@nextclaw/ui 0.18.2 → 0.18.4
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 +13 -0
- package/dist/assets/{appearance-settings-page-2ilQwMl0.js → appearance-settings-page-CEPxG1w0.js} +1 -1
- package/dist/assets/{channels-list-page-BPy2mXoD.js → channels-list-page-DKrUSeNz.js} +1 -1
- package/dist/assets/{chat-page-DDR-Q4Kf.js → chat-page-sGhIjLSr.js} +1 -1
- package/dist/assets/{desktop-update-config-Ds4pN7kz.js → desktop-update-config-VgvIATTT.js} +1 -1
- package/dist/assets/{index-C2N1bYyb.js → index-CtPLj_hk.js} +3 -3
- package/dist/assets/{model-config-page-B7QR33ED.js → model-config-page-DQ-iQFSO.js} +1 -1
- package/dist/assets/{provider-scoped-model-input-RWZz36z7.js → provider-scoped-model-input-BFzyywsF.js} +1 -1
- package/dist/assets/{providers-config-page-B5yakiZe.js → providers-config-page-DUYwVuYe.js} +1 -1
- package/dist/assets/remote-CNFQ6bFY.js +1 -0
- package/dist/assets/{runtime-config-page-Big45YWb.js → runtime-config-page-CaWoWoQk.js} +1 -1
- package/dist/assets/{search-config-page-QS-kqNDZ.js → search-config-page-ydeDD1OQ.js} +1 -1
- package/dist/assets/{secrets-config-page-DE3kmDHk.js → secrets-config-page-BZYqw8BF.js} +1 -1
- package/dist/index.html +1 -1
- package/package.json +3 -3
- package/src/features/right-panel-resources/utils/__tests__/right-panel-resource-uri.utils.test.ts +13 -0
- package/src/features/right-panel-resources/utils/right-panel-resource-uri.utils.ts +2 -2
- package/dist/assets/remote-BfRYDhkz.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/mermaid.core-BSf-ddRa.js","assets/preload-helper-D4M6sveU.js","assets/chunk-HOUHSVGY-DG_GJih_.js","assets/src-vgz8E_-O.js","assets/chunk-DseTPa7n.js","assets/chunk-Y2CYZVJY-D_B2ZRNt.js","assets/chunk-WYO6CB5R-mOJNzbWl.js","assets/chunk-ICXQ74PX-Drxk_6bE.js","assets/dist-DAPEIJbz.js","assets/chunk-Q4XR5HBZ-Da9BWfB6.js","assets/chunk-52WLFC77-698iC3BB.js","assets/line-CbyFs065.js","assets/path-DodfxcX7.js","assets/array-NADKd9aU.js","assets/chunk-7BUUIJ7U-DzptcytQ.js","assets/chunk-C7G6YPKG-Bw1BwwuY.js","assets/chunk-OGEWGWER-N25BzCmG.js","assets/chunk-ZGVPDNZ5-OJ8veMpK.js","assets/rough.esm-CUaa1Rbe.js","assets/chunk-FWX5IMBZ-B0SNoCmi.js","assets/chunk-VAUOI2AC-HLGIHQ6k.js","assets/chunk-ZIRB5QZD-SR_Nq_PP.js","assets/docx-preview-CoM4JK7_.js","assets/jszip.min-CkbBfwAQ.js","assets/aiden0z-pptx-renderer.es-C1nfBAXR.js","assets/doc-browser-D0arfzHY.js","assets/doc-browser-D73yN8ts.js","assets/dist-DyUY9uQ0.js","assets/react-D-jOo51s.js","assets/dist-IBUY9_9h.js","assets/search-B6mO7mmo.js","assets/book-open-BOJLGVsx.js","assets/navigation-link-DtPZZ_Q_.js","assets/host-capabilities-D9C4CBK5.js","assets/plus-B9V7Z_Eu.js","assets/refresh-cw-BQHORcAs.js","assets/x-BkjTUiww.js","assets/doc-browser-context-BM6Af8gN.js","assets/middleware-B3k-TSmZ.js","assets/model-config-page-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/mermaid.core-BSf-ddRa.js","assets/preload-helper-D4M6sveU.js","assets/chunk-HOUHSVGY-DG_GJih_.js","assets/src-vgz8E_-O.js","assets/chunk-DseTPa7n.js","assets/chunk-Y2CYZVJY-D_B2ZRNt.js","assets/chunk-WYO6CB5R-mOJNzbWl.js","assets/chunk-ICXQ74PX-Drxk_6bE.js","assets/dist-DAPEIJbz.js","assets/chunk-Q4XR5HBZ-Da9BWfB6.js","assets/chunk-52WLFC77-698iC3BB.js","assets/line-CbyFs065.js","assets/path-DodfxcX7.js","assets/array-NADKd9aU.js","assets/chunk-7BUUIJ7U-DzptcytQ.js","assets/chunk-C7G6YPKG-Bw1BwwuY.js","assets/chunk-OGEWGWER-N25BzCmG.js","assets/chunk-ZGVPDNZ5-OJ8veMpK.js","assets/rough.esm-CUaa1Rbe.js","assets/chunk-FWX5IMBZ-B0SNoCmi.js","assets/chunk-VAUOI2AC-HLGIHQ6k.js","assets/chunk-ZIRB5QZD-SR_Nq_PP.js","assets/docx-preview-CoM4JK7_.js","assets/jszip.min-CkbBfwAQ.js","assets/aiden0z-pptx-renderer.es-C1nfBAXR.js","assets/doc-browser-D0arfzHY.js","assets/doc-browser-D73yN8ts.js","assets/dist-DyUY9uQ0.js","assets/react-D-jOo51s.js","assets/dist-IBUY9_9h.js","assets/search-B6mO7mmo.js","assets/book-open-BOJLGVsx.js","assets/navigation-link-DtPZZ_Q_.js","assets/host-capabilities-D9C4CBK5.js","assets/plus-B9V7Z_Eu.js","assets/refresh-cw-BQHORcAs.js","assets/x-BkjTUiww.js","assets/doc-browser-context-BM6Af8gN.js","assets/middleware-B3k-TSmZ.js","assets/model-config-page-DQ-iQFSO.js","assets/api-BSsQ0I4l.js","assets/provider-scoped-model-input-BFzyywsF.js","assets/select-DToos7Rq.js","assets/loader-circle-C1fL3kBZ.js","assets/form-actions-Cpd7glh8.js","assets/skeleton-Bs2eO2CA.js","assets/config-hints-BcfVUMij.js","assets/appearance-settings-page-CEPxG1w0.js","assets/mcp-marketplace-page-D8V0GU4Y.js","assets/confirm-dialog-Bsg9A62_.js","assets/tag-chip-urB3N-kk.js","assets/chat-page-sGhIjLSr.js","assets/settings-2-ZAWXrq81.js","assets/search-config-page-ydeDD1OQ.js","assets/config-split-page-aUTKtWJu.js","assets/providers-config-page-DUYwVuYe.js","assets/channels-list-page-DKrUSeNz.js","assets/runtime-config-page-CaWoWoQk.js","assets/rotate-cw-DuCF-3PX.js","assets/save-BgiS2u-T.js","assets/desktop-update-config-VgvIATTT.js","assets/security-config-Ds_2SXBh.js","assets/secrets-config-page-BZYqw8BF.js","assets/mcp-marketplace-page-q6T-vKoH.js"])))=>i.map(i=>d[i]);
|
|
2
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,I as c,L as l,M as u,N as d,O as f,P as p,R as m,S as h,T as g,V as _,_ as v,a as y,b,d as x,f as S,g as C,h as w,i as T,j as E,k as D,m as O,n as k,o as A,r as j,s as M,t as N,v as P,w as ee,x as te,y as ne,z as re}from"./react-D-jOo51s.js";import{t as F}from"./preload-helper-D4M6sveU.js";import{a as ie,c as ae,d as oe,f as se,i as ce,l as le,n as ue,o as de,r as fe,s as pe,t as me,u as he}from"./navigation-link-DtPZZ_Q_.js";import{$ as ge,$t as _e,A as ve,An as ye,At as be,Bt as xe,C as Se,D as Ce,Dn as we,Dt as I,E as Te,En as Ee,Et as De,F as Oe,G as ke,Gt as Ae,Ht as je,I as Me,J as Ne,Jt as Pe,K as Fe,M as Ie,Mt as Le,N as Re,Nt as ze,O as Be,On as Ve,Ot as He,P as Ue,Pt as We,Q as Ge,Qt as Ke,Rt as qe,S as Je,T as Ye,Tn as Xe,Tt as Ze,U as Qe,Ut as $e,W as et,Wt as tt,X as nt,Xt as rt,Y as it,Z as at,Zt as ot,_ as st,_n as ct,_t as lt,a as ut,an as dt,at as ft,b as pt,bn as mt,bt as ht,c as gt,cn as L,ct as _t,d as vt,dt as yt,en as bt,et as xt,f as St,fn as Ct,ft as wt,g as Tt,gn as Et,gt as Dt,h as Ot,hn as kt,ht as At,i as jt,in as Mt,it as Nt,j as Pt,jt as Ft,k as It,kn as Lt,l as Rt,ln as zt,lt as Bt,m as Vt,mn as Ht,mt as Ut,n as Wt,nn as Gt,nt as Kt,o as qt,on as Jt,ot as Yt,p as Xt,pn as Zt,pt as Qt,q as $t,qt as en,r as tn,rn as R,rt as nn,s as rn,sn as an,st as on,t as sn,tn as cn,tt as ln,u as un,un as dn,ut as fn,v as pn,vn as mn,vt as hn,w as gn,wt as _n,x as vn,xn as yn,y as bn,yn as xn,yt as Sn,zt as Cn}from"./api-BSsQ0I4l.js";import{_ as wn,a as Tn,c as En,d as Dn,f as On,g as kn,h as An,i as jn,l as Mn,m as Nn,n as eee,o as Pn,p as Fn,r as In,s as Ln,u as Rn,v as zn}from"./mcp-marketplace-page-D8V0GU4Y.js";import{a as Bn,b as Vn,c as z,f as Hn,g as Un,h as Wn,i as Gn,l as Kn,o as qn,p as Jn,r as Yn,s as Xn,u as Zn,x as Qn,y as $n}from"./dist-DyUY9uQ0.js";import{C as er,D as tr,E as nr,O as rr,S as ir,T as ar,_ as or,a as sr,b as cr,c as lr,d as ur,f as dr,g as fr,h as pr,i as mr,l as hr,m as gr,n as _r,o as vr,p as yr,r as br,s as xr,t as Sr,u as Cr,v as wr,w as Tr,x as Er,y as Dr}from"./select-DToos7Rq.js";import{t as Or}from"./dist-IBUY9_9h.js";import{a as kr,c as Ar,d as jr,f as Mr,g as Nr,h as Pr,i as Fr,l as Ir,m as Lr,n as Rr,o as zr,p as Br,r as Vr,s as Hr,t as Ur,u as Wr}from"./confirm-dialog-Bsg9A62_.js";import{S as Gr,_ as Kr,a as qr,b as Jr,c as Yr,d as Xr,f as Zr,g as Qr,h as $r,i as ei,l as ti,m as ni,n as ri,o as B,p as ii,r as ai,s as oi,u as si,v as ci,x as li,y as ui}from"./doc-browser-D73yN8ts.js";import{n as di,t as fi}from"./search-B6mO7mmo.js";import{t as pi}from"./book-open-BOJLGVsx.js";import{t as mi}from"./loader-circle-C1fL3kBZ.js";import{t as hi}from"./plus-B9V7Z_Eu.js";import{t as gi}from"./refresh-cw-BQHORcAs.js";import{t as _i}from"./x-BkjTUiww.js";import{t as vi}from"./host-capabilities-D9C4CBK5.js";import{n as yi,t as bi}from"./middleware-B3k-TSmZ.js";import{t as xi}from"./skeleton-Bs2eO2CA.js";import{_ as Si,a as tee,c as Ci,d as wi,g as Ti,h as Ei,i as Di,l as Oi,n as ki,o as Ai,p as ji,r as Mi,s as Ni,t as Pi,u as Fi,v as Ii}from"./doc-browser-context-BM6Af8gN.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 Li=n((e=>{var t=i();e.createRoot=t.createRoot,e.hydrateRoot=t.hydrateRoot}));function Ri(e,t){let n=new Set(t);return e.filter(e=>!n.has(e))}function zi(e,t,n){let r=e.slice(0);return r[t]=n,r}var Bi=class extends ye{#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,Ee.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||!Lt(e,n)});!o&&!s||(o&&(this.#l=t,this.#i=n),this.#t=r,this.hasListeners()&&(o&&(Ri(e,n).forEach(e=>{e.destroy()}),Ri(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=Ve(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 Xe(this.#e,r);n.push({defaultedQueryOptions:r,observer:i})}),n}#p(e,t){let n=this.#i.indexOf(e);n!==-1&&(this.#t=zi(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)&&Ee.batch(()=>{this.listeners.forEach(e=>{e(this.#t)})})}}},V=e(_(),1);function Vi({queries:e,...t},n){let r=yn(n),i=xn(),a=mn(),o=V.useMemo(()=>e.map(e=>{let t=r.defaultQueryOptions(e);return t._optimisticResults=i?`isRestoring`:`optimistic`,t}),[e,r,i]);o.forEach(e=>{Ct(e),kt(e,a,r.getQueryCache().get(e.queryHash))}),ct(a);let[s]=V.useState(()=>new Bi(r,o,t)),[c,l,u]=s.getOptimisticResult(o,t.combine),d=!i&&t.subscribed!==!1;V.useSyncExternalStore(V.useCallback(e=>d?s.subscribe(Ee.batchCalls(e)):we,[s,d]),()=>s.getCurrentResult(),()=>s.getCurrentResult()),V.useEffect(()=>{s.setQueries(o,t)},[o,t,s]);let f=c.some((e,t)=>Ht(o[t],e))?c.flatMap((e,t)=>{let n=o[t];return n&&Ht(n,e)?Zt(n,new Xe(r,n),a):[]}):[];if(f.length>0)throw Promise.all(f);let p=c.find((e,t)=>{let n=o[t];return n&&Et({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 Hi=z(`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`}]]),Ui=z(`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`}]]),Wi=z(`ArrowDown`,[[`path`,{d:`M12 5v14`,key:`s699le`}],[`path`,{d:`m19 12-7 7-7-7`,key:`1idqje`}]]),Gi=z(`ArrowUpRight`,[[`path`,{d:`M7 7h10v10`,key:`1tivn9`}],[`path`,{d:`M7 17 17 7`,key:`1vkiza`}]]),Ki=z(`ArrowUp`,[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]),qi=z(`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`}]]),Ji=z(`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`}]]),Yi=z(`Bookmark`,[[`path`,{d:`m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z`,key:`1fy3hk`}]]),Xi=z(`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`}]]),Zi=z(`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`}]]),Qi=z(`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`}]]),$i=z(`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`}]]),ea=z(`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`}]]),ta=z(`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`}]]),na=z(`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`}]]),ra=z(`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`}]]),ia=z(`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`}]]),aa=z(`ChevronLeft`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),oa=z(`ChevronRight`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),sa=z(`ChevronsUp`,[[`path`,{d:`m17 11-5-5-5 5`,key:`e8nh98`}],[`path`,{d:`m17 18-5-5-5 5`,key:`2avn1x`}]]),ca=z(`CircleCheck`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),la=z(`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`}]]),ua=z(`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`}]]),da=z(`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`}]]),fa=z(`CirclePlay`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`polygon`,{points:`10 8 16 12 10 16 10 8`,key:`1cimsy`}]]),pa=z(`Clock3`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`polyline`,{points:`12 6 12 12 16.5 12`,key:`1aq6pp`}]]),ma=z(`Clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`polyline`,{points:`12 6 12 12 16 14`,key:`68esgv`}]]),ha=z(`Cloud`,[[`path`,{d:`M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z`,key:`p7xjir`}]]),ga=z(`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`}]]),_a=z(`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`}]]),va=z(`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`}]]),ya=z(`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`}]]),ba=z(`CornerDownRight`,[[`polyline`,{points:`15 10 20 15 15 20`,key:`1q7qjw`}],[`path`,{d:`M4 4v7a4 4 0 0 0 4 4h12`,key:`z08zvw`}]]),xa=z(`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`}]]),Sa=z(`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`}]]),Ca=z(`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`}]]),wa=z(`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`}]]),Ta=z(`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`}]]),Ea=z(`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`}]]),Da=z(`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`}]]),Oa=z(`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`}]]),ka=z(`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`}]]),Aa=z(`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`}]]),ja=z(`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`}]]),Ma=z(`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`}]]),Na=z(`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`}]]),Pa=z(`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`}]]),Fa=z(`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`}]]),Ia=z(`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`}]]),La=z(`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`}]]),Ra=z(`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`}]]),za=z(`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`}]]),Ba=z(`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`}]]),Va=z(`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`}]]),Ha=z(`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`}]]),Ua=z(`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`}]]),Wa=z(`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`}]]),Ga=z(`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`}]]),Ka=z(`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`}]]),qa=z(`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`}]]),Ja=z(`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`}]]),Ya=z(`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`}]]),Xa=z(`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`}]]),Za=z(`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`}]]),Qa=z(`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`}]]),$a=z(`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`}]]),eo=z(`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`}]]),to=z(`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`}]]),no=z(`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`}]]),ro=z(`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`}]]),io=z(`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`}]]),ao=z(`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`}]]),oo=z(`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`}]]),so=z(`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`}]]),co=z(`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`}]]),lo=z(`MessageCircle`,[[`path`,{d:`M7.9 20A9 9 0 1 0 4 16.1L2 22Z`,key:`vv11sd`}]]),uo=z(`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`}]]),fo=z(`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`}]]),po=z(`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`}]]),mo=z(`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`}]]),ho=z(`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`}]]),go=z(`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`}]]),_o=z(`Minus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}]]),vo=z(`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`}]]),yo=z(`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`}]]),bo=z(`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`}]]),xo=z(`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`}]]),So=z(`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`}]]),Co=z(`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`}]]),wo=z(`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`}]]),To=z(`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`}]]),Eo=z(`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`}]]),Do=z(`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`}]]),Oo=z(`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`}]]),ko=z(`Play`,[[`polygon`,{points:`6 3 20 12 6 21 6 3`,key:`1oa8hb`}]]),Ao=z(`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`}]]),jo=z(`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`}]]),Mo=z(`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`}]]),No=z(`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`}]]),Po=z(`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`}]]),Fo=z(`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`}]]),Io=z(`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`}]]),Lo=z(`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`}]]),Ro=z(`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`}]]),zo=z(`Smartphone`,[[`rect`,{width:`14`,height:`20`,x:`5`,y:`2`,rx:`2`,ry:`2`,key:`1yt0o3`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}]]),Bo=z(`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`}]]),Vo=z(`SquareCheck`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),Ho=z(`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`}]]),Uo=z(`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`}]]),Wo=z(`Square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),Go=z(`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`}]]),Ko=z(`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`}]]),qo=z(`Terminal`,[[`polyline`,{points:`4 17 10 11 4 5`,key:`akl6gq`}],[`line`,{x1:`12`,x2:`20`,y1:`19`,y2:`19`,key:`q2wloq`}]]),Jo=z(`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`}]]),Yo=z(`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`}]]),Xo=z(`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`}]]),Zo=z(`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`}]]),Qo=z(`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`}]]),$o=z(`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`}]]),es=z(`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`}]]),ts=z(`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`}]]),ns=z(`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`}]]),rs=Li(),H=re(),is={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 as({status:e,label:t,className:n}){let r=is[e];return(0,H.jsxs)(`div`,{className:c(`inline-flex shrink-0 items-center gap-1.5 whitespace-nowrap rounded-full px-2 py-0.5`,r.bg,n),children:[(0,H.jsx)(`span`,{className:c(`h-1.5 w-1.5 rounded-full`,r.dot)}),(0,H.jsx)(`span`,{className:c(`text-[11px] font-medium`,r.text),children:t})]})}function os(){return dn({queryKey:ls,queryFn:Vt,staleTime:5e3,refetchOnWindowFocus:!0})}function ss(e){let{label:t,muted:n,value:r}=e;return(0,H.jsxs)(`div`,{className:`flex items-start justify-between gap-4 py-2 text-sm`,children:[(0,H.jsx)(`span`,{className:`text-muted-foreground`,children:t}),(0,H.jsx)(`span`,{className:n?`text-right text-muted-foreground`:`text-right text-foreground`,children:r==null||r===``?`-`:String(r)})]})}function cs(){let e=q9(),t=os(),n=t.data,r=_s(e=>e.actionLabel),i=(0,V.useMemo)(()=>Cs(n),[n]),a=!!r,o=n?.runtime?.deviceName?.trim()||n?.settings.deviceName?.trim()||T(`remoteDeviceNameAuto`),s=!!(n?.account.loggedIn&&gs(n)),{hero:c,issueHint:l}=i;return(0,V.useEffect)(()=>{e.remoteAccessManager.syncStatus(n)},[e,n]),t.isLoading&&!n?(0,H.jsx)(Ke,{title:T(`remotePageTitle`),description:T(`remotePageDescription`),children:(0,H.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:T(`remoteLoading`)})}):(0,H.jsx)(Ke,{title:T(`remotePageTitle`),description:T(`remotePageDescription`),children:(0,H.jsxs)(`div`,{className:`grid gap-7 xl:grid-cols-[1.2fr_0.8fr]`,children:[(0,H.jsx)(ot,{title:c.title,description:c.description,actions:(0,H.jsx)(as,{status:c.badgeStatus,label:c.badgeLabel}),children:(0,H.jsx)(rt,{children:(0,H.jsxs)(`div`,{className:`space-y-5 p-4`,children:[(0,H.jsxs)(kn,{tone:`neutral`,children:[(0,H.jsx)(ss,{label:T(`remoteSignedInAccount`),value:n?.account.email}),(0,H.jsx)(ss,{label:T(`remoteDeviceName`),value:o}),(0,H.jsx)(ss,{label:T(`remoteConnectionStatus`),value:c.badgeLabel}),(0,H.jsx)(ss,{label:T(`remoteLastConnectedAt`),value:n?.runtime?.lastConnectedAt?j(n.runtime.lastConnectedAt):`-`,muted:!0})]}),(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[i.primaryAction?(0,H.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,H.jsx)(jo,{className:`mr-2 h-4 w-4`}):null,r||i.primaryAction.label]}):null,(0,H.jsxs)(R,{variant:`outline`,onClick:()=>void e.accountManager.openNextClawWeb(),disabled:a||!s,children:[(0,H.jsx)(Bo,{className:`mr-2 h-4 w-4`}),T(`remoteOpenDeviceList`)]}),n?.settings.enabled?(0,H.jsx)(R,{variant:`outline`,onClick:()=>void e.remoteAccessManager.disableRemoteAccess(n),disabled:a,children:T(`remoteDisable`)}):null]}),i.shouldShowIssueHint&&l?(0,H.jsx)(kn,{tone:`warning`,title:l.title,description:l.body}):null,(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:T(`remoteOpenWebHint`)})]})})}),(0,H.jsx)(ot,{title:(0,H.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(eo,{className:`h-4 w-4 text-primary`}),T(`remoteDeviceSectionTitle`)]}),description:T(`remoteDeviceSectionDescription`),children:(0,H.jsx)(rt,{children:(0,H.jsxs)(`div`,{className:`space-y-5 p-4`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,H.jsx)(as,{status:n?.account.loggedIn?`ready`:`inactive`,label:n?.account.loggedIn?T(`remoteAccountConnected`):T(`remoteAccountNotConnected`)}),(0,H.jsx)(as,{status:n?.settings.enabled?`active`:`inactive`,label:n?.settings.enabled?T(`remoteEnabled`):T(`remoteStateDisabled`)}),(0,H.jsx)(as,{status:n?.service.running?`active`:`inactive`,label:n?.service.running?T(`remoteServiceRunning`):T(`remoteServiceStopped`)})]}),(0,H.jsxs)(kn,{tone:`neutral`,children:[(0,H.jsx)(ss,{label:T(`remoteDeviceName`),value:o}),(0,H.jsx)(ss,{label:T(`remoteConnectionStatus`),value:c.badgeLabel}),(0,H.jsx)(ss,{label:T(`remoteLastConnectedAt`),value:n?.runtime?.lastConnectedAt?j(n.runtime.lastConnectedAt):`-`,muted:!0})]}),(0,H.jsx)(kn,{tone:`neutral`,borderStyle:`dashed`,description:n?.account.loggedIn?T(`remoteOpenWebHint`):T(`remoteStatusNeedsSignInDescription`),className:`text-sm`})]})})})]})})}var ls=[`remote-status`],us=`https://platform.nextclaw.io`,ds=`https://nextclaw-platform-console.pages.dev`,fs=async()=>await Jt.fetchQuery({queryKey:ls,queryFn:Vt,staleTime:5e3}),ps=async()=>(await Jt.invalidateQueries({queryKey:ls}),await fs()),ms=(e,t)=>t?.trim()||e?.settings.platformApiBase?.trim()||e?.account.apiBase?.trim()||void 0;function hs(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 us;if(n.hostname.includes(`nextclaw-provider-gateway-api`)&&n.hostname.endsWith(`.workers.dev`))return ds}var gs=e=>hs(e?.account.apiBase)||hs(e?.settings.platformApiBase)||hs(e?.platformBase)||hs(e?.account.platformBase)||void 0,_s=N(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})})),vs=class{constructor(e){this.params=e,this.syncStatus=e=>{if(!e)return;let t=_s.getState();t.draftTouched||t.actionLabel||this.hydrateDraftFromStatus(e)},this.setEnabled=e=>{_s.getState().setEnabled(e)},this.setDeviceName=e=>{_s.getState().setDeviceName(e)},this.setPlatformApiBase=e=>{_s.getState().setPlatformApiBase(e)},this.setAdvancedOpen=e=>{_s.getState().setAdvancedOpen(e)},this.enableRemoteAccess=async e=>{let t=e??await ps(),n=_s.getState(),r=await this.ensureRemoteAccount(t,n.platformApiBase);await this.applyEnabledState(!0,r)},this.disableRemoteAccess=async e=>{let t=e??await ps();await this.applyEnabledState(!1,t)},this.repairRemoteAccess=async e=>{let t=e??await ps(),n=(await this.ensureRemoteAccount(t)).service.running?`restart`:`start`;await this.runManagedAction({actionLabel:T(n===`restart`?`remoteActionRestarting`:`remoteActionStarting`),job:async()=>{await St(n);let e=await ps();this.hydrateDraftFromStatus(e)},successMessage:T(`remoteServiceRecovered`)})},this.reauthorizeRemoteAccess=async e=>{let t=e??await ps(),n=await this.params.accountManager.startBrowserSignInAndWait({status:t,apiBase:_s.getState().platformApiBase});await this.repairRemoteAccess(n)},this.saveAdvancedSettings=async e=>{let t=e??await ps(),n=_s.getState();await this.runManagedAction({actionLabel:T(`remoteActionSavingAdvanced`),job:async()=>{await bn({enabled:n.enabled,deviceName:n.deviceName.trim(),platformApiBase:n.platformApiBase.trim()});let e=await ps();this.hydrateDraftFromStatus(e)},successMessage:t.settings.enabled===n.enabled?T(`remoteSettingsSaved`):T(`remoteAdvancedSaved`)})},this.runDoctor=async()=>{await this.runManagedAction({actionLabel:T(`remoteDoctorRunning`),job:async()=>{let e=await Xt();_s.getState().setDoctor(e)},successMessage:T(`remoteDoctorCompleted`)})},this.startService=async()=>{await this.runServiceAction(`start`,T(`remoteActionStarting`))},this.restartService=async()=>{await this.runServiceAction(`restart`,T(`remoteActionRestarting`))},this.stopService=async()=>{await this.runServiceAction(`stop`,T(`remoteActionStopping`))},this.applyEnabledState=async(e,t)=>{let n=_s.getState();await this.runManagedAction({actionLabel:T(e?`remoteActionEnabling`:`remoteActionDisabling`),job:async()=>{await bn({enabled:e,deviceName:n.deviceName.trim(),platformApiBase:n.platformApiBase.trim()});let r=await ps();this.hydrateDraftFromStatus(r),e?await St(r.service.running?`restart`:`start`):t.service.running&&await St(`restart`);let i=await ps();this.hydrateDraftFromStatus(i)},successMessage:T(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 St(e),n=await ps();this.hydrateDraftFromStatus(n),L.success(t.message)}})},this.hydrateDraftFromStatus=e=>{_s.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;_s.getState().beginAction(t);try{await n(),r&&L.success(r)}catch(e){let t=e instanceof Error?e.message:T(`error`);throw L.error(t),e}finally{_s.getState().finishAction()}}}},ys=[/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 bs(e){return e?.runtime?.lastError?.trim()||``}function xs(e){let t=T(`remoteStatusIssueDetailGeneric`),n=bs(e);return n?`${t} (${n})`:t}function Ss(e){if(!e?.settings.enabled)return!1;let t=bs(e);return ys.some(e=>e.test(t))}function Cs(e){return Ss(e)?{hero:{badgeStatus:`warning`,badgeLabel:T(`remoteStateReauthorizationRequired`),title:T(`remoteStatusReauthorizationTitle`),description:T(`remoteStatusReauthorizationDescription`)},primaryAction:{kind:`reauthorize`,label:T(`remoteReauthorizeNow`),showRefreshIcon:!1},issueHint:{title:T(`remoteStatusRecoveryTitle`),body:T(`remoteStatusReauthorizationHint`)},shouldShowIssueHint:!0,requiresReauthorization:!0}:e?.account.loggedIn?e.settings.enabled?e.service.running?e.runtime?.state===`connected`?{hero:{badgeStatus:`ready`,badgeLabel:T(`statusReady`),title:T(`remoteStatusReadyTitle`),description:T(`remoteStatusReadyDescription`)},primaryAction:{kind:`repair`,label:T(`remoteReconnectNow`),showRefreshIcon:!0},issueHint:null,shouldShowIssueHint:!1,requiresReauthorization:!1}:e.runtime?.state===`connecting`?{hero:{badgeStatus:`active`,badgeLabel:T(`connecting`),title:T(`remoteStatusConnectingTitle`),description:T(`remoteStatusConnectingDescription`)},primaryAction:{kind:`repair`,label:T(`remoteReconnectNow`),showRefreshIcon:!0},issueHint:null,shouldShowIssueHint:!1,requiresReauthorization:!1}:{hero:{badgeStatus:`warning`,badgeLabel:T(`remoteStateDisconnected`),title:T(`remoteStatusIssueTitle`),description:T(`remoteStatusIssueDescription`)},primaryAction:{kind:`repair`,label:T(`remoteReconnectNow`),showRefreshIcon:!0},issueHint:{title:T(`remoteStatusRecoveryTitle`),body:xs(e)},shouldShowIssueHint:!!(e.settings.enabled&&e.account.loggedIn),requiresReauthorization:!1}:{hero:{badgeStatus:`warning`,badgeLabel:T(`remoteServiceStopped`),title:T(`remoteStatusNeedsServiceTitle`),description:T(`remoteStatusNeedsServiceDescription`)},primaryAction:{kind:`repair`,label:T(`remoteReconnectNow`),showRefreshIcon:!0},issueHint:{title:T(`remoteStatusRecoveryTitle`),body:T(`remoteStatusIssueDetailServiceStopped`)},shouldShowIssueHint:!0,requiresReauthorization:!1}:{hero:{badgeStatus:`inactive`,badgeLabel:T(`statusInactive`),title:T(`remoteStatusNeedsEnable`),description:T(`remoteStatusNeedsEnableDescription`)},primaryAction:{kind:`enable`,label:T(`remoteEnableNow`),showRefreshIcon:!1},issueHint:null,shouldShowIssueHint:!1,requiresReauthorization:!1}:{hero:{badgeStatus:`setup`,badgeLabel:T(`statusSetup`),title:T(`remoteStatusNeedsSignIn`),description:T(`remoteStatusNeedsSignInDescription`)},primaryAction:{kind:`sign-in-enable`,label:T(`remoteSignInAndEnable`),showRefreshIcon:!1},issueHint:null,shouldShowIssueHint:!1,requiresReauthorization:!1}}var ws=N(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 Ts({label:e,value:t}){return(0,H.jsxs)(`div`,{className:`flex items-start justify-between gap-4 py-2 text-sm`,children:[(0,H.jsx)(`span`,{className:`text-gray-500`,children:e}),(0,H.jsx)(`span`,{className:`text-right text-gray-900`,children:t?.trim()||`-`})]})}function Es(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,H.jsxs)(`div`,{className:`space-y-4`,children:[(0,H.jsx)(kn,{tone:`success`,title:T(`accountPanelSignedInTitle`),description:T(`accountPanelSignedInDescription`)}),(0,H.jsxs)(kn,{tone:`neutral`,children:[(0,H.jsx)(Ts,{label:T(`remoteAccountEmail`),value:t}),(0,H.jsx)(Ts,{label:T(`remoteAccountUsername`),value:n}),(0,H.jsx)(Ts,{label:T(`remoteAccountRole`),value:r})]}),n?(0,H.jsx)(`p`,{className:`text-xs text-gray-500`,children:T(`remoteAccountUsernameLockedHelp`)}):(0,H.jsxs)(kn,{tone:`warning`,title:T(`remoteAccountUsernameRequiredTitle`),description:T(`remoteAccountUsernameRequiredDescription`),children:[(0,H.jsxs)(`div`,{className:`mt-4 space-y-2`,children:[(0,H.jsx)(cn,{htmlFor:`account-panel-username`,children:T(`remoteAccountUsername`)}),(0,H.jsx)(Gt,{id:`account-panel-username`,value:o,onChange:e=>s(e.target.value),placeholder:T(`remoteAccountUsernamePlaceholder`),autoCapitalize:`none`,autoCorrect:`off`,spellCheck:!1})]}),(0,H.jsx)(`div`,{className:`mt-4 flex flex-wrap gap-3`,children:(0,H.jsx)(R,{disabled:!i,onClick:()=>void c(),children:T(a?`remoteAccountUsernameSaving`:`remoteAccountUsernameSave`)})})]}),(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[(0,H.jsxs)(R,{onClick:()=>void l(),children:[(0,H.jsx)(Bo,{className:`mr-2 h-4 w-4`}),T(`remoteOpenDeviceList`)]}),(0,H.jsxs)(R,{variant:`outline`,onClick:()=>void u(),children:[(0,H.jsx)(so,{className:`mr-2 h-4 w-4`}),T(`remoteLogout`)]})]})]})}function Ds(e){let{authSessionId:t,authExpiresAt:n,authStatusMessage:r,authVerificationUri:i,onStartBrowserSignIn:a,onResumeBrowserSignIn:o}=e;return(0,H.jsxs)(`div`,{className:`space-y-4`,children:[(0,H.jsx)(kn,{tone:`neutral`,title:T(`accountPanelSignedOutTitle`),description:T(`accountPanelSignedOutDescription`),children:t?(0,H.jsxs)(`div`,{className:`mt-3 border-t border-white/80 pt-3`,children:[(0,H.jsx)(Ts,{label:T(`remoteBrowserAuthSession`),value:t}),(0,H.jsx)(Ts,{label:T(`remoteBrowserAuthExpiresAt`),value:n?j(n):`-`})]}):null}),r?(0,H.jsx)(`p`,{className:`text-sm text-gray-600`,children:r}):null,(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[(0,H.jsx)(R,{onClick:()=>void a(),children:T(t?`remoteBrowserAuthActionRetry`:`remoteBrowserAuthAction`)}),i?(0,H.jsx)(R,{variant:`outline`,onClick:()=>void o(),children:T(`remoteBrowserAuthResume`)}):null]})]})}function Os(){let e=U9(),t=os(),n=ws(e=>e.panelOpen),r=ws(e=>e.authSessionId),i=ws(e=>e.authVerificationUri),a=ws(e=>e.authExpiresAt),o=ws(e=>e.authStatusMessage),s=t.data,[c,l]=(0,V.useState)(``),[u,d]=(0,V.useState)(!1);(0,V.useEffect)(()=>{e.accountManager.syncRemoteStatus(s)},[e,s]);let f=!u&&c.trim().length>0&&!s?.account.username;return(0,H.jsx)(Rr,{open:n,onOpenChange:t=>t?e.accountManager.openAccountPanel():e.accountManager.closeAccountPanel(),children:(0,H.jsxs)(Vr,{className:`max-w-xl`,children:[(0,H.jsxs)(zr,{children:[(0,H.jsxs)(Hr,{className:`flex items-center gap-2`,children:[(0,H.jsx)(Qa,{className:`h-5 w-5 text-primary`}),T(`accountPanelTitle`)]}),(0,H.jsx)(Fr,{children:T(`accountPanelDescription`)})]}),s?.account.loggedIn?(0,H.jsx)(Es,{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,H.jsx)(Ds,{authSessionId:r,authExpiresAt:a,authStatusMessage:o,authVerificationUri:i,onStartBrowserSignIn:()=>e.accountManager.startBrowserSignIn(),onResumeBrowserSignIn:()=>e.accountManager.resumeBrowserSignIn()})]})})}var ks=V.forwardRef(({className:e,hover:t=!0,surface:n=`raised`,...r},i)=>(0,H.jsx)(`div`,{ref:i,className:c(`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 As=V.forwardRef(({className:e,...t},n)=>(0,H.jsx)(`div`,{ref:n,className:c(`flex flex-col space-y-1.5 p-6`,e),...t}));As.displayName=`CardHeader`;var js=V.forwardRef(({className:e,...t},n)=>(0,H.jsx)(`h3`,{ref:n,className:c(`text-[15px] font-semibold leading-tight tracking-tight text-foreground`,e),...t}));js.displayName=`CardTitle`;var Ms=V.forwardRef(({className:e,...t},n)=>(0,H.jsx)(`p`,{ref:n,className:c(`text-[13px] text-muted-foreground leading-relaxed`,e),...t}));Ms.displayName=`CardDescription`;var Ns=V.forwardRef(({className:e,...t},n)=>(0,H.jsx)(`div`,{ref:n,className:c(`p-6 pt-0`,e),...t}));Ns.displayName=`CardContent`;var Ps=V.forwardRef(({className:e,...t},n)=>(0,H.jsx)(`div`,{ref:n,className:c(`flex items-center justify-between p-6 pt-0`,e),...t}));Ps.displayName=`CardFooter`;function Fs({username:e}){let t=Le(),[n,r]=(0,V.useState)(e??``),[i,a]=(0,V.useState)(``),o=n.trim().length>0&&i.length>0&&!t.isPending;return(0,H.jsx)(`main`,{className:`flex min-h-screen items-center justify-center bg-secondary px-6 py-10`,children:(0,H.jsxs)(ks,{hover:!1,className:`w-full max-w-md shadow-card-hover`,children:[(0,H.jsxs)(As,{children:[(0,H.jsx)(`p`,{className:`text-xs font-semibold uppercase tracking-[0.24em] text-gray-500`,children:T(`authBrand`)}),(0,H.jsx)(js,{className:`text-2xl`,children:T(`authLoginTitle`)}),(0,H.jsx)(Ms,{children:T(`authLoginDescription`)})]}),(0,H.jsx)(Ns,{children:(0,H.jsxs)(`form`,{className:`space-y-4`,onSubmit:e=>{e?.preventDefault(),o&&t.mutate({username:n.trim(),password:i})},children:[(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(`label`,{className:`text-sm font-medium text-gray-800`,children:T(`authUsername`)}),(0,H.jsx)(Gt,{value:n,onChange:e=>r(e.target.value),placeholder:T(`authUsernamePlaceholder`),autoFocus:!0})]}),(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(`label`,{className:`text-sm font-medium text-gray-800`,children:T(`authPassword`)}),(0,H.jsx)(Gt,{type:`password`,value:i,onChange:e=>a(e.target.value),placeholder:T(`authPasswordPlaceholder`)})]}),(0,H.jsx)(R,{type:`submit`,className:`w-full`,disabled:!o,children:t.isPending?T(`authLoggingIn`):T(`authLoginAction`)})]})})]})})}var Is=class{constructor(){this.authPollTimerId=null,this.browserSignInCompletion=null,this.openAccountPanel=()=>{ws.getState().openPanel()},this.closeAccountPanel=()=>{ws.getState().closePanel()},this.syncRemoteStatus=e=>{e?.account.loggedIn&&(this.clearPollTimer(),this.resolveBrowserSignIn(e),ws.getState().clearBrowserAuth())},this.ensureSignedIn=async e=>{let t=e?.status??await fs();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 st({apiBase:ms(e?.status??await fs(),t)});ws.getState().beginBrowserAuth({sessionId:n.sessionId,verificationUri:n.verificationUri,expiresAt:n.expiresAt,intervalMs:n.intervalMs,statusMessage:T(`remoteBrowserAuthWaiting`)}),(await vi.openExternalUrl(n.verificationUri)).opened||ws.getState().setAuthStatusMessage(T(`remoteBrowserAuthPopupBlocked`)),this.scheduleBrowserAuthPoll()}catch(e){let t=e instanceof Error?e.message:T(`remoteBrowserAuthStartFailed`);this.rejectBrowserSignIn(e),L.error(`${T(`remoteBrowserAuthStartFailed`)}: ${t}`)}},this.resumeBrowserSignIn=async()=>{let e=ws.getState().authVerificationUri;e&&await vi.openExternalUrl(e)},this.logout=async()=>{try{await Ot(),this.rejectBrowserSignIn(Error(`Signed out before browser sign-in completed.`)),ws.getState().clearBrowserAuth(),await ps(),L.success(T(`remoteLogoutSuccess`))}catch(e){let t=e instanceof Error?e.message:T(`remoteLogoutFailed`);L.error(`${T(`remoteLogoutFailed`)}: ${t}`)}},this.updateUsername=async e=>{try{await pn({username:e.trim()}),await ps(),L.success(T(`remoteAccountUsernameSetSuccess`))}catch(e){let t=e instanceof Error?e.message:T(`remoteAccountUsernameSetFailed`);L.error(`${T(`remoteAccountUsernameSetFailed`)}: ${t}`)}},this.openNextClawWeb=async(e=`/`)=>{let t=gs(await fs());if(!t){L.error(T(`remoteOpenWebUnavailable`));return}let n=new URL(e,`${t.replace(/\/+$/,``)}/`).toString();await vi.openExternalUrl(n)},this.scheduleBrowserAuthPoll=()=>{this.clearPollTimer();let{authSessionId:e,authPollIntervalMs:t}=ws.getState();e&&(this.authPollTimerId=window.setTimeout(async()=>{await this.pollBrowserSignIn()},t))},this.pollBrowserSignIn=async()=>{let e=ws.getState();if(e.authSessionId)try{let t=await fs(),n=await Tt({sessionId:e.authSessionId,apiBase:ms(t)});if(n.status===`pending`){ws.getState().updateBrowserAuth({statusMessage:T(`remoteBrowserAuthWaiting`),intervalMs:n.nextPollMs??1500}),this.scheduleBrowserAuthPoll();return}if(n.status===`expired`){this.clearPollTimer(),this.rejectBrowserSignIn(Error(n.message||T(`remoteBrowserAuthExpired`))),ws.getState().clearBrowserAuth(),L.error(n.message||T(`remoteBrowserAuthExpired`));return}ws.getState().setAuthStatusMessage(T(`remoteBrowserAuthCompleted`));let r=await ps();this.clearPollTimer(),this.resolveBrowserSignIn(r),ws.getState().clearBrowserAuth(),L.success(T(`remoteLoginSuccess`))}catch(e){this.clearPollTimer(),this.rejectBrowserSignIn(e),ws.getState().clearBrowserAuth();let t=e instanceof Error?e.message:T(`remoteBrowserAuthPollFailed`);L.error(`${T(`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=ws.getState();return{sessionId:e.authSessionId,expiresAt:e.authExpiresAt?j(e.authExpiresAt):`-`}}}},Ls=`nextclaw.app.viewport-layout`,Rs=1;function zs(e){return typeof e!=`number`||!Number.isFinite(e)?`desktop`:e<=767?`mobile`:`desktop`}function Bs(){let e=typeof window>`u`?null:window.innerWidth??null;return{mode:zs(e),width:e,isSidebarCollapsed:!1}}function Vs(e){if(!e||typeof e!=`object`)return null;let{isSidebarCollapsed:t}=e;return typeof t==`boolean`?t:null}var Hs=N()(yi(()=>Bs(),{name:Ls,version:Rs,storage:bi(()=>window.localStorage),partialize:e=>({isSidebarCollapsed:e.isSidebarCollapsed}),merge:(e,t)=>{let n=Vs(e);return n===null?t:{...t,isSidebarCollapsed:n}}})),Us=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=()=>Hs.getState(),this.setSidebarCollapsed=e=>{Hs.setState({isSidebarCollapsed: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=()=>{Hs.setState(e=>({isSidebarCollapsed:!e.isSidebarCollapsed}))},this.resetForTests=()=>{this.consumerCount=0,this.stop(),Hs.setState(Bs())},this.handleViewportChange=()=>{this.syncFromWindow()},this.syncFromWindow=()=>{if(typeof window>`u`)return;let e=window.innerWidth??null;Hs.setState({width:e,mode:zs(e)})}}};function Ws({parentSessionLabel:e,onGoToParentSession:t}){if(!e)return null;let n=e.trim();return(0,H.jsx)(`div`,{className:`bg-background/75 px-4 py-2 backdrop-blur-sm sm:px-5`,children:(0,H.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,H.jsx)(di,{className:`h-3.5 w-3.5`}),(0,H.jsxs)(`span`,{children:[T(`chatBackToParent`),n?` · ${n}`:``]})]})})}function Gs({layoutMode:e,actions:t,leading:n,onBackToList:r,projectBadge:i,sessionTypeBadge:a,shouldShow:o,title:s,titleContent:l}){let u=e===`mobile`;return(0,H.jsxs)(`div`,{"data-testid":`chat-conversation-header`,className:c(`bg-background/80 backdrop-blur-sm flex items-center justify-between shrink-0 overflow-hidden transition-colors duration-200`,u?`px-3 sm:px-3`:`px-4 sm:px-5`,o?`opacity-100`:`h-0 py-0 opacity-0`,o&&(u?`min-h-12 pb-2 pt-2`:`h-[52px]`)),style:u&&o?{paddingTop:`calc(env(safe-area-inset-top, 0px) + 0.5rem)`}:void 0,children:[(0,H.jsxs)(`div`,{className:`min-w-0 flex-1 flex items-center gap-2`,children:[u&&r?(0,H.jsx)(B,{icon:(0,H.jsx)(di,{className:`h-4 w-4`}),label:T(`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,l??(0,H.jsx)(`span`,{className:`text-sm font-medium text-foreground truncate`,children:s}),a,i]}),t]})}var Ks=`Popover`,[qs,nee]=$n(Ks,[Xn]),Js=Xn(),[Ys,Xs]=qs(Ks),Zs=e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=Js(t),c=V.useRef(null),[l,u]=V.useState(!1),[d,f]=Wn({prop:r,defaultProp:i??!1,onChange:a,caller:Ks});return(0,H.jsx)(qn,{...s,children:(0,H.jsx)(Ys,{scope:t,contentId:Un(),triggerRef:c,open:d,onOpenChange:f,onOpenToggle:V.useCallback(()=>f(e=>!e),[f]),hasCustomAnchor:l,onCustomAnchorAdd:V.useCallback(()=>u(!0),[]),onCustomAnchorRemove:V.useCallback(()=>u(!1),[]),modal:o,children:n})})};Zs.displayName=Ks;var Qs=`PopoverAnchor`,$s=V.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=Xs(Qs,n),a=Js(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:s}=i;return V.useEffect(()=>(o(),()=>s()),[o,s]),(0,H.jsx)(Yn,{...a,...r,ref:t})});$s.displayName=Qs;var ec=`PopoverTrigger`,tc=V.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=Xs(ec,n),a=Js(n),o=Vn(t,i.triggerRef),s=(0,H.jsx)(Hn.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.contentId,"data-state":gc(i.open),...r,ref:o,onClick:Qn(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?s:(0,H.jsx)(Yn,{asChild:!0,...a,children:s})});tc.displayName=ec;var nc=`PopoverPortal`,[rc,ic]=qs(nc,{forceMount:void 0}),ac=e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=Xs(nc,t);return(0,H.jsx)(rc,{scope:t,forceMount:n,children:(0,H.jsx)(Or,{present:n||a.open,children:(0,H.jsx)(Kn,{asChild:!0,container:i,children:r})})})};ac.displayName=nc;var oc=`PopoverContent`,sc=V.forwardRef((e,t)=>{let n=ic(oc,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=Xs(oc,e.__scopePopover);return(0,H.jsx)(Or,{present:r||a.open,children:a.modal?(0,H.jsx)(lc,{...i,ref:t}):(0,H.jsx)(uc,{...i,ref:t})})});sc.displayName=oc;var cc=Jn(`PopoverContent.RemoveScroll`),lc=V.forwardRef((e,t)=>{let n=Xs(oc,e.__scopePopover),r=V.useRef(null),i=Vn(t,r),a=V.useRef(!1);return V.useEffect(()=>{let e=r.current;if(e)return ar(e)},[]),(0,H.jsx)(nr,{as:cc,allowPinchZoom:!0,children:(0,H.jsx)(dc,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Qn(e.onCloseAutoFocus,e=>{e.preventDefault(),a.current||n.triggerRef.current?.focus()}),onPointerDownOutside:Qn(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;a.current=t.button===2||n},{checkForDefaultPrevented:!1}),onFocusOutside:Qn(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})}),uc=V.forwardRef((e,t)=>{let n=Xs(oc,e.__scopePopover),r=V.useRef(!1),i=V.useRef(!1);return(0,H.jsx)(dc,{...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()}})}),dc=V.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=Xs(oc,n),p=Js(n);return tr(),(0,H.jsx)(rr,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,H.jsx)(Zn,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>f.onOpenChange(!1),children:(0,H.jsx)(Bn,{"data-state":gc(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)`}})})})}),fc=`PopoverClose`,pc=V.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=Xs(fc,n);return(0,H.jsx)(Hn.button,{type:`button`,...r,ref:t,onClick:Qn(e.onClick,()=>i.onOpenChange(!1))})});pc.displayName=fc;var mc=`PopoverArrow`,hc=V.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=Js(n);return(0,H.jsx)(Gn,{...i,...r,ref:t})});hc.displayName=mc;function gc(e){return e?`open`:`closed`}var _c=Zs,vc=$s,yc=tc,bc=ac,xc=sc,Sc=`2rem`;function Cc(e){return`min(${e}, max(0px, calc(var(--radix-popover-content-available-height, 100vh) - ${Sc})))`}var wc=Cc(`24rem`),Tc=_c,Ec=yc,Dc=vc,Oc=V.forwardRef(({className:e,sideOffset:t=8,align:n=`start`,collisionPadding:r=12,style:i,...a},o)=>(0,H.jsx)(bc,{children:(0,H.jsx)(xc,{ref:o,sideOffset:t,align:n,collisionPadding:r,className:c(`z-[var(--z-popover,10100)] 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=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,e),style:{maxHeight:wc,...i},...a})}));Oc.displayName=xc.displayName;function kc(){let e=yn();return(0,V.useCallback)(async t=>{let{invalidateSessionSkills:n=!0,sessionKey:r,patch:i,successMessage:a}=t;try{Je(e,await Oe(r,i)),n&&await e.invalidateQueries({queryKey:[`ncp-session-skills`,r]}),a!==null&&L.success(a??T(`configSavedApplied`))}catch(e){throw L.error(T(`configSaveFailed`)+`: `+(e instanceof Error?e.message:String(e))),e}},[e])}function Ac(){let e=kc();return async t=>{await e({sessionKey:t.sessionKey,patch:{label:t.label},successMessage:T(`configSavedApplied`)})}}function jc(){let e=kc();return async t=>{let{persistToServer:n,projectRoot:r,sessionKey:i}=t,a=T(r?`chatSessionProjectUpdated`:`chatSessionProjectCleared`);if(!n){L.success(a);return}await e({sessionKey:i,patch:{projectRoot:r},successMessage:a})}}function Mc({icon:e,label:t,onClick:n,disabled:r=!1,destructive:i=!1}){return(0,H.jsxs)(`button`,{type:`button`,className:c(`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,H.jsx)(e,{className:`h-4 w-4 shrink-0`}),(0,H.jsx)(`span`,{children:t})]})}function Nc(e){try{return JSON.stringify(e??{},null,2)}catch{return`{}`}}function Pc({open:e,metadata:t,onOpenChange:n}){return(0,H.jsx)(Rr,{open:e,onOpenChange:n,children:(0,H.jsxs)(Vr,{className:`max-w-2xl gap-0 overflow-hidden p-0`,children:[(0,H.jsxs)(zr,{className:`border-b border-border px-5 py-4 pr-12`,children:[(0,H.jsx)(Hr,{className:`text-base`,children:T(`chatSessionMetadataDialogTitle`)}),(0,H.jsx)(Fr,{className:`sr-only`,children:T(`chatSessionMetadataDialogDescription`)})]}),(0,H.jsx)(`div`,{className:`px-5 pb-5 pt-4`,children:(0,H.jsx)(`pre`,{className:`max-h-[60vh] overflow-auto rounded-lg border border-border bg-muted/60 p-4 font-mono text-xs leading-6 text-foreground shadow-inner custom-scrollbar`,children:Nc(t)})})]})})}function Fc(e){return[`server-path-browse`,e.path?.trim()??``,e.basePath?.trim()??``,e.includeFiles??!1]}function Ic(e){let{basePath:t,enabled:n,includeFiles:r,path:i}=e,a=i?.trim()??``,o=t?.trim()??``;return dn({queryKey:Fc({path:a,basePath:o,includeFiles:r}),queryFn:()=>ut({path:a,basePath:o,includeFiles:r}),enabled:n??!0,staleTime:0})}function Lc(){return zt({mutationFn:Wt})}var Rc=`[mask-image:linear-gradient(to_bottom,black_calc(100%_-_28px),transparent)] [-webkit-mask-image:linear-gradient(to_bottom,black_calc(100%_-_28px),transparent)]`,zc=V.forwardRef(({className:e,children:t,...n},r)=>(0,H.jsx)(`div`,{ref:r,className:c(`overflow-auto`,e),...n,children:t}));zc.displayName=`ScrollArea`;function Bc({entries:e,emptyMessage:t,disabled:n,onOpen:r,onSelect:i,selectedPath:a}){let o=(e,t)=>{e.preventDefault();let n=Array.from(e.currentTarget.parentElement?.querySelectorAll(`[data-server-path-row]`)??[]),r=n[n.indexOf(e.currentTarget)+t];r&&(r.focus(),r.click())};return(0,H.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col bg-background`,children:[(0,H.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,1fr)_8rem] border-b border-border bg-muted/20 px-3 py-1.5 text-xs text-muted-foreground`,children:[(0,H.jsx)(`span`,{children:T(`pathPickerNameColumn`)}),(0,H.jsx)(`span`,{children:T(`pathPickerTypeColumn`)})]}),(0,H.jsx)(zc,{className:`min-h-0 flex-1`,children:e.length>0?(0,H.jsx)(`div`,{role:`listbox`,"aria-label":T(`pathPickerDirectoryList`),className:`p-1.5`,children:e.map(e=>{let t=a===e.path;return(0,H.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":t,"data-server-path-row":!0,className:c(`grid w-full grid-cols-[minmax(0,1fr)_8rem] items-center rounded-sm border border-transparent px-2 py-1.5 text-left text-sm text-foreground outline-none transition-colors`,t?`border-primary/25 bg-primary/15`:`hover:bg-[var(--interaction-hover)] focus-visible:border-primary/35 focus-visible:bg-accent/70`),onClick:()=>i(e.path),onDoubleClick:()=>r(e.path),onKeyDown:t=>{t.key===`Enter`&&(t.preventDefault(),r(e.path)),t.key===`ArrowDown`&&o(t,1),t.key===`ArrowUp`&&o(t,-1)},disabled:n,children:[(0,H.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,H.jsx)(Ua,{className:`h-4 w-4 shrink-0 fill-amber-300 text-amber-500`}),(0,H.jsx)(`span`,{className:`truncate`,children:e.name})]}),(0,H.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,children:T(`pathPickerDirectoryType`)})]},e.path)})}):(0,H.jsx)(`div`,{className:`grid h-full min-h-48 place-items-center px-6 text-center text-sm text-muted-foreground`,children:t})})]})}function Vc({confirmLabel:e,disabled:t,hint:n,isSaving:r,onCancel:i,onSelectedPathChange:a,pathLabel:o,pathPlaceholder:s,selectedPath:c}){return(0,H.jsxs)(`div`,{className:`min-w-0 border-t border-border bg-muted/20 px-4 py-3`,children:[(0,H.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,H.jsx)(cn,{htmlFor:`server-path-picker-selection`,className:`shrink-0 text-sm`,children:o}),(0,H.jsx)(Gt,{id:`server-path-picker-selection`,value:c,onChange:e=>a(e.target.value),placeholder:s,disabled:r,className:`h-9 min-w-0 flex-1 bg-background`}),(0,H.jsxs)(kr,{className:`shrink-0 flex-row gap-2`,children:[(0,H.jsx)(R,{type:`button`,variant:`outline`,onClick:i,disabled:r,children:T(`cancel`)}),(0,H.jsx)(R,{type:`submit`,disabled:t,children:r?T(`saving`):e})]})]}),n?(0,H.jsx)(`p`,{className:`mt-2 text-xs leading-relaxed text-muted-foreground`,children:n}):null]})}var Hc={applications:Gr,desktop:vo,documents:wn,downloads:Sa,home:Ya,"icloud-drive":ha,workspace:La,root:qa,volumes:qa},Uc={applications:`pathPickerApplications`,desktop:`pathPickerDesktop`,documents:`pathPickerDocuments`,downloads:`pathPickerDownloads`,"icloud-drive":`pathPickerICloudDrive`,volumes:`pathPickerVolumes`};function Wc({currentPath:e,defaultWorkspacePath:t,disabled:n,homePath:r,locations:i,rootPath:a,onNavigate:o}){let s=[],l=[],u=new Set,d=(e,t)=>{let n=t.path.trim();!n||u.has(n)||(u.add(n),e.push({...t,path:n}))};t&&d(s,{icon:`workspace`,label:T(`pathPickerDefaultWorkspace`),path:t}),r&&d(s,{icon:`home`,label:T(`homeDirectory`),path:r});for(let e of i)d(e.kind===`volumes`?l:s,{icon:e.kind,label:T(Uc[e.kind]),path:e.path});a&&d(l,{icon:`root`,label:T(`pathPickerFileSystem`),path:a});let f=t=>t.map(t=>{let r=Hc[t.icon],i=e===t.path;return(0,H.jsxs)(`button`,{type:`button`,className:c(`flex w-full items-center gap-2 rounded-md px-2 py-2 text-left text-sm transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,i?`bg-primary/12 text-primary`:`text-foreground hover:bg-[var(--interaction-hover)]`),"aria-current":i?`location`:void 0,onClick:()=>o(t.path),disabled:n,children:[(0,H.jsx)(r,{className:c(`h-4 w-4 shrink-0`,i?`text-primary`:`text-amber-500`)}),(0,H.jsx)(`span`,{className:`truncate`,children:t.label})]},t.path)});return(0,H.jsxs)(`aside`,{className:`hidden min-h-0 w-48 shrink-0 overflow-y-auto border-r border-border bg-muted/20 p-2 sm:block`,children:[(0,H.jsxs)(`div`,{className:`mb-1 flex items-center gap-2 px-2 py-1.5 text-xs font-medium text-muted-foreground`,children:[(0,H.jsx)(Go,{className:`h-3.5 w-3.5`}),T(`pathPickerQuickAccess`)]}),(0,H.jsx)(`nav`,{"aria-label":T(`pathPickerQuickAccess`),className:`space-y-0.5`,children:f(s)}),l.length>0?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`div`,{className:`mb-1 mt-3 px-2 py-1.5 text-xs font-medium text-muted-foreground`,children:T(`pathPickerLocations`)}),(0,H.jsx)(`nav`,{"aria-label":T(`pathPickerLocations`),className:`space-y-0.5`,children:f(l)})]}):null]})}function Gc({addressPath:e,breadcrumbs:t,canGoBack:n,canGoForward:r,canGoUp:i,disabled:a,onBack:o,onForward:s,onNavigate:c,onRefresh:l,onSearchChange:u,onUp:d,searchText:f}){let[p,m]=(0,V.useState)(!1),[h,g]=(0,V.useState)(``),_=t.length>5?[t[0],...t.slice(-4)]:t,v=_.length<t.length,y=()=>{a||(g(e),m(!0))},b=()=>{g(``),m(!1)},x=()=>{let e=h.trim();e&&(m(!1),c(e))};return(0,H.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 overflow-hidden border-b border-border bg-muted/25 px-3 py-2`,children:[(0,H.jsx)(B,{icon:(0,H.jsx)(di,{className:`h-4 w-4`}),label:T(`pathPickerBack`),size:`lg`,onClick:o,disabled:!n||a}),(0,H.jsx)(B,{icon:(0,H.jsx)(li,{className:`h-4 w-4`}),label:T(`pathPickerForward`),size:`lg`,onClick:s,disabled:!r||a}),(0,H.jsx)(B,{icon:(0,H.jsx)(Va,{className:`h-4 w-4`}),label:T(`parentDirectory`),size:`lg`,onClick:d,disabled:!i||a}),(0,H.jsx)(`div`,{className:`ml-1 flex h-9 min-w-0 flex-1 items-center overflow-hidden rounded-md border border-border bg-background shadow-sm`,children:p?(0,H.jsx)(Gt,{value:h,onChange:e=>g(e.target.value),onBlur:b,onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),x()),e.key===`Escape`&&(e.preventDefault(),b())},"aria-label":T(`pathPickerAddressLabel`),className:`h-full rounded-none border-0 bg-transparent px-3 shadow-none focus-visible:ring-0`,autoFocus:!0}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Ua,{className:`ml-3 h-4 w-4 shrink-0 text-amber-500`}),(0,H.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center overflow-hidden pl-2`,onDoubleClick:y,children:[_.length>0?_.map((e,t)=>(0,H.jsxs)(`div`,{className:`flex min-w-0 items-center`,children:[t>0?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(oa,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`}),v&&t===1?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`button`,{type:`button`,className:`rounded px-1.5 py-1 text-sm text-muted-foreground hover:bg-[var(--interaction-hover)]`,"aria-label":T(`pathPickerShowFullAddress`),onClick:y,children:`…`}),(0,H.jsx)(oa,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`})]}):null]}):null,(0,H.jsx)(`button`,{type:`button`,className:`max-w-40 truncate rounded px-1.5 py-1 text-sm text-foreground hover:bg-[var(--interaction-hover)] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,onClick:()=>c(e.path),disabled:a,children:e.label})]},e.path)):(0,H.jsx)(`span`,{className:`truncate text-sm text-foreground`,children:e}),(0,H.jsx)(`span`,{className:`h-full min-w-2 flex-1 cursor-text`,"aria-hidden":`true`}),(0,H.jsx)(B,{icon:(0,H.jsx)(Oo,{className:`h-3.5 w-3.5`}),label:T(`pathPickerEditAddress`),size:`md`,tooltipSide:`bottom`,onClick:y,disabled:a,className:`mr-1`})]})]})}),(0,H.jsx)(B,{icon:(0,H.jsx)(jo,{className:`h-4 w-4`}),label:T(`chatRefresh`),size:`lg`,onClick:l,disabled:a}),(0,H.jsxs)(`div`,{className:`relative hidden w-56 shrink-0 sm:block`,children:[(0,H.jsx)(fi,{className:`pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground`}),(0,H.jsx)(Gt,{value:f,onChange:e=>u(e.target.value),placeholder:T(`pathPickerSearchPlaceholder`),disabled:a,className:`h-9 rounded-md bg-background pl-9`})]})]})}function Kc({errorMessage:e,isCreating:t,name:n,onCancel:r,onCreate:i,onNameChange:a}){return(0,H.jsxs)(`div`,{className:`border-b border-gray-200 bg-white px-3 py-2`,children:[(0,H.jsxs)(`div`,{className:`flex gap-2`,children:[(0,H.jsx)(Gt,{value:n,onChange:e=>a(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),i()),e.key===`Escape`&&r()},placeholder:T(`pathPickerNewFolderPlaceholder`),"aria-label":T(`pathPickerNewFolderName`),autoFocus:!0,disabled:t}),(0,H.jsx)(R,{type:`button`,onClick:i,disabled:!n.trim()||t,children:T(t?`saving`:`pathPickerCreateFolder`)}),(0,H.jsx)(R,{type:`button`,variant:`outline`,onClick:r,disabled:t,children:T(`cancel`)})]}),e?(0,H.jsxs)(`p`,{role:`alert`,className:`mt-2 text-sm text-destructive`,children:[T(`pathPickerCreateFolderFailed`),`: `,e]}):null]})}function qc({allowCreateDirectory:e,disabled:t,onNewFolder:n}){return(0,H.jsxs)(`div`,{className:`flex items-center border-b border-border bg-background px-3 py-1.5`,children:[e?(0,H.jsxs)(R,{type:`button`,variant:`ghost`,size:`sm`,onClick:n,disabled:t,children:[(0,H.jsx)(za,{className:`mr-1 h-4 w-4`}),T(`pathPickerNewFolder`)]}):null,(0,H.jsx)(`span`,{className:`ml-auto text-xs text-muted-foreground`,children:T(`pathPickerDoubleClickHint`)})]})}function Jc(e,t){if(!t)return e;if(e===`~`)return t;let n=t.includes(`\\`);if(e.startsWith(`~/`)||n&&e.startsWith(`~\\`)){let r=n?`\\`:`/`,i=e.slice(2).replaceAll(r===`\\`?`/`:`\\`,r);return`${t.replace(/[\\/]+$/,``)}${r}${i}`}return e}function Yc({open:e,allowCreateDirectory:t=!0,currentPath:n,defaultWorkspacePath:r,isSaving:i,onOpenChange:a,onConfirm:o,title:s,description:c,pathLabel:l,pathPlaceholder:u,confirmLabel:d,hint:f}){let p=n?.trim()??``,m=r?.trim()??``,h=`${p}\u0000${m}`;return(0,H.jsx)(Rr,{open:e,onOpenChange:e=>{i||a(e)},children:(0,H.jsxs)(Vr,{className:`max-h-[92vh] overflow-hidden p-0 sm:h-[44rem] sm:max-w-5xl sm:grid-rows-[auto_minmax(0,1fr)]`,children:[(0,H.jsxs)(zr,{className:`border-b border-border px-5 py-4 pr-12`,children:[(0,H.jsx)(Hr,{children:s}),(0,H.jsx)(Fr,{className:c?void 0:`sr-only`,children:c??s})]}),e?(0,H.jsx)(Xc,{allowCreateDirectory:t,currentPath:p,defaultWorkspacePath:m,isSaving:i,onCancel:()=>a(!1),onConfirm:o,pathLabel:l,pathPlaceholder:u,confirmLabel:d,hint:f},h):null]})})}function Xc({allowCreateDirectory:e,currentPath:t,defaultWorkspacePath:n,isSaving:r,onCancel:i,onConfirm:a,pathLabel:o,pathPlaceholder:s,confirmLabel:c,hint:l}){let u=t||n,[d,f]=(0,V.useState)(u||null),[p,m]=(0,V.useState)(u||null),[h,g]=(0,V.useState)([]),[_,v]=(0,V.useState)([]),[y,b]=(0,V.useState)(``),[x,S]=(0,V.useState)(!1),[C,w]=(0,V.useState)(``),E=Ic({path:p,enabled:!0}),D=Lc(),O=Jc(p?.trim()??``,E.data?.homePath),k=d===null?E.data?.currentPath??``:d===p&&E.data?.currentPath===O?E.data.currentPath:d,A=k.trim(),j=A.length===0||r,M=O||E.data?.currentPath||``,N=!p||E.data?.currentPath===M?E.data?.breadcrumbs??[]:[],P=(0,V.useMemo)(()=>E.error?E.error instanceof Error?E.error.message:String(E.error):null,[E.error]),ee=(0,V.useMemo)(()=>D.error?D.error instanceof Error?D.error.message:String(D.error):null,[D.error]),te=C.trim().toLowerCase(),ne=(0,V.useMemo)(()=>(E.data?.entries??[]).filter(e=>e.kind===`directory`),[E.data?.entries]),re=(0,V.useMemo)(()=>te.length===0?ne:ne.filter(e=>{let t=e.name.toLowerCase(),n=e.path.toLowerCase();return t.includes(te)||n.includes(te)}),[ne,te]),F=e=>{m(e),f(e),w(``),S(!1),b(``),D.reset()},ie=e=>{let t=e.trim();if(!t)return;let n=M;n&&n!==t&&g(e=>[...e,n].slice(-50)),v([]),F(t)},ae=()=>{let e=h.at(-1);if(!e)return;let t=M;g(e=>e.slice(0,-1)),t&&v(e=>[t,...e].slice(0,50)),F(e)},oe=()=>{let e=_[0];if(!e)return;let t=M;v(e=>e.slice(1)),t&&g(e=>[...e,t].slice(-50)),F(e)},se=async()=>{let t=E.data?.currentPath,n=y.trim();if(!(!e||!t||!n||D.isPending))try{let e=await D.mutateAsync({parentPath:t,name:n});await E.refetch(),f(e.path),b(``),S(!1)}catch{}},ce=E.isLoading?T(`loading`):P?`${T(`pathBrowseFailed`)}: ${P}`:ne.length>0?T(`pathPickerSearchEmpty`):T(`emptyDirectory`),le=r||E.isLoading;return(0,H.jsxs)(`form`,{className:`flex min-h-0 min-w-0 flex-col overflow-hidden`,onSubmit:e=>{e.preventDefault(),!j&&a(A)},children:[(0,H.jsx)(Gc,{addressPath:M,breadcrumbs:N,canGoBack:h.length>0,canGoForward:_.length>0,canGoUp:!!E.data?.parentPath,disabled:le,onBack:ae,onForward:oe,onNavigate:ie,onRefresh:()=>void E.refetch(),onSearchChange:w,onUp:()=>{let e=E.data?.parentPath;e&&ie(e)},searchText:C}),(0,H.jsx)(qc,{allowCreateDirectory:e,disabled:le||!E.data?.currentPath,onNewFolder:()=>{S(!0),b(``),D.reset()}}),(0,H.jsxs)(`div`,{className:`relative border-b border-border p-2 sm:hidden`,children:[(0,H.jsx)(fi,{className:`pointer-events-none absolute left-5 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground`}),(0,H.jsx)(Gt,{value:C,onChange:e=>w(e.target.value),placeholder:T(`pathPickerSearchPlaceholder`),disabled:le,className:`h-9 pl-9`})]}),e&&x?(0,H.jsx)(Kc,{errorMessage:ee,isCreating:D.isPending,name:y,onCancel:()=>S(!1),onCreate:()=>void se(),onNameChange:e=>{b(e),D.reset()}}):null,(0,H.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 overflow-hidden`,children:[(0,H.jsx)(Wc,{currentPath:M,defaultWorkspacePath:Jc(n,E.data?.homePath)||null,disabled:le,homePath:E.data?.homePath,locations:E.data?.locations??[],rootPath:E.data?.breadcrumbs[0]?.path,onNavigate:ie}),(0,H.jsx)(Bc,{entries:re,emptyMessage:ce,disabled:r,onOpen:ie,onSelect:f,selectedPath:A})]}),(0,H.jsx)(Vc,{confirmLabel:c,disabled:j,hint:l,isSaving:r,onCancel:i,onSelectedPathChange:f,pathLabel:o,pathPlaceholder:s,selectedPath:k})]})}function Zc({open:e,currentProjectRoot:t,defaultWorkspacePath:n,isSaving:r,onOpenChange:i,onSave:a}){return(0,H.jsx)(Yc,{open:e,currentPath:t,defaultWorkspacePath:n,isSaving:r,onOpenChange:i,onConfirm:a,title:T(`chatSessionProjectDialogTitle`),description:T(`chatSessionProjectDialogDescription`),pathLabel:T(`chatSessionProjectPathLabel`),pathPlaceholder:T(`chatSessionProjectPathPlaceholder`),confirmLabel:T(`chatSessionSetProject`),hint:T(`chatSessionProjectUpdateHint`)})}var Qc=`flex shrink-0 items-center gap-1.5`;function $c({sessionKey:e,canDeleteSession:t,isDeletePending:n,currentPath:r,defaultWorkspacePath:i,metadata:a,isWorkspaceOpen:o,onToggleWorkspace:s,onDeleteSession:c}){let l=jc(),[u,d]=(0,V.useState)(!1),[f,p]=(0,V.useState)(!1),[m,h]=(0,V.useState)(!1),[g,_]=(0,V.useState)(!1),v=n||g,y=async n=>{if(!e)return;let r=t;_(!0);try{await l({sessionKey:e,projectRoot:n,persistToServer:r}),p(!1),d(!1)}finally{_(!1)}};return(0,H.jsxs)(`div`,{className:Qc,children:[e?(0,H.jsxs)(Tc,{open:u,onOpenChange:d,children:[(0,H.jsx)(Ec,{asChild:!0,children:(0,H.jsx)(B,{icon:(0,H.jsx)(ui,{className:`h-4 w-4`}),label:T(`chatSessionMoreActions`),tooltip:!1,disabled:v})}),(0,H.jsx)(Oc,{align:`end`,className:`w-56 p-2`,children:(0,H.jsxs)(`div`,{className:`space-y-1`,children:[(0,H.jsx)(Mc,{icon:Ra,label:T(`chatSessionSetProject`),onClick:()=>{d(!1),p(!0)},disabled:v}),(0,H.jsx)(Mc,{icon:Zi,label:T(`chatSessionViewMetadata`),onClick:()=>{d(!1),h(!0)},disabled:v}),(0,H.jsx)(Mc,{icon:Yo,label:T(`chatDeleteSession`),onClick:()=>{d(!1),c()},disabled:!t||v,destructive:!0})]})})]}):null,(0,H.jsx)(B,{icon:o?(0,H.jsx)(To,{className:`h-4 w-4`}):(0,H.jsx)(Kr,{className:`h-4 w-4`}),label:T(o?`chatSessionCloseWorkspace`:`chatSessionOpenWorkspace`),"aria-pressed":o,onClick:s,disabled:v}),e?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Zc,{open:f,currentProjectRoot:r,defaultWorkspacePath:i,isSaving:g,onOpenChange:p,onSave:y}),(0,H.jsx)(Pc,{open:m,metadata:a,onOpenChange:h})]}):null]})}var el={maxHeight:Cc(`18rem`)};function tl({sessionKey:e,projectName:t,projectRoot:n,defaultWorkspacePath:r,persistToServer:i}){let a=jc(),[o,s]=(0,V.useState)(!1),[c,l]=(0,V.useState)(!1),[u,d]=(0,V.useState)(!1),f=async t=>{d(!0);try{await a({sessionKey:e,projectRoot:t,persistToServer:i}),l(!1),s(!1)}finally{d(!1)}};return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(Tc,{open:o,onOpenChange:s,children:[(0,H.jsx)(Ec,{asChild:!0,children:(0,H.jsx)(`button`,{type:`button`,title:n??void 0,className:`min-w-0 max-w-[320px] shrink rounded-full border border-border bg-muted px-2 py-0.5 text-[11px] font-medium text-muted-foreground transition-colors hover:border-primary/35 hover:bg-[var(--interaction-hover)] hover:text-accent-foreground disabled:cursor-not-allowed disabled:opacity-60`,"aria-label":T(`chatSessionSetProject`),disabled:u,children:(0,H.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,H.jsx)(Ra,{className:`h-3.5 w-3.5 shrink-0`}),(0,H.jsx)(`span`,{className:`truncate`,children:t}),(0,H.jsx)(er,{className:`h-3 w-3 shrink-0 opacity-70`})]})})}),(0,H.jsxs)(Oc,{align:`start`,className:`w-72 p-2`,style:el,children:[(0,H.jsxs)(`div`,{className:`px-3 pb-2 pt-1`,children:[(0,H.jsx)(`div`,{className:`text-[11px] font-medium uppercase tracking-wider text-muted-foreground`,children:t}),n?(0,H.jsx)(`div`,{className:`mt-1 break-all text-xs text-muted-foreground`,children:n}):null]}),(0,H.jsxs)(`div`,{className:`space-y-1`,children:[(0,H.jsx)(Mc,{icon:Oo,label:T(`chatSessionSetProject`),onClick:()=>{s(!1),l(!0)},disabled:u}),(0,H.jsx)(Mc,{icon:Ha,label:T(`chatSessionClearProject`),onClick:()=>{f(null)},disabled:u})]})]})]}),(0,H.jsx)(Zc,{open:c,currentProjectRoot:n,defaultWorkspacePath:r,isSaving:u,onOpenChange:l,onSave:f})]})}var nl=(0,V.createContext)(null);function rl({presenter:e,children:t}){return(0,H.jsx)(nl.Provider,{value:e,children:t})}function il(){let e=(0,V.useContext)(nl);if(!e)throw Error(`usePresenter must be used inside ChatPresenterProvider`);return e}var al=[[`Thinking`,`thinking`],[`Calling tool`,`tool-running`],[`Tool call completed`,`tool-completed`],[`Run failed`,`run-failed`],[`Run interrupted`,`run-interrupted`]];function ol(e){let t=e.label?.trim();if(t)return t;let n=e.key.split(`:`);return n[n.length-1]||e.key}function sl(e,t){let n=e.statusText?.trim(),r=e.statusKind||!n?void 0:al.find(([e])=>n===e||n.startsWith(`${e}: `)),i=e.statusKind??r?.[1],a=r?n?.slice(r[0].length).replace(/^:\s*/,``)||void 0:n;switch(i){case`thinking`:return T(`chatTyping`,t);case`tool-running`:return[T(`chatToolCall`,t),T(`chatToolStatusRunning`,t),a].filter(Boolean).join(` · `);case`tool-completed`:return[T(`chatToolCall`,t),T(`chatToolStatusCompleted`,t),a].filter(Boolean).join(` · `);case`run-failed`:return[T(`chatToolStatusFailed`,t),a].filter(Boolean).join(` · `);case`run-interrupted`:return T(`chatSessionActivityInterrupted`,t);default:return a??null}}function cl(e,t=A()){let n=e.activityPreview;return!n||n.state===`cancelled`?null:n.state===`completed`&&n.replyText?n.replyText:sl(n,t)??n.replyText??null}function ll(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime()}function ul(e,t){return e.getFullYear()===t.getFullYear()}function dl(e,t){let n=`${e.getMonth()+1}月${e.getDate()}日`;return ul(e,t)?n:`${e.getFullYear()}年${n}`}function fl(e,t=A(),n=new Date){if(!e)return`-`;let r=e instanceof Date?e:new Date(e);if(Number.isNaN(r.getTime()))return typeof e==`string`?e:`-`;let i=M(t),a=ll(r),o=ll(n),s=Math.floor((o-a)/864e5);if(s===0)return new Intl.DateTimeFormat(i,{hour:`2-digit`,minute:`2-digit`,hour12:!1}).format(r);if(s===1)return T(`chatSidebarYesterday`,t);if(s>1&&s<7)return new Intl.DateTimeFormat(i,{weekday:`long`}).format(r);if(t===`zh`)return dl(r,n);let c=ul(r,n)?{month:`numeric`,day:`numeric`}:{year:`numeric`,month:`numeric`,day:`numeric`};return new Intl.DateTimeFormat(i,c).format(r)}function pl(e){return e.trim().toLowerCase()}function ml(e,t){let n=pl(t);return n?[e.key,ol(e),e.projectRoot??``,e.projectName??``].map(pl).some(e=>e.includes(n)):!0}var hl=function(e){return e.CALL=`call`,e.RESULT=`result`,e.PARTIAL_CALL=`partial-call`,e.ERROR=`error`,e.CANCELLED=`cancelled`,e}({});function gl(e){if(typeof e!=`string`)return null;let t=e.trim();return t.length>0?t:null}function _l(e){return gl(e)}function vl(e){let t=gl(e);if(!t)return null;let n=t.replace(/[\\/]+$/,``);if(!n)return t;let r=n.split(/[\\/]/).filter(Boolean);return r[r.length-1]??n}function yl(e){return/^[A-Za-z]:[\\/]?$/.test(e)||e===`/`?e:e.replace(/[\\/]+$/,``)}function bl(e){let t=yl(e.trim().replace(/\\/g,`/`));return/^[A-Za-z]:/.test(t)?`${t.slice(0,1).toLowerCase()}${t.slice(1)}`:t}function xl(e,t){if(!e)return t.join(`/`);let n=yl(e.trim().replace(/\\/g,`/`));return t.length===0?n:n===`/`?`/${t.join(`/`)}`:`${n}/${t.join(`/`)}`}function Sl(e){let t=yl(e.trim().replace(/\\/g,`/`));if(!t||t===`/`||/^[A-Za-z]:[\\/]?$/.test(t))return null;let n=t.lastIndexOf(`/`);if(n<0)return null;if(n===0)return`/`;let r=t.slice(0,n);return/^[A-Za-z]:$/.test(r)?`${r}/`:r}function Cl(e){let t=e.trim().replace(/\\/g,`/`);return t?/^[A-Za-z]:\//.test(t)?{prefix:t.slice(0,2),segments:t.slice(3).split(`/`).filter(Boolean)}:t.startsWith(`/`)?{prefix:`/`,segments:t.slice(1).split(`/`).filter(Boolean)}:{prefix:null,segments:t.split(`/`).filter(Boolean)}:{prefix:null,segments:[]}}function wl(e){let t=bl(e.path),n=bl(e.sessionProjectRoot);if(!t||!n)return null;if(!t.startsWith(`/`)&&!/^[A-Za-z]:\//.test(t))return t.split(`/`).filter(Boolean);if(t===n)return[];let r=n.endsWith(`/`)?n:`${n}/`;return t.startsWith(r)?t.slice(r.length).split(`/`).filter(Boolean):null}function Tl(e){let t=e.sessionProjectRoot?.trim();if(!t)return null;let n=wl({path:e.path,sessionProjectRoot:t});return!n?.length||n.some(e=>e===`.`||e===`..`)?null:n.join(`/`)}function El(e){let{basePath:t=null,currentKind:n=`file`,labels:r,leading:i=null}=e,a=r.map((e,i)=>{let a=i===r.length-1?n:`directory`,o=xl(t,r.slice(0,i+1));return{key:`${i}:${e}`,label:e,kind:a,path:o,browsePath:a===`file`?Sl(o):o,isCurrent:i===r.length-1}});return i?[i,...a]:a}function Dl(e){let{kind:t=`file`,path:n,sessionProjectRoot:r,truncated:i}=e,a=n.trim(),o=r?.trim()&&a?wl({path:a,sessionProjectRoot:r}):null,s;if(r?.trim()&&o){let e=r.trim(),n=vl(e)??e;s=El({labels:o,basePath:e,currentKind:t,leading:{key:`workspace:${n}`,label:n,kind:`workspace`,path:e,browsePath:e,isCurrent:o.length===0}})}else{let{prefix:e,segments:n}=Cl(a),r=e===`/`?`/`:e?`${e}/`:null;s=El({labels:n,basePath:r,currentKind:t,leading:e?{key:`root:${e}`,label:e,kind:`root`,path:r??e,browsePath:r??e,isCurrent:n.length===0}:null})}return s.length===0&&(s=[{key:`file:unknown`,label:a||`file`,kind:t,path:a,browsePath:t===`directory`?a:Sl(a),isCurrent:!0}]),{fullPath:a,truncated:i,segments:s}}var Ol=new Set([`off`,`minimal`,`low`,`medium`,`high`,`adaptive`,`xhigh`]),kl=new Set([`running`,`completed`,`failed`,`cancelled`,`idle`]),Al=new Set([`thinking`,`tool-running`,`tool-completed`,`run-failed`,`run-interrupted`]);function jl(e){if(typeof e==`string`)return e;try{return JSON.stringify(e??{})}catch{return String(e??``)}}function Ml(e){return`${en}/api/ncp/assets/content?${new URLSearchParams({uri:e}).toString()}`}function Nl(e){if(typeof e!=`string`)return null;let t=e.trim();return t.length>0?t:null}function Pl(e){let{metadata:t}=e;return!t||typeof t!=`object`||Array.isArray(t)?null:t}function Fl(e){let t=Pl(e)?.last_activity_preview;if(!t||typeof t!=`object`||Array.isArray(t))return null;let n=t,{state:r}=n,i=Nl(n.timestamp);if(!kl.has(r)||!i)return null;let a=Nl(n.statusKind);return{state:r,timestamp:i,statusKind:Al.has(a)?a:void 0,statusText:Nl(n.statusText)??void 0,replyText:Nl(n.replyText)??void 0}}function Il(e){let t=Pl(e);return t?Nl(t.preferred_model)??Nl(t.preferredModel)??Nl(t.model):null}function Ll(e){let t=Pl(e);if(!t)return null;let n=Nl(t.preferred_thinking)??Nl(t.thinking)??Nl(t.thinking_level)??Nl(t.thinkingLevel);if(!n)return null;let r=n.toLowerCase();return Ol.has(r)?r:null}function Rl(e){let t=Pl(e);return t?Nl(t.label):null}function zl(e){let t=Pl(e);return t?_l(t.project_root??t.projectRoot):null}function Bl(e){return Nl(e.workingDir)}function Vl(e){let t=Pl(e);return t?Nl(t.ui_last_read_at):null}function Hl(e){let t=Pl(e);return t?Nl(t.runtime)??Nl(t.session_type)??Nl(t.sessionType)??`native`:`native`}function Ul(e){let t=Pl(e);return t?Nl(t.parent_session_id)??Nl(t.parentSessionId):null}function Wl(e){let t=Pl(e);return t?Nl(t.spawned_by_request_id)??Nl(t.spawnedByRequestId):null}function Gl(e){let t=Pl(e);return t?t.child_session_promoted===!0:!1}function Kl(e){if(e.startsWith(`cron:`))return{type:`cron`};if(e.startsWith(`agent:`)){let t=e.split(`:`);if(t.length>=3){let e=t[2];if(e&&e!==`main`&&e!==`direct`)return{channel:e}}}return{}}function ql(e){return e.state===`cancelled`?hl.CANCELLED:e.state===`result`?hl.RESULT:e.state===`partial-call`?hl.PARTIAL_CALL:hl.CALL}function Jl(e){let t=[];for(let n of e){if(n.type===`text`){t.push({type:`text`,text:n.text});continue}if(n.type===`rich-text`){t.push({type:`text`,text:n.text});continue}if(n.type===`reasoning`){t.push({type:`reasoning`,reasoning:n.text,details:[]});continue}if(n.type===`source`){t.push({type:`source`,source:{sourceType:`url`,id:n.url??n.title??Math.random().toString(36).slice(2,8),url:n.url??``,...n.title?{title:n.title}:{}}});continue}if(n.type===`file`&&n.contentBase64){t.push({type:`file`,...n.name?{name:n.name}:{},mimeType:n.mimeType??`application/octet-stream`,data:n.contentBase64,...n.url?{url:n.url}:{},...typeof n.sizeBytes==`number`?{sizeBytes:n.sizeBytes}:{}});continue}if(n.type===`file`&&n.url){t.push({type:`file`,...n.name?{name:n.name}:{},mimeType:n.mimeType??`application/octet-stream`,data:``,url:n.url,...typeof n.sizeBytes==`number`?{sizeBytes:n.sizeBytes}:{}});continue}if(n.type===`file`&&n.assetUri){t.push({type:`file`,...n.name?{name:n.name}:{},mimeType:n.mimeType??`application/octet-stream`,data:``,url:Ml(n.assetUri),...typeof n.sizeBytes==`number`?{sizeBytes:n.sizeBytes}:{}});continue}if(n.type===`step-start`){t.push({type:`step-start`});continue}n.type===`tool-invocation`&&t.push({type:`tool-invocation`,toolInvocation:{status:ql(n),toolCallId:n.toolCallId??`${n.toolName}-${Math.random().toString(36).slice(2,8)}`,toolName:n.toolName,args:jl(n.args),result:n.result,...n.execution?{execution:{...n.execution}}:{}}})}return t}function Yl(e){return e.flatMap(e=>e.type===`extension`?[e]:Jl([e]))}function Xl(e){return e===`service`?`system`:e===`tool`?`assistant`:e}function Zl(e){return{id:e.id,role:Xl(e.role),parts:Jl(e.parts),meta:{source:`stream`,status:e.status,sessionKey:e.sessionId,timestamp:e.timestamp}}}function Ql(e){let t=Pl(e),n=Rl(e),r=Il(e),i=Ll(e),a=zl(e),o=Bl(e)??a,s=Vl(e),c=Nl(e.lastMessageAt),l=vl(a),u=Kl(e.sessionId),d=Ul(e),f=Wl(e),p=Gl(e),m=Fl(e);return{key:e.sessionId,createdAt:e.createdAt??e.updatedAt,updatedAt:e.updatedAt,...c?{lastMessageAt:c}:{},...s?{readAt:s}:{},...typeof e.agentId==`string`&&e.agentId.trim().length>0?{agentId:e.agentId.trim()}:{},...n?{label:n}:{},...u,...r?{preferredModel:r}:{},...i?{preferredThinking:i}:{},...a?{projectRoot:a}:{},...o?{workingDir:o}:{},...l?{projectName:l}:{},...t?{metadata:t}:{},sessionType:Hl(e),sessionTypeMutable:!1,status:e.status??`idle`,isChildSession:!!d,...p?{isPromotedChildSession:p}:{},...d?{parentSessionId:d}:{},...f?{spawnedByRequestId:f}:{},...m?{activityPreview:m}:{},messageCount:e.messageCount}}function $l(e){return e.map(Ql)}function eu(){return`ncp-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`}var tu=`nextclaw.chat.session-list.mode`,nu=`time-first`;function ru(e){return e===`time-first`||e===`project-first`}function iu(e){return Array.isArray(e)?[...new Set(e.filter(e=>typeof e==`string`).map(e=>e.trim()).filter(Boolean))]:[]}function au(e){if(!e||typeof e!=`object`)return null;let{snapshot:t}=e;return!t||typeof t!=`object`?null:ru(t.listMode)?t.listMode:null}function ou(e,t){let n=e?.trim();if(!n)return!1;let r=t?.trim();return r?n.localeCompare(r)>0:!1}function su(e){let{active:t,readAt:n,runStatus:r,lastMessageAt:i}=e;return t||r===`running`?!1:ou(i,n)}var cu={selectedSessionKey:null,selectedAgentId:`main`,query:``,listMode:nu,pinnedSessionKeys:[],pinnedProjectRoots:[],collapsedProjectRoots:[]};function lu(e){return t=>e(e=>({snapshot:{...e.snapshot,...t}}))}function uu(e){return(t,n)=>e(e=>{let r=t.trim(),i=n?.trim();if(!r||!i)return e;let a=e.optimisticReadAtBySessionKey[r];return a&&a.localeCompare(i)>=0?e:{...e,optimisticReadAtBySessionKey:{...e.optimisticReadAtBySessionKey,[r]:i}}})}var du=N()(yi(e=>({snapshot:cu,optimisticReadAtBySessionKey:{},setSnapshot:lu(e),markSessionRead:uu(e)}),{name:tu,storage:bi(()=>window.localStorage),partialize:e=>({snapshot:{listMode:e.snapshot.listMode,pinnedSessionKeys:e.snapshot.pinnedSessionKeys,pinnedProjectRoots:e.snapshot.pinnedProjectRoots,collapsedProjectRoots:e.snapshot.collapsedProjectRoots}}),merge:(e,t)=>{if(!e||typeof e!=`object`)return t;let{snapshot:n}=e,r=au(e);return{...t,snapshot:{...t.snapshot,...r?{listMode:r}:{},pinnedSessionKeys:iu(n?.pinnedSessionKeys),pinnedProjectRoots:iu(n?.pinnedProjectRoots),collapsedProjectRoots:iu(n?.collapsedProjectRoots)}}}})),fu={staleTime:5e3,retry:!1};function pu(e){return dn({queryKey:[`ncp-sessions`,e?.limit??null,e?.peerId?.trim()||null],queryFn:()=>Ue(e),...fu})}function mu(e){return dn({queryKey:[`ncp-session-skills`,e.sessionId,e.projectRoot??null],queryFn:()=>Ie(e.sessionId,{...Object.prototype.hasOwnProperty.call(e,`projectRoot`)?{projectRoot:e.projectRoot??null}:{}}),enabled:!!e.sessionId,...fu})}function hu(e){return dn({queryKey:[`ncp-session-token-usage`,e],queryFn:()=>Re(e),enabled:!!e,...fu})}function gu(e,t){return e.filter(e=>ml(e,t))}function _u(e){return e.isChildSession?e.isPromotedChildSession===!0:!0}function vu(e={}){let t=du(e=>e.snapshot.query),n=e.query??t,r=pu({limit:e.limit??200}),i=(0,V.useMemo)(()=>gu($l(r.data?.sessions??[]).filter(_u),n).map(e=>({session:e,runStatus:e.status===`running`?`running`:void 0})),[n,r.data?.sessions]);return{isLoading:r.isLoading,items:i}}function yu(e){return new Date(e.session.lastMessageAt??e.session.createdAt).getTime()}function bu(e){return[...e].sort((e,t)=>yu(t)-yu(e))}function xu(e,t){return[...e].sort((e,n)=>Number(t.has(n.session.key))-Number(t.has(e.session.key))||yu(n)-yu(e))}function Su(e,t=new Set){let n=new Date,r=new Date(n.getFullYear(),n.getMonth(),n.getDate()).getTime(),i=r-864e5,a=r-7*864e5,o=[],s=[],c=[],l=[],u=e.filter(e=>!t.has(e.session.key)),d=xu(e.filter(e=>t.has(e.session.key)),t);for(let e of u){let t=yu(e);t>=r?o.push(e):t>=i?s.push(e):t>=a?c.push(e):l.push(e)}let f=[];return d.length>0&&f.push({label:T(`chatSidebarPinned`),items:d}),o.length>0&&f.push({label:T(`chatSidebarToday`),items:o}),s.length>0&&f.push({label:T(`chatSidebarYesterday`),items:s}),c.length>0&&f.push({label:T(`chatSidebarPrevious7Days`),items:c}),l.length>0&&f.push({label:T(`chatSidebarOlder`),items:l}),f}function Cu(e,t=new Set,n=new Set,r=[]){let i=new Map;for(let e of r)i.set(e.rootPath,{projectRoot:e.rootPath,projectName:e.name,items:[],latestUpdatedAt:new Date(e.updatedAt).getTime(),isPinned:n.has(e.rootPath)});for(let t of e){let e=t.session.projectRoot?.trim();if(!e)continue;let r=i.get(e),a=yu(t);if(r){r.items.push(t),r.latestUpdatedAt=Math.max(r.latestUpdatedAt,a);continue}i.set(e,{projectRoot:e,projectName:t.session.projectName?.trim()||vl(e)||e,items:[t],latestUpdatedAt:a,isPinned:n.has(e)})}return[...i.values()].map(e=>({...e,items:xu(e.items,t)})).sort((e,t)=>Number(t.isPinned)-Number(e.isPinned)||t.latestUpdatedAt-e.latestUpdatedAt)}function wu(e){let t=new Map;for(let n of e){let e=n.session.parentSessionId?.trim();if(!e)continue;let r=t.get(e)??[];r.push(n),t.set(e,r)}for(let e of t.values())e.sort((e,t)=>yu(t)-yu(e));return t}function Tu(e){if(e.label&&e.label.trim())return e.label.trim();let t=e.key.split(`:`);return t[t.length-1]||e.key}function Eu({isProjectFirstView:e,onSelectMode:t}){return(0,H.jsxs)(`div`,{role:`group`,"aria-label":T(`chatSidebarViewMode`),className:`relative grid h-7 grid-cols-2 rounded-full bg-foreground/[0.04] p-0.5 text-[11px]`,children:[(0,H.jsx)(`span`,{"aria-hidden":`true`,className:c(`pointer-events-none absolute bottom-0.5 left-0.5 top-0.5 w-[calc(50%-2px)] rounded-full bg-gray-200/70 transition-transform duration-200 ease-out motion-reduce:transition-none`,e&&`translate-x-full`)}),(0,H.jsxs)(`button`,{type:`button`,"aria-pressed":!e,onClick:()=>t(`time-first`),className:c(`relative z-10 inline-flex h-6 items-center justify-center gap-1 rounded-full px-2 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1`,e?`text-muted-foreground hover:text-foreground`:`font-medium text-foreground`),children:[(0,H.jsx)(pa,{"aria-hidden":`true`,className:`h-3.5 w-3.5`}),T(`chatSidebarViewTime`)]}),(0,H.jsxs)(`button`,{type:`button`,"aria-pressed":e,onClick:()=>t(`project-first`),className:c(`relative z-10 inline-flex h-6 items-center justify-center gap-1 rounded-full px-2 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1`,e?`font-medium text-foreground`:`text-muted-foreground hover:text-foreground`),children:[(0,H.jsx)(Ua,{"aria-hidden":`true`,className:`h-3.5 w-3.5`}),T(`chatSidebarViewProject`)]})]})}var Du=`native`;function Ou(e){return typeof e==`string`?e.trim().toLowerCase()||`native`:Du}function ku(e,t=Du){return Ou(e?.runtime?.trim()||e?.engine?.trim()||t)}function Au(e,t){return e===`native`?T(`chatSessionTypeNative`):t?.trim()||e.trim().split(/[-_]+/g).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `)||e}function ju(e){let t=new Map;for(let n of e){let e=Ou(n.value);t.set(e,{value:e,label:n.label?.trim()||Au(e),icon:n.icon??null,ready:n.ready??!0,reason:n.reason??null,reasonMessage:n.reasonMessage??null,supportedModels:n.supportedModels,recommendedModel:n.recommendedModel??null,modelSelectionMode:n.modelSelectionMode??`nextclaw`,runtimeDefaultThinking:n.runtimeDefaultThinking??null,cta:n.cta??null})}return t.has(`native`)||t.set(Du,{value:Du,label:Au(Du),icon:null,ready:!0,reason:null,reasonMessage:null,supportedModels:void 0,recommendedModel:null,modelSelectionMode:`nextclaw`,runtimeDefaultThinking:null,cta:null}),Array.from(t.values()).sort((e,t)=>e.value===`native`?-1:t.value===`native`?1:e.value.localeCompare(t.value))}var Mu={telegram:`telegram.svg`,slack:`slack.svg`,discord:`discord.svg`,whatsapp:`whatsapp.svg`,qq:`qq.svg`,feishu:`feishu.svg`,dingtalk:`dingtalk.svg`,wecom:`wecom.svg`,weixin:`weixin.svg`,email:`email.svg`};function Nu(e,t){let n=e[t.toLowerCase()];return n?`/logos/${n}`:null}function Pu(e){return Nu(Mu,e)}var Fu={wx:`weixin`,lark:`feishu`},Iu={cron:{icon:`cron`}},Lu={codex:`chatSessionTypeCodex`,claude:`chatSessionTypeClaude`};function Ru(e){return e?.trim().toLowerCase()??``}function zu(e){return e.split(/[-_]+/g).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `)}function Bu(e,t){let n=Ru(e);if(!n||n===`native`)return null;let r=t.find(e=>Ru(e.value)===n);return r?.label.trim()?r.label.trim():zu(n)}function Vu(e,t){let n=Ru(e);return!n||n===`native`?null:t.find(e=>Ru(e.value)===n)??null}function Hu(e){let t=Ru(e);if(!t)return null;let n=Fu[t]??t;return Pu(n)?n:null}function Uu(e,t){let n=Hu(e.channel??``);if(n)return{icon:{kind:`channel-logo`,channel:n},label:null};let r=Iu[Ru(e.type)];if(r)return{icon:{kind:`symbol`,icon:r.icon},label:null};let i=Ru(e.sessionType),a=Vu(i,t);if(a?.icon?.src?.trim())return{icon:{kind:`runtime-image`,src:a.icon.src,alt:a.icon.alt??null,name:a.label},label:null};let o=Lu[i];return o?{icon:null,label:T(o)}:{icon:null,label:a?.label?.trim()||Bu(e.sessionType,t)}}var Wu=`app://`;function Gu(e){let t=e.trim().replace(/^\/+/,``);if(!t)return null;let n=t.split(`/`);return n.some(e=>e.trim().length===0||e===`.`||e===`..`)?null:n.join(`/`)}function Ku(e){let t=e.trim();if(!t)return null;if(!t.startsWith(Wu))return t;let n=Gu(t.slice(6));return n?`/${n}`:null}function qu({name:e,src:t,className:n,imgClassName:r,fallback:i}){let[a,o]=(0,V.useState)(!1),s=!!t&&!a;return(0,H.jsx)(`div`,{className:c(`inline-flex shrink-0 items-center justify-center overflow-hidden`,n),children:s?(0,H.jsx)(`img`,{src:t,alt:`${e} logo`,className:c(`block h-6 w-6 object-contain`,r),onError:()=>o(!0),draggable:!1}):i??(0,H.jsx)(`span`,{className:`text-lg font-bold uppercase`,children:e.slice(0,1)})})}function Ju({icon:e,className:t}){if(e.kind===`channel-logo`)return(0,H.jsx)(Yu,{channel:e.channel,className:t});if(e.kind===`runtime-image`){let n=Ku(e.src);return(0,H.jsx)(qu,{name:e.name?.trim()||e.alt?.trim()||`runtime`,src:n??void 0,className:c(`h-[1.125rem] w-[1.125rem]`,t),imgClassName:`h-full w-full object-contain`,fallback:(0,H.jsx)(Xi,{className:c(`h-3 w-3 text-current`,t),strokeWidth:2.4})})}return(0,H.jsx)(Hi,{className:c(`h-3.5 w-3.5`,t)})}function Yu({channel:e,className:t}){return(0,H.jsx)(qu,{name:e,src:Pu(e),className:c(`h-[1.125rem] w-[1.125rem]`,t),imgClassName:`h-full w-full object-contain`,fallback:(0,H.jsx)(Xi,{className:`h-3 w-3 text-muted-foreground`})})}function Xu({status:e,className:t}){let n=T(e===`running`?`sessionsRunStatusRunning`:`sessionsRunStatusQueued`);return(0,H.jsxs)(`span`,{className:c(`inline-flex h-3.5 w-3.5 items-center justify-center text-muted-foreground/70`,t),title:n,"aria-label":n,children:[(0,H.jsx)(mi,{className:`h-3 w-3 animate-spin`}),(0,H.jsx)(`span`,{className:`sr-only`,children:n})]})}function Zu({item:e,selectedSessionKey:t,optimisticReadAtBySessionKey:n,sessionTypeOptions:r,onSelect:i}){let{session:a,runStatus:o}=e,s=t===a.key,l=n[a.key],u=l&&a.readAt?l.localeCompare(a.readAt)>0?l:a.readAt:l??a.readAt,d=su({active:s,lastMessageAt:a.lastMessageAt,readAt:u,runStatus:o}),f=cl(a)??a.projectName??a.projectRoot??`${a.messageCount}`,p=fl(a.lastMessageAt??a.createdAt),m=Uu(a,r);return(0,H.jsxs)(`button`,{type:`button`,"aria-current":s?`page`:void 0,className:c(`flex w-full min-w-0 items-start gap-2 rounded-lg px-2.5 py-2 text-left transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,s?`bg-accent text-accent-foreground`:`text-foreground hover:bg-[var(--interaction-hover)] hover:text-accent-foreground`),onClick:()=>i(a.key),children:[(0,H.jsx)(`span`,{className:`relative mt-1 flex h-2.5 w-2.5 shrink-0 items-center justify-center`,children:d?(0,H.jsx)(`span`,{"aria-label":T(`chatSidebarUnread`),className:`h-1.5 w-1.5 rounded-full bg-primary`}):s?(0,H.jsx)(Tr,{className:`h-3 w-3 text-primary`}):(0,H.jsx)(`span`,{className:`h-1 w-1 rounded-full bg-muted-foreground/45`})}),(0,H.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,H.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,H.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs font-medium`,children:ol(a)}),m.label?(0,H.jsx)(`span`,{className:`shrink-0 rounded-full border border-border/70 px-1.5 py-0.5 text-[10px] font-semibold leading-none text-muted-foreground`,children:m.label}):null,m.icon?(0,H.jsx)(`span`,{className:`inline-flex h-[1.125rem] w-[1.125rem] shrink-0 items-center justify-center text-muted-foreground`,children:(0,H.jsx)(Ju,{icon:m.icon})}):null]}),(0,H.jsxs)(`span`,{className:`mt-0.5 flex min-w-0 items-center gap-2 text-[11px] text-muted-foreground`,children:[(0,H.jsx)(`span`,{className:`min-w-0 truncate`,children:f}),(0,H.jsx)(`span`,{className:`shrink-0`,children:p})]})]}),o?(0,H.jsx)(`span`,{className:`mt-0.5 shrink-0`,children:(0,H.jsx)(Xu,{status:o})}):null]})}function Qu({items:e,selectedSessionKey:t,optimisticReadAtBySessionKey:n,sessionTypeOptions:r,onSelect:i,className:a}){return(0,H.jsx)(`div`,{className:c(`space-y-1`,a),children:e.map(e=>(0,H.jsx)(Zu,{item:e,selectedSessionKey:t,optimisticReadAtBySessionKey:n,sessionTypeOptions:r,onSelect:i},e.session.key))})}function $u({group:e,...t}){return(0,H.jsxs)(`section`,{"aria-label":e.label,children:[(0,H.jsx)(`div`,{className:`px-2 py-1 text-[11px] font-medium uppercase tracking-wider text-muted-foreground/70`,children:e.label}),(0,H.jsx)(Qu,{items:e.items,...t})]})}function ed({group:e,isCollapsed:t,onToggleCollapsed:n,...r}){let i=(0,V.useId)(),a=`${T(t?`chatSidebarExpandProject`:`chatSidebarCollapseProject`)} · ${e.projectName}`;return(0,H.jsxs)(`section`,{"aria-label":e.projectName,children:[(0,H.jsxs)(`button`,{type:`button`,"aria-controls":i,"aria-expanded":!t,"aria-label":a,className:`group flex h-10 w-full min-w-0 items-center gap-1.5 rounded-lg px-2 text-left 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`,onClick:()=>n(e.projectRoot),children:[(0,H.jsx)(Ua,{className:`h-3.5 w-3.5 shrink-0`,"aria-hidden":`true`}),(0,H.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[11px] font-medium uppercase tracking-wider`,title:e.projectRoot,children:e.projectName}),(0,H.jsx)(`span`,{className:`shrink-0 text-[10px] text-muted-foreground/70`,children:e.items.length}),t?(0,H.jsx)(oa,{className:`h-3.5 w-3.5 shrink-0`,"aria-hidden":`true`}):(0,H.jsx)(er,{className:`h-3.5 w-3.5 shrink-0`,"aria-hidden":`true`})]}),t?null:(0,H.jsx)(Qu,{items:e.items,className:`mt-0.5`,...r})]})}function td({collapsedProjectRoots:e,dateGroups:t,isProjectFirstView:n,onToggleProjectCollapsed:r,projectGroups:i,...a}){return(0,H.jsx)(`div`,{className:`space-y-3`,children:n?i.map(t=>(0,H.jsx)(ed,{group:t,isCollapsed:e.includes(t.projectRoot),onToggleCollapsed:r,...a},t.projectRoot)):t.map(e=>(0,H.jsx)($u,{group:e,...a},e.label))})}var nd=N(e=>({snapshot:{},setSnapshot:t=>e(({snapshot:e})=>({snapshot:{...e,...t}}))})),rd=[`projects`];function id(e={}){return dn({queryKey:rd,queryFn:Be,enabled:e.enabled??!0,staleTime:3e4})}function ad(){let e=yn();return zt({mutationFn:Ce,onSuccess:async()=>{await e.invalidateQueries({queryKey:rd}),L.success(T(`chatProjectCreated`))},onError:e=>{L.error(`${T(`chatProjectCreateFailed`)}: ${e.message}`)}})}function od(){let e=yn();return zt({mutationFn:Te,onSuccess:async()=>{await e.invalidateQueries({queryKey:rd}),L.success(T(`chatProjectExistingAdded`))},onError:e=>{L.error(`${T(`chatProjectExistingFailed`)}: ${e.message}`)}})}var sd=`group inline-flex min-w-0 max-w-full items-center gap-1.5 rounded-md px-1.5 py-1 text-sm font-medium text-foreground transition-colors hover:bg-[var(--interaction-hover)] hover:text-accent-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`;function cd({title:e}){return(0,H.jsx)(`span`,{className:`text-sm font-medium text-foreground truncate`,children:e})}function ld({label:e}){return(0,H.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-4 text-xs text-muted-foreground`,children:[(0,H.jsx)(po,{className:`h-4 w-4 shrink-0 text-muted-foreground/55`}),(0,H.jsx)(`span`,{children:e})]})}function ud(){return(0,H.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-4 text-xs text-muted-foreground`,children:[(0,H.jsx)(mi,{className:`h-4 w-4 shrink-0 animate-spin`}),(0,H.jsx)(`span`,{children:T(`sessionsLoading`)})]})}function dd({selectedSessionKey:e,title:t}){let n=il(),[r,i]=(0,V.useState)(!1),[a,o]=(0,V.useState)(``),s=du(e=>e.optimisticReadAtBySessionKey),l=du(e=>e.snapshot.pinnedSessionKeys),u=du(e=>e.snapshot.pinnedProjectRoots),d=du(e=>e.snapshot.collapsedProjectRoots),f=du(e=>e.snapshot.listMode),p=nd(e=>e.snapshot.sessionTypesQuery?.data??null),{isLoading:m,items:h}=vu({query:a}),g=id(),_=(0,V.useMemo)(()=>{let e=a.trim().toLowerCase(),t=g.data?.projects??[];return e?t.filter(t=>t.name.toLowerCase().includes(e)||t.rootPath.toLowerCase().includes(e)):t},[g.data?.projects,a]),v=(0,V.useMemo)(()=>bu(h),[h]),y=(0,V.useMemo)(()=>Su(v,new Set(l)),[l,v]),b=(0,V.useMemo)(()=>Cu(v,new Set(l),new Set(u),_),[u,l,v,_]),x=(0,V.useMemo)(()=>ju(p?.options??[]),[p?.options]),S=t=>{i(!1),o(``),t!==e&&n.chatSessionListManager.selectSession(t)},C=e=>{i(e),e||o(``)},w={selectedSessionKey:e,optimisticReadAtBySessionKey:s,sessionTypeOptions:x,onSelect:S},E=f===`project-first`,D=E?b.length>0:y.length>0;return(0,H.jsxs)(Tc,{open:r,onOpenChange:C,children:[(0,H.jsx)(Ec,{asChild:!0,children:(0,H.jsxs)(`button`,{type:`button`,"aria-label":`${T(`chatSessionSwitch`)}: ${t}`,"aria-expanded":r,className:sd,children:[(0,H.jsx)(`span`,{className:`min-w-0 truncate`,children:t}),(0,H.jsx)(er,{className:c(`h-3.5 w-3.5 shrink-0 text-muted-foreground transition-transform group-hover:text-accent-foreground`,r?`rotate-180`:null)})]})}),(0,H.jsxs)(Oc,{align:`start`,className:`w-[22rem] max-w-[calc(100vw-2rem)] p-0`,children:[(0,H.jsxs)(`div`,{className:`space-y-2 border-b border-border px-3 py-2`,children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,H.jsx)(`div`,{className:`text-[11px] font-medium uppercase tracking-wider text-muted-foreground/75`,children:T(`chatSessionSwitcherTitle`)}),(0,H.jsx)(Eu,{isProjectFirstView:E,onSelectMode:n.chatSessionListManager.setListMode})]}),(0,H.jsxs)(`div`,{className:`relative`,children:[(0,H.jsx)(fi,{className:`pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground/65`}),(0,H.jsx)(Gt,{value:a,onChange:e=>o(e.target.value),placeholder:T(`chatSearchSessionPlaceholder`),"aria-label":T(`chatSearchSessionPlaceholder`),className:`h-8 rounded-lg bg-background pl-8 pr-2 text-xs`,autoFocus:!0})]})]}),(0,H.jsx)(`div`,{className:`max-h-80 overflow-y-auto p-1.5`,children:m?(0,H.jsx)(ud,{}):D?(0,H.jsx)(td,{collapsedProjectRoots:d,dateGroups:y,isProjectFirstView:E,onToggleProjectCollapsed:n.chatSessionListManager.toggleProjectCollapsed,projectGroups:b,...w}):(0,H.jsx)(ld,{label:a.trim()?T(`chatSessionSwitcherNoResults`):T(E?`chatSidebarProjectViewEmpty`:`sessionsEmpty`)})})]})]})}function fd({layoutMode:e,selectedSessionKey:t,title:n}){let r=Hs(e=>e.isSidebarCollapsed);return e===`desktop`&&!r?(0,H.jsx)(cd,{title:n}):(0,H.jsx)(dd,{selectedSessionKey:t,title:n})}var pd=Se.chat.newSessionType,md=[`preference`,pd];function hd(e,t){let n=Ou(e);return t.find(e=>e.value===n&&e.ready!==!1)??null}function gd(e){let{defaultSessionType:t,preferredSessionType:n,sessionTypeOptions:r}=e,i=n?hd(n,r):null,a=hd(t,r);return i??a??r.find(e=>e.ready!==!1)??r[0]??{value:Ou(t),label:Ou(t),icon:null,ready:!0,reason:null,reasonMessage:null,supportedModels:void 0,recommendedModel:null,modelSelectionMode:`nextclaw`,runtimeDefaultThinking:null,cta:null}}function _d(e){return typeof e?.value==`string`?Ou(e.value):null}function vd({defaultSessionType:e,sessionTypeOptions:t}){let n=yn(),r=dn({queryKey:md,queryFn:()=>gn(pd),staleTime:3e4,retry:!1}),i=(0,V.useMemo)(()=>_d(r.data),[r.data]),a=(0,V.useMemo)(()=>gd({preferredSessionType:i,defaultSessionType:e,sessionTypeOptions:t}),[e,i,t]),o=zt({mutationFn:async e=>await Ye(pd,Ou(e)),onMutate:async e=>{let t=Ou(e);await n.cancelQueries({queryKey:md});let r=n.getQueryData(md);return n.setQueryData(md,{key:pd,value:t,updatedAt:new Date().toISOString()}),{previous:r}},onError:(e,t,r)=>{r?.previous&&n.setQueryData(md,r.previous)},onSuccess:e=>{n.setQueryData(md,e)}}),s=(0,V.useCallback)(e=>{let n=hd(e,t);n&&o.mutate(n.value)},[t,o]);return{selectedSessionType:a.value,selectedSessionTypeOption:a,isLoading:r.isLoading,setSelectedSessionType:s}}var yd=[];function bd(){let e=nd(e=>!!(e.snapshot.configQuery?.isFetched||e.snapshot.configQuery?.isSuccess)),t=nd(e=>!!(e.snapshot.providersQuery?.isFetched||e.snapshot.providersQuery?.isSuccess)),n=nd(e=>!!(e.snapshot.providerTemplatesQuery?.isFetched||e.snapshot.providerTemplatesQuery?.isSuccess));return e&&t&&n}function xd(e){let t=nd(e=>e.snapshot.sessionsQuery?.data?.sessions??yd),n=(0,V.useMemo)(()=>$l(t),[t]);return(0,V.useMemo)(()=>n.find(t=>t.key===e)??null,[n,e])}function Sd(e){return!!e&&typeof e==`object`}function Cd(e){return typeof e==`string`&&e.trim().length>0?e.trim():null}function wd(e){return typeof e==`number`&&Number.isFinite(e)?e:null}function Td(e){return typeof e==`string`?e:null}function Ed(e){return e===`auto`||e===`source`||e===`rendered`?e:null}function Dd(e){try{return h(e)??null}catch{return null}}function Od(e){if(!Sd(e)||typeof e.key!=`string`||typeof e.path!=`string`||e.viewMode!==`preview`&&e.viewMode!==`diff`)return null;let t=e.key.trim(),n=e.path.trim();return!t||!n?null:{key:t,parentSessionKey:Cd(e.parentSessionKey),path:n,label:Cd(e.label),viewMode:e.viewMode,previewViewer:Ed(e.previewViewer),line:wd(e.line),column:wd(e.column),params:Dd(e.params),rawText:Td(e.rawText),contentUrl:Cd(e.contentUrl),mimeType:Cd(e.mimeType),beforeText:Td(e.beforeText),afterText:Td(e.afterText),patchText:Td(e.patchText),oldStartLine:wd(e.oldStartLine),newStartLine:wd(e.newStartLine)}}function kd(e){return{key:e.key,parentSessionKey:e.parentSessionKey,path:e.path,label:e.label,viewMode:e.viewMode,previewViewer:e.previewViewer,line:e.line,column:e.column,params:e.params,rawText:e.rawText,contentUrl:e.contentUrl,mimeType:e.mimeType,beforeText:e.beforeText,afterText:e.afterText,patchText:e.patchText,oldStartLine:e.oldStartLine,newStartLine:e.newStartLine}}function Ad(e,t,n){let r=e.slice(0,n),i=t?e.find(e=>e.key===t):null;return!i||r.some(e=>e.key===i.key)?r:r.length<n?[...r,i]:[...r.slice(0,-1),i]}function jd(e){return typeof e!=`number`||!Number.isFinite(e)?480:Math.max(360,Math.min(860,e))}function Md(e){return typeof e!=`number`||!Number.isFinite(e)?224:Math.max(192,Math.min(400,e))}function Nd(e){return e.index>0&&e.entries.length>0}function Pd(e){return e.index>=0&&e.index<e.entries.length-1}function Fd(e,t,n=Object.is){let r=Rd(e),i=e.entries[r];if(i&&n(i,t))return{entries:e.entries,index:r};let a=[...e.entries.slice(0,r+1),t];return{entries:a,index:a.length-1}}function Id(e,t){let n=Rd(e),r=t===`back`?n-1:n+1,i=e.entries[r];return i?{history:{entries:e.entries,index:r},entry:i}:null}function Ld(e,t,n){let r=Rd(e),i=e.entries.filter(t);if(i.length===0)return n===void 0?{entries:[],index:0}:{entries:[n],index:0};let a=e.entries.slice(0,r+1).filter(t);return{entries:i,index:Math.min(Math.max(0,a.length-1),i.length-1)}}function Rd(e){return e.entries.length===0?0:Number.isInteger(e.index)?Math.min(Math.max(0,e.index),e.entries.length-1):e.entries.length-1}function zd(e){return/\.html?$/i.test(e)?`html`:/\.mdx?$/i.test(e)?`markdown`:null}function Bd(e,t){let n=zd(e);return n===`html`?t===`rendered`?`rendered`:`source`:n===`markdown`?t===`source`?`source`:`rendered`:t===`source`||t===`rendered`?t:null}function Vd(e,t){return Bd(e,t)??t??null}function Hd(e,t){return zd(e)?Bd(e,t)===`source`?`rendered`:`source`:null}function Ud(e,t){let n=e.path.trim();if(!n)return null;let r=t?.trim()||null,i=e.viewMode===`preview`?Vd(n,e.previewViewer??(e.line?`source`:void 0)):e.previewViewer??null,a=e.viewMode===`preview`&&i===`rendered`?`preview:rendered`:e.viewMode;return{key:`${r??`draft`}::${a}::${n}`,parentSessionKey:r,path:n,label:e.label?.trim()||null,viewMode:e.viewMode,previewViewer:i,line:e.line??null,column:e.column??null,params:e.params??null,rawText:e.rawText??null,contentUrl:e.contentUrl?.trim()||null,mimeType:e.mimeType?.trim()||null,beforeText:e.beforeText??null,afterText:e.afterText??null,patchText:e.patchText??null,oldStartLine:e.oldStartLine??null,newStartLine:e.newStartLine??null,fullLines:e.fullLines}}function Wd(e,t,n){let r=e.findIndex(e=>e.key===t.key);if(r!==-1){let n=[...e];return n[r]={...e[r],...t},n}let i=n?e.findIndex(e=>e.key===n):-1;return i===-1?[t,...e]:[...e.slice(0,i+1),t,...e.slice(i+1)]}function Gd(e,t,n){let r=e.viewMode===`preview`&&e.previewViewer===`rendered`?`preview:rendered`:e.viewMode;return{...e,key:`${e.parentSessionKey??`draft`}::${r}::${t}`,path:t,label:n?.trim()||e.label}}function Kd(e,t){let n=t.trim(),r=e.key.indexOf(`::`),i=r>=0?e.key.slice(r):`::${e.key}`;return{...e,key:`${n}${i}`,parentSessionKey:n}}function qd(e,t){return e.kind===t.kind?e.kind===`overview`||e.kind===`child-sessions`||e.kind===`project-files`||e.kind===`cron`?!0:t.kind!==`overview`&&t.kind!==`child-sessions`&&t.kind!==`project-files`&&t.kind!==`cron`&&e.key===t.key:!1}function Jd(e){let{activeChildSessionKey:t,activeSideChatDraft:n,activeWorkspaceFileKey:r,activeWorkspacePanelKind:i}=e;return i===`overview`||i===`child-sessions`||i===`project-files`||i===`cron`?{kind:i}:i===`child-session`&&t?{kind:`child-session`,key:t}:i===`side-chat-draft`&&n?{kind:`side-chat-draft`,key:n.draftKey}:i===`file`&&r?{kind:`file`,key:r}:null}function Yd(e,t){if(e.kind===`overview`||e.kind===`child-sessions`||e.kind===`project-files`)return{activeWorkspacePanelKind:e.kind,activeChildSessionKey:null,activeSideChatDraft:null,activeWorkspaceFileKey:null};if(e.kind===`cron`)return{activeWorkspacePanelKind:`cron`,activeChildSessionKey:null,activeSideChatDraft:null,activeWorkspaceFileKey:null};if(e.kind===`file`)return t.workspaceFileTabs.some(t=>t.key===e.key)?{activeWorkspacePanelKind:`file`,activeChildSessionKey:null,activeSideChatDraft:null,activeWorkspaceFileKey:e.key}:null;if(e.kind===`side-chat-draft`){let{activeSideChatDraft:n}=t;return n?.draftKey===e.key?{activeWorkspacePanelKind:`side-chat-draft`,activeChildSessionKey:null,activeSideChatDraft:n,activeWorkspaceFileKey:null}:null}return{activeWorkspacePanelKind:`child-session`,activeChildSessionKey:e.key,activeSideChatDraft:null,activeWorkspaceFileKey:null}}function Xd(e,t){if(t.kind===`overview`||t.kind===`child-sessions`||t.kind===`cron`||t.kind===`project-files`)return null;let n=Ld({entries:e.workspaceNavigationHistory,index:e.workspaceNavigationHistoryIndex},e=>!qd(e,t),{kind:`overview`}),r={closedWorkspaceTabEntries:t.kind!==`file`&&t.kind!==`side-chat-draft`?[...e.closedWorkspaceTabEntries.filter(e=>!qd(e,t)),t]:e.closedWorkspaceTabEntries,childSessionTabs:t.kind===`child-session`?e.childSessionTabs.filter(e=>e.sessionKey!==t.key):e.childSessionTabs,activeSideChatDraft:t.kind===`side-chat-draft`?null:e.activeSideChatDraft,workspaceFileTabs:t.kind===`file`?e.workspaceFileTabs.filter(e=>e.key!==t.key):e.workspaceFileTabs,workspaceNavigationHistory:[...n.entries],workspaceNavigationHistoryIndex:n.index},i=Jd(e);if(!i||!qd(i,t))return r;let a=Yd(n.entries[n.index]??{kind:`overview`},{...e,...r});return{...r,...a??Yd({kind:`overview`},e)}}function Zd(e){return{draftKey:`side-chat-draft:${e}:${typeof globalThis.crypto?.randomUUID==`function`?globalThis.crypto.randomUUID():`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`}`,parentSessionKey:e}}function Qd(e,t){let n=e.findIndex(e=>e.sessionKey===t.sessionKey);if(n===-1)return[t,...e];let r=e[n],i=[...e];return i[n]={...r,parentSessionKey:r.parentSessionKey??t.parentSessionKey,label:r.label?.trim()?r.label:t.label,agentId:r.agentId?.trim()?r.agentId:t.agentId},i}function $d(e,t){let n=t.trim();if(!n)return null;let r=new Map,i=e.workspaceFileTabs.map(e=>{if(e.parentSessionKey!==null)return e;let t=Kd(e,n);return r.set(e.key,t.key),t}),a=e=>{if(e.kind!==`file`)return e;let t=r.get(e.key);return t?{...e,key:t}:e};return{draftProjectRoot:null,workspaceFileTabs:i,activeWorkspaceFileKey:e.activeWorkspaceFileKey?r.get(e.activeWorkspaceFileKey)??e.activeWorkspaceFileKey:null,closedWorkspaceTabEntries:e.closedWorkspaceTabEntries.map(a),workspaceNavigationHistory:e.workspaceNavigationHistory.map(a),workspacePanelParentKey:e.workspacePanelParentKey===null&&e.activeWorkspacePanelKind?n:e.workspacePanelParentKey}}function ef(e){let{agentId:t,draftKey:n,label:r,sessionKey:i,snapshot:a}=e,o=i.trim(),s=n.trim(),{activeSideChatDraft:c}=a;if(!o||!s||c?.draftKey!==s)return null;let{parentSessionKey:l}=c,u=Fd(Ld({entries:a.workspaceNavigationHistory,index:a.workspaceNavigationHistoryIndex},e=>e.kind!==`side-chat-draft`||e.key!==s),{kind:`child-session`,key:o},qd);return{parentSessionKey:l,patch:{workspacePanelParentKey:l,activeWorkspacePanelKind:`child-session`,activeChildSessionKey:o,activeSideChatDraft:null,activeWorkspaceFileKey:null,childSessionTabs:Qd(a.childSessionTabs,{sessionKey:o,parentSessionKey:l,label:r?.trim()||null,agentId:t?.trim()||null}),workspaceNavigationHistory:[...u.entries],workspaceNavigationHistoryIndex:u.index}}}var tf=`nextclaw.chat.workspace-panel.state`,nf=2,rf=8,af={sessionTypeLabel:null,sessionTypeIcon:null,sessionKey:null,agentId:null,sessionDisplayName:void 0,draftProjectRoot:null,sessionProjectName:null,canDeleteSession:!1,isDeletePending:!1,isHistoryLoading:!1,messages:[],isSending:!1,isAwaitingAssistantOutput:!1,hasSubmittedDraftMessage:!1,parentSessionKey:null,parentSessionLabel:null,workspacePanelParentKey:null,activeWorkspacePanelKind:null,childSessionTabs:[],activeChildSessionKey:null,activeSideChatDraft:null,workspaceFileTabs:[],activeWorkspaceFileKey:null,closedWorkspaceTabEntries:[],workspaceNavigationHistory:[],workspaceNavigationHistoryIndex:0,workspaceExplorerOpen:!1,workspaceExplorerWidth:224,workspacePanelWidth:480,contextWindow:null};function of(e){return!!e&&typeof e==`object`}function sf(e){return typeof e==`string`&&e.trim().length>0?e.trim():null}function cf(e,t){return typeof e==`number`&&Number.isInteger(e)?Math.min(Math.max(0,e),t):t}function lf(e){return e===`overview`||e===`child-sessions`||e===`child-session`||e===`project-files`||e===`file`||e===`cron`}function uf(e){if(!of(e))return null;if(e.kind===`overview`||e.kind===`child-sessions`||e.kind===`project-files`||e.kind===`cron`)return{kind:e.kind};let t=sf(e.key);return!t||e.kind!==`child-session`&&e.kind!==`file`?null:{kind:e.kind,key:t}}function df(e){if(!of(e))return null;let t=sf(e.workspacePanelParentKey),n=sf(e.activeWorkspaceFileKey),r=Ad(Array.isArray(e.workspaceFileTabs)?e.workspaceFileTabs.map(Od).filter(e=>e!==null):[],n,rf),i=r.filter(e=>e.parentSessionKey===t),a=n&&i.some(e=>e.key===n)?n:i[0]?.key??null,o=lf(e.activeWorkspacePanelKind)?e.activeWorkspacePanelKind:null,s=o===`file`&&!a?null:o,c=sf(e.activeChildSessionKey),l=Array.isArray(e.closedWorkspaceTabEntries)?e.closedWorkspaceTabEntries.map(uf).filter(e=>e!==null&&e.kind!==`overview`):[],u=Jd({activeWorkspacePanelKind:s,activeChildSessionKey:c,activeSideChatDraft:null,activeWorkspaceFileKey:a}),d=Array.isArray(e.workspaceNavigationHistory)?e.workspaceNavigationHistory.map(uf).filter(e=>e!==null).filter(e=>e.kind!==`file`||r.some(t=>t.key===e.key)):[],f=d.length>0?d:u?[u]:[];return{workspacePanelParentKey:t,activeWorkspacePanelKind:s,activeChildSessionKey:c,workspaceFileTabs:r,activeWorkspaceFileKey:a,closedWorkspaceTabEntries:l,workspaceNavigationHistory:f,workspaceNavigationHistoryIndex:f.length>0?cf(e.workspaceNavigationHistoryIndex,f.length-1):0,workspaceExplorerOpen:e.workspaceExplorerOpen===!0,workspaceExplorerWidth:Md(e.workspaceExplorerWidth),workspacePanelWidth:jd(e.workspacePanelWidth)}}var U=N()(yi(e=>({snapshot:af,setSnapshot:t=>e(e=>({snapshot:{...e.snapshot,...t}}))}),{name:tf,version:nf,storage:bi(()=>window.localStorage),partialize:e=>{let t=e.snapshot.workspaceNavigationHistory.filter(e=>e.kind!==`side-chat-draft`),n=t.length>0?Math.min(e.snapshot.workspaceNavigationHistoryIndex,t.length-1):0;return{snapshot:{workspacePanelParentKey:e.snapshot.workspacePanelParentKey,activeWorkspacePanelKind:e.snapshot.activeWorkspacePanelKind===`side-chat-draft`?null:e.snapshot.activeWorkspacePanelKind,activeChildSessionKey:e.snapshot.activeChildSessionKey,workspaceFileTabs:Ad(e.snapshot.workspaceFileTabs,e.snapshot.activeWorkspaceFileKey,rf).map(kd),activeWorkspaceFileKey:e.snapshot.activeWorkspaceFileKey,closedWorkspaceTabEntries:e.snapshot.closedWorkspaceTabEntries.filter(e=>e.kind!==`overview`&&e.kind!==`side-chat-draft`),workspaceNavigationHistory:t,workspaceNavigationHistoryIndex:n,workspaceExplorerOpen:e.snapshot.workspaceExplorerOpen,workspaceExplorerWidth:e.snapshot.workspaceExplorerWidth,workspacePanelWidth:e.snapshot.workspacePanelWidth}}},merge:(e,t)=>{let n=df(of(e)?e.snapshot:null);return n?{...t,snapshot:{...t.snapshot,...n}}:t}})),ff=[[`bg-amber-100`,`text-amber-700`],[`bg-emerald-100`,`text-emerald-700`],[`bg-blue-100`,`text-blue-700`],[`bg-rose-100`,`text-rose-700`],[`bg-cyan-100`,`text-cyan-700`],[`bg-violet-100`,`text-violet-700`]];function pf(e){let t=0;for(let n=0;n<e.length;n+=1)t=(t<<5)-t+e.charCodeAt(n),t|=0;return Math.abs(t)}function mf({agentId:e,displayName:t,avatarUrl:n,className:r}){let i=t?.trim()||e,a=e.trim().toLowerCase()===`main`,[o,s]=a?[`bg-[#ede7dc] [html[data-theme-appearance=dark]_&]:bg-[#373229]`,`text-[#57534e] [html[data-theme-appearance=dark]_&]:text-[#e2ded7]`]:ff[pf(e)%ff.length]??ff[0];return n?.trim()?(0,H.jsx)(`img`,{src:n,alt:t?.trim()||e,className:c(`rounded-full object-cover`,r)}):(0,H.jsx)(`div`,{className:c(`rounded-full flex items-center justify-center font-semibold`,o,s,r),"aria-label":t?.trim()||e,children:a?(0,H.jsx)(Xi,{className:`h-[55%] w-[55%]`,strokeWidth:2.4}):(i.trim()||`A`).slice(0,1).toUpperCase()})}function hf(){return dn({queryKey:[`agents`],queryFn:Ze,staleTime:3e4})}function gf(){let e=yn();return zt({mutationFn:({agentId:e,data:t})=>De(e,t),onSuccess:()=>{e.invalidateQueries({queryKey:[`agents`]}),e.invalidateQueries({queryKey:[`config`]}),L.success(T(`configSavedApplied`))},onError:e=>{L.error(T(`configSaveFailed`)+`: `+e.message)}})}function _f(){let e=yn();return zt({mutationFn:({agentId:e})=>_n(e),onSuccess:()=>{e.invalidateQueries({queryKey:[`agents`]}),e.invalidateQueries({queryKey:[`config`]}),L.success(T(`configSavedApplied`))},onError:e=>{L.error(T(`configSaveFailed`)+`: `+e.message)}})}function vf(e){return new Map(e.filter(e=>typeof e.id==`string`&&e.id.trim().length>0).map(e=>[e.id,e]))}function yf(e){let t=e?.trim()??``,n=hf(),r=(0,V.useMemo)(()=>vf(n.data?.agents??[]),[n.data?.agents]);return(0,V.useMemo)(()=>{if(!t)return null;let e=r.get(t)??null;return{agentId:t,profile:e,displayName:e?.displayName?.trim()||t,avatarUrl:e?.avatarUrl?.trim()||null}},[r,t])}function bf({agentId:e,className:t}){let n=yf(e);return n?(0,H.jsx)(mf,{agentId:n.agentId,displayName:n.displayName,avatarUrl:n.avatarUrl,className:t}):null}function xf({layoutMode:e,onBackToList:t}){let n=il(),r=U(e=>e.snapshot),i=du(e=>e.snapshot.selectedSessionKey),a=du(e=>e.snapshot.selectedAgentId),o=nd(e=>e.snapshot.sessionTypesQuery?.data??null),s=nd(e=>e.snapshot.configQuery?.data??null),c=xd(i),l=(0,V.useMemo)(()=>ju(o?.options??[]),[o?.options]),u=Ou(o?.defaultType??`native`),d=vd({defaultSessionType:u,sessionTypeOptions:l}),f=Ou(c?.sessionType??u),p=l.find(e=>e.value===f)??null,m=p?.label??Au(f),h=f!==`native`&&!!m,g=c?.projectRoot??null,_=_l(s?.agents.defaults.workspace),v=c?.projectName??vl(g),y=!!c,b=!!(i||m),x=(c?ol(c):void 0)||(y&&i?i:null)||T(`chatSidebarNewTask`),S=c?.agentId?.trim()??a?.trim()??``,C=S.length>0&&S.toLowerCase()!==`main`,w=!!(r.workspacePanelParentKey===i&&r.activeWorkspacePanelKind);return(0,H.jsx)(Gs,{layoutMode:e,title:x,titleContent:(0,H.jsx)(fd,{layoutMode:e,selectedSessionKey:i,title:x}),shouldShow:b,onBackToList:t,leading:C?(0,H.jsx)(`div`,{className:`inline-flex shrink-0 items-center`,children:(0,H.jsx)(bf,{agentId:S,className:`h-5 w-5`})}):null,sessionTypeBadge:h?(0,H.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1.5 rounded-full border border-border bg-muted px-2 py-0.5 text-[11px] font-medium text-muted-foreground`,children:[p?.icon?.src?(0,H.jsx)(`span`,{className:`inline-flex h-[1.125rem] w-[1.125rem] items-center justify-center`,children:(0,H.jsx)(Ju,{icon:{kind:`runtime-image`,src:p.icon.src,alt:p.icon.alt??null,name:m}})}):null,m]}):null,projectBadge:v?(0,H.jsx)(tl,{sessionKey:i??`draft`,projectName:v,projectRoot:g,defaultWorkspacePath:_,persistToServer:y}):null,actions:(0,H.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[e===`mobile`&&i?(0,H.jsx)(B,{icon:(0,H.jsx)(Ho,{className:`h-4 w-4`}),label:T(`chatSidebarNewTask`),tooltip:!1,onClick:()=>n.chatSessionListManager.createSession({sessionType:d.selectedSessionType})}):null,(0,H.jsx)($c,{sessionKey:i,canDeleteSession:y,isDeletePending:r.isDeletePending,currentPath:g??c?.workingDir??r.draftProjectRoot??_,defaultWorkspacePath:_,metadata:c?.metadata??null,isWorkspaceOpen:w,onToggleWorkspace:()=>{n.chatThreadManager.toggleWorkspacePanel(i)},onDeleteSession:n.chatThreadManager.deleteSession})]})})}function Sf(){let e=il(),t=U(e=>e.snapshot);return(0,H.jsx)(Ws,{parentSessionLabel:t.parentSessionKey?t.parentSessionLabel??null:null,onGoToParentSession:e.chatThreadManager.goToParentSession})}function Cf(e,t){return e.label?.trim()?e.label.trim():t?ol(t):e.sessionKey}function wf(e){let t=pu({limit:200}),n=(0,V.useMemo)(()=>t.data?.sessions??[],[t.data?.sessions]),r=(0,V.useMemo)(()=>{let e=$l(n);return new Map(e.map(e=>[e.key,e]))},[n]);return(0,V.useMemo)(()=>e.map(e=>{let t=r.get(e.sessionKey)??null,n=e.agentId?.trim()||t?.agentId||null;return{sessionKey:e.sessionKey,parentSessionKey:e.parentSessionKey,title:Cf(e,t),agentId:n,updatedAt:t?.updatedAt??null,lastMessageAt:t?.lastMessageAt??null,readAt:t?.readAt??null,runStatus:t?.status===`running`?`running`:void 0,sessionTypeLabel:t?.sessionType?Au(t.sessionType):null,preferredModel:t?.preferredModel?.trim()||null,projectName:t?.projectName?.trim()||null,projectRoot:t?.projectRoot?.trim()||null}}),[r,e])}function Tf(e){let t=e.path.split(`/`).filter(Boolean).pop();return e.label?.trim()||t||e.path}function Ef(e){let{activePanelKind:t,activeChildSessionKey:n,activeSideChatDraft:r,activeWorkspaceFileKey:i,childSessionTabs:a,workspaceFileTabs:o}=e;if(t===`overview`)return{kind:`overview`};if(t===`child-sessions`)return{kind:`child-sessions`};if(t===`project-files`)return{kind:`project-files`};if(t===`cron`)return{kind:`cron`};if(t===`side-chat-draft`&&r)return{kind:`side-chat-draft`,draft:r};if(t!==`child-session`&&i){let e=o.find(e=>e.key===i);if(e)return{kind:`file`,file:e}}if(t!==`file`&&n){let e=a.find(e=>e.sessionKey===n);if(e)return{kind:`child-session`,tab:e}}return a[0]?{kind:`child-session`,tab:a[0]}:r?{kind:`side-chat-draft`,draft:r}:o[0]?{kind:`file`,file:o[0]}:null}function Df({activeSelection:e,hasSession:t,onSelectChildSessions:n,onSelectCronJobs:r,onSelectOverview:i,onSelectProjectFiles:a}){let o=[{key:`overview`,kind:`overview`,title:T(`chatWorkspaceOverview`),tooltip:T(`chatWorkspaceOverview`),active:e?.kind===`overview`,onSelect:i},{key:`child-sessions`,kind:`child-sessions`,title:T(`chatWorkspaceChildSessions`),tooltip:T(`chatWorkspaceChildSessions`),active:e?.kind===`child-sessions`,onSelect:n},{key:`cron:session`,kind:`cron`,title:T(`chatWorkspaceSessionCronJobs`),tooltip:T(`chatWorkspaceSessionCronJobs`),active:e?.kind===`cron`,onSelect:r},{key:`project-files`,kind:`project-files`,title:T(`chatWorkspaceProjectFiles`),tooltip:T(`chatWorkspaceProjectFiles`),active:e?.kind===`project-files`,onSelect:a}];return t?o:o.filter(e=>e.kind===`project-files`)}function Of(e){let{hasSession:t,activeSideChatDraft:n,closedWorkspaceTabEntries:r,resolvedChildTabs:i,workspaceFileTabs:a,activeSelection:o,optimisticReadAtBySessionKey:s,sessionProjectRoot:c,onAddFileToChat:l,onSelectSession:u,onSelectFile:d,onOpenFileViewer:f,onCloseTab:p,onSelectOverview:m,onSelectChildSessions:h,onSelectProjectFiles:g,onSelectCronJobs:_}=e,v=Df({activeSelection:o,hasSession:t,onSelectChildSessions:h,onSelectCronJobs:_,onSelectOverview:m,onSelectProjectFiles:g}),y=n?[{key:`side-chat-draft:${n.draftKey}`,kind:`side-chat-draft`,title:T(`chatWorkspaceSideChatDraftTitle`),tooltip:T(`chatWorkspaceSideChatDraftSubtitle`),active:o?.kind===`side-chat-draft`&&o.draft.draftKey===n.draftKey,onSelect:()=>void 0,onClose:()=>p({kind:`side-chat-draft`,key:n.draftKey})}]:[],b=i.filter(e=>!r.some(t=>qd(t,{kind:`child-session`,key:e.sessionKey}))).map(e=>{let t=s[e.sessionKey],n=t&&e.readAt?t.localeCompare(e.readAt)>0?t:e.readAt:t??e.readAt;return{key:`child:${e.sessionKey}`,kind:`child-session`,title:e.title,tooltip:e.title,agentId:e.agentId,active:o?.kind===`child-session`&&o.tab.sessionKey===e.sessionKey,showUnreadDot:su({active:o?.kind===`child-session`&&o.tab.sessionKey===e.sessionKey,lastMessageAt:e.lastMessageAt,readAt:n,runStatus:e.runStatus}),onSelect:()=>u(e.sessionKey),onClose:()=>p({kind:`child-session`,key:e.sessionKey})}}),x=a.map(e=>{let t=e.viewMode===`preview`?Bd(e.path,e.previewViewer):null,n=e.viewMode===`preview`?Hd(e.path,e.previewViewer):null,r=Tf(e),i=Tl({path:e.path,sessionProjectRoot:c??null});return{key:`file:${e.key}`,kind:`file`,title:t===`rendered`?`${T(`chatWorkspacePreview`)}: ${r}`:r,tooltip:e.path,fileName:e.path,viewMode:e.viewMode,isRenderedPreview:t===`rendered`,alternateViewerAction:n?{label:T(n===`rendered`?`chatWorkspaceOpenPreview`:`chatWorkspaceOpenSource`),viewer:n,onSelect:()=>f(e.key,n)}:null,onAddToChat:i&&l?()=>l({label:r,tokenKey:i}):void 0,active:o?.kind===`file`&&o.file.key===e.key,onSelect:()=>d(e.key),onClose:()=>p({kind:`file`,key:e.key})}});return[...v,...y,...b,...x]}function kf(e,t){let n=e.icons,r=e.aliases||Object.create(null),i=Object.create(null);function a(e){if(n[e])return i[e]=[];if(!(e in i)){i[e]=null;let t=r[e]&&r[e].parent,n=t&&a(t);n&&(i[e]=[t].concat(n))}return i[e]}return Object.keys(n).concat(Object.keys(r)).forEach(a),i}var Af=Object.freeze({left:0,top:0,width:16,height:16}),jf=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),Mf=Object.freeze({...Af,...jf}),Nf=Object.freeze({...Mf,body:``,hidden:!1});function Pf(e,t){let n={};!e.hFlip!=!t.hFlip&&(n.hFlip=!0),!e.vFlip!=!t.vFlip&&(n.vFlip=!0);let r=((e.rotate||0)+(t.rotate||0))%4;return r&&(n.rotate=r),n}function Ff(e,t){let n=Pf(e,t);for(let r in Nf)r in jf?r in e&&!(r in n)&&(n[r]=jf[r]):r in t?n[r]=t[r]:r in e&&(n[r]=e[r]);return n}function If(e,t,n){let r=e.icons,i=e.aliases||Object.create(null),a={};function o(e){a=Ff(r[e]||i[e],a)}return o(t),n.forEach(o),Ff(e,a)}function Lf(e,t){let n=[];if(typeof e!=`object`||typeof e.icons!=`object`)return n;e.not_found instanceof Array&&e.not_found.forEach(e=>{t(e,null),n.push(e)});let r=kf(e);for(let i in r){let a=r[i];a&&(t(i,If(e,i,a)),n.push(i))}return n}var Rf={provider:``,aliases:{},not_found:{},...Af};function zf(e,t){for(let n in t)if(n in e&&typeof e[n]!=typeof t[n])return!1;return!0}function Bf(e){if(typeof e!=`object`||!e)return null;let t=e;if(typeof t.prefix!=`string`||!e.icons||typeof e.icons!=`object`||!zf(e,Rf))return null;let n=t.icons;for(let e in n){let t=n[e];if(!e||typeof t.body!=`string`||!zf(t,Nf))return null}let r=t.aliases||Object.create(null);for(let e in r){let t=r[e],i=t.parent;if(!e||typeof i!=`string`||!n[i]&&!r[i]||!zf(t,Nf))return null}return t}var Vf=Object.create(null);function Hf(e,t){return{provider:e,prefix:t,icons:Object.create(null),missing:new Set}}function Uf(e,t){let n=Vf[e]||(Vf[e]=Object.create(null));return n[t]||(n[t]=Hf(e,t))}function Wf(e,t){return Bf(t)?Lf(t,(t,n)=>{n?e.icons[t]=n:e.missing.add(t)}):[]}function Gf(e,t,n){try{if(typeof n.body==`string`)return e.icons[t]={...n},!0}catch{}return!1}var Kf=/^[a-z0-9]+(-[a-z0-9]+)*$/,qf=(e,t,n,r=``)=>{let i=e.split(`:`);if(e.slice(0,1)===`@`){if(i.length<2||i.length>3)return null;r=i.shift().slice(1)}if(i.length>3||!i.length)return null;if(i.length>1){let e=i.pop(),n=i.pop(),a={provider:i.length>0?i[0]:r,prefix:n,name:e};return t&&!Jf(a)?null:a}let a=i[0],o=a.split(`-`);if(o.length>1){let e={provider:r,prefix:o.shift(),name:o.join(`-`)};return t&&!Jf(e)?null:e}if(n&&r===``){let e={provider:r,prefix:``,name:a};return t&&!Jf(e,n)?null:e}return null},Jf=(e,t)=>e?!!((t&&e.prefix===``||e.prefix)&&e.name):!1,Yf=!1;function Xf(e){return typeof e==`boolean`&&(Yf=e),Yf}function Zf(e){let t=typeof e==`string`?qf(e,!0,Yf):e;if(t){let e=Uf(t.provider,t.prefix),n=t.name;return e.icons[n]||(e.missing.has(n)?null:void 0)}}function Qf(e,t){let n=qf(e,!0,Yf);if(!n)return!1;let r=Uf(n.provider,n.prefix);return t?Gf(r,n.name,t):(r.missing.add(n.name),!0)}function $f(e,t){if(typeof e!=`object`)return!1;if(typeof t!=`string`&&(t=e.provider||``),Yf&&!t&&!e.prefix){let t=!1;return Bf(e)&&(e.prefix=``,Lf(e,(e,n)=>{Qf(e,n)&&(t=!0)})),t}let n=e.prefix;return Jf({prefix:n,name:`a`})?!!Wf(Uf(t,n),e):!1}var ep=Object.freeze({width:null,height:null}),tp=Object.freeze({...ep,...jf}),np=/(-?[0-9.]*[0-9]+[0-9.]*)/g,rp=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function ip(e,t,n){if(t===1)return e;if(n||=100,typeof e==`number`)return Math.ceil(e*t*n)/n;if(typeof e!=`string`)return e;let r=e.split(np);if(r===null||!r.length)return e;let i=[],a=r.shift(),o=rp.test(a);for(;;){if(o){let e=parseFloat(a);isNaN(e)?i.push(a):i.push(Math.ceil(e*t*n)/n)}else i.push(a);if(a=r.shift(),a===void 0)return i.join(``);o=!o}}function ree(e,t=`defs`){let n=``,r=e.indexOf(`<`+t);for(;r>=0;){let i=e.indexOf(`>`,r),a=e.indexOf(`</`+t);if(i===-1||a===-1)break;let o=e.indexOf(`>`,a);if(o===-1)break;n+=e.slice(i+1,a).trim(),e=e.slice(0,r).trim()+e.slice(o+1)}return{defs:n,content:e}}function ap(e,t){return e?`<defs>`+e+`</defs>`+t:t}function op(e,t,n){let r=ree(e);return ap(r.defs,t+r.content+n)}var sp=e=>e===`unset`||e===`undefined`||e===`none`;function cp(e,t){let n={...Mf,...e},r={...tp,...t},i={left:n.left,top:n.top,width:n.width,height:n.height},a=n.body;[n,r].forEach(e=>{let t=[],n=e.hFlip,r=e.vFlip,o=e.rotate;n?r?o+=2:(t.push(`translate(`+(i.width+i.left).toString()+` `+(0-i.top).toString()+`)`),t.push(`scale(-1 1)`),i.top=i.left=0):r&&(t.push(`translate(`+(0-i.left).toString()+` `+(i.height+i.top).toString()+`)`),t.push(`scale(1 -1)`),i.top=i.left=0);let s;switch(o<0&&(o-=Math.floor(o/4)*4),o%=4,o){case 1:s=i.height/2+i.top,t.unshift(`rotate(90 `+s.toString()+` `+s.toString()+`)`);break;case 2:t.unshift(`rotate(180 `+(i.width/2+i.left).toString()+` `+(i.height/2+i.top).toString()+`)`);break;case 3:s=i.width/2+i.left,t.unshift(`rotate(-90 `+s.toString()+` `+s.toString()+`)`);break}o%2==1&&(i.left!==i.top&&(s=i.left,i.left=i.top,i.top=s),i.width!==i.height&&(s=i.width,i.width=i.height,i.height=s)),t.length&&(a=op(a,`<g transform="`+t.join(` `)+`">`,`</g>`))});let o=r.width,s=r.height,c=i.width,l=i.height,u,d;o===null?(d=s===null?`1em`:s===`auto`?l:s,u=ip(d,c/l)):(u=o===`auto`?c:o,d=s===null?ip(u,l/c):s===`auto`?l:s);let f={},p=(e,t)=>{sp(t)||(f[e]=t.toString())};p(`width`,u),p(`height`,d);let m=[i.left,i.top,c,l];return f.viewBox=m.join(` `),{attributes:f,viewBox:m,body:a}}var lp=/\sid="(\S+)"/g,up=`IconifyId`+Date.now().toString(16)+(Math.random()*16777216|0).toString(16),dp=0;function fp(e,t=up){let n=[],r;for(;r=lp.exec(e);)n.push(r[1]);if(!n.length)return e;let i=`suffix`+(Math.random()*16777216|Date.now()).toString(16);return n.forEach(n=>{let r=typeof t==`function`?t(n):t+(dp++).toString(),a=n.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`);e=e.replace(RegExp(`([#;"])(`+a+`)([")]|\\.[a-z])`,`g`),`$1`+r+i+`$3`)}),e=e.replace(new RegExp(i,`g`),``),e}var pp=Object.create(null);function mp(e,t){pp[e]=t}function hp(e){return pp[e]||pp[``]}function gp(e){let t;if(typeof e.resources==`string`)t=[e.resources];else if(t=e.resources,!(t instanceof Array)||!t.length)return null;return{resources:t,path:e.path||`/`,maxURL:e.maxURL||500,rotate:e.rotate||750,timeout:e.timeout||5e3,random:e.random===!0,index:e.index||0,dataAfterTimeout:e.dataAfterTimeout!==!1}}for(var _p=Object.create(null),vp=[`https://api.simplesvg.com`,`https://api.unisvg.com`],yp=[];vp.length>0;)vp.length===1||Math.random()>.5?yp.push(vp.shift()):yp.push(vp.pop());_p[``]=gp({resources:[`https://api.iconify.design`].concat(yp)});function bp(e,t){let n=gp(t);return n===null?!1:(_p[e]=n,!0)}function xp(e){return _p[e]}var Sp=(()=>{let e;try{if(e=fetch,typeof e==`function`)return e}catch{}})();function Cp(e,t){let n=xp(e);if(!n)return 0;let r;if(!n.maxURL)r=0;else{let e=0;n.resources.forEach(t=>{e=Math.max(e,t.length)});let i=t+`.json?icons=`;r=n.maxURL-e-n.path.length-i.length}return r}function wp(e){return e===404}var Tp=(e,t,n)=>{let r=[],i=Cp(e,t),a=`icons`,o={type:a,provider:e,prefix:t,icons:[]},s=0;return n.forEach((n,c)=>{s+=n.length+1,s>=i&&c>0&&(r.push(o),o={type:a,provider:e,prefix:t,icons:[]},s=n.length),o.icons.push(n)}),r.push(o),r};function Ep(e){if(typeof e==`string`){let t=xp(e);if(t)return t.path}return`/`}var Dp={prepare:Tp,send:(e,t,n)=>{if(!Sp){n(`abort`,424);return}let r=Ep(t.provider);switch(t.type){case`icons`:{let e=t.prefix,n=t.icons.join(`,`),i=new URLSearchParams({icons:n});r+=e+`.json?`+i.toString();break}case`custom`:{let e=t.uri;r+=e.slice(0,1)===`/`?e.slice(1):e;break}default:n(`abort`,400);return}let i=503;Sp(e+r).then(e=>{let t=e.status;if(t!==200){setTimeout(()=>{n(wp(t)?`abort`:`next`,t)});return}return i=501,e.json()}).then(e=>{if(typeof e!=`object`||!e){setTimeout(()=>{e===404?n(`abort`,e):n(`next`,i)});return}setTimeout(()=>{n(`success`,e)})}).catch(()=>{n(`next`,i)})}};function Op(e,t){e.forEach(e=>{let n=e.loaderCallbacks;n&&(e.loaderCallbacks=n.filter(e=>e.id!==t))})}function kp(e){e.pendingCallbacksFlag||(e.pendingCallbacksFlag=!0,setTimeout(()=>{e.pendingCallbacksFlag=!1;let t=e.loaderCallbacks?e.loaderCallbacks.slice(0):[];if(!t.length)return;let n=!1,r=e.provider,i=e.prefix;t.forEach(t=>{let a=t.icons,o=a.pending.length;a.pending=a.pending.filter(t=>{if(t.prefix!==i)return!0;let o=t.name;if(e.icons[o])a.loaded.push({provider:r,prefix:i,name:o});else if(e.missing.has(o))a.missing.push({provider:r,prefix:i,name:o});else return n=!0,!0;return!1}),a.pending.length!==o&&(n||Op([e],t.id),t.callback(a.loaded.slice(0),a.missing.slice(0),a.pending.slice(0),t.abort))})}))}var Ap=0;function jp(e,t,n){let r=Ap++,i=Op.bind(null,n,r);if(!t.pending.length)return i;let a={id:r,icons:t,callback:e,abort:i};return n.forEach(e=>{(e.loaderCallbacks||=[]).push(a)}),i}function Mp(e){let t={loaded:[],missing:[],pending:[]},n=Object.create(null);e.sort((e,t)=>e.provider===t.provider?e.prefix===t.prefix?e.name.localeCompare(t.name):e.prefix.localeCompare(t.prefix):e.provider.localeCompare(t.provider));let r={provider:``,prefix:``,name:``};return e.forEach(e=>{if(r.name===e.name&&r.prefix===e.prefix&&r.provider===e.provider)return;r=e;let i=e.provider,a=e.prefix,o=e.name,s=n[i]||(n[i]=Object.create(null)),c=s[a]||(s[a]=Uf(i,a)),l;l=o in c.icons?t.loaded:a===``||c.missing.has(o)?t.missing:t.pending;let u={provider:i,prefix:a,name:o};l.push(u)}),t}function Np(e,t=!0,n=!1){let r=[];return e.forEach(e=>{let i=typeof e==`string`?qf(e,t,n):e;i&&r.push(i)}),r}var Pp={resources:[],index:0,timeout:2e3,rotate:750,random:!1,dataAfterTimeout:!1};function Fp(e,t,n,r){let i=e.resources.length,a=e.random?Math.floor(Math.random()*i):e.index,o;if(e.random){let t=e.resources.slice(0);for(o=[];t.length>1;){let e=Math.floor(Math.random()*t.length);o.push(t[e]),t=t.slice(0,e).concat(t.slice(e+1))}o=o.concat(t)}else o=e.resources.slice(a).concat(e.resources.slice(0,a));let s=Date.now(),c=`pending`,l=0,u,d=null,f=[],p=[];typeof r==`function`&&p.push(r);function m(){d&&=(clearTimeout(d),null)}function h(){c===`pending`&&(c=`aborted`),m(),f.forEach(e=>{e.status===`pending`&&(e.status=`aborted`)}),f=[]}function g(e,t){t&&(p=[]),typeof e==`function`&&p.push(e)}function _(){return{startTime:s,payload:t,status:c,queriesSent:l,queriesPending:f.length,subscribe:g,abort:h}}function v(){c=`failed`,p.forEach(e=>{e(void 0,u)})}function y(){f.forEach(e=>{e.status===`pending`&&(e.status=`aborted`)}),f=[]}function b(t,n,r){let i=n!==`success`;switch(f=f.filter(e=>e!==t),c){case`pending`:break;case`failed`:if(i||!e.dataAfterTimeout)return;break;default:return}if(n===`abort`){u=r,v();return}if(i){u=r,f.length||(o.length?x():v());return}if(m(),y(),!e.random){let n=e.resources.indexOf(t.resource);n!==-1&&n!==e.index&&(e.index=n)}c=`completed`,p.forEach(e=>{e(r)})}function x(){if(c!==`pending`)return;m();let r=o.shift();if(r===void 0){if(f.length){d=setTimeout(()=>{m(),c===`pending`&&(y(),v())},e.timeout);return}v();return}let i={status:`pending`,resource:r,callback:(e,t)=>{b(i,e,t)}};f.push(i),l++,d=setTimeout(x,e.rotate),n(r,t,i.callback)}return setTimeout(x),_}function Ip(e){let t={...Pp,...e},n=[];function r(){n=n.filter(e=>e().status===`pending`)}function i(e,i,a){let o=Fp(t,e,i,(e,t)=>{r(),a&&a(e,t)});return n.push(o),o}function a(e){return n.find(t=>e(t))||null}return{query:i,find:a,setIndex:e=>{t.index=e},getIndex:()=>t.index,cleanup:r}}function Lp(){}var Rp=Object.create(null);function zp(e){if(!Rp[e]){let t=xp(e);if(!t)return;Rp[e]={config:t,redundancy:Ip(t)}}return Rp[e]}function Bp(e,t,n){let r,i;if(typeof e==`string`){let t=hp(e);if(!t)return n(void 0,424),Lp;i=t.send;let a=zp(e);a&&(r=a.redundancy)}else{let t=gp(e);if(t){r=Ip(t);let n=hp(e.resources?e.resources[0]:``);n&&(i=n.send)}}return!r||!i?(n(void 0,424),Lp):r.query(t,i,n)().abort}function Vp(){}function Hp(e){e.iconsLoaderFlag||(e.iconsLoaderFlag=!0,setTimeout(()=>{e.iconsLoaderFlag=!1,kp(e)}))}function Up(e){let t=[],n=[];return e.forEach(e=>{(e.match(Kf)?t:n).push(e)}),{valid:t,invalid:n}}function Wp(e,t,n){function r(){let n=e.pendingIcons;t.forEach(t=>{n&&n.delete(t),e.icons[t]||e.missing.add(t)})}if(n&&typeof n==`object`)try{if(!Wf(e,n).length){r();return}}catch(e){console.error(e)}r(),Hp(e)}function Gp(e,t){e instanceof Promise?e.then(e=>{t(e)}).catch(()=>{t(null)}):t(e)}function Kp(e,t){e.iconsToLoad?e.iconsToLoad=e.iconsToLoad.concat(t).sort():e.iconsToLoad=t,e.iconsQueueFlag||(e.iconsQueueFlag=!0,setTimeout(()=>{e.iconsQueueFlag=!1;let{provider:t,prefix:n}=e,r=e.iconsToLoad;if(delete e.iconsToLoad,!r||!r.length)return;let i=e.loadIcon;if(e.loadIcons&&(r.length>1||!i)){Gp(e.loadIcons(r,n,t),t=>{Wp(e,r,t)});return}if(i){r.forEach(r=>{Gp(i(r,n,t),t=>{Wp(e,[r],t?{prefix:n,icons:{[r]:t}}:null)})});return}let{valid:a,invalid:o}=Up(r);if(o.length&&Wp(e,o,null),!a.length)return;let s=n.match(Kf)?hp(t):null;if(!s){Wp(e,a,null);return}s.prepare(t,n,a).forEach(n=>{Bp(t,n,t=>{Wp(e,n.icons,t)})})}))}var qp=(e,t)=>{let n=Mp(Np(e,!0,Xf()));if(!n.pending.length){let e=!0;return t&&setTimeout(()=>{e&&t(n.loaded,n.missing,n.pending,Vp)}),()=>{e=!1}}let r=Object.create(null),i=[],a,o;return n.pending.forEach(e=>{let{provider:t,prefix:n}=e;if(n===o&&t===a)return;a=t,o=n,i.push(Uf(t,n));let s=r[t]||(r[t]=Object.create(null));s[n]||(s[n]=[])}),n.pending.forEach(e=>{let{provider:t,prefix:n,name:i}=e,a=Uf(t,n),o=a.pendingIcons||=new Set;o.has(i)||(o.add(i),r[t][n].push(i))}),i.forEach(e=>{let t=r[e.provider][e.prefix];t.length&&Kp(e,t)}),t?jp(t,n,i):Vp};function Jp(e,t){let n={...e};for(let e in t){let r=t[e],i=typeof r;e in ep?(r===null||r&&(i===`string`||i===`number`))&&(n[e]=r):i===typeof n[e]&&(n[e]=e===`rotate`?r%4:r)}return n}var Yp=/[\s,]+/;function Xp(e,t){t.split(Yp).forEach(t=>{switch(t.trim()){case`horizontal`:e.hFlip=!0;break;case`vertical`:e.vFlip=!0;break}})}function Zp(e,t=0){let n=e.replace(/^-?[0-9.]*/,``);function r(e){for(;e<0;)e+=4;return e%4}if(n===``){let t=parseInt(e);return isNaN(t)?0:r(t)}else if(n!==e){let t=0;switch(n){case`%`:t=25;break;case`deg`:t=90}if(t){let i=parseFloat(e.slice(0,e.length-n.length));return isNaN(i)?0:(i/=t,i%1==0?r(i):0)}}return t}function Qp(e,t){let n=e.indexOf(`xlink:`)===-1?``:` xmlns:xlink="http://www.w3.org/1999/xlink"`;for(let e in t)n+=` `+e+`="`+t[e]+`"`;return`<svg xmlns="http://www.w3.org/2000/svg"`+n+`>`+e+`</svg>`}function $p(e){return e.replace(/"/g,`'`).replace(/%/g,`%25`).replace(/#/g,`%23`).replace(/</g,`%3C`).replace(/>/g,`%3E`).replace(/\s+/g,` `)}function em(e){return`data:image/svg+xml,`+$p(e)}function tm(e){return`url("`+em(e)+`")`}var nm;function rm(){try{nm=window.trustedTypes.createPolicy(`iconify`,{createHTML:e=>e})}catch{nm=null}}function im(e){return nm===void 0&&rm(),nm?nm.createHTML(e):e}var am={...tp,inline:!1},om={xmlns:`http://www.w3.org/2000/svg`,xmlnsXlink:`http://www.w3.org/1999/xlink`,"aria-hidden":!0,role:`img`},sm={display:`inline-block`},cm={backgroundColor:`currentColor`},lm={backgroundColor:`transparent`},um={Image:`var(--svg)`,Repeat:`no-repeat`,Size:`100% 100%`},dm={WebkitMask:cm,mask:cm,background:lm};for(let e in dm){let t=dm[e];for(let n in um)t[e+n]=um[n]}var fm={...am,inline:!0};function pm(e){return e+(e.match(/^[-0-9.]+$/)?`px`:``)}var mm=(e,t,n)=>{let r=t.inline?fm:am,i=Jp(r,t),a=t.mode||`svg`,o={},s=t.style||{},c={...a===`svg`?om:{}};if(n){let e=qf(n,!1,!0);if(e){let t=[`iconify`];for(let n of[`provider`,`prefix`])e[n]&&t.push(`iconify--`+e[n]);c.className=t.join(` `)}}for(let e in t){let n=t[e];if(n!==void 0)switch(e){case`icon`:case`style`:case`children`:case`onLoad`:case`mode`:case`ssr`:case`fallback`:break;case`_ref`:c.ref=n;break;case`className`:c[e]=(c[e]?c[e]+` `:``)+n;break;case`inline`:case`hFlip`:case`vFlip`:i[e]=n===!0||n===`true`||n===1;break;case`flip`:typeof n==`string`&&Xp(i,n);break;case`color`:o.color=n;break;case`rotate`:typeof n==`string`?i[e]=Zp(n):typeof n==`number`&&(i[e]=n);break;case`ariaHidden`:case`aria-hidden`:n!==!0&&n!==`true`&&delete c[`aria-hidden`];break;default:r[e]===void 0&&(c[e]=n)}}let l=cp(e,i),u=l.attributes;if(i.inline&&(o.verticalAlign=`-0.125em`),a===`svg`){c.style={...o,...s},Object.assign(c,u);let e=0,n=t.id;return typeof n==`string`&&(n=n.replace(/-/g,`_`)),c.dangerouslySetInnerHTML={__html:im(fp(l.body,n?()=>n+`ID`+ e++:`iconifyReact`))},(0,V.createElement)(`svg`,c)}let{body:d,width:f,height:p}=e,m=a===`mask`||(a===`bg`?!1:d.indexOf(`currentColor`)!==-1),h=Qp(d,{...u,width:f+``,height:p+``});return c.style={...o,"--svg":tm(h),width:pm(u.width),height:pm(u.height),...sm,...m?cm:lm,...s},(0,V.createElement)(`span`,c)};if(Xf(!0),mp(``,Dp),typeof document<`u`&&typeof window<`u`){let e=window;if(e.IconifyPreload!==void 0){let t=e.IconifyPreload,n=`Invalid IconifyPreload syntax.`;typeof t==`object`&&t&&(t instanceof Array?t:[t]).forEach(e=>{try{(typeof e!=`object`||!e||e instanceof Array||typeof e.icons!=`object`||typeof e.prefix!=`string`||!$f(e))&&console.error(n)}catch{console.error(n)}})}if(e.IconifyProviders!==void 0){let t=e.IconifyProviders;if(typeof t==`object`&&t)for(let e in t){let n=`IconifyProviders[`+e+`] is invalid.`;try{let r=t[e];if(typeof r!=`object`||!r||r.resources===void 0)continue;bp(e,r)||console.error(n)}catch{console.error(n)}}}}function hm(e){let[t,n]=(0,V.useState)(!!e.ssr),[r,i]=(0,V.useState)({});function a(t){if(t){let t=e.icon;if(typeof t==`object`)return{name:``,data:t};let n=Zf(t);if(n)return{name:t,data:n}}return{name:``}}let[o,s]=(0,V.useState)(a(!!e.ssr));function c(){let e=r.callback;e&&(e(),i({}))}function l(e){if(JSON.stringify(o)!==JSON.stringify(e))return c(),s(e),!0}function u(){var t;let n=e.icon;if(typeof n==`object`){l({name:``,data:n});return}let r=Zf(n);l({name:n,data:r})&&(r===void 0?i({callback:qp([n],u)}):r&&((t=e.onLoad)==null||t.call(e,n)))}(0,V.useEffect)(()=>(n(!0),c),[]),(0,V.useEffect)(()=>{t&&u()},[e.icon,t]);let{name:d,data:f}=o;return f?mm({...Mf,...f},e,d):e.children?e.children:e.fallback?e.fallback:(0,V.createElement)(`span`,{})}var gm=(0,V.forwardRef)((e,t)=>hm({...e,_ref:t}));(0,V.forwardRef)((e,t)=>hm({inline:!0,...e,_ref:t}));var _m=n((e=>{e.__esModule=!0,e.default={width:32,height:32,body:`<path fill="#c5c5c5" d="M20.414 2H5v28h22V8.586ZM7 28V4h12v6h6v18Z"/>`}})),vm=n((e=>{e.__esModule=!0,e.default={width:32,height:32,body:`<path fill="#00007f" d="M17.229 4a.9.9 0 0 0-.569.232l-7.6 6.32a1.158 1.158 0 0 1-.955.328H3.208A1.2 1.2 0 0 0 2 12.088v7.826a1.2 1.2 0 0 0 1.208 1.206H8.1a1.158 1.158 0 0 1 .955.328l7.6 6.32c.521.433 1.081.224 1.081-.289V4.522A.494.494 0 0 0 17.229 4ZM27 6.3l-1.791 1.793a14.708 14.708 0 0 1 0 15.844l1.785 1.776A17.19 17.19 0 0 0 27 6.3Zm-4.333 4.323L20.905 12.4a6.035 6.035 0 0 1 0 7.237l1.756 1.756a8.554 8.554 0 0 0 .01-10.769Z"/>`}})),ym=n((e=>{e.__esModule=!0,e.default={width:32,height:32,body:`<path fill="#fbf0df" d="M29 17c0 5.65-5.82 10.23-13 10.23S3 22.61 3 17c0-3.5 2.24-6.6 5.66-8.44S14.21 4.81 16 4.81s3.32 1.54 7.34 3.71C26.76 10.36 29 13.46 29 17Z"/><path fill="none" stroke="#000" d="M16 27.65c7.32 0 13.46-4.65 13.46-10.65c0-3.72-2.37-7-5.89-8.85c-1.39-.75-2.46-1.41-3.37-2l-1.13-.69A6.14 6.14 0 0 0 16 4.35a6.88 6.88 0 0 0-3.3 1.23c-.42.24-.86.51-1.32.8c-.87.54-1.83 1.13-3 1.73C4.91 10 2.54 13.24 2.54 17c0 6 6.14 10.65 13.46 10.65Z"/><ellipse cx="21.65" cy="18.62" fill="#febbd0" rx="2.17" ry="1.28"/><ellipse cx="10.41" cy="18.62" fill="#febbd0" rx="2.17" ry="1.28"/><path fill-rule="evenodd" d="M11.43 18.11a2 2 0 1 0-2-2.05a2.05 2.05 0 0 0 2 2.05Zm9.2 0a2 2 0 1 0-2-2.05a2 2 0 0 0 2 2.05Z"/><path fill="#fff" fill-rule="evenodd" d="M10.79 16.19a.77.77 0 1 0-.76-.77a.76.76 0 0 0 .76.77Zm9.2 0a.77.77 0 1 0 0-1.53a.77.77 0 0 0 0 1.53Z"/><path fill="#b71422" stroke="#000" stroke-width=".75" d="M18.62 19.67a3.3 3.3 0 0 1-1.09 1.75a2.48 2.48 0 0 1-1.5.69a2.53 2.53 0 0 1-1.5-.69a3.28 3.28 0 0 1-1.08-1.75a.26.26 0 0 1 .29-.3h4.58a.27.27 0 0 1 .3.3Z"/><path fill="#ccbea7" fill-rule="evenodd" d="M14.93 5.75a6.09 6.09 0 0 1-2.09 4.62c-.1.09 0 .27.11.22c1.25-.49 2.94-1.94 2.23-4.88c-.03-.15-.25-.11-.25.04Zm.85 0a6 6 0 0 1 .57 5c0 .13.12.24.21.13c.83-1 1.54-3.11-.59-5.31c-.1-.11-.27.04-.19.17Zm1-.06a6.09 6.09 0 0 1 2.53 4.38c0 .14.21.17.24 0c.34-1.3.15-3.51-2.66-4.66c-.12-.02-.21.18-.09.27ZM9.94 9.55a6.27 6.27 0 0 0 3.89-3.33c.07-.13.28-.08.25.07c-.64 3-2.79 3.59-4.13 3.51c-.14-.01-.14-.21-.01-.25Z"/>`}})),bm=n((e=>{e.__esModule=!0,e.default={width:32,height:32,body:`<path fill="#99b8c4" d="m23.265 24.381l.9-.894c4.164.136 4.228-.01 4.411-.438l1.144-2.785l.085-.264l-.093-.231c-.049-.122-.2-.486-2.8-2.965V15.5c3-2.89 2.936-3.038 2.765-3.461l-1.139-2.814c-.171-.422-.236-.587-4.37-.474l-.9-.93a20.166 20.166 0 0 0-.141-4.106l-.116-.263l-2.974-1.3c-.438-.2-.592-.272-3.4 2.786l-1.262-.019c-2.891-3.086-3.028-3.03-3.461-2.855L9.149 3.182c-.433.175-.586.237-.418 4.437l-.893.89c-4.162-.136-4.226.012-4.407.438l-1.146 2.786l-.09.267l.094.232c.049.12.194.48 2.8 2.962v1.3c-3 2.89-2.935 3.038-2.763 3.462l1.138 2.817c.174.431.236.584 4.369.476l.9.935a20.243 20.243 0 0 0 .137 4.1l.116.265l2.993 1.308c.435.182.586.247 3.386-2.8l1.262.016c2.895 3.09 3.043 3.03 3.466 2.859l2.759-1.115c.436-.173.588-.234.413-4.436Zm-11.858-6.524a4.957 4.957 0 1 1 6.488 2.824a5.014 5.014 0 0 1-6.488-2.824Z"/>`}})),xm=n((e=>{e.__esModule=!0,e.default={width:32,height:32,body:`<path fill="#984c93" d="M14.742 24.047a10.242 10.242 0 0 1-4.673.919a7.628 7.628 0 0 1-5.914-2.346A8.876 8.876 0 0 1 2 16.369a9.476 9.476 0 0 1 2.422-6.748a8.216 8.216 0 0 1 6.285-2.588a11.151 11.151 0 0 1 4.035.641v3.761A6.839 6.839 0 0 0 11 10.395a4.813 4.813 0 0 0-3.712 1.535a5.9 5.9 0 0 0-1.413 4.159A5.8 5.8 0 0 0 7.209 20.1a4.57 4.57 0 0 0 3.59 1.493a7.319 7.319 0 0 0 3.943-1.113Zm2.37-9.218v-2.344h2.344v2.344H21.8v2.343h-2.344v2.343h-2.344v-2.343H14.77v-2.344l2.342.001zm8.201 0v-2.344h2.344v2.344H30v2.343h-2.343v2.343h-2.344v-2.343h-2.342v-2.344l2.342.001z"/>`}})),Sm=n((e=>{e.__esModule=!0,e.default={width:32,height:32,body:`<path fill="#368832" d="M19.792 7.071h2.553v2.553H24.9V7.071h2.552v2.553H30v2.552h-2.55v2.551H30v2.553h-2.551v2.552H24.9v-2.55h-2.55v2.552h-2.557v-2.55H17.24v-2.559h2.553v-2.546H17.24V9.622h2.554Zm2.553 7.658H24.9v-2.553h-2.555Zm-7.656 9.284a10.2 10.2 0 0 1-4.653.915a7.6 7.6 0 0 1-5.89-2.336A8.839 8.839 0 0 1 2 16.367a9.436 9.436 0 0 1 2.412-6.719a8.181 8.181 0 0 1 6.259-2.577a11.1 11.1 0 0 1 4.018.638v3.745a6.81 6.81 0 0 0-3.723-1.036a4.793 4.793 0 0 0-3.7 1.529a5.879 5.879 0 0 0-1.407 4.142a5.774 5.774 0 0 0 1.328 3.992a4.551 4.551 0 0 0 3.575 1.487a7.288 7.288 0 0 0 3.927-1.108Z"/>`}})),Cm=n((e=>{e.__esModule=!0,e.default={width:32,height:32,body:`<path fill="#1572b6" d="M5.902 27.201L3.656 2h24.688l-2.249 25.197L15.985 30L5.902 27.201z"/><path fill="#33a9dc" d="m16 27.858l8.17-2.265l1.922-21.532H16v23.797z"/><path fill="#fff" d="M16 13.191h4.09l.282-3.165H16V6.935h7.75l-.074.829l-.759 8.518H16v-3.091z"/><path fill="#ebebeb" d="m16.019 21.218l-.014.004l-3.442-.93l-.22-2.465H9.24l.433 4.853l6.331 1.758l.015-.004v-3.216z"/><path fill="#fff" d="m19.827 16.151l-.372 4.139l-3.447.93v3.216l6.336-1.756l.047-.522l.537-6.007h-3.101z"/><path fill="#ebebeb" d="M16.011 6.935v3.091H8.545l-.062-.695l-.141-1.567l-.074-.829h7.743zM16 13.191v3.091h-3.399l-.062-.695l-.14-1.567l-.074-.829H16z"/>`}})),wm=n((e=>{e.__esModule=!0,e.default={width:32,height:32,body:`<path fill="#3a4e55" d="M18.191 13.071H20.7v2.566h1.27a5.5 5.5 0 0 0 1.744-.292a4.462 4.462 0 0 0 .848-.383a3.149 3.149 0 0 1-.589-1.623a3.427 3.427 0 0 1 .616-2.416l.264-.305l.314.253a4 4 0 0 1 1.575 2.538a3.837 3.837 0 0 1 2.913.271l.345.2l-.181.354a3.629 3.629 0 0 1-3.648 1.74c-2.173 5.413-6.9 7.976-12.642 7.976A7.958 7.958 0 0 1 6.3 20.211l-.025-.043l-.226-.459a7.28 7.28 0 0 1-.579-3.693l.035-.38h2.143v-2.565h2.51v-2.51h5.02v-2.51h3.012v5.02Z"/><path fill="#00aada" d="M26.324 14.021a3.311 3.311 0 0 0-1.418-2.821a3.072 3.072 0 0 0 .289 3.821a5.279 5.279 0 0 1-3.225 1.037H5.883a6.779 6.779 0 0 0 .667 3.737l.183.335a6.2 6.2 0 0 0 .379.569q.992.064 1.829.045a8.972 8.972 0 0 0 2.669-.389a.193.193 0 1 1 .126.365c-.09.031-.184.061-.281.088a8.4 8.4 0 0 1-1.845.3c.044 0-.046.007-.046.007l-.082.007a21.455 21.455 0 0 1-2.008-.006l-.01.007a7.882 7.882 0 0 0 6.063 2.41c5.56 0 10.276-2.465 12.365-8c1.482.152 2.906-.226 3.553-1.49a3.5 3.5 0 0 0-3.122-.022"/><path fill="#27b9ec" d="M26.324 14.021a3.311 3.311 0 0 0-1.418-2.821a3.072 3.072 0 0 0 .289 3.821a5.279 5.279 0 0 1-3.225 1.037H6.836a5.223 5.223 0 0 0 2.106 4.686a8.972 8.972 0 0 0 2.669-.389a.193.193 0 1 1 .126.365c-.09.031-.184.061-.281.088a8.83 8.83 0 0 1-1.894.314l-.019-.022c1.892.971 4.636.967 7.782-.241a21.868 21.868 0 0 0 9.1-6.889l-.1.048"/><path fill="#088cb9" d="M5.913 17.732a6.431 6.431 0 0 0 .637 2.061l.183.335a6.2 6.2 0 0 0 .379.569q.992.064 1.829.045a8.972 8.972 0 0 0 2.669-.389a.193.193 0 1 1 .126.365c-.09.031-.184.061-.281.088a8.826 8.826 0 0 1-1.891.307h-.1c-.291.016-.6.026-.922.026c-.351 0-.709-.007-1.1-.026a7.913 7.913 0 0 0 6.076 2.413c4.76 0 8.9-1.807 11.3-5.8Z"/><path fill="#039cc7" d="M6.98 17.732a4.832 4.832 0 0 0 1.961 3.01a8.972 8.972 0 0 0 2.669-.389a.193.193 0 1 1 .126.365c-.09.031-.184.061-.281.088a8.959 8.959 0 0 1-1.9.307c1.892.971 4.628.957 7.773-.252a20.545 20.545 0 0 0 5.377-3.13Z"/><path fill="#00acd3" d="M9.889 13.671h.172v1.813h-.172v-1.813Zm-.33 0h.179v1.813h-.179v-1.813Zm-.33 0h.179v1.813H9.23v-1.813Zm-.33 0h.179v1.813H8.9v-1.813Zm-.33 0h.179v1.813H8.57v-1.813Zm-.323 0h.172v1.813h-.17v-1.813Zm-.181-.181h2.175v2.176H8.066V13.49Zm4.335-2.329h.172v1.813H12.4v-1.813Zm-.33 0h.179v1.813h-.179v-1.813Zm-.33 0h.179v1.813h-.179v-1.813Zm-.33 0h.179v1.813h-.179v-1.813Zm-.33 0h.178v1.813h-.178v-1.813Zm-.323 0h.172v1.813h-.172v-1.813Zm-.181-.181h2.176v2.176h-2.175v-2.177Z"/><path fill="#26c2ee" d="M12.4 13.671h.172v1.813H12.4v-1.813Zm-.33 0h.179v1.813h-.179v-1.813Zm-.33 0h.179v1.813h-.179v-1.813Zm-.33 0h.179v1.813h-.179v-1.813Zm-.33 0h.178v1.813h-.178v-1.813Zm-.323 0h.172v1.813h-.172v-1.813Zm-.181-.181h2.176v2.176h-2.175V13.49Z"/><path fill="#00acd3" d="M14.909 13.671h.172v1.813h-.172v-1.813Zm-.33 0h.179v1.813h-.178v-1.813Zm-.33 0h.179v1.813h-.178v-1.813Zm-.33 0h.181v1.813h-.179v-1.813Zm-.33 0h.179v1.813h-.179v-1.813Zm-.323 0h.172v1.813h-.172v-1.813Zm-.181-.181h2.176v2.176h-2.174V13.49Z"/><path fill="#26c2ee" d="M14.909 11.161h.172v1.813h-.172v-1.813Zm-.33 0h.179v1.813h-.178v-1.813Zm-.33 0h.179v1.813h-.178v-1.813Zm-.33 0h.181v1.813h-.179v-1.813Zm-.33 0h.179v1.813h-.179v-1.813Zm-.323 0h.172v1.813h-.172v-1.813Zm-.181-.181h2.176v2.176h-2.174v-2.177Zm4.335 2.691h.172v1.813h-.172v-1.813Zm-.33 0h.179v1.813h-.179v-1.813Zm-.33 0h.179v1.813h-.179v-1.813Zm-.33 0h.179v1.813h-.179v-1.813Zm-.33 0h.179v1.813H16.1v-1.813Zm-.323 0h.172v1.813h-.172v-1.813Zm-.177-.181h2.176v2.176H15.6V13.49Z"/><path fill="#00acd3" d="M17.42 11.161h.172v1.813h-.172v-1.813Zm-.33 0h.179v1.813h-.179v-1.813Zm-.33 0h.179v1.813h-.179v-1.813Zm-.33 0h.179v1.813h-.179v-1.813Zm-.33 0h.179v1.813H16.1v-1.813Zm-.323 0h.172v1.813h-.172v-1.813Zm-.181-.181h2.176v2.176H15.6v-2.177Z"/><path fill="#26c2ee" d="M17.42 8.65h.172v1.813h-.172V8.65Zm-.33 0h.179v1.813h-.179V8.65Zm-.33 0h.179v1.813h-.179V8.65Zm-.33 0h.179v1.813h-.179V8.65Zm-.33 0h.179v1.813H16.1V8.65Zm-.323 0h.172v1.813h-.172V8.65Zm-.177-.181h2.176v2.176H15.6V8.469Z"/><path fill="#00acd3" d="M19.93 13.671h.17v1.813h-.17v-1.813Zm-.33 0h.178v1.813H19.6v-1.813Zm-.33 0h.179v1.813h-.179v-1.813Zm-.33 0h.179v1.813h-.179v-1.813Zm-.33 0h.179v1.813h-.179v-1.813Zm-.323 0h.172v1.813h-.172v-1.813Zm-.181-.181h2.176v2.176h-2.175V13.49Z"/><path fill="#d5eef2" d="M12.616 19.193a.6.6 0 1 1-.6.6a.6.6 0 0 1 .6-.6"/><path fill="#3a4e55" d="M12.616 19.363a.431.431 0 0 1 .156.029a.175.175 0 1 0 .241.236a.43.43 0 1 1-.4-.265M2 17.949h27.92c-.608-.154-1.923-.362-1.707-1.159c-1.105 1.279-3.771.9-4.444.267c-.749 1.087-5.111.674-5.415-.173c-.939 1.1-3.85 1.1-4.789 0c-.3.847-4.666 1.26-5.415.173c-.673.631-3.338 1.012-4.444-.267c.217.8-1.1 1.005-1.707 1.159"/><path fill="#c0dbe1" d="M14.211 23.518a5.287 5.287 0 0 1-2.756-2.711a9.2 9.2 0 0 1-1.987.3q-.436.024-.917.025q-.554 0-1.168-.033a7.942 7.942 0 0 0 6.145 2.43q.344 0 .683-.013"/><path fill="#d5eef2" d="M12.007 21.773a5.206 5.206 0 0 1-.552-.966a9.2 9.2 0 0 1-1.987.3a6.325 6.325 0 0 0 2.539.664"/>`}})),Tm=n((e=>{e.__esModule=!0,e.default={width:32,height:32,body:`<g fill-rule="evenodd"><path d="M3.167 3.167h25.667v25.667H3.167z"/><path fill="#ecd53f" fill-rule="nonzero" d="M30 2v28H2V2zM14.757 20.539H9.98v6.44h4.898v-1.085h-3.597V24.14h3.232v-1.085H11.28v-1.428h3.475v-1.09zm2.503 0h-1.264v6.44h1.207v-4.2l2.597 4.2h1.305v-6.44h-1.21v4.3l-2.635-4.301zm5.97 0h-1.41l2.303 6.44h1.388l2.306-6.44h-1.38l-1.577 4.766l-1.63-4.767zM8.3 24.96H6.34v1.96H8.3z"/></g>`}})),Em=n((e=>{e.__esModule=!0,e.default={width:32,height:32,body:`<path fill="#4b32c3" d="m29.832 16.7l-6.354 10.717A1.256 1.256 0 0 1 22.36 28H9.647a1.262 1.262 0 0 1-1.118-.59l-6.356-10.7a1.256 1.256 0 0 1 0-1.272L8.527 4.676A1.344 1.344 0 0 1 9.647 4h12.709a1.344 1.344 0 0 1 1.118.678l6.354 10.786a1.2 1.2 0 0 1 0 1.238Zm-5.262 4.2v-9.614L16 6.466l-8.56 4.82V20.9L16 25.719Z"/><path fill="#8080f2" d="m21.802 19.188l-5.747 3.235l-5.742-3.235v-6.47l5.742-3.236l5.747 3.236v6.47z"/>`}})),Dm=n((e=>{e.__esModule=!0,e.default={width:32,height:32,body:`<defs><linearGradient id="vscodeIconsFileTypeExcel0" x1="4.494" x2="13.832" y1="-2092.086" y2="-2075.914" gradientTransform="translate(0 2100)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#18884f"/><stop offset=".5" stop-color="#117e43"/><stop offset="1" stop-color="#0b6631"/></linearGradient></defs><path fill="#185c37" d="M19.581 15.35L8.512 13.4v14.409A1.192 1.192 0 0 0 9.705 29h19.1A1.192 1.192 0 0 0 30 27.809V22.5Z"/><path fill="#21a366" d="M19.581 3H9.705a1.192 1.192 0 0 0-1.193 1.191V9.5L19.581 16l5.861 1.95L30 16V9.5Z"/><path fill="#107c41" d="M8.512 9.5h11.069V16H8.512Z"/><path d="M16.434 8.2H8.512v16.25h7.922a1.2 1.2 0 0 0 1.194-1.191V9.391A1.2 1.2 0 0 0 16.434 8.2Z" opacity=".1"/><path d="M15.783 8.85H8.512V25.1h7.271a1.2 1.2 0 0 0 1.194-1.191V10.041a1.2 1.2 0 0 0-1.194-1.191Z" opacity=".2"/><path d="M15.783 8.85H8.512V23.8h7.271a1.2 1.2 0 0 0 1.194-1.191V10.041a1.2 1.2 0 0 0-1.194-1.191Z" opacity=".2"/><path d="M15.132 8.85h-6.62V23.8h6.62a1.2 1.2 0 0 0 1.194-1.191V10.041a1.2 1.2 0 0 0-1.194-1.191Z" opacity=".2"/><path fill="url(#vscodeIconsFileTypeExcel0)" d="M3.194 8.85h11.938a1.193 1.193 0 0 1 1.194 1.191v11.918a1.193 1.193 0 0 1-1.194 1.191H3.194A1.192 1.192 0 0 1 2 21.959V10.041A1.192 1.192 0 0 1 3.194 8.85Z"/><path fill="#fff" d="m5.7 19.873l2.511-3.884l-2.3-3.862h1.847L9.013 14.6c.116.234.2.408.238.524h.017c.082-.188.169-.369.26-.546l1.342-2.447h1.7l-2.359 3.84l2.419 3.905h-1.809l-1.45-2.711A2.355 2.355 0 0 1 9.2 16.8h-.024a1.688 1.688 0 0 1-.168.351l-1.493 2.722Z"/><path fill="#33c481" d="M28.806 3h-9.225v6.5H30V4.191A1.192 1.192 0 0 0 28.806 3Z"/><path fill="#107c41" d="M19.581 16H30v6.5H19.581Z"/>`}})),Om=n((e=>{e.__esModule=!0,e.default={width:32,height:32,body:`<path fill="#cfcfcf" d="m12.677 17.781l-2.626-6.256l-2.694 6.256Zm6.723 6.511h-7.069v-1.365l.458-.023a1.847 1.847 0 0 0 .972-.2a.313.313 0 0 0 .145-.263a4.158 4.158 0 0 0-.419-1.4l-.812-1.931H7.322L6.4 21.259a3.319 3.319 0 0 0-.349 1.157c0 .036 0 .119.154.241a2.481 2.481 0 0 0 1.191.247l.448.033v1.354H2v-1.31l.4-.07a2.188 2.188 0 0 0 1-.318a6.318 6.318 0 0 0 1.18-2.066l5.575-13.036H11.2l5.512 13.174a5.255 5.255 0 0 0 1.049 1.835a1.959 1.959 0 0 0 1.19.4l.454.027Zm6.441-2.732v-3.985a22.542 22.542 0 0 0-2.226.97a3.845 3.845 0 0 0-1.29 1.05a2.03 2.03 0 0 0-.388 1.2a1.951 1.951 0 0 0 .491 1.362a1.49 1.49 0 0 0 1.13.544a4.142 4.142 0 0 0 2.283-1.141Zm-3.333 2.949a2.833 2.833 0 0 1-2.139-.893a3.206 3.206 0 0 1-.833-2.285a2.959 2.959 0 0 1 .415-1.577a5 5 0 0 1 1.791-1.625a23.876 23.876 0 0 1 3.617-1.588v-.074a2.905 2.905 0 0 0-.383-1.833a1.325 1.325 0 0 0-1.075-.412a1.155 1.155 0 0 0-.816.26a.687.687 0 0 0-.277.536l.023.646a1.62 1.62 0 0 1-.4 1.158a1.481 1.481 0 0 1-2.1-.019a1.634 1.634 0 0 1-.391-1.134a2.8 2.8 0 0 1 1.182-2.177a4.813 4.813 0 0 1 3.125-.932a5.381 5.381 0 0 1 2.508.524a2.628 2.628 0 0 1 1.213 1.346a6.391 6.391 0 0 1 .244 2.2v3.55a14.665 14.665 0 0 0 .051 1.749a.661.661 0 0 0 .054.2c.085-.078.284-.225.864-.806l.819-.828v1.967l-.1.128c-.958 1.283-1.883 1.907-2.83 1.907a1.6 1.6 0 0 1-1.257-.557a1.788 1.788 0 0 1-.358-.74a9.688 9.688 0 0 1-1.433.977a3.579 3.579 0 0 1-1.514.332Z"/>`}})),km=n((e=>{e.__esModule=!0,e.default={width:32,height:32,body:`<path fill="#dd4c35" d="M29.472 14.753L17.247 2.528a1.8 1.8 0 0 0-2.55 0l-2.539 2.539l3.22 3.22a2.141 2.141 0 0 1 2.712 2.73l3.1 3.1a2.143 2.143 0 1 1-1.285 1.21l-2.895-2.895v7.617a2.141 2.141 0 1 1-1.764-.062V12.3a2.146 2.146 0 0 1-1.165-2.814l-3.17-3.172L2.528 14.7a1.8 1.8 0 0 0 0 2.551l12.225 12.221a1.8 1.8 0 0 0 2.55 0L29.472 17.3a1.8 1.8 0 0 0 0-2.551"/><path fill="#fff" d="m12.158 5.067l3.22 3.22a2.141 2.141 0 0 1 2.712 2.73l3.1 3.1a2.143 2.143 0 1 1-1.285 1.21l-2.895-2.895v7.617a2.141 2.141 0 1 1-1.764-.062V12.3a2.146 2.146 0 0 1-1.165-2.814l-3.17-3.172"/>`}})),Am=n((e=>{e.__esModule=!0,e.default={width:254.5,height:225,body:`<path fill="#00acd7" d="M-46.926 89c-.621 0-.777-.311-.466-.777l3.262-4.194a2.225 2.225 0 0 1 1.708-.777h55.448c.621 0 .777.466.466.932l-2.64 4.038a2.367 2.367 0 0 1-1.553.932Zm-23.453 14.285c-.621 0-.777-.311-.466-.777l3.262-4.194a2.225 2.225 0 0 1 1.708-.777H4.95a.714.714 0 0 1 .777.932L4.484 102.2a1.358 1.358 0 0 1-1.4.932Zm37.587 14.289c-.621 0-.777-.466-.466-.932l2.174-3.883a2.06 2.06 0 0 1 1.553-.932H1.533c.621 0 .932.466.932 1.087l-.311 3.728a1.167 1.167 0 0 1-1.087 1.087ZM128.426 86.2c-9.785 2.485-16.464 4.349-26.093 6.834c-2.33.621-2.485.777-4.5-1.553c-2.33-2.64-4.038-4.349-7.3-5.9c-9.785-4.815-19.259-3.417-28.112 2.33c-10.561 6.834-16 16.929-15.842 29.51c.155 12.425 8.7 22.676 20.968 24.385c10.561 1.4 19.414-2.33 26.4-10.251c1.4-1.708 2.64-3.572 4.194-5.747H68.163c-3.262 0-4.038-2.019-2.951-4.659c2.019-4.815 5.747-12.891 7.921-16.929a4.194 4.194 0 0 1 3.883-2.485h56.535c-.311 4.194-.311 8.387-.932 12.581a66.239 66.239 0 0 1-12.736 30.442c-11.183 14.752-25.783 23.915-44.265 26.4c-15.221 2.019-29.355-.932-41.78-10.251a48.785 48.785 0 0 1-19.725-34.48c-2.019-16.929 2.951-32.15 13.2-45.508C38.342 66.475 52.942 57.312 70.8 54.05c14.6-2.64 28.578-.932 41.159 7.61a48.686 48.686 0 0 1 18.017 21.9c.935 1.398.313 2.175-1.55 2.64Z"/><path fill="#00acd7" d="M179.835 172.09c-14.134-.311-27.025-4.349-37.9-13.668a48.711 48.711 0 0 1-16.774-29.976c-2.8-17.551 2.019-33.082 12.581-46.905c11.338-14.91 25.006-22.676 43.488-25.938c15.842-2.8 30.753-1.243 44.265 7.921c12.27 8.387 19.88 19.725 21.9 34.635c2.64 20.968-3.417 38.052-17.861 52.652a71.17 71.17 0 0 1-37.276 19.88c-4.191.778-8.384.933-12.423 1.399Zm36.965-62.747a44.7 44.7 0 0 0-.466-5.125c-2.8-15.376-16.929-24.074-31.684-20.657c-14.444 3.262-23.763 12.425-27.18 27.025a25.579 25.579 0 0 0 14.289 29.355c8.542 3.728 17.085 3.262 25.317-.932c12.269-6.369 18.948-16.309 19.724-29.666Z"/>`}})),jm=n((e=>{e.__esModule=!0,e.default={width:32,height:32,body:`<path fill="#e10098" d="M4.781 22.746L16.232 2.914l1.028.593L5.81 23.34z"/><path fill="#e10098" d="M4.545 21.162h22.902v1.187H4.545z"/><path fill="#e10098" d="m4.999 21.828l.593-1.028l11.455 6.614l-.594 1.028zM14.95 4.59l.594-1.027l11.455 6.614l-.594 1.028z"/><path fill="#e10098" d="M5.002 10.174L16.456 3.56l.594 1.028l-11.455 6.614z"/><path fill="#e10098" d="m14.743 3.508l1.028-.594l11.45 19.833l-1.027.593zM5.454 9.386h1.187v13.228H5.454z"/><path fill="#e10098" d="M25.36 9.386h1.187v13.228H25.36z"/><path fill="#e10098" d="m15.734 27.042l9.962-5.752l.519.898l-9.963 5.752z"/><path fill="#e10098" d="M28.12 23a2.5 2.5 0 1 1-.915-3.411A2.5 2.5 0 0 1 28.12 23M8.2 11.5a2.5 2.5 0 1 1-.915-3.411A2.5 2.5 0 0 1 8.2 11.5M3.88 23a2.5 2.5 0 1 1 3.411.915A2.5 2.5 0 0 1 3.88 23M23.8 11.5a2.5 2.5 0 1 1 3.411.915A2.5 2.5 0 0 1 23.8 11.5M16 30a2.5 2.5 0 1 1 2.5-2.5A2.493 2.493 0 0 1 16 30m0-23.009a2.5 2.5 0 1 1 2.5-2.5a2.493 2.493 0 0 1-2.5 2.5"/>`}})),Mm=n((e=>{e.__esModule=!0,e.default={width:32,height:32,body:`<path fill="#e44f26" d="M5.902 27.201L3.655 2h24.69l-2.25 25.197L15.985 30L5.902 27.201z"/><path fill="#f1662a" d="m16 27.858l8.17-2.265l1.922-21.532H16v23.797z"/><path fill="#ebebeb" d="M16 13.407h-4.09l-.282-3.165H16V7.151H8.25l.074.83l.759 8.517H16v-3.091zm0 8.027l-.014.004l-3.442-.929l-.22-2.465H9.221l.433 4.852l6.332 1.758l.014-.004v-3.216z"/><path fill="#fff" d="M15.989 13.407v3.091h3.806l-.358 4.009l-3.448.93v3.216l6.337-1.757l.046-.522l.726-8.137l.076-.83h-7.185zm0-6.256v3.091h7.466l.062-.694l.141-1.567l.074-.83h-7.743z"/>`}})),Nm=n((e=>{e.__esModule=!0,e.default={width:32,height:32,body:`<path fill="#2dcc9f" d="M30 5.851v20.298H2V5.851h28"/><path fill="#fff" d="M24.232 8.541a2.2 2.2 0 1 0 1.127.623a2.212 2.212 0 0 0-1.127-.623M18.111 20.1q-2.724-3.788-5.45-7.575L4.579 23.766h10.9q1.316-1.832 2.634-3.663M22.057 16q-2.793 3.882-5.584 7.765h11.169Q24.851 19.882 22.057 16Z"/>`}})),Pm=n((e=>{e.__esModule=!0,e.default={width:32,height:32,body:`<path fill="#5382a1" d="M12.325 23.654s-1.07.622.761.833a16.023 16.023 0 0 0 5.8-.246a10.088 10.088 0 0 0 1.541.752c-5.481 2.349-12.405-.136-8.1-1.339m-.671-3.066s-1.2.888.633 1.078a22.618 22.618 0 0 0 7.481-.359a3.32 3.32 0 0 0 1.152.7c-6.627 1.938-14.009.153-9.266-1.421m5.644-5.198a2.051 2.051 0 0 1-.355 2.954s3.429-1.77 1.854-3.987c-1.471-2.067-2.6-3.095 3.508-6.636c0 0-9.586 2.394-5.007 7.669"/><path fill="#5382a1" d="M24.552 25.921s.792.652-.872 1.157c-3.164.958-13.168 1.248-15.948.038c-1-.435.874-1.038 1.464-1.164a3.8 3.8 0 0 1 .966-.108c-1.111-.783-7.181 1.537-3.083 2.2c11.176 1.812 20.372-.816 17.473-2.124M12.84 17.412s-5.089 1.209-1.8 1.648a38.225 38.225 0 0 0 6.731-.072a53.11 53.11 0 0 0 4.221-.555a8.934 8.934 0 0 0-1.28.685c-5.168 1.359-15.151.727-12.277-.663a9.629 9.629 0 0 1 4.407-1.042m9.127 5.102c5.253-2.73 2.824-5.353 1.129-5a3.932 3.932 0 0 0-.6.161a.957.957 0 0 1 .449-.346c3.354-1.179 5.933 3.478-1.083 5.322a.458.458 0 0 0 .106-.138M18.8 2s2.909 2.91-2.759 7.386c-4.546 3.59-1.037 5.637 0 7.975c-2.653-2.394-4.6-4.5-3.294-6.463C14.664 8.019 19.976 6.623 18.8 2"/><path fill="#5382a1" d="M13.356 29.912c5.042.323 12.786-.179 12.969-2.565c0 0-.353.9-4.167 1.623a41.458 41.458 0 0 1-12.76.2s.645.533 3.959.746"/>`}})),Fm=n((e=>{e.__esModule=!0,e.default={width:32,height:32,body:`<path fill="#f5de19" d="M18.774 19.7a3.727 3.727 0 0 0 3.376 2.078c1.418 0 2.324-.709 2.324-1.688c0-1.173-.931-1.589-2.491-2.272l-.856-.367c-2.469-1.052-4.11-2.37-4.11-5.156c0-2.567 1.956-4.52 5.012-4.52A5.058 5.058 0 0 1 26.9 10.52l-2.665 1.711a2.327 2.327 0 0 0-2.2-1.467a1.489 1.489 0 0 0-1.638 1.467c0 1.027.636 1.442 2.1 2.078l.856.366c2.908 1.247 4.549 2.518 4.549 5.376c0 3.081-2.42 4.769-5.671 4.769a6.575 6.575 0 0 1-6.236-3.5ZM6.686 20c.538.954 1.027 1.76 2.2 1.76c1.124 0 1.834-.44 1.834-2.15V7.975h3.422v11.683c0 3.543-2.078 5.156-5.11 5.156A5.312 5.312 0 0 1 3.9 21.688Z"/>`}})),Im=n((e=>{e.__esModule=!0,e.default={width:32,height:32,body:`<path fill="#f5de19" d="M4.014 14.976a2.51 2.51 0 0 0 1.567-.518a2.377 2.377 0 0 0 .805-1.358a15.261 15.261 0 0 0 .214-2.944q.012-2.085.075-2.747a5.236 5.236 0 0 1 .418-1.686a3.025 3.025 0 0 1 .755-1.018A3.046 3.046 0 0 1 9 4.125A6.762 6.762 0 0 1 10.544 4h.7v1.96h-.387a2.338 2.338 0 0 0-1.723.468a3.4 3.4 0 0 0-.425 2.092a36.054 36.054 0 0 1-.137 4.133a4.734 4.734 0 0 1-.768 2.06A4.567 4.567 0 0 1 6.1 16a3.809 3.809 0 0 1 1.992 1.754a8.861 8.861 0 0 1 .618 3.865q0 2.435.05 2.9a1.755 1.755 0 0 0 .504 1.181a2.639 2.639 0 0 0 1.592.337h.387V28h-.7a5.655 5.655 0 0 1-1.773-.2a2.97 2.97 0 0 1-1.324-.93a3.353 3.353 0 0 1-.681-1.63a24.175 24.175 0 0 1-.165-3.234a16.469 16.469 0 0 0-.214-3.106a2.408 2.408 0 0 0-.805-1.361a2.489 2.489 0 0 0-1.567-.524Zm23.972 2.035a2.489 2.489 0 0 0-1.567.524a2.408 2.408 0 0 0-.805 1.361a16.469 16.469 0 0 0-.212 3.109a24.175 24.175 0 0 1-.169 3.234a3.353 3.353 0 0 1-.681 1.63a2.97 2.97 0 0 1-1.324.93a5.655 5.655 0 0 1-1.773.2h-.7V26.04h.387a2.639 2.639 0 0 0 1.592-.337a1.755 1.755 0 0 0 .506-1.186q.05-.462.05-2.9a8.861 8.861 0 0 1 .618-3.865A3.809 3.809 0 0 1 25.9 16a4.567 4.567 0 0 1-1.7-1.286a4.734 4.734 0 0 1-.768-2.06a36.054 36.054 0 0 1-.137-4.133a3.4 3.4 0 0 0-.425-2.092a2.338 2.338 0 0 0-1.723-.468h-.387V4h.7a6.762 6.762 0 0 1 1.54.125a3.046 3.046 0 0 1 1.149.581a3.025 3.025 0 0 1 .755 1.018a5.236 5.236 0 0 1 .418 1.686q.062.662.075 2.747a15.261 15.261 0 0 0 .212 2.947a2.377 2.377 0 0 0 .805 1.355a2.51 2.51 0 0 0 1.567.518Z"/>`}})),Lm=n((e=>{e.__esModule=!0,e.default={width:32,height:32,body:`<defs><linearGradient id="vscodeIconsFileTypeKotlin0" x1="311.336" x2="283.342" y1="1452.064" y2="1480.058" gradientTransform="translate(-281.4 -1450)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#e44857"/><stop offset=".47" stop-color="#9d4b9d"/><stop offset="1" stop-color="#6d5faa"/></linearGradient></defs><path fill="url(#vscodeIconsFileTypeKotlin0)" d="M30 30H2V2h28L16 16Z"/>`}})),Rm=n((e=>{e.__esModule=!0,e.default={width:32,height:32,body:`<defs><linearGradient id="vscodeIconsFileTypeLicense0" x1="-264.845" x2="-255.586" y1="181.772" y2="182.061" gradientTransform="scale(-1 1) rotate(26.18 205.537 615.155)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#bd6316"/><stop offset="1" stop-color="#4e1500"/></linearGradient><linearGradient id="vscodeIconsFileTypeLicense1" x1="-263.276" x2="-256.603" y1="170.205" y2="171.772" href="#vscodeIconsFileTypeLicense0"/><linearGradient id="vscodeIconsFileTypeLicense2" x1="-265.068" x2="-256.777" y1="175.732" y2="178.801" href="#vscodeIconsFileTypeLicense0"/><linearGradient id="vscodeIconsFileTypeLicense3" x1="-655.014" x2="-655.555" y1="147.549" y2="146.948" gradientTransform="scale(-1 1) rotate(-18.83 -723.282 -1847.955)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#ffd436"/><stop offset="1" stop-color="#8b3f02"/></linearGradient><linearGradient id="vscodeIconsFileTypeLicense4" x1="-258.899" x2="-253.843" y1="170.981" y2="171.325" gradientTransform="scale(-1 1) rotate(26.18 205.537 615.155)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#fff8b7"/><stop offset="1" stop-color="#fcbf0e"/></linearGradient><linearGradient id="vscodeIconsFileTypeLicense5" x1="-258.884" x2="-253.896" y1="170.975" y2="171.314" href="#vscodeIconsFileTypeLicense0"/><linearGradient id="vscodeIconsFileTypeLicense6" x1="-257.805" x2="-257.726" y1="172.266" y2="168.648" gradientTransform="scale(-1 1) rotate(26.18 205.537 615.155)" href="#vscodeIconsFileTypeLicense3"/><linearGradient id="vscodeIconsFileTypeLicense7" x1="-258.935" x2="-256.173" y1="181.92" y2="182.108" href="#vscodeIconsFileTypeLicense4"/><linearGradient id="vscodeIconsFileTypeLicense8" x1="-274.156" x2="-274.512" y1="170.544" y2="173.778" gradientTransform="matrix(-1 0 0 1 -257.657 -155.509)" href="#vscodeIconsFileTypeLicense3"/><linearGradient id="vscodeIconsFileTypeLicense9" x1="-645.79" x2="-645.121" y1="-337.938" y2="-334.17" gradientTransform="scale(-1 1) rotate(-52.06 29.075 -802.903)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#ffef94"/><stop offset="1" stop-color="#ffd200"/></linearGradient><linearGradient id="vscodeIconsFileTypeLicensea" x1="-276.128" x2="-274.754" y1="178.682" y2="178.682" gradientTransform="scale(-1 1) rotate(26.18 189.155 648.159)" href="#vscodeIconsFileTypeLicense3"/><linearGradient id="vscodeIconsFileTypeLicenseb" x1="-274.314" x2="-271.841" y1="178.887" y2="178.987" gradientTransform="scale(-1 1) rotate(26.18 189.155 648.159)" href="#vscodeIconsFileTypeLicense3"/><linearGradient id="vscodeIconsFileTypeLicensec" x1="-273.817" x2="-274.213" y1="189.281" y2="174.569" gradientTransform="scale(-1 1) rotate(26.18 189.155 648.159)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#d89530"/><stop offset="1" stop-color="#772d00"/></linearGradient><linearGradient id="vscodeIconsFileTypeLicensed" x1="-274.075" x2="-273.917" y1="174.09" y2="181.459" gradientTransform="scale(-1 1) rotate(26.18 189.155 648.159)" href="#vscodeIconsFileTypeLicense3"/><linearGradient id="vscodeIconsFileTypeLicensee" x1="-272.919" x2="-273.315" y1="189.281" y2="174.57" href="#vscodeIconsFileTypeLicensec"/><linearGradient id="vscodeIconsFileTypeLicensef" x1="-273.177" x2="-273.019" y1="174.071" y2="181.44" gradientTransform="scale(-1 1) rotate(26.18 189.155 648.159)" href="#vscodeIconsFileTypeLicense3"/><linearGradient id="vscodeIconsFileTypeLicenseg" x1="-652.29" x2="-651.867" y1="-335.227" y2="-332.867" gradientTransform="scale(-1 1) rotate(-52.06 29.075 -802.903)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#ffdb57"/><stop offset="1" stop-color="#b55c13"/></linearGradient><linearGradient id="vscodeIconsFileTypeLicenseh" x1="-665.076" x2="-659.751" y1="157.413" y2="150.922" gradientTransform="scale(-1 1) rotate(-18.83 -723.282 -1847.955)" href="#vscodeIconsFileTypeLicensec"/><linearGradient id="vscodeIconsFileTypeLicensei" x1="-665.161" x2="-664.822" y1="156.114" y2="155.701" gradientTransform="scale(-1 1) rotate(-18.83 -723.282 -1847.955)" href="#vscodeIconsFileTypeLicensec"/><linearGradient id="vscodeIconsFileTypeLicensej" x1="-665.308" x2="-665.836" y1="156.436" y2="155.32" gradientTransform="scale(-1 1) rotate(-18.83 -723.282 -1847.955)" href="#vscodeIconsFileTypeLicensec"/><linearGradient id="vscodeIconsFileTypeLicensek" x1="-655.442" x2="-654.817" y1="147.568" y2="146.776" href="#vscodeIconsFileTypeLicense3"/><linearGradient id="vscodeIconsFileTypeLicensel" x1="-253.999" x2="-254.134" y1="175.1" y2="173.736" gradientTransform="scale(-1 1) rotate(26.18 205.537 615.155)" href="#vscodeIconsFileTypeLicensec"/><linearGradient id="vscodeIconsFileTypeLicensem" x1="-252.571" x2="-252.785" y1="173.138" y2="170.963" gradientTransform="scale(-1 1) rotate(26.18 205.537 615.155)" href="#vscodeIconsFileTypeLicensec"/><linearGradient id="vscodeIconsFileTypeLicensen" x1="-257.206" x2="-259.174" y1="169.107" y2="169.787" gradientTransform="scale(-1 1) rotate(26.18 205.537 615.155)" href="#vscodeIconsFileTypeLicensec"/><linearGradient id="vscodeIconsFileTypeLicenseo" x1="-260.717" x2="-260.77" y1="170.284" y2="171.228" gradientTransform="scale(-1 1) rotate(26.18 205.537 615.155)" href="#vscodeIconsFileTypeLicensec"/><linearGradient id="vscodeIconsFileTypeLicensep" x1="-257.835" x2="-257.782" y1="174.993" y2="171.93" gradientTransform="scale(-1 1) rotate(26.18 205.537 615.155)" href="#vscodeIconsFileTypeLicense3"/><linearGradient id="vscodeIconsFileTypeLicenseq" x1="-263.928" x2="-255.721" y1="171.018" y2="171.018" gradientTransform="scale(-1 1) rotate(26.18 205.537 615.155)" href="#vscodeIconsFileTypeLicense3"/><linearGradient id="vscodeIconsFileTypeLicenser" x1="-514.299" x2="-505.041" y1="-57.926" y2="-57.638" gradientTransform="matrix(-.947 -.323 -.148 .966 -476.554 -85.464)" href="#vscodeIconsFileTypeLicense0"/><linearGradient id="vscodeIconsFileTypeLicenses" x1="-512.744" x2="-505.964" y1="-69.496" y2="-67.904" gradientTransform="matrix(-.947 -.323 -.148 .966 -476.554 -85.464)" href="#vscodeIconsFileTypeLicense0"/><linearGradient id="vscodeIconsFileTypeLicenset" x1="-514.521" x2="-506.23" y1="-63.966" y2="-60.897" gradientTransform="matrix(-.947 -.323 -.148 .966 -476.554 -85.464)" href="#vscodeIconsFileTypeLicense0"/><linearGradient id="vscodeIconsFileTypeLicenseu" x1="-662.221" x2="-662.762" y1="-197.167" y2="-197.768" gradientTransform="matrix(-.564 -.911 -.774 .455 -516.113 -497.612)" href="#vscodeIconsFileTypeLicense3"/><linearGradient id="vscodeIconsFileTypeLicensev" x1="-508.354" x2="-503.297" y1="-68.717" y2="-68.373" gradientTransform="matrix(-.947 -.323 -.148 .966 -476.554 -85.464)" href="#vscodeIconsFileTypeLicense4"/><linearGradient id="vscodeIconsFileTypeLicensew" x1="-508.338" x2="-503.351" y1="-68.723" y2="-68.384" gradientTransform="matrix(-.947 -.323 -.148 .966 -476.554 -85.464)" href="#vscodeIconsFileTypeLicense0"/><linearGradient id="vscodeIconsFileTypeLicensex" x1="-507.26" x2="-507.18" y1="-67.432" y2="-71.05" gradientTransform="matrix(-.947 -.323 -.148 .966 -476.554 -85.464)" href="#vscodeIconsFileTypeLicense3"/><linearGradient id="vscodeIconsFileTypeLicensey" x1="-508.389" x2="-505.627" y1="-57.779" y2="-57.591" gradientTransform="matrix(-.947 -.323 -.148 .966 -476.554 -85.464)" href="#vscodeIconsFileTypeLicense4"/><linearGradient id="vscodeIconsFileTypeLicensez" x1="-523.609" x2="-523.966" y1="-69.153" y2="-65.918" gradientTransform="matrix(-.947 -.323 -.148 .966 -492.49 -86.99)" href="#vscodeIconsFileTypeLicense3"/><linearGradient id="vscodeIconsFileTypeLicense10" x1="-645.333" x2="-642.973" y1="-334.169" y2="-332.091" href="#vscodeIconsFileTypeLicense9"/><linearGradient id="vscodeIconsFileTypeLicense11" x1="-525.581" x2="-524.207" y1="-61.015" y2="-61.015" gradientTransform="matrix(-.947 -.323 -.148 .966 -492.49 -86.99)" href="#vscodeIconsFileTypeLicense3"/><linearGradient id="vscodeIconsFileTypeLicense12" x1="-523.768" x2="-521.294" y1="-60.81" y2="-60.71" gradientTransform="matrix(-.947 -.323 -.148 .966 -492.49 -86.99)" href="#vscodeIconsFileTypeLicense3"/><linearGradient id="vscodeIconsFileTypeLicense13" x1="-523.27" x2="-523.666" y1="-50.416" y2="-65.127" gradientTransform="matrix(-.947 -.323 -.148 .966 -492.49 -86.99)" href="#vscodeIconsFileTypeLicensec"/><linearGradient id="vscodeIconsFileTypeLicense14" x1="-523.528" x2="-523.37" y1="-65.606" y2="-58.238" gradientTransform="matrix(-.947 -.323 -.148 .966 -492.49 -86.99)" href="#vscodeIconsFileTypeLicense3"/><linearGradient id="vscodeIconsFileTypeLicense15" x1="-522.372" x2="-522.768" y1="-50.416" y2="-65.127" gradientTransform="matrix(-.947 -.323 -.148 .966 -492.49 -86.99)" href="#vscodeIconsFileTypeLicensec"/><linearGradient id="vscodeIconsFileTypeLicense16" x1="-522.631" x2="-522.472" y1="-65.626" y2="-58.257" gradientTransform="matrix(-.947 -.323 -.148 .966 -492.49 -86.99)" href="#vscodeIconsFileTypeLicense3"/><linearGradient id="vscodeIconsFileTypeLicense17" x1="-649.116" x2="-646.827" y1="-328.591" y2="-326.795" href="#vscodeIconsFileTypeLicense9"/><linearGradient id="vscodeIconsFileTypeLicense18" x1="-672.284" x2="-666.958" y1="-187.303" y2="-193.795" gradientTransform="matrix(-.564 -.911 -.774 .455 -516.113 -497.612)" href="#vscodeIconsFileTypeLicensec"/><linearGradient id="vscodeIconsFileTypeLicense19" x1="-672.369" x2="-672.03" y1="-188.603" y2="-189.016" gradientTransform="matrix(-.564 -.911 -.774 .455 -516.113 -497.612)" href="#vscodeIconsFileTypeLicensec"/><linearGradient id="vscodeIconsFileTypeLicense1a" x1="-672.516" x2="-673.044" y1="-188.281" y2="-189.397" gradientTransform="matrix(-.564 -.911 -.774 .455 -516.113 -497.612)" href="#vscodeIconsFileTypeLicensec"/><linearGradient id="vscodeIconsFileTypeLicense1b" x1="-662.648" x2="-662.023" y1="-197.148" y2="-197.94" gradientTransform="matrix(-.564 -.911 -.774 .455 -516.113 -497.612)" href="#vscodeIconsFileTypeLicense3"/><linearGradient id="vscodeIconsFileTypeLicense1c" x1="-503.367" x2="-503.501" y1="-64.607" y2="-65.971" gradientTransform="matrix(-.947 -.323 -.148 .966 -476.554 -85.464)" href="#vscodeIconsFileTypeLicensec"/><linearGradient id="vscodeIconsFileTypeLicense1d" x1="-502.006" x2="-502.232" y1="-66.361" y2="-68.654" gradientTransform="matrix(-.947 -.323 -.148 .966 -476.554 -85.464)" href="#vscodeIconsFileTypeLicensec"/><linearGradient id="vscodeIconsFileTypeLicense1e" x1="-506.661" x2="-508.629" y1="-70.591" y2="-69.911" gradientTransform="matrix(-.947 -.323 -.148 .966 -476.554 -85.464)" href="#vscodeIconsFileTypeLicensec"/><linearGradient id="vscodeIconsFileTypeLicense1f" x1="-510.172" x2="-510.224" y1="-69.414" y2="-68.47" gradientTransform="matrix(-.947 -.323 -.148 .966 -476.554 -85.464)" href="#vscodeIconsFileTypeLicensec"/><linearGradient id="vscodeIconsFileTypeLicense1g" x1="-507.289" x2="-507.236" y1="-64.705" y2="-67.768" gradientTransform="matrix(-.947 -.323 -.148 .966 -476.554 -85.464)" href="#vscodeIconsFileTypeLicense3"/><linearGradient id="vscodeIconsFileTypeLicense1h" x1="-642.337" x2="-640.048" y1="-337.231" y2="-335.435" gradientTransform="scale(-1 1) rotate(-52.06 29.075 -802.903)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#ffdb57"/><stop offset="1" stop-color="#b66512"/></linearGradient><linearGradient id="vscodeIconsFileTypeLicense1i" x1="-628.479" x2="-627.663" y1="-215.005" y2="-209.203" gradientTransform="scale(-1 1) rotate(-37.85 -2.119 -997.83)" href="#vscodeIconsFileTypeLicense0"/><linearGradient id="vscodeIconsFileTypeLicense1j" x1="-633.006" x2="-622.552" y1="-211.18" y2="-211.18" gradientTransform="scale(-1 1) rotate(-37.85 -2.119 -997.83)" href="#vscodeIconsFileTypeLicense4"/><linearGradient id="vscodeIconsFileTypeLicense1k" x1="-627.491" x2="-627.755" y1="-215.556" y2="-211.648" gradientTransform="scale(-1 1) rotate(-37.85 -2.119 -997.83)" href="#vscodeIconsFileTypeLicense3"/><linearGradient id="vscodeIconsFileTypeLicense1l" x1="-627.796" x2="-627.057" y1="-210.705" y2="-205.186" gradientTransform="scale(-1 1) rotate(-37.85 -2.119 -997.83)" href="#vscodeIconsFileTypeLicense3"/><linearGradient id="vscodeIconsFileTypeLicense1m" x1="245.815" x2="245.923" y1="139.434" y2="136.367" gradientTransform="rotate(7.312 1187.515 -1764.249)" href="#vscodeIconsFileTypeLicense4"/><linearGradient id="vscodeIconsFileTypeLicense1n" x1="-626.269" x2="-627.643" y1="-215.112" y2="-213.078" gradientTransform="scale(-1 1) rotate(-37.85 -2.119 -997.83)" href="#vscodeIconsFileTypeLicense3"/></defs><path fill="url(#vscodeIconsFileTypeLicense0)" d="m13.372 16.416l5.013-2.464l.93 1.893l-.054.238l-2.048 1.007l5.706 11.611l-.221.359l-1.543.758l-.82-.45l-5.459-11.109l-.482.237l-1.022-2.08z"/><path fill="url(#vscodeIconsFileTypeLicense1)" d="m9.24 13.619l1.2 2.44c.072.146.416.252.617.292l2.634.683l4.609-2.268l.867-2.342a.679.679 0 0 0 .036-.674l-1.2-2.44a.546.546 0 0 0-.452-.3l-4.44.136a1.278 1.278 0 0 0-1.018.541l-2.72 3.162a.916.916 0 0 0-.133.77Zm1.932.033a.356.356 0 0 1 .011-.334l1.84-2.215a.829.829 0 0 1 .66-.351l2.877-.088a.355.355 0 0 1 .293.2l.356.725a.242.242 0 0 1-.139.339L11.833 14.5a.224.224 0 0 1-.3-.121Z"/><path fill="url(#vscodeIconsFileTypeLicense2)" d="m9.426 13.209l1.2 2.44c.072.146.416.252.617.292l2.7.547l.782 1.591l.375-.179l5.459 11.109l.82.451l1.541-.76l-.017-.683l.868-1.458l-.241-.49l-.54.1l-.31-.63l.41-.366l-.59-1.199l-.593-.006l-.277-.564l.357-.473l-.3-.607l-.568.043l-.432-.879l.382-.423l-.161-.327a.871.871 0 0 1-.659-1.342l-.345-.7a1.347 1.347 0 0 1-.962-1.956l-.29-.591l.631-.31l-.773-1.546l.843-2.277a.68.68 0 0 0 .035-.674l-1.2-2.44a.546.546 0 0 0-.453-.3l-4.435.131a1.278 1.278 0 0 0-1.018.541l-2.84 3.419a.548.548 0 0 0-.016.516Zm1.932.033a.356.356 0 0 1 .011-.334l1.84-2.215a.828.828 0 0 1 .66-.351l2.877-.088a.354.354 0 0 1 .293.2l.356.725a.242.242 0 0 1-.139.339l-5.238 2.574a.224.224 0 0 1-.3-.121Z"/><path fill="url(#vscodeIconsFileTypeLicense3)" d="m14.47 18.381l.276-.318l.335-.164l-.139.245l-.472.237z"/><path fill="url(#vscodeIconsFileTypeLicense4)" d="m11.259 15.828l2.776.6l4.38-2.152l.865-2.339a.576.576 0 0 0 .024-.567L18.1 8.917a.441.441 0 0 0-.367-.246l-4.438.13a1.169 1.169 0 0 0-.938.5L9.52 12.725a.447.447 0 0 0-.011.414l1.206 2.453a1 1 0 0 0 .544.236Zm.354-1.836l-.358-.729a.463.463 0 0 1 .013-.434v-.008l1.853-2.221a.922.922 0 0 1 .739-.389l2.881-.084a.468.468 0 0 1 .392.257l.358.729c.005.009.19.3-.187.481l-5.244 2.577c-.272.129-.44-.164-.447-.179Z"/><path fill="url(#vscodeIconsFileTypeLicense5)" d="M11.246 15.738c.006 0 2.438.51 2.751.591l4.354-2.139l.878-2.336a.472.472 0 0 0 .015-.458l-1.208-2.458a.337.337 0 0 0-.282-.187l-4.454.141a1.083 1.083 0 0 0-.864.46l-2.863 3.436a.341.341 0 0 0-.008.313l1.206 2.454a1.118 1.118 0 0 0 .475.183Zm.245-1.7l-.355-.723a.568.568 0 0 1 .018-.535v-.008l.01-.015l1.865-2.241a1.033 1.033 0 0 1 .824-.43l2.9-.091a.575.575 0 0 1 .492.316l.359.73a.456.456 0 0 1 .027.338a.484.484 0 0 1-.265.286l-5.287 2.6a.415.415 0 0 1-.331.025a.486.486 0 0 1-.258-.248Z"/><path fill="url(#vscodeIconsFileTypeLicense6)" d="M11.268 15.663c.009 0 2.53.528 2.722.577l4.3-2.113l.878-2.314a.419.419 0 0 0 .01-.4l-1.2-2.436a.282.282 0 0 0-.237-.156l-4.433.149a1.033 1.033 0 0 0-.82.437l-2.353 2.823l-.5.595a.285.285 0 0 0 0 .254l1.193 2.421a1.181 1.181 0 0 0 .44.163Zm.14-1.529l-.351-.715a.575.575 0 0 1-.011-.56l1.959-2.36a1.082 1.082 0 0 1 .86-.447l2.887-.1a.628.628 0 0 1 .538.341l.356.724a.539.539 0 0 1-.309.773l-5.267 2.588a.482.482 0 0 1-.662-.243Z"/><path fill="url(#vscodeIconsFileTypeLicense7)" d="m18.463 14.345l.7 1.433l-.653.321l.319.649a1.428 1.428 0 0 0 1 2.043l.3.619a.958.958 0 0 0 .706 1.436l.107.218l-.39.428l.5 1.011l.577-.047l.239.485l-.366.478l.336.683h.6l.523 1.065l-.419.371l.382.777l.549-.1l.181.368A96.344 96.344 0 0 1 22.8 28v.638l-1.342.659l-.729-.414l-5.488-11.176l-.467.23l-.7-1.433Z"/><path fill="url(#vscodeIconsFileTypeLicense8)" d="M14.289 15.413h4.622v1.4h-4.622z" transform="rotate(-26.171 16.6 16.113)"/><path fill="url(#vscodeIconsFileTypeLicense9)" d="m18.128 14.582l-.8.392l.617 1.256l.8-.392Zm-1.319.648l.617 1.256l.308-.152l-.617-1.256Z"/><path fill="url(#vscodeIconsFileTypeLicensea)" d="m18.4 16.123l.308.628a1.523 1.523 0 0 0 1.037 2.11l.263.535a1.052 1.052 0 0 0 .744 1.513l.054.111l-.381.423l.557 1.134l.567-.043l.177.36l-.357.472l.392.8l.591.006l.456.929l-.409.366l.45.917l.539-.1l.12.243L22.634 28l-1.027.5l-5.525-11.235Z"/><path fill="url(#vscodeIconsFileTypeLicenseb)" d="m17.141 16.745l5.528 11.248l.046.511l-1.247.613l-.613-.349l-5.483-11.154Z"/><path fill="url(#vscodeIconsFileTypeLicensec)" d="m22.287 28.694l.427-.21l-4.794-9.754l-1.028-1.554l.602 1.764l4.793 9.754z"/><path fill="url(#vscodeIconsFileTypeLicensed)" d="M16.892 17.176L22.5 28.589l-.213.105l-4.793-9.754l-.602-1.764z"/><path fill="url(#vscodeIconsFileTypeLicensee)" d="m21.481 29.09l.427-.209l-4.794-9.755l-1.028-1.554l.602 1.764l4.793 9.754z"/><path fill="url(#vscodeIconsFileTypeLicensef)" d="m16.086 17.572l5.608 11.413l-.213.105l-4.793-9.754l-.602-1.764z"/><path fill="url(#vscodeIconsFileTypeLicenseg)" d="m18.27 16.189l-.411.2l5.285 10.755l.279-.47l-.181-.369l-.386.072l-.45-.917l.294-.26l-.508-1.034h-.424l-.392-.8l.256-.338l-.237-.482l-.407.031l-.557-1.134l.273-.3l-.143-.291a1.038 1.038 0 0 1-.619-1.259l-.391-.8a1.505 1.505 0 0 1-.906-1.844Zm-.68.334l5.371 10.929l.108-.182l-5.319-10.825Z"/><path fill="url(#vscodeIconsFileTypeLicenseh)" d="m15.018 18.247l5.356 10.997l.196-.273l-5.391-11.032l-.161.308z"/><path fill="url(#vscodeIconsFileTypeLicensei)" d="m20.436 29.315l.211-.291l.705.361l-.203.294l-.713-.364z"/><path fill="url(#vscodeIconsFileTypeLicensej)" d="m21.446 29.41l-.179.26l1.382-.659l.131-.241l-1.334.64z"/><path fill="url(#vscodeIconsFileTypeLicensek)" d="m14.029 16.673l-.225.388l.601 1.293l.297-.354l-.673-1.327z"/><path fill="url(#vscodeIconsFileTypeLicensel)" d="m13.946 16.506l-.239.432l-2.944-.761l.124-.345l3.059.674z"/><path fill="url(#vscodeIconsFileTypeLicensem)" d="M9.359 13s-.145.444-.087.563l1.212 2.465l.2-.384Z"/><path fill="url(#vscodeIconsFileTypeLicensen)" d="m16.683 10.624l.1-.327l-2.963.095a.914.914 0 0 0-.51.251l-.007.165a1.871 1.871 0 0 1 .394-.1Z"/><path fill="url(#vscodeIconsFileTypeLicenseo)" d="M16.83 10.309a.329.329 0 0 1 .17.137l.382.762l-.164.279l-.341-.693c-.023-.047-.108-.145-.147-.149Z"/><path fill="url(#vscodeIconsFileTypeLicensep)" d="m11.237 13.786l.171.348a.482.482 0 0 0 .661.248l5.267-2.588a.539.539 0 0 0 .309-.773l-.153-.31l1.08-.531l.606 1.232a.419.419 0 0 1-.01.4l-.878 2.314l-4.3 2.113c-.191-.049-2.713-.575-2.722-.577a1.181 1.181 0 0 1-.439-.16l-.6-1.222Z"/><path fill="url(#vscodeIconsFileTypeLicenseq)" d="m13.377 8.968l.532 1.084l.539-.018l-.532-1.084Zm2.306-.077l-1.395.047l.533 1.084l1.4-.046Zm1.471 2.994l-1.142.561l1.106 2.25l1.142-.561Zm-1.447.711l-.441.217l1.106 2.251l.441-.217Z"/><path fill="url(#vscodeIconsFileTypeLicenser)" d="m10.65 14.159l5.287 1.803L15.623 18l-.173.134l-2.16-.737l-1.921 12.501l-.371.102l-1.627-.555l-.395-.913l1.838-11.961l-.508-.173l.344-2.239z"/><path fill="url(#vscodeIconsFileTypeLicenses)" d="m8.951 9.175l-.542 2.747a.567.567 0 0 0 .175.452l1.976 2.461l4.866 1.659l1.969-1.077a.535.535 0 0 0 .4-.463l.4-2.627a.659.659 0 0 0-.188-.544L14.453 8.7a1.313 1.313 0 0 0-1.1-.337l-3.874.345a.707.707 0 0 0-.528.467Zm1.5 1.407a.281.281 0 0 1 .192-.234l2.633-.256a.928.928 0 0 1 .724.315l2.3 2a.426.426 0 0 1 .121.352l-.1.651s-.027.237-.3.146L10.5 11.667a.269.269 0 0 1-.172-.305Z"/><path fill="url(#vscodeIconsFileTypeLicenset)" d="m9.322 9.01l-.4 2.627c-.024.157.188.481.324.653l1.817 2.33l-.263 1.714l.392.134l-1.843 11.959l.395.914l1.627.555l.363-.507l1.483-.436l.081-.528l-.479-.314l.1-.678l.523.028l.2-1.283l-.461-.428l.093-.608l.54-.087l.1-.653l-.469-.375l.145-.946l.532-.034l.054-.352a1.047 1.047 0 0 1-.29-.859a.688.688 0 0 1 .512-.585l.116-.756a1.6 1.6 0 0 1-.364-1.232a1.07 1.07 0 0 1 .688-.874l.1-.636l.666.227l.246-1.674l1.915-1.047a.535.535 0 0 0 .4-.463l.4-2.627a.657.657 0 0 0-.188-.544l-3.556-3.08a1.313 1.313 0 0 0-1.1-.336l-4.109.445a.434.434 0 0 0-.29.356Zm1.5 1.407a.281.281 0 0 1 .192-.234l2.663-.289a.852.852 0 0 1 .711.218l2.3 2a.427.427 0 0 1 .122.352l-.12.781s-.027.237-.3.146L10.871 11.5a.269.269 0 0 1-.171-.3Z"/><path fill="url(#vscodeIconsFileTypeLicenseu)" d="m10.428 16.37l.392-.033l.353.12l-.244.078l-.501-.165z"/><path fill="url(#vscodeIconsFileTypeLicensev)" d="m9.317 12.221l1.846 2.421l4.619 1.575l1.967-1.076a.454.454 0 0 0 .331-.393l.406-2.641a.53.53 0 0 0-.152-.441l-3.552-3.083a1.207 1.207 0 0 0-1.011-.31l-4.109.453a.354.354 0 0 0-.237.292l-.405 2.641a1.261 1.261 0 0 0 .297.562Zm1.289-1.077l.121-.785a.367.367 0 0 1 .25-.305h.008l2.675-.295a.953.953 0 0 1 .794.247l2.3 2a.563.563 0 0 1 .166.467l-.121.785c0 .01-.014.35-.411.215l-5.53-1.886a.423.423 0 0 1-.252-.443Z"/><path fill="url(#vscodeIconsFileTypeLicensew)" d="M9.356 12.146c0 .005 1.63 2.115 1.831 2.4l4.591 1.566l1.974-1.065a.372.372 0 0 0 .264-.321l.406-2.646a.405.405 0 0 0-.118-.338l-3.571-3.091a1.117 1.117 0 0 0-.931-.285l-4.133.444a.271.271 0 0 0-.179.221l-.406 2.642a1.421 1.421 0 0 0 .272.473Zm1.126-1.054l.12-.778a.451.451 0 0 1 .309-.375h.024l2.7-.29a1.07 1.07 0 0 1 .883.278l2.324 2.01a.694.694 0 0 1 .212.581l-.121.786a.38.38 0 0 1-.165.265a.417.417 0 0 1-.365.018l-5.576-1.9a.5.5 0 0 1-.273-.219a.55.55 0 0 1-.072-.377Z"/><path fill="url(#vscodeIconsFileTypeLicensex)" d="M9.415 12.108c.006.008 1.693 2.194 1.816 2.366l4.535 1.546l1.963-1.048a.33.33 0 0 0 .228-.282l.4-2.623a.339.339 0 0 0-.1-.283L14.7 8.719a1.066 1.066 0 0 0-.884-.271l-3.4.359l-.716.076a.226.226 0 0 0-.142.183s-.4 2.594-.4 2.611a1.506 1.506 0 0 0 .257.431Zm.952-1.007l.118-.77a.463.463 0 0 1 .3-.414l2.836-.308a1.12 1.12 0 0 1 .921.292l2.316 2a.758.758 0 0 1 .234.632s-.1.633-.12.779c-.034.219-.191.5-.668.339l-5.555-1.894a.584.584 0 0 1-.383-.657Z"/><path fill="url(#vscodeIconsFileTypeLicensey)" d="m15.781 16.3l-.237 1.543l-.689-.235l-.107.7a1.158 1.158 0 0 0-.7.917a1.723 1.723 0 0 0 .367 1.283l-.1.666a.765.765 0 0 0-.527.634a1.154 1.154 0 0 0 .29.912l-.036.235l-.542.031l-.167 1.088l.479.379l-.08.522l-.55.084l-.113.736l.471.432l-.176 1.146l-.532-.031l-.128.837l.488.317l-.061.4c-.09.027-1.455.411-1.455.411l-.352.462l-1.424-.483l-.343-.822l1.843-12.03l-.493-.168l.237-1.543Z"/><path fill="url(#vscodeIconsFileTypeLicensez)" d="m11.056 16.181l4.374 1.491l.208-1.352l-4.374-1.492l-.208 1.353z"/><path fill="url(#vscodeIconsFileTypeLicense10)" d="m15.388 16.234l-.842-.287l-.207 1.353l.841.287ZM14 15.76l-.208 1.353l.325.111l.208-1.353Z"/><path fill="url(#vscodeIconsFileTypeLicense11)" d="m14.756 17.55l-.1.676a1.251 1.251 0 0 0-.7.957A1.845 1.845 0 0 0 14.3 20.5l-.089.576a.844.844 0 0 0-.525.678a1.256 1.256 0 0 0 .275.95l-.018.119l-.531.034l-.188 1.221l.469.375l-.06.388l-.539.087l-.132.858l.46.427l-.154 1l-.522-.028l-.152.987l.478.314l-.04.262l-1.506.443l-1.083-.369l1.86-12.1Z"/><path fill="url(#vscodeIconsFileTypeLicense12)" d="m13.423 17.1l-1.86 12.1l-.246.4L10 29.16l-.289-.692l1.845-12.009Z"/><path fill="url(#vscodeIconsFileTypeLicense13)" d="m10.877 29.44l.45.154l1.614-10.501l.049-1.863l-.499 1.709l-1.614 10.501z"/><path fill="url(#vscodeIconsFileTypeLicense14)" d="m12.99 17.23l-1.888 12.287l-.225-.077l1.614-10.501l.499-1.709z"/><path fill="url(#vscodeIconsFileTypeLicense15)" d="m10.028 29.151l.449.153l1.614-10.501l.049-1.863l-.499 1.71l-1.613 10.501z"/><path fill="url(#vscodeIconsFileTypeLicense16)" d="m12.14 16.94l-1.887 12.287l-.225-.076l1.613-10.501l.499-1.71z"/><path fill="url(#vscodeIconsFileTypeLicense17)" d="m14.615 17.5l-.433-.148l-1.782 11.58l.478-.14l.061-.4l-.339-.222l.152-.987l.374.02l.171-1.113l-.33-.306l.132-.858l.387-.062l.08-.519l-.336-.268l.188-1.221l.381-.024l.048-.314a1.2 1.2 0 0 1-.154-.766a.85.85 0 0 1 .363-.59l.132-.856a1.79 1.79 0 0 1-.231-1.123a1.261 1.261 0 0 1 .536-.861Zm-.717-.244L12.09 29.024l.185-.054l1.791-11.655Z"/><path fill="url(#vscodeIconsFileTypeLicense18)" d="M10.932 16.665L9.075 28.47l.303-.058l1.85-11.855l-.296.108z"/><path fill="url(#vscodeIconsFileTypeLicense19)" d="m9.085 28.566l.325-.06l.354.766l-.321.068l-.358-.774z"/><path fill="url(#vscodeIconsFileTypeLicense1a)" d="m9.823 29.357l-.283.06l1.447.513l.235-.081l-1.399-.492z"/><path fill="url(#vscodeIconsFileTypeLicense1b)" d="m11.024 14.816l-.391.12l-.241 1.367l.429-.043l.203-1.444z"/><path fill="url(#vscodeIconsFileTypeLicense1c)" d="m11.05 14.636l-.425.141l-2.084-2.606l.483-.214l2.026 2.679z"/><path fill="url(#vscodeIconsFileTypeLicense1d)" d="M9.384 8.813s-.358.218-.378.346l-.546 2.773l.51-.253Z"/><path fill="url(#vscodeIconsFileTypeLicense1e)" d="m16.435 12.332l.256-.168l-2.375-2.052a.962.962 0 0 0-.538-.183l-.1.115a2.143 2.143 0 0 1 .362.211Z"/><path fill="url(#vscodeIconsFileTypeLicense1f)" d="M16.724 12.208a.393.393 0 0 1 .058.221c-.016.1-.112.774-.12.825l-.283.085l.115-.747a.4.4 0 0 0-.033-.213Z"/><path fill="url(#vscodeIconsFileTypeLicense1g)" d="m10.424 10.725l-.058.375a.584.584 0 0 0 .381.653l5.553 1.894c.478.163.634-.12.668-.339l.051-.334l1.139.388l-.2 1.327a.33.33 0 0 1-.228.282l-1.963 1.048l-4.535-1.546a358.09 358.09 0 0 0-1.816-2.366a1.506 1.506 0 0 1-.257-.43l.2-1.315Z"/><path fill="url(#vscodeIconsFileTypeLicense1h)" d="m14.756 8.764l-.179 1.166l.432.373l.179-1.167Zm1.851 1.595l-1.119-.965l-.179 1.167l1.119.965Zm-.5 3.223l-1.2-.411l-.372 2.423l1.2.411Zm-1.526-.52l-.461-.162l-.372 2.423l.465.159Z"/><path fill="url(#vscodeIconsFileTypeLicense1i)" d="M9.936 2.733c2.042-1.441 5.206-.715 7.065 1.8A6.169 6.169 0 0 1 18.27 9.1c-.219-.73-1.023-.427-1.664-.441a4.11 4.11 0 0 0-.763-3.207C14.6 3.778 12.41 3.1 11.07 4.094s-1.382 3.253-.143 4.929a3.68 3.68 0 0 0 3.69 1.742c.521.444 1 .871 1.507 1.329c-1.84 1.134-4.8.334-6.51-1.982c-1.86-2.512-1.93-5.789.322-7.379Z"/><path fill="url(#vscodeIconsFileTypeLicense1j)" d="M9.956 2.841c1.939-1.405 5.111-.606 6.892 1.8a6.587 6.587 0 0 1 1.38 4.159c-.293-.387-1.035-.264-1.466-.211a4.6 4.6 0 0 0-.823-3.272c-1.317-1.78-3.546-2.373-4.97-1.32s-1.442 3.27-.125 5.051a4.034 4.034 0 0 0 3.842 1.905c.4.35.79.715 1.185 1.073c-1.982 1.012-4.528.084-6.123-2.073c-1.782-2.408-1.897-5.587.208-7.112Z"/><path fill="url(#vscodeIconsFileTypeLicense1k)" d="M10.1 2.918c1.855-1.345 4.971-.5 6.675 1.8a6.635 6.635 0 0 1 1.361 3.89a1.872 1.872 0 0 0-1.148-.126a4.555 4.555 0 0 0-.946-3.23c-1.394-1.885-3.6-2.472-5.1-1.357s-1.511 3.279-.171 5.2a4.075 4.075 0 0 0 3.976 1.973c.323.285.639.58.957.871c-1.939.959-4.394-.1-5.893-2.131C8.1 7.511 8.1 4.363 10.1 2.918Z"/><path fill="url(#vscodeIconsFileTypeLicense1l)" d="M9.684 3.412C8.6 4.969 8.825 7.5 10.3 9.494c1.413 1.911 3.466 2.885 5.249 2.443c-1.694.674-4.074-.233-5.554-2.235c-1.54-2.081-1.66-4.783-.311-6.29Z"/><path fill="url(#vscodeIconsFileTypeLicense1m)" d="M9.9 3.511c-.171.291.366.627.547.144a4.29 4.29 0 0 1 2.442-1.222A3.558 3.558 0 0 0 9.9 3.511Zm.077.506a.244.244 0 1 0 .211.273a.243.243 0 0 0-.213-.273Z"/><path fill="url(#vscodeIconsFileTypeLicense1n)" d="M11.035 3.763c1.4-1.181 3.664-.647 5.163 1.132a4.723 4.723 0 0 1 1.2 3.542c-.136.014-.273.03-.411.048a4.555 4.555 0 0 0-.946-3.23c-1.394-1.885-3.6-2.472-5.1-1.357c-.071.053-.136.11-.2.167a2.672 2.672 0 0 1 .294-.302Z"/>`}})),zm=n((e=>{e.__esModule=!0,e.default={width:32,height:32,body:`<path fill="gray" d="m16.5 30l-.011-.321c.4-.014.8-.045 1.19-.094l.039.319c-.406.048-.818.08-1.218.096Zm-1.222-.011c-.4-.021-.814-.061-1.216-.118l.045-.318c.393.055.793.094 1.188.115Zm3.642-.289l-.067-.314c.387-.083.776-.184 1.155-.3l.094.307c-.388.118-.786.222-1.182.307Zm-6.063-.053c-.4-.091-.791-.2-1.177-.326l.1-.306c.377.122.764.23 1.15.319Zm8.4-.665l-.121-.3c.364-.148.728-.314 1.08-.493h.006l.145.286c-.367.186-.741.356-1.114.507Zm-10.718-.088a13.693 13.693 0 0 1-1.1-.524l.15-.284c.35.186.713.358 1.078.512Zm12.893-1.021l-.17-.273c.337-.21.668-.437.984-.675l.193.257c-.328.243-.667.476-1.011.691Zm-15.053-.122c-.341-.22-.676-.459-1-.708l.2-.253c.312.243.64.476.972.691Zm17-1.346l-.215-.239c.294-.265.58-.546.851-.836l.235.219c-.278.297-.571.585-.872.851Zm-18.925-.153c-.3-.276-.585-.569-.856-.87l.239-.215c.265.294.547.58.836.85Zm20.587-1.632l-.253-.2c.244-.312.476-.639.692-.972l.27.175c-.221.343-.46.677-.709.997ZM4.82 24.439a14.237 14.237 0 0 1-.692-1.007l.272-.17c.21.337.438.668.676.984Zm23.547-1.867l-.284-.151c.186-.35.358-.713.513-1.078l.3.125a14.91 14.91 0 0 1-.528 1.104Zm-24.841-.2l-.006-.012a13.075 13.075 0 0 1-.5-1.1l.3-.121c.147.362.312.724.491 1.074l.006.012Zm25.794-2.047l-.306-.1c.122-.377.23-.764.319-1.15l.313.072c-.091.396-.2.792-.326 1.178Zm-26.712-.218c-.12-.388-.223-.786-.308-1.182l.314-.067c.083.387.184.776.3 1.155Zm27.262-2.161l-.318-.045c.056-.393.094-.793.115-1.188l.321.017a13.78 13.78 0 0 1-.118 1.216ZM2.1 17.72c-.05-.4-.082-.812-.1-1.218l.321-.011c.014.4.046.8.094 1.19Zm27.582-2.2c-.014-.4-.045-.8-.093-1.19l.319-.039c.049.4.082.813.1 1.218ZM2.331 15.3l-.321-.02c.021-.405.061-.814.117-1.216l.318.045c-.055.391-.093.791-.114 1.191Zm27.057-2.144a13.987 13.987 0 0 0-.3-1.155l.312-.101c.119.388.223.786.307 1.183Zm-26.725-.222l-.313-.072c.091-.4.2-.791.326-1.177l.306.1c-.123.376-.23.763-.319 1.149Zm26.026-2.062a12.639 12.639 0 0 0-.5-1.086l.286-.146c.185.363.355.736.507 1.111ZM3.4 10.665l-.3-.125c.158-.374.334-.745.524-1.1l.284.15c-.184.347-.356.71-.508 1.075Zm1.113-2.108l-.27-.174c.22-.341.458-.676.707-1l.254.2c-.243.317-.476.641-.691.974Zm1.464-1.881l-.235-.219c.276-.3.569-.585.87-.857l.215.239c-.294.261-.58.547-.85.837Zm1.77-1.6l-.193-.257c.323-.244.662-.477 1.007-.692l.17.272c-.337.215-.668.442-.984.68Zm15.705-.558l-.018-.012l.175-.27l.018.011Zm-1.047-.616a13.44 13.44 0 0 0-1.078-.512l.125-.3c.374.158.745.334 1.1.524ZM9.769 3.815l-.146-.286l.018-.009c.356-.181.724-.349 1.093-.5l.121.3c-.361.147-.72.311-1.068.488Zm10.44-.838a13.414 13.414 0 0 0-1.151-.317l.072-.313c.4.091.792.2 1.178.325Zm-8.229-.06l-.094-.307a14.25 14.25 0 0 1 1.182-.308l.067.314a13.89 13.89 0 0 0-1.155.301Zm5.9-.473a13.953 13.953 0 0 0-1.188-.113l.016-.321c.405.021.814.059 1.216.115Zm-3.572-.026l-.04-.319c.4-.05.812-.083 1.218-.1l.012.321c-.392.017-.793.049-1.186.098Z"/><circle cx="16" cy="15.998" r="10.708" fill="navy"/><circle cx="20.435" cy="11.562" r="3.136" fill="#fff"/><circle cx="26.708" cy="5.29" r="3.137" fill="navy"/><path fill="#fff" d="M13.1 21.352v-.79H9.629v-6.236h-.9v7.026H13.1m4.816 0V16.3h-.8v2.785c0 1.031-.54 1.706-1.378 1.706A.95.95 0 0 1 14.7 19.8v-3.5h-.8v3.817c0 .838.626 1.378 1.609 1.378a1.863 1.863 0 0 0 1.687-.925v.781h.723m5.872-.018v-.607a.664.664 0 0 1-.173.019c-.279 0-.434-.145-.434-.4v-2.809c0-.9-.655-1.378-1.9-1.378c-1.224 0-1.976.472-2.024 1.638h.81c.067-.617.434-.9 1.185-.9c.723 0 1.128.27 1.128.752v.212c0 .337-.2.482-.838.559a5.763 5.763 0 0 0-1.619.308a1.327 1.327 0 0 0-.887 1.311c0 .916.636 1.455 1.658 1.455a2.363 2.363 0 0 0 1.715-.742a.855.855 0 0 0 .829.665a1.967 1.967 0 0 0 .549-.087m-1.407-1.725a1.366 1.366 0 0 1-1.513 1.185c-.626 0-.993-.222-.993-.771c0-.53.357-.761 1.214-.887a4 4 0 0 0 1.291-.279v.752"/>`}})),Bm=n((e=>{e.__esModule=!0,e.default={width:32,height:32,body:`<path fill="#fff" d="M7.313 18.654a.548.548 0 0 1-.6.233a.917.917 0 0 0-.869.08c-.306.218-.637.053-.579-.345a1.229 1.229 0 0 1 .583-.971c.833-.479.254-.812.711-1.293s.357-.629.341-1.283a4.648 4.648 0 0 1-3.4-1.9a6.012 6.012 0 0 1-1.46-3.764a6.365 6.365 0 0 1 .649-3.8a5.315 5.315 0 0 1 2.565-2.522a7.022 7.022 0 0 1 3.489-.77a4.96 4.96 0 0 1 2.443.452a5.148 5.148 0 0 0 1.546.8a1.217 1.217 0 0 0 .782-.226c.047 1.189-1.023 1.292-1.98 1.317s-1.546-.371-2.427-.224a4.193 4.193 0 0 0-3.03 1.774A3.783 3.783 0 0 0 5.408 8.9a1.952 1.952 0 0 0 1.441 1.8c.5.008.61-.136 1.047-.421s2.665-3.043 3.426-3.663a3.522 3.522 0 0 1 2.322-.821a3.24 3.24 0 0 1 1.671.286A12.275 12.275 0 0 1 16.9 7.139a8.833 8.833 0 0 0 .684-.576a2.865 2.865 0 0 1 2.393-.718a3.644 3.644 0 0 1 1.819.8a14.312 14.312 0 0 1 2.013 2.425a3.59 3.59 0 0 0 1.621 1.489c.771.237 1.352-.762 1.437-1.316a5.814 5.814 0 0 0 .112-.935a4.413 4.413 0 0 0-.135-1.125a4 4 0 0 0-.455-1.016a3.606 3.606 0 0 0-1.3-1.25A4.129 4.129 0 0 0 23.7 4.5a13.676 13.676 0 0 0-1.4.2c-.584.04-1.628.171-2.086-.28a1.18 1.18 0 0 1-.378-.853a.892.892 0 0 0 .469.19c.366.031.708-.268 1-.441a7.34 7.34 0 0 1 .908-.526a5.856 5.856 0 0 1 2.7-.232a6.308 6.308 0 0 1 2.2.725a6 6 0 0 1 1.634 1.48A4.983 4.983 0 0 1 29.781 6.9a8.981 8.981 0 0 1 .017 3.847a7.577 7.577 0 0 1-1.714 2.819a4.388 4.388 0 0 1-2.317 1.112a4.911 4.911 0 0 0 .086.488c.064.206.188.436.441.363a.236.236 0 0 1 .289.063c.133.116.064.567-.311.769a1.449 1.449 0 0 1-.695.131a6.612 6.612 0 0 1-1.11-.051c-.33-.058-.528-.32-.894-.361a3.572 3.572 0 0 1-1.452-.764a3.048 3.048 0 0 0-.362-.185c.059.18.138.368.177.541s.023.334.043.472s.059.247.082.359c.09.081.119.2.272.243a1.706 1.706 0 0 0 .546-.043c.156-.021.26-.106.383-.083a.85.85 0 0 1 .34.193c.1.082.191.094.274.3a3.333 3.333 0 0 1 .171.9a1.93 1.93 0 0 1-.1.755a1.261 1.261 0 0 1-.381.541a5.937 5.937 0 0 1-.956.769a1.652 1.652 0 0 0 .2.3c.1.109.324.229.421.344a.473.473 0 0 1 .148.324a.686.686 0 0 1-.109.433a1.9 1.9 0 0 1-.937.573a2.477 2.477 0 0 1 .023 1.06c-.037.159-.119.519-.315.612a3.823 3.823 0 0 1-.814.086c-.239.038-.373.074-.56.111a3.3 3.3 0 0 0-.34.492a.4.4 0 0 0 .008.35c.049.15.214.368.261.544a1.091 1.091 0 0 1 .012.541a.943.943 0 0 1-.269.46c-.15.157-.446.28-.593.406s-.294.142-.254.352a1.551 1.551 0 0 0 .781.867a.925.925 0 0 0 .65-.048c-.015.246-.228.412-.367.576a2.2 2.2 0 0 0 1-.588a2.488 2.488 0 0 1-.752.955a2.872 2.872 0 0 1-.6.4a2.652 2.652 0 0 0 .99 0a1.97 1.97 0 0 1-.748.242a2.2 2.2 0 0 1-.85-.064a5.7 5.7 0 0 1-.951-.541a.78.78 0 0 0 .217.442a2.859 2.859 0 0 0 .639.334a9.407 9.407 0 0 1-.963-.116a2.233 2.233 0 0 1-.555-.189a3.647 3.647 0 0 1-.449-.309a1.291 1.291 0 0 0 .215.411a1.963 1.963 0 0 0 .48.232a2.1 2.1 0 0 1-.5-.011a1.408 1.408 0 0 1-.517-.245a3.7 3.7 0 0 1-.52-.463a2.155 2.155 0 0 1-.4-.538c-.058-.154.035-.262.052-.393a1.233 1.233 0 0 0-.318.21a.4.4 0 0 0-.118.37a2.46 2.46 0 0 0 .315.589c-.344-.281-.536-.389-.618-.729a1.143 1.143 0 0 1 .272-.846c.075-.119.187-.23.257-.345a4.668 4.668 0 0 1-.466-.456c-.133-.173-.189-.408-.325-.573a3.412 3.412 0 0 0-.478-.407a6.246 6.246 0 0 1 .42.9a.6.6 0 0 1-.139.5c-.083.126-.216.154-.343.231s-.323.017-.4.131a.392.392 0 0 0-.023.4l.3.466a1.421 1.421 0 0 1-.381-.328c-.084-.114-.214-.218-.232-.371a.541.541 0 0 1 .073-.422c.1-.137.371-.182.493-.287s.19-.173.183-.309s-.14-.232-.253-.318a8.278 8.278 0 0 1-1.088-.815a1.08 1.08 0 0 1-.28-.443a.459.459 0 0 1 .085-.368c.083-.151.367-.352.4-.515s-.109-.2-.238-.256s-.376.029-.5-.071s.035-.311-.1-.427s-.445-.051-.6-.176a.837.837 0 0 1-.281-.459a.974.974 0 0 1-.024-.509c.038-.131.15-.154.217-.222s.127-.124.036-.225s-.385.006-.555-.124s-.066-.44-.186-.572s-.336-.079-.449-.121s-.159.106-.228-.128s-.072-.93-.166-1.189s-.278-.018-.363-.276a7.085 7.085 0 0 1-.043-1.06l-.175-1.061c-.609.409-2.53.935-2.7 1.233"/><path fill="#030303" d="M16.623 8.258a3.733 3.733 0 0 0 .077.942a.909.909 0 0 0 .382.66c.462.343.758.286 1.114.485a1.017 1.017 0 0 1 .446.421a.363.363 0 0 1-.17.422a.361.361 0 0 0 .371-.48c-.052-.128-.3-.185-.373-.314a.488.488 0 0 1-.04-.393c.064-.236.531-.451.7-.637a.772.772 0 0 0 .208-.9a2.831 2.831 0 0 0-1.45-1.141a3.209 3.209 0 0 0-.5-.15a1.65 1.65 0 0 1 .875.807c.144.374.019.515.024.84c0 .151.2.226.289.322s.07.145.009.259a.3.3 0 0 0-.13-.236c-.13-.093-.271-.073-.341-.263c-.106-.289.1-.563-.132-.888a1.029 1.029 0 0 0-.727-.522a1.267 1.267 0 0 0-.423.066l-.219-.258a4.594 4.594 0 0 0-1.34-.995a3.033 3.033 0 0 0-1.607-.3a3.068 3.068 0 0 0-2.2.771c-.808.7-2.892 3.367-3.4 3.7a1.7 1.7 0 0 1-1.248.453a2.124 2.124 0 0 1-1.657-2.002a4.041 4.041 0 0 1 .722-2.857a4.173 4.173 0 0 1 3.224-1.9a12.022 12.022 0 0 1 2.441.23c.771 0 1.534-.132 1.759-.745a1.044 1.044 0 0 1-.672.118A6.739 6.739 0 0 1 11 2.952a5.237 5.237 0 0 0-2.29-.377a6.319 6.319 0 0 0-3.215.669a5.769 5.769 0 0 0-2.582 2.475a5.866 5.866 0 0 0-.654 3.649a6.068 6.068 0 0 0 1.423 3.613a4.457 4.457 0 0 0 3.295 1.785l.329-1.45l-.587.842l.015-.937l-.531.659l-.233-.894l-.43.716l-.214-1l-.623.5l.2-.823l-.825.092l.379-.572l-.752.009l.438-.764l-.667-.106L4 10.35l-.817-.242l.676-.648l-.659-.544l.522-.406l-.492-.65l.521-.607l-.194-.8L4 6.067l.132-.916l.5-.249l.427-.715l.785-.087l.39-.643l.793.04l.749-.407l.778.181l.883-.266l.654.153l.853.125l.824.659L10.5 3.5l-.636.305l-.526-.321l-.362.246l-.64.064l-.574-.037l-.419.511l-.843.013l-.3.688l-.759.266l-.071.791l-.544.426L5 7.2l-.47.773l.361.676l-.355.619l.472.308l-.107.995l.656.166l.148.738l.715-.075l.444.506l.549-.536a6.151 6.151 0 0 0 2.193-1.625a10.282 10.282 0 0 1 2.58-2.506a3.451 3.451 0 0 1 2.493-.477c.895.154 1.194.691 1.853 1.257a.626.626 0 0 1 .2-.253a4.416 4.416 0 0 0-.108.492Zm4.665 5.934a.71.71 0 0 1-.2.143a2.376 2.376 0 0 1-.344.083c.173.27.355.543.521.826s.31.594.469.892a4.909 4.909 0 0 0-.022-.511a5.014 5.014 0 0 0-.168-.537c-.071-.239-.159-.564-.26-.9Zm-.06-1.551a.508.508 0 0 1 .168.092a.646.646 0 0 1 .255.269a1.025 1.025 0 0 1 .048.466c-.056-.016-.132-.005-.191-.055s-.092-.162-.167-.21a.439.439 0 0 0-.219-.048a.694.694 0 0 1 .043.35a.431.431 0 0 1-.409.387a1.336 1.336 0 0 1-.342-.036c.04.089.108.167.147.256a1.842 1.842 0 0 0 .439-.073a3.264 3.264 0 0 1 .345-.2a2.175 2.175 0 0 1 .395-.067c-.113.1-.188.2-.3.295l.25.728c.177.111.344.169.566.306a7.337 7.337 0 0 0 .781.515a2.887 2.887 0 0 0 .767.263c.3.057.545.3.844.343a6.43 6.43 0 0 0 1.087.025c.261-.025.6-.16.631-.447a.6.6 0 0 1-.723-.407c-.075-.183-.038-.52-.153-.737s-.274-.286-.466-.552a8.352 8.352 0 0 1-.679-1.045c-.175-.357-.217-.762-.365-1.082a5.285 5.285 0 0 0-.546-.826a2.918 2.918 0 0 0-1.308-1.18a6.4 6.4 0 0 0-.963-.249c-.131.059-.31.124-.342.276a.622.622 0 0 0 .14.493a2.1 2.1 0 0 1 .568.7a2.753 2.753 0 0 1 .03 1.029a1.146 1.146 0 0 1-.328.42Zm-1.451.173a2.483 2.483 0 0 1 .854-.242c.126-.008.321.012.448.017a1.7 1.7 0 0 0 .3-.466a2.519 2.519 0 0 0-.043-.826c-.172-.423-.34-.441-.577-.683a1.347 1.347 0 0 1-.231-.743c-.019-.11-.073-.249-.1-.363a4.64 4.64 0 0 0-1-.052a1.088 1.088 0 0 0 .39-.567a1.116 1.116 0 0 0-.132-.78a3.032 3.032 0 0 0-.576-.6c-.208-.182-.506-.332-.7-.482a5.781 5.781 0 0 1 .768-.275a2.5 2.5 0 0 1 1.842.448a4.6 4.6 0 0 1 1.053.833c.384.4.859 1.137 1.23 1.574a7.877 7.877 0 0 0 .997 1.043a4.973 4.973 0 0 0 .925.5l.481.51l.389-.481l.625.071l.129-.7l.574-.157l-.093-.947l.413-.293l-.31-.589l.315-.644l-.411-.736l.159-.708l-.476-.405l-.062-.753l-.664-.253l-.266-.655l-.75-.01l-.366-.486l-.5.035l-.56-.061l-.316-.234l-.46.3l-.557-.29l-1.106.42l.721-.627l.747-.119l.569-.138l.773.254l.68-.172l.656.388l.694-.038l.341.612l.691.079l.374.68l.435.237l.115.871l.387.367l-.17.762l.456.577l-.428.619l.457.387l-.585.518l.592.616l-.715.23l.466.661l-.584.1l.383.727l-.658-.009l.331.545l-.722-.087l.173.783l-.546-.48l-.187.949l-.377-.682l-.2.85l-.465-.627l.012.891l-.514-.8a3.638 3.638 0 0 0 .385 1.382a3.518 3.518 0 0 0 2.24-1.041a7.168 7.168 0 0 0 1.627-2.739a9.306 9.306 0 0 0 .011-3.618a5.45 5.45 0 0 0-1.045-2.109A7.963 7.963 0 0 0 26.9 3.405a6.2 6.2 0 0 0-3.2-.694a3.79 3.79 0 0 0-1.338.25c-.617.224-1.11.714-1.737.955a.6.6 0 0 1-.53 0a.989.989 0 0 0 .723.572a5.464 5.464 0 0 0 1.431-.013a9.013 9.013 0 0 1 1.451-.19a3.1 3.1 0 0 1 1.484.428a3.658 3.658 0 0 1 1.4 1.318a4 4 0 0 1 .448 1.079a5.063 5.063 0 0 1 .151 1.174a3.6 3.6 0 0 1-.112 1.035c-.212.781-.68 1.576-1.641 1.454c-.588-.075-1.475-1.18-1.772-1.585a15.7 15.7 0 0 0-1.969-2.4a3.034 3.034 0 0 0-1.705-.757a2.579 2.579 0 0 0-2.384.829a4.609 4.609 0 0 1 .532.17a3.981 3.981 0 0 1 1.094.718a1.19 1.19 0 0 1 .5.968c.008.3-.239.541-.465.758c-.139.133-.322.254-.434.357c-.149.137-.333.286-.147.5a1.883 1.883 0 0 0 .3.22c.163.121.089.572-.127.691a.712.712 0 0 1-.832-.069c.287-.043.469-.081.461-.315c0-.136-.177-.249-.347-.326a4.931 4.931 0 0 1-1.125-.452c-.411-.3-.42-.458-.531-.922a2.623 2.623 0 0 0-.646.113c-.265.087-.558.3-.8.348a1.718 1.718 0 0 1-1.058.006a4.244 4.244 0 0 0-2.1.349a5.917 5.917 0 0 0-.975.121a6.413 6.413 0 0 0-1.7.995a9.083 9.083 0 0 0-1.98 4.059c-.051.57.112.955-.248 1.233s-.349.992-.471 1.193s-.263.111-.525.392s-.4.234-.389.766a1.839 1.839 0 0 1 .845-.332c.256-.009.259.328.916-.322c.352-.348 1.027-.358 1.5-.512A4.732 4.732 0 0 0 11 16.152a5.613 5.613 0 0 0 1.415-3.381a3.984 3.984 0 0 1-.038 1.247a3.473 3.473 0 0 0 .151 2.442l.309.59a5.184 5.184 0 0 1-.652-.953l-.25-.674a5.057 5.057 0 0 1-1.463 1.662a2.916 2.916 0 0 0 .089 1.169c.128.373-.076.8.021 1.049s.321.106.394.355s-.038.741.075.983s.392.1.527.174a.774.774 0 0 1 .251.289c.073.1-.028.346.119.425s.376.012.529.088a.357.357 0 0 1 .139.422c-.036.163-.2.238-.272.4a.427.427 0 0 0 .023.434a.891.891 0 0 0 .466.314c.19.077.457.034.653.14a1.537 1.537 0 0 1 .476.473a.636.636 0 0 1 .127.425a1.19 1.19 0 0 1-.157.505c-.087.157-.278.347.021.647s.287.17.458.364c-.019-.336-.157-.609-.056-.862s.406-.3.566-.411a2.625 2.625 0 0 0 .379-.4a4.487 4.487 0 0 1 0 .491c-.041.266-.119.5.277.544a1.293 1.293 0 0 0 .535-.166c-.1.176-.269.318-.3.528a.918.918 0 0 0 .151.651a2.127 2.127 0 0 0 .582.487a2.227 2.227 0 0 0 .425.2c.007.207-.034.427-.01.621a1.134 1.134 0 0 0 .2.529a1.73 1.73 0 0 0 .465.373c-.094-.218-.283-.424-.281-.653a.734.734 0 0 1 .294-.594c.223-.2.746-.38.992-.577a1.214 1.214 0 0 0 .414-.51a2.23 2.23 0 0 0 .08-.673a2.032 2.032 0 0 1 .119.569a2.006 2.006 0 0 1-.221.794a1.217 1.217 0 0 0 .6-.612c.065.039.032.145.056.349c.109-.108.232-.191.341-.293a.949.949 0 0 0 .284-.334a.765.765 0 0 0-.008-.459a3.091 3.091 0 0 0-.324-.538c-.1-.181.017-.358.01-.576a1.727 1.727 0 0 0-.6-.1c-.229.033-.491.29-.725.293s-.365-.216-.557-.277a3.409 3.409 0 0 0-.579-.08a5.348 5.348 0 0 1 1.84-.451a11.629 11.629 0 0 1 1.715-.155a4.393 4.393 0 0 0 .769.03c.179-.051.141-.174.194-.307a1.73 1.73 0 0 0-.006-1.079A8.378 8.378 0 0 0 20.46 22c-.511.039-1.117.282-1.644.3a3.165 3.165 0 0 1-1.53-.328a3.63 3.63 0 0 1-.986-1.125c-.215-.329-.486-.975-.651-1.27a1.614 1.614 0 0 0-.339-.5a1.512 1.512 0 0 0-.488-.2c.188.019.392-.04.563.058c.256.147.543.756.7 1.021c.169-.566.129-.788.618-1.107a2.153 2.153 0 0 0-.5 1.295c.327.537.782 1.393 1.378 1.63a3.907 3.907 0 0 0 .817.168a5.91 5.91 0 0 0 2.132-.315a5.587 5.587 0 0 1 1.678-.04c.215.012.72-.117.825-.333a.382.382 0 0 0-.033-.386c-.081-.126-.3-.186-.414-.3a2.667 2.667 0 0 1-.274-.368a7.515 7.515 0 0 1-1.238.138c.257-.106.5-.167.771-.271a4.6 4.6 0 0 0 .787-.419a2.522 2.522 0 0 0 .51-.391a3.13 3.13 0 0 0 .471-.539a1.406 1.406 0 0 0 .139-.681a2.03 2.03 0 0 0-.1-.805a.634.634 0 0 0-.433-.311c-.15-.048-.252.073-.408.09s-.3.115-.527.008a1.967 1.967 0 0 1-.72-.642c-.228-.32-.39-.844-.623-1.247a21.2 21.2 0 0 0-1.376-1.986a4.043 4.043 0 0 1-.118-.593a2.861 2.861 0 0 1 .076-1.13a.987.987 0 0 1 .512-.69a.563.563 0 0 1 .371-.026a.25.25 0 0 1 .167.294c-.045.15-.15.155-.221.231a.808.808 0 0 0-.213.384a1.825 1.825 0 0 1 .412.016a.481.481 0 0 1 .339.326a.611.611 0 0 0-.456-.22a2.057 2.057 0 0 0-.316.048a2.271 2.271 0 0 1-.118.383c-.056.1-.163.075-.2.191a1.12 1.12 0 0 0-.022.455Zm.546.2c-.208.013-.258-.014-.424.1l.271.422a.65.65 0 0 1 .153-.525Zm-7.072-1.86a.812.812 0 0 1 .036-.194c-.3-.081-.423.115-.6.479c-.066.136 0 .217-.072.306s-.185.077-.3.163s-.23.251-.338.34a3.758 3.758 0 0 1-.777.418a2.536 2.536 0 0 0 .625-.513c.058-.1.05-.287.14-.377s.123-.152.24-.174s.07-.159.108-.266a1.151 1.151 0 0 1 .193-.293a.848.848 0 0 1 .339-.329c.158-.059.405 0 .525-.029s.051-.121.138-.173s.257-.029.373-.085a1.139 1.139 0 0 0 .429-.442A2.256 2.256 0 0 1 14.187 11a1.478 1.478 0 0 1-.749.89a2.38 2.38 0 0 1-.426.16c.073-.1.177-.143.219-.3a3.762 3.762 0 0 0 .02-.6Zm1.931 1.493c.157-.014.351.028.5.02a2.652 2.652 0 0 0 .377-.07c-.023-.221 0-.627-.205-.774a1.783 1.783 0 0 0-.817.008a7.63 7.63 0 0 0-1.017.385a3.168 3.168 0 0 1 .923-.514a2.428 2.428 0 0 1 .948-.09c.1.028.123.07.185.156a1.811 1.811 0 0 1 .268.9a2.524 2.524 0 0 1 .157.229a1.1 1.1 0 0 1 .081.338c-.056-.081-.022-.183-.177-.243a1.507 1.507 0 0 0-.6.018a.508.508 0 0 1-.231.934a.541.541 0 0 1-.641-.333a.988.988 0 0 1-.021-.4a.794.794 0 0 0-.688.259a1.3 1.3 0 0 0 .523.508a1.681 1.681 0 0 0 .5.186a2.516 2.516 0 0 0 .676.032a.734.734 0 0 0 .444-.216a1.04 1.04 0 0 0 .212-.47a1.369 1.369 0 0 1-.083.431a.786.786 0 0 1-.778.412a2.853 2.853 0 0 1-1.019-.2a1.542 1.542 0 0 1-.73-.624a1.8 1.8 0 0 1-.02-.557c.332-.22.413-.166.806-.231c.164-.027.277-.088.433-.1Zm.9-2.187a1.48 1.48 0 0 0 .524.212c.147 0 .185-.1.272-.154a6.578 6.578 0 0 0 .523 1.333c.1.169.159.09.232.26s.107.514.176.73a5.907 5.907 0 0 0 .242.564a7.727 7.727 0 0 1-.583-.9c-.114-.241-.041-.262-.133-.492s-.279-.588-.418-.882a.829.829 0 0 1-.3.008c-.076-.023-.061-.1-.129-.156s-.184-.032-.28-.115a.592.592 0 0 1-.127-.405Zm-1.964 7.762c.138-.112.511-.023.789 0l-.6.154c-.019.068-.01.147-.056.2s-.132.079-.2.119c.007-.179-.072-.363.066-.475Zm2.574-3.737a2.621 2.621 0 0 0 .205-.6c-.027.252.024.529-.1.712s-.339.151-.518.2c.139-.106.3-.153.411-.312Zm-.252 2.8a1 1 0 0 1 .5-.9a2.14 2.14 0 0 1 .706-.253a2.751 2.751 0 0 1 1.186.155a7.055 7.055 0 0 1 .7.459c.239.141.409.236.637.395c.35.243.554.512.8.673a1.763 1.763 0 0 0 .435.113a.73.73 0 0 1-.407.033a1.823 1.823 0 0 1-.513-.306a3.515 3.515 0 0 0-.579-.42c-.145-.084-.383-.183-.542-.287s-.435-.331-.587-.407a1.892 1.892 0 0 0-.759-.146a1.606 1.606 0 0 0-.959.267a.645.645 0 0 0-.264.66a2.992 2.992 0 0 1 .23-.3a.721.721 0 0 1 .607-.131a.531.531 0 0 1 .459.415a1.1 1.1 0 0 0-.238-.159a.573.573 0 0 0-.51.05c-.21.112-.153.278-.183.463a1.765 1.765 0 0 1-.069.231a.453.453 0 0 1-.211-.113a1.493 1.493 0 0 0 .008.259a3.194 3.194 0 0 0 .1.319a1.872 1.872 0 0 1-.39-.47a1.237 1.237 0 0 1-.148-.6Zm1.889.318a.98.98 0 0 1 .439.114a1.712 1.712 0 0 1 .314.223a1.858 1.858 0 0 1 .5.877a5.274 5.274 0 0 1 .077.745a4.767 4.767 0 0 0-.225-.687a1.682 1.682 0 0 0-.783-.8a.42.42 0 0 0-.252-.032c.028.047.075.086.077.155a.27.27 0 0 1-.13.259a.493.493 0 0 1-.541-.1a.48.48 0 0 1-.12-.535c.091-.224.439-.224.644-.216Zm-10.406.644a.726.726 0 0 0-.6.4a.548.548 0 0 1-.6.233a.917.917 0 0 0-.869.08c-.306.218-.637.053-.579-.344a1.226 1.226 0 0 1 .583-.971c.832-.479.254-.812.71-1.293s.356-.629.342-1.283a4.65 4.65 0 0 1-3.4-1.9A6.013 6.013 0 0 1 2.036 9.4a6.362 6.362 0 0 1 .649-3.8a5.314 5.314 0 0 1 2.569-2.522a7.026 7.026 0 0 1 3.489-.769a4.958 4.958 0 0 1 2.443.452a5.153 5.153 0 0 0 1.545.8a1.218 1.218 0 0 0 .782-.226c.047 1.189-1.023 1.292-1.981 1.317s-1.546-.371-2.427-.223A4.192 4.192 0 0 0 6.078 6.2a3.78 3.78 0 0 0-.669 2.683a1.951 1.951 0 0 0 1.44 1.8c.5.008.61-.136 1.047-.421s2.665-3.041 3.426-3.662a3.518 3.518 0 0 1 2.321-.821a3.236 3.236 0 0 1 1.671.285A12.282 12.282 0 0 1 16.9 7.128a8.515 8.515 0 0 0 .684-.576a2.865 2.865 0 0 1 2.393-.718a3.644 3.644 0 0 1 1.819.8a14.284 14.284 0 0 1 2.014 2.425a3.594 3.594 0 0 0 1.621 1.489c.771.237 1.351-.762 1.437-1.316a5.786 5.786 0 0 0 .112-.932a4.39 4.39 0 0 0-.134-1.125a4.012 4.012 0 0 0-.455-1.016a3.6 3.6 0 0 0-1.3-1.25a4.131 4.131 0 0 0-1.391-.424a13.632 13.632 0 0 0-1.4.2c-.584.04-1.627.171-2.085-.28a1.18 1.18 0 0 1-.378-.854a.891.891 0 0 0 .469.189c.366.031.708-.268 1-.441a7.2 7.2 0 0 1 .907-.526a5.861 5.861 0 0 1 2.7-.233a6.315 6.315 0 0 1 2.2.725a6.005 6.005 0 0 1 1.634 1.48a4.992 4.992 0 0 1 1.037 2.15a8.988 8.988 0 0 1 .017 3.847a7.581 7.581 0 0 1-1.713 2.819a4.391 4.391 0 0 1-2.317 1.112c.034.177.04.342.085.487c.065.206.188.436.442.364a.236.236 0 0 1 .289.062c.133.117.063.567-.312.769a1.444 1.444 0 0 1-.695.131a6.517 6.517 0 0 1-1.11-.051c-.33-.058-.528-.319-.894-.361a3.576 3.576 0 0 1-1.452-.764a3.069 3.069 0 0 0-.362-.185c.059.18.137.368.177.541s.022.334.043.473s.059.246.081.359c.091.081.12.2.272.243a1.688 1.688 0 0 0 .546-.043c.156-.021.261-.105.383-.083a.853.853 0 0 1 .341.193c.1.082.19.094.274.3a3.364 3.364 0 0 1 .17.9a1.922 1.922 0 0 1-.1.755a1.254 1.254 0 0 1-.381.541a5.924 5.924 0 0 1-.957.769a1.691 1.691 0 0 0 .2.3c.1.108.324.229.421.343a.474.474 0 0 1 .148.324a.689.689 0 0 1-.109.434a1.9 1.9 0 0 1-.937.573a2.484 2.484 0 0 1 .023 1.06c-.037.159-.119.519-.315.612a3.808 3.808 0 0 1-.814.086c-.239.038-.373.074-.56.111a3.312 3.312 0 0 0-.34.491a.4.4 0 0 0 .008.35c.049.15.215.369.261.544a1.091 1.091 0 0 1 .012.541a.952.952 0 0 1-.269.461c-.15.157-.446.279-.593.406s-.294.142-.254.352a1.548 1.548 0 0 0 .781.867a.93.93 0 0 0 .65-.047c-.015.246-.228.412-.367.575a2.2 2.2 0 0 0 1-.587a2.486 2.486 0 0 1-.752.954a2.86 2.86 0 0 1-.6.4a2.634 2.634 0 0 0 .991 0a1.964 1.964 0 0 1-.748.242a2.189 2.189 0 0 1-.85-.063a5.72 5.72 0 0 1-.951-.541a.782.782 0 0 0 .216.442a2.849 2.849 0 0 0 .639.334a9.6 9.6 0 0 1-.963-.116a2.274 2.274 0 0 1-.555-.189a3.8 3.8 0 0 1-.449-.309a1.3 1.3 0 0 0 .215.411a1.95 1.95 0 0 0 .481.233a2.1 2.1 0 0 1-.5-.011a1.409 1.409 0 0 1-.517-.245a3.708 3.708 0 0 1-.521-.464a2.146 2.146 0 0 1-.4-.538c-.058-.154.035-.262.052-.393a1.218 1.218 0 0 0-.319.209a.4.4 0 0 0-.118.371a2.45 2.45 0 0 0 .315.589c-.344-.281-.536-.39-.618-.729a1.142 1.142 0 0 1 .272-.846c.075-.119.187-.23.256-.345a4.636 4.636 0 0 1-.466-.456c-.133-.174-.189-.408-.325-.574a3.436 3.436 0 0 0-.478-.406a6.173 6.173 0 0 1 .42.9a.6.6 0 0 1-.139.5c-.083.126-.216.154-.342.231s-.324.016-.4.131a.393.393 0 0 0-.023.4l.3.466a1.418 1.418 0 0 1-.381-.328c-.085-.113-.214-.218-.232-.371a.541.541 0 0 1 .073-.423c.1-.136.371-.182.493-.287s.19-.173.183-.309s-.139-.233-.253-.318a8.319 8.319 0 0 1-1.088-.815a1.091 1.091 0 0 1-.28-.443a.461.461 0 0 1 .085-.368c.083-.151.367-.352.4-.515s-.109-.2-.238-.257s-.375.029-.5-.071s.035-.311-.1-.427s-.445-.051-.6-.176a.84.84 0 0 1-.281-.46a.968.968 0 0 1-.024-.509c.037-.131.149-.153.217-.221s.127-.124.036-.226s-.386.006-.556-.124s-.066-.44-.186-.571s-.336-.08-.449-.122s-.158.106-.228-.127s-.072-.929-.165-1.189s-.278-.017-.364-.276a7.171 7.171 0 0 1-.043-1.061l-.175-1.061a3.741 3.741 0 0 1-1.666.654a10.832 10.832 0 0 0 .338 4.321c.543 1.777 1.643 2.824 3.128 4.328a9.109 9.109 0 0 1-3.478-4.188a9.791 9.791 0 0 1-.414-4.277"/>`}})),Vm=n((e=>{e.__esModule=!0,e.default={width:32,height:32,body:`<path fill="none" stroke="#755838" d="M2.5 7.955h27v16.091h-27z"/><path fill="#755838" d="M5.909 20.636v-9.272h2.727l2.728 3.409l2.727-3.409h2.727v9.272h-2.727v-5.318l-2.727 3.409l-2.728-3.409v5.318H5.909zm17.046 0l-4.091-4.5h2.727v-4.772h2.727v4.772h2.727l-4.09 4.5z"/>`}})),Hm=n((e=>{e.__esModule=!0,e.default={width:32,height:32,body:`<path fill="#cb3837" d="M2 10.555h28v9.335H16v1.556H9.778v-1.557H2Zm1.556 7.779h3.111v-4.668h1.555v4.667h1.556v-6.222H3.556Zm7.778-6.223v7.779h3.111v-1.556h3.111v-6.223Zm3.111 1.556H16v3.112h-1.556Zm4.667-1.556v6.223h3.111v-4.668h1.556v4.667h1.556v-4.667h1.556v4.667h1.556v-6.222Z"/>`}})),Um=n((e=>{e.__esModule=!0,e.default={width:32,height:32,body:`<path fill="#909090" d="m24.1 2.072l5.564 5.8v22.056H8.879V30h20.856V7.945L24.1 2.072"/><path fill="#f4f4f4" d="M24.031 2H8.808v27.928h20.856V7.873L24.03 2"/><path fill="#7a7b7c" d="M8.655 3.5h-6.39v6.827h20.1V3.5H8.655"/><path fill="#dd2025" d="M22.472 10.211H2.395V3.379h20.077v6.832"/><path fill="#464648" d="M9.052 4.534H7.745v4.8h1.028V7.715L9 7.728a2.042 2.042 0 0 0 .647-.117a1.427 1.427 0 0 0 .493-.291a1.224 1.224 0 0 0 .335-.454a2.13 2.13 0 0 0 .105-.908a2.237 2.237 0 0 0-.114-.644a1.173 1.173 0 0 0-.687-.65a2.149 2.149 0 0 0-.409-.104a2.232 2.232 0 0 0-.319-.026m-.189 2.294h-.089v-1.48h.193a.57.57 0 0 1 .459.181a.92.92 0 0 1 .183.558c0 .246 0 .469-.222.626a.942.942 0 0 1-.524.114m3.671-2.306c-.111 0-.219.008-.295.011L12 4.538h-.78v4.8h.918a2.677 2.677 0 0 0 1.028-.175a1.71 1.71 0 0 0 .68-.491a1.939 1.939 0 0 0 .373-.749a3.728 3.728 0 0 0 .114-.949a4.416 4.416 0 0 0-.087-1.127a1.777 1.777 0 0 0-.4-.733a1.63 1.63 0 0 0-.535-.4a2.413 2.413 0 0 0-.549-.178a1.282 1.282 0 0 0-.228-.017m-.182 3.937h-.1V5.392h.013a1.062 1.062 0 0 1 .6.107a1.2 1.2 0 0 1 .324.4a1.3 1.3 0 0 1 .142.526c.009.22 0 .4 0 .549a2.926 2.926 0 0 1-.033.513a1.756 1.756 0 0 1-.169.5a1.13 1.13 0 0 1-.363.36a.673.673 0 0 1-.416.106m5.08-3.915H15v4.8h1.028V7.434h1.3v-.892h-1.3V5.43h1.4v-.892"/><path fill="#dd2025" d="M21.781 20.255s3.188-.578 3.188.511s-1.975.646-3.188-.511Zm-2.357.083a7.543 7.543 0 0 0-1.473.489l.4-.9c.4-.9.815-2.127.815-2.127a14.216 14.216 0 0 0 1.658 2.252a13.033 13.033 0 0 0-1.4.288Zm-1.262-6.5c0-.949.307-1.208.546-1.208s.508.115.517.939a10.787 10.787 0 0 1-.517 2.434a4.426 4.426 0 0 1-.547-2.162Zm-4.649 10.516c-.978-.585 2.051-2.386 2.6-2.444c-.003.001-1.576 3.056-2.6 2.444ZM25.9 20.895c-.01-.1-.1-1.207-2.07-1.16a14.228 14.228 0 0 0-2.453.173a12.542 12.542 0 0 1-2.012-2.655a11.76 11.76 0 0 0 .623-3.1c-.029-1.2-.316-1.888-1.236-1.878s-1.054.815-.933 2.013a9.309 9.309 0 0 0 .665 2.338s-.425 1.323-.987 2.639s-.946 2.006-.946 2.006a9.622 9.622 0 0 0-2.725 1.4c-.824.767-1.159 1.356-.725 1.945c.374.508 1.683.623 2.853-.91a22.549 22.549 0 0 0 1.7-2.492s1.784-.489 2.339-.623s1.226-.24 1.226-.24s1.629 1.639 3.2 1.581s1.495-.939 1.485-1.035"/><path fill="#909090" d="M23.954 2.077V7.95h5.633l-5.633-5.873Z"/><path fill="#f4f4f4" d="M24.031 2v5.873h5.633L24.031 2Z"/><path fill="#fff" d="M8.975 4.457H7.668v4.8H8.7V7.639l.228.013a2.042 2.042 0 0 0 .647-.117a1.428 1.428 0 0 0 .493-.291a1.224 1.224 0 0 0 .332-.454a2.13 2.13 0 0 0 .105-.908a2.237 2.237 0 0 0-.114-.644a1.173 1.173 0 0 0-.687-.65a2.149 2.149 0 0 0-.411-.105a2.232 2.232 0 0 0-.319-.026m-.189 2.294h-.089v-1.48h.194a.57.57 0 0 1 .459.181a.92.92 0 0 1 .183.558c0 .246 0 .469-.222.626a.942.942 0 0 1-.524.114m3.67-2.306c-.111 0-.219.008-.295.011l-.235.006h-.78v4.8h.918a2.677 2.677 0 0 0 1.028-.175a1.71 1.71 0 0 0 .68-.491a1.939 1.939 0 0 0 .373-.749a3.728 3.728 0 0 0 .114-.949a4.416 4.416 0 0 0-.087-1.127a1.777 1.777 0 0 0-.4-.733a1.63 1.63 0 0 0-.535-.4a2.413 2.413 0 0 0-.549-.178a1.282 1.282 0 0 0-.228-.017m-.182 3.937h-.1V5.315h.013a1.062 1.062 0 0 1 .6.107a1.2 1.2 0 0 1 .324.4a1.3 1.3 0 0 1 .142.526c.009.22 0 .4 0 .549a2.926 2.926 0 0 1-.033.513a1.756 1.756 0 0 1-.169.5a1.13 1.13 0 0 1-.363.36a.673.673 0 0 1-.416.106m5.077-3.915h-2.43v4.8h1.028V7.357h1.3v-.892h-1.3V5.353h1.4v-.892"/>`}})),Wm=n((e=>{e.__esModule=!0,e.default={width:32,height:32,body:`<defs><radialGradient id="vscodeIconsFileTypePhp0" cx="-16.114" cy="20.532" r="18.384" gradientTransform="translate(26.52 -9.307)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#fff"/><stop offset=".5" stop-color="#4c6b96"/><stop offset="1" stop-color="#231f20"/></radialGradient></defs><ellipse cx="16" cy="16" fill="url(#vscodeIconsFileTypePhp0)" rx="14" ry="7.365"/><ellipse cx="16" cy="16" fill="#6280b6" rx="13.453" ry="6.818"/><path fill="#fff" d="m18.725 18.2l.667-3.434a1.752 1.752 0 0 0-.372-1.719a2.929 2.929 0 0 0-2-.525h-1.153l.331-1.7a.219.219 0 0 0-.215-.26h-1.6a.219.219 0 0 0-.215.177l-.709 3.646a2.051 2.051 0 0 0-.477-1.054a2.783 2.783 0 0 0-2.2-.807H7.7a.219.219 0 0 0-.215.177l-1.434 7.38a.219.219 0 0 0 .215.26h1.603a.219.219 0 0 0 .215-.177l.347-1.785h1.2a5.167 5.167 0 0 0 1.568-.2a3.068 3.068 0 0 0 1.15-.689a3.538 3.538 0 0 0 .68-.844l-.287 1.475a.219.219 0 0 0 .215.26h1.6a.219.219 0 0 0 .215-.177l.787-4.051h1.094c.466 0 .6.093.64.133s.1.165.025.569l-.635 3.265a.219.219 0 0 0 .215.26h1.62a.219.219 0 0 0 .207-.18Zm-7.395-2.834a1.749 1.749 0 0 1-.561 1.092a2.171 2.171 0 0 1-1.315.321h-.712l.515-2.651h.921c.677 0 .949.145 1.059.266a1.181 1.181 0 0 1 .093.972Zm14.216-2.034a2.783 2.783 0 0 0-2.2-.807h-3.091a.219.219 0 0 0-.215.177l-1.434 7.38a.219.219 0 0 0 .215.26h1.608a.219.219 0 0 0 .215-.177l.347-1.785h1.2a5.167 5.167 0 0 0 1.568-.2a3.068 3.068 0 0 0 1.15-.689a3.425 3.425 0 0 0 1.076-1.927a2.512 2.512 0 0 0-.439-2.232Zm-1.667 2.034a1.749 1.749 0 0 1-.561 1.092a2.171 2.171 0 0 1-1.318.32h-.71l.515-2.651h.921c.677 0 .949.145 1.059.266a1.181 1.181 0 0 1 .094.973Z"/><path fill="#000004" d="M10.178 13.908a1.645 1.645 0 0 1 1.221.338a1.34 1.34 0 0 1 .145 1.161a1.945 1.945 0 0 1-.642 1.223a2.361 2.361 0 0 1-1.448.37h-.978l.6-3.089Zm-3.917 6.216h1.608l.381-1.962h1.377a4.931 4.931 0 0 0 1.5-.191a2.84 2.84 0 0 0 1.07-.642a3.207 3.207 0 0 0 1.01-1.808a2.3 2.3 0 0 0-.385-2.044a2.568 2.568 0 0 0-2.035-.732H7.7Zm8.126-9.342h1.6l-.387 1.962h1.421a2.767 2.767 0 0 1 1.85.468a1.548 1.548 0 0 1 .305 1.516l-.667 3.434H16.89l.635-3.265a.886.886 0 0 0-.08-.76a1.121 1.121 0 0 0-.8-.2H15.37l-.822 4.228h-1.6Zm8.34 3.126a1.645 1.645 0 0 1 1.221.338a1.34 1.34 0 0 1 .145 1.161a1.945 1.945 0 0 1-.642 1.223A2.361 2.361 0 0 1 22 17h-.978l.6-3.089Zm-3.917 6.216h1.608l.381-1.962h1.377a4.931 4.931 0 0 0 1.5-.191a2.84 2.84 0 0 0 1.07-.642a3.207 3.207 0 0 0 1.01-1.808a2.3 2.3 0 0 0-.385-2.044a2.568 2.568 0 0 0-2.035-.732h-3.092Z"/>`}})),Gm=n((e=>{e.__esModule=!0,e.default={width:32,height:32,body:`<path fill="#f9ad00" d="M30 10.75h-8.749V2H30Zm-9.626 0h-8.75V2h8.75Zm-9.625 0H2V2h8.749ZM30 20.375h-8.749v-8.75H30Z"/><path fill="#fff" d="M20.374 20.375h-8.75v-8.75h8.75Zm0 9.625h-8.75v-8.75h8.75ZM30 30h-8.749v-8.75H30Zm-19.251 0H2v-8.75h8.749Z"/>`}})),Km=n((e=>{e.__esModule=!0,e.default={width:32,height:32,body:`<defs><linearGradient id="vscodeIconsFileTypePowerpoint0" x1="4.494" x2="13.832" y1="-1748.086" y2="-1731.914" gradientTransform="translate(0 1756)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#ca4c28"/><stop offset=".5" stop-color="#c5401e"/><stop offset="1" stop-color="#b62f14"/></linearGradient></defs><path fill="#ed6c47" d="M18.93 17.3L16.977 3h-.146A12.9 12.9 0 0 0 3.953 15.854V16Z"/><path fill="#ff8f6b" d="M17.123 3h-.146v13l6.511 2.6L30 16v-.146A12.9 12.9 0 0 0 17.123 3Z"/><path fill="#d35230" d="M30 16v.143A12.905 12.905 0 0 1 17.12 29h-.287a12.907 12.907 0 0 1-12.88-12.857V16Z"/><path d="M17.628 9.389V23.26a1.2 1.2 0 0 1-.742 1.1a1.16 1.16 0 0 1-.45.091H7.027a10.08 10.08 0 0 1-.521-.65a12.735 12.735 0 0 1-2.553-7.657v-.286A12.705 12.705 0 0 1 6.05 8.85a8.82 8.82 0 0 1 .456-.65h9.93a1.2 1.2 0 0 1 1.192 1.189Z" opacity=".1"/><path d="M16.977 10.04v13.871a1.15 1.15 0 0 1-.091.448a1.2 1.2 0 0 1-1.1.741H7.62q-.309-.314-.593-.65a10.08 10.08 0 0 1-.521-.65a12.735 12.735 0 0 1-2.553-7.657v-.286A12.705 12.705 0 0 1 6.05 8.85h9.735a1.2 1.2 0 0 1 1.192 1.19Z" opacity=".2"/><path d="M16.977 10.04v12.571a1.2 1.2 0 0 1-1.192 1.189H6.506a12.735 12.735 0 0 1-2.553-7.657v-.286A12.705 12.705 0 0 1 6.05 8.85h9.735a1.2 1.2 0 0 1 1.192 1.19Z" opacity=".2"/><path d="M16.326 10.04v12.571a1.2 1.2 0 0 1-1.192 1.189H6.506a12.735 12.735 0 0 1-2.553-7.657v-.286A12.705 12.705 0 0 1 6.05 8.85h9.084a1.2 1.2 0 0 1 1.192 1.19Z" opacity=".2"/><path fill="url(#vscodeIconsFileTypePowerpoint0)" d="M3.194 8.85h11.938a1.193 1.193 0 0 1 1.194 1.191v11.918a1.193 1.193 0 0 1-1.194 1.191H3.194A1.192 1.192 0 0 1 2 21.959V10.041A1.192 1.192 0 0 1 3.194 8.85Z"/><path fill="#fff" d="M9.293 12.028a3.287 3.287 0 0 1 2.174.636a2.27 2.27 0 0 1 .756 1.841a2.555 2.555 0 0 1-.373 1.376a2.49 2.49 0 0 1-1.059.935a3.607 3.607 0 0 1-1.591.334H7.687v2.8H6.141v-7.922ZM7.686 15.94h1.331a1.735 1.735 0 0 0 1.177-.351a1.3 1.3 0 0 0 .4-1.025q0-1.309-1.525-1.31H7.686v2.686Z"/>`}})),qm=n((e=>{e.__esModule=!0,e.default={width:32,height:32,body:`<path fill="#56b3b4" d="M21.714 8.571h1.143a.571.571 0 0 1 .571.571a.571.571 0 0 1-.571.571h-1.143a.571.571 0 0 1-.571-.571a.571.571 0 0 1 .571-.571Z"/><path fill="#ea5e5e" d="M4.571 26.857h5.714a.571.571 0 0 1 .571.571a.571.571 0 0 1-.571.571H4.571a.571.571 0 0 1-.571-.57a.571.571 0 0 1 .571-.572Z"/><path fill="#bf85bf" d="M18.286 17.714h3.429a.571.571 0 0 1 .571.571a.571.571 0 0 1-.571.571h-3.429a.571.571 0 0 1-.571-.571a.571.571 0 0 1 .571-.571Z"/><path fill="#ea5e5e" d="M11.429 17.714H16a.571.571 0 0 1 .571.571a.571.571 0 0 1-.571.571h-4.571a.571.571 0 0 1-.571-.571a.571.571 0 0 1 .571-.571Z"/><path fill="#56b3b4" d="M4.571 17.714h4.572a.571.571 0 0 1 .571.571a.571.571 0 0 1-.571.571H4.571a.571.571 0 0 1-.571-.57a.571.571 0 0 1 .571-.572Z"/><path fill="#bf85bf" d="M4.571 22.286h5.714a.571.571 0 0 1 .571.571a.571.571 0 0 1-.571.571H4.571A.571.571 0 0 1 4 22.857a.571.571 0 0 1 .571-.571Zm0-9.143h5.714a.571.571 0 0 1 .571.571a.571.571 0 0 1-.571.571H4.571A.571.571 0 0 1 4 13.714a.571.571 0 0 1 .571-.571Z"/><path fill="#f7ba3e" d="M10.286 6.286h11.428a.571.571 0 0 1 .571.571a.571.571 0 0 1-.571.571H10.286a.571.571 0 0 1-.571-.571a.571.571 0 0 1 .571-.571Z"/><path fill="#ea5e5e" d="M4.571 6.286H8a.571.571 0 0 1 .571.571a.571.571 0 0 1-.571.572H4.571A.571.571 0 0 1 4 6.857a.571.571 0 0 1 .571-.571Z"/><path fill="#f7ba3e" d="M9.143 24.571h1.143a.571.571 0 0 1 .571.571a.571.571 0 0 1-.571.571H9.143a.571.571 0 0 1-.571-.571a.571.571 0 0 1 .571-.571Z"/><path fill="#56b3b4" d="M9.143 10.857h1.143a.571.571 0 0 1 .571.571a.571.571 0 0 1-.571.571H9.143a.571.571 0 0 1-.571-.571a.571.571 0 0 1 .571-.571ZM4.571 24.571h2.286a.571.571 0 0 1 .571.571a.571.571 0 0 1-.571.571H4.571a.571.571 0 0 1-.571-.57a.571.571 0 0 1 .571-.572Z"/><path fill="#f7ba3e" d="M4.571 10.857h2.286a.571.571 0 0 1 .571.571a.571.571 0 0 1-.571.572H4.571A.571.571 0 0 1 4 11.429a.571.571 0 0 1 .571-.572Z"/><path fill="#4d616e" d="M19.429 24.571h1.143a.571.571 0 0 1 .571.571a.571.571 0 0 1-.571.571h-1.143a.571.571 0 0 1-.571-.571a.571.571 0 0 1 .571-.571Zm-6.858 0h4.571a.571.571 0 0 1 .571.571a.571.571 0 0 1-.571.571h-4.571a.571.571 0 0 1-.571-.57a.571.571 0 0 1 .571-.572Zm10.286 0h4.571a.571.571 0 0 1 .571.571a.571.571 0 0 1-.571.571h-4.571a.571.571 0 0 1-.571-.571a.571.571 0 0 1 .571-.571Z" opacity=".5"/><path fill="#56b3b4" d="M13.714 15.429h9.143a.571.571 0 0 1 .571.571a.571.571 0 0 1-.571.571h-9.143a.571.571 0 0 1-.571-.571a.571.571 0 0 1 .571-.571Z"/><path fill="#f7ba3e" d="M8 15.429h3.429A.571.571 0 0 1 12 16a.571.571 0 0 1-.571.571H8A.571.571 0 0 1 7.429 16A.571.571 0 0 1 8 15.429Z"/><path fill="#ea5e5e" d="M4.571 15.429h1.143a.571.571 0 0 1 .572.571a.571.571 0 0 1-.571.571H4.571A.571.571 0 0 1 4 16a.571.571 0 0 1 .571-.571Z"/><path fill="#bf85bf" d="M14.857 8.571h4.571a.571.571 0 0 1 .572.572a.571.571 0 0 1-.571.571h-4.572a.571.571 0 0 1-.571-.571a.571.571 0 0 1 .571-.572Z"/><path fill="#56b3b4" d="M4.571 8.571h8a.571.571 0 0 1 .571.571a.571.571 0 0 1-.571.571h-8A.571.571 0 0 1 4 9.143a.571.571 0 0 1 .571-.572Z"/><path fill="#f7ba3e" d="M8 20h10.286a.571.571 0 0 1 .571.571a.571.571 0 0 1-.571.571H8a.571.571 0 0 1-.571-.571A.571.571 0 0 1 8 20Z"/><path fill="#bf85bf" d="M4.571 20h1.143a.571.571 0 0 1 .571.571a.571.571 0 0 1-.571.571H4.571A.571.571 0 0 1 4 20.571A.571.571 0 0 1 4.571 20Z"/><path fill="#ea5e5e" d="M18.286 10.857H24a.571.571 0 0 1 .571.571A.571.571 0 0 1 24 12h-5.714a.571.571 0 0 1-.571-.571a.571.571 0 0 1 .571-.572Z"/><path fill="#f7ba3e" d="M18.286 13.143H24a.571.571 0 0 1 .571.571a.571.571 0 0 1-.571.571h-5.714a.571.571 0 0 1-.571-.571a.571.571 0 0 1 .571-.571Z"/><path fill="#56b3b4" d="M4.571 4h13.715a.571.571 0 0 1 .571.571a.571.571 0 0 1-.571.571H4.571A.571.571 0 0 1 4 4.571A.571.571 0 0 1 4.571 4Z"/><path fill="#4d616e" d="M20.571 4h6.857a.571.571 0 0 1 .572.571a.571.571 0 0 1-.571.571h-6.858A.571.571 0 0 1 20 4.571A.571.571 0 0 1 20.571 4Zm0 16h2.286a.571.571 0 0 1 .571.571a.571.571 0 0 1-.571.571h-2.286a.571.571 0 0 1-.571-.571a.571.571 0 0 1 .571-.571Zm4.572 0h2.286a.571.571 0 0 1 .571.571a.571.571 0 0 1-.571.571h-2.286a.571.571 0 0 1-.571-.571a.571.571 0 0 1 .571-.571ZM24 17.714h3.429a.571.571 0 0 1 .571.571a.571.571 0 0 1-.571.571H24a.571.571 0 0 1-.571-.571a.571.571 0 0 1 .571-.571Zm0-11.428h3.429a.571.571 0 0 1 .571.571a.571.571 0 0 1-.571.571H24a.571.571 0 0 1-.571-.571a.571.571 0 0 1 .571-.571Zm1.143 9.143h2.286A.571.571 0 0 1 28 16a.571.571 0 0 1-.571.571h-2.286a.571.571 0 0 1-.572-.571a.571.571 0 0 1 .572-.571Zm0-6.858h2.286a.571.571 0 0 1 .571.572a.571.571 0 0 1-.571.571h-2.286a.571.571 0 0 1-.571-.571a.571.571 0 0 1 .571-.572Zm1.143 2.286h1.143a.571.571 0 0 1 .571.571a.571.571 0 0 1-.571.571h-1.143a.571.571 0 0 1-.571-.571a.571.571 0 0 1 .571-.571Zm0 2.286h1.143a.571.571 0 0 1 .571.571a.571.571 0 0 1-.571.571h-1.143a.571.571 0 0 1-.571-.571a.571.571 0 0 1 .571-.571Zm-9.143 9.143h10.286a.571.571 0 0 1 .571.571a.571.571 0 0 1-.571.571H17.143a.571.571 0 0 1-.571-.571a.571.571 0 0 1 .571-.571Zm-4.572 0h2.286a.571.571 0 0 1 .571.571a.571.571 0 0 1-.571.571h-2.286a.571.571 0 0 1-.571-.571a.571.571 0 0 1 .571-.571Zm9.143 4.571h5.714a.571.571 0 0 1 .571.571a.571.571 0 0 1-.571.571h-5.714a.571.571 0 0 1-.571-.571a.571.571 0 0 1 .571-.571Zm-9.143 0h6.857a.571.571 0 0 1 .571.571a.571.571 0 0 1-.571.571h-6.857a.571.571 0 0 1-.571-.57a.571.571 0 0 1 .571-.572Zm0-16H16a.571.571 0 0 1 .571.571A.571.571 0 0 1 16 12h-3.429a.571.571 0 0 1-.571-.571a.571.571 0 0 1 .571-.572Zm0 2.286H16a.571.571 0 0 1 .571.571a.571.571 0 0 1-.571.571h-3.429a.571.571 0 0 1-.571-.571a.571.571 0 0 1 .571-.571Z" opacity=".5"/>`}})),Jm=n((e=>{e.__esModule=!0,e.default={width:32,height:32,body:`<defs><linearGradient id="vscodeIconsFileTypePython0" x1="-133.268" x2="-133.198" y1="-202.91" y2="-202.84" gradientTransform="matrix(189.38 0 0 189.81 25243.061 38519.17)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#387eb8"/><stop offset="1" stop-color="#366994"/></linearGradient><linearGradient id="vscodeIconsFileTypePython1" x1="-133.575" x2="-133.495" y1="-203.203" y2="-203.133" gradientTransform="matrix(189.38 0 0 189.81 25309.061 38583.42)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#ffe052"/><stop offset="1" stop-color="#ffc331"/></linearGradient></defs><path fill="url(#vscodeIconsFileTypePython0)" d="M15.885 2.1c-7.1 0-6.651 3.07-6.651 3.07v3.19h6.752v1H6.545S2 8.8 2 16.005s4.013 6.912 4.013 6.912H8.33v-3.361s-.13-4.013 3.9-4.013h6.762s3.772.06 3.772-3.652V5.8s.572-3.712-6.842-3.712Zm-3.732 2.137a1.214 1.214 0 1 1-1.183 1.244v-.02a1.214 1.214 0 0 1 1.214-1.214Z"/><path fill="url(#vscodeIconsFileTypePython1)" d="M16.085 29.91c7.1 0 6.651-3.08 6.651-3.08v-3.18h-6.751v-1h9.47S30 23.158 30 15.995s-4.013-6.912-4.013-6.912H23.64V12.4s.13 4.013-3.9 4.013h-6.765S9.2 16.356 9.2 20.068V26.2s-.572 3.712 6.842 3.712h.04Zm3.732-2.147A1.214 1.214 0 1 1 21 26.519v.03a1.214 1.214 0 0 1-1.214 1.214h.03Z"/>`}})),Ym=n((e=>{e.__esModule=!0,e.default={width:32,height:32,body:`<circle cx="16" cy="15.974" r="2.5" fill="#00d8ff"/><path fill="#00d8ff" d="M16 21.706a28.385 28.385 0 0 1-8.88-1.2a11.3 11.3 0 0 1-3.657-1.958A3.543 3.543 0 0 1 2 15.974c0-1.653 1.816-3.273 4.858-4.333A28.755 28.755 0 0 1 16 10.293a28.674 28.674 0 0 1 9.022 1.324a11.376 11.376 0 0 1 3.538 1.866A3.391 3.391 0 0 1 30 15.974c0 1.718-2.03 3.459-5.3 4.541a28.8 28.8 0 0 1-8.7 1.191Zm0-10.217a27.948 27.948 0 0 0-8.749 1.282c-2.8.977-4.055 2.313-4.055 3.2c0 .928 1.349 2.387 4.311 3.4A27.21 27.21 0 0 0 16 20.51a27.6 27.6 0 0 0 8.325-1.13C27.4 18.361 28.8 16.9 28.8 15.974a2.327 2.327 0 0 0-1.01-1.573a10.194 10.194 0 0 0-3.161-1.654A27.462 27.462 0 0 0 16 11.489Z"/><path fill="#00d8ff" d="M10.32 28.443a2.639 2.639 0 0 1-1.336-.328c-1.432-.826-1.928-3.208-1.327-6.373a28.755 28.755 0 0 1 3.4-8.593a28.676 28.676 0 0 1 5.653-7.154a11.376 11.376 0 0 1 3.384-2.133a3.391 3.391 0 0 1 2.878 0c1.489.858 1.982 3.486 1.287 6.859a28.806 28.806 0 0 1-3.316 8.133a28.385 28.385 0 0 1-5.476 7.093a11.3 11.3 0 0 1-3.523 2.189a4.926 4.926 0 0 1-1.624.307Zm1.773-14.7a27.948 27.948 0 0 0-3.26 8.219c-.553 2.915-.022 4.668.75 5.114c.8.463 2.742.024 5.1-2.036a27.209 27.209 0 0 0 5.227-6.79a27.6 27.6 0 0 0 3.181-7.776c.654-3.175.089-5.119-.713-5.581a2.327 2.327 0 0 0-1.868.089A10.194 10.194 0 0 0 17.5 6.9a27.464 27.464 0 0 0-5.4 6.849Z"/><path fill="#00d8ff" d="M21.677 28.456c-1.355 0-3.076-.82-4.868-2.361a28.756 28.756 0 0 1-5.747-7.237a28.676 28.676 0 0 1-3.374-8.471a11.376 11.376 0 0 1-.158-4A3.391 3.391 0 0 1 8.964 3.9c1.487-.861 4.01.024 6.585 2.31a28.8 28.8 0 0 1 5.39 6.934a28.384 28.384 0 0 1 3.41 8.287a11.3 11.3 0 0 1 .137 4.146a3.543 3.543 0 0 1-1.494 2.555a2.59 2.59 0 0 1-1.315.324Zm-9.58-10.2a27.949 27.949 0 0 0 5.492 6.929c2.249 1.935 4.033 2.351 4.8 1.9c.8-.465 1.39-2.363.782-5.434A27.212 27.212 0 0 0 19.9 13.74a27.6 27.6 0 0 0-5.145-6.64c-2.424-2.152-4.39-2.633-5.191-2.169a2.327 2.327 0 0 0-.855 1.662a10.194 10.194 0 0 0 .153 3.565a27.465 27.465 0 0 0 3.236 8.1Z"/>`}})),Xm=n((e=>{e.__esModule=!0,e.default={width:32,height:32,body:`<circle cx="16" cy="15.974" r="2.5" fill="#007acc"/><path fill="#007acc" d="M16 21.706a28.385 28.385 0 0 1-8.88-1.2a11.3 11.3 0 0 1-3.657-1.958A3.543 3.543 0 0 1 2 15.974c0-1.653 1.816-3.273 4.858-4.333A28.755 28.755 0 0 1 16 10.293a28.674 28.674 0 0 1 9.022 1.324a11.376 11.376 0 0 1 3.538 1.866A3.391 3.391 0 0 1 30 15.974c0 1.718-2.03 3.459-5.3 4.541a28.8 28.8 0 0 1-8.7 1.191Zm0-10.217a27.948 27.948 0 0 0-8.749 1.282c-2.8.977-4.055 2.313-4.055 3.2c0 .928 1.349 2.387 4.311 3.4A27.21 27.21 0 0 0 16 20.51a27.6 27.6 0 0 0 8.325-1.13C27.4 18.361 28.8 16.9 28.8 15.974a2.327 2.327 0 0 0-1.01-1.573a10.194 10.194 0 0 0-3.161-1.654A27.462 27.462 0 0 0 16 11.489Z"/><path fill="#007acc" d="M10.32 28.443a2.639 2.639 0 0 1-1.336-.328c-1.432-.826-1.928-3.208-1.327-6.373a28.755 28.755 0 0 1 3.4-8.593a28.676 28.676 0 0 1 5.653-7.154a11.376 11.376 0 0 1 3.384-2.133a3.391 3.391 0 0 1 2.878 0c1.489.858 1.982 3.486 1.287 6.859a28.806 28.806 0 0 1-3.316 8.133a28.385 28.385 0 0 1-5.476 7.093a11.3 11.3 0 0 1-3.523 2.189a4.926 4.926 0 0 1-1.624.307Zm1.773-14.7a27.948 27.948 0 0 0-3.26 8.219c-.553 2.915-.022 4.668.75 5.114c.8.463 2.742.024 5.1-2.036a27.209 27.209 0 0 0 5.227-6.79a27.6 27.6 0 0 0 3.181-7.776c.654-3.175.089-5.119-.713-5.581a2.327 2.327 0 0 0-1.868.089A10.194 10.194 0 0 0 17.5 6.9a27.464 27.464 0 0 0-5.4 6.849Z"/><path fill="#007acc" d="M21.677 28.456c-1.355 0-3.076-.82-4.868-2.361a28.756 28.756 0 0 1-5.747-7.237a28.676 28.676 0 0 1-3.374-8.471a11.376 11.376 0 0 1-.158-4A3.391 3.391 0 0 1 8.964 3.9c1.487-.861 4.01.024 6.585 2.31a28.8 28.8 0 0 1 5.39 6.934a28.384 28.384 0 0 1 3.41 8.287a11.3 11.3 0 0 1 .137 4.146a3.543 3.543 0 0 1-1.494 2.555a2.59 2.59 0 0 1-1.315.324Zm-9.58-10.2a27.949 27.949 0 0 0 5.492 6.929c2.249 1.935 4.033 2.351 4.8 1.9c.8-.465 1.39-2.363.782-5.434A27.212 27.212 0 0 0 19.9 13.74a27.6 27.6 0 0 0-5.145-6.64c-2.424-2.152-4.39-2.633-5.191-2.169a2.327 2.327 0 0 0-.855 1.662a10.194 10.194 0 0 0 .153 3.565a27.465 27.465 0 0 0 3.236 8.1Z"/>`}})),Zm=n((e=>{e.__esModule=!0,e.default={width:32,height:32,body:`<defs><linearGradient id="vscodeIconsFileTypeRuby0" x1="-235.957" x2="-235.986" y1="-308.579" y2="-308.527" gradientTransform="matrix(202.935 0 0 -202.78 47910.461 -62541.16)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#fb7655"/><stop offset=".41" stop-color="#e42b1e"/><stop offset=".99" stop-color="#900"/><stop offset="1" stop-color="#900"/></linearGradient><linearGradient id="vscodeIconsFileTypeRuby1" x1="-235.571" x2="-235.697" y1="-309.087" y2="-309.041" gradientTransform="matrix(60.308 0 0 -111.778 14236.351 -34525.395)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#871101"/><stop offset=".99" stop-color="#911209"/><stop offset="1" stop-color="#911209"/></linearGradient><linearGradient id="vscodeIconsFileTypeRuby2" x1="-235.896" x2="-235.937" y1="-313.362" y2="-313.129" gradientTransform="matrix(188.32 0 0 -21.986 44447.302 -6856.882)" href="#vscodeIconsFileTypeRuby1"/><linearGradient id="vscodeIconsFileTypeRuby3" x1="-233.515" x2="-233.497" y1="-309.082" y2="-309.161" gradientTransform="matrix(65.222 0 0 -97.1 15237.802 -29991.814)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#fff"/><stop offset=".23" stop-color="#e57252"/><stop offset=".46" stop-color="#de3b20"/><stop offset=".99" stop-color="#a60003"/><stop offset="1" stop-color="#a60003"/></linearGradient><linearGradient id="vscodeIconsFileTypeRuby4" x1="-235.314" x2="-235.31" y1="-309.534" y2="-309.607" gradientTransform="matrix(105.32 0 0 -106.825 24798.925 -33053.152)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#fff"/><stop offset=".23" stop-color="#e4714e"/><stop offset=".56" stop-color="#be1a0d"/><stop offset=".99" stop-color="#a80d00"/><stop offset="1" stop-color="#a80d00"/></linearGradient><linearGradient id="vscodeIconsFileTypeRuby5" x1="-235.882" x2="-235.869" y1="-311.851" y2="-311.935" gradientTransform="matrix(94.321 0 0 -66.418 22271.499 -20707.004)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#fff"/><stop offset=".18" stop-color="#e46342"/><stop offset=".4" stop-color="#c82410"/><stop offset=".99" stop-color="#a80d00"/><stop offset="1" stop-color="#a80d00"/></linearGradient><linearGradient id="vscodeIconsFileTypeRuby6" x1="-235.412" x2="-235.333" y1="-321.074" y2="-320.958" gradientTransform="matrix(70.767 0 0 -24.301 16678.116 -7798.647)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#fff"/><stop offset=".54" stop-color="#c81f11"/><stop offset=".99" stop-color="#bf0905"/><stop offset="1" stop-color="#bf0905"/></linearGradient><linearGradient id="vscodeIconsFileTypeRuby7" x1="-223.821" x2="-223.796" y1="-310.116" y2="-310.18" gradientTransform="matrix(18.177 0 0 -72.645 4071.017 -22510.233)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#fff"/><stop offset=".31" stop-color="#de4024"/><stop offset=".99" stop-color="#bf190b"/><stop offset="1" stop-color="#bf190b"/></linearGradient><linearGradient id="vscodeIconsFileTypeRuby8" x1="-235.561" x2="-235.424" y1="-309.258" y2="-309.116" gradientTransform="matrix(158.162 0 0 -157.937 37256.313 -48819.382)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#bd0012"/><stop offset=".07" stop-color="#fff"/><stop offset=".17" stop-color="#fff"/><stop offset=".27" stop-color="#c82f1c"/><stop offset=".33" stop-color="#820c01"/><stop offset=".46" stop-color="#a31601"/><stop offset=".72" stop-color="#b31301"/><stop offset=".99" stop-color="#e82609"/><stop offset="1" stop-color="#e82609"/></linearGradient><linearGradient id="vscodeIconsFileTypeRuby9" x1="-235.424" x2="-235.476" y1="-309.143" y2="-309.126" gradientTransform="matrix(127.074 0 0 -97.409 29932.229 -30086.947)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#8c0c01"/><stop offset=".54" stop-color="#990c00"/><stop offset=".99" stop-color="#a80d0e"/><stop offset="1" stop-color="#a80d0e"/></linearGradient><linearGradient id="vscodeIconsFileTypeRubya" x1="-235.839" x2="-235.901" y1="-309.604" y2="-309.555" gradientTransform="matrix(94.011 0 0 -105.603 22198.743 -32676.856)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#7e110b"/><stop offset=".99" stop-color="#9e0c00"/><stop offset="1" stop-color="#9e0c00"/></linearGradient><linearGradient id="vscodeIconsFileTypeRubyb" x1="-235.854" x2="-235.891" y1="-311.24" y2="-311.202" gradientTransform="matrix(79.702 0 0 -81.791 18827.397 -25447.905)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#79130d"/><stop offset=".99" stop-color="#9e120b"/><stop offset="1" stop-color="#9e120b"/></linearGradient><linearGradient id="vscodeIconsFileTypeRubyc" x1="-231.241" x2="-231.299" y1="-309.435" y2="-309.337" gradientTransform="matrix(40.137 0 0 -81.143 9286.998 -25078.589)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#8b2114"/><stop offset=".43" stop-color="#9e100a"/><stop offset=".99" stop-color="#b3100c"/><stop offset="1" stop-color="#b3100c"/></linearGradient><linearGradient id="vscodeIconsFileTypeRubyd" x1="-235.898" x2="-235.831" y1="-317.466" y2="-317.537" gradientTransform="matrix(78.099 0 0 -32.624 18447.361 -10353.553)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#b31000"/><stop offset=".44" stop-color="#910f08"/><stop offset=".99" stop-color="#791c12"/><stop offset="1" stop-color="#791c12"/></linearGradient><radialGradient id="vscodeIconsFileTypeRubye" cx="-235.882" cy="-312.543" r=".076" gradientTransform="matrix(93.113 0 0 -48.655 21986.073 -15193.61)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#a80d00"/><stop offset=".99" stop-color="#7e0e08"/><stop offset="1" stop-color="#7e0e08"/></radialGradient><radialGradient id="vscodeIconsFileTypeRubyf" cx="-235.282" cy="-309.704" r=".097" gradientTransform="matrix(97.434 0 0 -75.848 22937.057 -23467.84)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#a30c00"/><stop offset=".99" stop-color="#800e08"/><stop offset="1" stop-color="#800e08"/></radialGradient></defs><path fill="url(#vscodeIconsFileTypeRuby0)" d="M23.693 20.469L7.707 29.961l20.7-1.4L30 7.685Z"/><path fill="url(#vscodeIconsFileTypeRuby1)" d="m28.44 28.542l-1.779-12.279l-4.846 6.4Z"/><path fill="url(#vscodeIconsFileTypeRuby2)" d="M28.464 28.542L15.43 27.519l-7.654 2.415Z"/><path fill="url(#vscodeIconsFileTypeRuby3)" d="M7.794 29.937L11.05 19.27L3.885 20.8Z"/><path fill="url(#vscodeIconsFileTypeRuby4)" d="m21.813 22.7l-3-11.735L10.243 19Z"/><path fill="url(#vscodeIconsFileTypeRuby5)" d="m29.32 11.127l-8.1-6.619l-2.257 7.3Z"/><path fill="url(#vscodeIconsFileTypeRuby6)" d="m25.53 2.148l-4.767 2.634l-3.007-2.67Z"/><path fill="url(#vscodeIconsFileTypeRuby7)" d="m2 24.38l2-3.642L2.382 16.4Z"/><path fill="#fff" d="m2.274 16.263l1.626 4.61l7.062-1.584l8.062-7.489L21.3 4.569l-3.583-2.53l-6.091 2.28C9.706 6.1 5.982 9.635 5.848 9.7s-2.459 4.464-3.574 6.562Z"/><path fill="url(#vscodeIconsFileTypeRuby8)" d="M7.981 7.981C12.14 3.858 17.5 1.421 19.559 3.5s-.124 7.121-4.283 11.244s-9.455 6.69-11.511 4.614s.057-7.258 4.216-11.377Z"/><path fill="url(#vscodeIconsFileTypeRuby9)" d="m7.794 29.933l3.231-10.7l10.729 3.447c-3.879 3.638-8.194 6.713-13.96 7.254Z"/><path fill="url(#vscodeIconsFileTypeRubya)" d="m19.038 11.774l2.754 10.91c3.24-3.407 6.149-7.07 7.573-11.6l-10.328.691Z"/><path fill="url(#vscodeIconsFileTypeRubyb)" d="M29.337 11.139c1.1-3.327 1.357-8.1-3.841-8.985l-4.265 2.355l8.106 6.629Z"/><path fill="#9e1209" d="M2 24.332c.153 5.49 4.114 5.572 5.8 5.62l-3.9-9.1l-1.9 3.48Z"/><path fill="url(#vscodeIconsFileTypeRubye)" d="M19.053 11.791c2.49 1.531 7.509 4.6 7.61 4.661a17.552 17.552 0 0 0 2.619-5.343l-10.229.683Z"/><path fill="url(#vscodeIconsFileTypeRubyf)" d="m11.021 19.232l4.319 8.332a27.924 27.924 0 0 0 6.385-4.88l-10.7-3.452Z"/><path fill="url(#vscodeIconsFileTypeRubyc)" d="m3.887 20.861l-.612 7.287c1.155 1.577 2.743 1.714 4.409 1.591c-1.205-3-3.614-9-3.8-8.878Z"/><path fill="url(#vscodeIconsFileTypeRubyd)" d="m21.206 4.528l8.58 1.2c-.458-1.94-1.864-3.192-4.261-3.584l-4.319 2.38Z"/>`}})),Qm=n((e=>{e.__esModule=!0,e.default={width:32,height:32,body:`<defs><radialGradient id="vscodeIconsFileTypeRust0" cx="-492.035" cy="-883.37" r="13.998" gradientTransform="matrix(.866 -.5 -.3 -.52 177.106 -689.033)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#7d7d7d"/><stop offset=".267" stop-color="#7e7c7a"/><stop offset=".45" stop-color="#817871"/><stop offset=".608" stop-color="#867162"/><stop offset=".753" stop-color="#8d684c"/><stop offset=".886" stop-color="#965c30"/><stop offset="1" stop-color="#a04f12"/></radialGradient></defs><path fill="url(#vscodeIconsFileTypeRust0)" d="M15.124 5.3a.832.832 0 1 1 .832.832a.831.831 0 0 1-.832-.832M5.2 12.834a.832.832 0 1 1 .832.832a.832.832 0 0 1-.832-.832m19.856.039a.832.832 0 1 1 .832.832a.831.831 0 0 1-.832-.832m-17.451 1.14a.76.76 0 0 0 .386-1l-.369-.835h1.452v6.545h-2.93a10.247 10.247 0 0 1-.332-3.911Zm6.074.161v-1.929h3.458c.179 0 1.261.206 1.261 1.016c0 .672-.83.913-1.513.913ZM8.958 24.561a.832.832 0 1 1 .832.832a.831.831 0 0 1-.832-.832m12.331.039a.832.832 0 1 1 .832.832a.832.832 0 0 1-.832-.832m.257-1.887a.758.758 0 0 0-.9.584l-.418 1.949a10.249 10.249 0 0 1-8.545-.041l-.417-1.949a.759.759 0 0 0-.9-.583l-1.721.37a10.233 10.233 0 0 1-.89-1.049h8.374c.095 0 .158-.017.158-.1v-2.966c0-.086-.063-.1-.158-.1h-2.45v-1.881h2.649a1.665 1.665 0 0 1 1.629 1.412c.105.413.336 1.757.494 2.187c.157.483.8 1.447 1.482 1.447h4.323a10.243 10.243 0 0 1-.949 1.1Zm4.65-7.821a10.261 10.261 0 0 1 .022 1.779h-1.051c-.105 0-.148.069-.148.172v.483c0 1.136-.641 1.384-1.2 1.447c-.535.06-1.128-.224-1.2-.551a3.616 3.616 0 0 0-1.671-2.808c1.03-.654 2.1-1.619 2.1-2.911A3.292 3.292 0 0 0 21.44 9.8a4.559 4.559 0 0 0-2.2-.724H8.367A10.246 10.246 0 0 1 14.1 5.84l1.282 1.344a.758.758 0 0 0 1.072.026l1.434-1.372a10.248 10.248 0 0 1 7.015 5l-.982 2.217a.761.761 0 0 0 .386 1Zm2.448.036l-.033-.343l1.011-.943a.42.42 0 0 0-.013-.595a.428.428 0 0 0-.121-.081l-1.288-.483l-.1-.334l.806-1.12a.422.422 0 0 0-.13-.581a.43.43 0 0 0-.133-.055l-1.363-.222l-.164-.306l.573-1.257a.419.419 0 0 0-.236-.544a.426.426 0 0 0-.146-.029l-1.383.048l-.224-.264l.318-1.347a.421.421 0 0 0-.343-.487a.435.435 0 0 0-.144 0l-1.348.315l-.266-.219l.049-1.381a.421.421 0 0 0-.431-.411a.426.426 0 0 0-.141.028l-1.257.573l-.306-.164l-.222-1.363a.421.421 0 0 0-.5-.318a.43.43 0 0 0-.133.055l-1.121.806l-.333-.1l-.483-1.293a.421.421 0 0 0-.555-.215a.442.442 0 0 0-.12.08l-.946 1.012l-.343-.033l-.728-1.177a.421.421 0 0 0-.688 0l-.728 1.177l-.343.033l-.943-1.012a.421.421 0 0 0-.595.015a.442.442 0 0 0-.08.12L12.483 3.8l-.333.1l-1.12-.8a.422.422 0 0 0-.581.13a.43.43 0 0 0-.055.133l-.222 1.363l-.306.164l-1.258-.573a.421.421 0 0 0-.544.239a.444.444 0 0 0-.028.144l.048 1.383l-.266.217l-1.347-.316a.421.421 0 0 0-.487.343a.435.435 0 0 0 0 .144L6.3 7.819l-.218.265L4.7 8.036a.422.422 0 0 0-.383.573l.573 1.257l-.164.306l-1.363.222a.42.42 0 0 0-.318.5a.43.43 0 0 0 .055.133l.806 1.12l-.1.334l-1.293.483a.421.421 0 0 0-.215.555a.414.414 0 0 0 .081.121l1.011.943l-.033.343l-1.177.728a.421.421 0 0 0 0 .688l1.177.728l.033.343l-1.011.943a.421.421 0 0 0 .015.595a.436.436 0 0 0 .119.08l1.293.483l.1.334l-.806 1.124a.421.421 0 0 0 .131.581a.43.43 0 0 0 .133.055l1.363.222l.164.307l-.573 1.257a.422.422 0 0 0 .24.545a.438.438 0 0 0 .143.028l1.383-.048l.219.266l-.317 1.348a.42.42 0 0 0 .341.486a.4.4 0 0 0 .146 0l1.345-.319l.266.218l-.049 1.382a.419.419 0 0 0 .429.41a.413.413 0 0 0 .143-.028l1.257-.573l.306.164l.222 1.362a.421.421 0 0 0 .5.319a.407.407 0 0 0 .133-.055l1.12-.807l.334.1l.483 1.292a.422.422 0 0 0 .556.214a.436.436 0 0 0 .119-.08l.943-1.011l.343.034l.728 1.177a.422.422 0 0 0 .588.1a.413.413 0 0 0 .1-.1l.728-1.177l.343-.034l.943 1.011a.421.421 0 0 0 .595-.015a.436.436 0 0 0 .08-.119l.483-1.292l.334-.1l1.12.807a.421.421 0 0 0 .581-.131a.43.43 0 0 0 .055-.133l.222-1.362l.306-.164l1.257.573a.421.421 0 0 0 .544-.239a.438.438 0 0 0 .028-.143l-.048-1.384l.265-.218l1.347.317a.421.421 0 0 0 .487-.34a.447.447 0 0 0 0-.146l-.309-1.346l.218-.266l1.383.048a.421.421 0 0 0 .41-.431a.4.4 0 0 0-.028-.142l-.573-1.257l.164-.307l1.363-.222a.421.421 0 0 0 .319-.5a.434.434 0 0 0-.056-.135l-.806-1.12l.1-.334l1.293-.483a.42.42 0 0 0 .215-.554a.414.414 0 0 0-.081-.121l-1.011-.943l.033-.343l1.177-.728a.421.421 0 0 0 0-.688Z"/>`}})),$m=n((e=>{e.__esModule=!0,e.default={width:32,height:32,body:`<path fill="#cd6799" d="M26.11 17.572a5.8 5.8 0 0 0-2.537.588a5.345 5.345 0 0 1-.568-1.314a3.53 3.53 0 0 1-.051-1.1a9.811 9.811 0 0 1 .332-1.192c-.005-.051-.061-.292-.624-.3s-1.048.107-1.1.256a6.171 6.171 0 0 0-.235.834a19.686 19.686 0 0 1-1.713 3.294a3.186 3.186 0 0 1-.44-2.066a9.811 9.811 0 0 1 .332-1.192c-.005-.051-.061-.292-.624-.3s-1.048.107-1.1.256s-.118.5-.235.834s-1.483 3.386-1.841 4.173c-.184.4-.343.726-.455.946a.233.233 0 0 1-.02.041l-.153.292v.005c-.077.138-.159.266-.2.266a1.711 1.711 0 0 1 .01-.869c.2-1.059.69-2.705.685-2.762c0-.031.092-.317-.317-.465a.508.508 0 0 0-.578.1c-.036 0-.061.087-.061.087s.445-1.851-.849-1.851a3.855 3.855 0 0 0-2.475 1.683c-.348.189-1.089.593-1.882 1.028c-.3.169-.614.338-.905.5c-.02-.02-.041-.046-.061-.066C6.87 17.6 3.975 16.416 4.1 14.171c.046-.818.327-2.966 5.559-5.575c4.306-2.122 7.733-1.534 8.326-.23c.849 1.862-1.836 5.319-6.285 5.82a3.351 3.351 0 0 1-2.813-.711c-.235-.256-.271-.271-.358-.22c-.143.077-.051.307 0 .44a2.626 2.626 0 0 0 1.606 1.263a8.55 8.55 0 0 0 5.217-.517c2.7-1.043 4.8-3.943 4.184-6.372c-.619-2.465-4.71-3.278-8.582-1.9a19.5 19.5 0 0 0-6.595 3.783c-2.133 1.995-2.47 3.728-2.332 4.455c.5 2.578 4.051 4.255 5.472 5.5a8.554 8.554 0 0 1-.194.107c-.711.353-3.421 1.77-4.1 3.268c-.767 1.7.123 2.915.711 3.079a4.374 4.374 0 0 0 4.71-1.908a4.725 4.725 0 0 0 .423-4.353a.107.107 0 0 0-.02-.031l.557-.327a27.2 27.2 0 0 1 1.028-.578a6.74 6.74 0 0 0-.363 1.862a3.886 3.886 0 0 0 .834 2.7a.921.921 0 0 0 .675.22c.6 0 .875-.5 1.176-1.094c.368-.726.7-1.57.7-1.57s-.414 2.281.711 2.281c.409 0 .823-.532 1.008-.8v.005l.031-.051l.066-.107v-.01c.164-.286.532-.936 1.079-2.015c.706-1.391 1.386-3.13 1.386-3.13a8.888 8.888 0 0 0 .271 1.13a10.643 10.643 0 0 0 .583 1.309c-.164.23-.266.358-.266.358l.005.005c-.133.174-.276.363-.435.547a16.3 16.3 0 0 0-1.314 1.647a.447.447 0 0 0 .123.6a1.116 1.116 0 0 0 .685.113a3.147 3.147 0 0 0 1.028-.235a3.45 3.45 0 0 0 .885-.465a1.98 1.98 0 0 0 .849-1.744a3.521 3.521 0 0 0-.322-1.233c.051-.072.1-.143.148-.215a23.428 23.428 0 0 0 1.534-2.649a8.888 8.888 0 0 0 .271 1.13a7.57 7.57 0 0 0 .5 1.125a4.861 4.861 0 0 0-1.497 1.922c-.322.931-.072 1.35.4 1.447a1.425 1.425 0 0 0 .747-.153a3.4 3.4 0 0 0 .946-.486a2.126 2.126 0 0 0 1.043-1.729a3.268 3.268 0 0 0-.235-1.023a5.356 5.356 0 0 1 2.716-.312c2.434.286 2.915 1.805 2.823 2.445a1.618 1.618 0 0 1-.772 1.094c-.169.107-.225.143-.21.22c.02.113.1.107.245.087A1.9 1.9 0 0 0 30 20.7c.077-1.5-1.355-3.145-3.887-3.13ZM7.33 23.9c-.808.88-1.933 1.212-2.419.931c-.522-.3-.317-1.6.675-2.532a12.884 12.884 0 0 1 1.9-1.417c.118-.072.292-.174.5-.3l.056-.031l.123-.077A3.493 3.493 0 0 1 7.33 23.9Zm5.881-4c-.281.685-.869 2.44-1.227 2.342c-.307-.082-.5-1.412-.061-2.726a6.193 6.193 0 0 1 .956-1.754c.44-.491.926-.655 1.043-.455a9.062 9.062 0 0 1-.711 2.593Zm4.853 2.322c-.118.061-.23.1-.281.072c-.036-.02.051-.1.051-.1s.609-.655.849-.951c.138-.174.3-.378.476-.609v.066c0 .782-.757 1.309-1.094 1.524Zm3.744-.854c-.087-.061-.072-.266.22-.905a3.408 3.408 0 0 1 .834-1.074a1.448 1.448 0 0 1 .082.471a1.547 1.547 0 0 1-1.135 1.509Z"/>`}})),eh=n((e=>{e.__esModule=!0,e.default={width:32,height:32,body:`<path fill="#d9b400" d="M29.4 27.6H2.5V4.5h26.9Zm-25.9-1h24.9V5.5H3.5Z"/><path fill="#d9b400" d="m6.077 19.316l-.555-.832l4.844-3.229l-4.887-4.071l.641-.768l5.915 4.928l-5.958 3.972zM12.7 18.2h7.8v1h-7.8zM2.5 5.5h26.9v1.9H2.5z"/>`}})),th=n((e=>{e.__esModule=!0,e.default={width:32,height:32,body:`<path fill="#ffda44" d="M8.562 15.256A21.159 21.159 0 0 0 16 16.449a21.159 21.159 0 0 0 7.438-1.194c1.864-.727 2.525-1.535 2.525-2V9.7a10.357 10.357 0 0 1-2.084 1.076A22.293 22.293 0 0 1 16 12.078a22.36 22.36 0 0 1-7.879-1.3A10.28 10.28 0 0 1 6.037 9.7v3.55c0 .474.663 1.278 2.525 2.006Zm0 6.705a15.611 15.611 0 0 0 2.6.741a24.9 24.9 0 0 0 4.838.453a24.9 24.9 0 0 0 4.838-.452a15.614 15.614 0 0 0 2.6-.741c1.864-.727 2.525-1.535 2.525-2v-3.39a10.706 10.706 0 0 1-1.692.825A23.49 23.49 0 0 1 16 18.74a23.49 23.49 0 0 1-8.271-1.348a10.829 10.829 0 0 1-1.692-.825v3.393c0 .466.663 1.271 2.525 2.001ZM16 30c5.5 0 9.963-1.744 9.963-3.894v-2.837a10.5 10.5 0 0 1-1.535.762l-.157.063A23.487 23.487 0 0 1 16 25.445a23.422 23.422 0 0 1-8.271-1.351c-.054-.02-.106-.043-.157-.063a10.5 10.5 0 0 1-1.535-.762v2.837C6.037 28.256 10.5 30 16 30Z"/><ellipse cx="16" cy="5.894" fill="#ffda44" rx="9.963" ry="3.894"/>`}})),nh=n((e=>{e.__esModule=!0,e.default={width:32,height:32,body:`<path fill="#ff3e00" d="M26.47 5.7a8.973 8.973 0 0 0-11.793-2.454L7.96 7.4a7.461 7.461 0 0 0-3.481 5.009a7.686 7.686 0 0 0 .8 5.058a7.358 7.358 0 0 0-1.151 2.8a7.789 7.789 0 0 0 1.4 6.028a8.977 8.977 0 0 0 11.794 2.458L24.04 24.6a7.468 7.468 0 0 0 3.481-5.009a7.673 7.673 0 0 0-.8-5.062a7.348 7.348 0 0 0 1.152-2.8A7.785 7.785 0 0 0 26.47 5.7"/><path fill="#fff" d="M14.022 26.64A5.413 5.413 0 0 1 8.3 24.581a4.678 4.678 0 0 1-.848-3.625a4.307 4.307 0 0 1 .159-.61l.127-.375l.344.238a8.76 8.76 0 0 0 2.628 1.274l.245.073l-.025.237a1.441 1.441 0 0 0 .271.968a1.63 1.63 0 0 0 1.743.636a1.512 1.512 0 0 0 .411-.175l6.7-4.154a1.366 1.366 0 0 0 .633-.909a1.407 1.407 0 0 0-.244-1.091a1.634 1.634 0 0 0-1.726-.622a1.509 1.509 0 0 0-.413.176l-2.572 1.584a4.934 4.934 0 0 1-1.364.582a5.415 5.415 0 0 1-5.727-2.06a4.678 4.678 0 0 1-.831-3.628A4.507 4.507 0 0 1 9.9 10.09l6.708-4.154a4.932 4.932 0 0 1 1.364-.581A5.413 5.413 0 0 1 23.7 7.414a4.679 4.679 0 0 1 .848 3.625a4.272 4.272 0 0 1-.159.61l-.127.375l-.344-.237a8.713 8.713 0 0 0-2.628-1.274l-.245-.074l.025-.237a1.438 1.438 0 0 0-.272-.968a1.629 1.629 0 0 0-1.725-.622a1.484 1.484 0 0 0-.411.176l-6.722 4.14a1.353 1.353 0 0 0-.631.908a1.394 1.394 0 0 0 .244 1.092a1.634 1.634 0 0 0 1.726.621a1.538 1.538 0 0 0 .413-.175l2.562-1.585a4.9 4.9 0 0 1 1.364-.581a5.417 5.417 0 0 1 5.728 2.059a4.681 4.681 0 0 1 .843 3.625a4.5 4.5 0 0 1-2.089 3.013l-6.707 4.154a4.9 4.9 0 0 1-1.364.581"/>`}})),rh=n((e=>{e.__esModule=!0,e.default={width:32,height:32,body:`<path fill="#ffb13b" stroke="#000" stroke-width="3.73" d="M7.674 14.488a2.218 2.218 0 1 0 0 3.137h16.652a2.218 2.218 0 1 0 0-3.137Z"/><path fill="#ffb13b" stroke="#000" stroke-width="3.73" d="M11.222 9.06A2.218 2.218 0 1 0 9 11.278l11.778 11.774A2.218 2.218 0 1 0 23 20.834Z"/><path fill="#ffb13b" stroke="#000" stroke-width="3.73" d="M17.568 7.73a2.218 2.218 0 1 0-3.137 0v16.652a2.218 2.218 0 1 0 3.137 0Z"/><path fill="#ffb13b" stroke="#000" stroke-width="3.73" d="M23 11.278a2.218 2.218 0 1 0-2.222-2.218L9 20.834a2.218 2.218 0 1 0 2.218 2.218Z"/><path fill="#ffb13b" d="M7.674 14.488a2.218 2.218 0 1 0 0 3.137h16.652a2.218 2.218 0 1 0 0-3.137Z"/><path fill="#ffb13b" d="M11.222 9.06A2.218 2.218 0 1 0 9 11.278l11.778 11.774A2.218 2.218 0 1 0 23 20.834Z"/><path fill="#ffb13b" d="M17.568 7.73a2.218 2.218 0 1 0-3.137 0v16.652a2.218 2.218 0 1 0 3.137 0Z"/><path fill="#ffb13b" d="M23 11.278a2.218 2.218 0 1 0-2.222-2.218L9 20.834a2.218 2.218 0 1 0 2.218 2.218Z"/><path d="M2 16.056h28v9.894a4.035 4.035 0 0 1-4.106 4.106H6.106A4.035 4.035 0 0 1 2 25.95Z"/><path fill="#fff" d="M6.2 23.045a3.628 3.628 0 1 1 6.2-2.565h-2.13a1.5 1.5 0 1 0-2.57 1.061a1.6 1.6 0 0 0 1.062.441a4.118 4.118 0 0 1 2.566 1.063a3.628 3.628 0 1 1-6.194 2.565h2.13a1.5 1.5 0 1 0 2.566-1.06a1.948 1.948 0 0 0-1.063-.44A4.465 4.465 0 0 1 6.2 23.045Zm13.451-6.193L17.085 29.24H14.96L12.4 16.852h2.12l1.5 7.255l1.5-7.255Zm3.629 5.131h3.628v3.628a3.628 3.628 0 1 1-7.257 0V20.48a3.628 3.628 0 0 1 7.257 0h-2.125a1.5 1.5 0 1 0-3.005 0v5.13a1.5 1.5 0 0 0 3.005 0v-1.5h-1.5v-2.127Z"/>`}})),ih=n((e=>{e.__esModule=!0,e.default={width:32,height:32,body:`<defs><linearGradient id="vscodeIconsFileTypeSwift0" x1="-134.494" x2="-134.497" y1="-171.82" y2="-171.89" gradientTransform="matrix(240 0 0 -205.6 32295 -35312.585)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#f88535"/><stop offset="1" stop-color="#fd2221"/></linearGradient></defs><path fill="url(#vscodeIconsFileTypeSwift0)" d="M19.422 4.007s6.217 3.554 7.844 9.2c1.466 5.1.292 7.534.292 7.534a8.915 8.915 0 0 1 1.742 2.8a4.825 4.825 0 0 1 .29 4.453s-.1-2.08-3.2-2.511c-2.841-.4-3.874 2.366-9.3 2.232A18.435 18.435 0 0 1 2 19.354C4.651 20.8 8.124 23.045 12.449 22.7s5.228-1.674 5.228-1.674A66.9 66.9 0 0 1 4.891 7.643c3.4 2.845 11.822 8.507 11.626 8.363A75.826 75.826 0 0 1 8.092 6.24s12.636 10.389 13.653 10.323c.418-.861 2.579-5.318-2.324-12.557Z"/>`}})),ah=n((e=>{e.__esModule=!0,e.default={width:32,height:32,body:`<path fill="#44a8b3" d="M9 13.7q1.4-5.6 7-5.6c5.6 0 6.3 4.2 9.1 4.9q2.8.7 4.9-2.1q-1.4 5.6-7 5.6c-5.6 0-6.3-4.2-9.1-4.9q-2.8-.7-4.9 2.1Zm-7 8.4q1.4-5.6 7-5.6c5.6 0 6.3 4.2 9.1 4.9q2.8.7 4.9-2.1q-1.4 5.6-7 5.6c-5.6 0-6.3-4.2-9.1-4.9q-2.8-.7-4.9 2.1Z"/>`}})),oh=n((e=>{e.__esModule=!0,e.default={width:32,height:32,body:`<path fill="#c2c2c2" d="M22.038 2H6.375a1.755 1.755 0 0 0-1.75 1.75v24.5A1.755 1.755 0 0 0 6.375 30h19.25a1.755 1.755 0 0 0 1.75-1.75V6.856Zm.525 2.844l1.663 1.531h-1.663ZM6.375 28.25V3.75h14.438v4.375h4.813V28.25Z"/><path fill="#829ec2" d="M8.125 15.097h13.076v1.75H8.125zm0 9.342h9.762v1.75H8.125zm0-4.676h15.75v1.75H8.125zm0-9.533h15.75v1.75H8.125z"/>`}})),sh=n((e=>{e.__esModule=!0,e.default={width:32,height:32,body:`<path fill="#7f7f7f" d="M22.76 6.83v3.25h-5v15.09h-3.5V10.08h-5V6.83Z"/><path fill="#bfbfbf" d="M2 2h6.2v3.09H5.34v21.8H8.2V30H2Zm28 28h-6.2v-3.09h2.86V5.11H23.8V2H30Z"/>`}})),ch=n((e=>{e.__esModule=!0,e.default={width:32,height:32,body:`<path fill="#007acc" d="M23.827 8.243a4.424 4.424 0 0 1 2.223 1.281a5.853 5.853 0 0 1 .852 1.143c.011.045-1.534 1.083-2.471 1.662c-.034.023-.169-.124-.322-.35a2.014 2.014 0 0 0-1.67-1c-1.077-.074-1.771.49-1.766 1.433a1.3 1.3 0 0 0 .153.666c.237.49.677.784 2.059 1.383c2.544 1.1 3.636 1.817 4.31 2.843a5.158 5.158 0 0 1 .416 4.333a4.764 4.764 0 0 1-3.932 2.815a10.9 10.9 0 0 1-2.708-.028a6.531 6.531 0 0 1-3.616-1.884a6.278 6.278 0 0 1-.926-1.371a2.655 2.655 0 0 1 .327-.208c.158-.09.756-.434 1.32-.761l1.024-.6l.214.312a4.771 4.771 0 0 0 1.35 1.292a3.3 3.3 0 0 0 3.458-.175a1.545 1.545 0 0 0 .2-1.974c-.276-.4-.84-.727-2.443-1.422a8.8 8.8 0 0 1-3.349-2.055a4.687 4.687 0 0 1-.976-1.777a7.116 7.116 0 0 1-.062-2.268a4.332 4.332 0 0 1 3.644-3.374a9 9 0 0 1 2.691.084Zm-8.343 1.483l.011 1.454h-4.63v13.148H7.6V11.183H2.97V9.755a13.986 13.986 0 0 1 .04-1.466c.017-.023 2.832-.034 6.245-.028l6.211.017Z"/><path fill="#99b8c4" d="m27.075 25.107l.363-.361c1.68.055 1.706 0 1.78-.177l.462-1.124l.034-.107l-.038-.093c-.02-.049-.081-.2-1.13-1.2v-.526c1.211-1.166 1.185-1.226 1.116-1.4l-.46-1.136c-.069-.17-.1-.237-1.763-.191l-.364-.367a8.138 8.138 0 0 0-.057-1.657l-.047-.106l-1.2-.525c-.177-.081-.239-.11-1.372 1.124l-.509-.008c-1.167-1.245-1.222-1.223-1.4-1.152l-1.115.452c-.175.071-.236.1-.169 1.79l-.36.359c-1.68-.055-1.7 0-1.778.177L18.606 20l-.036.108l.038.094c.02.048.078.194 1.13 1.2v.525c-1.211 1.166-1.184 1.226-1.115 1.4l.459 1.137c.07.174.1.236 1.763.192l.363.377a8.169 8.169 0 0 0 .055 1.654l.047.107l1.208.528c.176.073.236.1 1.366-1.13l.509.006c1.168 1.247 1.228 1.223 1.4 1.154l1.113-.45c.176-.075.237-.102.169-1.795Zm-4.788-2.632a2 2 0 1 1 2.618 1.14a2.023 2.023 0 0 1-2.618-1.14Z"/>`}})),lh=n((e=>{e.__esModule=!0,e.default={width:32,height:32,body:`<path fill="#007acc" d="M23.827 8.243a4.424 4.424 0 0 1 2.223 1.281a5.853 5.853 0 0 1 .852 1.143c.011.045-1.534 1.083-2.471 1.662c-.034.023-.169-.124-.322-.35a2.014 2.014 0 0 0-1.67-1c-1.077-.074-1.771.49-1.766 1.433a1.3 1.3 0 0 0 .153.666c.237.49.677.784 2.059 1.383c2.544 1.095 3.636 1.817 4.31 2.843a5.158 5.158 0 0 1 .416 4.333a4.764 4.764 0 0 1-3.932 2.815a10.9 10.9 0 0 1-2.708-.028a6.531 6.531 0 0 1-3.616-1.884a6.278 6.278 0 0 1-.926-1.371a2.655 2.655 0 0 1 .327-.208c.158-.09.756-.434 1.32-.761l1.024-.6l.214.312a4.771 4.771 0 0 0 1.35 1.292a3.3 3.3 0 0 0 3.458-.175a1.545 1.545 0 0 0 .2-1.974c-.276-.395-.84-.727-2.443-1.422a8.8 8.8 0 0 1-3.349-2.055a4.687 4.687 0 0 1-.976-1.777a7.116 7.116 0 0 1-.062-2.268a4.332 4.332 0 0 1 3.644-3.374a9 9 0 0 1 2.691.084Zm-8.343 1.483l.011 1.454h-4.63v13.148H7.6V11.183H2.97V9.755a13.986 13.986 0 0 1 .04-1.466c.017-.023 2.832-.034 6.245-.028l6.211.017Z"/>`}})),uh=n((e=>{e.__esModule=!0,e.default={width:32,height:32,body:`<path fill="#e75749" d="M4.5 2.375A2.562 2.562 0 0 1 5.861 2h20.366a2.545 2.545 0 0 1 2.423 1.951a3.37 3.37 0 0 1 .072.862v11.176h-1.573a1.814 1.814 0 0 0-.22.022a5.236 5.236 0 0 0-.581-.011c-.3.007-.61-.014-.914.014a2.275 2.275 0 0 0-.4-.02h-4.739c-.2 0-.392.008-.587-.01l.1-.065l-6.353-3.813v3.889c-2.213-.005-4.427 0-6.64 0a2.274 2.274 0 0 0-.251.021c-.212-.032-.427-.016-.642-.016c-.284.006-.57-.015-.853.015a2.052 2.052 0 0 0-.253-.022H3.275c.006-3.635 0-7.27 0-10.9a4.786 4.786 0 0 1 .071-1.131A2.541 2.541 0 0 1 4.5 2.375Zm.54 2.188a.639.639 0 0 0-.489.606v1.316a.639.639 0 0 0 .627.6h1.309a.638.638 0 0 0 .6-.608c.005-.426 0-.853 0-1.279a.644.644 0 0 0-.329-.575a.708.708 0 0 0-.358-.078H5.264a1.081 1.081 0 0 0-.224.018Zm20.341 0a.639.639 0 0 0-.474.607v1.306a.638.638 0 0 0 .6.608c.436.005.872 0 1.308 0a.639.639 0 0 0 .627-.606c.006-.438 0-.876 0-1.314a.638.638 0 0 0-.594-.621c-.348-.009-.7 0-1.045 0a1.98 1.98 0 0 0-.422.024ZM5.042 8.38a.637.637 0 0 0-.452.4a1.078 1.078 0 0 0-.041.386v1.135a.637.637 0 0 0 .6.6c.4.008.795 0 1.192 0a.826.826 0 0 0 .395-.065a.641.641 0 0 0 .36-.574V8.983a.638.638 0 0 0-.6-.624c-.338-.008-.677 0-1.016 0a2.385 2.385 0 0 0-.438.021Zm20.338 0a.637.637 0 0 0-.433.4a1.072 1.072 0 0 0-.041.387v1.131a.638.638 0 0 0 .608.607c.406.006.812 0 1.218 0a.739.739 0 0 0 .38-.078a.64.64 0 0 0 .335-.558V8.985a.637.637 0 0 0-.593-.622c-.349-.009-.7 0-1.047 0a1.928 1.928 0 0 0-.428.022ZM5.041 12.2a.639.639 0 0 0-.491.608c0 .438-.005.877 0 1.315a.638.638 0 0 0 .627.6h1.3a.638.638 0 0 0 .608-.607v-1.307a.638.638 0 0 0-.605-.626c-.348-.007-.7 0-1.045 0a2.12 2.12 0 0 0-.394.017Zm20.335.006a.635.635 0 0 0-.43.394a1.06 1.06 0 0 0-.041.386v1.131a.638.638 0 0 0 .607.608c.435.005.87 0 1.306 0a.639.639 0 0 0 .628-.605c.006-.438 0-.876 0-1.313a.637.637 0 0 0-.592-.622c-.349-.01-.7 0-1.046 0a1.908 1.908 0 0 0-.431.015Z"/><path fill="#fff" d="M13.458 12.1q3.176 1.908 6.353 3.813l-.1.065q-3.127 1.872-6.251 3.748V15.99c-.001-1.295-.004-2.59-.002-3.89Z"/><path fill="#c0392b" d="M3.275 15.988h1.541a2.052 2.052 0 0 1 .253.022a.645.645 0 0 0-.409.273a.883.883 0 0 0-.111.518v1.045a.686.686 0 0 0 .685.689h1.192a.68.68 0 0 0 .657-.569c.008-.447 0-.9 0-1.343a.632.632 0 0 0-.521-.613a2.274 2.274 0 0 1 .251-.021h6.64v3.736q3.127-1.871 6.251-3.748c.2.018.391.007.587.01h4.741a2.275 2.275 0 0 1 .4.02a.637.637 0 0 0-.475.385a.983.983 0 0 0-.045.407v1.014a.677.677 0 0 0 .691.719h1.16a.684.684 0 0 0 .686-.658v-.984a1.074 1.074 0 0 0-.1-.589a.642.642 0 0 0-.42-.292a1.814 1.814 0 0 1 .22-.022h1.573c.011 1.721 0 3.443 0 5.165v6.293a2.567 2.567 0 0 1-.612 1.651a2.539 2.539 0 0 1-1.563.868a7.534 7.534 0 0 1-.981.033H6.724a9.27 9.27 0 0 1-1.368-.048a2.557 2.557 0 0 1-2-1.846a2.825 2.825 0 0 1-.09-.746V16.891c.007-.3-.002-.602.009-.903Zm1.795 3.843a.613.613 0 0 0-.386.234a.761.761 0 0 0-.134.464v1.162a.685.685 0 0 0 .686.658h1.283a.687.687 0 0 0 .568-.716v-1.191a.617.617 0 0 0-.2-.458a.712.712 0 0 0-.487-.17H5.264a1.039 1.039 0 0 0-.194.017Zm20.366 0a.62.62 0 0 0-.522.58v1.222a.676.676 0 0 0 .69.718c.428 0 .857.005 1.285 0a.7.7 0 0 0 .562-.684v-1.013a.9.9 0 0 0-.123-.568a.661.661 0 0 0-.532-.267h-.954a2.246 2.246 0 0 0-.406.011ZM5.071 23.648a.609.609 0 0 0-.4.249a.766.766 0 0 0-.124.448v1.132a.7.7 0 0 0 .6.688h1.376a.687.687 0 0 0 .567-.717v-1.189a.617.617 0 0 0-.2-.459a.71.71 0 0 0-.484-.17H5.265a1.028 1.028 0 0 0-.194.018Zm20.362 0a.616.616 0 0 0-.492.427a.99.99 0 0 0-.029.33V25.6a.681.681 0 0 0 .656.567h1.193a.689.689 0 0 0 .686-.719v-1.164a.657.657 0 0 0-.286-.545a1.461 1.461 0 0 0-.787-.11c-.312.01-.629-.02-.94.018Z"/>`}})),dh=n((e=>{e.__esModule=!0,e.default={width:32,height:32,body:`<g fill="none"><path fill="url(#vscodeIconsFileTypeVite0)" d="m29.884 6.146l-13.142 23.5a.714.714 0 0 1-1.244.005L2.096 6.148a.714.714 0 0 1 .746-1.057l13.156 2.352a.714.714 0 0 0 .253 0l12.881-2.348a.714.714 0 0 1 .752 1.05z"/><path fill="url(#vscodeIconsFileTypeVite1)" d="M22.264 2.007L12.54 3.912a.357.357 0 0 0-.288.33l-.598 10.104a.357.357 0 0 0 .437.369l2.707-.625a.357.357 0 0 1 .43.42l-.804 3.939a.357.357 0 0 0 .454.413l1.672-.508a.357.357 0 0 1 .454.414l-1.279 6.187c-.08.387.435.598.65.267l.143-.222l7.925-15.815a.357.357 0 0 0-.387-.51l-2.787.537a.357.357 0 0 1-.41-.45l1.818-6.306a.357.357 0 0 0-.412-.45z"/><defs><linearGradient id="vscodeIconsFileTypeVite0" x1="6" x2="235" y1="33" y2="344" gradientTransform="translate(1.34 1.894) scale(.07142)" gradientUnits="userSpaceOnUse"><stop stop-color="#41D1FF"/><stop offset="1" stop-color="#BD34FE"/></linearGradient><linearGradient id="vscodeIconsFileTypeVite1" x1="194.651" x2="236.076" y1="8.818" y2="292.989" gradientTransform="translate(1.34 1.894) scale(.07142)" gradientUnits="userSpaceOnUse"><stop stop-color="#FFEA83"/><stop offset=".083" stop-color="#FFDD35"/><stop offset="1" stop-color="#FFA800"/></linearGradient></defs></g>`}})),fh=n((e=>{e.__esModule=!0,e.default={width:32,height:32,body:`<path fill="#fcc72b" d="m22.86 11.09l-6.55 9.46a.58.58 0 0 1-.28.21a.55.55 0 0 1-.36 0a.56.56 0 0 1-.29-.21a.59.59 0 0 1-.09-.35l.26-5.2l-4.23-.9a.55.55 0 0 1-.24-.12a.5.5 0 0 1-.16-.22a.5.5 0 0 1 0-.27a.46.46 0 0 1 .1-.25l6.54-9.46a.58.58 0 0 1 .29-.22a.53.53 0 0 1 .35 0a.58.58 0 0 1 .29.22a.52.52 0 0 1 .09.34l-.26 5.22l4.23.9a.58.58 0 0 1 .25.12a.69.69 0 0 1 .16.22a.62.62 0 0 1-.06.53Z"/><path fill="#729b1b" d="M16 28.49a1.44 1.44 0 0 1-.5-.1a1.3 1.3 0 0 1-.43-.29l-6.19-6.19A1.28 1.28 0 0 1 8.5 21a1.3 1.3 0 0 1 1.32-1.32a1.32 1.32 0 0 1 .94.38L16 25.29l11.43-11.43a1.32 1.32 0 0 1 .94-.38a1.31 1.31 0 0 1 .93.39a1.29 1.29 0 0 1 .39.93a1.34 1.34 0 0 1-.38.93L16.94 28.1a1.42 1.42 0 0 1-.43.29a1.45 1.45 0 0 1-.51.1Z"/><path fill="#729b1b" fill-opacity=".5" d="M16 28.49a1.44 1.44 0 0 0 .5-.1a1.3 1.3 0 0 0 .43-.29l6.19-6.19a1.28 1.28 0 0 0 .38-.91a1.3 1.3 0 0 0-1.32-1.32a1.32 1.32 0 0 0-.94.38L16 25.29L4.57 13.86a1.32 1.32 0 0 0-.94-.38a1.31 1.31 0 0 0-.93.39a1.29 1.29 0 0 0-.39.93a1.34 1.34 0 0 0 .38.93L15.06 28.1a1.42 1.42 0 0 0 .43.29a1.45 1.45 0 0 0 .51.1Z"/>`}})),ph=n((e=>{e.__esModule=!0,e.default={width:32,height:32,body:`<path fill="#41b883" d="M24.4 3.925H30l-14 24.15L2 3.925h10.71l3.29 5.6l3.22-5.6Z"/><path fill="#41b883" d="m2 3.925l14 24.15l14-24.15h-5.6L16 18.415L7.53 3.925Z"/><path fill="#35495e" d="M7.53 3.925L16 18.485l8.4-14.56h-5.18L16 9.525l-3.29-5.6Z"/>`}})),mh=n((e=>{e.__esModule=!0,e.default={width:32,height:32,body:`<defs><linearGradient id="vscodeIconsFileTypeWord0" x1="4.494" x2="13.832" y1="-1712.086" y2="-1695.914" gradientTransform="translate(0 1720)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#2368c4"/><stop offset=".5" stop-color="#1a5dbe"/><stop offset="1" stop-color="#1146ac"/></linearGradient></defs><path fill="#41a5ee" d="M28.806 3H9.705a1.192 1.192 0 0 0-1.193 1.191V9.5l11.069 3.25L30 9.5V4.191A1.192 1.192 0 0 0 28.806 3Z"/><path fill="#2b7cd3" d="M30 9.5H8.512V16l11.069 1.95L30 16Z"/><path fill="#185abd" d="M8.512 16v6.5l10.418 1.3L30 22.5V16Z"/><path fill="#103f91" d="M9.705 29h19.1A1.192 1.192 0 0 0 30 27.809V22.5H8.512v5.309A1.192 1.192 0 0 0 9.705 29Z"/><path d="M16.434 8.2H8.512v16.25h7.922a1.2 1.2 0 0 0 1.194-1.191V9.391A1.2 1.2 0 0 0 16.434 8.2Z" opacity=".1"/><path d="M15.783 8.85H8.512V25.1h7.271a1.2 1.2 0 0 0 1.194-1.191V10.041a1.2 1.2 0 0 0-1.194-1.191Z" opacity=".2"/><path d="M15.783 8.85H8.512V23.8h7.271a1.2 1.2 0 0 0 1.194-1.191V10.041a1.2 1.2 0 0 0-1.194-1.191Z" opacity=".2"/><path d="M15.132 8.85h-6.62V23.8h6.62a1.2 1.2 0 0 0 1.194-1.191V10.041a1.2 1.2 0 0 0-1.194-1.191Z" opacity=".2"/><path fill="url(#vscodeIconsFileTypeWord0)" d="M3.194 8.85h11.938a1.193 1.193 0 0 1 1.194 1.191v11.918a1.193 1.193 0 0 1-1.194 1.191H3.194A1.192 1.192 0 0 1 2 21.959V10.041A1.192 1.192 0 0 1 3.194 8.85Z"/><path fill="#fff" d="M6.9 17.988c.023.184.039.344.046.481h.028c.01-.13.032-.287.065-.47s.062-.338.089-.465l1.255-5.407h1.624l1.3 5.326a7.761 7.761 0 0 1 .162 1h.022a7.6 7.6 0 0 1 .135-.975l1.039-5.358h1.477l-1.824 7.748h-1.727l-1.237-5.126q-.054-.222-.122-.578t-.084-.52h-.021q-.021.189-.084.561c-.042.249-.075.432-.1.552L7.78 19.871H6.024L4.19 12.127h1.5l1.131 5.418a4.469 4.469 0 0 1 .079.443Z"/>`}})),hh=n((e=>{e.__esModule=!0,e.default={width:32,height:32,body:`<path fill="#f1662a" d="m20.42 21.157l2.211 2.211L30 16l-7.369-7.369l-2.211 2.212L25.58 16Zm-8.84-10.314L9.369 8.631L2 16l7.369 7.369l2.211-2.211L6.42 16Zm5.831-3.166l1.6.437l-4.42 16.209l-1.6-.437l4.42-16.209Z"/>`}})),gh=n((e=>{e.__esModule=!0,e.default={width:32,height:32,body:`<path fill="#ffe885" d="M2 12.218c.755 0 1.51-.008 2.264 0l.053.038l2.761 2.758c.891-.906 1.8-1.794 2.7-2.7c.053-.052.11-.113.192-.1h1.823a1.4 1.4 0 0 1 .353.019c-.7.67-1.377 1.369-2.069 2.05L5.545 18.8c-.331.324-.648.663-.989.975c-.754.022-1.511.007-2.266.007c1.223-1.209 2.431-2.433 3.658-3.637c-1.321-1.304-2.63-2.62-3.948-3.927Zm10.7 0h1.839v7.566c-.611 0-1.222.012-1.832-.008v-4.994c-1.6 1.607-3.209 3.2-4.811 4.8c-.089.08-.166.217-.305.194c-.824-.006-1.649 0-2.474 0Q8.916 16 12.7 12.218Zm2.258.002c.47-.009.939 0 1.409 0c.836.853 1.69 1.689 2.536 2.532q1.268-1.267 2.539-2.532h1.4q-.008 3.784 0 7.567c-.471 0-.943.006-1.414 0q.008-2.387 0-4.773c-.844.843-1.676 1.7-2.526 2.536c-.856-.835-1.687-1.695-2.532-2.541c0 1.594-.006 3.188.006 4.781c-.472 0-.943.005-1.415 0q-.003-3.79-.003-7.57Zm8.301-.003c.472 0 .944-.007 1.416 0q-.007 3.083 0 6.166h3.782c.063.006.144-.012.191.045c.448.454.907.9 1.353 1.354q-3.371.007-6.741 0q.007-3.782-.001-7.565Z"/>`}})),_h=n((e=>{e.__esModule=!0,e.default={width:32,height:32,body:`<path fill="#2188b6" d="M28.208 24.409a10.493 10.493 0 0 0-3.959 1.822a23.743 23.743 0 0 1-5.835 2.642a1.632 1.632 0 0 1-.983.55a62.228 62.228 0 0 1-6.447.577c-1.163.009-1.876-.3-2.074-.776a1.573 1.573 0 0 1 .866-2.074a3.759 3.759 0 0 1-.514-.379c-.171-.171-.352-.514-.406-.388c-.225.55-.343 1.894-.947 2.5c-.83.839-2.4.559-3.328.072c-1.019-.541.072-1.813.072-1.813a.73.73 0 0 1-.992-.343a4.847 4.847 0 0 1-.667-2.949a5.374 5.374 0 0 1 1.749-2.895a9.334 9.334 0 0 1 .658-4.4a10.445 10.445 0 0 1 3.165-3.661S6.628 10.747 7.35 8.817c.469-1.262.658-1.253.812-1.308a3.633 3.633 0 0 0 1.452-.857a5.265 5.265 0 0 1 4.41-1.7S15.2 1.4 16.277 2.09a18.349 18.349 0 0 1 1.533 2.886s1.281-.748 1.425-.469a11.334 11.334 0 0 1 .523 6.132a14.01 14.01 0 0 1-2.6 5.411c-.135.225 1.551.938 2.615 3.887c.983 2.7.108 4.96.262 5.212c.027.045.036.063.036.063s1.127.09 3.391-1.308a8.5 8.5 0 0 1 4.277-1.604a1.081 1.081 0 0 1 .469 2.11Z"/>`}})),vh=n((e=>{e.__esModule=!0,e.default={width:32,height:32,body:`<defs><linearGradient id="vscodeIconsFileTypeZip0" x1="17.65" x2="21.099" y1="26.056" y2="26.056" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#4d4d4d"/><stop offset=".5" stop-color="#fff"/><stop offset="1" stop-color="#4d4d4d"/></linearGradient><linearGradient id="vscodeIconsFileTypeZip1" x1="17.65" x2="21.099" y1="23.756" y2="23.756" href="#vscodeIconsFileTypeZip0"/><linearGradient id="vscodeIconsFileTypeZip2" x1="17.65" x2="21.099" y1="21.456" y2="21.456" href="#vscodeIconsFileTypeZip0"/><linearGradient id="vscodeIconsFileTypeZip3" x1="17.65" x2="21.099" y1="19.156" y2="19.156" href="#vscodeIconsFileTypeZip0"/><linearGradient id="vscodeIconsFileTypeZip4" x1="17.65" x2="21.099" y1="16.857" y2="16.857" href="#vscodeIconsFileTypeZip0"/><linearGradient id="vscodeIconsFileTypeZip5" x1="17.65" x2="21.099" y1="14.557" y2="14.557" href="#vscodeIconsFileTypeZip0"/><linearGradient id="vscodeIconsFileTypeZip6" x1="17.65" x2="21.099" y1="12.257" y2="12.257" href="#vscodeIconsFileTypeZip0"/><linearGradient id="vscodeIconsFileTypeZip7" x1="17.65" x2="21.099" y1="9.957" y2="9.957" href="#vscodeIconsFileTypeZip0"/><linearGradient id="vscodeIconsFileTypeZip8" x1="17.65" x2="21.099" y1="7.657" y2="7.657" href="#vscodeIconsFileTypeZip0"/><linearGradient id="vscodeIconsFileTypeZip9" x1="16.237" x2="19.686" y1="27.217" y2="27.217" href="#vscodeIconsFileTypeZip0"/><linearGradient id="vscodeIconsFileTypeZipa" x1="16.237" x2="19.686" y1="24.918" y2="24.918" href="#vscodeIconsFileTypeZip0"/><linearGradient id="vscodeIconsFileTypeZipb" x1="16.237" x2="19.686" y1="22.618" y2="22.618" href="#vscodeIconsFileTypeZip0"/><linearGradient id="vscodeIconsFileTypeZipc" x1="16.237" x2="19.686" y1="20.318" y2="20.318" href="#vscodeIconsFileTypeZip0"/><linearGradient id="vscodeIconsFileTypeZipd" x1="16.237" x2="19.686" y1="18.018" y2="18.018" href="#vscodeIconsFileTypeZip0"/><linearGradient id="vscodeIconsFileTypeZipe" x1="17.65" x2="21.099" y1="28.356" y2="28.356" href="#vscodeIconsFileTypeZip0"/><linearGradient id="vscodeIconsFileTypeZipf" x1="16.237" x2="19.686" y1="15.718" y2="15.718" href="#vscodeIconsFileTypeZip0"/><linearGradient id="vscodeIconsFileTypeZipg" x1="16.237" x2="19.686" y1="13.419" y2="13.419" href="#vscodeIconsFileTypeZip0"/><linearGradient id="vscodeIconsFileTypeZiph" x1="16.237" x2="19.686" y1="11.119" y2="11.119" href="#vscodeIconsFileTypeZip0"/><linearGradient id="vscodeIconsFileTypeZipi" x1="16.237" x2="19.686" y1="8.819" y2="8.819" href="#vscodeIconsFileTypeZip0"/><linearGradient id="vscodeIconsFileTypeZipj" x1="16.237" x2="19.686" y1="29.514" y2="29.514" href="#vscodeIconsFileTypeZip0"/><linearGradient id="vscodeIconsFileTypeZipk" x1="16.985" x2="20.446" y1="11.196" y2="11.196" href="#vscodeIconsFileTypeZip0"/><linearGradient id="vscodeIconsFileTypeZipl" x1="18.096" x2="19.336" y1="5.329" y2="5.329" href="#vscodeIconsFileTypeZip0"/><linearGradient id="vscodeIconsFileTypeZipm" x1="16.029" x2="21.403" y1="5.591" y2="5.591" href="#vscodeIconsFileTypeZip0"/></defs><path fill="#c09553" d="M27.667 27.667V17.333L23 15V2H4.333v28h23.334Zm-4.667 0v-9.111l2.333 1.222v7.889Z"/><path fill="url(#vscodeIconsFileTypeZip0)" d="M17.65 25.559h3.45v.993h-3.45z"/><path fill="url(#vscodeIconsFileTypeZip1)" d="M17.65 23.26h3.45v.993h-3.45z"/><path fill="url(#vscodeIconsFileTypeZip2)" d="M17.65 20.96h3.45v.993h-3.45z"/><path fill="url(#vscodeIconsFileTypeZip3)" d="M17.65 18.66h3.45v.993h-3.45z"/><path fill="url(#vscodeIconsFileTypeZip4)" d="M17.65 16.36h3.45v.993h-3.45z"/><path fill="url(#vscodeIconsFileTypeZip5)" d="M17.65 14.06h3.45v.993h-3.45z"/><path fill="url(#vscodeIconsFileTypeZip6)" d="M17.65 11.76h3.45v.993h-3.45z"/><path fill="url(#vscodeIconsFileTypeZip7)" d="M17.65 9.461h3.45v.993h-3.45z"/><path fill="url(#vscodeIconsFileTypeZip8)" d="M17.65 7.161h3.45v.993h-3.45z"/><path fill="url(#vscodeIconsFileTypeZip9)" d="M16.237 26.721h3.45v.993h-3.45z"/><path fill="url(#vscodeIconsFileTypeZipa)" d="M16.237 24.421h3.45v.993h-3.45z"/><path fill="url(#vscodeIconsFileTypeZipb)" d="M16.237 22.121h3.45v.993h-3.45z"/><path fill="url(#vscodeIconsFileTypeZipc)" d="M16.237 19.821h3.45v.993h-3.45z"/><path fill="url(#vscodeIconsFileTypeZipd)" d="M16.237 17.522h3.45v.993h-3.45z"/><path fill="url(#vscodeIconsFileTypeZipe)" d="M17.65 27.859h3.45v.993h-3.45z"/><path fill="url(#vscodeIconsFileTypeZipf)" d="M16.237 15.222h3.45v.993h-3.45z"/><path fill="url(#vscodeIconsFileTypeZipg)" d="M16.237 12.922h3.45v.993h-3.45z"/><path fill="url(#vscodeIconsFileTypeZiph)" d="M16.237 10.622h3.45v.993h-3.45z"/><path fill="url(#vscodeIconsFileTypeZipi)" d="M16.237 8.322h3.45v.993h-3.45z"/><path fill="url(#vscodeIconsFileTypeZipj)" d="M16.237 29.018h3.45v.993h-3.45z"/><path fill="url(#vscodeIconsFileTypeZipk)" d="M20.1 5.911a.554.554 0 0 0-.548-.53h-.009v.557h.092l.206 2.514h-2.252l.211-2.514h.094v-.557h-.044a.552.552 0 0 0-.547.53l-.314 10.569a.513.513 0 0 0 .515.531h2.432a.512.512 0 0 0 .513-.531Zm-1.384 10.5a1.171 1.171 0 1 1 1.171-1.171a1.171 1.171 0 0 1-1.171 1.168Z"/><path fill="url(#vscodeIconsFileTypeZipl)" d="M18.096 3.802h1.24v3.054h-1.24z"/><path fill="url(#vscodeIconsFileTypeZipm)" d="M21.4 4.56a2.549 2.549 0 0 0-2.549-2.549h-.276a2.55 2.55 0 0 0-2.436 3.3v.006a7.986 7.986 0 0 1 .261 2.561a1.811 1.811 0 0 0 .641 1.271l.109-3.441a.593.593 0 0 1 .6-.551h.135v-1.57h1.653v1.57h.1a.6.6 0 0 1 .605.551l.121 3.462a1.813 1.813 0 0 0 .666-1.292V7.72a7.693 7.693 0 0 1 .236-2.359a2.543 2.543 0 0 0 .134-.801Z"/>`}})),yh=e(_m(),1),bh=e(vm(),1),xh=e(ym(),1),Sh=e(bm(),1),Ch=e(xm(),1),wh=e(Sm(),1),Th=e(Cm(),1),Eh=e(wm(),1),Dh=e(Tm(),1),Oh=e(Em(),1),iee=e(Dm(),1),aee=e(Om(),1),oee=e(km(),1),see=e(Am(),1),cee=e(jm(),1),lee=e(Mm(),1),uee=e(Nm(),1),dee=e(Pm(),1),fee=e(Fm(),1),pee=e(Im(),1),mee=e(Lm(),1),hee=e(Rm(),1),gee=e(zm(),1),_ee=e(Bm(),1),kh=e(Vm(),1),vee=e(Hm(),1),yee=e(Um(),1),bee=e(Wm(),1),xee=e(Gm(),1),See=e(Km(),1),Cee=e(qm(),1),wee=e(Jm(),1),Tee=e(Ym(),1),Eee=e(Xm(),1),Dee=e(Zm(),1),Oee=e(Qm(),1),kee=e($m(),1),Aee=e(eh(),1),jee=e(th(),1),Mee=e(nh(),1),Nee=e(rh(),1),Pee=e(ih(),1),Fee=e(ah(),1),Iee=e(oh(),1),Lee=e(sh(),1),Ree=e(ch(),1),zee=e(lh(),1),Bee=e(uh(),1),Vee=e(dh(),1),Hee=e(fh(),1),Uee=e(ph(),1),Wee=e(mh(),1),Gee=e(hh(),1),Kee=e(gh(),1),qee=e(_h(),1),Jee=e(vh(),1),Yee=[{icon:Eh.default,name:`docker`,pattern:/^(dockerfile|\.dockerignore)$/},{icon:Dh.default,name:`dotenv`,pattern:/^\.env(?:\.|$)/},{icon:oee.default,name:`git`,pattern:/^\.git(?:attributes|ignore|modules)$/},{icon:_ee.default,name:`makefile`,pattern:/^makefile$/},{icon:hee.default,name:`license`,pattern:/^licen[cs]e(?:\.|$)/},{icon:kh.default,name:`markdown`,pattern:/^readme(?:\.|$)/},{icon:vee.default,name:`npm`,pattern:/^package(?:-lock)?\.json$/},{icon:xee.default,name:`pnpm`,pattern:/^(pnpm-lock\.yaml|pnpm-workspace\.yaml)$/},{icon:qee.default,name:`yarn`,pattern:/^yarn\.lock$/},{icon:xh.default,name:`bun`,pattern:/^bun\.lockb?$/},{icon:Ree.default,name:`tsconfig`,pattern:/^tsconfig(?:\..+)?\.json$/},{icon:Vee.default,name:`vite`,pattern:/^vite\.config\./},{icon:Hee.default,name:`vitest`,pattern:/^vitest(?:\..+)?\.config\./},{icon:Fee.default,name:`tailwind`,pattern:/^tailwind\.config\./},{icon:Oh.default,name:`eslint`,pattern:/^(eslint\.config\.|\.eslintrc)/},{icon:Cee.default,name:`prettier`,pattern:/^(prettier\.config\.|\.prettierrc)/}],Xee=[{icon:Eee.default,name:`react-typescript`,extensions:[`tsx`]},{icon:Tee.default,name:`react-javascript`,extensions:[`jsx`]},{icon:zee.default,name:`typescript`,extensions:[`ts`,`mts`,`cts`]},{icon:fee.default,name:`javascript`,extensions:[`js`,`mjs`,`cjs`]},{icon:pee.default,name:`json`,extensions:[`json`,`json5`,`jsonc`]},{icon:kh.default,name:`markdown`,extensions:[`md`,`mdx`]},{icon:lee.default,name:`html`,extensions:[`html`,`htm`]},{icon:Th.default,name:`css`,extensions:[`css`,`pcss`,`less`]},{icon:kee.default,name:`sass`,extensions:[`sass`,`scss`]},{icon:Uee.default,name:`vue`,extensions:[`vue`]},{icon:Mee.default,name:`svelte`,extensions:[`svelte`]},{icon:wee.default,name:`python`,extensions:[`py`,`pyw`]},{icon:see.default,name:`go`,extensions:[`go`]},{icon:Oee.default,name:`rust`,extensions:[`rs`]},{icon:dee.default,name:`java`,extensions:[`java`]},{icon:mee.default,name:`kotlin`,extensions:[`kt`,`kts`]},{icon:Pee.default,name:`swift`,extensions:[`swift`]},{icon:Ch.default,name:`cpp`,extensions:[`c`,`cc`,`cpp`,`h`,`hpp`]},{icon:wh.default,name:`csharp`,extensions:[`cs`]},{icon:bee.default,name:`php`,extensions:[`php`]},{icon:Dee.default,name:`ruby`,extensions:[`rb`]},{icon:gee.default,name:`lua`,extensions:[`lua`]},{icon:Aee.default,name:`shell`,extensions:[`sh`,`bash`,`zsh`,`fish`,`ps1`]},{icon:cee.default,name:`graphql`,extensions:[`graphql`,`gql`]},{icon:Kee.default,name:`yaml`,extensions:[`yaml`,`yml`]},{icon:Lee.default,name:`toml`,extensions:[`toml`]},{icon:Gee.default,name:`xml`,extensions:[`xml`]},{icon:jee.default,name:`sql`,extensions:[`sql`,`sqlite`,`db`]},{icon:Nee.default,name:`svg`,extensions:[`svg`]},{icon:uee.default,name:`image`,extensions:[`avif`,`bmp`,`gif`,`heic`,`ico`,`jpeg`,`jpg`,`png`,`tif`,`tiff`,`webp`]},{icon:bh.default,name:`audio`,extensions:[`aac`,`flac`,`m4a`,`mp3`,`ogg`,`opus`,`wav`,`weba`]},{icon:Bee.default,name:`video`,extensions:[`avi`,`m4v`,`mkv`,`mov`,`mp4`,`webm`,`wmv`]},{icon:yee.default,name:`pdf`,extensions:[`pdf`]},{icon:Wee.default,name:`word`,extensions:[`doc`,`docx`,`odt`,`rtf`]},{icon:iee.default,name:`excel`,extensions:[`csv`,`numbers`,`ods`,`tsv`,`xls`,`xlsx`]},{icon:See.default,name:`powerpoint`,extensions:[`odp`,`ppt`,`pptx`]},{icon:Jee.default,name:`archive`,extensions:[`7z`,`bz2`,`gz`,`rar`,`tar`,`tgz`,`zip`]},{icon:aee.default,name:`font`,extensions:[`eot`,`otf`,`ttf`,`woff`,`woff2`]},{icon:Sh.default,name:`config`,extensions:[`cfg`,`conf`,`ini`,`properties`]},{icon:Iee.default,name:`text`,extensions:[`log`,`txt`]}],Zee={icon:yh.default,name:`default`};function Qee(e){return e.trim().split(/[\\/]/).filter(Boolean).pop()??e.trim()}function $ee(e){return/\.([a-z0-9]{1,16})$/i.exec(e)?.[1]?.toLowerCase()??``}function ete(e){let t=Qee(e).toLowerCase(),n=Yee.find(({pattern:e})=>e.test(t));if(n)return n;let r=$ee(t);return Xee.find(({extensions:e})=>e.includes(r))??Zee}function tte(e){let t=e;return`body`in t?t:t.default}function Ah({className:e,fileName:t,size:n=`default`}){let r=ete(t);return(0,H.jsx)(gm,{"aria-hidden":`true`,"data-file-type-icon":r.name,icon:tte(r.icon),className:c(`shrink-0`,n===`compact`?`h-3.5 w-3.5`:`h-4 w-4`,e)})}function jh({agentId:e,fileName:t,kind:n}){return n===`overview`?(0,H.jsx)(to,{className:`h-3.5 w-3.5 shrink-0 text-gray-400`}):n===`child-sessions`?(0,H.jsx)(Wa,{className:`h-3.5 w-3.5 shrink-0 text-gray-400`}):n===`project-files`?(0,H.jsx)(Ba,{className:`h-3.5 w-3.5 shrink-0 text-gray-400`}):n===`cron`?(0,H.jsx)(Hi,{className:`h-3.5 w-3.5 shrink-0 text-gray-400`}):n===`file`?(0,H.jsx)(Ah,{fileName:t??``,size:`compact`}):n===`side-chat-draft`?(0,H.jsx)(uo,{className:`h-3.5 w-3.5 shrink-0 text-primary`}):e?(0,H.jsx)(bf,{agentId:e,className:`h-3.5 w-3.5 shrink-0`}):(0,H.jsx)(po,{className:`h-3.5 w-3.5 shrink-0 text-gray-400`})}function Mh(e){if(e.kind!==`file`)return;let t=[...e.onAddToChat?[{key:`add-to-chat`,icon:(0,H.jsx)(uo,{className:`h-4 w-4`}),label:T(`chatWorkspaceAddToChat`),restoreFocus:!1,onSelect:e.onAddToChat}]:[],...e.alternateViewerAction?[{key:`viewer:${e.alternateViewerAction.viewer}`,icon:e.alternateViewerAction.viewer===`rendered`?(0,H.jsx)(Ea,{className:`h-4 w-4`}):(0,H.jsx)(ga,{className:`h-4 w-4`}),label:e.alternateViewerAction.label,onSelect:e.alternateViewerAction.onSelect}]:[]],n=e.onClose?[{key:`close`,icon:(0,H.jsx)(_i,{className:`h-4 w-4`}),label:T(`chatWorkspaceCloseFile`),onSelect:e.onClose}]:[];return[{key:`file`,items:t},{key:`tab`,items:n}]}function Nh(e){return e.map(e=>({key:e.key,label:e.title,labelClassName:e.isRenderedPreview?`italic font-normal`:void 0,active:e.active,tooltip:e.tooltip,leadingIcon:(0,H.jsx)(jh,{kind:e.kind,agentId:e.agentId,fileName:e.fileName}),badge:e.kind===`file`&&e.viewMode===`diff`?(0,H.jsx)(`span`,{className:`shrink-0 rounded border border-amber-200 bg-amber-50 px-1 py-0 text-[9px] font-medium uppercase tracking-[0.08em] text-amber-700`,children:T(`chatWorkspaceDiff`)}):null,unreadIndicator:e.showUnreadDot?(0,H.jsx)(`span`,{"aria-label":T(`chatSessionUnread`),className:`h-2 w-2 shrink-0 rounded-full bg-primary`}):null,closeLabel:`${e.kind===`file`?T(`chatWorkspaceCloseFile`):T(`chatWorkspaceCloseTab`)}: ${e.title}`,closePlacement:`leading-hover`,onSelect:e.onSelect,onClose:e.onClose,menuLabel:T(`chatWorkspaceFileMoreActions`),menuGroups:Mh(e)}))}function Ph({canGoBack:e,canGoForward:t,isMaximized:n=!1,onClose:r,onGoBack:i,onGoForward:a,onRefreshFile:o,onToggleMaximize:s,tabs:c}){return(0,H.jsx)(ai,{testId:`workspace-tabs-bar`,scrollTestId:`workspace-tabs-scroll`,tabs:Nh(c),actions:[{key:`back`,icon:(0,H.jsx)(di,{className:`h-4 w-4`}),label:T(`chatWorkspaceBack`),disabled:!e,onClick:i},{key:`forward`,icon:(0,H.jsx)(li,{className:`h-4 w-4`}),label:T(`chatWorkspaceForward`),disabled:!t,onClick:a},...o?[{key:`refresh-file`,icon:(0,H.jsx)(gi,{className:`h-4 w-4`}),label:T(`chatWorkspaceRefreshFile`),onClick:o}]:[],...s?[{key:`maximize`,icon:n?(0,H.jsx)(go,{className:`h-4 w-4`}):(0,H.jsx)(co,{className:`h-4 w-4`}),label:T(n?`chatWorkspaceRestorePanel`:`chatWorkspaceMaximizePanel`),onClick:s}]:[],{key:`close`,icon:(0,H.jsx)(_i,{className:`h-4 w-4`}),label:T(`chatWorkspaceClosePanel`),onClick:r}],scrollClassName:`workspace-horizontal-scrollbar`,actionsClassName:`ml-1 mr-1 self-stretch`})}var Fh={key:`slash`,marker:`/`};function Ih(){return`composer-${Math.random().toString(36).slice(2,10)}`}function Lh(e=``){return{id:Ih(),type:`text`,text:e}}function Rh(e){let{data:t,label:n,previewUrl:r,tokenKey:i,tokenKind:a}=e;return{id:Ih(),type:`token`,tokenKind:a,tokenKey:i,label:n,previewUrl:r,data:t}}function zh(e){return e.type===`text`?e.text.length:1}function Bh(){return[Lh(``)]}function Vh(e){return[Lh(e)]}function Hh(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?Bh():t}function Uh(e){return e.map(e=>e.type===`text`?e.text:``).join(``)}function Wh(e){return e.filter(e=>e.type===`text`).map(e=>e.text).join(``)}function Gh(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 Kh(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 qh(e,t,n,r){return t<=n||e>=r}function Jh(e,t,n,r,i){return!n&&r>=i?(e.push(...t),!0):n}function Yh(e,t,n,r,i,a,o){let s=Kh(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 Xh(e,t,n,r,i,a){return!r&&i<=a?(e.push(...n),!0):(e.push(t),r)}function Zh(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=zh(t),n=s,l=s+e;if(qh(n,l,i,a)){c=Jh(o,r,c,n,a),o.push(t),s=l;continue}c=t.type===`text`?Yh(o,t,n,i,a,r,c):Xh(o,t,r,c,i,n),s=l}return c||o.push(...r),Hh(o)}function Qh(e,t){return Hh(e.filter(e=>e.type!==`token`||!t(e)))}function $h(e,t){return t===0||/\s/.test(e[t-1]??``)}function eg(e,t,n){if(!t||t.start!==t.end)return null;let r=Uh(e),i=t.end,a=r.slice(0,i),o=a.lastIndexOf(n.marker);if(o<0||!$h(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 tg(e,t,n=[Fh]){let r=null;for(let i of n){let n=eg(e,t,i);n&&(!r||n.start>r.start)&&(r=n)}return r}function ng(e,t){let n=eg(e,t,Fh);return n?{query:n.query,start:n.start,end:n.end}:null}var rg=e=>`[data-item-index="${e}"]`;function ig(e){let{activeIndex:t,containerRef:n,getItemSelector:r,isEnabled:i,itemCount:a}=e,o=r??rg;(0,V.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 ag(){let e=(0,V.useRef)(null),[t,n]=(0,V.useState)(null);return(0,V.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 l(m(e))}var og=V.forwardRef(({className:e,type:t,...n},r)=>(0,H.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}));og.displayName=`ChatInput`;var sg=Pr,cg=Nr,lg=Mr,ug=V.forwardRef(({className:e,children:t,closeLabel:n,...r},i)=>(0,H.jsxs)(Lr,{children:[(0,H.jsx)(Br,{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,H.jsxs)(jr,{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,H.jsxs)(Wr,{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,H.jsx)(_i,{className:`h-4 w-4`}),(0,H.jsx)(`span`,{className:`sr-only`,children:n})]})]})]}));ug.displayName=jr.displayName;var dg=({className:e,...t})=>(0,H.jsx)(`div`,{className:W(`flex flex-col gap-2 text-center sm:text-left`,e),...t}),fg=`2rem`;function pg(e){return`min(${e}, max(0px, calc(var(--radix-popover-content-available-height, 100vh) - ${fg})))`}var mg=pg(`24rem`),hg=_c,gg=yc,_g=vc,vg=V.forwardRef(({className:e,sideOffset:t=8,align:n=`start`,collisionPadding:r=12,style:i,...a},o)=>(0,H.jsx)(bc,{children:(0,H.jsx)(xc,{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:mg,...i},...a})}));vg.displayName=xc.displayName;var yg=pr,bg=lr,xg=cr,Sg=`2rem`;function Cg(e){return`min(${e}, max(0px, calc(var(--radix-select-content-available-height, 100vh) - ${Sg})))`}var wg=Cg(`24rem`),Tg=V.forwardRef(({className:e,children:t,...n},r)=>(0,H.jsxs)(Dr,{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,H.jsx)(hr,{asChild:!0,children:(0,H.jsx)(er,{className:`h-4 w-4 opacity-50`})})]}));Tg.displayName=Dr.displayName;var Eg=V.forwardRef(({className:e,...t},n)=>(0,H.jsx)(or,{ref:n,className:W(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,H.jsx)(ir,{className:`h-4 w-4`})}));Eg.displayName=or.displayName;var Dg=V.forwardRef(({className:e,...t},n)=>(0,H.jsx)(fr,{ref:n,className:W(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,H.jsx)(er,{className:`h-4 w-4`})}));Dg.displayName=fr.displayName;var Og=V.forwardRef(({className:e,children:t,collisionPadding:n=12,position:r=`popper`,style:i,viewportClassName:a,...o},s)=>(0,H.jsx)(gr,{children:(0,H.jsxs)(xr,{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:wg,...i},...o,children:[(0,H.jsx)(Eg,{}),(0,H.jsx)(Er,{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,H.jsx)(Dg,{})]})}));Og.displayName=xr.displayName;var kg=V.forwardRef(({className:e,...t},n)=>(0,H.jsx)(yr,{ref:n,className:W(`px-2 py-1 text-[11px] font-semibold uppercase tracking-[0.08em] text-muted-foreground`,e),...t}));kg.displayName=yr.displayName;var Ag=V.forwardRef(({className:e,children:t,...n},r)=>(0,H.jsxs)(Cr,{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,H.jsx)(`span`,{className:`absolute right-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,H.jsx)(ur,{children:(0,H.jsx)(Tr,{className:`h-4 w-4`})})}),(0,H.jsx)(dr,{children:t})]}));Ag.displayName=Cr.displayName;var jg=V.forwardRef(({className:e,...t},n)=>(0,H.jsx)(wr,{ref:n,className:W(`-mx-1 my-1 h-px bg-border`,e),...t}));jg.displayName=wr.displayName;var Mg=ii,Ng=ni,Pg=$r,Fg=V.forwardRef(({className:e,sideOffset:t=4,...n},r)=>(0,H.jsx)(Zr,{children:(0,H.jsx)(Xr,{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})}));Fg.displayName=Xr.displayName;var Ig={Dialog:sg,DialogContent:ug,DialogDescription:lg,DialogHeader:dg,DialogTitle:cg,Popover:hg,PopoverAnchor:_g,PopoverContent:vg,PopoverTrigger:gg,Input:og,Select:yg,SelectContent:Og,SelectGroup:bg,SelectItem:Ag,SelectLabel:kg,SelectSeparator:jg,SelectTrigger:Tg,SelectValue:xg,Tooltip:Ng,TooltipContent:Fg,TooltipProvider:Mg,TooltipTrigger:Pg};function Lg({pathPreview:e}){return(0,H.jsxs)(`div`,{className:`rounded-lg border border-gray-200 bg-gray-50/70 px-3 py-2.5`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-medium text-gray-600`,children:[(0,H.jsx)(Ua,{"aria-hidden":`true`,className:`h-4 w-4 text-gray-400`}),(0,H.jsx)(`span`,{className:`truncate`,children:e.rootLabel})]}),(0,H.jsx)(`div`,{className:`mt-2`,children:e.segments.map((e,t)=>{let n=e.kind===`directory`?Ua:Fa;return(0,H.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,H.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,H.jsx)(n,{"aria-hidden":`true`,className:`h-4 w-4 shrink-0 text-gray-400`}),(0,H.jsx)(`span`,{className:`truncate font-medium`,children:e.label})]},`${t}:${e.label}`)})})]})}var Rg=680,zg=.82,Bg=560,Vg=pg(`24rem`),Hg={back:di,"calendar-clock":ta,command:_a,file:Fa,files:Ia,folder:Ua,inbox:Za,"list-collapse":io,"message-square-plus":uo,"panel-app":Gr,project:La,skill:Ar};function Ug(e,t){return!t.sectionKeys||t.sectionKeys.length===0?!0:!!(e.sectionKey&&t.sectionKeys.includes(e.sectionKey))}function Wg(e,t){return e?.length?e.some(e=>e.key===t)?t:e[0].key:null}function Gg({icon:e}){let t=Hg[e];return(0,H.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,H.jsx)(t,{className:`h-3.5 w-3.5`})})}function Kg({item:e,texts:t}){return e?(0,H.jsxs)(`div`,{className:`space-y-3`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e.subtitle?(0,H.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,H.jsx)(`span`,{className:`text-sm font-semibold text-gray-900`,children:e.title})]}),(0,H.jsx)(`p`,{className:`text-xs leading-5 text-gray-600`,children:e.description}),e.pathPreview?(0,H.jsx)(Lg,{pathPreview:e.pathPreview}):null,(0,H.jsx)(`div`,{className:`space-y-1`,children:e.detailLines.map(e=>(0,H.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,H.jsx)(`div`,{className:`pt-1 text-[11px] text-gray-500`,children:e.hintLabel??t.itemHintLabel})]}):(0,H.jsx)(`div`,{className:`text-xs text-gray-500`,children:t.hintLabel})}function qg(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 Jg=(0,V.forwardRef)(function(e,t){let{Popover:n,PopoverAnchor:r,PopoverContent:i}=Ig,{elementRef:a,width:o}=ag(),s=(0,V.useRef)(null),[c,l]=(0,V.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,V.useState)(f?.[0]?.key??null),x=(0,V.useMemo)(()=>Wg(f,y),[y,f]),S=(0,V.useMemo)(()=>f?.find(e=>e.key===x)??null,[f,x]),C=(0,V.useMemo)(()=>f?.map(e=>({...e,count:p.filter(t=>Ug(t,e)).length}))??[],[f,p]),w=(0,V.useMemo)(()=>S?p.filter(e=>Ug(e,S)):p,[S,p]),T=(0,V.useMemo)(()=>w.map(e=>e.key).join(``),[w]),E=(0,V.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,V.useCallback)(e=>{b(e),l({index:0,itemsSignature:``})},[]),j=(0,V.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,V.useCallback)(e=>{e.selectionBehavior===`navigate`&&l({index:0,itemsSignature:``}),g(e)},[g]),N=(0,V.useMemo)(()=>{if(o)return Math.min(o>Bg?o*zg:o,Rg)},[o]);return(0,V.useImperativeHandle)(t,()=>({handleKeyDown:e=>qg({activeIndex:O,event:e,isOpen:u,items:w,onOpenChange:_,onSelectItem:M,setActiveIndex:j})}),[O,u,_,M,j,w]),ig({containerRef:s,activeIndex:O,itemCount:w.length,isEnabled:u&&!d,getItemSelector:e=>`[data-input-surface-index="${e}"]`}),(0,H.jsxs)(n,{open:u,onOpenChange:_,children:[(0,H.jsx)(r,{asChild:!0,children:(0,H.jsx)(`div`,{ref:a,className:`pointer-events-none absolute bottom-0 left-3 right-3 top-0`})}),(0,H.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:Vg,maxHeight:Vg,width:N?`${N}px`:void 0},children:(0,H.jsxs)(`div`,{className:`grid min-h-0 flex-1 grid-cols-[minmax(220px,300px)_minmax(0,1fr)]`,children:[(0,H.jsxs)(`div`,{className:`flex min-h-0 flex-col border-r border-gray-200`,children:[!d&&C.length>0?(0,H.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,H.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,H.jsx)(`span`,{children:n}),(0,H.jsx)(`span`,{className:r?`text-gray-500`:`text-gray-400`,children:e})]},t)})}):null,!d&&m?(0,H.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,H.jsx)(Ir,{"aria-hidden":`true`,className:`mt-0.5 h-3.5 w-3.5 shrink-0`}),(0,H.jsx)(`span`,{children:m.message})]}):null,(0,H.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,H.jsx)(`div`,{className:`p-2 text-xs text-gray-500`,children:h.loadingLabel}):(0,H.jsxs)(H.Fragment,{children:[E?null:(0,H.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,H.jsx)(`div`,{className:`px-1.5 text-xs text-gray-400`,children:h.emptyLabel}):(0,H.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,H.jsxs)(`div`,{children:[E&&a?.trim()&&l?.sectionKey!==i?(0,H.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,H.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,H.jsx)(Gg,{icon:n}):null,(0,H.jsx)(`span`,{className:`truncate text-xs font-medium`,children:o}),(0,H.jsx)(`span`,{className:`truncate text-xs text-gray-500`,children:s})]})]},r)})})]})})]}),(0,H.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,H.jsx)(Kg,{item:k,texts:h})})]})})]})});function Yg(e){return`${e.key}:${e.marker}:${e.start}`}function Xg(e,t){return t.type===`insert-text`&&e.query===``&&e.end===e.start+e.marker.length}function Zg(e,t,n){if(!t)return null;let r=Yg(t);return e===r?e:Xg(t,n)?r:null}function Qg(e){let{children:t,inputSurface:n,onInputSurfaceTriggerChange:r,onSelectItem:i,triggerSpecs:a=[Fh]}=e,o=(0,V.useRef)(null),s=(0,V.useRef)(!1),c=(0,V.useRef)(null),[l,u]=(0,V.useState)(null),d=!!n&&l!==null,f=(0,V.useCallback)((e,t)=>{c.current=e,u(e),r?.(e?t:null)},[r]),p=(0,V.useCallback)((e,t,n)=>{let r=tg(e,t,a),i=Zg(c.current,r,n);f(i,i?r:null)},[f,a]),m=(0,V.useCallback)(e=>o.current?.handleKeyDown(e)??!1,[]),h=(0,V.useCallback)(e=>{!e&&!s.current&&f(null,null)},[f]);return(0,H.jsxs)(H.Fragment,{children:[t((0,V.useMemo)(()=>({onInputSurfaceKeyDown:m,onInputSurfaceOpenChange:h,onInputSurfaceSnapshotChange:p}),[m,h,p])),n&&d?(0,H.jsx)(Jg,{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 $g=dt(`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`}}),e_=V.forwardRef(({className:e,variant:t,size:n,...r},i)=>(0,H.jsx)(`button`,{className:W($g({variant:t,size:n,className:e})),ref:i,...r}));e_.displayName=`ChatButton`;function t_(){return(0,H.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 n_({contextWindow:e}){let{Tooltip:t,TooltipContent:n,TooltipProvider:r,TooltipTrigger:i}=Ig,a=Math.max(0,Math.min(1,e.ratio)),o=Math.round(a*360);return(0,H.jsx)(r,{delayDuration:0,children:(0,H.jsxs)(t,{children:[(0,H.jsx)(i,{asChild:!0,children:(0,H.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,H.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,H.jsx)(`span`,{"aria-hidden":`true`,className:`absolute inset-[10px] rounded-full bg-card`})]})}),(0,H.jsx)(n,{side:`top`,className:`max-w-[18rem]`,children:(0,H.jsxs)(`div`,{className:`space-y-1.5 text-xs`,children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-5 font-semibold text-foreground`,children:[(0,H.jsx)(`span`,{children:e.label}),(0,H.jsx)(`span`,{children:e.percentLabel})]}),e.details.map(e=>(0,H.jsxs)(V.Fragment,{children:[e.dividerBefore?(0,H.jsx)(`div`,{"aria-hidden":`true`,className:`my-2 border-t border-border/70`,"data-testid":`context-window-detail-divider`}):null,(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-5 text-muted-foreground`,children:[(0,H.jsx)(`span`,{children:e.label}),(0,H.jsx)(`span`,{className:`font-medium text-foreground`,children:e.value})]})]},e.label))]})})]})})}function r_({children:e,label:t}){let{Tooltip:n,TooltipContent:r,TooltipProvider:i,TooltipTrigger:a}=Ig;return(0,H.jsx)(i,{delayDuration:250,children:(0,H.jsxs)(n,{children:[(0,H.jsx)(a,{asChild:!0,children:(0,H.jsx)(`span`,{className:`inline-flex`,children:e})}),(0,H.jsx)(r,{side:`top`,className:`text-xs`,children:t})]})})}function i_({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,H.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[c?(0,H.jsx)(n_,{contextWindow:c}):null,!e||!n?(0,H.jsx)(r_,{label:a,children:(0,H.jsx)(e_,{size:`icon`,className:`h-8 w-8 rounded-full`,"aria-label":a,onClick:()=>void l(),disabled:n,children:o===`continue`?(0,H.jsx)(ko,{"data-testid":`chat-continue-input-icon`,className:`h-4 w-4`}):(0,H.jsx)(Ki,{className:`h-5 w-5`})})}):t?(0,H.jsx)(r_,{label:s,children:(0,H.jsx)(e_,{size:`icon`,variant:`outline`,className:`h-8 w-8 rounded-full`,"aria-label":s,onClick:()=>void u(),disabled:r,children:(0,H.jsx)(t_,{})})}):(0,H.jsx)(r_,{label:i,children:(0,H.jsx)(e_,{size:`icon`,variant:`outline`,className:`h-8 w-8 rounded-full`,"aria-label":s,disabled:!0,children:(0,H.jsx)(t_,{})})})]})}function a_(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 o_=pg(`20rem`),s_=`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 c_(e){let{Input:t}=Ig,{onBack:n,picker:r}=e,i=(0,V.useRef)(null),a=(0,V.useId)(),[o,s]=(0,V.useState)(``),[c,l]=(0,V.useState)(0),u=(0,V.useMemo)(()=>new Set(r.selectedKeys),[r.selectedKeys]),d=(0,V.useMemo)(()=>r.groups?.filter(e=>e.options.length>0)??[],[r.groups]),f=(0,V.useMemo)(()=>d.length===0?null:d.map(e=>({...e,options:a_(e.options,o)})).filter(e=>e.options.length>0),[d,o]),p=(0,V.useMemo)(()=>f===null?a_(r.options,o):f.flatMap(e=>e.options),[f,r.options,o]),m=p.length===0?0:Math.min(c,p.length-1);ig({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,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:`shrink-0 space-y-1.5 p-2`,children:[(0,H.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,H.jsx)(aa,{className:`h-4 w-4`}),(0,H.jsx)(`span`,{children:r.title})]}),(0,H.jsxs)(`div`,{className:`relative`,children:[(0,H.jsx)(fi,{className:`pointer-events-none absolute left-2.5 top-2.5 h-3.5 w-3.5 text-muted-foreground/60`}),(0,H.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,H.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,H.jsx)(`div`,{className:`p-4 text-xs text-muted-foreground`,children:r.loadingLabel}):p.length===0?(0,H.jsx)(`div`,{className:`p-4 text-center text-xs text-muted-foreground`,children:r.emptyLabel}):(0,H.jsx)(`div`,{children:(()=>{let e=f??[{key:`all-skills`,options:p}],t=0;return e.map(e=>(0,H.jsxs)(`div`,{children:[e.label?(0,H.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,H.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,H.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,H.jsx)(`div`,{className:`truncate text-sm text-foreground`,children:e.label}),(0,H.jsx)(`div`,{className:`mt-0.5 truncate text-xs text-muted-foreground`,children:e.description||e.key})]}),r?(0,H.jsx)(Tr,{className:`h-4 w-4 shrink-0 text-foreground/70`}):null]},e.key)})]},e.key))})()})}),r.manageHref&&r.manageLabel?(0,H.jsx)(`div`,{className:`shrink-0 px-2 pb-2 pt-1`,children:(0,H.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,H.jsx)(ue,{className:`h-3 w-3`})]})}):null]})}function l_(e){let{Popover:t,PopoverContent:n,PopoverTrigger:r,Tooltip:i,TooltipContent:a,TooltipProvider:o,TooltipTrigger:s}=Ig,{accessories:c,label:l,picker:u}=e,[d,f]=(0,V.useState)(!1),[p,m]=(0,V.useState)(`actions`);return(0,H.jsxs)(t,{open:d,onOpenChange:e=>{f(e),e||m(`actions`)},children:[(0,H.jsx)(o,{children:(0,H.jsxs)(i,{children:[(0,H.jsx)(s,{asChild:!0,children:(0,H.jsx)(`span`,{className:`inline-flex`,children:(0,H.jsx)(r,{asChild:!0,children:(0,H.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,H.jsx)(hi,{className:`h-4 w-4`})})})})}),(0,H.jsx)(a,{side:`top`,children:(0,H.jsx)(`p`,{className:`text-xs`,children:l})})]})}),(0,H.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:o_},children:p===`actions`?(0,H.jsxs)(H.Fragment,{children:[c.map(e=>(0,H.jsxs)(`button`,{type:`button`,"aria-label":e.label,disabled:e.disabled,onClick:()=>{e.onClick?.(),f(!1)},className:s_,children:[e.icon===`paperclip`?(0,H.jsx)(Eo,{className:`h-4 w-4`}):null,(0,H.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.label})]},e.key)),u?(0,H.jsxs)(`button`,{type:`button`,onClick:()=>m(`skills`),className:s_,children:[(0,H.jsx)(Ar,{className:`h-4 w-4 shrink-0 text-muted-foreground`}),(0,H.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:u.title}),(0,H.jsx)(oa,{className:`h-4 w-4 shrink-0 text-muted-foreground/60`})]}):null]}):u?(0,H.jsx)(c_,{picker:u,onBack:()=>m(`actions`)}):null})]})}function u_(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 d_(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)||u_(t,r)})}function f_(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=>d_([e.label,e.value,e.description],r)):e.options})).filter(e=>e.options.length>0)}function p_({discovery:e,onOpen:t}){return(0,H.jsx)(`div`,{className:`shrink-0 border-t border-border/60 px-1.5 py-1`,children:(0,H.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,H.jsx)(Ar,{className:`h-3.5 w-3.5 shrink-0 text-primary`}),(0,H.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.summaryLabel}),(0,H.jsx)(`span`,{className:`shrink-0 font-medium text-primary`,children:e.viewLabel})]})})}function m_({discovery:e,open:t,onOpenChange:n,renderOption:r,restoreFocusRef:i}){let{Dialog:a,DialogContent:o,DialogDescription:s,DialogHeader:c,DialogTitle:l,Input:u}=Ig,[d,f]=(0,V.useState)(``),[p,m]=(0,V.useState)(`all`),[h,g]=(0,V.useState)(null),[_,v]=(0,V.useState)(()=>new Set),y=(0,V.useMemo)(()=>e.groups.filter(e=>e.options.length>0),[e.groups]),b=p===`all`||y.some(e=>e.key===p)?p:`all`,x=(0,V.useMemo)(()=>f_(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,H.jsx)(a,{open:t,onOpenChange:S,children:(0,H.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,H.jsxs)(c,{className:`shrink-0 gap-1 border-b border-border/70 px-5 pb-4 pt-5 text-left`,children:[(0,H.jsx)(l,{className:`pr-8 text-lg font-semibold text-foreground`,children:e.groupLabel}),(0,H.jsx)(s,{className:`text-sm text-muted-foreground`,children:e.summaryLabel}),(0,H.jsxs)(`div`,{className:`relative pt-3`,children:[(0,H.jsx)(fi,{className:`pointer-events-none absolute left-3 top-[1.375rem] h-4 w-4 text-muted-foreground/60`}),(0,H.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,H.jsxs)(`div`,{role:`tablist`,"aria-label":e.groupLabel,className:`custom-scrollbar flex gap-1 overflow-x-auto overscroll-contain pt-2`,children:[(0,H.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,H.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,H.jsxs)(`div`,{className:`custom-scrollbar min-h-0 flex-1 overflow-y-auto overscroll-contain px-3 py-2`,children:[x.length===0?(0,H.jsx)(`p`,{className:`px-3 py-10 text-center text-sm text-muted-foreground`,children:e.searchEmptyLabel}):null,x.map(t=>(0,H.jsxs)(`div`,{children:[b===`all`?(0,H.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,H.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,H.jsx)(`div`,{className:`min-w-0 overflow-hidden`,title:t.label,children:r(t)}),(0,H.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,H.jsx)(mi,{className:`h-3.5 w-3.5 animate-spin`}):null,n?e.addedLabel:e.actionLabel]})]},t.value)})]},t.key))]}),(0,H.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-3 border-t border-border/70 px-5 py-3`,children:[(0,H.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,H.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 h_({icon:e,className:t=``}){return e===`sparkles`?(0,H.jsx)(Ar,{className:`h-3.5 w-3.5 shrink-0 text-primary ${t}`}):e===`brain`?(0,H.jsx)($i,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground ${t}`}):null}var g_={model:`min-w-0 max-w-[18rem]`,"session-type":`shrink-0`,thinking:`shrink-0`},__={model:`w-[min(340px,calc(100vw-1rem))]`,"session-type":`w-[220px]`,thinking:`w-[180px]`},v_=pg(`18rem`),y_=Cg(`18rem`);function b_(e){return e.key===`model`&&e.selectedLabel&&e.selectedLabel.split(`/`).slice(1).join(`/`).trim()||e.selectedLabel}function x_(e){return e.groups?.filter(e=>e.options.length>0)??(e.options.length>0?[{key:`${e.key}-default`,options:e.options}]:[])}function S_({item:e}){let t=b_(e);return e.selectedLabel?(0,H.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 text-left`,children:[(0,H.jsx)(h_,{icon:e.icon,className:e.key===`model`?`hidden [@container_nextclaw-chat-input-bar_(max-width:440px)]:block`:void 0}),(0,H.jsx)(`span`,{className:`nextclaw-chat-toolbar-mobile-label truncate sm:hidden [@container_nextclaw-chat-input-bar_(max-width:440px)]:hidden`,children:t}),(0,H.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,H.jsx)(`div`,{className:`h-3 w-24 animate-pulse rounded bg-muted`}):(0,H.jsx)(`span`,{className:`truncate`,children:e.placeholder})}function C_({option:e}){return e.description?(0,H.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,H.jsx)(`span`,{className:`block truncate text-sm font-normal text-foreground`,children:e.label}),(0,H.jsx)(`span`,{className:`block truncate text-[11px] text-muted-foreground`,children:e.description})]}):(0,H.jsx)(`span`,{className:`block truncate text-sm font-normal text-foreground`,children:e.label})}function w_({item:e}){let{Input:t,Popover:n,PopoverContent:r,PopoverTrigger:i,Tooltip:a,TooltipContent:o,TooltipProvider:s,TooltipTrigger:c}=Ig,[l,u]=(0,V.useState)(!1),[d,f]=(0,V.useState)(!1),[p,m]=(0,V.useState)(``),h=(0,V.useRef)(null),g=x_(e),_=(0,V.useMemo)(()=>{let e=p.trim().toLowerCase();return e?g.map(t=>({...t,options:t.options.filter(t=>d_([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,H.jsxs)(n,{open:l,onOpenChange:C,children:[(0,H.jsx)(i,{asChild:!0,children:(0,H.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 ${g_[e.key]??``}`,children:[(0,H.jsx)(S_,{item:e}),(0,H.jsx)(er,{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,H.jsxs)(r,{className:`flex flex-col overflow-hidden rounded-2xl border-border/80 p-0 shadow-md ${__[e.key]??``}`,style:{maxHeight:v_},children:[(0,H.jsxs)(`div`,{className:`relative shrink-0 px-2 pb-1 pt-1.5`,children:[(0,H.jsx)(fi,{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,H.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,H.jsxs)(`div`,{className:`custom-scrollbar min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:[v?null:e.loading?(0,H.jsxs)(`div`,{className:`space-y-2 px-2 py-1`,children:[(0,H.jsx)(`div`,{className:`h-3 w-36 animate-pulse rounded bg-muted`}),(0,H.jsx)(`div`,{className:`h-3 w-28 animate-pulse rounded bg-muted`}),(0,H.jsx)(`div`,{className:`h-3 w-32 animate-pulse rounded bg-muted`})]}):e.emptyLabel?(0,H.jsx)(`div`,{className:`px-2 py-1 text-xs text-muted-foreground`,children:e.emptyLabel}):null,v&&!y?(0,H.jsx)(`div`,{className:`px-2 py-1 text-xs text-muted-foreground`,children:e.search?.emptyLabel??e.emptyLabel}):null,(0,H.jsx)(`div`,{className:`px-1.5 pb-0.5`,children:_.map(t=>(0,H.jsxs)(`div`,{children:[t.label?(0,H.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,H.jsxs)(`div`,{className:`group flex items-center gap-1 rounded-lg hover:bg-[var(--interaction-hover)]`,children:[(0,H.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,H.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,H.jsx)(C_,{option:t})}),n?(0,H.jsx)(Tr,{className:`h-4 w-4 shrink-0 text-foreground/70`}):null]}),x&&i?(0,H.jsx)(s,{children:(0,H.jsxs)(a,{children:[(0,H.jsx)(c,{asChild:!0,children:(0,H.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,H.jsx)(Go,{className:`h-3.5 w-3.5 ${r?`fill-current text-foreground`:``}`})})}),(0,H.jsx)(o,{side:`left`,children:(0,H.jsx)(`p`,{className:`text-xs`,children:i})})]})}):null]},t.value)})]},t.key))})]}),b?(0,H.jsx)(p_,{discovery:b,onOpen:()=>{C(!1),f(!0)}}):null,e.manageHref&&e.manageLabel?(0,H.jsx)(`div`,{className:`shrink-0 px-1.5 pb-1.5 pt-0.5`,children:(0,H.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,H.jsx)(ue,{className:`h-3 w-3`})]})}):null]}),b?(0,H.jsx)(m_,{discovery:b,open:d,onOpenChange:f,restoreFocusRef:h,renderOption:e=>(0,H.jsx)(C_,{option:e})}):null]})}function T_({item:e}){if(e.search)return(0,H.jsx)(w_,{item:e});let{Select:t,SelectContent:n,SelectGroup:r,SelectItem:i,SelectLabel:a,SelectSeparator:o,SelectTrigger:s,SelectValue:c}=Ig,l=x_(e),u=l.some(e=>e.options.length>0);return(0,H.jsxs)(t,{value:e.value,onValueChange:e.onValueChange,disabled:e.disabled,children:[(0,H.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 ${g_[e.key]??``}`,children:e.selectedLabel||e.loading?(0,H.jsx)(S_,{item:e}):(0,H.jsx)(c,{placeholder:e.placeholder})}),(0,H.jsxs)(n,{className:__[e.key]??``,style:{maxHeight:y_},children:[u?null:e.loading?(0,H.jsxs)(`div`,{className:`space-y-2 px-3 py-2`,children:[(0,H.jsx)(`div`,{className:`h-3 w-36 animate-pulse rounded bg-muted`}),(0,H.jsx)(`div`,{className:`h-3 w-28 animate-pulse rounded bg-muted`}),(0,H.jsx)(`div`,{className:`h-3 w-32 animate-pulse rounded bg-muted`})]}):e.emptyLabel?(0,H.jsx)(`div`,{className:`px-3 py-2 text-xs text-muted-foreground`,children:e.emptyLabel}):null,l.map((e,t)=>(0,H.jsxs)(`div`,{children:[t>0?(0,H.jsx)(o,{}):null,(0,H.jsxs)(r,{children:[e.label?(0,H.jsx)(a,{children:e.label}):null,e.options.map(e=>(0,H.jsx)(i,{value:e.value,className:`py-1.5`,children:(0,H.jsx)(C_,{option:e})},e.value))]})]},e.key))]})]})}function E_({actions:e,accessories:t=[],addMenuLabel:n,selects:r,skillPicker:i,trailingSelects:a=[]}){let o=n??i?.title??t[0]?.label;return(0,H.jsxs)(`div`,{className:`flex flex-wrap items-end justify-between gap-2 px-3 pb-3`,children:[(0,H.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,H.jsx)(l_,{label:o,accessories:t,picker:i}):null,r.map(e=>(0,H.jsx)(T_,{item:e},e.key))]}),(0,H.jsxs)(`div`,{className:`flex shrink-0 items-end gap-1`,children:[a.length>0?(0,H.jsx)(`div`,{className:`nextclaw-chat-toolbar-trailing-selects flex min-w-0 items-center gap-1`,children:a.map(e=>(0,H.jsx)(T_,{item:e},e.key))}):null,(0,H.jsx)(i_,{...e})]})]})}var D_=(0,V.createContext)(null);function O_(e,t){let n=null;return e!=null&&(n=e[1]),{getTheme:function(){return t??(n==null?null:n.getTheme())}}}function k_(){let e=(0,V.useContext)(D_);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 A_(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 j_=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0,M_=j_&&`documentMode`in document?document.documentMode:null,N_=j_&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),P_=j_&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),F_=!(!j_||!(`InputEvent`in window)||M_)&&`getTargetRanges`in new window.InputEvent(`input`),I_=j_&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,L_=j_&&/Android/.test(navigator.userAgent),R_=j_&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent)&&!L_,z_=j_&&/^(?=.*Chrome).*/i.test(navigator.userAgent),B_=j_&&L_&&z_,V_=j_&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&N_&&!z_,H_=0,U_=1,W_=2,G_=1,K_=2,q_=3,J_=4,Y_=5,X_=6,Z_=R_||I_||V_?`\xA0`:``,Q_=`
|
|
3
3
|
|
|
4
4
|
`,$_=P_?`\xA0`:Z_,ev={bold:1,capitalize:1024,code:16,highlight:128,italic:2,lowercase:256,strikethrough:4,subscript:32,superscript:64,underline:8,uppercase:512},tv={directionless:1,unmergeable:2},nv={center:2,end:6,justify:4,left:1,right:3,start:5},rv={[K_]:`center`,[X_]:`end`,[J_]:`justify`,[G_]:`left`,[q_]:`right`,[Y_]:`start`},iv={normal:0,segmented:2,token:1},av={[H_]:`normal`,[W_]:`segmented`,[U_]:`token`},ov=`$config`;function sv(e,t,n,r,i,a){let o=e.getFirstChild();for(;o!==null;){let e=o.__key;o.__parent===t&&(Y(o)&&sv(o,e,n,r,i,a),n.has(e)||a.delete(e),i.push(e)),o=o.getNextSibling()}}var cv=!1,lv=0;function uv(e){lv=e.timeStamp}function dv(e,t,n){let r=e.nodeName===`BR`,i=t.__lexicalLineBreak;return i&&(e===i||r&&e.previousSibling===i)||r&&uC(e,n)!==void 0}function fv(e,t,n){let r=$C(GC(n)),i=null,a=null;r!==null&&r.anchorNode===e&&(i=r.anchorOffset,a=r.focusOffset);let o=e.nodeValue;o!==null&&CC(t,o,i,a,!1)}function pv(e,t,n){if(q(e)){let t=e.anchor.getNode();if(t.is(n)&&e.format!==t.getFormat())return!1}return $S(t)&&n.isAttached()}function mv(e,t,n,r){for(let i=e;i&&!mw(i);i=zC(i)){let e=uC(i,t);if(e!==void 0){let t=cC(e,n);if(t)return bS(t)||!tw(i)?void 0:[i,t]}else if(i===r)return[r,hC(n)]}}function hv(e,t,n){cv=!0;let r=performance.now()-lv>100;try{mS(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=mv(p,e,s,o);if(!m)continue;let[h,g]=m;if(f===`characterData`)r&&K(g)&&$S(p)&&pv(i,p,g)&&fv(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=lC(r),a=r.parentNode;if(a!=null&&r!==c&&i===null&&!dv(r,a,e)){if(P_){let e=(tw(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];(dv(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`||dv(n,i,e)||a.removeChild(n)}}n.takeRecords()}i!==null&&(l&&gC(i),P_&&LC(e)&&i.insertRawText(u))})}finally{cv=!1}}function gv(e){let t=e._observer;t!==null&&hv(e,t.takeRecords(),t)}function _v(e){(function(e){lv===0&&GC(e).addEventListener(`textInput`,uv,!0)})(e),e._observer=new MutationObserver((t,n)=>{hv(e,t,n)})}var vv=class{key;parse;unparse;isEqual;defaultValue;resetOnCopyNode;constructor(e,t){this.key=e,this.parse=t.parse.bind(t),this.unparse=(t.unparse||Tv).bind(t),this.isEqual=(t.isEqual||Object.is).bind(t),this.defaultValue=this.parse(void 0),this.resetOnCopyNode=t.resetOnCopyNode||!1}};function yv(e,t){return new vv(e,t)}function bv(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}=gw(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 xv=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 wv(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=wv(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 Sv(e){let t=e.getWritable(),n=t.__state?t.__state.getWritable(t):new xv(t,Cv(t));return t.__state=n,n}function Cv(e){return e.__state?e.__state.sharedNodeState:HS(sw(),e.getType()).sharedNodeState}function wv(e){if(e)for(let t in e)return e}function Tv(e){return e}function Ev(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 Dv(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 Ov(e,t){let n=e.__state;return n&&n.node===e?n.getWritable(t):n}function kv(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&&Ev(n,e,t)||t&&Ev(n,t,e)||e&&Dv(n,e,t)||t&&Dv(n,t,e))}(c,l))}function Av(e,t){let n=e.mergeWithSibling(t),r=tS()._normalizedNodes;return r.add(e.__key),r.add(t.__key),n}function jv(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(kv(t,r)){r=Av(t,r);break}break}t.remove()}for(;(n=r.getNextSibling())!==null&&K(n)&&n.isSimpleText()&&!n.isUnmergeable();){if(n.__text!==``){if(kv(r,n)){r=Av(r,n);break}break}n.remove()}}else r.remove()}function Mv(e){return Nv(e.anchor),Nv(e.focus),e}function Nv(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 Pv,Fv,Iv,Lv,Rv,zv,Bv,Vv,Hv,Uv,Wv=``,Gv=null,Kv=null,qv=!1,Jv=!1;function Yv(e,t){let n=Bv.get(e);if(t!==null){let n=py(e);n.parentNode===t&&t.removeChild(n)}if(Vv.has(e)||Fv._keyToDOMMap.delete(e),Y(n)){let e=sy(n,Bv);Xv(e,0,e.length-1,null)}n!==void 0&&PC(Uv,Iv,Lv,n,`destroyed`)}function Xv(e,t,n,r){for(let i=t;i<=n;++i){let t=e[i];t!==void 0&&Yv(t,r)}}function Zv(e,t){e.setProperty(`text-align`,t)}var Qv=`40px`;function $v(e,t){let n=Pv.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(Fv._rootElement||e).getPropertyValue(`--lexical-indent-base-value`)||Qv;e.style.setProperty(`padding-inline-start`,`calc(${t} * ${r})`)}function ey(e,t){let n=e.style;t===0?Zv(n,``):t===1?Zv(n,`left`):t===2?Zv(n,`center`):t===3?Zv(n,`right`):t===4?Zv(n,`justify`):t===5?Zv(n,`start`):t===6&&Zv(n,`end`)}function ty(e,t){let n=function(e){let t=e.__dir;if(t!==null)return t;if(SS(e))return null;let n=e.getParentOrThrow();return SS(n)&&n.__dir===null?`auto`:null}(t);n===null?e.removeAttribute(`dir`):e.dir=n}function ny(e,t){let n=Vv.get(e);n===void 0&&G(60);let r=n.createDOM(Pv,Fv);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,Fv),K(n)?r.setAttribute(`data-lexical-text`,`true`):bS(n)&&r.setAttribute(`data-lexical-decorator`,`true`),Y(n)){let e=n.__indent,t=n.__size;if(ty(r,n),e!==0&&$v(r,e),t!==0){let e=t-1;ry(sy(n,Vv),n,0,e,n.getDOMSlot(r))}let i=n.__format;i!==0&&ey(r,i),n.isInline()||ay(null,n,r)}else{let t=n.getTextContent();if(bS(n)){let t=n.decorate(Fv,Pv);t!==null&&ly(e,t),r.contentEditable=`false`}Wv+=t}return t!==null&&t.insertChild(r),PC(Uv,Iv,Lv,n,`created`),r}function ry(e,t,n,r,i){let a=Wv;Wv=``;let o=n;for(;o<=r;++o){ny(e[o],i);let t=Vv.get(e[o]);t!==null&&K(t)?Gv===null&&(Gv=t.getFormat(),Kv=t.getStyle()):Y(t)&&o<r&&!t.isInline()&&(Wv+=Q_)}i.element.__lexicalTextContent=Wv,Wv=a+Wv}function iy(e,t){if(e){let n=e.__last;if(n){let e=t.get(n);if(e)return Kb(e)?`line-break`:bS(e)&&e.isInline()?`decorator`:null}return`empty`}return null}function ay(e,t,n){let r=iy(e,Bv),i=iy(t,Vv);r!==i&&t.getDOMSlot(n).setManagedLineBreak(i)}function oy(e,t,n){var r;Gv=null,Kv=null,function(e,t,n){let r=Wv,i=e.__size,a=t.__size;Wv=``;let o=n.element;if(i===1&&a===1){let n=e.__first,r=t.__first;if(n===r)cy(n,o);else{let e=py(n),t=ny(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}Yv(n,null)}let i=Vv.get(r);K(i)&&Gv===null&&(Gv=i.getFormat(),Kv=i.getStyle())}else{let r=sy(e,Bv),s=sy(t,Vv);if(r.length!==i&&G(227),s.length!==a&&G(228),i===0)a!==0&&ry(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;Xv(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=uy(cy(r,a.element)),d++,f++;else{if(l===void 0&&(l=dy(n,f)),c===void 0)c=dy(t,d);else if(!c.has(e)){d++;continue}if(!l.has(e)){u=uy(py(e)),Yv(e,a.element),d++,c.delete(e);continue}if(c.has(r)){let e=RC(Fv,r);e!==u&&a.withBefore(u).insertChild(e),u=uy(cy(r,a.element)),d++,f++}else ny(r,a.withBefore(u)),f++}let i=Vv.get(r);i!==null&&K(i)?Gv===null&&(Gv=i.getFormat(),Kv=i.getStyle()):Y(i)&&f<=s&&!i.isInline()&&(Wv+=Q_)}let p=d>o,m=f>s;if(p&&!m){let e=n[s+1],t=e===void 0?null:Fv.getElementByKey(e);ry(n,0,f,s,a.withBefore(t))}else m&&!p&&Xv(t,d,o,a.element)})(0,r,s,i,a,n)}o.__lexicalTextContent=Wv,Wv=r+Wv}(e,t,t.getDOMSlot(n)),r=t,Gv==null||Gv===r.__textFormat||Jv||r.setTextFormat(Gv),function(e){Kv==null||Kv===e.__textStyle||Jv||e.setTextStyle(Kv)}(t)}function sy(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 cy(e,t){let n=Bv.get(e),r=Vv.get(e);n!==void 0&&r!==void 0||G(61);let i=qv||zv.has(e)||Rv.has(e),a=RC(Fv,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 Wv+=e,a}if(n!==r&&i&&PC(Uv,Iv,Lv,r,`updated`),r.updateDOM(n,a,Pv)){let n=ny(e,null);return t===null&&G(62),t.replaceChild(n,a),Yv(e,null),n}if(Y(n)){Y(r)||G(334,e);let t=r.__indent;(qv||t!==n.__indent)&&$v(a,t);let o=r.__format;if((qv||o!==n.__format)&&ey(a,o),i)oy(n,r,a),SS(r)||r.isInline()||ay(n,r,a);else{let e=a.__lexicalTextContent,t;typeof e==`string`?t=e:(t=n.getTextContent(),a.__lexicalTextContent=t),Wv+=t}if((qv||r.__dir!==n.__dir)&&(ty(a,r),SS(r)&&!qv))for(let e of r.getChildren())Y(e)&&ty(RC(Fv,e.getKey()),e)}else{let t=r.getTextContent();if(bS(r)){let t=r.decorate(Fv,Pv);t!==null&&ly(e,t)}Wv+=t}if(!Jv&&SS(r)&&r.__cachedText!==Wv){let e=r.getWritable();e.__cachedText=Wv,r=e}return a}function ly(e,t){let n=Fv._pendingDecorators,r=Fv._decorators;if(n===null){if(r[e]===t)return;n=fC(Fv)}n[e]=t}function uy(e){let t=e.nextSibling;return t!==null&&t===Fv._blockCursorElement&&(t=t.nextSibling),t}function dy(e,t){let n=new Set;for(let r=t;r<e.length;r++)n.add(e[r]);return n}function fy(e,t,n,r,i,a){Wv=``,qv=r===2,Fv=n,Pv=n._config,Iv=n._nodes,Lv=Fv._listeners.mutation,Rv=i,zv=a,Bv=e._nodeMap,Vv=t._nodeMap,Jv=t._readOnly,Hv=new Map(n._keyToDOMMap);let o=new Map;return Uv=o,cy(`root`,null),Fv=void 0,Iv=void 0,Rv=void 0,zv=void 0,Bv=void 0,Vv=void 0,Pv=void 0,Hv=void 0,Uv=void 0,o}function py(e){let t=Hv.get(e);return t===void 0&&G(75,e),t}function my(e){return{type:e}}var hy=my(`SELECTION_CHANGE_COMMAND`),gy=my(`CLICK_COMMAND`),_y=my(`BEFORE_INPUT_COMMAND`),vy=my(`INPUT_COMMAND`),yy=my(`COMPOSITION_START_COMMAND`),by=my(`COMPOSITION_END_COMMAND`),xy=my(`DELETE_CHARACTER_COMMAND`),Sy=my(`INSERT_LINE_BREAK_COMMAND`),Cy=my(`INSERT_PARAGRAPH_COMMAND`),wy=my(`CONTROLLED_TEXT_INSERTION_COMMAND`),Ty=my(`PASTE_COMMAND`),Ey=my(`REMOVE_TEXT_COMMAND`),Dy=my(`DELETE_WORD_COMMAND`),Oy=my(`DELETE_LINE_COMMAND`),ky=my(`FORMAT_TEXT_COMMAND`),Ay=my(`UNDO_COMMAND`),jy=my(`REDO_COMMAND`),My=my(`KEYDOWN_COMMAND`),Ny=my(`KEY_ARROW_RIGHT_COMMAND`),Py=my(`MOVE_TO_END`),Fy=my(`KEY_ARROW_LEFT_COMMAND`),Iy=my(`MOVE_TO_START`),Ly=my(`KEY_ARROW_UP_COMMAND`),Ry=my(`KEY_ARROW_DOWN_COMMAND`),zy=my(`KEY_ENTER_COMMAND`),By=my(`KEY_SPACE_COMMAND`),Vy=my(`KEY_BACKSPACE_COMMAND`),Hy=my(`KEY_ESCAPE_COMMAND`),Uy=my(`KEY_DELETE_COMMAND`),Wy=my(`KEY_TAB_COMMAND`),Gy=my(`DROP_COMMAND`),Ky=my(`DRAGSTART_COMMAND`),qy=my(`DRAGOVER_COMMAND`),Jy=my(`DRAGEND_COMMAND`),Yy=my(`COPY_COMMAND`),Xy=my(`CUT_COMMAND`),Zy=my(`SELECT_ALL_COMMAND`),Qy=my(`FOCUS_COMMAND`),$y=my(`BLUR_COMMAND`),eb=my(`KEY_MODIFIER_COMMAND`),tb=Object.freeze({}),nb=[[`keydown`,function(e,t){rb=e.timeStamp,ib=e.key,!t.isComposing()&&X(t,My,e)}],[`pointerdown`,function(e,t){let n=e.target,r=e.pointerType;nw(n)&&r!==`touch`&&r!==`pen`&&e.button===0&&mS(t,()=>{GS(n)||(ub=!0)})}],[`compositionstart`,function(e,t){X(t,yy,e)}],[`compositionend`,function(e,t){P_?fb=!0:I_||!R_&&!V_?X(t,by,e):(pb=!0,mb=e.data)}],[`input`,function(e,t){e.stopPropagation(),mS(t,()=>{t.dispatchCommand(vy,e)},{event:e}),ob=null}],[`click`,function(e,t){mS(t,()=>{let n=J(),r=$C(GC(t)),i=Px();if(r){if(q(n)){let t=n.anchor,a=t.getNode();if(t.type===`element`&&t.offset===0&&n.isCollapsed()&&!SS(a)&&mC().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=vw(a,e=>Y(e)&&!e.isInline());Y(e)&&e.select(0)}}else if(e.pointerType===`touch`||e.pointerType===`pen`){let n=r.anchorNode;(tw(n)||$S(n))&&gC(Nx(i,r,t,e))}}X(t,gy,e)})}],[`cut`,tb],[`copy`,tb],[`dragstart`,tb],[`dragover`,tb],[`dragend`,tb],[`paste`,tb],[`focus`,tb],[`blur`,tb],[`drop`,tb]];F_&&nb.push([`beforeinput`,(e,t)=>function(e,t){let n=e.inputType;n===`deleteCompositionText`||P_&&LC(t)||n!==`insertCompositionText`&&X(t,_y,e)}(e,t)]);var rb=0,ib=null,ab=0,ob=null,sb=new WeakMap,cb=new WeakMap,lb=!1,ub=!1,db=!1,fb=!1,pb=!1,mb=``,hb=null,gb=[0,``,0,`root`,0];function _b(e,t,n,r,i){let a=e.anchor,o=e.focus,s=a.getNode(),c=tS(),l=$C(GC(c)),u=l===null?null:l.anchorNode,d=a.key,f=c.getElementByKey(d),p=n.length;return d!==o.key||!K(s)||(!i&&(!F_||ab<r+50)||s.isDirty()&&p<2||vC(n))&&a.offset!==o.offset&&!s.isComposing()||QS(s)||s.isDirty()&&p>1||(i||!F_)&&f!==null&&!s.isComposing()&&u!==tC(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=ZS(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 vb(e,t){return $S(e)&&e.nodeValue!==null&&t!==0&&t!==e.nodeValue.length}function yb(e,t,n){let{anchorNode:r,anchorOffset:i,focusNode:a,focusOffset:o}=e;lb&&(lb=!1,vb(r,i)&&vb(a,o)&&!hb)||mS(t,()=>{if(!n)return void gC(null);if(!qS(t,r,a))return;let s=J();if(hb&&q(s)&&s.isCollapsed()){let e=s.anchor,t=hb.anchor;(e.key===t.key&&e.offset===t.offset+1||e.offset===1&&t.getNode().is(e.getNode().getPreviousSibling()))&&(s=hb.clone(),gC(s))}if(hb=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=GC(t).event,a=i?i.timeStamp:performance.now(),[o,c,l,u,d]=gb,f=mC(),p=!1===t.isComposing()&&f.getTextContent()===``;if(a<d+200&&n.offset===l&&n.key===u)bb(s,o,c);else if(n.type===`text`)K(r)||G(141),xb(s,r);else if(n.type===`element`&&!p){Y(r)||G(259);let e=n.getNode();e.isEmpty()?function(e,t){bb(e,t.getTextFormat(),t.getTextStyle())}(s,e):bb(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,hy,void 0)})}function bb(e,t,n){e.format===t&&e.style===n||(e.format=t,e.style=n,e.dirty=!0)}function xb(e,t){bb(e,t.getFormat(),t.getStyle())}function Sb(e){if(!e.getTargetRanges)return null;let t=e.getTargetRanges();return t.length===0?null:t[0]}function Cb(e){let t=e.inputType,n=Sb(e),r=tS(),i=J();if(t===`deleteContentBackward`){if(i===null){let e=Px();if(!q(e))return!0;gC(e.clone())}if(q(i)){let t=i.anchor.key===i.focus.key;if(a=e.timeStamp,ib===`MediaLast`&&a<rb+30&&r.isComposing()&&t){if(oC(null),rb=0,setTimeout(()=>{mS(r,()=>{oC(null)})},30),q(i)){let e=i.anchor.getNode();e.markDirty(),K(e)||G(142),xb(i,e)}}else{oC(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=B_&&t&&!s&&o;if(c&&i.isCollapsed()&&(c=!bS(IC(i.anchor,!0))),!c){X(r,xy,!0);let e=J();B_&&q(e)&&e.isCollapsed()&&(hb=e,setTimeout(()=>hb=null))}}return!0}}var a;if(!q(i))return!0;let o=e.data;ob!==null&&SC(!1,r,ob),i.dirty&&ob===null||!i.isCollapsed()||SS(i.anchor.getNode())||n===null||i.applyDOMRange(n),ob=null;let s=i.anchor,c=i.focus,l=s.getNode(),u=c.getNode();if(t===`insertText`||t===`insertTranspose`){if(o===`
|
|
@@ -99,11 +99,11 @@ https://github.com/highlightjs/highlight.js/issues/2277`),i=e,r=t),n===void 0&&(
|
|
|
99
99
|
|
|
100
100
|
`):void 0}function DK(e){let{invocation:t,texts:n}=e,{toolName:r,toolCallId:i,args:a,result:o}=t;if(r!==`spawn`&&r!==`sessions_request`&&r!==`sessions_spawn`)return null;let s=yK(o);if(s){let e=vK(s.status)?.toLowerCase(),t=CK(s,a),o=TK(s),c=vK(s.sessionId),l=oG({args:a,result:s}),u=c?{kind:`open-session`,sessionId:c,sessionKind:s.isChildSession===!0?`child`:`session`,...l?{agentId:l}:{},...vK(s.title)?{label:s.title.trim()}:{},...vK(s.parentSessionId)?{parentSessionId:s.parentSessionId.trim()}:{}}:void 0;return e===`failed`?{kind:`result`,name:r,detail:t,input:SK(a),text:o,callId:i||void 0,hasResult:!!o,statusTone:`error`,statusLabel:n.toolStatusFailedLabel,...l?{agentId:l}:{},...u?{action:u}:{}}:e===`completed`?{kind:`result`,name:r,detail:t,input:SK(a),text:o,callId:i||void 0,hasResult:!!o,statusTone:`success`,statusLabel:n.toolStatusCompletedLabel,...l?{agentId:l}:{},...u?{action:u}:{}}:{kind:`result`,name:r,detail:t,input:SK(a),text:o,callId:i||void 0,hasResult:!!o,statusTone:`running`,statusLabel:n.toolStatusRunningLabel,...l?{agentId:l}:{},...u?{action:u}:{}}}let c=bK(o);if(!c)return null;let l=wK(c,a),u=EK(c),d=vK(c.sessionId),f=oG({args:a,result:c}),p=d?{kind:`open-session`,sessionId:d,sessionKind:c.isChildSession===!0?`child`:`session`,...f?{agentId:f}:{},...vK(c.title)?{label:c.title.trim()}:{},...vK(c.parentSessionId)?{parentSessionId:c.parentSessionId.trim()}:{}}:void 0;return{kind:`result`,name:r,detail:l,input:SK(a),text:u,callId:i||void 0,hasResult:!!u,statusTone:`success`,statusLabel:n.toolStatusCompletedLabel,...f?{agentId:f}:{},...p?{action:p}:{}}}var OK=`ncp_internal_visibility`;function kK(e){return e?.metadata?.[OK]===`hidden`}var AK=`ai_execution`;function jK(e){return!!e&&typeof e==`object`&&!Array.isArray(e)}function MK(e){return e===null||typeof e==`number`&&Number.isSafeInteger(e)&&e>=0}function NK(e){return e===`reported`||e===`partial`||e===`unavailable`}function PK(e){return e===`completed`||e===`failed`||e===`aborted`}function FK(e){let t=e?.[AK];if(!jK(t)||t.version!==1||!jK(t.usage))return null;let n=t.usage;return typeof t.runId!=`string`||!t.runId.trim()||typeof t.runtimeId!=`string`||!t.runtimeId.trim()||typeof t.model!=`string`||!t.model.trim()||!(t.requestedModel===null||typeof t.requestedModel==`string`)||!PK(t.outcome)||!MK(n.inputTokens)||!MK(n.outputTokens)||!MK(n.cachedInputTokens)||!MK(n.totalTokens)||!MK(n.modelCallCount)||!MK(n.reportedModelCallCount)||!NK(n.status)?null:t}var IK=function(e){return e.EndpointReady=`endpoint.ready`,e.EndpointError=`endpoint.error`,e.MessageRequest=`message.request`,e.MessageStreamRequest=`message.stream-request`,e.MessageSent=`message.sent`,e.MessageAccepted=`message.accepted`,e.MessageIncoming=`message.incoming`,e.MessageCompleted=`message.completed`,e.MessageFailed=`message.failed`,e.MessageAbort=`message.abort`,e.MessageTextStart=`message.text-start`,e.MessageTextDelta=`message.text-delta`,e.MessageTextEnd=`message.text-end`,e.MessageReasoningStart=`message.reasoning-start`,e.MessageReasoningDelta=`message.reasoning-delta`,e.MessageReasoningEnd=`message.reasoning-end`,e.MessageToolCallStart=`message.tool-call-start`,e.MessageToolCallArgs=`message.tool-call-args`,e.MessageToolCallArgsDelta=`message.tool-call-args-delta`,e.MessageToolCallOutputDelta=`message.tool-call-output-delta`,e.MessageToolCallEnd=`message.tool-call-end`,e.MessageToolExecutionStarted=`message.tool-execution-started`,e.MessageToolCallResult=`message.tool-call-result`,e.MessageRead=`message.read`,e.MessageDelivered=`message.delivered`,e.MessageRecalled=`message.recalled`,e.MessageReaction=`message.reaction`,e.RunStarted=`run.started`,e.RunFinished=`run.finished`,e.RunError=`run.error`,e.RunMetadata=`run.metadata`,e.ContextWindowUpdated=`context-window.updated`,e.TypingStart=`typing.start`,e.TypingEnd=`typing.end`,e.PresenceUpdated=`presence.updated`,e}({});function LK(e,t=e.occurredAt??new Date().toISOString()){return{...e,occurredAt:t}}var RK=/\[\[\s*reply_to_current\s*\]\]/gi,zK=/\[\[\s*reply_to\s*:\s*([^\]]+?)\s*\]\]/i;function BK(e){if(typeof e!=`string`)return;let t=e.trim();return t.length>0?t:void 0}function VK(e,t){let n=e,r;RK.test(n)&&(r=BK(t),n=n.replace(RK,``).trim());let i=n.match(zK)?.[1];return i&&(r=BK(i),n=n.replace(zK,``).trim()),r?{content:n,replyTo:r}:{content:n}}function HK(e,t=e.id){if(e.role!==`assistant`)return{...e,parts:[...e.parts],metadata:e.metadata?{...e.metadata}:void 0};let n=e.parts.findIndex(e=>e.type===`text`),r=e.metadata?{...e.metadata}:void 0,i=BK(r?.reply_to);if(n<0)return{...e,parts:[...e.parts],metadata:r};let a=e.parts[n];if(!a||a.type!==`text`)return{...e,parts:[...e.parts],metadata:r};let{content:o,replyTo:s}=VK(a.text,t),c=s??i,l=e.parts.flatMap((e,t)=>t!==n||e.type!==`text`?[e]:o.length===0?[]:[{...e,text:o}]);return c?{...e,parts:l,metadata:{...r,reply_to:c}}:{...e,parts:l,metadata:r}}function UK(e){if(typeof e!=`string`)return null;let t=e.trim();return t.length>0?t:null}function WK(e){if(typeof e!=`number`||!Number.isFinite(e))return null;let t=Math.trunc(e);return t>=0?t:null}function GK(e){return e===!0}function KK(e){let t=e;if(!t||typeof t!=`object`||Array.isArray(t))return null;let n=t,r=WK(n.usedContextTokens),i=WK(n.totalContextTokens),a=WK(n.prunedUsedContextTokens),o=UK(n.updatedAt);if(r===null||i===null||a===null||!o)return null;let s=WK(n.compactedUsedContextTokens),c=WK(n.fixedInputTokens),l=WK(n.dynamicInputTokens),u=WK(n.reservedContextTokens),d=WK(n.triggerContextTokens),f=WK(n.availableBeforeCompactionTokens);return{completeInputBudget:GK(n.completeInputBudget),usedContextTokens:r,totalContextTokens:i,prunedUsedContextTokens:a,availableContextTokens:WK(n.availableContextTokens)??Math.max(0,i-r),...c===null?{}:{fixedInputTokens:c},...l===null?{}:{dynamicInputTokens:l},...u===null?{}:{reservedContextTokens:u},...d===null?{}:{triggerContextTokens:d},...f===null?{}:{availableBeforeCompactionTokens:f},droppedHistoryCount:WK(n.droppedHistoryCount)??0,truncatedToolResultCount:WK(n.truncatedToolResultCount)??0,truncatedSystemPrompt:GK(n.truncatedSystemPrompt),truncatedUserMessage:GK(n.truncatedUserMessage),compacted:GK(n.compacted),...UK(n.checkpointId)?{checkpointId:UK(n.checkpointId)??void 0}:{},compactedMessageCount:WK(n.compactedMessageCount)??0,...s===null?{}:{compactedUsedContextTokens:s},updatedAt:o}}function qK(e){let{metadata:t}=e;if(!t||t.nextclaw_timeline_kind!==`context_compaction`)return null;let n=t.checkpoint&&typeof t.checkpoint==`object`&&!Array.isArray(t.checkpoint)?t.checkpoint:null;if(!n)return null;let r=UK(n.id),i=n.status===`compressing`?`compressing`:n.status===`compressed`?`compressed`:n.status===`failed`?`failed`:n.status===`cancelled`?`cancelled`:null,a=n.phase===`pre-run`?`pre-run`:n.phase===`mid-run`?`mid-run`:null,o=UK(n.continuationMessageId),s=WK(n.continuationMessageCoveredPartCount),c=typeof n.summary==`string`?n.summary:null,l=WK(n.coveredMessageCount),u=WK(n.coveredSessionMessageCount),d=WK(n.originalEstimatedTokens),f=WK(n.projectedEstimatedTokens),p=UK(n.createdAt),m=UK(n.updatedAt);return!r||!i||c===null||l===null||u===null||d===null||f===null||!p||!m?null:{id:r,status:i,...a?{phase:a}:{},...o?{continuationMessageId:o}:{},...s===null?{}:{continuationMessageCoveredPartCount:s},summary:c,coveredMessageCount:l,coveredSessionMessageCount:u,originalEstimatedTokens:d,projectedEstimatedTokens:f,createdAt:p,updatedAt:m}}var JK=`inherited_from_session_id`,YK=`nextclaw.context-compaction`;function XK(e){let t=e.metadata?.[JK];return typeof t==`string`&&t.trim()?t.trim():null}function ZK(e){return!kK(e)&&!x(e)&&!qK(e)&&!XK(e)}function QK(e){let t=e.metadata?.[u];return typeof t==`string`&&t.trim()?t.trim():null}function $K(e,t){return[...e,...t]}function eq(e,t){let n=e.lifecycle?.startedAt??t.lifecycle?.startedAt,r=t.lifecycle?.endedAt??e.lifecycle?.endedAt;return{...e,status:t.status,parts:$K(e.parts,t.parts),lifecycle:n||r?{startedAt:n,endedAt:r}:void 0,metadata:e.metadata||t.metadata?{...e.metadata,...t.metadata}:void 0}}function tq(e,t={}){let n=[],r=new Map,i=new Map,a=new Map(e.map(e=>[e.id,e.parts.length])),o=[],s=new Set,c=null;e.forEach((e,t)=>{let l=qK(e),u=l?.continuationMessageId,d=l?.phase===`pre-run`?c:null,f=u??d,p=l?.continuationMessageCoveredPartCount??(d?a.get(d):void 0),m=f?i.get(f):void 0;if((l?.phase===`mid-run`||l?.phase===`pre-run`)&&m&&p!==void 0){o.push({boundaryIndex:m.partOffset+p,checkpoint:l,messageIndex:m.messageIndex,rawOrder:t,serviceMessageId:e.id}),s.add(e.id);return}let h=QK(e);if(h&&kK(e)){c=h;return}if(!ZK(e))return;let g=c&&e.role===`assistant`?r.get(c):void 0;if(g!==void 0&&n[g]?.role===`assistant`){let t=n[g].parts.length;n[g]=eq(n[g],e),r.set(e.id,g),i.set(e.id,{messageIndex:g,partOffset:t}),c=null;return}c=null,r.set(e.id,n.length),i.set(e.id,{messageIndex:n.length,partOffset:0}),n.push(e)});let l=new Map;for(let e of o){let t=l.get(e.messageIndex)??[];t.push(e),l.set(e.messageIndex,t)}for(let[e,t]of l){let r=n[e];if(!r)continue;let i=[...r.parts],a=0;t.sort((e,t)=>e.boundaryIndex-t.boundaryIndex||e.rawOrder-t.rawOrder).forEach(e=>{if(!Number.isSafeInteger(e.boundaryIndex)||e.boundaryIndex<0||e.boundaryIndex>r.parts.length){s.delete(e.serviceMessageId);return}i.splice(e.boundaryIndex+a,0,{type:`extension`,extensionType:YK,data:{id:e.serviceMessageId,checkpoint:e.checkpoint}}),a+=1}),n[e]={...r,parts:i}}let u=c?r.get(c):void 0;return t.continuationRunning&&u!==void 0&&(n[u]={...n[u],status:`pending`}),{messages:n,inlineCompactionMessageIds:s}}function nq(e,t={}){return tq(e,t).messages}function rq(e){let{rawMessageId:t,rawMessages:n,visibleRawMessages:r}=e,i=n.findIndex(e=>e.id===t);return i<0?r.length-1:nq(n.slice(0,i)).length-1}function iq(e){let t=e.findIndex(e=>XK(e));if(t<0)return null;let n=XK(e[t]);return n?{boundaryIndex:nq(e.slice(0,t)).length,sourceSessionId:n,inheritedMessageCount:e.filter(e=>XK(e)===n).length}:null}function aq(e){let t=tq(e.rawMessages),n=t.messages,r=e.rawMessages.map(e=>({rawMessageId:e.id,checkpoint:qK(e)})).filter(e=>!!(e.checkpoint&&!t.inlineCompactionMessageIds.has(e.rawMessageId))).map(t=>({key:`compaction:${t.rawMessageId}`,checkpoint:t.checkpoint,boundaryIndex:rq({rawMessages:e.rawMessages,visibleRawMessages:n,rawMessageId:t.rawMessageId})})).sort((e,t)=>e.boundaryIndex-t.boundaryIndex),i=iq(e.rawMessages),a=[],o=[],s=0,c=()=>{o.length!==0&&(a.push(...o.map(e=>({kind:`message`,key:`message:${e.id}`,message:e}))),o=[])};for(n.forEach((t,n)=>{i?.boundaryIndex===n&&(c(),a.push({kind:`context-inheritance`,key:`context-inheritance:${i.sourceSessionId}`,inheritance:i}));let l=e.messages[n];for(l&&o.push(l);s<r.length&&r[s]?.boundaryIndex<=n;){let e=r[s];c(),a.push({kind:`compaction`,key:e.key,checkpoint:e.checkpoint}),s+=1}}),i?.boundaryIndex===n.length&&(c(),a.push({kind:`context-inheritance`,key:`context-inheritance:${i.sourceSessionId}`,inheritance:i}));s<r.length;){let e=r[s];c(),a.push({kind:`compaction`,key:e.key,checkpoint:e.checkpoint}),s+=1}return c(),a.length===0&&a.push({kind:`empty`,key:`empty`}),a}function oq(e){let t=typeof e==`object`&&e&&!Array.isArray(e)?e.error:null;return typeof t==`object`&&t&&!Array.isArray(t)&&t.code===`invalid_tool_arguments`?t:null}function sq(e,t){let n=WW(e.reasoning);return n?{type:`reasoning`,text:n,label:t.reasoningLabel}:null}function cq(e,t){let n=e.mimeType.startsWith(`image/`),r=qW(e.sizeBytes);return{type:`file`,file:{label:typeof e.name==`string`&&e.name.trim()?e.name.trim():n?t.imageAttachmentLabel:t.fileAttachmentLabel,mimeType:e.mimeType,dataUrl:typeof e.url==`string`&&e.url.trim().length>0?e.url.trim():`data:${e.mimeType};base64,${e.data}`,...r==null?{}:{sizeBytes:r},isImage:n}}}function lq(e,t){let n=e.toolInvocation,r=ZW(n.result,t);if(r)return r;let i=DK({invocation:n,texts:{toolStatusRunningLabel:t.toolStatusRunningLabel,toolStatusCompletedLabel:t.toolStatusCompletedLabel,toolStatusFailedLabel:t.toolStatusFailedLabel}});if(i)return{type:`tool-card`,card:QW(i,t)};let a=gK({invocation:n,actionLabel:t.showContentActionLabel??`Show content`,statusLabel:t.toolStatusCompletedLabel});if(a)return{type:`tool-card`,card:QW(a,t)};let o=$W({status:n.status,error:n.error,cancelled:n.cancelled,result:n.result,texts:t}),s=oq(n.result),c=Array.isArray(s?.issues)?s.issues.find(e=>typeof e==`string`&&e.trim().length>0):void 0,l=rK({toolName:n.toolName,status:n.status,toolCallId:n.toolCallId,args:n.args,parsedArgs:n.parsedArgs,result:n.result}),u=c?`Invalid arguments: ${c}`:l?.summary??ZU(n.parsedArgs??n.args),d=l?void 0:tG(n.args,n.parsedArgs),f=c||(typeof n.error==`string`&&n.error.trim()?n.error.trim():n.result==null?``:YU(n.result).trim()),p=!n.error&&JW(n.result),m=(!l?.fileOperation||!!n.error)&&!p,h=oG(n);return{type:`tool-card`,card:QW({kind:o.kind,name:n.toolName,...h?{agentId:h}:{},detail:u,...d?{input:d}:{},text:m&&f?f:void 0,outputData:n.result,callId:n.toolCallId||void 0,toolCallId:n.toolCallId||void 0,...n.execution?{execution:n.execution}:{},hasResult:o.hasResult,statusTone:s?`error`:o.statusTone,statusLabel:s?t.toolStatusFailedLabel:o.statusLabel,...l?.fileOperation?{fileOperation:l.fileOperation}:{}},t)}}function uq(e,t){return{type:`unknown`,label:t.unknownPartLabel,rawType:typeof e.type==`string`?e.type:`unknown`,text:YU(e)}}function dq(e){return e.type===`text`&&typeof e.text==`string`}function fq(e){return e.type===`reasoning`&&typeof e.reasoning==`string`}function pq(e){return e.type===`file`&&typeof e.mimeType==`string`&&typeof e.data==`string`}function mq(e){return e.type!==`tool-invocation`||typeof e.toolInvocation!=`object`||e.toolInvocation===null||Array.isArray(e.toolInvocation)?!1:`toolName`in e.toolInvocation&&typeof e.toolInvocation.toolName==`string`}function hq(e){if(e.extensionType!==`nextclaw.context-compaction`)return null;let t=e.data;return!t||typeof t.id!=`string`||!t.checkpoint?null:{type:`custom`,id:t.id,customType:e.extensionType,data:{id:t.id,checkpoint:t.checkpoint},process:!0}}function gq(e){return e.type===`extension`&&`extensionType`in e&&typeof e.extensionType==`string`&&`data`in e}function _q(e){let{inlineTokens:t,part:n,texts:r}=e;return dq(n)?UW(n,t):fq(n)?sq(n,r):pq(n)?cq(n,r):mq(n)?lq(n,r):gq(n)?hq(n):uq(n,r)}function vq(e){let t=e.meta?.timestamp;return t&&Number.isFinite(Date.parse(t))?t:new Date().toISOString()}function yq(e,t){return e===`user`?t.user:e===`assistant`?t.assistant:e===`tool`?t.tool:e===`system`?t.system:t.fallback}function bq(e){return e===`user`||e===`assistant`||e===`tool`||e===`system`?e:`message`}function xq(e,t){return{id:e.id,role:bq(e.role),roleLabel:yq(e.role,t.texts.roleLabels),timestampLabel:t.formatTimestamp(vq(e)),status:e.meta?.status,processSummary:e.meta?.processSummary,executionSummaryLabel:e.meta?.executionSummaryLabel,moreActions:e.meta?.moreActions,parts:e.parts.map(n=>_q({part:n,inlineTokens:e.meta?.inlineTokens??[],texts:t.texts})).filter(e=>e!==null)}}function Sq(e){return e.type===`reasoning`||e.type===`tool-invocation`}function Cq(e){return e.type===`text`||e.type===`rich-text`?e.text.trim().length>0:e.type===`file`||e.type===`source`||e.type===`card`}function wq(e){if(e.role!==`assistant`||e.status===`pending`||e.status===`streaming`)return!1;let t=-1;for(let n=e.parts.length-1;n>=0;--n){let r=e.parts[n];if(r&&Sq(r)){t=n;break}}return t>=0&&t<e.parts.length-1&&e.parts.slice(t+1).some(Cq)}function Tq(e){let t=e.lifecycle?.startedAt,n=e.lifecycle?.endedAt;if(!t||!n)return null;let r=Date.parse(t),i=Date.parse(n);if(!Number.isFinite(r)||!Number.isFinite(i)||i<r)return null;let a=Math.round((i-r)/1e3),o=Math.floor(a/3600),s=Math.floor(a%3600/60),c=a%60;return o>0?s>0?`${o}h ${s}m`:`${o}h`:s>0?`${s}m ${c}s`:`${c}s`}function Eq({message:e,processedLabel:t}){if(!wq(e))return;let n=Tq(e);return{label:n?`${t} ${n}`:t}}function Dq(e){let t=e>=1e9?{divisor:1e9,suffix:`b`}:e>=1e6?{divisor:1e6,suffix:`m`}:e>=1e3?{divisor:1e3,suffix:`k`}:null;return t?`${Math.round(e/t.divisor*10)/10}${t.suffix}`:String(e)}function Oq(e,t){if(e===null)return t;let n=Dq(e);return e>=1e3?`${n} (${e})`:n}function kq(e,t){let n=[];if(e.usage.inputTokens!==null&&n.push(`${Dq(e.usage.inputTokens)} ${t.input}`),e.usage.outputTokens!==null&&n.push(`${Dq(e.usage.outputTokens)} ${t.output}`),n.length===0&&e.usage.totalTokens!==null&&n.push(`${Dq(e.usage.totalTokens)} ${t.tokens}`),n.length===0)return e.model;let r=`${e.model} · ${n.join(` / `)}`;return e.usage.status===`partial`?`${r} · ${t.partial}`:r}function Aq(e){let{labels:t,message:n}=e;if(n.role!==`assistant`)return null;let r=FK(n.metadata);if(!r)return null;let{usage:i}=r,a=[{label:t.fields.runId,value:r.runId},{label:t.fields.runtime,value:r.runtimeId},{label:t.fields.model,value:r.model},{label:t.fields.requestedModel,value:r.requestedModel??t.notAvailable},{label:t.fields.outcome,value:t.outcomes[r.outcome]},{label:t.fields.inputTokens,value:Oq(i.inputTokens,t.notAvailable)},{label:t.fields.outputTokens,value:Oq(i.outputTokens,t.notAvailable)},{label:t.fields.cachedInputTokens,value:Oq(i.cachedInputTokens,t.notAvailable)},{label:t.fields.totalTokens,value:Oq(i.totalTokens,t.notAvailable)},{label:t.fields.modelCallCount,value:i.modelCallCount?.toString()??t.notAvailable},{label:t.fields.reportedModelCallCount,value:i.reportedModelCallCount?.toString()??t.notAvailable},{label:t.fields.usageStatus,value:t.usageStatuses[i.status]}];return{cacheKey:JSON.stringify(r),summaryLabel:kq(r,t),moreActions:{triggerLabel:t.moreActions,items:[{key:`ai-execution-metadata`,label:t.viewMetadata,dialog:{title:t.metadataTitle,description:t.metadataDescription,closeLabel:t.close,rows:a}}]}}}function jq(e){return{roleLabels:{user:T(`chatRoleUser`),assistant:T(`chatRoleAssistant`),tool:T(`chatRoleTool`),system:T(`chatRoleSystem`),fallback:T(`chatRoleMessage`)},reasoningLabel:T(`chatReasoning`),toolCallLabel:T(`chatToolCall`),toolResultLabel:T(`chatToolResult`),toolInputLabel:T(`chatToolInput`),toolNoOutputLabel:T(`chatToolNoOutput`),toolOutputLabel:T(`chatToolOutput`),toolStatusPreparingLabel:T(`chatToolStatusPreparing`),toolStatusRunningLabel:T(`chatToolStatusRunning`),toolStatusCompletedLabel:T(`chatToolStatusCompleted`),toolStatusFailedLabel:T(`chatToolStatusFailed`),toolStatusCancelledLabel:T(`chatToolStatusCancelled`),showContentActionLabel:T(`chatShowContentAction`),imageAttachmentLabel:T(`chatImageAttachment`),fileAttachmentLabel:T(`chatFileAttachment`),unknownPartLabel:T(`chatUnknownPart`)}}function Mq(){return{directory:{running:T(`chatToolDirectoryRunning`),success:T(`chatToolDirectorySuccess`),error:T(`chatToolDirectoryError`),cancelled:T(`chatToolDirectoryCancelled`)},web:{running:T(`chatToolWebRunning`),success:T(`chatToolWebSuccess`),error:T(`chatToolWebError`),cancelled:T(`chatToolWebCancelled`)},message:{running:T(`chatToolMessageRunning`),success:T(`chatToolMessageSuccess`),error:T(`chatToolMessageError`),cancelled:T(`chatToolMessageCancelled`)},session:{running:T(`chatToolSessionRunning`),success:T(`chatToolSessionSuccess`),error:T(`chatToolSessionError`),cancelled:T(`chatToolSessionCancelled`)},agent:{running:T(`chatToolAgentRunning`),success:T(`chatToolAgentSuccess`),error:T(`chatToolAgentError`),cancelled:T(`chatToolAgentCancelled`)},memory:{running:T(`chatToolMemoryRunning`),success:T(`chatToolMemorySuccess`),error:T(`chatToolMemoryError`),cancelled:T(`chatToolMemoryCancelled`)},schedule:{running:T(`chatToolScheduleRunning`),success:T(`chatToolScheduleSuccess`),error:T(`chatToolScheduleError`),cancelled:T(`chatToolScheduleCancelled`)},system:{running:T(`chatToolSystemRunning`),success:T(`chatToolSystemSuccess`),error:T(`chatToolSystemError`),cancelled:T(`chatToolSystemCancelled`)},image:{running:T(`chatToolImageRunning`),success:T(`chatToolImageSuccess`),error:T(`chatToolImageError`),cancelled:T(`chatToolImageCancelled`)},display:{running:T(`chatToolDisplayRunning`),success:T(`chatToolDisplaySuccess`),error:T(`chatToolDisplayError`),cancelled:T(`chatToolDisplayCancelled`)}}}function Nq(e){return{input:T(`chatAiExecutionInput`),output:T(`chatAiExecutionOutput`),tokens:T(`chatAiExecutionTokens`),partial:T(`chatAiExecutionPartial`),moreActions:T(`chatMessageMoreActions`),viewMetadata:T(`chatAiExecutionViewMetadata`),metadataTitle:T(`chatAiExecutionMetadataTitle`),metadataDescription:T(`chatAiExecutionMetadataDescription`),close:T(`chatAiExecutionMetadataClose`),notAvailable:T(`chatAiExecutionNotAvailable`),fields:{runId:T(`chatAiExecutionRunId`),runtime:T(`chatAiExecutionRuntime`),model:T(`chatAiExecutionModel`),requestedModel:T(`chatAiExecutionRequestedModel`),outcome:T(`chatAiExecutionOutcome`),inputTokens:T(`chatAiExecutionInputTokens`),outputTokens:T(`chatAiExecutionOutputTokens`),cachedInputTokens:T(`chatAiExecutionCachedInputTokens`),totalTokens:T(`chatAiExecutionTotalTokens`),modelCallCount:T(`chatAiExecutionModelCallCount`),reportedModelCallCount:T(`chatAiExecutionReportedModelCallCount`),usageStatus:T(`chatAiExecutionUsageStatus`)},outcomes:{completed:T(`chatAiExecutionOutcomeCompleted`),failed:T(`chatAiExecutionOutcomeFailed`),aborted:T(`chatAiExecutionOutcomeAborted`)},usageStatuses:{reported:T(`chatAiExecutionUsageReported`),partial:T(`chatAiExecutionUsagePartial`),unavailable:T(`chatAiExecutionUsageUnavailable`)}}}function Pq(e){return{addSelectionToChatLabel:T(`chatWorkspaceAddToChat`),selectionTooLongLabel:T(`chatWorkspaceExcerptSelectionTooLong`),copyCodeLabel:T(`chatCodeCopy`),copiedCodeLabel:T(`chatCodeCopied`),copyMessageLabel:T(`chatMessageCopy`),copiedMessageLabel:T(`chatMessageCopied`),excerptCharacterCountTemplate:T(`chatWorkspaceExcerptCharacterCount`),mermaidDiagramLabel:T(`chatMermaidDiagram`),mermaidExpandLabel:T(`chatMermaidExpand`),mermaidLoadingLabel:T(`chatMermaidLoading`),mermaidRenderErrorLabel:T(`chatMermaidRenderError`),previewZoomInLabel:T(`chatPreviewZoomIn`),previewZoomOutLabel:T(`chatPreviewZoomOut`),previewResetZoomLabel:T(`chatPreviewResetZoom`),typingLabel:T(`chatTyping`),reasoningCharacterCountTemplates:{inProgress:T(`chatReasoningInProgressCharacterCount`),completed:T(`chatReasoningCompletedCharacterCount`)},toolStatusLabels:{terminal:{running:T(`chatToolTerminalRunning`),success:T(`chatToolTerminalSuccess`),error:T(`chatToolTerminalError`),cancelled:T(`chatToolTerminalCancelled`)},fileRead:{running:T(`chatToolFileReadRunning`),success:T(`chatToolFileReadSuccess`),error:T(`chatToolFileReadError`),cancelled:T(`chatToolFileReadCancelled`)},fileEdit:{running:T(`chatToolFileEditRunning`),success:T(`chatToolFileEditSuccess`),error:T(`chatToolFileEditError`),cancelled:T(`chatToolFileEditCancelled`)},search:{running:T(`chatToolSearchRunning`),success:T(`chatToolSearchSuccess`),error:T(`chatToolSearchError`),cancelled:T(`chatToolSearchCancelled`)},builtIn:Mq()},attachmentOpenLabel:T(`chatAttachmentOpen`),attachmentAttachedLabel:T(`chatAttachmentAttached`),attachmentExpandLabel:T(`chatAttachmentExpand`),attachmentCloseLabel:T(`chatAttachmentClosePreview`),attachmentCategoryLabels:{archive:T(`chatAttachmentCategoryArchive`),audio:T(`chatAttachmentCategoryAudio`),code:T(`chatAttachmentCategoryCode`),data:T(`chatAttachmentCategoryData`),document:T(`chatAttachmentCategoryDocument`),generic:T(`chatAttachmentCategoryGeneric`),image:T(`chatAttachmentCategoryImage`),pdf:T(`chatAttachmentCategoryPdf`),sheet:T(`chatAttachmentCategorySheet`),video:T(`chatAttachmentCategoryVideo`)},toolActivitySegmentTemplates:{read:{one:T(`chatToolActivityReadOne`),other:T(`chatToolActivityReadOther`)},edit:{one:T(`chatToolActivityEditOne`),other:T(`chatToolActivityEditOther`)},directory:{one:T(`chatToolActivityDirectoryOne`),other:T(`chatToolActivityDirectoryOther`)},search:{one:T(`chatToolActivitySearchOne`),other:T(`chatToolActivitySearchOther`)},bash:{one:T(`chatToolActivityBashOne`),other:T(`chatToolActivityBashOther`)},web:{one:T(`chatToolActivityWebOne`),other:T(`chatToolActivityWebOther`)},agent:{one:T(`chatToolActivityAgentOne`),other:T(`chatToolActivityAgentOther`)},panel:{one:T(`chatToolActivityPanelOne`),other:T(`chatToolActivityPanelOther`)},other:{one:T(`chatToolActivityOtherOne`),other:T(`chatToolActivityOtherOther`)}},toolActivityFailedLabel:T(`chatProcessSummaryFailed`),toolActivityCancelledLabel:T(`chatProcessSummaryCancelled`)}}async function Fq(e){let t=await QL(e);L[t?`success`:`error`](T(t?`chatCodeCopied`:`chatWorkspaceCopyPathFailed`))}function Iq({busy:e,downloadUrl:t,entry:n,onAddToChat:r,onCreateFolder:i,onCreateFile:a,onDelete:o,onOpen:s,onRenameRequest:c,onRevealPath:l,onUpload:u,ownCreateTarget:d,parentRefresh:f,relativePath:p}){let m=n.kind===`directory`,h={key:`open`,items:[{key:`open`,label:T(`chatWorkspaceOpen`),icon:(0,H.jsx)(ue,{className:`h-4 w-4`}),onSelect:s}]},g={key:`manage`,items:m?[...a?[{key:`new-file`,label:T(`chatWorkspaceNewFile`),icon:(0,H.jsx)(Ma,{className:`h-4 w-4`}),disabled:e,restoreFocus:!1,onSelect:()=>a(d)}]:[],...i?[{key:`new-folder`,label:T(`chatWorkspaceNewFolder`),icon:(0,H.jsx)(za,{className:`h-4 w-4`}),disabled:e,restoreFocus:!1,onSelect:()=>i(d)}]:[],...u?[{key:`upload`,label:T(`chatWorkspaceUploadFilesHere`),icon:(0,H.jsx)(Qo,{className:`h-4 w-4`}),disabled:e,restoreFocus:!1,onSelect:()=>u(d)}]:[]]:[]},_={key:`nextclaw`,items:[...p&&r?[{key:`add-to-chat`,label:T(`chatWorkspaceAddToChat`),icon:(0,H.jsx)(uo,{className:`h-4 w-4`}),restoreFocus:!1,onSelect:()=>r(n,p)}]:[],...t?[{key:`download`,label:T(`chatWorkspaceDownloadFile`),icon:(0,H.jsx)(Sa,{className:`h-4 w-4`}),href:t,download:n.name}]:[]]},v={key:`path`,items:[...l?[{key:`reveal`,label:T(`chatWorkspaceRevealInFileManager`),icon:(0,H.jsx)(oo,{className:`h-4 w-4`}),onSelect:()=>l(n.path)}]:[],{key:`copy-path`,label:T(`chatWorkspaceCopyPath`),icon:(0,H.jsx)(ya,{className:`h-4 w-4`}),onSelect:()=>void Fq(n.path)},...p?[{key:`copy-relative-path`,label:T(`chatWorkspaceCopyRelativePath`),icon:(0,H.jsx)(ya,{className:`h-4 w-4`}),onSelect:()=>void Fq(p)}]:[]]},y={key:`rename`,items:c?[{key:`rename`,label:T(`chatWorkspaceRename`),icon:(0,H.jsx)(Oo,{className:`h-4 w-4`}),disabled:e,restoreFocus:!1,onSelect:c}]:[]},b={key:`danger`,items:o?[{key:`delete`,label:T(`chatWorkspaceDelete`),icon:(0,H.jsx)(Yo,{className:`h-4 w-4`}),destructive:!0,disabled:e,restoreFocus:!1,onSelect:()=>o(n,f)}]:[]};return m?[_,g,v,y,b]:[h,_,v,y,b]}var Lq=`nextclaw.chat.workspace-project-tree.state`,Rq=1,zq=12,Bq=256,Vq=1e7;function Hq(e){return!!e&&typeof e==`object`}function Uq(e){return(e?.trim().replace(/\\/g,`/`).replace(/\/+$/g,``)??``)||(e?.trim()===`/`?`/`:``)}function Wq(e){return e?.trim().replace(/\\/g,`/`).replace(/^\/+|\/+$/g,``).replace(/\/{2,}/g,`/`)??``}function Gq(e){return typeof e!=`number`||!Number.isFinite(e)?0:Math.min(Math.max(0,Math.round(e)),Vq)}function Kq(e){return typeof e==`number`&&Number.isFinite(e)&&e>=0?e:0}function qq(e){return Array.isArray(e)?Array.from(new Set(e.map(e=>typeof e==`string`?Wq(e):``).filter(Boolean))).slice(0,Bq):[]}function Jq(e){return Hq(e)?Object.entries(e).map(([e,t])=>{let n=Uq(e);return!n||!Hq(t)?null:[n,{expandedPaths:qq(t.expandedPaths),scrollTop:Gq(t.scrollTop),updatedAt:Kq(t.updatedAt)}]}).filter(e=>e!==null).sort((e,t)=>t[1].updatedAt-e[1].updatedAt).slice(0,zq).reduce((e,[t,n])=>(e[t]=n,e),{}):{}}function Yq(e){return Jq(e)}function Xq(){return{expandedPaths:[],scrollTop:0,updatedAt:Date.now()}}var Zq=N()(yi(e=>({trees:{},collapseAll:t=>{let n=Uq(t);n&&e(e=>{let t=e.trees[n];return!t||t.expandedPaths.length===0?e:{trees:Yq({...e.trees,[n]:{...t,expandedPaths:[],updatedAt:Date.now()}})}})},setDirectoryExpanded:(t,n,r)=>{let i=Uq(t),a=Wq(n);!i||!a||e(e=>{let t=e.trees[i]??Xq(),n=r?Array.from(new Set([...t.expandedPaths,a])).slice(0,Bq):t.expandedPaths.filter(e=>e!==a);return n.length===t.expandedPaths.length&&n.every((e,n)=>e===t.expandedPaths[n])?e:{trees:Yq({...e.trees,[i]:{...t,expandedPaths:n,updatedAt:Date.now()}})}})},setScrollTop:(t,n)=>{let r=Uq(t);if(!r)return;let i=Gq(n);e(e=>{let t=e.trees[r]??Xq();return t.scrollTop===i?e:{trees:Yq({...e.trees,[r]:{...t,scrollTop:i,updatedAt:Date.now()}})}})}}),{name:Lq,version:Rq,storage:bi(()=>window.localStorage),partialize:e=>({trees:e.trees}),merge:(e,t)=>({...t,trees:Jq(Hq(e)?e.trees:null)})}));function Qq(e){return`${e.kind===`directory`?T(`chatWorkspaceOpenDirectory`):T(`chatWorkspaceOpenFile`)}: ${e.name}`}function $q(e){return e instanceof Error?e.message:String(e)}function eJ(e){return e.error?$q(e.error):null}function tJ({fileName:e,isDirectory:t,isExpanded:n}){return t?n?(0,H.jsx)(Ra,{className:`h-4 w-4 shrink-0 text-amber-500`}):(0,H.jsx)(Ua,{className:`h-4 w-4 shrink-0 text-amber-500`}):(0,H.jsx)(Ah,{fileName:e})}function nJ({browseQuery:e,level:t,onFileOpen:n,onRevealPath:r,parentCreateTarget:i,parentRelativePath:a,...o}){let s=e.data?.entries??[],c=eJ(e),l={paddingLeft:`${36+t*14}px`};return e.isLoading&&!e.data?(0,H.jsx)(`div`,{className:`h-7 truncate pr-2 text-[11px] leading-7 text-gray-400`,style:l,children:T(`chatWorkspaceLoadingDirectory`)}):c&&!e.data?(0,H.jsx)(`div`,{className:`h-7 truncate pr-2 text-[11px] leading-7 text-rose-600`,style:l,title:c,children:T(`chatWorkspaceDirectoryLoadFailed`)}):s.length===0?(0,H.jsx)(`div`,{className:`h-7 truncate pr-2 text-[11px] leading-7 text-gray-400`,style:l,children:T(`chatWorkspaceDirectoryEmpty`)}):s.map(s=>(0,H.jsx)(sJ,{...o,browseParentRefresh:()=>e.refetch(),entry:s,level:t+1,onFileOpen:n,onRevealPath:r,parentCreateTarget:i,relativePath:a?`${a}/${s.name}`:null},s.path))}function rJ({entry:e,onRename:t,refresh:n}){let[r,i]=(0,V.useState)(!1),[a,o]=(0,V.useState)(e.name),[s,c]=(0,V.useState)(null),l=()=>i(!1);return{active:r,cancel:l,error:s,name:a,start:()=>{o(e.name),c(null),i(!0)},submit:async()=>{let r=a.trim();if(!(!t||!r||r===`.`||r===`..`||r.includes(`/`)||r.includes(`\\`))){if(r===e.name){l();return}try{await t(e,r,n),l()}catch(e){c(`${T(`chatWorkspaceRenameFailed`)}: ${$q(e)}`)}}},updateName:e=>{o(e),c(null)}}}function iJ(e,t,n,r){let i=!n&&e!==null&&e===t;return[i,n===null?i:n===r]}function aJ(e,t,n,r,i){return e||!!(!i&&t&&r&&n?.startsWith(`${r}/`))}function oJ(e,t){let[n,r]=(0,V.useState)(!1),i=Wq(t),a=Zq(t=>!!(e&&i&&t.trees[e]?.expandedPaths.includes(i))),o=Zq(e=>e.setDirectoryExpanded);return{manuallyExpanded:e&&i?a:n,updateExpanded:(0,V.useCallback)(t=>{if(e&&i){o(e,i,t);return}r(t)},[i,o,e])}}function sJ({activeRelativePath:e,browseParentRefresh:t,busy:n,createTarget:r,entry:i,level:a,onAddToChat:o,onCreateFolder:s,onCreateFile:l,onDelete:u,onRename:d,onFileOpen:f,onRevealComplete:p,onRevealPath:m,onSelect:h,onUpload:g,parentCreateTarget:_,relativePath:v,renderCreateFolder:y,revealPath:b,selectedPath:x,treeRootKey:S}){let C=(0,V.useRef)(null),w=(0,V.useRef)(null),E=i.kind===`directory`,{manuallyExpanded:D,updateExpanded:O}=oJ(S,v),k=aJ(D,E,e,v,x),A=rJ({entry:i,onRename:d,refresh:t}),j=Ic({path:i.path,includeFiles:!0,enabled:E&&k}),M=j.refetch,N=E?null:sn(i.path),P=(0,V.useMemo)(()=>E?{label:i.name,path:i.path,refresh:()=>M(),expand:()=>O(!0)}:_,[i.name,i.path,E,_,M,O]),ee=(0,V.useMemo)(()=>({path:i.path,createTarget:P}),[i.path,P]),[te,ne]=iJ(e,v,x,i.path);(0,V.useLayoutEffect)(()=>{te&&C.current?.scrollIntoView?.({block:`nearest`})},[te]),(0,V.useLayoutEffect)(()=>{b===i.path&&(C.current?.scrollIntoView?.({block:`nearest`}),h(ee),w.current?.focus(),p())},[i.path,p,h,b,ee]);let re=()=>{h(ee),E?O(!k):f({path:i.path,label:i.name,viewMode:`preview`})},F=Iq({busy:n,downloadUrl:N,entry:i,onAddToChat:o,onCreateFolder:s,onCreateFile:l,onDelete:u,onOpen:re,onRenameRequest:d?A.start:void 0,onRevealPath:m,onUpload:g,ownCreateTarget:P,parentRefresh:t,relativePath:v});return(0,H.jsxs)(`div`,{role:`treeitem`,"aria-expanded":E?k:void 0,"aria-label":Qq(i),"aria-selected":ne,children:[(0,H.jsx)(ei,{groups:F,label:T(`chatWorkspaceFileContextMenu`),children:(0,H.jsxs)(`div`,{ref:C,"data-workspace-tree-entry":``,className:c(`group flex h-[26px] w-full min-w-0 items-center text-gray-700 transition-colors hover:bg-gray-100 focus-within:bg-gray-100`,ne?`bg-primary/10`:null,i.hidden?`opacity-65`:null),style:{paddingLeft:`${6+a*12}px`},onContextMenu:()=>h(ee),children:[A.active?(0,H.jsxs)(`form`,{className:`flex h-full min-w-0 flex-1 items-center gap-1`,onSubmit:e=>{e.preventDefault(),A.submit()},children:[(0,H.jsx)(Gt,{autoFocus:!0,"aria-label":T(`chatWorkspaceRenameName`),className:`h-6 min-w-0 flex-1 px-1.5 text-xs`,value:A.name,onChange:e=>A.updateName(e.target.value),onKeyDown:e=>{e.key===`Escape`&&(e.preventDefault(),A.cancel())}}),(0,H.jsx)(B,{icon:(0,H.jsx)(Tr,{className:`h-3.5 w-3.5`}),label:T(`chatWorkspaceRename`),size:`sm`,onClick:()=>void A.submit()}),(0,H.jsx)(B,{icon:(0,H.jsx)(_i,{className:`h-3.5 w-3.5`}),label:T(`cancel`),size:`sm`,onClick:A.cancel})]}):(0,H.jsxs)(`button`,{ref:w,type:`button`,"aria-label":i.name,className:`flex h-full min-w-0 flex-1 items-center gap-1 text-left text-[13px] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-border`,onClick:re,onKeyDown:e=>{e.key===`F2`&&d&&(e.preventDefault(),A.start())},children:[(0,H.jsx)(`span`,{className:`inline-flex h-3.5 w-3.5 shrink-0 items-center justify-center text-gray-400`,children:E?k?(0,H.jsx)(er,{className:`h-3.5 w-3.5`}):(0,H.jsx)(oa,{className:`h-3.5 w-3.5`}):null}),(0,H.jsx)(tJ,{fileName:i.name,isDirectory:E,isExpanded:k}),(0,H.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,title:i.name,children:i.name})]}),A.active?null:(0,H.jsx)(qr,{children:(0,H.jsx)(B,{className:`mr-1 opacity-0 pointer-events-none group-hover:pointer-events-auto group-hover:opacity-100 group-focus-within:pointer-events-auto group-focus-within:opacity-100 data-[context-menu-open]:pointer-events-auto data-[context-menu-open]:opacity-100`,icon:(0,H.jsx)(wa,{className:`h-3.5 w-3.5`}),label:T(`chatWorkspaceMoreActionsFor`).replace(`{name}`,i.name),size:`sm`,tooltipSide:`left`,onClick:()=>h(ee)})})]})}),A.error?(0,H.jsx)(`p`,{role:`alert`,className:`py-1 pr-2 text-[11px] text-destructive`,style:{paddingLeft:`${36+a*14}px`},children:A.error}):null,E&&k?(0,H.jsxs)(`div`,{role:`group`,children:[r?.path===i.path?y(a+1):null,(0,H.jsx)(nJ,{activeRelativePath:e,browseQuery:j,busy:n,createTarget:r,level:a,onAddToChat:o,onCreateFolder:s,onCreateFile:l,onDelete:u,onRename:d,onFileOpen:f,onRevealComplete:p,onRevealPath:m,onSelect:h,onUpload:g,parentCreateTarget:P,parentRelativePath:v,renderCreateFolder:y,revealPath:b,selectedPath:x,treeRootKey:S})]}):null]})}function cJ(e){let t=e.trim();return!!(t&&t!==`.`&&t!==`..`&&!t.includes(`/`)&&!t.includes(`\\`))}function lJ({error:e,kind:t,isCreating:n,level:r,name:i,onCancel:a,onNameChange:o,onSubmit:s}){let c=(0,V.useRef)(null),l=(0,V.useRef)(null),u=cJ(i);(0,V.useLayoutEffect)(()=>{let e=c.current;typeof e?.scrollIntoView==`function`&&e.scrollIntoView({block:`nearest`}),l.current?.focus(),l.current?.select()},[]);let d=e=>{e.preventDefault(),u&&!n&&s()};return(0,H.jsxs)(`form`,{ref:c,role:`treeitem`,"aria-label":T(t===`file`?`chatWorkspaceNewFile`:`chatWorkspaceNewFolder`),className:`bg-primary/5`,onSubmit:d,children:[(0,H.jsxs)(`div`,{className:`flex min-h-8 min-w-0 items-center gap-1 py-0.5 pr-1`,style:{paddingLeft:`${8+r*14}px`},children:[(0,H.jsx)(`span`,{className:`inline-flex h-4 w-4 shrink-0`}),t===`file`?(0,H.jsx)(Fa,{className:`h-4 w-4 shrink-0 text-gray-500`}):(0,H.jsx)(Ua,{className:`h-4 w-4 shrink-0 text-amber-500`}),(0,H.jsx)(Gt,{ref:l,"aria-label":T(t===`file`?`chatWorkspaceFileName`:`chatWorkspaceFolderName`),className:`h-7 min-w-0 flex-1 rounded-md px-2 text-xs`,disabled:n,placeholder:T(t===`file`?`chatWorkspaceFileNamePlaceholder`:`chatWorkspaceFolderNamePlaceholder`),value:i,onChange:e=>o(e.target.value),onKeyDown:e=>{e.key===`Escape`&&(e.preventDefault(),a())}}),(0,H.jsx)(B,{disabled:!u||n,icon:(0,H.jsx)(Tr,{className:`h-3.5 w-3.5`}),label:T(`chatWorkspaceCreateFolder`),size:`sm`,tooltipSide:`top`,onClick:s}),(0,H.jsx)(B,{disabled:n,icon:(0,H.jsx)(_i,{className:`h-3.5 w-3.5`}),label:T(`cancel`),size:`sm`,tooltipSide:`top`,onClick:a})]}),e?(0,H.jsx)(`p`,{role:`alert`,className:`pb-1 pr-2 text-[11px] text-destructive`,style:{paddingLeft:`${42+r*14}px`},children:e}):null]})}function uJ({disabled:e,rootLabel:t,onCollapseAll:n,onNewFile:r,onNewFolder:i,onRefresh:a}){return(0,H.jsxs)(`div`,{className:`flex h-9 shrink-0 items-center gap-0.5 border-b border-gray-200/80 bg-gray-50/55 px-1.5`,children:[(0,H.jsx)(`span`,{className:`min-w-0 flex-1 truncate px-0.5 text-[11px] font-semibold uppercase tracking-[0.03em] text-gray-800`,title:t,children:t}),(0,H.jsx)(B,{icon:(0,H.jsx)(Ma,{className:`h-4 w-4`}),label:T(`chatWorkspaceNewFile`),size:`sm`,disabled:e,onClick:r}),(0,H.jsx)(B,{icon:(0,H.jsx)(za,{className:`h-4 w-4`}),label:T(`chatWorkspaceNewFolder`),size:`sm`,disabled:e,onClick:i}),(0,H.jsx)(B,{icon:(0,H.jsx)(gi,{className:`h-4 w-4`}),label:T(`chatWorkspaceRefreshExplorer`),size:`sm`,onClick:a}),(0,H.jsx)(B,{icon:(0,H.jsx)(sa,{className:`h-4 w-4`}),label:T(`chatWorkspaceCollapseAll`),size:`sm`,onClick:n}),(0,H.jsx)(qr,{children:(0,H.jsx)(B,{icon:(0,H.jsx)(wa,{className:`h-4 w-4`}),label:T(`chatWorkspaceRootMoreActions`),size:`sm`})})]})}function dJ(e){let t=e.trim().replace(/\\/g,`/`).replace(/\/+$/g,``)||`/`;return/^[a-z]:/i.test(t)?t.toLowerCase():t}function fJ(e,t){if(e[0]!==`server-path-browse`||e[3]!==!0||typeof e[1]!=`string`)return!1;let n=dJ(t),r=dJ(e[1]);return r===n||(n===`/`?r.startsWith(`/`):r.startsWith(`${n}/`))}function pJ({children:e,currentPath:t,onBlankContext:n,onContextMenu:r,rootDraft:i,showRoot:a}){let o=(0,V.useRef)(null),s=(0,V.useRef)(null),c=(0,V.useRef)(null),l=Uq(t),u=Zq(e=>l?e.trees[l]?.scrollTop??0:0),d=Zq(e=>e.setScrollTop);return(0,V.useLayoutEffect)(()=>{o.current&&l&&(o.current.scrollTop=u)},[u,l]),(0,V.useEffect)(()=>()=>{c.current&&clearTimeout(c.current),l&&s.current!==null&&d(l,s.current)},[d,l]),(0,H.jsx)(`div`,{ref:o,"data-testid":`workspace-directory-browser`,role:`tree`,tabIndex:-1,"aria-label":T(`chatWorkspaceProjectFiles`),className:`min-h-0 flex-1 overflow-auto py-1 custom-scrollbar`,onContextMenu:e=>{e.target.closest(`[data-workspace-tree-entry]`)||n(),r?.(e)},onScroll:e=>{l&&(s.current=e.currentTarget.scrollTop,c.current&&clearTimeout(c.current),c.current=setTimeout(()=>{c.current=null,s.current!==null&&d(l,s.current)},120))},children:a&&t?(0,H.jsxs)(H.Fragment,{children:[i,e]}):e})}function mJ(e){return e instanceof Error?e.message:String(e)}function hJ(e,t){return e.replace(`{count}`,String(t))}function gJ(){let[e,t]=(0,V.useState)(null),n=(0,V.useRef)(null),r=async(e,r)=>{if(n.current)throw Error(`another workspace file operation is already running`);n.current=e,t(e);try{return await r()}finally{n.current=null,t(null)}};return{pendingAction:e,createDirectory:e=>r(`create-directory`,()=>Wt(e)),createFile:e=>r(`create-file`,()=>tn(e)),deleteEntry:e=>r(`delete`,()=>jt(e)),renameEntry:e=>r(`rename`,()=>gt(e)),uploadFiles:e=>r(`upload`,()=>un(e))}}async function _J({actions:e,confirm:t,files:n,rootPath:r,target:i}){try{let a;try{a=await e.uploadFiles({basePath:r,targetPath:i.path,files:n})}catch(o){if(!(o instanceof Pe)||o.code!==`SERVER_PATH_FILE_EXISTS`)throw o;let s=Array.isArray(o.details?.conflicts)?o.details.conflicts.length:n.length;if(!await t({title:T(`chatWorkspaceUploadConflictTitle`),description:hJ(T(`chatWorkspaceUploadConflictDescription`),s),confirmLabel:T(`chatWorkspaceReplaceFiles`),variant:`destructive`}))return;a=await e.uploadFiles({basePath:r,targetPath:i.path,files:n,overwrite:!0})}await i.refresh(),L.success(hJ(T(`chatWorkspaceUploadSucceeded`),a.files.length))}catch(e){L.error(`${T(`chatWorkspaceUploadFailed`)}: ${mJ(e)}`)}}async function vJ({actions:e,confirm:t,entry:n,refresh:r,rootPath:i}){let a=n.kind===`directory`;if(!await t({title:T(a?`chatWorkspaceDeleteFolderTitle`:`chatWorkspaceDeleteFileTitle`).replace(`{name}`,n.name),description:T(a?`chatWorkspaceDeleteFolderDescription`:`chatWorkspaceDeleteFileDescription`),confirmLabel:T(`chatWorkspaceDelete`),variant:`destructive`}))return;let o=L.loading(T(`chatWorkspaceDeleting`).replace(`{name}`,n.name));try{let t=await e.deleteEntry({basePath:i,path:n.path});return await r(),L.dismiss(o),L.success(T(`chatWorkspaceDeleteSucceeded`).replace(`{name}`,n.name)),t}catch(e){return L.dismiss(o),L.error(`${T(`chatWorkspaceDeleteFailed`).replace(`{name}`,n.name)}: ${mJ(e)}`),null}}async function yJ({actions:e,kind:t,name:n,rootPath:r,setError:i,target:a}){i(null);try{let i=await(t===`file`?e.createFile:e.createDirectory)({basePath:r,parentPath:a.path,name:n});return await a.refresh(),L.success(T(t===`file`?`chatWorkspaceFileCreated`:`chatWorkspaceFolderCreated`)),i}catch(e){return i(`${T(t===`file`?`chatWorkspaceFileCreateFailed`:`chatWorkspaceFolderCreateFailed`)}: ${mJ(e)}`),null}}function bJ({activeRelativePath:e,confirm:t,onEntryDeleted:n,onEntryRenamed:r,rootPath:i}){let a=(0,V.useRef)(null),o=gJ(),[s,c]=(0,V.useState)(null),[l,u]=(0,V.useState)(``),[d,f]=(0,V.useState)(`directory`),[p,m]=(0,V.useState)(null),[h,g]=(0,V.useState)(null),[_,v]=(0,V.useState)(null),[y,b]=(0,V.useState)(null),x=h?.activeRelativePath===e?h.selection:null,S=e=>{b(e),a.current&&(a.current.value=``,a.current.click())},C=t=>{g({activeRelativePath:e,selection:t})},w=(e,t)=>{t.expand?.(),f(e),u(``),m(null),c(t)};return{actions:{cancelCreateFolder:()=>{c(null),u(``),m(null)},clearSelection:()=>{g(null)},completeReveal:()=>v(null),deleteEntry:async(e,r)=>{if(!i)return;let a=await vJ({actions:o,confirm:t,entry:e,refresh:r,rootPath:i});a&&n?.(a.path)},openCreateFile:e=>w(`file`,e),openCreateFolder:e=>w(`directory`,e),renameEntry:async(t,n,a)=>{if(!i)return null;let s=await o.renameEntry({basePath:i,path:t.path,name:n});return r?.({previousPath:s.oldPath,path:s.path,label:s.name}),await a(),g(n=>n?.activeRelativePath===e?{activeRelativePath:e,selection:{path:s.path,createTarget:n.selection.createTarget.path===t.path?{...n.selection.createTarget,label:s.name,path:s.path}:n.selection.createTarget}}:null),v(s.path),L.success(T(`chatWorkspaceRenameSucceeded`).replace(`{name}`,s.name)),s},requestUpload:S,selectEntry:C,setCreateError:m,setCreateName:u,submitCreate:async()=>{if(!i||!s)return;let t=await yJ({actions:o,kind:d,name:l,rootPath:i,setError:m,target:s});t&&(c(null),g({activeRelativePath:e,selection:{path:t.path,createTarget:{label:l.trim(),path:t.path,refresh:s.refresh}}}),v(t.path))},uploadFiles:async e=>{!i||!y||e.length===0||await _J({actions:o,confirm:t,files:e,rootPath:i,target:y})}},refs:{fileInputRef:a},state:{createError:p,createKind:d,createName:l,createTarget:s,pendingAction:o.pendingAction,revealPath:_,selectedCreateTarget:x?.createTarget??null,selectedPath:x?.path??null}}}var xJ=2*6e4;function SJ(e){let t=e.join(`
|
|
101
101
|
`);(0,V.useEffect)(()=>{let e=t.split(`
|
|
102
|
-
`).filter(Boolean);if(e.length===0)return;let n=!1,r=null,i=null,a=async()=>{try{let t=await vt({directories:e,subscriptionId:r});if(n){await Rt(t.subscriptionId).catch(()=>void 0);return}r=t.subscriptionId}catch(e){console.warn(`Project file auto-refresh is unavailable; manual refresh remains available.`,e)}};return a().then(()=>{!n&&r&&(i=setInterval(()=>void a(),xJ))}),()=>{n=!0,i&&clearInterval(i),r&&Rt(r).catch(()=>void 0)}},[t])}var CJ=[];function wJ(e){return e.split(/[\\/]/).filter(Boolean).pop()??e}function TJ({activeRelativePath:e,busy:t,createTarget:n,entries:r,fallbackParentTarget:i,mutable:a,onAddToChat:o,onCreateFile:s,onCreateFolder:c,onDelete:l,onFileOpen:u,onRevealComplete:d,onRename:f,onRevealPath:p,onSelect:m,onUpload:h,refresh:g,relativePaths:_,renderCreateFolder:v,revealPath:y,selectedPath:b,showRoot:x,treeRootKey:S}){return r.length===0?(0,H.jsx)(`div`,{className:`px-4 py-8 text-center text-xs text-gray-400`,children:T(`chatWorkspaceDirectoryEmpty`)}):r.map(r=>(0,H.jsx)(sJ,{activeRelativePath:e,browseParentRefresh:g,busy:t,createTarget:n,entry:r,level:x?1:0,onAddToChat:o,onCreateFile:a?s:void 0,onCreateFolder:a?c:void 0,onDelete:a?l:void 0,onFileOpen:u,onRevealComplete:d,onRename:f,onRevealPath:p,onSelect:m,onUpload:a?h:void 0,parentCreateTarget:i,relativePath:_?r.name:null,renderCreateFolder:v,revealPath:y,selectedPath:b,treeRootKey:S},r.path))}function EJ({busy:e,onCollapseAll:t,onCreateFile:n,onCreateFolder:r,onRefresh:i,onRevealPath:a,onUpload:o,target:s}){return[{key:`manage`,items:[{key:`new-file`,label:T(`chatWorkspaceNewFile`),icon:(0,H.jsx)(Ma,{className:`h-4 w-4`}),disabled:e,restoreFocus:!1,onSelect:n},{key:`new-folder`,label:T(`chatWorkspaceNewFolder`),icon:(0,H.jsx)(za,{className:`h-4 w-4`}),disabled:e,restoreFocus:!1,onSelect:r},{key:`upload`,label:T(`chatWorkspaceUploadFilesHere`),icon:(0,H.jsx)(Qo,{className:`h-4 w-4`}),disabled:e,restoreFocus:!1,onSelect:o}]},{key:`view`,items:[{key:`refresh`,label:T(`chatWorkspaceRefreshExplorer`),icon:(0,H.jsx)(gi,{className:`h-4 w-4`}),onSelect:i},{key:`collapse`,label:T(`chatWorkspaceCollapseAll`),icon:(0,H.jsx)(sa,{className:`h-4 w-4`}),onSelect:t}]},{key:`path`,items:[...a?[{key:`reveal`,label:T(`chatWorkspaceRevealInFileManager`),icon:(0,H.jsx)(oo,{className:`h-4 w-4`}),onSelect:()=>a(s.path)}]:[],{key:`copy-path`,label:T(`chatWorkspaceCopyPath`),icon:(0,H.jsx)(ya,{className:`h-4 w-4`}),onSelect:()=>void Fq(s.path)}]}]}function DJ({activeRelativePath:e,browseQuery:t,ConfirmDialog:n,controller:r,entries:i,onAddToChat:a,onFileOpen:o,onRevealPath:s,rootLabel:c,rootPath:l,showRoot:u}){let d=yn(),{cancelCreateFolder:f,clearSelection:p,completeReveal:m,submitCreate:h,deleteEntry:g,openCreateFile:_,openCreateFolder:v,requestUpload:y,renameEntry:b,selectEntry:x,setCreateError:S,setCreateName:C,uploadFiles:w}=r.actions,{fileInputRef:E}=r.refs,{createError:D,createKind:O,createName:k,createTarget:A,pendingAction:j,revealPath:M,selectedCreateTarget:N,selectedPath:P}=r.state,ee=j!==null,te=Uq(l),ne=Zq(e=>e.collapseAll),re=()=>l?d.refetchQueries({predicate:e=>fJ(e.queryKey,l),type:`active`}):t.refetch(),F=l?{label:c,path:l,refresh:re}:null,ie=N??F,ae=e=>(0,H.jsx)(lJ,{error:D,kind:O,isCreating:j===`create-directory`||j===`create-file`,level:e,name:k,onCancel:f,onNameChange:e=>{C(e),S(null)},onSubmit:()=>void h()}),oe=(0,H.jsx)(TJ,{activeRelativePath:e,busy:ee,createTarget:A,entries:i,fallbackParentTarget:F??{label:``,path:t.data?.currentPath??``,refresh:re},mutable:!!l,onAddToChat:a,onCreateFile:_,onCreateFolder:v,onDelete:(e,t)=>void g(e,t),onFileOpen:o,onRevealComplete:m,onRename:b,onRevealPath:s,onSelect:x,onUpload:y,refresh:re,relativePaths:!!a,renderCreateFolder:ae,revealPath:M,selectedPath:P,showRoot:!1,treeRootKey:te||null}),se=(0,H.jsx)(pJ,{currentPath:l,onBlankContext:p,rootDraft:A?.path===l?ae(0):null,showRoot:u,children:oe}),ce=F?EJ({busy:ee,onCollapseAll:()=>{te&&ne(te)},onCreateFile:()=>_(F),onCreateFolder:()=>v(F),onRefresh:()=>void re(),onRevealPath:s,onUpload:()=>y(F),target:F}):[],le=(0,H.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col bg-white`,onContextMenu:e=>{e.target.closest(`[data-workspace-tree-entry]`)||p()},children:[l&&ie?(0,H.jsx)(uJ,{disabled:ee,rootLabel:c,onCollapseAll:()=>{te&&ne(te)},onNewFile:()=>_(ie),onNewFolder:()=>v(ie),onRefresh:()=>void re()}):null,l?(0,H.jsx)(`input`,{ref:E,type:`file`,multiple:!0,className:`sr-only`,"aria-label":T(`chatWorkspaceUploadFiles`),onChange:e=>void w(Array.from(e.currentTarget.files??[]))}):null,se,(0,H.jsx)(n,{})]});return F?(0,H.jsx)(ei,{groups:ce,label:T(`chatWorkspaceRootContextMenu`),children:le}):le}function OJ({activeRelativePath:e=null,browseQuery:t,onFileOpen:n,sessionKey:r,renderStatus:i,showRoot:a=!1}){let o=il(),{confirm:s,ConfirmDialog:c}=An(),l=t.data?.entries??[],u=eJ(t),d=a?t.data?.currentPath??null:null,f=Uq(d),p=Zq(e=>f?e.trees[f]?.expandedPaths??CJ:CJ);SJ((0,V.useMemo)(()=>{if(!d)return[];let e=d.includes(`\\`)&&!d.includes(`/`)?`\\`:`/`,t=d.replace(/[\\/]+$/g,``),n=new Set(p);return[d,...p.filter(e=>{let t=e.split(`/`);return t.slice(0,-1).every((e,r)=>n.has(t.slice(0,r+1).join(`/`)))}).map(n=>`${t}${e}${n.replace(/[\\/]+/g,e)}`)]},[p,d]));let m=d?wJ(d):``,h=bJ({activeRelativePath:e,confirm:s,onEntryDeleted:o.chatThreadManager.removeWorkspacePath,onEntryRenamed:o.chatThreadManager.renameWorkspacePath,rootPath:d}),g=vi.canRevealPath()?e=>{vi.revealPath(e).then(e=>{e.revealed||L.error(T(`chatWorkspaceRevealPathFailed`))})}:void 0,_=r===void 0?void 0:(e,t)=>{(e.kind===`directory`?o.chatComposerIntentManager.requestDirectoryReference:o.chatComposerIntentManager.requestFileReference)({targetSessionKey:r,tokenKey:t,label:e.name})};return t.isLoading&&!t.data?i({text:T(`chatWorkspaceLoadingDirectory`)}):u&&!t.data?i({tone:`error`,text:`${T(`chatWorkspaceDirectoryLoadFailed`)}: ${u}`}):(0,H.jsx)(DJ,{activeRelativePath:e,browseQuery:t,ConfirmDialog:c,controller:h,entries:l,onAddToChat:_,onFileOpen:n,onRevealPath:g,rootLabel:m,rootPath:d,showRoot:a})}function kJ({name:e,kind:t}){return t===`directory`?(0,H.jsx)(Ua,{className:`h-3.5 w-3.5 shrink-0 text-emerald-600`}):(0,H.jsx)(Ah,{fileName:e,size:`compact`})}function AJ({browsePath:e,onBrowsePathChange:t,onClose:n,onFileOpen:r}){let i=Ic({path:e,includeFiles:!0,enabled:!!e}),a=i.error?i.error instanceof Error?i.error.message:String(i.error):null,o=i.data?.entries??[],s=e=>{if(e.kind===`directory`){t(e.path);return}r({path:e.path,label:e.name,viewMode:`preview`}),n()};return(0,H.jsxs)(`div`,{"data-testid":`workspace-breadcrumb-browser`,className:`flex max-h-72 flex-col overflow-hidden`,children:[(0,H.jsx)(`div`,{className:`border-b border-gray-200 px-2 py-1`,children:(0,H.jsx)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-0.5 text-[11px] leading-none text-gray-600`,children:i.data?.breadcrumbs.map((e,n)=>(0,H.jsxs)(V.Fragment,{children:[(0,H.jsx)(`button`,{type:`button`,className:`h-5 rounded-sm px-1 text-left hover:bg-gray-100 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,onClick:()=>t(e.path),children:e.label}),n<i.data.breadcrumbs.length-1?(0,H.jsx)(oa,{className:`h-3 w-3 shrink-0 text-gray-300`}):null]},e.path))})}),(0,H.jsx)(zc,{className:`min-h-0 flex-1 px-1 py-1`,children:i.isLoading?(0,H.jsxs)(`div`,{className:`flex items-center gap-1.5 px-2 py-4 text-[11px] text-gray-500`,children:[(0,H.jsx)(mi,{className:`h-3.5 w-3.5 animate-spin`}),T(`loading`)]}):a?(0,H.jsxs)(`div`,{className:`px-2 py-3 text-[11px] text-rose-600`,children:[T(`pathBrowseFailed`),`: `,a]}):o.length>0?(0,H.jsx)(`div`,{className:`space-y-0.5`,children:o.map(e=>(0,H.jsxs)(`button`,{type:`button`,className:c(`flex h-6 w-full items-center gap-1.5 rounded-sm px-1.5 text-left text-[11px] text-gray-700 transition-colors hover:bg-gray-100 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,e.hidden?`opacity-65`:null),onClick:()=>s(e),children:[(0,H.jsx)(kJ,{kind:e.kind,name:e.name}),(0,H.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.name}),e.kind===`directory`?(0,H.jsx)(oa,{className:`h-3 w-3 shrink-0 text-gray-300`}):null]},e.path))}):(0,H.jsx)(`div`,{className:`px-2 py-4 text-[11px] text-gray-500`,children:T(`emptyDirectory`)})})]})}function jJ({value:e}){return(0,H.jsx)(`span`,{className:`inline-flex h-5 items-center rounded-sm border border-amber-200 bg-amber-50 px-1.5 text-[10px] font-medium leading-none text-amber-700`,children:e})}function MJ({onFileOpen:e,segment:t}){let[n,r]=(0,V.useState)(!1),[i,a]=(0,V.useState)(t.browsePath);return(0,H.jsxs)(Tc,{open:n,onOpenChange:e=>{e&&a(t.browsePath),r(e)},children:[(0,H.jsx)(Ec,{asChild:!0,children:(0,H.jsxs)(`button`,{type:`button`,"aria-current":t.isCurrent?`page`:void 0,className:c(`inline-flex h-5 shrink-0 items-center gap-1 whitespace-nowrap rounded-sm px-1 text-[11px] leading-none transition-colors hover:bg-gray-200/80 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,t.kind===`workspace`?`bg-primary/8 text-primary hover:bg-primary/12`:t.isCurrent?`bg-gray-200/70 text-gray-900`:`text-gray-500`),disabled:!t.browsePath,children:[t.kind===`workspace`?(0,H.jsx)(Ba,{className:`h-3 w-3 shrink-0`}):t.kind===`directory`&&t.isCurrent?(0,H.jsx)(Ua,{className:`h-3 w-3 shrink-0`}):t.isCurrent?(0,H.jsx)(Ah,{fileName:t.label,size:`compact`}):null,(0,H.jsx)(`span`,{children:t.label})]})}),(0,H.jsx)(Oc,{"data-testid":`workspace-breadcrumb-popover`,className:`w-[22rem] rounded-md p-0`,align:`start`,children:(0,H.jsx)(AJ,{browsePath:i,onBrowsePathChange:a,onClose:()=>r(!1),onFileOpen:e})})]})}function NJ({breadcrumb:e,leading:t,onFileOpen:n}){let r=(0,V.useRef)(null);return(0,V.useLayoutEffect)(()=>{let e=r.current;if(!e)return;let t=e.querySelector(`[aria-current="page"]`);if(!t)return;let n=()=>{let n=e.getBoundingClientRect(),r=t.getBoundingClientRect();r.right>n.right?e.scrollLeft+=r.right-n.right:r.left<n.left&&(e.scrollLeft-=n.left-r.left)};if(n(),typeof ResizeObserver>`u`)return;let i=new ResizeObserver(n);return i.observe(e),i.observe(t),()=>i.disconnect()},[e.fullPath]),(0,H.jsxs)(`div`,{"data-testid":`workspace-file-breadcrumbs`,title:e.fullPath,className:`flex min-w-0 items-center border-b border-gray-200/80 bg-gray-50/55`,children:[t?(0,H.jsx)(`div`,{className:`flex h-full shrink-0 items-center pl-1 pr-0.5`,children:t}):null,(0,H.jsxs)(`div`,{ref:r,"data-testid":`workspace-file-breadcrumb-scroll`,className:`workspace-horizontal-scrollbar flex min-w-0 flex-1 items-center gap-2.5 overflow-x-auto overflow-y-hidden px-3 py-1.5`,children:[(0,H.jsx)(`div`,{className:`flex min-w-0 flex-1 items-center gap-1 pr-1`,children:e.segments.map((t,r)=>(0,H.jsxs)(V.Fragment,{children:[(0,H.jsx)(MJ,{segment:t,onFileOpen:n}),r<e.segments.length-1?(0,H.jsx)(oa,{className:`h-3 w-3 shrink-0 text-gray-300`}):null]},t.key))}),e.truncated?(0,H.jsx)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-end gap-1`,children:(0,H.jsx)(jJ,{value:T(`chatWorkspacePreviewTruncated`)})}):null]})]})}var PJ=8e3;function FJ(e){return e.match(/\n/g)?.length??0}function IJ(e){let{label:t,path:n,selectedText:r,sourceStartLine:i=1,sourceText:a}=e,o=n.trim(),s=t.trim(),c=r.trim();if(!o||!s||!c)return null;let l=a.indexOf(c),u=l>=0&&l===a.lastIndexOf(c)?(i??1)+FJ(a.slice(0,l)):null;return{path:o,label:s,excerpt:c,startLine:u,endLine:u===null?null:u+FJ(c)}}function LJ({children:e,fileLabel:t,filePath:n,onAddToChat:r,sourceStartLine:i,sourceText:a}){return(0,H.jsx)(HU,{actionLabel:T(`chatWorkspaceAddToChat`),className:`h-full min-h-0`,maxCharacters:PJ,selectionTooLongLabel:T(`chatWorkspaceExcerptSelectionTooLong`),onAddToChat:({text:e})=>{let o=IJ({path:n,label:t,selectedText:e,sourceText:a,sourceStartLine:i});o&&r?.(o)},children:e})}function RJ(e){let[t,n]=(0,V.useState)(null),r=t?.contentUrl===e?t:null;return(0,V.useEffect)(()=>{let t=new AbortController;return fetch(e,{signal:t.signal}).then(e=>{if(!e.ok)throw Error(`Unable to load document (${e.status}).`);return e.arrayBuffer()}).then(r=>{t.signal.aborted||n({contentUrl:e,status:`ready`,data:r})}).catch(r=>{t.signal.aborted||(console.error(`Failed to load workspace document`,r),n({contentUrl:e,status:`error`,data:null}))}),()=>t.abort()},[e]),{status:r?.status??`loading`,data:r?.data??null}}function zJ({status:e}){return e===`ready`?null:(0,H.jsx)(`div`,{className:`absolute inset-0 z-10 flex items-center justify-center bg-background/90 px-6 text-center text-sm text-muted-foreground`,children:T(e===`loading`?`chatWorkspaceLoadingPreview`:`chatWorkspacePreviewFailed`)})}function BJ(e){let t=Array.from(e.querySelectorAll(`.docx-wrapper > section.docx`)).some(e=>!e.style.width&&!e.style.padding);if(e.classList.toggle(`workspace-docx-preview--reflow`,t),t)for(let t of e.querySelectorAll(`table`)){if(t.querySelectorAll(`col`).length<5)continue;let e=document.createElement(`div`);e.className=`workspace-docx-wide-table`,t.before(e),e.append(t)}}function VJ({contentUrl:e}){let t=(0,V.useRef)(null),n=RJ(e),[r,i]=(0,V.useState)(null),a=r?.contentUrl===e?r.status:`loading`,o=n.status===`ready`?a:n.status;return(0,V.useEffect)(()=>{let r=t.current;if(!r||!n.data)return;let a=!1;return r.replaceChildren(),F(()=>import(`./docx-preview-CoM4JK7_.js`).then(async t=>{await t.renderAsync(n.data,r,r,{breakPages:!0,inWrapper:!0,ignoreLastRenderedPageBreak:!1}),a||(BJ(r),i({contentUrl:e,status:`ready`}))}),__vite__mapDeps([22,4,23])).catch(t=>{a||(console.error(`Failed to render DOCX preview`,t),i({contentUrl:e,status:`error`}))}),()=>{a=!0,r.replaceChildren()}},[e,n.data]),(0,H.jsxs)(`div`,{className:`relative h-full overflow-auto bg-muted/40 p-4 custom-scrollbar`,children:[(0,H.jsx)(zJ,{status:o}),(0,H.jsx)(`div`,{ref:t,className:`workspace-docx-preview min-h-full`,"data-testid":`workspace-content-docx`})]})}function HJ({contentUrl:e}){let t=(0,V.useRef)(null),n=RJ(e),[r,i]=(0,V.useState)(null),a=r?.contentUrl===e?r.status:`loading`,o=n.status===`ready`?a:n.status;return(0,V.useEffect)(()=>{let r=t.current;if(!r||!n.data)return;let a=new AbortController,o=null;return r.replaceChildren(),F(async()=>{let{PptxViewer:e,RECOMMENDED_ZIP_LIMITS:t}=await import(`./aiden0z-pptx-renderer.es-C1nfBAXR.js`);return{PptxViewer:e,RECOMMENDED_ZIP_LIMITS:t}},__vite__mapDeps([24,4,23])).then(async({PptxViewer:t,RECOMMENDED_ZIP_LIMITS:s})=>{if(o=await t.open(n.data,r,{renderMode:`list`,fitMode:`contain`,lazySlides:!0,lazyMedia:!0,pdfjs:!1,scrollContainer:r,signal:a.signal,zipLimits:s,listOptions:{windowed:!0,batchSize:8,initialSlides:4,overscanViewport:1.5}}),a.signal.aborted){o.destroy(),o=null;return}i({contentUrl:e,status:`ready`})}).catch(t=>{a.signal.aborted||(console.error(`Failed to render presentation preview`,t),i({contentUrl:e,status:`error`}))}),()=>{a.abort(),o?.destroy(),r.replaceChildren()}},[e,n.data]),(0,H.jsxs)(`div`,{className:`relative h-full bg-muted/40`,children:[(0,H.jsx)(zJ,{status:o}),(0,H.jsx)(`div`,{ref:t,className:`h-full overflow-auto p-4 custom-scrollbar`,"data-testid":`workspace-content-presentation`})]})}var UJ=500,WJ=100;function GJ(e){let t=``,n=e+1;for(;n>0;)--n,t=String.fromCharCode(65+n%26)+t,n=Math.floor(n/26);return t}function KJ({contentUrl:e}){let t=RJ(e),[n,r]=(0,V.useState)(null),[i,a]=(0,V.useState)(``),o=n?.contentUrl===e?n:null,s=t.status===`ready`?o?.status??`loading`:t.status,l=o?.sheets.find(e=>e.name===i)??o?.sheets[0]??null;return(0,V.useEffect)(()=>{if(!t.data)return;let n=!1;return F(()=>import(`./xlsx-CxByi7bR.js`).then(i=>{let a=i.read(t.data,{dense:!0,sheetRows:UJ+1}),o=a.SheetNames.map(e=>{let t=a.Sheets[e],n=t?i.utils.sheet_to_json(t,{header:1,raw:!1,defval:``,blankrows:!1}):[],r=n.slice(0,UJ).map(e=>e.slice(0,WJ).map(e=>String(e??``)));return{name:e,rows:r,columnCount:Math.min(WJ,r.reduce((e,t)=>Math.max(e,t.length),0)),truncated:n.length>UJ||n.some(e=>e.length>WJ)}});n||r({contentUrl:e,status:`ready`,sheets:o})}),[]).catch(t=>{n||(console.error(`Failed to render spreadsheet preview`,t),r({contentUrl:e,status:`error`,sheets:[]}))}),()=>{n=!0}},[e,t.data]),(0,H.jsxs)(`div`,{className:`relative flex h-full min-h-0 flex-col bg-white`,"data-testid":`workspace-content-spreadsheet`,children:[(0,H.jsx)(zJ,{status:s}),o&&o.sheets.length>1?(0,H.jsx)(`div`,{className:`flex shrink-0 gap-1 overflow-x-auto border-b border-border px-2 py-1.5 custom-scrollbar`,children:o.sheets.map(e=>(0,H.jsx)(`button`,{type:`button`,className:c(`h-7 shrink-0 rounded-md px-2.5 text-xs transition-colors`,e.name===l?.name?`bg-accent font-medium text-accent-foreground`:`text-muted-foreground hover:bg-muted hover:text-foreground`),onClick:()=>a(e.name),children:e.name},e.name))}):null,l?(0,H.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto custom-scrollbar`,children:(0,H.jsxs)(`table`,{className:`min-w-full border-collapse text-xs text-foreground`,children:[(0,H.jsx)(`thead`,{className:`sticky top-0 z-[1] bg-muted`,children:(0,H.jsxs)(`tr`,{children:[(0,H.jsx)(`th`,{className:`sticky left-0 z-[2] h-7 min-w-10 border border-border bg-muted px-2`}),Array.from({length:l.columnCount},(e,t)=>(0,H.jsx)(`th`,{className:`h-7 min-w-24 border border-border px-2 text-center font-medium text-muted-foreground`,children:GJ(t)},t))]})}),(0,H.jsx)(`tbody`,{children:l.rows.map((e,t)=>(0,H.jsxs)(`tr`,{children:[(0,H.jsx)(`th`,{className:`sticky left-0 min-w-10 border border-border bg-muted px-2 text-right font-normal text-muted-foreground`,children:t+1}),Array.from({length:l.columnCount},(t,n)=>(0,H.jsx)(`td`,{className:`max-w-80 whitespace-pre-wrap border border-border px-2 py-1.5 align-top`,children:e[n]??``},n))]},t))})]})}):null,l?.truncated?(0,H.jsx)(`div`,{className:`shrink-0 border-t border-border bg-muted/60 px-3 py-1.5 text-xs text-muted-foreground`,children:T(`chatWorkspaceSpreadsheetPreviewTruncated`)}):null]})}function qJ(e){let t=e.mimeType?.trim().toLowerCase()??``,n=e.path.trim().toLowerCase();return t.startsWith(`image/`)||/\.(avif|bmp|gif|heic|heif|ico|jpe?g|png|svg|tiff?|webp)$/i.test(n)?`image`:t.startsWith(`audio/`)||/\.(aac|flac|m4a|mp3|ogg|opus|wav|weba)$/i.test(n)?`audio`:t.startsWith(`video/`)||/\.(avi|m4v|mkv|mov|mp4|webm|wmv)$/i.test(n)?`video`:t.includes(`pdf`)||n.endsWith(`.pdf`)?`pdf`:t===`application/vnd.openxmlformats-officedocument.wordprocessingml.document`||n.endsWith(`.docx`)?`docx`:t.includes(`spreadsheet`)||t.includes(`excel`)||/\.(ods|xls|xlsb|xlsm|xlsx)$/i.test(n)?`spreadsheet`:t===`application/vnd.openxmlformats-officedocument.presentationml.presentation`||n.endsWith(`.pptx`)?`presentation`:t.includes(`html`)||/\.html?$/i.test(n)?`html`:`other`}function JJ({contentUrl:e,label:t}){return(0,H.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-4 px-6 text-center`,"data-testid":`workspace-content-unsupported`,children:[(0,H.jsxs)(`div`,{className:`max-w-sm space-y-1.5`,children:[(0,H.jsx)(`p`,{className:`truncate text-sm font-medium text-foreground`,title:t,children:t}),(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:T(`chatWorkspacePreviewUnsupported`)}),(0,H.jsx)(`p`,{className:`text-xs leading-5 text-muted-foreground/80`,children:T(`chatWorkspacePreviewUnsupportedHint`)})]}),(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center justify-center gap-2`,children:[(0,H.jsx)(`a`,{href:e,download:t,className:`inline-flex h-8 items-center rounded-lg border border-border bg-card px-3 text-xs font-medium text-foreground transition-colors hover:bg-muted`,children:T(`chatWorkspacePreviewDownload`)}),(0,H.jsx)(`a`,{href:e,target:`_blank`,rel:`noreferrer`,className:`inline-flex h-8 items-center rounded-lg bg-primary px-3 text-xs font-medium text-primary-foreground transition-colors hover:bg-primary/90`,children:T(`chatWorkspacePreviewOpenExternally`)})]})]})}function YJ({contentUrl:e,contentParams:t,label:n,onContentHeightChange:r}){let i=(0,V.useRef)(null),a=(0,V.useRef)(null),o=te(t);(0,V.useEffect)(()=>()=>{a.current?.()},[]);let s=()=>{a.current?.(),a.current=null;let e=i.current;if(!(!e||!r||typeof ResizeObserver>`u`))try{let t=e.contentDocument;if(!t)return;let n=()=>{let e=S(t.body,t.documentElement);e>0&&r(e)},i=new ResizeObserver(n);i.observe(t.documentElement),t.body&&i.observe(t.body),n(),a.current=()=>i.disconnect()}catch{}};return(0,H.jsx)(`iframe`,{ref:i,allowFullScreen:!0,className:`h-full w-full border-0 bg-white`,"data-testid":`workspace-html-preview`,name:o,src:b(e,t),title:n,onLoad:s},o??`no-content-params`)}function XJ({contentUrl:e,contentParams:t,kind:n,label:r,onHtmlContentHeightChange:i}){return n===`image`?(0,H.jsx)(`div`,{className:`flex h-full items-center justify-center overflow-auto bg-white p-4 custom-scrollbar`,children:(0,H.jsx)(`img`,{src:e,alt:r,className:`max-h-full max-w-full object-contain`,"data-testid":`workspace-content-image`})}):n===`audio`?(0,H.jsx)(`div`,{className:`flex h-full items-center justify-center bg-white px-6`,children:(0,H.jsx)(`audio`,{controls:!0,preload:`metadata`,"aria-label":r,className:`w-full max-w-xl`,"data-testid":`workspace-content-audio`,src:e})}):n===`video`?(0,H.jsx)(`div`,{className:`flex h-full items-center justify-center bg-black`,children:(0,H.jsx)(`video`,{controls:!0,playsInline:!0,preload:`metadata`,"aria-label":r,className:`max-h-full max-w-full`,"data-testid":`workspace-content-video`,src:e})}):n===`html`?(0,H.jsx)(YJ,{contentUrl:e,contentParams:t,label:r,onContentHeightChange:i}):n===`pdf`?(0,H.jsx)(`iframe`,{allowFullScreen:!0,className:`h-full w-full border-0 bg-white`,"data-testid":`workspace-content-pdf`,src:e,title:r}):n===`docx`?(0,H.jsx)(VJ,{contentUrl:e}):n===`spreadsheet`?(0,H.jsx)(KJ,{contentUrl:e}):n===`presentation`?(0,H.jsx)(HJ,{contentUrl:e}):(0,H.jsx)(JJ,{contentUrl:e,label:r})}function ZJ(e){return[`server-path-read`,e.path?.trim()??``,e.basePath??null,e.line??null]}function QJ(e){let{basePath:t,enabled:n=!0,line:r,path:i}=e,a=i?.trim()??``;return dn({queryKey:ZJ({path:a,basePath:t,line:r}),queryFn:()=>qt({path:a,basePath:t,line:r}),enabled:n&&a.length>0,staleTime:0})}function $J(e){return e.serverKind?e.serverKind:/\.mdx?$/i.test(e.path)?`markdown`:`text`}function eY(e,t){return t<=0?e:`${e}${e.includes(`?`)?`&`:`?`}refresh=${t}`}function tY(e){let{languageHint:t,path:n,startLine:r,text:i}=e,a=r??1;return{key:`preview:${n}`,path:n,display:`preview`,lines:pG({text:i,kind:`context`,oldStartLine:a,newStartLine:a}),rawText:i,languageHint:t??null,oldStartLine:a,newStartLine:a}}function nY(e){if(Array.isArray(e.fullLines)&&e.fullLines.length>0)return{key:`diff:${e.key}`,path:e.path,display:`diff`,lines:e.fullLines,fullLines:e.fullLines,...e.beforeText?{beforeText:e.beforeText}:{},...e.afterText?{afterText:e.afterText}:{},...e.patchText?{patchText:e.patchText}:{},...typeof e.oldStartLine==`number`?{oldStartLine:e.oldStartLine}:{},...typeof e.newStartLine==`number`?{newStartLine:e.newStartLine}:{}};if(e.beforeText==null&&e.afterText==null)return null;let t=_G({beforeText:e.beforeText??``,afterText:e.afterText??``,oldStartLine:e.oldStartLine??void 0,newStartLine:e.newStartLine??void 0});return{key:`diff:${e.key}`,path:e.path,display:`diff`,lines:t,fullLines:t,...e.beforeText?{beforeText:e.beforeText}:{},...e.afterText?{afterText:e.afterText}:{},...typeof e.oldStartLine==`number`?{oldStartLine:e.oldStartLine}:{},...typeof e.newStartLine==`number`?{newStartLine:e.newStartLine}:{}}}function rY({text:e,tone:t=`muted`}){return(0,H.jsx)(`div`,{className:c(`flex h-full items-center justify-center px-6 text-center text-sm`,t===`error`?`text-rose-600`:`text-gray-500`),children:e})}function iY(e){return e instanceof Pe&&e.code===`SERVER_PATH_NOT_FOUND`?T(`chatWorkspacePreviewNotFound`):T(`chatWorkspacePreviewFailed`)}function aY({diffBlock:e}){return e?(0,H.jsx)(oY,{block:e}):(0,H.jsx)(rY,{text:T(`chatWorkspaceDiffEmpty`)})}function oY({block:e,targetColumn:t,targetLine:n}){return(0,H.jsx)(`div`,{className:`h-full overflow-auto custom-scrollbar bg-white`,children:(0,H.jsx)(GV,{block:e,layout:`workspace`,targetColumn:t,targetLine:n})})}function sY({contentUrl:e,contentUrlKind:t,contentLabel:n,contentParams:r,directoryQuery:i,fileBasePath:a,onFileOpen:o,onHtmlContentHeightChange:s,previewBlock:c,previewKind:l,previewViewer:u,previewQuery:d,previewText:f,targetColumn:p,targetLine:m}){return e&&t?(0,H.jsx)(XJ,{contentUrl:e,contentParams:r??void 0,kind:t,label:n,onHtmlContentHeightChange:s}):i?.data?(0,H.jsx)(OJ,{browseQuery:i,onFileOpen:o,renderStatus:e=>(0,H.jsx)(rY,{...e})}):i?.isLoading&&d?.error&&!c?(0,H.jsx)(rY,{text:T(`chatWorkspaceLoadingDirectory`)}):(i?.isLoading||d?.isLoading)&&!c?(0,H.jsx)(rY,{text:T(`chatWorkspaceLoadingPreview`)}):d?.data?.kind===`binary`?(0,H.jsx)(rY,{text:T(`chatWorkspacePreviewUnsupported`)}):d?.error&&!c?(0,H.jsx)(rY,{tone:`error`,text:iY(d.error)}):l===`markdown`&&u!==`source`&&f?(0,H.jsx)(`div`,{className:`h-full overflow-auto custom-scrollbar px-5 py-4`,children:(0,H.jsx)(SB,{text:f,role:`assistant`,texts:{copyCodeLabel:T(`chatCodeCopy`),copiedCodeLabel:T(`chatCodeCopied`)},onFileOpen:o,resolveFileContentUrl:e=>sn(e.path,a)})}):c?(0,H.jsx)(oY,{block:c,targetColumn:p,targetLine:m}):(0,H.jsx)(rY,{text:T(`chatWorkspacePreviewEmpty`)})}function cY({breadcrumbLeading:e,file:t,refreshVersion:n=0,sessionProjectRoot:r,sessionWorkingDir:i,showBreadcrumbs:a=!0,onHtmlContentHeightChange:o,onFileOpen:s,onTextExcerptAdd:c}){let l=t.viewMode===`preview`,u=t.contentUrl?.trim()||null,d=l&&!u,f=QJ({path:t.path,basePath:i,line:t.line,enabled:d}),p=Ic({path:t.path,basePath:i,includeFiles:!0,enabled:d}),m=(0,V.useMemo)(()=>t.viewMode===`diff`?nY(t):null,[t]),h=l?f?.data?.text??t.rawText??null:null,g=$J({path:f?.data?.resolvedPath??t.path,serverKind:f?.data?.kind}),_=u?qJ({path:t.path,mimeType:t.mimeType}):null,v=p?.data?.currentPath??f?.data?.resolvedPath??t.path,y=p?.data?`directory`:`file`,b=Bd(v,t.previewViewer),x=qJ({path:v}),S=sn(t.path,i),C=!u&&l&&S&&t.previewViewer!==`source`&&x!==`other`&&(x!==`html`||b===`rendered`)&&S?eY(S,n):null,w=u??C,T=_??(C?x:null),E=(0,V.useMemo)(()=>!l||!h||w?null:tY({path:f?.data?.resolvedPath??t.path,text:h,languageHint:f?.data?.languageHint??null,startLine:f?.data?.startLine??1}),[w,t.path,l,f?.data?.languageHint,f?.data?.resolvedPath,f?.data?.startLine,h]),D=!w&&!!f?.data?.truncated,O=r??i,k=Tl({path:v,sessionProjectRoot:O})??v.trim(),A=(0,V.useMemo)(()=>Dl({path:v,kind:y,sessionProjectRoot:O,truncated:D}),[O,D,y,v]),j=(0,H.jsx)(sY,{contentUrl:w,contentUrlKind:T,contentLabel:t.label?.trim()||v,contentParams:t.params,directoryQuery:p,fileBasePath:i,onFileOpen:s,onHtmlContentHeightChange:o,previewBlock:E,previewKind:g,previewViewer:b,previewQuery:f,previewText:h,targetColumn:t.column,targetLine:t.line});return(0,H.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col bg-white`,children:[a?(0,H.jsx)(NJ,{breadcrumb:A,leading:e,onFileOpen:s}):null,(0,H.jsx)(`div`,{className:`flex-1 min-h-0 overflow-hidden`,children:t.viewMode===`diff`?(0,H.jsx)(aY,{diffBlock:m}):k&&h?(0,H.jsx)(LJ,{fileLabel:t.label?.trim()||k.split(`/`).at(-1)||k,filePath:k,sourceStartLine:f?.data?.startLine??1,sourceText:h,onAddToChat:c,children:j}):j})]})}var lY=240;function uY({actions:e,children:t,contentHeight:n,isLoading:r=!1}){return(0,H.jsxs)(`section`,{className:`group/inline-content relative my-2 w-full max-w-[48rem] overflow-visible`,"data-chat-inline-content-surface":`true`,"data-chat-message-wide-content":`true`,children:[e?(0,H.jsx)(`div`,{className:c(`pointer-events-none absolute bottom-full left-1/2 z-10 -translate-x-1/2 pb-2 opacity-0 transition-opacity duration-150`,`group-hover/inline-content:pointer-events-auto group-hover/inline-content:opacity-100 group-focus-within/inline-content:pointer-events-auto group-focus-within/inline-content:opacity-100`),"data-chat-inline-content-actions":`true`,children:(0,H.jsx)(`div`,{className:`flex items-center gap-0.5 rounded-lg bg-background/95 p-0.5 shadow-md ring-1 ring-border/60 backdrop-blur-sm`,"data-chat-inline-content-actions-surface":`true`,children:e})}):null,(0,H.jsx)(`div`,{className:c(`h-[240px] min-h-[240px] max-h-[min(90vh,1440px)] overflow-hidden rounded-lg`,r&&`animate-pulse bg-muted/45`),"data-chat-inline-content-viewport":`true`,style:n?{height:Math.max(lY,n)}:void 0,children:t})]})}function dY({display:e,parentSessionKey:t,sessionProjectRoot:n,sessionWorkingDir:r,onFileOpen:i}){let[a,o]=(0,V.useState)(null);if(e.target.type!==`file`)return null;let{path:s,line:c,column:l,params:u,viewer:d}=e.target.payload,f=Ud({path:s,label:e.title,viewMode:`preview`,previewViewer:d,line:c,column:l,params:u},t);if(!f)return null;let p=f.label??f.path.split(/[\\/]/).filter(Boolean).pop()??f.path,m=f.previewViewer===`rendered`&&/\.html?$/i.test(f.path),h=e=>{i({path:f.path,label:f.label??void 0,viewMode:`preview`,previewViewer:e,line:f.line??void 0,column:f.column??void 0,params:f.params??void 0})};return m?(0,H.jsx)(uY,{actions:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(B,{size:`sm`,icon:(0,H.jsx)(Kr,{className:`h-3.5 w-3.5`}),label:T(`chatPanelCardExpand`),tooltipSide:`top`,onClick:()=>h(`rendered`)}),(0,H.jsx)(B,{size:`sm`,icon:(0,H.jsx)(ga,{className:`h-3.5 w-3.5`}),label:T(`chatWorkspaceOpenSource`),tooltipSide:`top`,onClick:()=>h(`source`)})]}),contentHeight:a,children:(0,H.jsx)(cY,{file:f,sessionProjectRoot:n,sessionWorkingDir:r,showBreadcrumbs:!1,onHtmlContentHeightChange:o,onFileOpen:i})}):(0,H.jsxs)(`section`,{className:`my-2 w-full max-w-[48rem] overflow-hidden rounded-lg border border-border bg-card shadow-sm`,"data-chat-inline-file-preview":`true`,"data-chat-message-wide-content":`true`,children:[(0,H.jsxs)(`header`,{className:`border-b border-border bg-muted/45 px-3 py-2`,children:[(0,H.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 text-xs font-medium text-foreground`,children:[(0,H.jsx)(wn,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`,"aria-hidden":!0}),(0,H.jsx)(`span`,{className:`truncate`,children:p})]}),(0,H.jsx)(`p`,{className:`mt-1 truncate font-mono text-[11px] font-normal text-muted-foreground`,title:f.path,children:f.path})]}),(0,H.jsx)(`div`,{className:`h-[420px] min-h-[240px] max-h-[min(60vh,420px)] overflow-hidden`,children:(0,H.jsx)(cY,{file:f,sessionProjectRoot:n,sessionWorkingDir:r,showBreadcrumbs:!1,onFileOpen:i})})]})}function fY({deletePending:e,entry:t,favoritePending:n,onDelete:r,onOpen:i,onToggleFavorite:a}){let[o,s]=(0,V.useState)(!1),[c,l]=(0,V.useState)(!1),u=t.favorite?T(`panelAppsUnfavorite`):T(`panelAppsFavorite`),d=t.lastOpenedAt?`${T(`panelAppsLastOpened`)} ${mY(t.lastOpenedAt)}`:`${T(`panelAppsUpdated`)} ${mY(t.updatedAt)}`,f=e=>{e.stopPropagation(),a()},p=()=>{s(!1),l(!0)};return(0,H.jsxs)(`div`,{className:`group w-full min-w-0 rounded-lg border border-border/60 bg-card px-2.5 py-2.5 transition-colors hover:bg-muted/40`,children:[(0,H.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2`,children:[(0,H.jsxs)(`button`,{type:`button`,onClick:i,className:`min-w-0 flex-1 text-left`,children:[(0,H.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,H.jsx)(`span`,{className:`flex h-7 w-7 shrink-0 items-center justify-center rounded-md bg-muted text-base text-muted-foreground`,children:(0,H.jsx)(hY,{icon:t.icon,title:t.title})}),(0,H.jsx)(`span`,{className:`block min-w-0 flex-1 truncate text-sm font-medium text-foreground`,children:t.title})]}),t.description?(0,H.jsx)(`span`,{className:`mt-1.5 block truncate text-xs leading-5 text-muted-foreground`,children:t.description}):null,(0,H.jsx)(`span`,{className:`mt-0.5 block truncate text-[11px] leading-4 text-muted-foreground/70`,children:d})]}),(0,H.jsxs)(`div`,{className:`flex shrink-0 items-center gap-0.5 opacity-70 transition-opacity group-hover:opacity-100`,children:[(0,H.jsx)(`button`,{type:`button`,onClick:f,disabled:n,className:`rounded-md p-1.5 text-muted-foreground/70 transition-colors hover:bg-muted hover:text-foreground disabled:opacity-50`,title:u,"aria-label":u,children:(0,H.jsx)(Go,{className:t.favorite?`h-4 w-4 fill-current text-foreground`:`h-4 w-4`})}),(0,H.jsxs)(Tc,{open:o,onOpenChange:s,children:[(0,H.jsx)(Ec,{asChild:!0,children:(0,H.jsx)(`button`,{type:`button`,className:`rounded-md p-1.5 text-muted-foreground/70 transition-colors hover:bg-muted hover:text-foreground`,"aria-label":T(`panelAppsMoreActions`),disabled:e,children:(0,H.jsx)(ui,{className:`h-4 w-4`})})}),(0,H.jsx)(Oc,{align:`end`,className:`w-48 rounded-xl p-1.5`,children:(0,H.jsx)(pY,{destructive:!0,disabled:e,icon:Yo,label:T(`panelAppsDelete`),onClick:p})})]})]})]}),(0,H.jsx)(Ur,{open:c,onOpenChange:l,title:T(`panelAppsDeleteConfirmTitle`),description:`${T(`panelAppsDeleteConfirmDescription`)} ${t.fileName}`,confirmLabel:T(`delete`),variant:`destructive`,onConfirm:r,onCancel:()=>void 0})]})}function pY({destructive:e=!1,disabled:t=!1,icon:n,label:r,onClick:i}){return(0,H.jsxs)(`button`,{type:`button`,className:c(`flex w-full items-center gap-2 rounded-lg px-2.5 py-2 text-left text-sm transition-colors disabled:cursor-not-allowed disabled:opacity-50`,e?`text-destructive hover:bg-destructive/10`:`text-muted-foreground hover:bg-[var(--interaction-hover)] hover:text-accent-foreground`),disabled:t,onClick:i,children:[(0,H.jsx)(n,{className:`h-4 w-4 shrink-0`}),(0,H.jsx)(`span`,{children:r})]})}function mY(e){let t=new Date(e);if(Number.isNaN(t.getTime()))return e;let n=M(A()),r=new Date;return t.toDateString()===r.toDateString()?new Intl.DateTimeFormat(n,{hour:`2-digit`,minute:`2-digit`}).format(t):t.getFullYear()===r.getFullYear()?new Intl.DateTimeFormat(n,{month:`numeric`,day:`numeric`}).format(t):new Intl.DateTimeFormat(n,{year:`2-digit`,month:`numeric`,day:`numeric`}).format(t)}function hY({icon:e,title:t}){return e?gY(e)?(0,H.jsx)(`img`,{src:e,alt:``,"aria-hidden":`true`,className:`h-5 w-5 rounded-sm object-contain`,title:t}):(0,H.jsx)(`span`,{className:`max-w-6 truncate text-center leading-none`,children:e}):(0,H.jsx)(Gr,{className:`h-4 w-4`})}function gY(e){return e.startsWith(`data:image/`)||e.startsWith(`http://`)||e.startsWith(`https://`)||e.startsWith(`/`)}var _Y=[`panel-apps`];function vY(e={}){return dn({queryKey:_Y,queryFn:()=>I.panelApps.listPanelApps(),enabled:e.enabled??!0,staleTime:0})}function yY(){let e=yn();return zt({mutationFn:({id:e,preferences:t})=>I.panelApps.updatePanelAppPreferences(e,t),onSuccess:()=>{e.invalidateQueries({queryKey:_Y})}})}function bY(){let e=yn();return zt({mutationFn:e=>I.panelApps.recordPanelAppOpened(e),onSuccess:()=>{e.invalidateQueries({queryKey:_Y})}})}function xY(){let e=yn();return zt({mutationFn:e=>I.panelApps.grantClient(e),onSuccess:()=>{e.invalidateQueries({queryKey:_Y})}})}function SY(){let e=yn();return zt({mutationFn:e=>I.panelApps.deletePanelApp(e),onSuccess:()=>{e.invalidateQueries({queryKey:_Y})}})}function CY(e,t){return t===`favorites`?wY(e.filter(e=>e.favorite),`smart`):wY(t===`recent-open`?e.filter(e=>e.lastOpenedAt):e,t)}function wY(e,t){return[...e].sort((e,n)=>TY(e,n,t))}function TY(e,t,n){return n===`recent-open`?kY(e.lastOpenedAt,t.lastOpenedAt)||EY(e,t):n===`updated`?kY(e.updatedAt,t.updatedAt)||EY(e,t):n===`name`?EY(e,t):DY(e,t)||Number(t.favorite)-Number(e.favorite)||EY(e,t)}function EY(e,t){return e.title.localeCompare(t.title)}function DY(e,t){return OY(t)-OY(e)}function OY(e){return Math.max(new Date(e.lastOpenedAt??0).getTime(),new Date(e.createdAt).getTime(),new Date(e.updatedAt).getTime())}function kY(e,t){return new Date(t??0).getTime()-new Date(e??0).getTime()}var AY=V.createContext(null);function jY({defaultValue:e,value:t,onValueChange:n,children:r}){return(0,H.jsx)(AY.Provider,{value:{value:t,onValueChange:n},children:r})}function MY({children:e,className:t}){return(0,H.jsx)(`div`,{role:`tablist`,onKeyDown:e=>{if(![`ArrowLeft`,`ArrowRight`,`Home`,`End`].includes(e.key))return;let t=Array.from(e.currentTarget.querySelectorAll(`[role="tab"]:not(:disabled)`));if(t.length===0)return;let n=t.indexOf(document.activeElement),r=e.key===`Home`?0:e.key===`End`?t.length-1:e.key===`ArrowRight`?(Math.max(n,-1)+1)%t.length:(n<=0?t.length:n)-1;e.preventDefault(),t[r]?.focus(),t[r]?.click()},className:c(`inline-flex h-9 items-center justify-center rounded-xl bg-muted p-1 text-muted-foreground`,t),children:e})}function NY({value:e,children:t,className:n}){let r=V.useContext(AY);if(!r)throw Error(`TabsTrigger must be used within Tabs`);let i=r.value===e;return(0,H.jsx)(`button`,{type:`button`,onClick:()=>r.onValueChange(e),role:`tab`,"aria-selected":i,tabIndex:i?0:-1,"data-state":i?`active`:`inactive`,className:c(`inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-[13px] 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`,i?`bg-card text-foreground shadow-sm`:`text-muted-foreground hover:bg-[var(--interaction-hover)] hover:text-accent-foreground`,n),children:t})}function PY({value:e,children:t,className:n}){let r=V.useContext(AY);if(!r)throw Error(`TabsContent must be used within Tabs`);return r.value===e?(0,H.jsx)(`div`,{className:c(`mt-2 animate-fade-in`,n),children:t}):null}var FY=[];function IY({onOpenPanelApp:e}){let t=vY(),n=SY(),r=yY(),i=bY(),a=xY(),o=q9(),s=oe(),[c,l]=(0,V.useState)(`smart`),u=t.data?.entries??FY,d=(0,V.useMemo)(()=>CY(u,c),[u,c]),f=async t=>{if(await p(t))try{e(await i.mutateAsync(t.id))}catch{e(t)}},p=async e=>!e.clientDeclared||e.clientGranted?!0:await o.serviceActionAuthorizationManager.requestAuthorization({panelAppId:e.appId,actions:[{actionId:`nextclaw.client`,actionTitle:T(`panelAppsClientGrantTitle`),actionDescription:T(`panelAppsClientGrantDescription`),risk:`dangerous`}]})?(await a.mutateAsync(e.appId),!0):!1,m=e=>{r.mutate({id:e.id,preferences:{favorite:!e.favorite}})},h=e=>{n.mutate(e.id)},g=()=>{s(`/chat`),o.chatDraftIntentManager.requestDraft(T(`panelAppsExamplePrompt`))};return t.isLoading?(0,H.jsx)(`div`,{className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:T(`panelAppsLoading`)}):t.isError?(0,H.jsx)(`div`,{className:`p-4 text-sm text-rose-600`,children:t.error instanceof Error?t.error.message:T(`panelAppsLoadFailed`)}):(0,H.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col bg-card text-card-foreground`,children:[(0,H.jsxs)(`div`,{className:`flex min-h-12 shrink-0 items-center justify-end gap-2 border-b border-border/70 px-4 py-2`,children:[(0,H.jsx)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:t.data?.panelsPath?(0,H.jsx)(ti,{delayDuration:250,children:(0,H.jsxs)(oi,{children:[(0,H.jsx)(si,{asChild:!0,children:(0,H.jsx)(`button`,{type:`button`,className:`rounded p-0.5 text-muted-foreground/70 transition-colors hover:bg-[var(--interaction-hover)] hover:text-accent-foreground`,"aria-label":T(`panelAppsTitle`),children:(0,H.jsx)(ua,{className:`h-3.5 w-3.5`})})}),(0,H.jsx)(Yr,{side:`bottom`,className:`max-w-[320px] break-all font-mono text-xs`,children:t.data.panelsPath})]})}):null}),(0,H.jsx)(`button`,{type:`button`,onClick:()=>void t.refetch(),className:`rounded-md p-1.5 text-muted-foreground transition-colors hover:bg-[var(--interaction-hover)] hover:text-accent-foreground`,title:T(`panelAppsRefresh`),"aria-label":T(`panelAppsRefresh`),children:(0,H.jsx)(gi,{className:`h-3.5 w-3.5`})})]}),(0,H.jsx)(`div`,{className:`border-b border-border/70 px-3 py-2`,children:(0,H.jsx)(jY,{value:c,onValueChange:e=>l(e),children:(0,H.jsxs)(MY,{className:`grid h-auto w-full grid-cols-5 rounded-lg bg-muted/70 p-0.5`,children:[(0,H.jsx)(NY,{value:`smart`,className:`px-2 py-1 text-xs`,children:T(`panelAppsSortSmart`)}),(0,H.jsx)(NY,{value:`favorites`,className:`px-2 py-1 text-xs`,children:T(`panelAppsFavorites`)}),(0,H.jsx)(NY,{value:`recent-open`,className:`px-2 py-1 text-xs`,children:T(`panelAppsSortRecentOpen`)}),(0,H.jsx)(NY,{value:`updated`,className:`px-2 py-1 text-xs`,children:T(`panelAppsSortUpdated`)}),(0,H.jsx)(NY,{value:`name`,className:`px-2 py-1 text-xs`,children:T(`panelAppsSortName`)})]})})}),u.length===0?(0,H.jsx)(LY,{panelsPath:t.data?.panelsPath,onCreateExample:g,onRefresh:()=>void t.refetch()}):d.length===0?(0,H.jsx)(`div`,{className:`flex flex-1 items-center justify-center px-6 text-center text-sm text-muted-foreground`,children:T(`panelAppsEmptyFiltered`)}):(0,H.jsx)(`div`,{className:`custom-scrollbar min-h-0 flex-1 overflow-y-auto p-3`,children:(0,H.jsx)(`div`,{className:`space-y-1.5`,children:d.map(e=>(0,H.jsx)(fY,{entry:e,deletePending:n.isPending,favoritePending:r.isPending,onDelete:()=>h(e),onOpen:()=>void f(e),onToggleFavorite:()=>m(e)},e.id))})})]})}function LY({onCreateExample:e,panelsPath:t,onRefresh:n}){return(0,H.jsx)(`div`,{className:`flex flex-1 items-center justify-center overflow-y-auto px-5 py-6 text-center`,children:(0,H.jsxs)(`div`,{className:`w-full max-w-sm`,children:[(0,H.jsx)(`div`,{className:`mx-auto flex h-10 w-10 items-center justify-center rounded-lg bg-primary/10 text-primary`,children:(0,H.jsx)(Gr,{className:`h-5 w-5`})}),(0,H.jsx)(`h2`,{className:`mt-3 text-sm font-semibold text-foreground`,children:T(`panelAppsEmptyTitle`)}),(0,H.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-muted-foreground`,children:T(`panelAppsEmptyDescription`)}),(0,H.jsxs)(`div`,{className:`mt-4 space-y-2 text-left`,children:[(0,H.jsx)(RY,{icon:(0,H.jsx)(uo,{className:`h-4 w-4`}),title:T(`panelAppsEmptyAskTitle`),description:T(`panelAppsEmptyAskDescription`),actionLabel:T(`panelAppsEmptyAskAction`),onAction:e}),(0,H.jsx)(RY,{icon:(0,H.jsx)(ka,{className:`h-4 w-4`}),title:T(`panelAppsEmptyFileTitle`),description:T(`panelAppsEmptyFileDescription`)})]}),t?(0,H.jsxs)(`div`,{className:`mt-4 rounded-md bg-muted/60 px-3 py-2 text-left`,children:[(0,H.jsx)(`div`,{className:`text-[11px] font-medium uppercase text-muted-foreground/70`,children:T(`panelAppsPanelsPath`)}),(0,H.jsx)(`code`,{className:`mt-1 block break-all text-xs text-muted-foreground`,children:t})]}):null,(0,H.jsxs)(`button`,{type:`button`,onClick:n,className:`mt-4 inline-flex items-center justify-center gap-1.5 rounded-md border border-border px-3 py-1.5 text-xs 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`,children:[(0,H.jsx)(gi,{className:`h-3.5 w-3.5`}),T(`panelAppsRefresh`)]})]})})}function RY({actionLabel:e,description:t,icon:n,onAction:r,title:i}){let a=(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`div`,{className:`mt-0.5 text-muted-foreground`,children:n}),(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsx)(`div`,{className:`text-xs font-medium text-foreground`,children:i}),(0,H.jsx)(`div`,{className:`mt-0.5 text-xs leading-5 text-muted-foreground`,children:t}),e?(0,H.jsx)(`div`,{className:`mt-2 text-xs font-medium text-primary`,children:e}):null]})]});return r?(0,H.jsx)(`button`,{type:`button`,onClick:r,className:`flex w-full gap-2 rounded-md bg-muted/60 px-3 py-2.5 text-left transition-colors hover:bg-[var(--interaction-hover)] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,children:a}):(0,H.jsx)(`div`,{className:`flex gap-2 rounded-md bg-muted/60 px-3 py-2.5`,children:a})}var zY=class{constructor(e){this.authorizationManager=e,this.handleIframeMessage=({event:e,iframe:t,iframeInstanceId:n,tab:r})=>{this.isBridgeRequest(e.data)&&(!t?.contentWindow||e.source!==t.contentWindow||this.handleBridgeRequest({event:e,iframe:t,iframeInstanceId:n,tab:r},e.data))},this.handleBridgeRequest=async(e,t)=>{try{let n=this.getBridgeContext(t),r=await this.dispatchRequest(n,t);this.postResponse(e,{type:`nextclaw:panel-app-service-actions:response`,requestId:t.requestId,ok:!0,data:r})}catch(n){this.postResponse(e,{type:`nextclaw:panel-app-service-actions:response`,requestId:t.requestId,ok:!1,error:this.toBridgeError(n)})}},this.dispatchRequest=async(e,t)=>{switch(t.method){case`list`:return await I.serviceApps.listServiceActions({bridgeSessionToken:e.token});case`requestGrant`:return await this.confirmAndGrant(e,this.requireActionId(t));case`revokeGrant`:return await I.serviceApps.revokeServiceAction(this.requireActionId(t),{bridgeSessionToken:e.token});case`invoke`:return await this.invokeWithAuthorization(e,t);case`agent.send`:return await this.sendAgentMessageWithAuthorization(e,t);case`agent.generateObject`:return await this.generateAgentObjectWithAuthorization(e,t);default:throw Error(`Unsupported panel bridge method: ${String(t.method)}`)}},this.invokeWithAuthorization=async(e,t)=>{let n=this.requireActionId(t);try{return await I.serviceApps.invokeServiceAction(n,this.readOptionalRecord(t.payload?.input),{bridgeSessionToken:e.token})}catch(r){if(!(r instanceof Pe)||r.code!==`AUTHORIZATION_REQUIRED`)throw r;return await this.confirmAndGrant(e,n,this.readOptionalRecord(t.payload?.input)),await I.serviceApps.invokeServiceAction(n,this.readOptionalRecord(t.payload?.input),{bridgeSessionToken:e.token})}},this.sendAgentMessageWithAuthorization=async(e,t)=>{try{return await I.panelApps.sendAgentMessage(this.readAgentSendRequest(t),{bridgeSessionToken:e.token})}catch(n){if(!(n instanceof Pe)||n.code!==`AUTHORIZATION_REQUIRED`)throw n;return await this.confirmAndGrantAgentCapability(e,`agent:send`),await I.panelApps.sendAgentMessage(this.readAgentSendRequest(t),{bridgeSessionToken:e.token})}},this.generateAgentObjectWithAuthorization=async(e,t)=>{try{return await I.panelApps.generateAgentObject(this.readGenerateObjectRequest(t),{bridgeSessionToken:e.token})}catch(n){if(!(n instanceof Pe)||n.code!==`AUTHORIZATION_REQUIRED`)throw n;return await this.confirmAndGrantAgentCapability(e,`agent:generateObject`),await I.panelApps.generateAgentObject(this.readGenerateObjectRequest(t),{bridgeSessionToken:e.token})}},this.confirmAndGrantAgentCapability=async(e,t)=>{if(!await this.authorizationManager.requestAuthorization({panelAppId:e.appId,actions:[{actionId:t,actionTitle:t===`agent:send`?`Send agent message`:`Generate object`,actionDescription:t===`agent:send`?`Send a message to a NextClaw Agent session.`:`Send context to a NextClaw Agent session and receive a structured object.`,risk:`write`}]}))throw new Pe({code:`AUTHORIZATION_REJECTED`,message:`Permission rejected for ${t}.`});return await I.panelApps.grantAgentCapability(t,{bridgeSessionToken:e.token})},this.confirmAndGrant=async(e,t,n)=>{let r=await this.listGrantCandidateActions(e,t);if(!await this.authorizationManager.requestAuthorization({panelAppId:e.appId,actions:r.map(e=>({actionId:e.id,actionTitle:e.title,actionDescription:e.description,risk:e.risk})),inputPreview:this.createInputPreview(n)}))throw new Pe({code:`AUTHORIZATION_REJECTED`,message:`Permission rejected for ${t}.`});let i=await I.serviceApps.grantServiceActions(r.map(e=>e.id),{bridgeSessionToken:e.token}),a=i.grants.find(e=>e.actionId===t)??i.grants[0];if(!a)throw Error(`No permission grant returned for ${t}.`);return a},this.listGrantCandidateActions=async(e,t)=>{let n=await I.serviceApps.listServiceActions({bridgeSessionToken:e.token}),r=n.actions.find(e=>e.id===t);if(r&&r.grantState!==`not-granted`)return[r];let i=n.actions.filter(e=>e.grantState===`not-granted`),a=[...i.filter(e=>e.id===t),...i.filter(e=>e.id!==t)];return a.length>0?a:[{appId:r?.appId??t.split(`.`)[0]??t,description:r?.description,id:t,name:r?.name??t,risk:r?.risk??`dangerous`,title:r?.title}]},this.createInputPreview=e=>{if(!(!e||Object.keys(e).length===0))try{let t=JSON.stringify(e,null,2);return t.length>500?`${t.slice(0,500)}...`:t}catch{return`[unserializable input]`}},this.getBridgeContext=e=>({appId:e.appId,token:e.runtimeToken}),this.requireActionId=e=>{let t=e.payload?.actionId?.trim();if(!t)throw Error(`Panel bridge actionId is required.`);return t},this.readOptionalRecord=e=>{if(e!==void 0)return this.requireRecord(e,`input`)},this.readAgentSendRequest=e=>({payload:this.requireRecord(e.payload?.request,`agent.send request`)}),this.readGenerateObjectRequest=e=>({input:this.requireRecord(e.payload?.input,`generateObject input`)}),this.requireRecord=(e,t)=>{if(!e||typeof e!=`object`||Array.isArray(e))throw Error(`${t} is required.`);return e},this.postResponse=(e,t)=>{e.iframe?.contentWindow?.postMessage(t,`*`)},this.toBridgeError=e=>e instanceof Pe?{code:e.code,message:e.message,details:e.details}:{message:e instanceof Error?e.message:String(e)},this.isBridgeRequest=e=>{if(!e||typeof e!=`object`)return!1;let t=e;return t.type===`nextclaw:panel-app-service-actions:request`&&typeof t.requestId==`string`&&typeof t.runtimeToken==`string`&&typeof t.appId==`string`&&(t.method===`invoke`||t.method===`agent.send`||t.method===`agent.generateObject`||t.method===`list`||t.method===`requestGrant`||t.method===`revokeGrant`)}}};function BY(e,t){let n=t.trim();return[e.id,e.appId,e.fileName,e.title].some(e=>e.trim()===n)}function VY(e,t){let n=t.trim();return n?e.find(e=>BY(e,n))??null:null}var HY=`allow-scripts allow-forms allow-modals allow-popups allow-popups-to-escape-sandbox allow-downloads allow-pointer-lock allow-presentation`;function UY(e){e?.focus({preventScroll:!0}),e?.contentWindow?.focus()}function WY({className:e,icon:t,name:n}){let[r,i]=(0,V.useState)(),a=GY(t),o=r===t;return(0,H.jsx)(`span`,{className:c(`relative flex h-11 w-11 shrink-0 items-center justify-center overflow-hidden rounded-[13px] bg-gradient-to-br from-violet-500/15 via-primary/10 to-emerald-500/15 text-sm font-semibold text-foreground ring-1 ring-black/[0.04] dark:ring-white/[0.06]`,e),children:a&&!o?(0,H.jsx)(`img`,{src:t,alt:``,className:`h-full w-full object-cover`,onError:()=>i(t)}):t&&!a?(0,H.jsx)(`span`,{className:`text-base leading-none`,"aria-hidden":`true`,children:t}):(0,H.jsx)(`span`,{"aria-hidden":`true`,children:KY(n)})})}function GY(e){return!!e&&(e.startsWith(`data:`)||e.startsWith(`/`)||e.startsWith(`http://`)||e.startsWith(`https://`))}function KY(e){return[...e.trim()][0]?.toLocaleUpperCase()??`A`}function qY({accentColor:e,className:t,coverPreview:n,coverUrl:r,name:i}){let[a,o]=(0,V.useState)(),s=r&&a!==r?r:void 0;return(0,H.jsx)(`span`,{className:c(`relative block aspect-[8/5] overflow-hidden rounded-2xl bg-muted ring-1 ring-black/[0.05] dark:ring-white/[0.07]`,t),style:{"--app-accent":e??`#78716c`},children:s?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`img`,{src:s,alt:`${i} app cover`,className:`h-full w-full object-cover transition-transform duration-500 group-hover:scale-[1.015]`,loading:`lazy`,onError:()=>o(s)}),null]}):(0,H.jsx)(`span`,{"aria-label":`${i} 暂无封面`,className:`flex h-full w-full items-center justify-center bg-[radial-gradient(circle_at_30%_25%,color-mix(in_srgb,var(--app-accent)_28%,transparent),transparent_50%),linear-gradient(145deg,var(--muted),var(--background))]`,children:(0,H.jsx)(`span`,{className:`flex h-14 w-14 items-center justify-center rounded-2xl bg-background/65 text-xl font-semibold text-foreground/65 shadow-sm ring-1 ring-black/[0.05] backdrop-blur-sm`,children:JY(i)})})})}function JY(e){let t=e.trim().split(/\s+/).filter(Boolean);return t.length>1?t.slice(0,2).map(e=>e[0]).join(``).toLocaleUpperCase():[...t[0]??`?`].slice(0,1).join(``).toLocaleUpperCase()}function YY({active:e,canUpdate:t,failed:n,installed:r,isStarting:i,onAction:a,operation:o}){return(0,H.jsx)(R,{type:`button`,size:`sm`,variant:r&&!t||e?`secondary`:`default`,disabled:r&&!t||e||i,onClick:a,className:`shrink-0 rounded-full px-4`,children:r&&!t?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Tr,{className:`mr-1.5 h-3.5 w-3.5`}),T(`appPackagesMarketplaceInstalled`)]}):e||i?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(mi,{className:`mr-1.5 h-3.5 w-3.5 animate-spin`}),o?QY(o):T(`appPackagesPreparing`)]}):T(t?`appPackagesUpdate`:n?`appPackagesRetry`:`appPackagesInstall`)})}function XY({operation:e}){let t=Math.max(4,Math.round(e.completedSteps/e.totalSteps*100)),n=e.status===`failed`||e.status===`interrupted`;return(0,H.jsxs)(`div`,{className:`mt-2`,role:n?`alert`:`status`,"aria-live":`polite`,children:[(0,H.jsx)(`div`,{className:`h-1 overflow-hidden rounded-full bg-muted`,children:(0,H.jsx)(`div`,{className:c(`h-full rounded-full transition-[width] duration-300`,n?`bg-destructive`:`bg-primary`),style:{width:n?`100%`:`${t}%`}})}),(0,H.jsx)(`p`,{className:c(`mt-1.5 truncate text-[11px]`,n?`text-destructive`:`text-muted-foreground`),children:n?e.error??T(`appPackagesActionFailed`):QY(e)})]})}function ZY(e,t,n){return e.find(e=>e.appId===t||e.source===n)}function QY(e){switch(e.status){case`queued`:return T(`appPackagesPreparing`);case`resolving`:return T(`appPackagesResolving`);case`downloading`:return T(`appPackagesDownloading`);case`verifying`:return T(`appPackagesVerifying`);case`installing`:return e.action===`rollback`?T(`appPackagesSwitchingVersion`):e.action===`uninstall`?T(`appPackagesUninstalling`):T(`appPackagesInstalling`);case`finalizing`:return T(`appPackagesFinalizing`);case`succeeded`:return T(`appPackagesCompleted`);case`failed`:case`interrupted`:return T(`appPackagesActionFailed`)}}function $Y({checked:e,description:t,destructive:n=!1,disabled:r=!1,label:i,onClick:a}){return(0,H.jsxs)(`button`,{type:`button`,"aria-pressed":e,"aria-disabled":r,disabled:r,onClick:a,className:c(`flex items-start gap-3 rounded-xl border px-3 py-3 text-left transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border disabled:cursor-not-allowed disabled:opacity-50`,e?`border-foreground/25 bg-muted/55`:`border-border/60 hover:bg-muted/35`),children:[(0,H.jsx)(`span`,{className:c(`mt-0.5 flex h-4 w-4 shrink-0 items-center justify-center rounded-full border`,e?`border-foreground bg-foreground text-background`:`border-border`),children:e?(0,H.jsx)(Tr,{className:`h-2.5 w-2.5`}):null}),(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`span`,{className:c(`block text-sm font-medium`,n?`text-destructive`:`text-foreground`),children:i}),(0,H.jsx)(`span`,{className:`mt-0.5 block text-xs leading-5 text-muted-foreground`,children:t})]})]})}function eX({storage:e,usage:t}){let n=[[T(`appDataClassData`),t.dataBytes],[T(`appDataClassConfig`),t.configBytes],[T(`appDataClassState`),t.stateBytes],[T(`appDataClassCache`),t.cacheBytes],[T(`appDataClassTemporary`),t.temporaryBytes],[T(`appDataClassLogs`),t.logsBytes]];return(0,H.jsxs)(`div`,{className:`rounded-xl bg-muted/45 px-3 py-2.5`,children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-3 text-xs`,children:[(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 font-medium text-foreground`,children:[(0,H.jsx)(qa,{className:`h-3.5 w-3.5`}),T(`appDataStorageTotal`)]}),(0,H.jsx)(`span`,{className:`tabular-nums text-foreground`,children:tX(t.totalBytes)})]}),(0,H.jsx)(`dl`,{className:`mt-2 grid grid-cols-2 gap-x-4 gap-y-1 text-[11px] sm:grid-cols-3`,children:n.map(([e,t])=>(0,H.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-2`,children:[(0,H.jsx)(`dt`,{className:`truncate text-muted-foreground`,children:e}),(0,H.jsx)(`dd`,{className:`shrink-0 tabular-nums text-foreground/80`,children:tX(t)})]},e))}),(0,H.jsxs)(`div`,{className:`mt-2 border-t border-border/50 pt-2`,children:[(0,H.jsx)(`div`,{className:`text-[10px] text-muted-foreground`,children:T(`appDataStoragePath`)}),(0,H.jsx)(`code`,{"aria-label":T(`appDataStoragePath`),className:`mt-0.5 block select-all break-all font-mono text-[10px] leading-4 text-foreground/75`,tabIndex:0,children:e.instanceDirectory})]})]})}function tX(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:e<1024*1024*1024?`${(e/(1024*1024)).toFixed(1)} MB`:`${(e/(1024*1024*1024)).toFixed(1)} GB`}var nX=[`app-data`];function rX(){return dn({queryKey:nX,queryFn:()=>I.appData.list(),staleTime:0})}function iX(){let e=yn();return zt({mutationFn:({dataId:e,confirmAppId:t})=>I.appData.deleteRetained(e,t),onSuccess:async()=>{await e.invalidateQueries({queryKey:nX}),L.success(T(`appDataDeleteCompleted`))}})}function aX({diagnostics:e,entries:t,error:n,isLoading:r,onDeletionFocusReturn:i}){let[a,o]=(0,V.useState)(null),s=(0,V.useRef)(null),c=(0,V.useRef)(null),l=iX(),u=t.filter(e=>e.lifecycle===`retained`),d=()=>{l.isPending||o(null)};return(0,V.useEffect)(()=>{l.isError&&s.current?.focus()},[l.isError]),!r&&!n&&e.length===0&&u.length===0?null:(0,H.jsxs)(`section`,{className:`mt-6`,"aria-labelledby":`retained-app-data-title`,children:[(0,H.jsxs)(`div`,{className:`mb-2.5 px-1`,children:[(0,H.jsx)(`h2`,{ref:c,id:`retained-app-data-title`,tabIndex:-1,className:`text-sm font-semibold text-foreground`,children:T(`appDataRetainedTitle`)}),(0,H.jsx)(`p`,{className:`mt-0.5 text-xs leading-5 text-muted-foreground`,children:T(`appDataRetainedDescription`)})]}),r?(0,H.jsx)(xi,{className:`h-28 w-full rounded-xl`}):null,n?(0,H.jsx)(`div`,{role:`alert`,className:`rounded-xl border border-destructive/20 bg-destructive/5 px-3 py-2.5 text-xs text-destructive`,children:n instanceof Error?n.message:T(`appDataLoadFailed`)}):null,e.length>0?(0,H.jsxs)(`div`,{role:`alert`,className:`mb-2.5 rounded-xl border border-amber-500/20 bg-amber-500/5 px-3 py-2.5 text-xs text-amber-800 dark:text-amber-200`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-1.5 font-medium`,children:[(0,H.jsx)(Ir,{className:`h-3.5 w-3.5`}),T(`appDataDiagnosticsTitle`)]}),(0,H.jsx)(`ul`,{className:`mt-1 space-y-1`,children:e.map(e=>(0,H.jsxs)(`li`,{className:`break-all`,children:[e.message,` — `,e.instanceDirectory]},e.instanceDirectory))})]}):null,(0,H.jsx)(`div`,{className:`space-y-2.5`,children:u.map(e=>(0,H.jsxs)(`article`,{className:`rounded-xl border border-border/65 bg-card p-3.5`,children:[(0,H.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,H.jsx)(`span`,{className:`flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-muted text-muted-foreground`,children:(0,H.jsx)(Ui,{className:`h-4 w-4`})}),(0,H.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,H.jsx)(`div`,{className:`truncate text-sm font-medium text-foreground`,children:e.displayName}),(0,H.jsxs)(`div`,{className:`mt-0.5 truncate font-mono text-[10px] text-muted-foreground`,children:[e.appId,e.publisherId?` · ${e.publisherId}`:``]})]}),(0,H.jsxs)(R,{type:`button`,size:`sm`,variant:`outline`,onClick:()=>{l.reset(),o(e)},children:[(0,H.jsx)(Yo,{className:`mr-1.5 h-3.5 w-3.5`}),T(`appDataDeleteAction`)]})]}),(0,H.jsx)(`div`,{className:`mt-3`,children:(0,H.jsx)(eX,{storage:e.storage,usage:e.usage})})]},e.id))}),(0,H.jsx)(Rr,{open:!!a,onOpenChange:e=>!e&&d(),children:(0,H.jsx)(Vr,{className:`max-w-md [&>:last-child]:hidden`,onEscapeKeyDown:e=>l.isPending&&e.preventDefault(),onInteractOutside:e=>l.isPending&&e.preventDefault(),children:a?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(zr,{children:[(0,H.jsx)(Hr,{children:T(`appDataDeleteTitle`)}),(0,H.jsx)(Fr,{children:T(`appDataDeleteDescription`)})]}),(0,H.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[(0,H.jsxs)(`div`,{className:`rounded-lg border border-destructive/20 bg-destructive/5 px-3 py-2 text-xs text-destructive`,children:[a.displayName,` · `,a.appId]}),(0,H.jsx)(eX,{storage:a.storage,usage:a.usage}),l.isError?(0,H.jsx)(`p`,{ref:s,role:`alert`,tabIndex:-1,className:`text-xs text-destructive`,children:l.error instanceof Error?l.error.message:T(`appDataDeleteFailed`)}):null]}),(0,H.jsxs)(kr,{className:`mt-5 gap-2 sm:gap-0`,children:[(0,H.jsx)(R,{autoFocus:!0,type:`button`,variant:`outline`,disabled:l.isPending,onClick:d,children:T(`cancel`)}),(0,H.jsxs)(R,{type:`button`,variant:`destructive`,disabled:l.isPending,onClick:()=>l.mutate({dataId:a.id,confirmAppId:a.appId},{onSuccess:()=>{o(null),window.requestAnimationFrame(()=>{c.current?c.current.focus():i?.()})}}),children:[l.isPending?(0,H.jsx)(mi,{className:`mr-1.5 h-3.5 w-3.5 animate-spin`}):null,l.isPending?T(`appDataDeleting`):T(`appDataDeletePermanently`)]})]})]}):null})})]})}var oX=[`app-packages`],sX=[`panel-apps`],cX=[`service-apps`],lX=[`service-actions`],uX=[`app-package-operations`],dX=new Set([`queued`,`resolving`,`downloading`,`verifying`,`installing`,`finalizing`]);function fX(){return dn({queryKey:oX,queryFn:()=>I.appPackages.list({includeStorageUsage:!1}),staleTime:0})}function pX(){return dn({queryKey:uX,queryFn:()=>I.appPackages.listOperations(),refetchInterval:e=>(e.state.data?.entries??[]).some(e=>mX(e.status))?500:!1,staleTime:0})}function mX(e){return dX.has(e)}function hX({isLoaded:e,operations:t,refetchPackages:n,refetchPanels:r,refetchAppData:i,settlementManager:a}){(0,V.useEffect)(()=>{a.settle({isLoaded:e,operations:t,refetchPackages:n,refetchPanels:r,refetchAppData:i})},[e,t,n,r,i,a])}function gX(){let e=yn();return zt({mutationFn:async e=>{switch(e.action){case`enable`:return await I.appPackages.enable(e.appId);case`disable`:return await I.appPackages.disable(e.appId);case`install`:return await I.appPackages.startInstall({source:e.source,registryUrl:e.registryUrl});case`update`:return await I.appPackages.startUpdate(e.appId);case`rollback`:return await I.appPackages.startRollback(e.appId,e.version);case`uninstall`:return await I.appPackages.startUninstall(e.appId,e.purgeData??!1)}},onSuccess:async()=>{await Promise.all([e.invalidateQueries({queryKey:oX}),e.invalidateQueries({queryKey:sX}),e.invalidateQueries({queryKey:cX}),e.invalidateQueries({queryKey:lX}),e.invalidateQueries({queryKey:uX}),e.invalidateQueries({queryKey:nX})])}})}var _X={darwin:`macOS`,linux:`Linux`,win32:`Windows`};function vX(e,t){return!e||e.mode===`universal`?t:e.operatingSystems.map(e=>_X[e]).join(` · `)}function yX(e){return Array.from(new Set(e.map(e=>e.spec).filter(Boolean)))}function bX(e){let{request:t,result:n}=e,r=new Date().toISOString();return n.type===`skill`?{type:`skill`,spec:n.spec,id:t.skill??n.spec,label:t.skill??n.name??n.spec,source:`workspace`,installPath:t.installPath,installedAt:r}:{type:n.type,spec:n.spec,id:n.name??n.spec,label:n.name??n.spec,source:`marketplace`,origin:`marketplace`,enabled:t.enabled??!0,runtimeStatus:t.enabled===!1?`disabled`:`ready`,installedAt:r}}function xX(e,t){let{id:n,spec:r}=t;return!!(r&&e.spec===r||n&&e.id===n)}function SX(e,t){return t??{type:e,total:0,specs:[],records:[]}}function CX(e){let{result:t,view:n}=e,r=SX(t.type,n),i=bX(e),a=r.records.findIndex(e=>xX(e,{id:i.id,spec:i.spec})),o=[...r.records];return a>=0?o[a]={...o[a],...i}:o.unshift(i),{...r,type:t.type,records:o,specs:yX(o),total:o.length}}function wX(e){let{request:t,result:n,view:r}=e,i=SX(n.type,r);if(n.action===`uninstall`||n.action===`remove`){let e=i.records.filter(e=>!xX(e,{id:n.id,spec:t.spec}));return{...i,records:e,specs:yX(e),total:e.length}}let a=i.records.map(e=>xX(e,{id:n.id,spec:t.spec})?n.action===`disable`?{...e,enabled:!1,runtimeStatus:`disabled`}:n.action===`update`?{...e,installedAt:new Date().toISOString(),origin:e.origin??`marketplace`}:{...e,enabled:!0,runtimeStatus:`ready`}:e);return{...i,records:a,specs:yX(a),total:a.length}}var TX=3e4;function EX(e){return e instanceof Pe&&e.code===`MARKETPLACE_SKILL_LOCAL_CHANGES`}function DX(e){let t=zn({queryKey:[`marketplace-items`,e],initialPageParam:1,queryFn:({pageParam:t})=>et({...e,page:t}),getNextPageParam:e=>e.page<e.totalPages?e.page+1:void 0,placeholderData:(t,n)=>{let r=n?.queryKey?.[1];if(!(!r||typeof r!=`object`||!r))return(`type`in r?r.type:void 0)===e.type&&kX(r,e)?t:void 0},staleTime:15e3,refetchInterval:e.q?!1:TX,refetchOnMount:`always`,refetchOnReconnect:`always`,refetchOnWindowFocus:`always`}),n=(0,V.useMemo)(()=>On(t.data),[t.data]);return{...t,data:n}}function OX(e,t=!0){return dn({queryKey:[`marketplace-recent-items`,e],queryFn:()=>et({type:e,sort:`updated`,page:1,pageSize:6}),enabled:t,staleTime:15e3,refetchInterval:TX,refetchOnMount:`always`,refetchOnReconnect:`always`,refetchOnWindowFocus:`always`})}function kX(e,t){return e.tag===t.tag&&e.scene===t.scene&&e.pageSize===t.pageSize}function AX(e=!0){return dn({queryKey:[`marketplace-skill-scenes`],queryFn:Fe,enabled:e,staleTime:6e4})}function jX(e,t=!0){let n=Vi({queries:e.map(e=>({queryKey:[`marketplace-skill-scene-count`,e.scene],queryFn:()=>et({type:`skill`,scene:e.scene,pageSize:1}),enabled:t&&typeof e.count!=`number`,staleTime:6e4}))});return(0,V.useMemo)(()=>{let t=new Map;return e.forEach((e,r)=>{let i=typeof e.count==`number`?e.count:n[r]?.data?.total;typeof i==`number`&&t.set(e.scene,i)}),t},[n,e])}function MX(e){return dn({queryKey:[`marketplace-installed`,e],queryFn:()=>Qe(e),staleTime:1e4})}function NX(){let e=yn();return zt({mutationFn:e=>$t(e),onSuccess:(t,n)=>{e.setQueryData([`marketplace-installed`,t.type],e=>CX({view:e,request:n,result:t})),e.invalidateQueries({queryKey:[`marketplace-installed`,t.type],refetchType:`inactive`}),L.success(t.message||T(`marketplaceInstallSuccessSkill`))},onError:e=>{L.error(e.message||T(`marketplaceInstallFailed`))}})}function PX(){let e=yn();return zt({mutationFn:e=>Ne(e),onSuccess:(t,n)=>{e.setQueryData([`marketplace-installed`,t.type],e=>wX({view:e,request:n,result:t})),e.invalidateQueries({queryKey:[`marketplace-installed`,t.type],refetchType:`inactive`});let r=t.action===`enable`?T(`marketplaceEnableSuccess`):t.action===`disable`?T(`marketplaceDisableSuccess`):t.action===`update`?T(`marketplaceUpdateSuccess`):T(`marketplaceUninstallSuccess`);L.success(t.message||r)},onError:e=>{EX(e)||L.error(e.message||T(`marketplaceOperationFailed`))}})}var FX=[`bg-amber-600`,`bg-orange-500`,`bg-yellow-600`,`bg-emerald-600`,`bg-teal-600`,`bg-cyan-600`,`bg-stone-600`,`bg-rose-500`,`bg-violet-500`];function IX(e){let{name:t,fallback:n,className:r}=e,i=t||n,a=i.substring(0,2).toUpperCase();return(0,H.jsx)(`div`,{className:c(`flex h-10 w-10 shrink-0 items-center justify-center rounded-xl text-sm font-semibold text-white`,LX(i),r),children:a})}function LX(e){let t=0;for(let n=0;n<e.length;n++)t=e.charCodeAt(n)+((t<<5)-t);return FX[Math.abs(t)%FX.length]}function RX({title:e,spec:t}){return(0,H.jsxs)(ti,{delayDuration:400,children:[(0,H.jsxs)(oi,{children:[(0,H.jsx)(si,{asChild:!0,children:(0,H.jsx)(`div`,{className:`truncate text-[14px] font-semibold leading-tight text-gray-950`,children:e})}),(0,H.jsx)(Yr,{className:`max-w-[300px] text-xs`,children:e})]}),(0,H.jsx)(`div`,{className:`mb-2 mt-1 flex min-w-0 items-center gap-1.5`,children:t?(0,H.jsxs)(oi,{children:[(0,H.jsx)(si,{asChild:!0,children:(0,H.jsx)(`span`,{className:`max-w-full truncate text-[11px] font-mono leading-tight text-gray-400`,children:t})}),(0,H.jsx)(Yr,{className:`max-w-[300px] break-all font-mono text-xs`,children:t})]}):null})]})}function zX(e){let{item:t,record:n,state:r,onInstall:i,onManage:a}=e,{isInstalling:o,canUpdate:s,canUninstall:l,busyAction:u}=r,d=!!u;return t&&!n||n&&(s||l)?(0,H.jsxs)(`div`,{className:c(`flex shrink-0 items-center justify-end gap-1.5 opacity-100 transition-opacity duration-150`,`md:pointer-events-none md:opacity-0`,`md:group-hover:pointer-events-auto md:group-hover:opacity-100`,`md:group-focus-within:pointer-events-auto md:group-focus-within:opacity-100`),children:[t&&!n&&(0,H.jsxs)(`button`,{onClick:e=>{e.stopPropagation(),i(t)},disabled:o,className:`inline-flex h-6 items-center gap-1 whitespace-nowrap rounded-md bg-primary px-2 text-[11px] font-medium text-white transition-colors hover:bg-primary-600 disabled:opacity-50`,children:[(0,H.jsx)(Sa,{className:`h-3 w-3`}),T(o?`marketplaceInstalling`:`marketplaceInstall`)]}),n&&s&&(0,H.jsxs)(`button`,{disabled:d,onClick:e=>{e.stopPropagation(),a(`update`,n)},className:`inline-flex h-6 items-center gap-1 whitespace-nowrap rounded-md border border-blue-200/80 bg-white px-2 text-[11px] font-medium text-blue-600 transition-colors hover:border-blue-300 hover:bg-blue-50 disabled:opacity-50`,children:[(0,H.jsx)(gi,{className:`h-3 w-3`}),T(u===`update`?`marketplaceUpdating`:`marketplaceUpdate`)]}),n&&l&&(0,H.jsxs)(`button`,{disabled:d,onClick:e=>{e.stopPropagation(),a(`uninstall`,n)},className:`inline-flex h-6 items-center gap-1 whitespace-nowrap rounded-md border border-gray-200/80 bg-white px-2 text-[11px] font-medium text-gray-500 transition-colors hover:border-rose-200 hover:bg-rose-50 hover:text-rose-600 disabled:opacity-50`,children:[(0,H.jsx)(Yo,{className:`h-3 w-3`}),T(u===`uninstall`?`marketplaceRemoving`:`marketplaceUninstall`)]})]}):null}function BX(e){let{record:t,disabled:n}=e;return t?(0,H.jsx)(`div`,{className:`flex h-5 w-5 shrink-0 items-center justify-end`,children:(0,H.jsx)(VX,{disabled:n})}):null}function VX(e){let{disabled:t}=e,n=T(t?`marketplaceDisabledStatus`:`marketplaceInstalledStatus`);return(0,H.jsx)(ti,{delayDuration:300,children:(0,H.jsxs)(oi,{children:[(0,H.jsx)(si,{asChild:!0,children:(0,H.jsx)(`span`,{"aria-label":n,className:c(`inline-flex h-5 w-5 items-center justify-center`,t?`text-gray-400`:`text-emerald-700`),children:t?(0,H.jsx)(ca,{className:`h-4 w-4 opacity-40`}):(0,H.jsx)(ca,{className:`h-4 w-4`})})}),(0,H.jsx)(Yr,{className:`text-xs`,children:n})]})})}function HX(e){let{item:t,record:n,installState:r,manageState:i,onOpen:a,onInstall:o,onManage:s}=e,{language:c}=Nn(),l=Ln(c),u=t?.name??n?.label??n?.id??n?.spec??T(`marketplaceUnknownItem`),d=En(t?.summaryI18n,t?.summary,l)||(n?T(`marketplaceInstalledLocalSummary`):``),f=t?.install.spec??n?.spec??``,p=t?.tags??[],m=n?.id||n?.spec,h=m?i.actionsByTarget.get(m):void 0,g=n?.type===`skill`&&n.source===`workspace`,_=n?.type===`skill`&&n.origin===`marketplace`,v=n?n.enabled===!1||n.runtimeStatus===`disabled`:!1,y=t?.install.spec,b=typeof y==`string`&&r.installingSpecs.has(y);return(0,H.jsxs)(`article`,{onClick:a,className:`group flex h-full min-h-[156px] cursor-pointer flex-col rounded-xl border border-gray-200/60 bg-white p-3.5 shadow-sm transition-colors hover:border-gray-300 hover:bg-gray-50/60`,children:[(0,H.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2.5`,children:[(0,H.jsx)(IX,{name:u,fallback:f||T(`marketplaceTypeSkill`),className:`h-9 w-9 rounded-lg text-xs`}),(0,H.jsx)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:(0,H.jsx)(RX,{title:u,spec:f})}),(0,H.jsx)(BX,{record:n,disabled:v})]}),(0,H.jsxs)(`div`,{className:`mt-2 flex min-w-0 flex-1 flex-col`,children:[(0,H.jsx)(`p`,{className:`line-clamp-2 text-left text-[12px] leading-relaxed text-gray-500`,children:d}),(0,H.jsxs)(`div`,{className:`mt-auto flex min-w-0 items-end justify-between gap-2 pt-2`,children:[(0,H.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,H.jsx)(UX,{tags:p})}),(0,H.jsx)(zX,{item:t,record:n,state:{isInstalling:b,canUpdate:_,canUninstall:g,busyAction:h},onInstall:o,onManage:s})]})]})]})}function UX({tags:e}){let t=e.filter(WX).slice(0,3);return t.length===0?null:(0,H.jsx)(`div`,{className:`flex min-w-0 flex-wrap gap-1.5 overflow-hidden`,children:t.map(e=>(0,H.jsx)(`span`,{className:`max-w-[104px] truncate rounded-md bg-gray-100 px-2 py-0.5 text-[11px] font-medium leading-5 text-gray-500`,children:e},e))})}function WX(e){let t=e.trim().toLowerCase();return t.length>0&&t!==`skill`}function GX({model:e,showTitle:t,operationState:n,scroll:r,actions:i}){let{scope:a,entries:o,header:s,status:l,emptyLabel:u,errorLabel:d}=e,{showSkeleton:f,isRefreshing:p,error:m}=l,{hasMore:h,loadingMore:g,sentinelRef:_}=r,{installState:v,manageState:y}=n,{onOpen:b,onInstall:x,onManage:S}=i;return(0,H.jsxs)(`section`,{className:c(`flex min-h-full flex-col`,t&&`gap-3`),children:[t&&(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,H.jsx)(`h3`,{className:`text-[14px] font-semibold text-gray-950`,children:s.title}),(0,H.jsxs)(`div`,{className:`flex items-center gap-2 text-[12px] text-gray-500`,children:[p&&(0,H.jsx)(`span`,{className:`font-medium text-primary`,children:s.refreshingLabel}),(0,H.jsx)(`span`,{children:s.summary})]})]}),m&&(0,H.jsxs)(`div`,{className:`rounded-xl border border-rose-200 bg-rose-50 p-4 text-sm text-rose-700`,children:[d,`: `,m.message]}),p&&(0,H.jsx)(`div`,{"data-testid":`marketplace-list-refreshing`,className:`h-0.5 overflow-hidden rounded-full bg-primary/10`,children:(0,H.jsx)(`div`,{className:`h-full w-1/3 animate-pulse rounded-full bg-primary`})}),(0,H.jsxs)(`div`,{"data-testid":f?`marketplace-list-skeleton`:void 0,className:c(`grid grid-cols-1 gap-2.5 md:grid-cols-2 xl:grid-cols-3`,f&&`min-h-0 flex-1 auto-rows-[156px] content-start`),children:[f&&(0,H.jsx)(Dn,{count:36}),!f&&!m&&o.map(e=>(0,H.jsx)(HX,{item:e.item,record:e.record,installState:v,manageState:y,onOpen:()=>b(e.item,e.record),onInstall:x,onManage:S},e.key))]}),!f&&!m&&o.length===0&&(0,H.jsx)(`div`,{className:`py-8 text-center text-[13px] text-gray-500`,children:u}),a===`all`&&!f&&!m&&(0,H.jsx)(Rn,{hasMore:h,loading:g,sentinelRef:_})]})}function KX(e){let{entry:t,language:n,localeFallbacks:r,installState:i,layout:a=`rail`,onOpen:o,onInstall:s}=e,{item:l,record:u}=t,d=En(l.summaryI18n,l.summary,r),f=l.install.spec,p=i.installingSpecs.has(f),m=!!u;return(0,H.jsxs)(`article`,{onClick:()=>o(t),className:c(`group flex min-h-[166px] cursor-pointer flex-col justify-between rounded-xl border border-gray-200/70 bg-white p-3 shadow-sm transition-colors hover:border-gray-300 hover:bg-gray-50/60`,a===`rail`?`w-[260px] shrink-0`:`w-full min-w-0`),children:[(0,H.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,H.jsxs)(`div`,{className:`mb-2.5 flex min-w-0 items-start gap-2.5`,children:[(0,H.jsx)(IX,{name:l.name,fallback:l.install.spec}),(0,H.jsxs)(`div`,{className:`min-w-0 flex-1 pt-0.5`,children:[(0,H.jsx)(`div`,{className:`truncate text-[13px] font-semibold leading-tight text-gray-950`,children:l.name}),(0,H.jsx)(`div`,{className:`mt-0.5 truncate text-[11px] font-mono leading-tight text-gray-400`,children:qX(l)})]})]}),(0,H.jsx)(`p`,{className:`line-clamp-2 text-[12px] leading-relaxed text-gray-500`,children:d}),(0,H.jsx)(JX,{tags:l.tags})]}),(0,H.jsxs)(`div`,{className:`mt-3 flex items-center justify-between gap-3 border-t border-gray-100 pt-2.5`,children:[(0,H.jsx)(`span`,{className:`min-w-0 truncate text-[11px] text-gray-400`,children:XX(l.updatedAt)}),m?(0,H.jsxs)(`span`,{className:`inline-flex h-7 items-center gap-1.5 text-[11px] font-semibold text-emerald-700`,children:[(0,H.jsx)(ca,{className:`h-3.5 w-3.5`}),ZX({zh:`已安装`,en:`Installed`},n)]}):(0,H.jsxs)(`button`,{type:`button`,disabled:p,onClick:e=>{e.stopPropagation(),s(l)},className:`inline-flex h-7 items-center gap-1.5 rounded-md border border-gray-200 bg-white px-2 text-[11px] font-semibold text-gray-700 transition-colors hover:border-gray-300 hover:bg-gray-50 disabled:opacity-50`,children:[(0,H.jsx)(Sa,{className:`h-3.5 w-3.5`}),T(p?`marketplaceInstalling`:`marketplaceInstall`)]})]})]})}function qX(e){return e.slug||e.install.spec}function JX({tags:e}){let t=e.filter(YX).slice(0,2);return t.length===0?null:(0,H.jsx)(`div`,{className:`mt-auto truncate pt-2 text-[11px] font-medium text-gray-400`,children:t.join(` / `)})}function YX(e){let t=e.trim().toLowerCase();return t.length>0&&t!==`skill`}function XX(e){return e.slice(0,10)||e}function ZX(e,t){return t.startsWith(`zh`)?e.zh:e.en}var QX=[{scene:`development-debugging`,title:{zh:`开发与调试`,en:`Development`},summary:{zh:`代码审查、错误定位、架构分析与交付验证。`,en:`Review, debug, analyze, and verify delivery work.`},icon:Uo,tone:`dark`,span:`md:col-span-2`},{scene:`office-collaboration`,title:{zh:`办公协作`,en:`Office Work`},summary:{zh:`连接文档、日历、会议、邮件和团队通信。`,en:`Connect docs, calendars, meetings, mail, and teams.`},icon:ea,tone:`green`,span:`md:col-span-2`},{scene:`writing-content`,title:{zh:`写作与内容`,en:`Writing`},summary:{zh:`把调研、写作、润色和发布组织成连续工作流。`,en:`Turn research, writing, polishing, and publishing into one flow.`},icon:Do,tone:`amber`,span:`md:col-span-2`},{scene:`browser-automation`,title:{zh:`浏览器自动化`,en:`Browser`},summary:{zh:`操作网页、捕获动态内容并验证真实用户路径。`,en:`Operate pages, capture dynamic content, and verify user paths.`},icon:Ca,tone:`blue`,span:`md:col-span-2`},{scene:`local-environment`,title:{zh:`本地环境`,en:`Local`},summary:{zh:`管理终端、文件、运行时和本地服务。`,en:`Manage shells, files, runtimes, and local services.`},icon:xa,tone:`violet`,span:`md:col-span-1`},{scene:`social-platforms`,title:{zh:`社交平台`,en:`Social`},summary:{zh:`处理发布、互动、检索和内容分发。`,en:`Handle posting, interaction, search, and distribution.`},icon:ho,tone:`sky`,span:`md:col-span-1`},{scene:`nextclaw-official`,title:{zh:`NextClaw 官方`,en:`NextClaw Official`},summary:{zh:`优先查看由 NextClaw 维护的原生能力。`,en:`Browse native capabilities maintained by NextClaw.`},icon:Ar,tone:`teal`,span:`md:col-span-2`}],$X={icon:Ar,tone:`dark`,span:`md:col-span-2`},eZ={dark:{card:`border-gray-200/80 bg-white text-gray-950`,icon:`border-stone-600 bg-stone-600 text-white`,title:`text-gray-950`,text:`text-gray-500`,meta:`text-gray-400`},blue:{card:`border-gray-200/80 bg-white text-gray-950`,icon:`border-cyan-600 bg-cyan-600 text-white`,title:`text-gray-950`,text:`text-gray-500`,meta:`text-gray-400`},green:{card:`border-gray-200/80 bg-white text-gray-950`,icon:`border-emerald-600 bg-emerald-600 text-white`,title:`text-gray-950`,text:`text-gray-500`,meta:`text-gray-400`},amber:{card:`border-gray-200/80 bg-white text-gray-950`,icon:`border-amber-600 bg-amber-600 text-white`,title:`text-gray-950`,text:`text-gray-500`,meta:`text-gray-400`},violet:{card:`border-gray-200/80 bg-white text-gray-950`,icon:`border-violet-500 bg-violet-500 text-white`,title:`text-gray-950`,text:`text-gray-500`,meta:`text-gray-400`},sky:{card:`border-gray-200/80 bg-white text-gray-950`,icon:`border-sky-500 bg-sky-500 text-white`,title:`text-gray-950`,text:`text-gray-500`,meta:`text-gray-400`},teal:{card:`border-gray-200/80 bg-white text-gray-950`,icon:`border-teal-600 bg-teal-600 text-white`,title:`text-gray-950`,text:`text-gray-500`,meta:`text-gray-400`}},tZ=`grid grid-cols-[repeat(auto-fill,minmax(240px,320px))] justify-start gap-3`;function nZ(e){let{recentEntries:t,scenes:n,isScenesLoading:r,isItemsLoading:i,language:a,installState:o,onOpen:s,onInstall:c,onOpenScene:l}=e,u=Ln(a);return(0,H.jsxs)(`div`,{className:`mb-4 space-y-5`,children:[(0,H.jsxs)(`section`,{className:`space-y-2.5`,children:[(0,H.jsx)(oZ,{icon:va,title:sZ({zh:`场景`,en:`Scenes`},a),description:sZ({zh:`按使用场景浏览适合的技能组合。`,en:`Browse skills by how you plan to use them.`},a)}),r?(0,H.jsx)(`div`,{"data-testid":`marketplace-scenes-skeleton`,className:`grid auto-rows-[104px] grid-cols-2 gap-2 md:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-5`,children:(0,H.jsx)(Dn,{count:QX.length})}):(0,H.jsx)(`div`,{className:`grid grid-cols-2 gap-2 md:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-5`,children:n.map(e=>(0,H.jsx)(rZ,{scene:e,language:a,onSelect:l},e.scene))})]}),(i||t.length>0)&&(0,H.jsx)(aZ,{icon:pa,title:sZ({zh:`最近更新`,en:`Recently updated`},a),description:sZ({zh:`看看生态最近在补齐哪些能力。`,en:`See what the ecosystem has been improving lately.`},a),entries:t,language:a,localeFallbacks:u,isLoading:i,installState:o,onOpen:s,onInstall:c})]})}function rZ(e){let{scene:t,language:n,onSelect:r}=e,i=cZ(t.scene),a=i.icon,o=eZ[i.tone];return(0,H.jsx)(`button`,{type:`button`,onClick:()=>r(t.scene),className:c(`group flex min-h-[74px] flex-col justify-center rounded-lg border px-3 py-2.5 text-left shadow-sm transition-colors hover:border-gray-300 hover:bg-gray-50/70`,o.card),children:(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,H.jsx)(`span`,{className:c(`flex h-7 w-7 shrink-0 items-center justify-center rounded-md border`,o.icon),children:(0,H.jsx)(a,{className:`h-3.5 w-3.5`})}),(0,H.jsx)(`div`,{className:`min-w-0 flex-1 truncate text-[13px] font-semibold text-gray-950`,children:lZ(t,i,n)}),typeof t.count==`number`&&(0,H.jsx)(`span`,{className:`shrink-0 text-[11px] font-medium text-gray-400`,children:dZ(t.count,n)})]}),(0,H.jsx)(`p`,{className:c(`mt-1 line-clamp-1 text-[11px] leading-relaxed`,o.text),children:uZ(t,i,n)})]})})}function iZ(e){let{scene:t,entries:n,isLoading:r,language:i,localeFallbacks:a,installState:o,onBack:s,onOpen:l,onInstall:u}=e,d=cZ(t.scene),f=d.icon,p=eZ[d.tone];return(0,H.jsxs)(`section`,{className:`flex min-h-full flex-col`,children:[(0,H.jsxs)(`div`,{className:`mb-4 flex min-w-0 items-start gap-2.5`,children:[(0,H.jsx)(`button`,{type:`button`,onClick:s,className:`inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-lg text-gray-600 transition-colors hover:bg-gray-100 hover:text-gray-900`,"aria-label":sZ({zh:`返回`,en:`Back`},i),children:(0,H.jsx)(di,{className:`h-4 w-4`})}),(0,H.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,H.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,H.jsx)(`span`,{className:c(`flex h-8 w-8 shrink-0 items-center justify-center rounded-lg border`,p.icon),children:(0,H.jsx)(f,{className:`h-4 w-4`})}),(0,H.jsx)(`h3`,{className:`min-w-0 flex-1 truncate text-[15px] font-semibold text-gray-950`,children:lZ(t,d,i)}),(0,H.jsx)(`span`,{className:`shrink-0 text-[11px] font-medium text-gray-400`,children:sZ(r?{zh:`加载中`,en:`Loading`}:{zh:`${n.length} 个技能`,en:`${n.length} skills`},i)})]}),(0,H.jsx)(`div`,{className:`mt-1.5 flex min-w-0 items-center gap-2`,children:(0,H.jsx)(`p`,{className:`min-w-0 flex-1 truncate text-[12px] leading-relaxed text-gray-500`,children:uZ(t,d,i)})})]})]}),r?(0,H.jsx)(`div`,{"data-testid":`marketplace-scene-skeleton`,className:c(tZ,`min-h-0 flex-1 auto-rows-[166px] content-start`),children:(0,H.jsx)(Dn,{count:24})}):n.length>0?(0,H.jsx)(`div`,{className:tZ,children:n.map(e=>(0,H.jsx)(KX,{entry:e,language:i,localeFallbacks:a,installState:o,layout:`grid`,onOpen:l,onInstall:u},e.item.id))}):(0,H.jsx)(`div`,{className:`rounded-lg border border-dashed border-gray-200 py-8 text-center text-[12px] text-gray-500`,children:sZ({zh:`这个模块暂无技能。`,en:`No skills in this module yet.`},i)})]})}function aZ(e){let{icon:t,title:n,description:r,entries:i,language:a,localeFallbacks:o,isLoading:s,installState:c,onOpen:l,onInstall:u}=e;return(0,H.jsxs)(`section`,{className:`space-y-2.5`,children:[(0,H.jsx)(oZ,{icon:t,title:n,description:r}),s?(0,H.jsx)(`div`,{"data-testid":`marketplace-recent-skeleton`,className:`-mx-1 grid auto-rows-[166px] grid-cols-[repeat(4,260px)] gap-2.5 overflow-hidden px-1 pb-1.5`,children:(0,H.jsx)(Dn,{count:4})}):(0,H.jsx)(`div`,{className:`-mx-1 flex gap-2.5 overflow-x-auto px-1 pb-1.5 custom-scrollbar`,children:i.map(e=>(0,H.jsx)(KX,{entry:e,language:a,localeFallbacks:o,installState:c,onOpen:l,onInstall:u},e.item.id))})]})}function oZ({icon:e,title:t,description:n}){return(0,H.jsx)(`div`,{className:`flex items-end justify-between gap-4`,children:(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(`h3`,{className:`flex items-center gap-2 text-[14px] font-semibold text-gray-950`,children:[(0,H.jsx)(e,{className:`h-4 w-4 text-primary`}),t]}),(0,H.jsx)(`p`,{className:`mt-0.5 text-[12px] leading-relaxed text-gray-500`,children:n})]})})}function sZ(e,t){return t.startsWith(`zh`)?e.zh:e.en}function cZ(e){return QX.find(t=>t.scene===e)??{scene:e,...$X}}function lZ(e,t,n){return t.title?sZ(t.title,n):e.title}function uZ(e,t,n){return t.summary?sZ(t.summary,n):e.description??e.scene}function dZ(e,t){return t.startsWith(`zh`)?`${e} 个技能`:`${e} skills`}var fZ=`https://skillhub.cn/`;function pZ(){return(0,H.jsx)(me,{href:fZ,external:!0,className:`h-7 shrink-0 px-1.5 text-[13px]`,children:T(`marketplaceExternalSkillSourceTitle`)})}function mZ(e){return(e??``).trim().toLowerCase()}function hZ(e,t){let n=mZ(t);return n.length>0?`${e}:${n}`:``}function gZ(e){let t=new Map;for(let n of e){let e=[n.install.spec,n.slug,n.id];for(let r of e){let e=hZ(n.type,r);!e||t.has(e)||t.set(e,n)}}return t}function _Z(e){let t=new Map;for(let n of e){let e=[n.spec,n.id,n.label];for(let r of e){let e=hZ(n.type,r);!e||t.has(e)||t.set(e,n)}}return t}function vZ(e,t){let n=[e.install.spec,e.slug,e.id];for(let r of n){let n=hZ(e.type,r);if(!n)continue;let i=t.get(n);if(i)return i}}function yZ(e,t){return t.get(hZ(e.type,e.spec))||t.get(hZ(e.type,e.id))||t.get(hZ(e.type,e.label))}function bZ(e,t,n,r){let i=mZ(n);if(!i)return!0;let a=En(t?.summaryI18n,t?.summary,r);return[e.id,e.spec,e.label,t?.name,t?.slug,t?.summary,a,...t?.tags??[]].map(e=>mZ(e)).filter(Boolean).some(e=>e.includes(i))}function xZ(e){let{items:t,recentItems:n,installedRecordLookup:r,scene:i,forcedType:a,typeFilter:o,scope:s,searchText:c,query:l,showListSkeleton:u,hasCatalogError:d}=e,f=AX(o===`skill`),p=(0,V.useMemo)(()=>f.data?.scenes??[],[f.data?.scenes]),m=jX(p,o===`skill`),h=(0,V.useMemo)(()=>p.map(e=>({...e,count:typeof e.count==`number`?e.count:m.get(e.scene)})),[m,p]),g=(0,V.useMemo)(()=>t.map(e=>({item:e,record:vZ(e,r)})),[t,r]),_=(0,V.useMemo)(()=>n.map(e=>({item:e,record:vZ(e,r)})),[r,n]),v=(0,V.useMemo)(()=>{let e=i?.trim();if(e)return h.find(t=>t.scene===e)??{scene:e,title:e}},[i,h]),y=o===`skill`&&!!i?.trim(),b=o===`skill`&&s===`all`&&!c.trim()&&!l&&!y,x=u||t.length>=4,S=b&&!d&&x&&h.length===0&&f.isLoading;return{entries:g,recentEntries:_,scenes:h,selectedScene:v,sceneEntries:g,isSceneRoute:y,isScenesLoading:S,showShelves:b&&!d&&x&&(u||h.length>0||S),backPath:a?`/skills`:`/marketplace/skills`,pathPrefix:a?`/skills/scenes`:`/marketplace/skills/scenes`}}function SZ(){let e=NX(),t=PX(),{confirm:n,ConfirmDialog:r}=An(),[i,a]=(0,V.useState)(new Set),[o,s]=(0,V.useState)(new Map);return{installState:{installingSpecs:i},manageState:{actionsByTarget:o},handleInstall:async t=>{let n=t.install.spec;if(!i.has(n)){a(e=>new Set(e).add(n));try{await e.mutateAsync({type:t.type,spec:n,kind:t.install.kind,skill:t.slug,installPath:`skills/${t.slug}`})}catch{}finally{a(e=>{let t=new Set(e);return t.delete(n),t})}}},handleManage:async(e,r)=>{let i=e===`update`?r.catalogSlug||r.id||r.spec:r.id||r.spec;if(!(!i||o.has(i))&&!(e===`uninstall`&&!await n({title:`${T(`marketplaceUninstallTitle`)} ${i}?`,description:T(`marketplaceUninstallDescription`),confirmLabel:T(`marketplaceUninstall`),variant:`destructive`}))){s(t=>new Map(t).set(i,e));try{let a={type:r.type,action:e,id:i,spec:r.spec};try{await t.mutateAsync(a)}catch(r){if(e!==`update`||!EX(r)||!await n({title:T(`marketplaceUpdateConflictTitle`),description:T(`marketplaceUpdateConflictDescription`),confirmLabel:T(`marketplaceUpdateConflictConfirm`),variant:`destructive`}))return;await t.mutateAsync({...a,force:!0})}}finally{s(e=>{let t=new Map(e);return t.delete(i),t})}}},ConfirmDialog:r}}function CZ(e){let t=ki(),n=(0,V.useRef)({byKey:new Map,seq:0});return{openItemDetail:async(r,i)=>{let a=r?.name??i?.label??i?.id??i?.spec??T(`marketplaceUnknownItem`),o=jn(r?`skill`:`skill-local`,r?.slug??i?.id??i?.spec??a),s=r?`marketplace:${r.type}:${r.slug}`:`marketplace:${i?.type??`unknown`}:${i?.id??i?.spec??a}`,c=T(`marketplaceTypeSkill`);if(!r){Tn(t,{id:o,title:a,typeLabel:c,spec:i?.spec??`-`,status:`ready`,summary:T(`marketplaceInstalledLocalSummary`),metadataRaw:JSON.stringify(i??{},null,2),contentRaw:`-`});return}let l=n.current.seq+1;n.current.seq=l,n.current.byKey.set(s,l);let u=En(r.summaryI18n,r.summary,e);Tn(t,{id:o,title:a,typeLabel:c,spec:r.install.spec,status:`loading`,summary:u,tags:r.tags,author:r.author});try{let e=await ke(r.slug);if(n.current.byKey.get(s)!==l)return;Tn(t,{id:o,title:a,typeLabel:c,spec:r.install.spec,status:`ready`,summary:u,metadataRaw:e.metadataRaw,contentRaw:e.bodyRaw||e.raw,sourceUrl:e.sourceUrl,sourceLabel:`Source (${e.source})`,tags:r.tags,author:r.author},{activate:!1})}catch(e){if(n.current.byKey.get(s)!==l)return;Tn(t,{id:o,title:a,typeLabel:c,spec:r.install.spec,status:`error`,summary:u,metadataRaw:JSON.stringify({error:e instanceof Error?e.message:String(e)},null,2),contentRaw:T(`marketplaceOperationFailed`)},{activate:!1})}}}}function wZ(e){let{scope:t,typeFilter:n,query:r,localeFallbacks:i,catalogView:a,installedView:o,isCatalogLoading:s,isCatalogFetching:c,isCatalogFetchingNextPage:l,catalogError:u,isInstalledLoading:d,installedError:f}=e,p=(0,V.useMemo)(()=>o?.records??[],[o?.records]),m=(0,V.useMemo)(()=>a?.items??[],[a?.items]),h=(0,V.useMemo)(()=>gZ(m),[m]),g=(0,V.useMemo)(()=>_Z(p),[p]),_=(0,V.useMemo)(()=>p.filter(e=>e.type===n).map(e=>({key:`${e.type}:${e.spec}:${e.id??``}`,record:e,item:yZ(e,h)})).filter(e=>bZ(e.record,e.item,r,i)).sort((e,t)=>TZ(e.record,t.record)),[p,n,h,r,i]),v=(0,V.useMemo)(()=>t===`installed`?_:m.map(e=>({key:e.id,item:e,record:vZ(e,g)})),[m,_,g,t]),y=t===`all`&&s&&!a||t===`installed`&&d&&!o,b=t===`all`&&!y&&!!a&&c&&!l,x=t===`installed`?d&&!o?T(`loading`):`${_.length} ${T(`marketplaceInstalledSkillsCountSuffix`)}`:a?`${a.total} ${T(`marketplaceSkillsCountSuffix`)}`:T(`loading`),S=t===`all`&&u?u:t===`installed`&&f?f:void 0,C={scope:t,entries:v,header:{title:T(t===`installed`?`marketplaceSectionInstalledSkills`:`marketplaceAllSkills`),summary:x,refreshingLabel:T(`marketplaceRefreshingResults`)},status:{showSkeleton:y,isRefreshing:b,error:S},emptyLabel:T(t===`installed`?`marketplaceNoInstalledSkills`:`marketplaceNoSkills`),errorLabel:T(t===`installed`?`marketplaceErrorLoadingInstalledSkills`:`marketplaceErrorLoadingSkillsData`)};return{allItems:m,installedRecordLookup:g,installedTotal:o?.total??0,itemListView:C,showListSkeleton:y,isRefreshingList:b}}function TZ(e,t){let n=Date.parse(e.installedAt??``),r=Date.parse(t.installedAt??``);return Number.isNaN(n)||Number.isNaN(r)||n===r?e.spec.localeCompare(t.spec):r-n}var EZ=20;function DZ({forcedType:e}={}){let t=oe(),n=se(),{language:r}=Nn(),i=`skill`,a=(0,V.useMemo)(()=>Ln(r),[r]),[o,s]=(0,V.useState)(``),[c,l]=(0,V.useState)(``),[u,d]=(0,V.useState)(`all`),[f,p]=(0,V.useState)(`relevance`),{installState:m,manageState:h,handleInstall:g,handleManage:_,ConfirmDialog:v}=SZ(),{openItemDetail:y}=CZ(a);(0,V.useEffect)(()=>{let e=setTimeout(()=>{l(o.trim())},250);return()=>clearTimeout(e)},[o]);let b=MX(i),x=i===`skill`?n.scene?.trim():void 0,S=DX({q:x?void 0:c||void 0,scene:x,type:i,sort:f,pageSize:EZ}),C=OX(i,u===`all`&&!o.trim()&&!c&&!x),{containerRef:w,sentinelRef:E}=eee({disabled:u!==`all`||S.isError||!S.hasNextPage||S.isFetchingNextPage,onLoadMore:()=>S.fetchNextPage(),watchValue:`${i}:${u}:${c}:${x??``}:${f}:${S.data?.loadedItems??0}:${S.data?.loadedPages??0}`});(0,V.useEffect)(()=>{let e=w.current;e&&typeof e.scrollTo==`function`&&e.scrollTo({top:0})},[w,c,x,u,f,i]);let D=wZ({scope:u,typeFilter:i,query:c,localeFallbacks:a,catalogView:S.data,installedView:b.data,isCatalogLoading:S.isLoading,isCatalogFetching:S.isFetching,isCatalogFetchingNextPage:S.isFetchingNextPage,catalogError:S.isError?S.error:void 0,isInstalledLoading:b.isLoading,installedError:b.isError?b.error:void 0}),O=xZ({items:D.allItems,recentItems:C.data?.items??[],installedRecordLookup:D.installedRecordLookup,scene:x,forcedType:e,typeFilter:i,scope:u,searchText:o,query:c,showListSkeleton:D.showListSkeleton,hasCatalogError:S.isError});return(0,H.jsxs)(bt,{className:`flex h-full min-h-0 flex-col pb-0`,children:[!O.isSceneRoute&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:`mb-3 flex items-start justify-between gap-3 border-b border-gray-200/60`,children:[(0,H.jsx)(jY,{value:u,onValueChange:e=>d(e),children:(0,H.jsxs)(MY,{className:`mb-0 h-auto flex-1 justify-start gap-6 rounded-none border-b-0 bg-transparent p-0 text-gray-500`,children:[(0,H.jsx)(NY,{value:`all`,className:`rounded-none border-b-2 border-transparent bg-transparent px-0 pb-3 pt-0 shadow-none hover:bg-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent data-[state=active]:text-gray-950 data-[state=active]:shadow-none`,children:T(`marketplaceTabMarketplaceSkills`)}),(0,H.jsxs)(NY,{value:`installed`,className:`gap-1.5 rounded-none border-b-2 border-transparent bg-transparent px-0 pb-3 pt-0 shadow-none hover:bg-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent data-[state=active]:text-gray-950 data-[state=active]:shadow-none`,children:[T(`marketplaceTabInstalledSkills`),(0,H.jsx)(`span`,{className:`text-[11px] font-medium text-gray-500`,children:D.installedTotal})]})]})}),(0,H.jsx)(pZ,{})]}),(0,H.jsx)(Mn,{scope:u,searchText:o,isRefreshing:D.isRefreshingList,searchPlaceholder:T(`marketplaceSearchPlaceholderSkills`),sort:f,onSearchTextChange:s,onSortChange:p})]}),(0,H.jsx)(`section`,{className:`flex min-h-0 flex-1 flex-col`,children:(0,H.jsxs)(`div`,{ref:w,className:`min-h-0 flex-1 overflow-y-auto custom-scrollbar pr-1`,"aria-busy":D.showListSkeleton||S.isFetchingNextPage,children:[O.isSceneRoute&&O.selectedScene&&(0,H.jsx)(iZ,{scene:O.selectedScene,entries:O.sceneEntries,isLoading:D.showListSkeleton,language:r,localeFallbacks:a,installState:m,onBack:()=>t(O.backPath),onOpen:e=>void y(e.item,e.record),onInstall:g}),O.isSceneRoute&&!D.showListSkeleton&&(0,H.jsx)(Rn,{hasMore:!!S.hasNextPage,loading:S.isFetchingNextPage,sentinelRef:E}),O.showShelves&&(0,H.jsx)(nZ,{recentEntries:O.recentEntries,scenes:O.scenes,isScenesLoading:O.isScenesLoading,isItemsLoading:D.showListSkeleton||C.isLoading,language:r,installState:m,onOpen:e=>void y(e.item,e.record),onInstall:g,onOpenScene:e=>t(`${O.pathPrefix}/${e}`)}),!O.isSceneRoute&&(0,H.jsx)(GX,{model:D.itemListView,showTitle:O.showShelves||!D.showListSkeleton,operationState:{installState:m,manageState:h},scroll:{hasMore:!!S.hasNextPage,loadingMore:S.isFetchingNextPage,sentinelRef:E},actions:{onOpen:(e,t)=>void y(e,t),onInstall:g,onManage:_}})]})}),(0,H.jsx)(v,{})]})}function OZ({error:e,filter:t,installedById:n,isError:r,isFetchingNextPage:i,isLoading:a,isStarting:o,items:s,localeFallbacks:c,onFilterChange:l,onInstall:u,onLoadMore:d,onSearchChange:f,onSelect:p,onUpdate:m,operations:h,hasNextPage:g,search:_,startingSource:v}){return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(kZ,{filter:t,onFilterChange:l,onSearchChange:f,search:_}),(0,H.jsxs)(`div`,{className:`custom-scrollbar min-h-0 flex-1 overflow-y-auto bg-background px-4 py-4 sm:px-6 sm:py-5`,children:[e?(0,H.jsx)(`div`,{role:`alert`,className:`mb-2 rounded-xl bg-destructive/8 px-3 py-2.5 text-xs leading-5 text-destructive ring-1 ring-destructive/15`,children:e.message||T(`appPackagesActionFailed`)}):null,(0,H.jsx)(AZ,{installedById:n,isError:r,isFetchingNextPage:i,isLoading:a,isStarting:o,items:s,localeFallbacks:c,onInstall:u,onLoadMore:d,onSelect:p,onUpdate:m,operations:h,hasNextPage:g,startingSource:v})]})]})}function kZ({filter:e,onFilterChange:t,onSearchChange:n,search:r}){let i=[{value:`all`,label:T(`appPackagesFilterAll`)},{value:`featured`,label:T(`appPackagesMarketplaceFeatured`)},{value:`personal`,label:T(`appPackagesFilterPersonal`)},{value:`local`,label:T(`appPackagesFilterLocal`)}];return(0,H.jsxs)(`div`,{className:`shrink-0 border-b border-border/60 bg-card px-5 pb-3.5 pt-[max(1.25rem,env(safe-area-inset-top))] sm:px-6 sm:pt-5`,children:[(0,H.jsxs)(zr,{className:`pr-8`,children:[(0,H.jsx)(Hr,{className:`text-xl`,children:T(`appPackagesMarketplaceTitle`)}),(0,H.jsx)(Fr,{className:`max-w-xl leading-5`,children:T(`appPackagesMarketplaceDescription`)})]}),(0,H.jsxs)(`div`,{className:`relative mt-4`,children:[(0,H.jsx)(fi,{className:`pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground`}),(0,H.jsx)(Gt,{autoFocus:!0,className:`h-10 rounded-xl border-transparent bg-muted/65 pl-9 shadow-none focus-visible:ring-1`,value:r,onChange:e=>n(e.target.value),placeholder:T(`appPackagesMarketplaceSearch`),"aria-label":T(`appPackagesMarketplaceSearch`)})]}),(0,H.jsx)(`div`,{className:`mt-3 flex gap-1 overflow-x-auto`,"aria-label":T(`appPackagesFilterLabel`),children:i.map(n=>(0,H.jsx)(`button`,{type:`button`,onClick:()=>t(n.value),className:c(`shrink-0 rounded-full px-3 py-1.5 text-xs font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,e===n.value?`bg-foreground text-background`:`text-muted-foreground hover:bg-[var(--interaction-hover)] hover:text-foreground`),children:n.label},n.value))})]})}function AZ({installedById:e,isError:t,isFetchingNextPage:n,isLoading:r,isStarting:i,items:a,localeFallbacks:o,onInstall:s,onLoadMore:c,onSelect:l,onUpdate:u,operations:d,hasNextPage:f,startingSource:p}){return r?(0,H.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2 min-[820px]:grid-cols-3`,"aria-label":T(`appPackagesMarketplaceLoading`),children:[(0,H.jsx)(xi,{className:`aspect-[16/9] w-full rounded-2xl`}),(0,H.jsx)(xi,{className:`aspect-[16/9] w-full rounded-2xl`}),(0,H.jsx)(xi,{className:`hidden aspect-[16/9] w-full rounded-2xl min-[820px]:block`})]}):t?(0,H.jsx)(`div`,{role:`alert`,className:`rounded-xl border border-destructive/20 bg-destructive/5 px-4 py-5 text-sm text-destructive`,children:T(`appPackagesMarketplaceFailed`)}):a.length===0?(0,H.jsxs)(`div`,{className:`flex flex-col items-center px-6 py-14 text-center`,children:[(0,H.jsx)(`span`,{className:`flex h-11 w-11 items-center justify-center rounded-2xl bg-muted`,children:(0,H.jsx)(fi,{className:`h-5 w-5 text-muted-foreground`})}),(0,H.jsx)(`p`,{className:`mt-3 text-sm font-medium text-foreground`,children:T(`appPackagesMarketplaceEmpty`)}),(0,H.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:T(`appPackagesMarketplaceEmptyHint`)})]}):(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 min-[820px]:grid-cols-3`,children:a.map(t=>(0,H.jsx)(jZ,{installedPackage:e.get(t.appId),isStarting:i&&p===t.install.spec,item:t,localeFallbacks:o,onInstall:s,onSelect:l,onUpdate:u,operation:ZY(d,t.appId,t.install.spec)},t.id))}),f?(0,H.jsx)(`div`,{className:`flex justify-center pt-5`,children:(0,H.jsx)(`button`,{type:`button`,disabled:n,onClick:c,className:`rounded-full border border-border bg-card px-4 py-2 text-xs font-medium text-foreground transition hover:bg-[var(--interaction-hover)] disabled:cursor-wait disabled:opacity-60`,children:T(n?`appPackagesMarketplaceLoadingMore`:`appPackagesMarketplaceLoadMore`)})}):null]})}function jZ({installedPackage:e,isStarting:t,item:n,localeFallbacks:r,onInstall:i,onSelect:a,onUpdate:o,operation:s}){let c=e?MZ(e.name,e.nameI18n):n.name,l=En(n.summaryI18n,n.summary,r),u=s?mX(s.status):!1,d=s?.status===`failed`||s?.status===`interrupted`,f=!!(e&&e.activeVersion!==n.latestVersion);return(0,H.jsxs)(`article`,{className:`group relative overflow-hidden rounded-2xl border border-border/60 bg-card shadow-sm transition duration-200 hover:-translate-y-0.5 hover:border-border hover:shadow-lg`,children:[(0,H.jsx)(`button`,{type:`button`,onClick:()=>a(n.slug),className:`block w-full text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring`,children:(0,H.jsx)(qY,{accentColor:n.accentColor,coverPreview:n.coverPreview,coverUrl:n.coverUrl,name:c,className:`aspect-[16/9] rounded-none ring-0`})}),(0,H.jsxs)(`div`,{className:`p-3.5`,children:[(0,H.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,H.jsx)(WY,{icon:n.iconUrl??e?.icon,name:c,className:`h-11 w-11 rounded-[13px]`}),(0,H.jsxs)(`button`,{type:`button`,onClick:()=>a(n.slug),className:`min-w-0 flex-1 rounded-lg text-left focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,children:[(0,H.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,H.jsx)(`span`,{className:`truncate text-sm font-semibold text-foreground`,children:c}),n.featured?(0,H.jsx)(Ar,{className:`h-3.5 w-3.5 shrink-0 text-amber-500`,"aria-label":T(`appPackagesMarketplaceFeatured`)}):null]}),(0,H.jsx)(`span`,{className:`mt-1 line-clamp-2 block min-h-10 text-xs leading-5 text-muted-foreground`,children:l}),(0,H.jsxs)(`span`,{className:`mt-2 flex items-center gap-1.5 text-[11px] text-muted-foreground/75`,children:[(0,H.jsx)(`span`,{children:n.publisher.name}),(0,H.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,H.jsxs)(`span`,{children:[`v`,n.latestVersion]}),(0,H.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,H.jsx)(`span`,{children:vX(n.availability,T(`appPackagesAllPlatforms`))}),(0,H.jsx)(oa,{className:`ml-0.5 h-3 w-3 opacity-0 transition-opacity group-hover:opacity-60`})]})]})]}),(0,H.jsx)(`div`,{className:`mt-3 flex items-center justify-end border-t border-border/50 pt-3`,children:(0,H.jsx)(YY,{active:u,canUpdate:f,failed:d,installed:!!e,isStarting:t,onAction:()=>f?o(n.appId):i(n.install.spec,n.install.registry),operation:s})})]}),s&&(u||d)?(0,H.jsx)(`div`,{className:`px-4 pb-4`,children:(0,H.jsx)(XY,{operation:s})}):null]})}function MZ(e,t){let n=A()===`zh`?`zh-CN`:`en-US`;return t?.[n]??e??``}function NZ({detail:e,error:t,installedPackage:n,isLoading:r,isStarting:i,localeFallbacks:a,onInstall:o,onUpdate:s,operation:c}){if(r)return(0,H.jsxs)(`div`,{className:`space-y-4 p-6`,children:[(0,H.jsx)(xi,{className:`h-24 w-full rounded-2xl`}),(0,H.jsx)(xi,{className:`h-40 w-full rounded-2xl`})]});if(t||!e)return(0,H.jsx)(`div`,{role:`alert`,className:`m-6 rounded-xl border border-destructive/20 bg-destructive/5 px-4 py-5 text-sm text-destructive`,children:t?.message??T(`appPackagesMarketplaceFailed`)});let l=En(e.summaryI18n,e.summary,a),u=En(e.descriptionI18n,e.description??l,a),d=c?mX(c.status):!1,f=c?.status===`failed`||c?.status===`interrupted`,p=e.manifest.components??[],m=p.filter(e=>e.kind===`panel`).length,h=p.filter(e=>e.kind===`service`).length,g=e.manifest.runtime?.profile??(h>0?`native-process`:`panel-only`),_=!!(n&&n.activeVersion!==e.latestVersion);return(0,H.jsxs)(`div`,{className:`mx-auto w-full max-w-3xl px-5 py-5 sm:px-7 sm:py-6`,children:[(0,H.jsxs)(`div`,{className:`grid items-stretch gap-5 sm:grid-cols-[minmax(0,1.18fr)_minmax(240px,0.82fr)]`,children:[(0,H.jsx)(qY,{accentColor:e.accentColor,coverPreview:e.coverPreview,coverUrl:e.coverUrl,name:e.name,className:`aspect-[16/9] rounded-2xl`}),(0,H.jsxs)(`div`,{className:`flex min-w-0 flex-col rounded-2xl border border-border/60 bg-card p-4`,children:[(0,H.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,H.jsx)(WY,{icon:e.iconUrl??n?.icon,name:e.name,className:`h-14 w-14 rounded-2xl`}),(0,H.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,H.jsx)(`h2`,{className:`text-lg font-semibold tracking-tight text-foreground`,children:e.name}),(0,H.jsxs)(`div`,{className:`mt-1.5 flex flex-wrap items-center gap-2 text-[11px] text-muted-foreground`,children:[(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,H.jsx)(Lo,{className:`h-3.5 w-3.5`}),e.publisher.name]}),(0,H.jsxs)(`span`,{children:[`v`,e.latestVersion]})]})]})]}),(0,H.jsx)(`p`,{className:`mt-3 text-sm leading-6 text-muted-foreground`,children:l}),(0,H.jsx)(`div`,{className:`mt-auto pt-4`,children:(0,H.jsx)(YY,{active:d,canUpdate:_,failed:f,installed:!!n,isStarting:i,onAction:()=>_?s(e.appId):o(e.install.spec,e.install.registry),operation:c})})]})]}),c&&(d||f)?(0,H.jsx)(XY,{operation:c}):null,(0,H.jsxs)(`section`,{className:`mt-7`,children:[(0,H.jsx)(`h3`,{className:`text-sm font-semibold text-foreground`,children:T(`appPackagesAboutApp`)}),(0,H.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-muted-foreground`,children:u})]}),(0,H.jsxs)(`div`,{className:`mt-6 grid gap-3 sm:grid-cols-2`,children:[(0,H.jsx)(PZ,{icon:vo,label:T(`appPackagesPlatformsLabel`),value:vX(e.availability,T(`appPackagesAllPlatforms`))}),(0,H.jsx)(PZ,{icon:wn,label:T(`appPackagesPanelsAdded`),value:m>0?String(m):T(`appPackagesNone`)}),(0,H.jsx)(PZ,{icon:Po,label:T(`appPackagesServicesAdded`),value:h>0?String(h):T(`appPackagesNone`)}),e.manifest.engines?.nextclaw?(0,H.jsx)(PZ,{icon:Lo,label:T(`appPackagesNextClawRequirement`),value:e.manifest.engines.nextclaw}):null,(0,H.jsx)(PZ,{icon:g===`native-process`?Io:Lo,label:T(`appPackagesIsolationLabel`),value:T(g===`native-process`?`appPackagesIsolationFullUser`:g===`wasi`?`appPackagesIsolationMediated`:`appPackagesIsolationPanel`)})]}),(0,H.jsxs)(`section`,{className:`mt-7 border-t border-border/60 pt-6`,children:[(0,H.jsx)(`h3`,{className:`text-sm font-semibold text-foreground`,children:T(`appPackagesAccessTitle`)}),(0,H.jsx)(`div`,{className:`mt-3 space-y-2`,children:FZ(e).map(e=>(0,H.jsxs)(`div`,{className:`flex items-start gap-2.5 rounded-xl bg-muted/45 px-3 py-2.5 text-xs leading-5 text-muted-foreground`,children:[(0,H.jsx)(Lo,{className:`mt-0.5 h-3.5 w-3.5 shrink-0`}),(0,H.jsx)(`span`,{children:e})]},e))})]}),(0,H.jsxs)(`a`,{href:e.webUrl,target:`_blank`,rel:`noreferrer`,className:`mt-6 inline-flex items-center gap-1.5 text-xs font-medium text-muted-foreground underline-offset-4 hover:text-foreground hover:underline focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,children:[T(`appPackagesOpenPublicDetails`),(0,H.jsx)(ue,{className:`h-3.5 w-3.5`})]})]})}function PZ({icon:e,label:t,value:n}){return(0,H.jsxs)(`div`,{className:`flex items-center gap-3 rounded-xl border border-border/60 px-3 py-3`,children:[(0,H.jsx)(`span`,{className:`flex h-8 w-8 items-center justify-center rounded-lg bg-muted text-muted-foreground`,children:(0,H.jsx)(e,{className:`h-4 w-4`})}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:t}),(0,H.jsx)(`p`,{className:`text-sm font-medium text-foreground`,children:n})]})]})}function FZ(e){let t=[],n=e.permissions.documentAccess??[];n.length>0&&t.push(T(`appPackagesDocumentAccess`).replace(`{count}`,String(n.length)));let r=e.permissions.allowedDomains??[];return r.length>0&&t.push(T(`appPackagesNetworkAccess`).replace(`{count}`,String(r.length))),e.permissions.capabilities?.hostBridge&&t.push(T(`appPackagesHostBridgeAccess`)),e.permissions.capabilities?.nativeProcess&&t.push(T(`appPackagesNativeProcessAccess`)),(e.permissions.storage===!0||typeof e.permissions.storage==`object`&&e.permissions.storage?.namespace)&&t.push(T(`appPackagesLocalStorageAccess`)),t.length>0?t:[T(`appPackagesNoExtraAccess`)]}var IZ=`https://apps-registry.nextclaw.io`,LZ=new Set([404,405,501]),RZ=(void 0)?.replace(/\/$/,``),zZ=void 0,BZ=new Set([`hello-notes`,`personal-organizer`,`starter-card`,`workspace-glance`]);async function VZ(e={},t){let n=await WZ(e,t);return LZ.has(n.status)?await KZ(e,t):await GZ(n)}async function HZ(e,t){let n=await fetch(`${IZ}/api/v1/apps/items/${encodeURIComponent(e)}`,{headers:{accept:`application/json`},signal:t});if(!n.ok)throw Error(`Marketplace detail request failed (${n.status})`);let r=await n.json();if(!ZZ(r)||r.ok!==!0||!ZZ(r.data))throw Error(`Marketplace returned an invalid app detail`);let{data:i}=r,a=i;if(!JZ(i)||!ZZ(a.manifest)||!ZZ(a.permissions))throw Error(`Marketplace returned an invalid app detail`);let{manifest:o,permissions:s}=a,c=Array.isArray(o.components)?o.components.filter(e=>ZZ(e)&&(e.kind===`panel`||e.kind===`service`)&&typeof e.path==`string`):void 0;return{...UZ(i),description:typeof a.description==`string`?a.description:void 0,descriptionI18n:XZ(a.descriptionI18n)?a.descriptionI18n:void 0,manifest:{schemaVersion:o.schemaVersion===2?2:1,icon:typeof o.icon==`string`?o.icon:void 0,engines:ZZ(o.engines)&&typeof o.engines.nextclaw==`string`?{nextclaw:o.engines.nextclaw}:void 0,components:c},permissions:s}}function UZ(e){if(e.coverUrl)return e;let t=qZ(e.slug);return e.publisher.id!==`nextclaw`||!t?e:{...e,coverUrl:t,coverPreview:!0}}async function WZ(e,t){let{cursor:n,featured:r,limit:i,publisher:a,q:o,sort:s,tag:c,tags:l}=e,u=new URLSearchParams;return o&&u.set(`q`,o),c&&u.set(`tag`,c),l?.length&&u.set(`tags`,l.join(`,`)),a&&u.set(`publisher`,a),r!==void 0&&u.set(`featured`,String(r)),s&&u.set(`sort`,s),n&&u.set(`cursor`,n),u.set(`limit`,String(i??24)),await fetch(`${IZ}/api/v2/apps/items?${u}`,{headers:{accept:`application/json`},signal:t})}async function GZ(e){if(!e.ok)throw Error(`Marketplace request failed (${e.status})`);let t=await e.json();if(!ZZ(t)||t.ok!==!0||!ZZ(t.data))throw Error(`Marketplace returned an invalid response`);return{items:(Array.isArray(t.data.items)?t.data.items.filter(JZ):[]).map(UZ),nextCursor:typeof t.data.nextCursor==`string`?t.data.nextCursor:void 0,hasMore:t.data.hasMore===!0,query:typeof t.data.query==`string`?t.data.query:void 0,tag:typeof t.data.tag==`string`?t.data.tag:void 0,featured:typeof t.data.featured==`boolean`?t.data.featured:void 0,sort:t.data.sort===`updated`||t.data.sort===`featured`?t.data.sort:`relevance`}}async function KZ(e,t){let{featured:n,publisher:r,q:i,sort:a,tag:o,tags:s}=e,c=new URLSearchParams({page:`1`,pageSize:`100`});i&&c.set(`q`,i),o&&c.set(`tag`,o);let l=await fetch(`${IZ}/api/v1/apps/items?${c}`,{headers:{accept:`application/json`},signal:t});if(!l.ok)throw Error(`Marketplace compatibility request failed (${l.status})`);let u=await l.json();if(!ZZ(u)||u.ok!==!0||!ZZ(u.data))throw Error(`Marketplace returned an invalid compatibility response`);let d=Array.isArray(u.data.items)?u.data.items.filter(JZ):[],f=new Set(s??[]);return{items:d.filter(e=>!r||e.publisher.id===r).filter(e=>n===void 0||e.featured===n).filter(e=>f.size===0||e.tags.some(e=>f.has(e))).map(UZ),hasMore:!1,query:i,tag:o,tags:s,featured:n,sort:a??(i?`relevance`:`featured`)}}function qZ(e){let t=RZ??zZ;if(t&&BZ.has(e))return`${t}/${encodeURIComponent(e)}.webp`}function JZ(e){return!ZZ(e)||!ZZ(e.install)||!ZZ(e.publisher)?!1:typeof e.id==`string`&&typeof e.slug==`string`&&typeof e.appId==`string`&&typeof e.name==`string`&&(e.iconUrl===void 0||typeof e.iconUrl==`string`)&&(e.coverUrl===void 0||typeof e.coverUrl==`string`)&&(e.coverPreview===void 0||typeof e.coverPreview==`boolean`)&&(e.accentColor===void 0||typeof e.accentColor==`string`)&&typeof e.summary==`string`&&XZ(e.summaryI18n)&&Array.isArray(e.tags)&&e.tags.every(e=>typeof e==`string`)&&typeof e.latestVersion==`string`&&typeof e.featured==`boolean`&&(e.availability===void 0||YZ(e.availability))&&typeof e.publisher.id==`string`&&typeof e.publisher.name==`string`&&e.install.kind===`registry`&&typeof e.install.spec==`string`&&typeof e.install.registry==`string`&&typeof e.webUrl==`string`}function YZ(e){return!ZZ(e)||e.mode!==`universal`&&e.mode!==`targeted`?!1:Array.isArray(e.targets)&&e.targets.every(e=>typeof e==`string`)&&Array.isArray(e.operatingSystems)&&e.operatingSystems.every(e=>e===`darwin`||e===`linux`||e===`win32`)}function XZ(e){return ZZ(e)&&Object.values(e).every(e=>typeof e==`string`)}function ZZ(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var QZ=[`app-marketplace`,`v3`];function $Z(e,t){let n=zn({queryKey:[...QZ,e],initialPageParam:void 0,queryFn:async({pageParam:t,signal:n})=>await VZ({...e,cursor:t,limit:24},n),getNextPageParam:e=>e.nextCursor,enabled:t,retry:1,staleTime:300*1e3}),r=(0,V.useMemo)(()=>{if(!n.data)return;let e=new Map;for(let t of n.data.pages)for(let n of t.items)e.set(n.id,n);return{items:[...e.values()],hasMore:n.data.pages.at(-1)?.hasMore??!1}},[n.data]);return{...n,data:r}}function eQ(e,t){return dn({queryKey:[`app-marketplace-detail`,`v2`,e],queryFn:async({signal:t})=>await HZ(e??``,t),enabled:t&&!!e,retry:1,staleTime:300*1e3})}var tQ=new Set([`nextclaw.starter-card`,`nextclaw.validation-task-board`]);function nQ({error:e,installedPackages:t,isStarting:n,onInstall:r,onOpenChange:i,onUpdate:a,open:o,operations:s,startingSource:c}){let[l,u]=(0,V.useState)(`all`),[d,f]=(0,V.useState)(``),[p,m]=(0,V.useState)(``),[h,g]=(0,V.useState)(null);(0,V.useEffect)(()=>{let e=window.setTimeout(()=>m(d.trim()),250);return()=>window.clearTimeout(e)},[d]);let _=$Z((0,V.useMemo)(()=>({q:p||void 0,featured:l===`featured`?!0:void 0,tags:l===`personal`?[`personal`,`productivity`,`notes`,`calendar`]:void 0,tag:l===`local`?`local`:void 0,sort:p?`relevance`:`featured`}),[p,l]),o),v=eQ(h,o),y=(0,V.useMemo)(()=>new Map(t.map(e=>[e.id,e])),[t]),b=Ln(A()===`zh`?`zh-CN`:`en-US`),x=(0,V.useMemo)(()=>(_.data?.items??[]).filter(e=>!tQ.has(e.appId)),[_.data?.items]);return(0,H.jsx)(Rr,{open:o,onOpenChange:e=>{e||g(null),i(e)},children:(0,H.jsxs)(Vr,{className:`flex h-dvh w-screen max-w-none flex-col gap-0 overflow-hidden rounded-none border-0 bg-background/95 p-0 shadow-[0_32px_100px_rgba(0,0,0,0.24)] backdrop-blur-xl [&>button.absolute]:top-[max(1rem,env(safe-area-inset-top))] sm:h-[min(680px,calc(100dvh-4rem))] sm:w-[min(920px,calc(100vw-3rem))] sm:max-w-none sm:rounded-2xl sm:border sm:border-border/55`,children:[h?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(rQ,{onBack:()=>g(null)}),(0,H.jsx)(`div`,{className:`custom-scrollbar min-h-0 flex-1 overflow-y-auto bg-background`,children:(0,H.jsx)(NZ,{detail:v.data,error:v.error instanceof Error?v.error:null,installedPackage:v.data?y.get(v.data.appId):void 0,isLoading:v.isLoading,isStarting:n&&v.data?.install.spec===c,localeFallbacks:b,onInstall:r,onUpdate:a,operation:v.data?ZY(s,v.data.appId,v.data.install.spec):void 0})})]}):(0,H.jsx)(OZ,{error:e,filter:l,installedById:y,isError:_.isError,isFetchingNextPage:_.isFetchingNextPage,isLoading:_.isLoading,isStarting:n,items:x,localeFallbacks:b,onFilterChange:u,onInstall:r,onLoadMore:()=>void _.fetchNextPage(),onSearchChange:f,onSelect:g,onUpdate:a,operations:s,hasNextPage:_.hasNextPage,search:d,startingSource:c}),(0,H.jsxs)(`div`,{className:`flex items-start gap-2 border-t border-border/60 bg-muted/25 px-5 pb-[max(.75rem,env(safe-area-inset-bottom))] pt-3 text-[11px] leading-4 text-muted-foreground sm:px-6 sm:pb-3`,children:[(0,H.jsx)(Lo,{className:`mt-0.5 h-3.5 w-3.5 shrink-0`}),(0,H.jsx)(`span`,{children:T(`appPackagesMarketplaceTrustHint`)})]})]})})}function rQ({onBack:e}){return(0,H.jsx)(`div`,{className:`border-b border-border/60 bg-card px-4 pb-3 pt-[max(.75rem,env(safe-area-inset-top))] sm:px-5 sm:pt-3`,children:(0,H.jsxs)(`button`,{type:`button`,onClick:e,className:`inline-flex items-center gap-2 rounded-lg px-2 py-1.5 text-sm font-medium text-muted-foreground transition-colors hover:bg-[var(--interaction-hover)] hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,children:[(0,H.jsx)(di,{className:`h-4 w-4`}),T(`appPackagesBackToMarketplace`)]})})}function iQ({appPackage:e,isPending:t,operation:n,onDisable:r,onEnable:i,onOpenPanelApp:a,onRollback:o,onUninstall:s,onUpdate:l,panelApps:u,storageUsage:d,storageUsageLoading:f,storageUsageUnavailable:p}){let[m,h]=(0,V.useState)(!1),[g,_]=(0,V.useState)(!1),[v,y]=(0,V.useState)(!1),b=(0,V.useRef)(!1),x=(0,V.useRef)(null),S=e.components.filter(e=>e.kind===`panel`),C=e.components.length-S.length,w=e.installedVersions.filter(t=>t!==e.activeVersion),E=pQ(e.name,e.nameI18n)??e.id,D=pQ(e.description,e.descriptionI18n),O=n?mX(n.status):!1,k=t||O,A=oQ(d,f,p);return(0,H.jsxs)(ks,{surface:`flat`,hover:!1,className:`overflow-hidden border-border/60 shadow-[0_1px_2px_rgba(0,0,0,0.025)]`,children:[(0,H.jsxs)(`div`,{className:`flex items-start gap-3.5 px-4 pb-3.5 pt-4`,children:[(0,H.jsx)(WY,{icon:e.icon,name:E}),(0,H.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,H.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,H.jsx)(`h2`,{className:`truncate text-sm font-semibold text-foreground`,children:E}),(0,H.jsx)(`span`,{className:c(`shrink-0 rounded-full px-2 py-0.5 text-[10px] font-medium`,e.enabled?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:`bg-muted text-muted-foreground`),children:e.enabled?T(`appPackagesEnabled`):T(`appPackagesAvailable`)})]}),D?(0,H.jsx)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-muted-foreground`,children:D}):null,(0,H.jsxs)(`div`,{className:`mt-1.5 flex flex-wrap items-center gap-x-2 gap-y-1 text-[11px] text-muted-foreground/75`,children:[(0,H.jsxs)(`span`,{children:[`v`,e.activeVersion]}),e.builtIn?(0,H.jsx)(`span`,{children:T(`appPackagesBuiltIn`)}):null,C>0?(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,H.jsx)(Po,{className:`h-3 w-3`}),T(`appPackagesLocalService`)]}):null,(0,H.jsxs)(`span`,{className:c(`inline-flex items-center gap-1`,e.isolation===`full-user`&&`text-amber-700 dark:text-amber-300`),children:[e.isolation===`full-user`?(0,H.jsx)(Io,{className:`h-3 w-3`}):(0,H.jsx)(Lo,{className:`h-3 w-3`}),e.isolation===`full-user`?T(`appPackagesIsolationFullUser`):e.isolation===`host-mediated`?T(`appPackagesIsolationMediated`):T(`appPackagesIsolationPanel`)]})]}),(0,H.jsxs)(`div`,{className:`mt-2 flex min-w-0 items-center gap-1.5 rounded-md bg-muted/35 px-2 py-1 text-[10px] text-muted-foreground`,title:e.storage.dataDirectory,children:[(0,H.jsx)(qa,{className:`h-3 w-3 shrink-0`}),(0,H.jsxs)(`span`,{className:`shrink-0`,children:[T(`appPackagesDataUsage`),` `,A]}),(0,H.jsx)(`code`,{className:`min-w-0 truncate font-mono text-[10px]`,children:e.storage.dataDirectory})]})]}),(0,H.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[(0,H.jsx)(R,{type:`button`,size:`sm`,variant:e.enabled?`outline`:`default`,disabled:k,onClick:e.enabled?r:i,children:sQ({enabled:e.enabled,isPending:t,operation:n,operationActive:O})}),(0,H.jsxs)(Tc,{open:m,onOpenChange:h,children:[(0,H.jsx)(Ec,{asChild:!0,children:(0,H.jsx)(`button`,{type:`button`,"aria-label":T(`appPackagesMoreActions`),title:T(`appPackagesMoreActions`),disabled:k,className:`rounded-full p-2 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 disabled:opacity-50`,children:(0,H.jsx)(wa,{className:`h-4 w-4`})})}),(0,H.jsxs)(Oc,{align:`end`,className:`w-52 rounded-xl p-1.5`,onCloseAutoFocus:e=>{b.current&&=(e.preventDefault(),!1)},children:[(0,H.jsx)(cQ,{icon:gi,label:T(`appPackagesCheckUpdate`),onClick:()=>{h(!1),l()}}),w.map(e=>(0,H.jsx)(cQ,{icon:Mo,label:`${T(`appPackagesRollback`)} v${e}`,onClick:()=>{h(!1),o(e)}},e)),(0,H.jsx)(cQ,{destructive:!0,icon:Yo,label:T(`appPackagesUninstall`),onClick:()=>{b.current=!0,h(!1),y(!1),_(!0)}})]})]})]})]}),n&&(O||n.status===`failed`||n.status===`interrupted`)?(0,H.jsx)(uQ,{operation:n}):null,S.length>0?(0,H.jsx)(`div`,{className:`border-t border-border/60 bg-muted/20 p-2`,children:(0,H.jsx)(`div`,{className:`grid grid-cols-2 gap-1.5`,children:S.map(t=>{let n=u.find(e=>e.appId===t.id),r=fQ(t.id),i=pQ(t.title,t.titleI18n)??t.id;return(0,H.jsxs)(`button`,{type:`button`,disabled:!e.enabled||!n||k,onClick:()=>n&&a({...n,title:i,description:pQ(t.description,t.descriptionI18n)}),className:`group flex min-w-0 items-center gap-2 rounded-lg px-2.5 py-2 text-left transition-colors hover:bg-[var(--interaction-hover)] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border disabled:cursor-default disabled:opacity-55`,title:e.enabled?i:T(`appPackagesEnableToOpen`),children:[(0,H.jsx)(`span`,{className:`flex h-7 w-7 shrink-0 items-center justify-center rounded-lg bg-card text-muted-foreground shadow-sm ring-1 ring-border/60`,children:(0,H.jsx)(lQ,{icon:t.icon,fallback:r})}),(0,H.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs font-medium text-foreground`,children:i}),e.enabled?(0,H.jsx)(oa,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground/50 transition-transform group-hover:translate-x-0.5`}):null]},t.id)})})}):null,(0,H.jsx)(Rr,{open:g,onOpenChange:_,children:(0,H.jsxs)(Vr,{className:`max-w-md [&>:last-child]:hidden`,onOpenAutoFocus:e=>{e.preventDefault(),x.current?.focus()},children:[(0,H.jsxs)(zr,{children:[(0,H.jsx)(Hr,{children:T(`appPackagesUninstallTitle`)}),(0,H.jsx)(Fr,{children:T(`appPackagesUninstallDescription`)})]}),(0,H.jsxs)(`div`,{className:`mt-4 grid gap-2`,children:[(0,H.jsx)($Y,{checked:!v,description:T(`appPackagesKeepDataDescription`),label:T(`appPackagesKeepData`),onClick:()=>y(!1)}),(0,H.jsx)($Y,{checked:v,destructive:!0,description:T(`appPackagesDeleteDataDescription`),label:T(`appPackagesDeleteData`),onClick:()=>y(!0)})]}),(0,H.jsx)(`div`,{className:`mt-3`,children:(0,H.jsx)(aQ,{loading:f,storage:e.storage,usage:d,unavailable:p})}),(0,H.jsxs)(kr,{className:`mt-5 gap-2 sm:gap-0`,children:[(0,H.jsx)(R,{ref:x,autoFocus:!0,type:`button`,variant:`outline`,onClick:()=>_(!1),children:T(`cancel`)}),(0,H.jsx)(R,{type:`button`,variant:`destructive`,onClick:()=>{s(v),_(!1)},children:T(`appPackagesUninstall`)})]})]})})]})}function aQ({loading:e,storage:t,unavailable:n,usage:r}){return r?(0,H.jsx)(eX,{storage:t,usage:r}):(0,H.jsxs)(`div`,{className:`rounded-xl bg-muted/45 px-3 py-3 text-xs text-muted-foreground`,children:[e?(0,H.jsx)(mi,{className:`mr-1.5 inline h-3.5 w-3.5 animate-spin`}):null,T(e?`appPackagesLoading`:n?`appPackagesDataUsageUnavailable`:`appPackagesNoDataYet`)]})}function oQ(e,t,n){return e?tX(e.totalBytes):T(t?`appPackagesLoading`:n?`appPackagesDataUsageUnavailable`:`appPackagesNoDataYet`)}function sQ({enabled:e,isPending:t,operation:n,operationActive:r}){return r?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(mi,{className:`mr-1.5 h-3.5 w-3.5 animate-spin`}),n?dQ(n):T(`appPackagesWorking`)]}):T(t?`appPackagesWorking`:e?`appPackagesDisable`:`appPackagesEnable`)}function cQ({destructive:e=!1,icon:t,label:n,onClick:r}){return(0,H.jsxs)(`button`,{type:`button`,onClick:r,className:c(`flex w-full items-center gap-2 rounded-lg px-2.5 py-2 text-left text-sm transition-colors`,e?`text-destructive hover:bg-destructive/10`:`text-muted-foreground hover:bg-[var(--interaction-hover)] hover:text-accent-foreground`),children:[(0,H.jsx)(t,{className:`h-4 w-4 shrink-0`}),(0,H.jsx)(`span`,{children:n})]})}function lQ({fallback:e,icon:t}){return t&&(t.startsWith(`data:`)||t.startsWith(`/`)||t.startsWith(`http://`)||t.startsWith(`https://`))?(0,H.jsx)(`img`,{src:t,alt:``,className:`h-4 w-4 rounded object-cover`}):t?(0,H.jsx)(`span`,{className:`text-sm leading-none`,children:t}):(0,H.jsx)(e,{className:`h-3.5 w-3.5`})}function uQ({operation:e}){let t=e.status===`failed`||e.status===`interrupted`,n=Math.max(4,Math.round(e.completedSteps/e.totalSteps*100));return(0,H.jsxs)(`div`,{className:`border-t border-border/50 px-4 py-2.5`,role:t?`alert`:`status`,"aria-live":`polite`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px]`,children:[t?(0,H.jsx)(Ir,{className:`h-3.5 w-3.5 text-destructive`}):(0,H.jsx)(mi,{className:`h-3.5 w-3.5 animate-spin text-primary`}),(0,H.jsx)(`span`,{className:t?`text-destructive`:`text-muted-foreground`,children:t?e.error??T(`appPackagesActionFailed`):dQ(e)})]}),(0,H.jsx)(`div`,{className:`mt-2 h-1 overflow-hidden rounded-full bg-muted`,children:(0,H.jsx)(`div`,{className:c(`h-full rounded-full transition-[width] duration-300`,t?`bg-destructive`:`bg-primary`),style:{width:t?`100%`:`${n}%`}})})]})}function dQ(e){switch(e.status){case`queued`:return T(`appPackagesPreparing`);case`resolving`:return T(`appPackagesResolving`);case`downloading`:return T(`appPackagesDownloading`);case`verifying`:return T(`appPackagesVerifying`);case`installing`:return e.action===`rollback`?`${T(`appPackagesSwitchingVersion`)} ${e.targetVersion?`v${e.targetVersion}`:``}`.trim():e.action===`uninstall`?T(`appPackagesUninstalling`):T(`appPackagesInstalling`);case`finalizing`:return T(`appPackagesFinalizing`);case`succeeded`:return T(`appPackagesCompleted`);case`failed`:case`interrupted`:return T(`appPackagesActionFailed`)}}function fQ(e){return e.endsWith(`-todos`)?Vo:e.endsWith(`-notes`)?bo:e.endsWith(`-favorites`)?Yi:e.endsWith(`-calendar`)?na:Gr}function pQ(e,t){let n=A()===`zh`?`zh-CN`:`en-US`;return t?.[n]??e}function mQ({focusedPackageId:e,onOpenPanelApp:t}){let n=fX(),r=rX(),i=pX(),a=vY(),o=gX(),s=bY(),c=xY(),l=q9(),u=(0,V.useRef)(null),[d,f]=(0,V.useState)(!1),[p,m]=(0,V.useState)(``),[h,g]=(0,V.useState)(!1),_=(0,V.useMemo)(()=>i.data?.entries??[],[i.data?.entries]);(0,V.useEffect)(()=>{if(!e||n.isLoading)return;let t=document.getElementById(`app-package-${e}`);t?.scrollIntoView({block:`nearest`}),t?.focus({preventScroll:!0})},[n.data,n.isLoading,e]),hX({isLoaded:!!i.data,operations:_,refetchPackages:n.refetch,refetchPanels:a.refetch,refetchAppData:r.refetch,settlementManager:l.appPackageOperationSettlementManager});let v=(e,t)=>{o.reset(),o.mutate(e,{onSuccess:t})},y=async e=>{if(e.clientDeclared&&!e.clientGranted){if(!await l.serviceActionAuthorizationManager.requestAuthorization({panelAppId:e.appId,actions:[{actionId:`nextclaw.client`,actionTitle:T(`panelAppsClientGrantTitle`),actionDescription:T(`panelAppsClientGrantDescription`),risk:`dangerous`}]}))return;await c.mutateAsync(e.appId)}try{t(await s.mutateAsync(e.id))}catch{t(e)}},b=e=>{e.preventDefault();let t=p.trim();t&&v({action:`install`,source:t},()=>{f(!1),m(``)})};return(0,H.jsxs)(`div`,{className:`@container flex h-full min-h-0 flex-col bg-card text-card-foreground`,children:[(0,H.jsxs)(`div`,{className:`flex min-h-12 shrink-0 items-center justify-end gap-1 border-b border-border/70 px-4 py-2`,children:[(0,H.jsx)(`button`,{type:`button`,onClick:()=>{n.refetch(),i.refetch(),a.refetch(),r.refetch()},className:`rounded-full p-2 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:T(`appPackagesRefresh`),"aria-label":T(`appPackagesRefresh`),children:(0,H.jsx)(gi,{className:`h-3.5 w-3.5`})}),(0,H.jsxs)(R,{type:`button`,size:`sm`,variant:`outline`,onClick:()=>{o.reset(),g(!0)},children:[(0,H.jsx)(Ko,{className:`mr-1.5 h-3.5 w-3.5`}),T(`appPackagesBrowse`)]}),(0,H.jsxs)(R,{type:`button`,size:`sm`,variant:`outline`,onClick:()=>{o.reset(),f(!0)},children:[(0,H.jsx)(xo,{className:`mr-1.5 h-3.5 w-3.5`}),T(`appPackagesInstall`)]})]}),(0,H.jsx)(`div`,{className:`custom-scrollbar min-h-0 flex-1 overflow-y-auto`,children:(0,H.jsxs)(`div`,{className:`mx-auto w-full max-w-3xl p-3 sm:p-5`,children:[(0,H.jsxs)(`div`,{className:`mb-4 px-1`,children:[(0,H.jsx)(`h1`,{ref:u,tabIndex:-1,className:`text-base font-semibold tracking-tight text-foreground`,children:T(`appPackagesLibraryTitle`)}),(0,H.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-muted-foreground`,children:T(`appPackagesLibraryDescription`)})]}),o.isError?(0,H.jsx)(`div`,{role:`alert`,className:`mb-3 rounded-xl bg-destructive/8 px-3 py-2.5 text-xs leading-5 text-destructive ring-1 ring-destructive/15`,children:o.error instanceof Error?o.error.message:T(`appPackagesActionFailed`)}):null,(0,H.jsx)(hQ,{appDataEntries:r.data?.entries??[],appDataLoading:r.isLoading,appDataUnavailable:r.isError,error:vQ(n.error,a.error),focusedPackageId:e,isLoading:n.isLoading||a.isLoading,isPending:o.isPending,mutationAppId:`appId`in(o.variables??{})?o.variables.appId:void 0,packages:n.data?.entries??[],panelApps:a.data?.entries??[],operations:_,onInstall:()=>f(!0),onMutate:v,onOpenPanelApp:e=>void y(e)}),(0,H.jsx)(aX,{diagnostics:r.data?.diagnostics??[],entries:r.data?.entries??[],error:r.error,isLoading:r.isLoading,onDeletionFocusReturn:()=>u.current?.focus()})]})}),(0,H.jsx)(nQ,{error:o.error instanceof Error?o.error:null,installedPackages:n.data?.entries??[],startingSource:o.variables?.action===`install`?o.variables.source:void 0,isStarting:o.isPending,operations:_,open:h,onOpenChange:g,onInstall:(e,t)=>v({action:`install`,source:e,registryUrl:t}),onUpdate:e=>v({action:`update`,appId:e})}),(0,H.jsx)(Rr,{open:d,onOpenChange:f,children:(0,H.jsx)(Vr,{className:`max-w-md [&>:last-child]:hidden`,children:(0,H.jsxs)(`form`,{onSubmit:b,children:[(0,H.jsxs)(zr,{children:[(0,H.jsx)(Hr,{children:T(`appPackagesInstallTitle`)}),(0,H.jsx)(Fr,{children:T(`appPackagesInstallDescription`)})]}),(0,H.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[(0,H.jsx)(Gt,{autoFocus:!0,value:p,onChange:e=>m(e.target.value),placeholder:T(`appPackagesInstallPlaceholder`),"aria-label":T(`appPackagesInstallSource`)}),(0,H.jsxs)(`div`,{className:`flex items-start gap-2 rounded-xl bg-muted/60 px-3 py-2.5 text-xs leading-5 text-muted-foreground`,children:[(0,H.jsx)(Lo,{className:`mt-0.5 h-3.5 w-3.5 shrink-0`}),(0,H.jsx)(`span`,{children:T(`appPackagesInstallTrustHint`)})]}),o.isError?(0,H.jsx)(`p`,{role:`alert`,className:`text-xs text-destructive`,children:o.error instanceof Error?o.error.message:T(`appPackagesActionFailed`)}):null]}),(0,H.jsxs)(kr,{className:`mt-5 gap-2 sm:gap-0`,children:[(0,H.jsx)(R,{type:`button`,variant:`outline`,onClick:()=>f(!1),children:T(`cancel`)}),(0,H.jsx)(R,{type:`submit`,disabled:!p.trim()||o.isPending,children:o.isPending?T(`appPackagesInstalling`):T(`appPackagesInstall`)})]})]})})})]})}function hQ({appDataEntries:e,appDataLoading:t,appDataUnavailable:n,error:r,focusedPackageId:i,isLoading:a,isPending:o,mutationAppId:s,onInstall:c,onMutate:l,onOpenPanelApp:u,packages:d,panelApps:f,operations:p}){if(a)return(0,H.jsxs)(`div`,{className:`space-y-2.5`,"aria-label":T(`appPackagesLoading`),children:[(0,H.jsx)(xi,{className:`h-44 w-full rounded-2xl`}),(0,H.jsx)(xi,{className:`h-32 w-full rounded-2xl`})]});if(r)return(0,H.jsx)(`div`,{className:`rounded-xl border border-destructive/20 bg-destructive/5 px-4 py-4 text-sm text-destructive`,children:r});if(d.length===0){let e=p.filter(e=>e.action===`install`&&mX(e.status));return e.length>0?(0,H.jsx)(`div`,{className:`space-y-2.5`,children:e.map(e=>(0,H.jsx)(gQ,{operation:e},e.id))}):(0,H.jsxs)(`div`,{className:`flex flex-col items-center rounded-2xl border border-dashed border-border px-6 py-10 text-center`,children:[(0,H.jsx)(xo,{className:`h-7 w-7 text-muted-foreground`}),(0,H.jsx)(`h2`,{className:`mt-3 text-sm font-semibold text-foreground`,children:T(`appPackagesEmptyTitle`)}),(0,H.jsx)(`p`,{className:`mt-1 max-w-sm text-xs leading-5 text-muted-foreground`,children:T(`appPackagesEmptyDescription`)}),(0,H.jsx)(R,{type:`button`,size:`sm`,className:`mt-4`,onClick:c,children:T(`appPackagesInstall`)})]})}return(0,H.jsxs)(`div`,{className:`space-y-2.5`,children:[p.filter(e=>e.action===`install`&&mX(e.status)&&!d.some(t=>t.id===e.appId)).map(e=>(0,H.jsx)(gQ,{operation:e},e.id)),d.map(r=>{let a=p.find(e=>e.appId===r.id),c=a&&(mX(a.status)||a.status===`failed`||a.status===`interrupted`)?a:void 0;return(0,H.jsx)(`section`,{id:`app-package-${r.id}`,"aria-label":r.name,tabIndex:-1,className:i===r.id?`rounded-xl outline-none ring-2 ring-primary/35 ring-offset-2 ring-offset-background`:`rounded-xl outline-none`,children:(0,H.jsx)(iQ,{appPackage:r,storageUsage:e.find(e=>e.source===`package`&&e.lifecycle===`active`&&e.appId===r.id&&e.instanceId===r.instanceId)?.usage??r.storageUsage,storageUsageLoading:t,storageUsageUnavailable:n,panelApps:f.filter(e=>e.packageId===r.id),isPending:o&&s===r.id,operation:c,onEnable:()=>l({action:`enable`,appId:r.id}),onDisable:()=>l({action:`disable`,appId:r.id}),onUpdate:()=>l({action:`update`,appId:r.id}),onRollback:e=>l({action:`rollback`,appId:r.id,version:e}),onUninstall:e=>l({action:`uninstall`,appId:r.id,purgeData:e}),onOpenPanelApp:u})},r.id)})]})}function gQ({operation:e}){let t=e.appId??e.source??T(`appPackagesInstall`),n=Math.max(4,Math.round(e.completedSteps/e.totalSteps*100));return(0,H.jsxs)(`div`,{className:`rounded-xl border border-border/60 bg-card px-4 py-3.5 shadow-[0_1px_2px_rgba(0,0,0,0.025)]`,role:`status`,"aria-live":`polite`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,H.jsx)(WY,{name:t}),(0,H.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,H.jsx)(`p`,{className:`truncate text-sm font-semibold text-foreground`,children:t}),(0,H.jsxs)(`p`,{className:`mt-0.5 flex items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,H.jsx)(mi,{className:`h-3.5 w-3.5 animate-spin`}),_Q(e)]})]})]}),(0,H.jsx)(`div`,{className:`ml-14 mt-2 h-1 overflow-hidden rounded-full bg-muted`,children:(0,H.jsx)(`div`,{className:`h-full rounded-full bg-primary transition-[width] duration-300`,style:{width:`${n}%`}})})]})}function _Q(e){switch(e.status){case`queued`:return T(`appPackagesPreparing`);case`resolving`:return T(`appPackagesResolving`);case`downloading`:return T(`appPackagesDownloading`);case`verifying`:return T(`appPackagesVerifying`);case`installing`:return T(`appPackagesInstalling`);case`finalizing`:return T(`appPackagesFinalizing`);case`succeeded`:return T(`appPackagesCompleted`);case`failed`:case`interrupted`:return e.error??T(`appPackagesActionFailed`)}}function vQ(...e){return e.find(e=>e instanceof Error)?.message||(e.some(Boolean)?T(`appPackagesLoadFailed`):void 0)}function yQ(){return`service-action-auth-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`}var bQ=N((e,t)=>({pending:null,requestAuthorization:async n=>await new Promise(r=>{t().pending?.resolve(!1),e({pending:{id:yQ(),...n,resolve:r}})}),resolveAuthorization:n=>{let{pending:r}=t();r&&(r.resolve(n),e({pending:null}))}}));function xQ(){let e=bQ(e=>e.pending),t=bQ(e=>e.resolveAuthorization);return(0,H.jsx)(Rr,{open:!!e,onOpenChange:e=>{e||t(!1)},children:(0,H.jsxs)(Vr,{className:`[&>:last-child]:hidden`,children:[(0,H.jsxs)(zr,{children:[(0,H.jsxs)(Hr,{className:`flex items-center gap-2`,children:[(0,H.jsx)(Io,{className:`h-4 w-4 text-amber-600`}),T(`serviceActionAuthorizationTitle`)]}),(0,H.jsx)(Fr,{children:T(`serviceActionAuthorizationDescription`)})]}),e?(0,H.jsxs)(`div`,{className:`space-y-3 rounded-md border border-border bg-muted/60 p-3 text-sm`,children:[(0,H.jsx)(CQ,{label:T(`serviceActionAuthorizationSource`),value:e.panelAppId}),(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(`div`,{className:`text-xs font-medium text-muted-foreground`,children:T(`serviceActionAuthorizationActions`)}),(0,H.jsx)(`div`,{className:`max-h-64 space-y-2 overflow-auto`,children:e.actions.map(e=>(0,H.jsx)(SQ,{action:e},e.actionId))})]}),e.inputPreview?(0,H.jsx)(CQ,{label:T(`serviceActionAuthorizationInput`),value:e.inputPreview}):null]}):null,(0,H.jsxs)(kr,{className:`gap-2 sm:gap-0`,children:[(0,H.jsx)(R,{type:`button`,variant:`outline`,onClick:()=>t(!1),children:T(`serviceActionAuthorizationReject`)}),(0,H.jsx)(R,{type:`button`,onClick:()=>t(!0),children:T(`serviceActionAuthorizationAllow`)})]})]})})}function SQ({action:e}){return(0,H.jsxs)(`div`,{className:`space-y-1 rounded border border-border bg-card px-3 py-2`,children:[(0,H.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,H.jsx)(`div`,{className:`min-w-0 break-words text-xs font-medium text-foreground`,children:e.actionTitle??e.actionId}),(0,H.jsx)(`div`,{className:`shrink-0 rounded bg-amber-50 px-1.5 py-0.5 text-[11px] font-medium text-amber-700`,children:e.risk??`dangerous`})]}),(0,H.jsx)(`div`,{className:`break-words text-[11px] text-muted-foreground`,children:e.actionId}),e.actionDescription?(0,H.jsx)(`div`,{className:`break-words text-xs text-muted-foreground`,children:e.actionDescription}):null]})}function CQ({label:e,value:t}){return(0,H.jsxs)(`div`,{className:`grid grid-cols-[5rem_minmax(0,1fr)] gap-3`,children:[(0,H.jsx)(`div`,{className:`text-xs font-medium text-muted-foreground`,children:e}),(0,H.jsx)(`div`,{className:`min-w-0 break-words text-xs text-foreground`,children:t})]})}var wQ=class{constructor(){this.requestAuthorization=async e=>await bQ.getState().requestAuthorization(e)}};function TQ({appId:e,appTitle:t,dataEntry:n,dataLoading:r,deleteError:i,deletePending:a,open:o,purgeData:s,onDelete:c,onOpenChange:l,onPurgeDataChange:u}){let d=(0,V.useRef)(null);(0,V.useEffect)(()=>{i&&d.current?.focus()},[i]);let f=()=>l(!1);return(0,H.jsx)(Rr,{open:o,onOpenChange:e=>!a&&l(e),children:(0,H.jsxs)(Vr,{className:`max-w-md [&>:last-child]:hidden`,onEscapeKeyDown:e=>a&&e.preventDefault(),onInteractOutside:e=>a&&e.preventDefault(),children:[(0,H.jsxs)(zr,{children:[(0,H.jsx)(Hr,{children:T(`serviceAppsDeleteConfirmTitle`)}),(0,H.jsxs)(Fr,{children:[T(`serviceAppsDeleteConfirmDescription`),` `,t]})]}),(0,H.jsxs)(`div`,{className:`mt-4 grid gap-2`,children:[(0,H.jsx)($Y,{checked:!s,description:T(`serviceAppsKeepDataDescription`),label:T(`appPackagesKeepData`),onClick:()=>u(!1)}),(0,H.jsx)($Y,{checked:s,destructive:!0,disabled:!n||r,description:T(`serviceAppsDeleteDataDescription`),label:T(`appPackagesDeleteData`),onClick:()=>u(!0)})]}),n?(0,H.jsx)(`div`,{className:`mt-3`,children:(0,H.jsx)(eX,{storage:n.storage,usage:n.usage})}):(0,H.jsx)(`p`,{role:`status`,className:`mt-3 text-xs text-muted-foreground`,children:T(r?`appPackagesLoading`:`serviceAppsDataUnavailable`)}),i?(0,H.jsx)(`p`,{ref:d,role:`alert`,tabIndex:-1,className:`mt-3 text-xs text-destructive`,children:i instanceof Error?i.message:T(`appPackagesActionFailed`)}):null,(0,H.jsxs)(kr,{className:`mt-5 gap-2 sm:gap-0`,children:[(0,H.jsx)(R,{autoFocus:!0,type:`button`,variant:`outline`,disabled:a,onClick:f,children:T(`cancel`)}),(0,H.jsxs)(R,{type:`button`,variant:s?`destructive`:`default`,disabled:a||s&&!n,onClick:()=>c(e,s,f),children:[a?(0,H.jsx)(mi,{className:`mr-1.5 h-3.5 w-3.5 animate-spin`}):null,T(s?`appDataDeletePermanently`:`serviceAppsDelete`)]})]})]})})}function EQ({app:e,actions:t,actionsOpen:n,grants:r,deletePending:i,deleteError:a,dataEntry:o,dataLoading:s,isDiscovering:l,onActionsOpenChange:u,onDiscover:d,onManagePackage:f,onDelete:p,onResetDelete:m,onRestart:h,onRevoke:g}){let[_,v]=(0,V.useState)(!1),[y,b]=(0,V.useState)(!1),[x,S]=(0,V.useState)(!1),[C,w]=(0,V.useState)(!1),E=e.status!==`starting`&&e.status!==`stopped`,D=e.status===`running`||e.status===`failed`,O=e.sourceKind===`package`?e.packageId:void 0,k=AQ(e),A=()=>{v(!1),w(!1),m(),b(!0)};return(0,H.jsx)(ti,{delayDuration:250,children:(0,H.jsxs)(`section`,{className:`group bg-card transition-colors hover:bg-muted/25`,children:[(0,H.jsxs)(`div`,{className:`flex items-start gap-3 px-4 py-3.5`,children:[(0,H.jsx)(`div`,{className:`flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-muted text-muted-foreground`,children:(0,H.jsx)(Po,{className:`h-4 w-4`})}),(0,H.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`div`,{className:`truncate text-sm font-medium text-foreground`,children:e.title}),(0,H.jsx)(DQ,{status:e.status})]}),e.description?(0,H.jsx)(`div`,{className:`mt-1 truncate text-xs leading-5 text-muted-foreground`,children:e.description}):null,e.lastError?(0,H.jsx)(`div`,{className:`mt-1.5 truncate text-xs text-rose-600`,title:e.lastError,children:e.lastError}):null]}),(0,H.jsxs)(`div`,{className:`flex shrink-0 items-center gap-0.5`,children:[E?(0,H.jsxs)(oi,{children:[(0,H.jsx)(si,{asChild:!0,children:(0,H.jsxs)(`button`,{type:`button`,disabled:l,className:`inline-flex h-7 items-center gap-1.5 rounded-md bg-foreground px-2.5 text-xs font-medium text-background transition-colors hover:bg-foreground/85 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-foreground/40 disabled:cursor-not-allowed disabled:opacity-50`,"aria-label":T(`serviceAppsDiscoverActions`),onClick:()=>d(e.id),children:[l?(0,H.jsx)(mi,{className:`h-3.5 w-3.5 animate-spin`}):(0,H.jsx)(Ao,{className:`h-3.5 w-3.5`}),(0,H.jsx)(`span`,{children:T(`serviceAppsConnect`)})]})}),(0,H.jsx)(Yr,{side:`bottom`,className:`max-w-56 text-xs`,children:T(`serviceAppsDiscoverActionsHint`)})]}):null,(0,H.jsxs)(Tc,{open:_,onOpenChange:v,children:[(0,H.jsxs)(oi,{children:[(0,H.jsx)(si,{asChild:!0,children:(0,H.jsx)(Ec,{asChild:!0,children:(0,H.jsx)(`button`,{type:`button`,className:`rounded-md p-1.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border disabled:opacity-50`,"aria-label":T(`serviceAppsMoreActions`),disabled:i,children:(0,H.jsx)(ui,{className:`h-3.5 w-3.5`})})})}),(0,H.jsx)(Yr,{side:`bottom`,className:`text-xs`,children:T(`serviceAppsMoreActions`)})]}),(0,H.jsxs)(Oc,{align:`end`,className:`w-48 rounded-xl p-1.5`,children:[(0,H.jsx)(kQ,{disabled:!D,icon:Zo,label:T(`serviceAppsDisconnectRuntime`),onClick:()=>{v(!1),h(e.id)}}),O?(0,H.jsx)(kQ,{icon:Jr,label:T(`serviceAppsManagePackage`),onClick:()=>{v(!1),f(O)}}):(0,H.jsx)(kQ,{destructive:!0,disabled:i,icon:Yo,label:T(`serviceAppsDelete`),onClick:A})]})]})]})]}),(0,H.jsxs)(`div`,{className:`border-t border-border/60`,children:[(0,H.jsxs)(`div`,{className:`flex items-stretch`,children:[(0,H.jsxs)(`button`,{type:`button`,onClick:()=>u(!n),className:`flex min-w-0 flex-1 items-center justify-between gap-2 px-4 py-2 text-left text-xs text-muted-foreground transition-colors hover:bg-muted/40 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-border`,"aria-expanded":n,children:[(0,H.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,H.jsx)(`span`,{children:T(`serviceAppsActionsSection`)}),(0,H.jsx)(`span`,{className:`tabular-nums text-muted-foreground/70`,children:t.length})]}),(0,H.jsx)(er,{className:c(`h-3.5 w-3.5 shrink-0 text-muted-foreground/70 transition-transform`,n&&`rotate-180`)})]}),k.length>0?(0,H.jsxs)(`button`,{type:`button`,onClick:()=>S(e=>!e),className:`flex shrink-0 items-center gap-1 border-l border-border/60 px-3 text-xs text-muted-foreground transition-colors hover:bg-muted/40 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-border`,"aria-expanded":x,children:[(0,H.jsx)(`span`,{children:T(`serviceAppsDetails`)}),(0,H.jsx)(er,{className:c(`h-3.5 w-3.5 transition-transform`,x&&`rotate-180`)})]}):null]}),n?(0,H.jsx)(`div`,{className:`border-t border-border/60 px-4 py-2.5`,children:t.length===0?(0,H.jsx)(`div`,{className:`py-1 text-xs text-muted-foreground`,children:T(`serviceAppsActionsEmpty`)}):(0,H.jsx)(`div`,{className:`divide-y divide-border/50`,children:t.map(e=>(0,H.jsx)(NQ,{action:e,grants:r.filter(t=>t.actionId===e.id),onRevoke:g},e.id))})}):null,x?(0,H.jsx)(jQ,{rows:k}):null]}),e.sourceKind===`package`?null:(0,H.jsx)(TQ,{appId:e.id,appTitle:e.title,dataEntry:o,dataLoading:s,deleteError:a,deletePending:i,open:y,purgeData:C,onDelete:p,onOpenChange:b,onPurgeDataChange:w})]})})}function DQ({status:e}){let t=OQ(e),n=t.icon;return(0,H.jsxs)(oi,{children:[(0,H.jsx)(si,{asChild:!0,children:(0,H.jsxs)(`span`,{className:c(`inline-flex shrink-0 items-center gap-1 text-xs`,t.className),"aria-label":t.label,children:[(0,H.jsx)(n,{className:c(`h-3 w-3`,t.iconClassName)}),(0,H.jsx)(`span`,{children:t.label})]})}),(0,H.jsx)(Yr,{side:`bottom`,className:`text-xs`,children:t.tooltip})]})}function OQ(e){switch(e){case`running`:return{className:`text-emerald-700`,icon:ca,label:T(`serviceAppsStatus_running`),tooltip:T(`serviceAppsStatusHint_running`)};case`starting`:return{className:`text-blue-700`,icon:mi,iconClassName:`animate-spin`,label:T(`serviceAppsStatus_starting`),tooltip:T(`serviceAppsStatusHint_starting`)};case`failed`:return{className:`text-rose-700`,icon:Xo,label:T(`serviceAppsStatus_failed`),tooltip:T(`serviceAppsStatusHint_failed`)};case`stopped`:return{className:`text-muted-foreground`,icon:da,label:T(`serviceAppsStatus_stopped`),tooltip:T(`serviceAppsStatusHint_stopped`)};default:return{className:`text-muted-foreground`,icon:la,label:T(`serviceAppsStatus_idle`),tooltip:T(`serviceAppsStatusHint_idle`)}}}function kQ({destructive:e=!1,disabled:t=!1,icon:n,label:r,onClick:i}){return(0,H.jsxs)(`button`,{type:`button`,className:c(`flex w-full items-center gap-2 rounded-lg px-2.5 py-2 text-left text-sm transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border disabled:cursor-not-allowed disabled:opacity-50`,e?`text-destructive hover:bg-destructive/10`:`text-muted-foreground hover:bg-[var(--interaction-hover)] hover:text-accent-foreground`),disabled:t,onClick:i,children:[(0,H.jsx)(n,{className:`h-4 w-4 shrink-0`}),(0,H.jsx)(`span`,{children:r})]})}function AQ(e){let t=[e.command,...e.args??[]].filter(e=>!!e?.trim()).join(` `);return[{label:T(`serviceAppsCommand`),value:t},{label:T(`serviceAppsCwd`),value:e.cwd},{label:T(`serviceAppsManifest`),value:e.manifestPath},{label:T(`serviceAppsLastStarted`),value:e.lastStartedAt},{label:T(`serviceAppsLastReady`),value:e.lastReadyAt},{label:T(`serviceAppsLastFailed`),value:e.lastFailedAt}].filter(e=>e.value)}function jQ({rows:e}){return(0,H.jsx)(`div`,{className:`border-t border-border/60 px-4 py-2.5`,children:(0,H.jsx)(`dl`,{className:`grid grid-cols-[4.75rem_minmax(0,1fr)] gap-x-3 gap-y-1.5 text-xs`,children:e.map(e=>(0,H.jsx)(MQ,{label:e.label,value:e.value},e.label))})})}function MQ({label:e,value:t}){return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`dt`,{className:`text-muted-foreground/70`,children:e}),(0,H.jsx)(`dd`,{className:`min-w-0 truncate font-mono text-muted-foreground`,title:t,children:t})]})}function NQ({action:e,grants:t,onRevoke:n}){return(0,H.jsxs)(`div`,{className:`py-2`,children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,H.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,H.jsx)(`span`,{className:`flex h-6 w-6 shrink-0 items-center justify-center text-muted-foreground`,children:(0,H.jsx)(ns,{className:`h-3.5 w-3.5`})}),(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsx)(`div`,{className:`truncate text-xs font-medium text-foreground`,children:e.title??e.name}),e.description?(0,H.jsx)(`div`,{className:`truncate text-[11px] text-muted-foreground`,children:e.description}):null]})]}),(0,H.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[e.runtimeState?(0,H.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:T(`serviceAppsRuntimeState_${e.runtimeState}`)}):null,(0,H.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:e.risk})]})]}),t.map(e=>(0,H.jsxs)(`div`,{className:`mt-1.5 flex items-center justify-between gap-2 pl-8`,children:[(0,H.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 text-[11px] text-muted-foreground`,children:[(0,H.jsx)(Lo,{className:`h-3 w-3 shrink-0 text-emerald-500`}),(0,H.jsxs)(`span`,{className:`truncate`,children:[T(`serviceAppsGrantedTo`),` `,e.caller.appId]})]}),(0,H.jsx)(`button`,{type:`button`,onClick:()=>n(e),className:`rounded-md p-1 text-muted-foreground/70 transition-colors hover:bg-muted hover:text-rose-600 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,title:T(`serviceAppsRevokeGrant`),"aria-label":T(`serviceAppsRevokeGrant`),children:(0,H.jsx)(Yo,{className:`h-3 w-3`})})]},`${e.caller.surface}:${e.caller.appId}:${e.actionId}`))]})}var PQ=[`service-apps`],FQ=[`service-actions`],IQ=[`service-action-grants`],LQ=[`app-data`];function RQ(){return dn({queryKey:PQ,queryFn:()=>I.serviceApps.listServiceApps()})}function zQ(){return dn({queryKey:FQ,queryFn:()=>I.serviceApps.listServiceActions()})}function BQ(){return dn({queryKey:IQ,queryFn:()=>I.serviceApps.listServiceActionGrants()})}function VQ(){let e=yn();return zt({mutationFn:e=>I.serviceApps.restartServiceApp(e),onSuccess:async()=>{await Promise.all([e.invalidateQueries({queryKey:PQ}),e.invalidateQueries({queryKey:FQ})])}})}function HQ(){let e=yn();return zt({mutationFn:e=>I.serviceApps.deleteServiceApp(e.appId,e.purgeData),onSuccess:async()=>{await Promise.all([e.invalidateQueries({queryKey:PQ}),e.invalidateQueries({queryKey:FQ}),e.invalidateQueries({queryKey:IQ}),e.invalidateQueries({queryKey:LQ})])}})}function UQ(){let e=yn();return zt({mutationFn:e=>I.serviceApps.discoverServiceAppActions(e),onSuccess:async()=>{await e.invalidateQueries({queryKey:PQ})}})}function WQ(){let e=yn();return zt({mutationFn:e=>I.serviceApps.revokeServiceActionGrant(e),onSuccess:async()=>{await Promise.all([e.invalidateQueries({queryKey:FQ}),e.invalidateQueries({queryKey:IQ})])}})}function GQ({onManagePackage:e}){let t=RQ(),n=rX(),r=zQ(),i=BQ(),a=HQ(),o=VQ(),s=UQ(),c=WQ(),[l,u]=(0,V.useState)({}),[d,f]=(0,V.useState)({}),p=()=>{t.refetch(),r.refetch(),i.refetch(),n.refetch()};if(t.isLoading||r.isLoading||i.isLoading)return(0,H.jsx)(`div`,{className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:T(`serviceAppsLoading`)});if(t.isError||r.isError||i.isError){let e=t.error??r.error??i.error;return(0,H.jsx)(`div`,{className:`p-4 text-sm text-rose-600`,children:e instanceof Error?e.message:T(`serviceAppsLoadFailed`)})}let m=t.data?.entries??[],h=t.data?.diagnostics??[],g=r.data?.actions??[],_=i.data?.grants??[],v=e=>{s.mutateAsync(e).then(t=>{u(n=>({...n,[e]:t.actions})),f(t=>({...t,[e]:!0}))})},y=(n.data?.entries??[]).filter(e=>e.source===`workspace-service`&&e.lifecycle===`active`);return(0,H.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col bg-card text-card-foreground`,children:[(0,H.jsx)(`div`,{className:`flex min-h-12 shrink-0 items-center justify-end border-b border-border/60 px-4 py-2`,children:(0,H.jsx)(ti,{delayDuration:250,children:(0,H.jsxs)(oi,{children:[(0,H.jsx)(si,{asChild:!0,children:(0,H.jsx)(`button`,{type:`button`,className:`rounded-md p-1.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,"aria-label":T(`serviceAppsRefresh`),onClick:p,children:(0,H.jsx)(gi,{className:`h-3.5 w-3.5`})})}),(0,H.jsx)(Yr,{side:`bottom`,className:`text-xs`,children:T(`serviceAppsRefresh`)})]})})}),h.length>0?(0,H.jsxs)(`div`,{role:`alert`,className:`mx-3 mt-3 rounded-xl border border-destructive/20 bg-destructive/5 px-3 py-2.5 text-xs text-destructive sm:mx-4`,children:[(0,H.jsx)(`div`,{className:`font-medium`,children:T(`serviceAppsLoadFailed`)}),(0,H.jsx)(`ul`,{className:`mt-1 space-y-1`,children:h.map(e=>(0,H.jsxs)(`li`,{className:`break-words`,children:[e.appId,`: `,e.message]},e.stagedPath))})]}):null,m.length===0?(0,H.jsx)(`div`,{className:`flex flex-1 items-center justify-center px-6 py-8 text-center`,children:(0,H.jsxs)(`div`,{className:`w-full max-w-xs`,children:[(0,H.jsx)(`div`,{className:`mx-auto flex h-10 w-10 items-center justify-center rounded-xl bg-muted text-muted-foreground`,children:(0,H.jsx)(Po,{className:`h-5 w-5`})}),(0,H.jsx)(`h2`,{className:`mt-3 text-sm font-semibold text-foreground`,children:T(`serviceAppsEmptyTitle`)}),(0,H.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-muted-foreground`,children:T(`serviceAppsEmptyDescription`)})]})}):(0,H.jsx)(`div`,{className:`custom-scrollbar min-h-0 flex-1 overflow-y-auto p-3 sm:p-4`,children:(0,H.jsx)(`div`,{className:`overflow-hidden rounded-xl border border-border/70 bg-card`,children:m.map(t=>(0,H.jsx)(EQ,{app:t,actions:l[t.id]??g.filter(e=>e.appId===t.id),actionsOpen:!!d[t.id],grants:_,deletePending:a.isPending,deleteError:a.error,dataEntry:y.find(e=>e.appId===t.id),dataLoading:n.isLoading,isDiscovering:s.isPending,onActionsOpenChange:e=>f(n=>({...n,[t.id]:e})),onDiscover:v,onManagePackage:e,onDelete:(e,t,n)=>void a.mutate({appId:e,purgeData:t},{onSuccess:n}),onResetDelete:a.reset,onRestart:e=>void o.mutate(e),onRevoke:e=>void c.mutate({actionId:e.actionId,caller:e.caller})},t.id))})})]})}function KQ({activeTab:e,onActiveTabChange:t,onOpenPanelApp:n}){let[r,i]=(0,V.useState)(),a=e=>{i(void 0),t(e)},o=e=>{i(e),t(`apps`)};return(0,H.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col bg-card text-card-foreground`,children:[(0,H.jsx)(`nav`,{className:`shrink-0 border-b border-border/70 px-4 py-3`,"aria-label":T(`appsTitle`),children:(0,H.jsx)(jY,{value:e,onValueChange:e=>a(e),children:(0,H.jsxs)(MY,{className:`grid h-auto w-full max-w-[390px] grid-cols-3 rounded-lg bg-muted/70 p-0.5`,children:[(0,H.jsxs)(NY,{value:`apps`,className:`min-w-0 gap-1.5 px-2 py-1.5 text-xs`,children:[(0,H.jsx)(Jr,{className:`h-3.5 w-3.5 shrink-0`}),(0,H.jsx)(`span`,{className:`truncate`,children:T(`appsTitle`)})]}),(0,H.jsxs)(NY,{value:`panel-apps`,className:`min-w-0 gap-1.5 px-2 py-1.5 text-xs`,children:[(0,H.jsx)(Gr,{className:`h-3.5 w-3.5 shrink-0`}),(0,H.jsx)(`span`,{className:`truncate`,children:T(`panelAppsTitle`)})]}),(0,H.jsxs)(NY,{value:`service-apps`,className:`min-w-0 gap-1.5 px-2 py-1.5 text-xs`,children:[(0,H.jsx)(Po,{className:`h-3.5 w-3.5 shrink-0`}),(0,H.jsx)(`span`,{className:`truncate`,children:T(`serviceAppsTitle`)})]})]})})}),(0,H.jsx)(`div`,{className:`min-h-0 flex-1`,children:e===`apps`?(0,H.jsx)(mQ,{focusedPackageId:r,onOpenPanelApp:n}):e===`panel-apps`?(0,H.jsx)(IY,{onOpenPanelApp:n}):(0,H.jsx)(GQ,{onManagePackage:o})})]})}var qQ=class{constructor(e){this.docBrowserManager=e,this.initialized=!1,this.knownTerminalOperationIds=new Set,this.settle=({isLoaded:e,operations:t,refetchPackages:n,refetchPanels:r,refetchAppData:i})=>{if(!e)return;let a=t.filter(e=>!mX(e.status));if(!this.initialized){a.forEach(e=>this.knownTerminalOperationIds.add(e.id)),this.initialized=!0;return}a.forEach(e=>{this.knownTerminalOperationIds.has(e.id)||(this.knownTerminalOperationIds.add(e.id),this.settleOperation(e,n,r,i))})},this.settleOperation=(e,t,n,r)=>{if(e.status===`succeeded`){L.success(JQ(e)),t(),r(),n().then(t=>{e.action!==`rollback`&&e.action!==`update`||this.docBrowserManager.reloadByDedupeKeys(t.data?.entries.filter(t=>t.packageId===e.appId).map(e=>`panel-app:${e.id}`)??[])});return}(e.status===`failed`||e.status===`interrupted`)&&(t(),n(),r(),L.error(e.error??T(`appPackagesActionFailed`)))}}};function JQ(e){switch(e.action){case`install`:return T(`appPackagesInstallCompleted`);case`update`:return e.result?.changed===!1?T(`appPackagesAlreadyCurrent`):T(`appPackagesUpdateCompleted`);case`rollback`:return e.result?.changed===!1?T(`appPackagesAlreadyOnVersion`):T(`appPackagesRollbackCompleted`);case`uninstall`:return T(`appPackagesUninstallCompleted`)}}function YQ({appTitle:e,onOpenApps:t,onRefresh:n}){return(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-2 border-b border-border/70 bg-card px-3.5 py-2 shrink-0`,children:[(0,H.jsx)(`button`,{type:`button`,onClick:t,className:`inline-flex shrink-0 items-center rounded-md p-1.5 text-muted-foreground transition-colors hover:bg-[var(--interaction-hover)] hover:text-accent-foreground`,title:T(`appsTitle`),"aria-label":T(`appsTitle`),children:(0,H.jsx)(di,{className:`h-3.5 w-3.5`})}),(0,H.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs font-medium text-muted-foreground`,title:e,children:e}),(0,H.jsx)(`button`,{type:`button`,onClick:n,className:`rounded-md p-1.5 text-muted-foreground transition-colors hover:bg-[var(--interaction-hover)] hover:text-accent-foreground`,title:T(`panelAppsRefreshCurrent`),"aria-label":T(`panelAppsRefreshCurrent`),children:(0,H.jsx)(gi,{className:`h-3.5 w-3.5`})})]})}function XQ(e){return e.split(`/`).map(e=>e.trim()).filter(e=>e.length>0)}function ZQ(e){let t=e.trim();try{let e=t.startsWith(`/`),n=e?new URL(t,`http://nextclaw.local`):new URL(t);return{authority:e?``:n.hostname,pathSegments:XQ(n.pathname),pathname:n.pathname,raw:t,scheme:e?``:n.protocol.replace(/:$/,``).toLowerCase(),searchParams:n.searchParams}}catch{return{authority:``,pathSegments:XQ(t),pathname:t,raw:t,scheme:``,searchParams:new URLSearchParams}}}var QQ=class{constructor(e,t){this.routeDefinitions=e,this.options=t,this.resolve=e=>{let t=ZQ(e);return this.findDefinition(t).resolve(t)},this.normalize=e=>this.options.getNormalizedUri(this.resolve(e)),this.areEquivalent=(e,t)=>this.findDefinition(ZQ(e)).areEquivalent?.(e,t)??this.normalize(e)===this.normalize(t),this.findDefinition=e=>{let t=this.routeDefinitions.find(t=>t.match(e));if(!t)throw Error(`Unsupported resource URI: ${e.raw}`);return t}}},$Q=`home`,e$=`nextclaw://new-tab`,t$=`apps`,n$=`nextclaw://apps`,r$=`${n$}?tab=panel-apps`,i$=`${n$}?tab=service-apps`,a$=`panel-app`,o$=new Set([e$,`about:blank`]);function s$(e){let t=e.resourceUri?.trim()||e.currentUrl.trim(),n=e.currentUrl.trim();return!t||!n||o$.has(t)?null:ne({uri:t,resourceKind:e.kind,title:e.title.trim()||t,currentUrl:n,...e.contentParams?{contentParams:structuredClone(e.contentParams)}:{}})}var c$=`apps`;function l$(e){return e===`apps`||e===`panel-apps`||e===`service-apps`}function u$(e=c$){return e===`panel-apps`?r$:e===`service-apps`?i$:n$}function d$(e){try{let t=new URL(e).searchParams.get(`tab`);return l$(t)?t:c$}catch{return c$}}function f$(e){return u$(d$(e))}function p$(e,t){let n=`nextclaw://panel-app/${encodeURIComponent(e)}`,r=t?.trim();return r?`${n}?${new URLSearchParams({path:r}).toString()}`:n}function m$(e,t){let n=`/api/panel-apps/${encodeURIComponent(e)}/content`,r=t?.trim();return r?`${n}?${new URLSearchParams({path:r}).toString()}`:n}function h$(e){return e.startsWith(`data:image/`)||e.startsWith(`http://`)||e.startsWith(`https://`)||e.startsWith(`/`)}function g$(e){let t=e.icon?.trim();if(t)return h$(t)?{type:`url`,url:t}:{type:`text`,value:t}}function _$(e){return{dedupeKey:`panel-app:${e.id}`,dockIcon:g$(e),historyPolicy:`managed`,kind:a$,resourceUri:p$(e.id),title:e.title,url:e.contentPath}}function v$(e,t){return e===t||e.startsWith(`${t}?`)||e.startsWith(`${t}/`)}function y$(e){let t=e.pathSegments.join(`/`);return Ii(t?`/${t}`:`/`,`docs`)}function b$(e){let t=e.filter(e=>e.trim().length>0).map(e=>encodeURIComponent(decodeURIComponent(e))).join(`/`);return t?`nextclaw://docs/${t}`:`nextclaw://docs`}function x$(e){let t=Si(e),n=t.startsWith(`/`)?t:(()=>{try{return new URL(e).pathname}catch{return``}})();return n?b$(n.split(`/`)):`nextclaw://docs`}function S$(e){if(e.scheme===`nextclaw`&&e.authority===`panel-app`)return e.pathSegments[0]??``;let[t,n,r,i]=e.pathSegments;return t===`api`&&n===`panel-apps`&&r!==void 0&&r.length>0&&i===`content`?r:``}function C$(e){return S$(e).length>0}function w$(e){let t=S$(e);if(!t)return`nextclaw://panel-app`;let n=e.searchParams.get(`path`)?.trim();return m$(decodeURIComponent(t),n)}function T$(e){let t=S$(e);if(!t)return`nextclaw://panel-app`;let n=`nextclaw://panel-app/${encodeURIComponent(decodeURIComponent(t))}`,r=e.searchParams.get(`path`)?.trim();return r?`${n}?${new URLSearchParams({path:r}).toString()}`:n}function E$(e,t){let n=ZQ(e),r=ZQ(t),i=S$(n),a=S$(r),o=n.searchParams.get(`path`)?.trim()??``,s=r.searchParams.get(`path`)?.trim()??``;return i.length>0&&a.length>0?decodeURIComponent(i)===decodeURIComponent(a)&&o===s:e===t}var D$=[{defaultUrl:()=>e$,id:`home`,kind:$Q,match:e=>e.raw===e$,resolve:()=>({historyPolicy:`managed`,kind:$Q,resourceUri:e$,title:T(`docBrowserHomeTitle`),url:e$}),areEquivalent:(e,t)=>e===t},{defaultUrl:ji,id:`docs-url`,kind:`docs`,match:e=>Ti(e.raw),resolve:e=>{let t=Ii(e.raw,`docs`);return{historyPolicy:`managed`,kind:`docs`,resourceUri:x$(t),title:T(`docBrowserHelp`),url:t}},areEquivalent:(e,t)=>Si(e)===Si(t)},{defaultUrl:ji,id:`nextclaw-docs`,kind:`docs`,match:e=>e.scheme===`nextclaw`&&e.authority===`docs`,resolve:e=>{let t=y$(e);return{historyPolicy:`managed`,kind:`docs`,resourceUri:b$(e.pathSegments),title:T(`docBrowserHelp`),url:t}},areEquivalent:(e,t)=>Si(e)===Si(t)},{defaultUrl:()=>n$,id:`apps`,kind:t$,match:e=>v$(e.raw,n$),resolve:e=>{let t=f$(e.raw);return{dedupeKey:`apps`,historyPolicy:`managed`,kind:t$,resourceUri:t,title:T(t===`nextclaw://apps`?`appsTitle`:`serviceAppsTitle`),url:t}},areEquivalent:(e,t)=>f$(e)===f$(t)},{defaultUrl:()=>`nextclaw://panel-app`,id:`panel-app`,kind:a$,match:e=>e.scheme===`nextclaw`&&e.authority===`panel-app`||C$(e),resolve:e=>{let t=w$(e),n=S$(e);return{dedupeKey:n?`panel-app:${e.searchParams.get(`path`)?.trim()||decodeURIComponent(n)}`:void 0,historyPolicy:`managed`,kind:a$,resourceUri:T$(e),title:T(`panelAppsTitle`),url:t}},areEquivalent:E$},{defaultUrl:()=>`about:blank`,id:`content`,kind:`content`,match:()=>!0,resolve:e=>({historyPolicy:`managed`,kind:`content`,resourceUri:e.raw||`about:blank`,title:Ei(e.raw,`content`,`Detail`),url:e.raw||`about:blank`}),areEquivalent:(e,t)=>e===t}],O$=D$.map(e=>({areEquivalent:e.areEquivalent,id:e.id,match:e.match,resolve:e.resolve}));function k$(){return[{id:`apps`,label:T(`appsTitle`),target:{type:`right-panel-resource`,uri:n$}},{id:`service-apps`,label:T(`serviceAppsTitle`),target:{type:`right-panel-resource`,uri:i$}},{id:`docs`,label:T(`docBrowserHelp`),target:{options:{newTab:!0},type:`right-panel-resource`,uri:ji()}},{id:`skill-marketplace`,label:T(`marketplaceSkillsPageTitle`),target:{path:`/marketplace/skills`,type:`app-route`}}]}var A$={apps:{accentClassName:`bg-emerald-50 text-emerald-700`,hoverAccentClassName:`group-hover:bg-emerald-100`,icon:(0,H.jsx)(Jr,{className:`h-5 w-5`})},"service-apps":{accentClassName:`bg-sky-50 text-sky-700`,hoverAccentClassName:`group-hover:bg-sky-100`,icon:(0,H.jsx)(Ka,{className:`h-5 w-5`})},docs:{accentClassName:`bg-amber-50 text-amber-700`,hoverAccentClassName:`group-hover:bg-amber-100`,icon:(0,H.jsx)(pi,{className:`h-5 w-5`})},"skill-marketplace":{accentClassName:`bg-rose-50 text-rose-700`,hoverAccentClassName:`group-hover:bg-rose-100`,icon:(0,H.jsx)(Qi,{className:`h-5 w-5`})}};function j$(e){return A$[e.id]??{accentClassName:`bg-gray-50 text-gray-700`,hoverAccentClassName:`group-hover:bg-gray-100`,icon:(0,H.jsx)(Jr,{className:`h-5 w-5`})}}function M$({open:e}){let t=oe(),n=k$(),r=n=>{if(n.type===`app-route`){t(n.path);return}e(n.uri,n.options)};return(0,H.jsx)(`div`,{className:`h-full overflow-auto bg-background px-4 py-5`,children:(0,H.jsx)(`div`,{className:`mx-auto w-full max-w-[520px]`,children:(0,H.jsx)(`div`,{className:`grid grid-cols-[repeat(auto-fit,minmax(76px,1fr))] gap-x-2 gap-y-4`,children:n.map(e=>{let t=j$(e);return(0,H.jsxs)(`button`,{type:`button`,onClick:()=>r(e.target),className:`group flex min-h-[68px] flex-col items-center gap-1.5 rounded-md px-1.5 py-1.5 text-center focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,children:[(0,H.jsx)(`span`,{className:c(`flex h-10 w-10 shrink-0 items-center justify-center rounded-md transition-colors`,t.accentClassName,t.hoverAccentClassName),children:t.icon}),(0,H.jsx)(`span`,{className:`line-clamp-2 min-w-0 max-w-full text-xs font-medium leading-snug text-gray-700 transition-colors group-hover:text-gray-900`,children:e.label})]},e.id)})})})})}function N$(e){return e&&Ti(e)?`docs`:`content`}var P$=class{constructor(){this.resourceUriResolver=new QQ(O$,{getNormalizedUri:e=>e.resourceUri??e.url}),this.resolve=e=>this.resourceUriResolver.resolve(e),this.normalize=e=>this.resourceUriResolver.normalize(e),this.areEquivalent=(e,t)=>this.resourceUriResolver.areEquivalent(e,t),this.resolveOpenTarget=e=>{let{activeTab:t,kind:n,url:r}=e,i=this.resolveRouteDefinition(r,n,t),a=r?.trim()||(!n&&t&&t.kind!==`docs`?t.currentUrl:i.defaultUrl());return i.resolve(ZQ(a))},this.areUrlsEquivalent=(e,t,n,r)=>n===r?this.resolveRouteDefinition(e,n).areEquivalent?.(e,t)??this.areEquivalent(e,t):!1,this.usesManagedHistory=e=>this.resolveRouteDefinition(e.currentUrl,e.kind).resolve(ZQ(e.currentUrl)).historyPolicy===`managed`,this.resolveRouteDefinition=(e,t,n)=>{let r=t??(e?void 0:n?.kind),i=r?D$.find(e=>e.kind===r):void 0;if(i)return i;let a=e?ZQ(e):null,o=a?D$.find(e=>e.match(a)):void 0;if(o)return o;let s=t??n?.kind??N$(e);return D$.find(e=>e.kind===s)??D$[D$.length-1]}}},F$=t$,I$=a$,L$=`apps`;function R$(e){return e===`apps`||e===`panel-apps`||e===`service-apps`}function z$(e=L$){return e===`panel-apps`?r$:e===`service-apps`?i$:n$}function B$(e){try{let t=new URL(e).searchParams.get(`tab`);return R$(t)?t:L$}catch{return L$}}function V$(e){e.open(z$(),{kind:F$,title:T(`appsTitle`),dedupeKey:`apps`})}var H$={[$Q]:{getTitle:()=>T(`docBrowserHomeTitle`),renderContent:({open:e})=>(0,H.jsx)(M$,{open:e})},[F$]:{getTitle:()=>T(`appsTitle`),renderIcon:()=>(0,H.jsx)(Jr,{className:`w-4 h-4 text-primary shrink-0`}),renderContent:({currentUrl:e,open:t,openTarget:n})=>(0,H.jsx)(KQ,{activeTab:B$(e),onActiveTabChange:e=>t(z$(e),{activate:!1,kind:F$,title:T(`appsTitle`),dedupeKey:`apps`}),onOpenPanelApp:e=>n(_$(e))})},[I$]:{getIframeSandbox:()=>HY,getTitle:e=>e.title||T(`panelAppsTitle`),onIframeMessage:e=>W9().panelAppBridgeManager.handleIframeMessage(e),onIframePointerOver:e=>UY(e.currentTarget),renderIcon:()=>(0,H.jsx)(Gr,{className:`w-4 h-4 text-primary shrink-0`}),renderToolbar:({open:e,refreshIframe:t,tab:n})=>(0,H.jsx)(YQ,{appTitle:n.title||T(`panelAppsTitle`),onOpenApps:()=>V$({open:e}),onRefresh:t}),supportsScrollRestoration:!0}};function U$(e,t){return m$(e,t)}function W$(e){return`${e}${e.includes(`?`)?`&`:`?`}${new URLSearchParams({[O.displayModeSearchParam]:O.displayMode,[O.placementSearchParam]:O.placement}).toString()}`}function G$(e){if(!e||typeof e!=`object`)return null;let t=e;return t.type===O.contentHeightMessageType&&typeof t.height==`number`&&Number.isFinite(t.height)&&t.height>0?Math.ceil(t.height):null}function K$(e){let{appId:t,params:n,path:r,title:i,url:a}=e;return{contentParams:n,currentUrl:a,dedupeKey:`panel-app:${r??t}`,history:[a],historyIndex:0,id:`inline-panel-app:${r??t}`,kind:a$,navVersion:0,resourceUri:p$(t,r),title:i}}function q$({panelApp:e,showExpandAction:t=!0}){let n=ki(),r=(0,V.useRef)(null),i=(0,V.useId)(),[a,o]=(0,V.useState)(null),s=vY(),c=(0,V.useMemo)(()=>e.path?void 0:VY(s.data?.entries??[],e.appId),[e.appId,e.path,s.data?.entries]),l=c?_$(c):null,u=e.title??l?.title??e.appId,d=e.path?U$(e.appId,e.path):s.isLoading?``:l?.url??U$(e.appId),f=(0,V.useMemo)(()=>d?W$(d):``,[d]),p=(0,V.useMemo)(()=>K$({appId:c?.id??e.appId,params:e.params,path:e.path,title:u,url:d}),[c?.id,e.appId,e.params,e.path,u,d]),m=te(e.params),h=`${p.id}:${p.navVersion}:${i}:${m??``}`;return(0,V.useEffect)(()=>{if(!d)return;let e=e=>{if(e.source!==r.current?.contentWindow)return;let t=G$(e.data);if(t!==null){o(t);return}W9().panelAppBridgeManager.handleIframeMessage({event:e,iframe:r.current,iframeInstanceId:h,tab:p})};return window.addEventListener(`message`,e),()=>window.removeEventListener(`message`,e)},[h,p,d]),d?(0,H.jsx)(uY,{actions:t?(0,H.jsx)(B,{size:`sm`,icon:(0,H.jsx)(co,{className:`h-3.5 w-3.5`}),label:T(`chatPanelCardExpand`),tooltipSide:`top`,onClick:()=>{if(l){n.openTarget({...l,contentParams:e.params});return}n.open(d,{dedupeKey:p.dedupeKey,kind:p.kind,contentParams:e.params,title:u})}}):void 0,contentHeight:a,children:(0,H.jsx)(`iframe`,{ref:r,src:f,name:m,title:u,sandbox:HY,tabIndex:0,onPointerOver:()=>UY(r.current),className:`h-full w-full border-0 bg-card`},h)}):(0,H.jsx)(uY,{isLoading:!0,children:(0,H.jsx)(`span`,{className:`sr-only`,children:u})})}function J$({checkpoint:e,inline:t=!1}){let n=!e||e.status===`compressing`,r=e?.status===`failed`,i=e?.status===`cancelled`,a=e?[`${T(`chatContextCompactionCoveredMessages`)}: ${e.coveredSessionMessageCount}`,`${T(`chatContextCompactionOriginalTokens`)}: ${e.originalEstimatedTokens}`,`${T(`chatContextCompactionProjectedTokens`)}: ${e.projectedEstimatedTokens}`].join(`
|
|
102
|
+
`).filter(Boolean);if(e.length===0)return;let n=!1,r=null,i=null,a=async()=>{try{let t=await vt({directories:e,subscriptionId:r});if(n){await Rt(t.subscriptionId).catch(()=>void 0);return}r=t.subscriptionId}catch(e){console.warn(`Project file auto-refresh is unavailable; manual refresh remains available.`,e)}};return a().then(()=>{!n&&r&&(i=setInterval(()=>void a(),xJ))}),()=>{n=!0,i&&clearInterval(i),r&&Rt(r).catch(()=>void 0)}},[t])}var CJ=[];function wJ(e){return e.split(/[\\/]/).filter(Boolean).pop()??e}function TJ({activeRelativePath:e,busy:t,createTarget:n,entries:r,fallbackParentTarget:i,mutable:a,onAddToChat:o,onCreateFile:s,onCreateFolder:c,onDelete:l,onFileOpen:u,onRevealComplete:d,onRename:f,onRevealPath:p,onSelect:m,onUpload:h,refresh:g,relativePaths:_,renderCreateFolder:v,revealPath:y,selectedPath:b,showRoot:x,treeRootKey:S}){return r.length===0?(0,H.jsx)(`div`,{className:`px-4 py-8 text-center text-xs text-gray-400`,children:T(`chatWorkspaceDirectoryEmpty`)}):r.map(r=>(0,H.jsx)(sJ,{activeRelativePath:e,browseParentRefresh:g,busy:t,createTarget:n,entry:r,level:x?1:0,onAddToChat:o,onCreateFile:a?s:void 0,onCreateFolder:a?c:void 0,onDelete:a?l:void 0,onFileOpen:u,onRevealComplete:d,onRename:f,onRevealPath:p,onSelect:m,onUpload:a?h:void 0,parentCreateTarget:i,relativePath:_?r.name:null,renderCreateFolder:v,revealPath:y,selectedPath:b,treeRootKey:S},r.path))}function EJ({busy:e,onCollapseAll:t,onCreateFile:n,onCreateFolder:r,onRefresh:i,onRevealPath:a,onUpload:o,target:s}){return[{key:`manage`,items:[{key:`new-file`,label:T(`chatWorkspaceNewFile`),icon:(0,H.jsx)(Ma,{className:`h-4 w-4`}),disabled:e,restoreFocus:!1,onSelect:n},{key:`new-folder`,label:T(`chatWorkspaceNewFolder`),icon:(0,H.jsx)(za,{className:`h-4 w-4`}),disabled:e,restoreFocus:!1,onSelect:r},{key:`upload`,label:T(`chatWorkspaceUploadFilesHere`),icon:(0,H.jsx)(Qo,{className:`h-4 w-4`}),disabled:e,restoreFocus:!1,onSelect:o}]},{key:`view`,items:[{key:`refresh`,label:T(`chatWorkspaceRefreshExplorer`),icon:(0,H.jsx)(gi,{className:`h-4 w-4`}),onSelect:i},{key:`collapse`,label:T(`chatWorkspaceCollapseAll`),icon:(0,H.jsx)(sa,{className:`h-4 w-4`}),onSelect:t}]},{key:`path`,items:[...a?[{key:`reveal`,label:T(`chatWorkspaceRevealInFileManager`),icon:(0,H.jsx)(oo,{className:`h-4 w-4`}),onSelect:()=>a(s.path)}]:[],{key:`copy-path`,label:T(`chatWorkspaceCopyPath`),icon:(0,H.jsx)(ya,{className:`h-4 w-4`}),onSelect:()=>void Fq(s.path)}]}]}function DJ({activeRelativePath:e,browseQuery:t,ConfirmDialog:n,controller:r,entries:i,onAddToChat:a,onFileOpen:o,onRevealPath:s,rootLabel:c,rootPath:l,showRoot:u}){let d=yn(),{cancelCreateFolder:f,clearSelection:p,completeReveal:m,submitCreate:h,deleteEntry:g,openCreateFile:_,openCreateFolder:v,requestUpload:y,renameEntry:b,selectEntry:x,setCreateError:S,setCreateName:C,uploadFiles:w}=r.actions,{fileInputRef:E}=r.refs,{createError:D,createKind:O,createName:k,createTarget:A,pendingAction:j,revealPath:M,selectedCreateTarget:N,selectedPath:P}=r.state,ee=j!==null,te=Uq(l),ne=Zq(e=>e.collapseAll),re=()=>l?d.refetchQueries({predicate:e=>fJ(e.queryKey,l),type:`active`}):t.refetch(),F=l?{label:c,path:l,refresh:re}:null,ie=N??F,ae=e=>(0,H.jsx)(lJ,{error:D,kind:O,isCreating:j===`create-directory`||j===`create-file`,level:e,name:k,onCancel:f,onNameChange:e=>{C(e),S(null)},onSubmit:()=>void h()}),oe=(0,H.jsx)(TJ,{activeRelativePath:e,busy:ee,createTarget:A,entries:i,fallbackParentTarget:F??{label:``,path:t.data?.currentPath??``,refresh:re},mutable:!!l,onAddToChat:a,onCreateFile:_,onCreateFolder:v,onDelete:(e,t)=>void g(e,t),onFileOpen:o,onRevealComplete:m,onRename:b,onRevealPath:s,onSelect:x,onUpload:y,refresh:re,relativePaths:!!a,renderCreateFolder:ae,revealPath:M,selectedPath:P,showRoot:!1,treeRootKey:te||null}),se=(0,H.jsx)(pJ,{currentPath:l,onBlankContext:p,rootDraft:A?.path===l?ae(0):null,showRoot:u,children:oe}),ce=F?EJ({busy:ee,onCollapseAll:()=>{te&&ne(te)},onCreateFile:()=>_(F),onCreateFolder:()=>v(F),onRefresh:()=>void re(),onRevealPath:s,onUpload:()=>y(F),target:F}):[],le=(0,H.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col bg-white`,onContextMenu:e=>{e.target.closest(`[data-workspace-tree-entry]`)||p()},children:[l&&ie?(0,H.jsx)(uJ,{disabled:ee,rootLabel:c,onCollapseAll:()=>{te&&ne(te)},onNewFile:()=>_(ie),onNewFolder:()=>v(ie),onRefresh:()=>void re()}):null,l?(0,H.jsx)(`input`,{ref:E,type:`file`,multiple:!0,className:`sr-only`,"aria-label":T(`chatWorkspaceUploadFiles`),onChange:e=>void w(Array.from(e.currentTarget.files??[]))}):null,se,(0,H.jsx)(n,{})]});return F?(0,H.jsx)(ei,{groups:ce,label:T(`chatWorkspaceRootContextMenu`),children:le}):le}function OJ({activeRelativePath:e=null,browseQuery:t,onFileOpen:n,sessionKey:r,renderStatus:i,showRoot:a=!1}){let o=il(),{confirm:s,ConfirmDialog:c}=An(),l=t.data?.entries??[],u=eJ(t),d=a?t.data?.currentPath??null:null,f=Uq(d),p=Zq(e=>f?e.trees[f]?.expandedPaths??CJ:CJ);SJ((0,V.useMemo)(()=>{if(!d)return[];let e=d.includes(`\\`)&&!d.includes(`/`)?`\\`:`/`,t=d.replace(/[\\/]+$/g,``),n=new Set(p);return[d,...p.filter(e=>{let t=e.split(`/`);return t.slice(0,-1).every((e,r)=>n.has(t.slice(0,r+1).join(`/`)))}).map(n=>`${t}${e}${n.replace(/[\\/]+/g,e)}`)]},[p,d]));let m=d?wJ(d):``,h=bJ({activeRelativePath:e,confirm:s,onEntryDeleted:o.chatThreadManager.removeWorkspacePath,onEntryRenamed:o.chatThreadManager.renameWorkspacePath,rootPath:d}),g=vi.canRevealPath()?e=>{vi.revealPath(e).then(e=>{e.revealed||L.error(T(`chatWorkspaceRevealPathFailed`))})}:void 0,_=r===void 0?void 0:(e,t)=>{(e.kind===`directory`?o.chatComposerIntentManager.requestDirectoryReference:o.chatComposerIntentManager.requestFileReference)({targetSessionKey:r,tokenKey:t,label:e.name})};return t.isLoading&&!t.data?i({text:T(`chatWorkspaceLoadingDirectory`)}):u&&!t.data?i({tone:`error`,text:`${T(`chatWorkspaceDirectoryLoadFailed`)}: ${u}`}):(0,H.jsx)(DJ,{activeRelativePath:e,browseQuery:t,ConfirmDialog:c,controller:h,entries:l,onAddToChat:_,onFileOpen:n,onRevealPath:g,rootLabel:m,rootPath:d,showRoot:a})}function kJ({name:e,kind:t}){return t===`directory`?(0,H.jsx)(Ua,{className:`h-3.5 w-3.5 shrink-0 text-emerald-600`}):(0,H.jsx)(Ah,{fileName:e,size:`compact`})}function AJ({browsePath:e,onBrowsePathChange:t,onClose:n,onFileOpen:r}){let i=Ic({path:e,includeFiles:!0,enabled:!!e}),a=i.error?i.error instanceof Error?i.error.message:String(i.error):null,o=i.data?.entries??[],s=e=>{if(e.kind===`directory`){t(e.path);return}r({path:e.path,label:e.name,viewMode:`preview`}),n()};return(0,H.jsxs)(`div`,{"data-testid":`workspace-breadcrumb-browser`,className:`flex max-h-72 flex-col overflow-hidden`,children:[(0,H.jsx)(`div`,{className:`border-b border-gray-200 px-2 py-1`,children:(0,H.jsx)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-0.5 text-[11px] leading-none text-gray-600`,children:i.data?.breadcrumbs.map((e,n)=>(0,H.jsxs)(V.Fragment,{children:[(0,H.jsx)(`button`,{type:`button`,className:`h-5 rounded-sm px-1 text-left hover:bg-gray-100 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,onClick:()=>t(e.path),children:e.label}),n<i.data.breadcrumbs.length-1?(0,H.jsx)(oa,{className:`h-3 w-3 shrink-0 text-gray-300`}):null]},e.path))})}),(0,H.jsx)(zc,{className:`min-h-0 flex-1 px-1 py-1`,children:i.isLoading?(0,H.jsxs)(`div`,{className:`flex items-center gap-1.5 px-2 py-4 text-[11px] text-gray-500`,children:[(0,H.jsx)(mi,{className:`h-3.5 w-3.5 animate-spin`}),T(`loading`)]}):a?(0,H.jsxs)(`div`,{className:`px-2 py-3 text-[11px] text-rose-600`,children:[T(`pathBrowseFailed`),`: `,a]}):o.length>0?(0,H.jsx)(`div`,{className:`space-y-0.5`,children:o.map(e=>(0,H.jsxs)(`button`,{type:`button`,className:c(`flex h-6 w-full items-center gap-1.5 rounded-sm px-1.5 text-left text-[11px] text-gray-700 transition-colors hover:bg-gray-100 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,e.hidden?`opacity-65`:null),onClick:()=>s(e),children:[(0,H.jsx)(kJ,{kind:e.kind,name:e.name}),(0,H.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.name}),e.kind===`directory`?(0,H.jsx)(oa,{className:`h-3 w-3 shrink-0 text-gray-300`}):null]},e.path))}):(0,H.jsx)(`div`,{className:`px-2 py-4 text-[11px] text-gray-500`,children:T(`emptyDirectory`)})})]})}function jJ({value:e}){return(0,H.jsx)(`span`,{className:`inline-flex h-5 items-center rounded-sm border border-amber-200 bg-amber-50 px-1.5 text-[10px] font-medium leading-none text-amber-700`,children:e})}function MJ({onFileOpen:e,segment:t}){let[n,r]=(0,V.useState)(!1),[i,a]=(0,V.useState)(t.browsePath);return(0,H.jsxs)(Tc,{open:n,onOpenChange:e=>{e&&a(t.browsePath),r(e)},children:[(0,H.jsx)(Ec,{asChild:!0,children:(0,H.jsxs)(`button`,{type:`button`,"aria-current":t.isCurrent?`page`:void 0,className:c(`inline-flex h-5 shrink-0 items-center gap-1 whitespace-nowrap rounded-sm px-1 text-[11px] leading-none transition-colors hover:bg-gray-200/80 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,t.kind===`workspace`?`bg-primary/8 text-primary hover:bg-primary/12`:t.isCurrent?`bg-gray-200/70 text-gray-900`:`text-gray-500`),disabled:!t.browsePath,children:[t.kind===`workspace`?(0,H.jsx)(Ba,{className:`h-3 w-3 shrink-0`}):t.kind===`directory`&&t.isCurrent?(0,H.jsx)(Ua,{className:`h-3 w-3 shrink-0`}):t.isCurrent?(0,H.jsx)(Ah,{fileName:t.label,size:`compact`}):null,(0,H.jsx)(`span`,{children:t.label})]})}),(0,H.jsx)(Oc,{"data-testid":`workspace-breadcrumb-popover`,className:`w-[22rem] rounded-md p-0`,align:`start`,children:(0,H.jsx)(AJ,{browsePath:i,onBrowsePathChange:a,onClose:()=>r(!1),onFileOpen:e})})]})}function NJ({breadcrumb:e,leading:t,onFileOpen:n}){let r=(0,V.useRef)(null);return(0,V.useLayoutEffect)(()=>{let e=r.current;if(!e)return;let t=e.querySelector(`[aria-current="page"]`);if(!t)return;let n=()=>{let n=e.getBoundingClientRect(),r=t.getBoundingClientRect();r.right>n.right?e.scrollLeft+=r.right-n.right:r.left<n.left&&(e.scrollLeft-=n.left-r.left)};if(n(),typeof ResizeObserver>`u`)return;let i=new ResizeObserver(n);return i.observe(e),i.observe(t),()=>i.disconnect()},[e.fullPath]),(0,H.jsxs)(`div`,{"data-testid":`workspace-file-breadcrumbs`,title:e.fullPath,className:`flex min-w-0 items-center border-b border-gray-200/80 bg-gray-50/55`,children:[t?(0,H.jsx)(`div`,{className:`flex h-full shrink-0 items-center pl-1 pr-0.5`,children:t}):null,(0,H.jsxs)(`div`,{ref:r,"data-testid":`workspace-file-breadcrumb-scroll`,className:`workspace-horizontal-scrollbar flex min-w-0 flex-1 items-center gap-2.5 overflow-x-auto overflow-y-hidden px-3 py-1.5`,children:[(0,H.jsx)(`div`,{className:`flex min-w-0 flex-1 items-center gap-1 pr-1`,children:e.segments.map((t,r)=>(0,H.jsxs)(V.Fragment,{children:[(0,H.jsx)(MJ,{segment:t,onFileOpen:n}),r<e.segments.length-1?(0,H.jsx)(oa,{className:`h-3 w-3 shrink-0 text-gray-300`}):null]},t.key))}),e.truncated?(0,H.jsx)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-end gap-1`,children:(0,H.jsx)(jJ,{value:T(`chatWorkspacePreviewTruncated`)})}):null]})]})}var PJ=8e3;function FJ(e){return e.match(/\n/g)?.length??0}function IJ(e){let{label:t,path:n,selectedText:r,sourceStartLine:i=1,sourceText:a}=e,o=n.trim(),s=t.trim(),c=r.trim();if(!o||!s||!c)return null;let l=a.indexOf(c),u=l>=0&&l===a.lastIndexOf(c)?(i??1)+FJ(a.slice(0,l)):null;return{path:o,label:s,excerpt:c,startLine:u,endLine:u===null?null:u+FJ(c)}}function LJ({children:e,fileLabel:t,filePath:n,onAddToChat:r,sourceStartLine:i,sourceText:a}){return(0,H.jsx)(HU,{actionLabel:T(`chatWorkspaceAddToChat`),className:`h-full min-h-0`,maxCharacters:PJ,selectionTooLongLabel:T(`chatWorkspaceExcerptSelectionTooLong`),onAddToChat:({text:e})=>{let o=IJ({path:n,label:t,selectedText:e,sourceText:a,sourceStartLine:i});o&&r?.(o)},children:e})}function RJ(e){let[t,n]=(0,V.useState)(null),r=t?.contentUrl===e?t:null;return(0,V.useEffect)(()=>{let t=new AbortController;return fetch(e,{signal:t.signal}).then(e=>{if(!e.ok)throw Error(`Unable to load document (${e.status}).`);return e.arrayBuffer()}).then(r=>{t.signal.aborted||n({contentUrl:e,status:`ready`,data:r})}).catch(r=>{t.signal.aborted||(console.error(`Failed to load workspace document`,r),n({contentUrl:e,status:`error`,data:null}))}),()=>t.abort()},[e]),{status:r?.status??`loading`,data:r?.data??null}}function zJ({status:e}){return e===`ready`?null:(0,H.jsx)(`div`,{className:`absolute inset-0 z-10 flex items-center justify-center bg-background/90 px-6 text-center text-sm text-muted-foreground`,children:T(e===`loading`?`chatWorkspaceLoadingPreview`:`chatWorkspacePreviewFailed`)})}function BJ(e){let t=Array.from(e.querySelectorAll(`.docx-wrapper > section.docx`)).some(e=>!e.style.width&&!e.style.padding);if(e.classList.toggle(`workspace-docx-preview--reflow`,t),t)for(let t of e.querySelectorAll(`table`)){if(t.querySelectorAll(`col`).length<5)continue;let e=document.createElement(`div`);e.className=`workspace-docx-wide-table`,t.before(e),e.append(t)}}function VJ({contentUrl:e}){let t=(0,V.useRef)(null),n=RJ(e),[r,i]=(0,V.useState)(null),a=r?.contentUrl===e?r.status:`loading`,o=n.status===`ready`?a:n.status;return(0,V.useEffect)(()=>{let r=t.current;if(!r||!n.data)return;let a=!1;return r.replaceChildren(),F(()=>import(`./docx-preview-CoM4JK7_.js`).then(async t=>{await t.renderAsync(n.data,r,r,{breakPages:!0,inWrapper:!0,ignoreLastRenderedPageBreak:!1}),a||(BJ(r),i({contentUrl:e,status:`ready`}))}),__vite__mapDeps([22,4,23])).catch(t=>{a||(console.error(`Failed to render DOCX preview`,t),i({contentUrl:e,status:`error`}))}),()=>{a=!0,r.replaceChildren()}},[e,n.data]),(0,H.jsxs)(`div`,{className:`relative h-full overflow-auto bg-muted/40 p-4 custom-scrollbar`,children:[(0,H.jsx)(zJ,{status:o}),(0,H.jsx)(`div`,{ref:t,className:`workspace-docx-preview min-h-full`,"data-testid":`workspace-content-docx`})]})}function HJ({contentUrl:e}){let t=(0,V.useRef)(null),n=RJ(e),[r,i]=(0,V.useState)(null),a=r?.contentUrl===e?r.status:`loading`,o=n.status===`ready`?a:n.status;return(0,V.useEffect)(()=>{let r=t.current;if(!r||!n.data)return;let a=new AbortController,o=null;return r.replaceChildren(),F(async()=>{let{PptxViewer:e,RECOMMENDED_ZIP_LIMITS:t}=await import(`./aiden0z-pptx-renderer.es-C1nfBAXR.js`);return{PptxViewer:e,RECOMMENDED_ZIP_LIMITS:t}},__vite__mapDeps([24,4,23])).then(async({PptxViewer:t,RECOMMENDED_ZIP_LIMITS:s})=>{if(o=await t.open(n.data,r,{renderMode:`list`,fitMode:`contain`,lazySlides:!0,lazyMedia:!0,pdfjs:!1,scrollContainer:r,signal:a.signal,zipLimits:s,listOptions:{windowed:!0,batchSize:8,initialSlides:4,overscanViewport:1.5}}),a.signal.aborted){o.destroy(),o=null;return}i({contentUrl:e,status:`ready`})}).catch(t=>{a.signal.aborted||(console.error(`Failed to render presentation preview`,t),i({contentUrl:e,status:`error`}))}),()=>{a.abort(),o?.destroy(),r.replaceChildren()}},[e,n.data]),(0,H.jsxs)(`div`,{className:`relative h-full bg-muted/40`,children:[(0,H.jsx)(zJ,{status:o}),(0,H.jsx)(`div`,{ref:t,className:`h-full overflow-auto p-4 custom-scrollbar`,"data-testid":`workspace-content-presentation`})]})}var UJ=500,WJ=100;function GJ(e){let t=``,n=e+1;for(;n>0;)--n,t=String.fromCharCode(65+n%26)+t,n=Math.floor(n/26);return t}function KJ({contentUrl:e}){let t=RJ(e),[n,r]=(0,V.useState)(null),[i,a]=(0,V.useState)(``),o=n?.contentUrl===e?n:null,s=t.status===`ready`?o?.status??`loading`:t.status,l=o?.sheets.find(e=>e.name===i)??o?.sheets[0]??null;return(0,V.useEffect)(()=>{if(!t.data)return;let n=!1;return F(()=>import(`./xlsx-CxByi7bR.js`).then(i=>{let a=i.read(t.data,{dense:!0,sheetRows:UJ+1}),o=a.SheetNames.map(e=>{let t=a.Sheets[e],n=t?i.utils.sheet_to_json(t,{header:1,raw:!1,defval:``,blankrows:!1}):[],r=n.slice(0,UJ).map(e=>e.slice(0,WJ).map(e=>String(e??``)));return{name:e,rows:r,columnCount:Math.min(WJ,r.reduce((e,t)=>Math.max(e,t.length),0)),truncated:n.length>UJ||n.some(e=>e.length>WJ)}});n||r({contentUrl:e,status:`ready`,sheets:o})}),[]).catch(t=>{n||(console.error(`Failed to render spreadsheet preview`,t),r({contentUrl:e,status:`error`,sheets:[]}))}),()=>{n=!0}},[e,t.data]),(0,H.jsxs)(`div`,{className:`relative flex h-full min-h-0 flex-col bg-white`,"data-testid":`workspace-content-spreadsheet`,children:[(0,H.jsx)(zJ,{status:s}),o&&o.sheets.length>1?(0,H.jsx)(`div`,{className:`flex shrink-0 gap-1 overflow-x-auto border-b border-border px-2 py-1.5 custom-scrollbar`,children:o.sheets.map(e=>(0,H.jsx)(`button`,{type:`button`,className:c(`h-7 shrink-0 rounded-md px-2.5 text-xs transition-colors`,e.name===l?.name?`bg-accent font-medium text-accent-foreground`:`text-muted-foreground hover:bg-muted hover:text-foreground`),onClick:()=>a(e.name),children:e.name},e.name))}):null,l?(0,H.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto custom-scrollbar`,children:(0,H.jsxs)(`table`,{className:`min-w-full border-collapse text-xs text-foreground`,children:[(0,H.jsx)(`thead`,{className:`sticky top-0 z-[1] bg-muted`,children:(0,H.jsxs)(`tr`,{children:[(0,H.jsx)(`th`,{className:`sticky left-0 z-[2] h-7 min-w-10 border border-border bg-muted px-2`}),Array.from({length:l.columnCount},(e,t)=>(0,H.jsx)(`th`,{className:`h-7 min-w-24 border border-border px-2 text-center font-medium text-muted-foreground`,children:GJ(t)},t))]})}),(0,H.jsx)(`tbody`,{children:l.rows.map((e,t)=>(0,H.jsxs)(`tr`,{children:[(0,H.jsx)(`th`,{className:`sticky left-0 min-w-10 border border-border bg-muted px-2 text-right font-normal text-muted-foreground`,children:t+1}),Array.from({length:l.columnCount},(t,n)=>(0,H.jsx)(`td`,{className:`max-w-80 whitespace-pre-wrap border border-border px-2 py-1.5 align-top`,children:e[n]??``},n))]},t))})]})}):null,l?.truncated?(0,H.jsx)(`div`,{className:`shrink-0 border-t border-border bg-muted/60 px-3 py-1.5 text-xs text-muted-foreground`,children:T(`chatWorkspaceSpreadsheetPreviewTruncated`)}):null]})}function qJ(e){let t=e.mimeType?.trim().toLowerCase()??``,n=e.path.trim().toLowerCase();return t.startsWith(`image/`)||/\.(avif|bmp|gif|heic|heif|ico|jpe?g|png|svg|tiff?|webp)$/i.test(n)?`image`:t.startsWith(`audio/`)||/\.(aac|flac|m4a|mp3|ogg|opus|wav|weba)$/i.test(n)?`audio`:t.startsWith(`video/`)||/\.(avi|m4v|mkv|mov|mp4|webm|wmv)$/i.test(n)?`video`:t.includes(`pdf`)||n.endsWith(`.pdf`)?`pdf`:t===`application/vnd.openxmlformats-officedocument.wordprocessingml.document`||n.endsWith(`.docx`)?`docx`:t.includes(`spreadsheet`)||t.includes(`excel`)||/\.(ods|xls|xlsb|xlsm|xlsx)$/i.test(n)?`spreadsheet`:t===`application/vnd.openxmlformats-officedocument.presentationml.presentation`||n.endsWith(`.pptx`)?`presentation`:t.includes(`html`)||/\.html?$/i.test(n)?`html`:`other`}function JJ({contentUrl:e,label:t}){return(0,H.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-4 px-6 text-center`,"data-testid":`workspace-content-unsupported`,children:[(0,H.jsxs)(`div`,{className:`max-w-sm space-y-1.5`,children:[(0,H.jsx)(`p`,{className:`truncate text-sm font-medium text-foreground`,title:t,children:t}),(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:T(`chatWorkspacePreviewUnsupported`)}),(0,H.jsx)(`p`,{className:`text-xs leading-5 text-muted-foreground/80`,children:T(`chatWorkspacePreviewUnsupportedHint`)})]}),(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center justify-center gap-2`,children:[(0,H.jsx)(`a`,{href:e,download:t,className:`inline-flex h-8 items-center rounded-lg border border-border bg-card px-3 text-xs font-medium text-foreground transition-colors hover:bg-muted`,children:T(`chatWorkspacePreviewDownload`)}),(0,H.jsx)(`a`,{href:e,target:`_blank`,rel:`noreferrer`,className:`inline-flex h-8 items-center rounded-lg bg-primary px-3 text-xs font-medium text-primary-foreground transition-colors hover:bg-primary/90`,children:T(`chatWorkspacePreviewOpenExternally`)})]})]})}function YJ({contentUrl:e,contentParams:t,label:n,onContentHeightChange:r}){let i=(0,V.useRef)(null),a=(0,V.useRef)(null),o=te(t);(0,V.useEffect)(()=>()=>{a.current?.()},[]);let s=()=>{a.current?.(),a.current=null;let e=i.current;if(!(!e||!r||typeof ResizeObserver>`u`))try{let t=e.contentDocument;if(!t)return;let n=()=>{let e=S(t.body,t.documentElement);e>0&&r(e)},i=new ResizeObserver(n);i.observe(t.documentElement),t.body&&i.observe(t.body),n(),a.current=()=>i.disconnect()}catch{}};return(0,H.jsx)(`iframe`,{ref:i,allowFullScreen:!0,className:`h-full w-full border-0 bg-white`,"data-testid":`workspace-html-preview`,name:o,src:b(e,t),title:n,onLoad:s},o??`no-content-params`)}function XJ({contentUrl:e,contentParams:t,kind:n,label:r,onHtmlContentHeightChange:i}){return n===`image`?(0,H.jsx)(`div`,{className:`flex h-full items-center justify-center overflow-auto bg-white p-4 custom-scrollbar`,children:(0,H.jsx)(`img`,{src:e,alt:r,className:`max-h-full max-w-full object-contain`,"data-testid":`workspace-content-image`})}):n===`audio`?(0,H.jsx)(`div`,{className:`flex h-full items-center justify-center bg-white px-6`,children:(0,H.jsx)(`audio`,{controls:!0,preload:`metadata`,"aria-label":r,className:`w-full max-w-xl`,"data-testid":`workspace-content-audio`,src:e})}):n===`video`?(0,H.jsx)(`div`,{className:`flex h-full items-center justify-center bg-black`,children:(0,H.jsx)(`video`,{controls:!0,playsInline:!0,preload:`metadata`,"aria-label":r,className:`max-h-full max-w-full`,"data-testid":`workspace-content-video`,src:e})}):n===`html`?(0,H.jsx)(YJ,{contentUrl:e,contentParams:t,label:r,onContentHeightChange:i}):n===`pdf`?(0,H.jsx)(`iframe`,{allowFullScreen:!0,className:`h-full w-full border-0 bg-white`,"data-testid":`workspace-content-pdf`,src:e,title:r}):n===`docx`?(0,H.jsx)(VJ,{contentUrl:e}):n===`spreadsheet`?(0,H.jsx)(KJ,{contentUrl:e}):n===`presentation`?(0,H.jsx)(HJ,{contentUrl:e}):(0,H.jsx)(JJ,{contentUrl:e,label:r})}function ZJ(e){return[`server-path-read`,e.path?.trim()??``,e.basePath??null,e.line??null]}function QJ(e){let{basePath:t,enabled:n=!0,line:r,path:i}=e,a=i?.trim()??``;return dn({queryKey:ZJ({path:a,basePath:t,line:r}),queryFn:()=>qt({path:a,basePath:t,line:r}),enabled:n&&a.length>0,staleTime:0})}function $J(e){return e.serverKind?e.serverKind:/\.mdx?$/i.test(e.path)?`markdown`:`text`}function eY(e,t){return t<=0?e:`${e}${e.includes(`?`)?`&`:`?`}refresh=${t}`}function tY(e){let{languageHint:t,path:n,startLine:r,text:i}=e,a=r??1;return{key:`preview:${n}`,path:n,display:`preview`,lines:pG({text:i,kind:`context`,oldStartLine:a,newStartLine:a}),rawText:i,languageHint:t??null,oldStartLine:a,newStartLine:a}}function nY(e){if(Array.isArray(e.fullLines)&&e.fullLines.length>0)return{key:`diff:${e.key}`,path:e.path,display:`diff`,lines:e.fullLines,fullLines:e.fullLines,...e.beforeText?{beforeText:e.beforeText}:{},...e.afterText?{afterText:e.afterText}:{},...e.patchText?{patchText:e.patchText}:{},...typeof e.oldStartLine==`number`?{oldStartLine:e.oldStartLine}:{},...typeof e.newStartLine==`number`?{newStartLine:e.newStartLine}:{}};if(e.beforeText==null&&e.afterText==null)return null;let t=_G({beforeText:e.beforeText??``,afterText:e.afterText??``,oldStartLine:e.oldStartLine??void 0,newStartLine:e.newStartLine??void 0});return{key:`diff:${e.key}`,path:e.path,display:`diff`,lines:t,fullLines:t,...e.beforeText?{beforeText:e.beforeText}:{},...e.afterText?{afterText:e.afterText}:{},...typeof e.oldStartLine==`number`?{oldStartLine:e.oldStartLine}:{},...typeof e.newStartLine==`number`?{newStartLine:e.newStartLine}:{}}}function rY({text:e,tone:t=`muted`}){return(0,H.jsx)(`div`,{className:c(`flex h-full items-center justify-center px-6 text-center text-sm`,t===`error`?`text-rose-600`:`text-gray-500`),children:e})}function iY(e){return e instanceof Pe&&e.code===`SERVER_PATH_NOT_FOUND`?T(`chatWorkspacePreviewNotFound`):T(`chatWorkspacePreviewFailed`)}function aY({diffBlock:e}){return e?(0,H.jsx)(oY,{block:e}):(0,H.jsx)(rY,{text:T(`chatWorkspaceDiffEmpty`)})}function oY({block:e,targetColumn:t,targetLine:n}){return(0,H.jsx)(`div`,{className:`h-full overflow-auto custom-scrollbar bg-white`,children:(0,H.jsx)(GV,{block:e,layout:`workspace`,targetColumn:t,targetLine:n})})}function sY({contentUrl:e,contentUrlKind:t,contentLabel:n,contentParams:r,directoryQuery:i,fileBasePath:a,onFileOpen:o,onHtmlContentHeightChange:s,previewBlock:c,previewKind:l,previewViewer:u,previewQuery:d,previewText:f,targetColumn:p,targetLine:m}){return e&&t?(0,H.jsx)(XJ,{contentUrl:e,contentParams:r??void 0,kind:t,label:n,onHtmlContentHeightChange:s}):i?.data?(0,H.jsx)(OJ,{browseQuery:i,onFileOpen:o,renderStatus:e=>(0,H.jsx)(rY,{...e})}):i?.isLoading&&d?.error&&!c?(0,H.jsx)(rY,{text:T(`chatWorkspaceLoadingDirectory`)}):(i?.isLoading||d?.isLoading)&&!c?(0,H.jsx)(rY,{text:T(`chatWorkspaceLoadingPreview`)}):d?.data?.kind===`binary`?(0,H.jsx)(rY,{text:T(`chatWorkspacePreviewUnsupported`)}):d?.error&&!c?(0,H.jsx)(rY,{tone:`error`,text:iY(d.error)}):l===`markdown`&&u!==`source`&&f?(0,H.jsx)(`div`,{className:`h-full overflow-auto custom-scrollbar px-5 py-4`,children:(0,H.jsx)(SB,{text:f,role:`assistant`,texts:{copyCodeLabel:T(`chatCodeCopy`),copiedCodeLabel:T(`chatCodeCopied`)},onFileOpen:o,resolveFileContentUrl:e=>sn(e.path,a)})}):c?(0,H.jsx)(oY,{block:c,targetColumn:p,targetLine:m}):(0,H.jsx)(rY,{text:T(`chatWorkspacePreviewEmpty`)})}function cY({breadcrumbLeading:e,file:t,refreshVersion:n=0,sessionProjectRoot:r,sessionWorkingDir:i,showBreadcrumbs:a=!0,onHtmlContentHeightChange:o,onFileOpen:s,onTextExcerptAdd:c}){let l=t.viewMode===`preview`,u=t.contentUrl?.trim()||null,d=l&&!u,f=QJ({path:t.path,basePath:i,line:t.line,enabled:d}),p=Ic({path:t.path,basePath:i,includeFiles:!0,enabled:d}),m=(0,V.useMemo)(()=>t.viewMode===`diff`?nY(t):null,[t]),h=l?f?.data?.text??t.rawText??null:null,g=$J({path:f?.data?.resolvedPath??t.path,serverKind:f?.data?.kind}),_=u?qJ({path:t.path,mimeType:t.mimeType}):null,v=p?.data?.currentPath??f?.data?.resolvedPath??t.path,y=p?.data?`directory`:`file`,b=Bd(v,t.previewViewer),x=qJ({path:v}),S=sn(t.path,i),C=!u&&l&&S&&t.previewViewer!==`source`&&x!==`other`&&(x!==`html`||b===`rendered`)&&S?eY(S,n):null,w=u??C,T=_??(C?x:null),E=(0,V.useMemo)(()=>!l||!h||w?null:tY({path:f?.data?.resolvedPath??t.path,text:h,languageHint:f?.data?.languageHint??null,startLine:f?.data?.startLine??1}),[w,t.path,l,f?.data?.languageHint,f?.data?.resolvedPath,f?.data?.startLine,h]),D=!w&&!!f?.data?.truncated,O=r??i,k=Tl({path:v,sessionProjectRoot:O})??v.trim(),A=(0,V.useMemo)(()=>Dl({path:v,kind:y,sessionProjectRoot:O,truncated:D}),[O,D,y,v]),j=(0,H.jsx)(sY,{contentUrl:w,contentUrlKind:T,contentLabel:t.label?.trim()||v,contentParams:t.params,directoryQuery:p,fileBasePath:i,onFileOpen:s,onHtmlContentHeightChange:o,previewBlock:E,previewKind:g,previewViewer:b,previewQuery:f,previewText:h,targetColumn:t.column,targetLine:t.line});return(0,H.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col bg-white`,children:[a?(0,H.jsx)(NJ,{breadcrumb:A,leading:e,onFileOpen:s}):null,(0,H.jsx)(`div`,{className:`flex-1 min-h-0 overflow-hidden`,children:t.viewMode===`diff`?(0,H.jsx)(aY,{diffBlock:m}):k&&h?(0,H.jsx)(LJ,{fileLabel:t.label?.trim()||k.split(`/`).at(-1)||k,filePath:k,sourceStartLine:f?.data?.startLine??1,sourceText:h,onAddToChat:c,children:j}):j})]})}var lY=240;function uY({actions:e,children:t,contentHeight:n,isLoading:r=!1}){return(0,H.jsxs)(`section`,{className:`group/inline-content relative my-2 w-full max-w-[48rem] overflow-visible`,"data-chat-inline-content-surface":`true`,"data-chat-message-wide-content":`true`,children:[e?(0,H.jsx)(`div`,{className:c(`pointer-events-none absolute bottom-full left-1/2 z-10 -translate-x-1/2 pb-2 opacity-0 transition-opacity duration-150`,`group-hover/inline-content:pointer-events-auto group-hover/inline-content:opacity-100 group-focus-within/inline-content:pointer-events-auto group-focus-within/inline-content:opacity-100`),"data-chat-inline-content-actions":`true`,children:(0,H.jsx)(`div`,{className:`flex items-center gap-0.5 rounded-lg bg-background/95 p-0.5 shadow-md ring-1 ring-border/60 backdrop-blur-sm`,"data-chat-inline-content-actions-surface":`true`,children:e})}):null,(0,H.jsx)(`div`,{className:c(`h-[240px] min-h-[240px] max-h-[min(90vh,1440px)] overflow-hidden rounded-lg`,r&&`animate-pulse bg-muted/45`),"data-chat-inline-content-viewport":`true`,style:n?{height:Math.max(lY,n)}:void 0,children:t})]})}function dY({display:e,parentSessionKey:t,sessionProjectRoot:n,sessionWorkingDir:r,onFileOpen:i}){let[a,o]=(0,V.useState)(null);if(e.target.type!==`file`)return null;let{path:s,line:c,column:l,params:u,viewer:d}=e.target.payload,f=Ud({path:s,label:e.title,viewMode:`preview`,previewViewer:d,line:c,column:l,params:u},t);if(!f)return null;let p=f.label??f.path.split(/[\\/]/).filter(Boolean).pop()??f.path,m=f.previewViewer===`rendered`&&/\.html?$/i.test(f.path),h=e=>{i({path:f.path,label:f.label??void 0,viewMode:`preview`,previewViewer:e,line:f.line??void 0,column:f.column??void 0,params:f.params??void 0})};return m?(0,H.jsx)(uY,{actions:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(B,{size:`sm`,icon:(0,H.jsx)(Kr,{className:`h-3.5 w-3.5`}),label:T(`chatPanelCardExpand`),tooltipSide:`top`,onClick:()=>h(`rendered`)}),(0,H.jsx)(B,{size:`sm`,icon:(0,H.jsx)(ga,{className:`h-3.5 w-3.5`}),label:T(`chatWorkspaceOpenSource`),tooltipSide:`top`,onClick:()=>h(`source`)})]}),contentHeight:a,children:(0,H.jsx)(cY,{file:f,sessionProjectRoot:n,sessionWorkingDir:r,showBreadcrumbs:!1,onHtmlContentHeightChange:o,onFileOpen:i})}):(0,H.jsxs)(`section`,{className:`my-2 w-full max-w-[48rem] overflow-hidden rounded-lg border border-border bg-card shadow-sm`,"data-chat-inline-file-preview":`true`,"data-chat-message-wide-content":`true`,children:[(0,H.jsxs)(`header`,{className:`border-b border-border bg-muted/45 px-3 py-2`,children:[(0,H.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 text-xs font-medium text-foreground`,children:[(0,H.jsx)(wn,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`,"aria-hidden":!0}),(0,H.jsx)(`span`,{className:`truncate`,children:p})]}),(0,H.jsx)(`p`,{className:`mt-1 truncate font-mono text-[11px] font-normal text-muted-foreground`,title:f.path,children:f.path})]}),(0,H.jsx)(`div`,{className:`h-[420px] min-h-[240px] max-h-[min(60vh,420px)] overflow-hidden`,children:(0,H.jsx)(cY,{file:f,sessionProjectRoot:n,sessionWorkingDir:r,showBreadcrumbs:!1,onFileOpen:i})})]})}function fY({deletePending:e,entry:t,favoritePending:n,onDelete:r,onOpen:i,onToggleFavorite:a}){let[o,s]=(0,V.useState)(!1),[c,l]=(0,V.useState)(!1),u=t.favorite?T(`panelAppsUnfavorite`):T(`panelAppsFavorite`),d=t.lastOpenedAt?`${T(`panelAppsLastOpened`)} ${mY(t.lastOpenedAt)}`:`${T(`panelAppsUpdated`)} ${mY(t.updatedAt)}`,f=e=>{e.stopPropagation(),a()},p=()=>{s(!1),l(!0)};return(0,H.jsxs)(`div`,{className:`group w-full min-w-0 rounded-lg border border-border/60 bg-card px-2.5 py-2.5 transition-colors hover:bg-muted/40`,children:[(0,H.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2`,children:[(0,H.jsxs)(`button`,{type:`button`,onClick:i,className:`min-w-0 flex-1 text-left`,children:[(0,H.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,H.jsx)(`span`,{className:`flex h-7 w-7 shrink-0 items-center justify-center rounded-md bg-muted text-base text-muted-foreground`,children:(0,H.jsx)(hY,{icon:t.icon,title:t.title})}),(0,H.jsx)(`span`,{className:`block min-w-0 flex-1 truncate text-sm font-medium text-foreground`,children:t.title})]}),t.description?(0,H.jsx)(`span`,{className:`mt-1.5 block truncate text-xs leading-5 text-muted-foreground`,children:t.description}):null,(0,H.jsx)(`span`,{className:`mt-0.5 block truncate text-[11px] leading-4 text-muted-foreground/70`,children:d})]}),(0,H.jsxs)(`div`,{className:`flex shrink-0 items-center gap-0.5 opacity-70 transition-opacity group-hover:opacity-100`,children:[(0,H.jsx)(`button`,{type:`button`,onClick:f,disabled:n,className:`rounded-md p-1.5 text-muted-foreground/70 transition-colors hover:bg-muted hover:text-foreground disabled:opacity-50`,title:u,"aria-label":u,children:(0,H.jsx)(Go,{className:t.favorite?`h-4 w-4 fill-current text-foreground`:`h-4 w-4`})}),(0,H.jsxs)(Tc,{open:o,onOpenChange:s,children:[(0,H.jsx)(Ec,{asChild:!0,children:(0,H.jsx)(`button`,{type:`button`,className:`rounded-md p-1.5 text-muted-foreground/70 transition-colors hover:bg-muted hover:text-foreground`,"aria-label":T(`panelAppsMoreActions`),disabled:e,children:(0,H.jsx)(ui,{className:`h-4 w-4`})})}),(0,H.jsx)(Oc,{align:`end`,className:`w-48 rounded-xl p-1.5`,children:(0,H.jsx)(pY,{destructive:!0,disabled:e,icon:Yo,label:T(`panelAppsDelete`),onClick:p})})]})]})]}),(0,H.jsx)(Ur,{open:c,onOpenChange:l,title:T(`panelAppsDeleteConfirmTitle`),description:`${T(`panelAppsDeleteConfirmDescription`)} ${t.fileName}`,confirmLabel:T(`delete`),variant:`destructive`,onConfirm:r,onCancel:()=>void 0})]})}function pY({destructive:e=!1,disabled:t=!1,icon:n,label:r,onClick:i}){return(0,H.jsxs)(`button`,{type:`button`,className:c(`flex w-full items-center gap-2 rounded-lg px-2.5 py-2 text-left text-sm transition-colors disabled:cursor-not-allowed disabled:opacity-50`,e?`text-destructive hover:bg-destructive/10`:`text-muted-foreground hover:bg-[var(--interaction-hover)] hover:text-accent-foreground`),disabled:t,onClick:i,children:[(0,H.jsx)(n,{className:`h-4 w-4 shrink-0`}),(0,H.jsx)(`span`,{children:r})]})}function mY(e){let t=new Date(e);if(Number.isNaN(t.getTime()))return e;let n=M(A()),r=new Date;return t.toDateString()===r.toDateString()?new Intl.DateTimeFormat(n,{hour:`2-digit`,minute:`2-digit`}).format(t):t.getFullYear()===r.getFullYear()?new Intl.DateTimeFormat(n,{month:`numeric`,day:`numeric`}).format(t):new Intl.DateTimeFormat(n,{year:`2-digit`,month:`numeric`,day:`numeric`}).format(t)}function hY({icon:e,title:t}){return e?gY(e)?(0,H.jsx)(`img`,{src:e,alt:``,"aria-hidden":`true`,className:`h-5 w-5 rounded-sm object-contain`,title:t}):(0,H.jsx)(`span`,{className:`max-w-6 truncate text-center leading-none`,children:e}):(0,H.jsx)(Gr,{className:`h-4 w-4`})}function gY(e){return e.startsWith(`data:image/`)||e.startsWith(`http://`)||e.startsWith(`https://`)||e.startsWith(`/`)}var _Y=[`panel-apps`];function vY(e={}){return dn({queryKey:_Y,queryFn:()=>I.panelApps.listPanelApps(),enabled:e.enabled??!0,staleTime:0})}function yY(){let e=yn();return zt({mutationFn:({id:e,preferences:t})=>I.panelApps.updatePanelAppPreferences(e,t),onSuccess:()=>{e.invalidateQueries({queryKey:_Y})}})}function bY(){let e=yn();return zt({mutationFn:e=>I.panelApps.recordPanelAppOpened(e),onSuccess:()=>{e.invalidateQueries({queryKey:_Y})}})}function xY(){let e=yn();return zt({mutationFn:e=>I.panelApps.grantClient(e),onSuccess:()=>{e.invalidateQueries({queryKey:_Y})}})}function SY(){let e=yn();return zt({mutationFn:e=>I.panelApps.deletePanelApp(e),onSuccess:()=>{e.invalidateQueries({queryKey:_Y})}})}function CY(e,t){return t===`favorites`?wY(e.filter(e=>e.favorite),`smart`):wY(t===`recent-open`?e.filter(e=>e.lastOpenedAt):e,t)}function wY(e,t){return[...e].sort((e,n)=>TY(e,n,t))}function TY(e,t,n){return n===`recent-open`?kY(e.lastOpenedAt,t.lastOpenedAt)||EY(e,t):n===`updated`?kY(e.updatedAt,t.updatedAt)||EY(e,t):n===`name`?EY(e,t):DY(e,t)||Number(t.favorite)-Number(e.favorite)||EY(e,t)}function EY(e,t){return e.title.localeCompare(t.title)}function DY(e,t){return OY(t)-OY(e)}function OY(e){return Math.max(new Date(e.lastOpenedAt??0).getTime(),new Date(e.createdAt).getTime(),new Date(e.updatedAt).getTime())}function kY(e,t){return new Date(t??0).getTime()-new Date(e??0).getTime()}var AY=V.createContext(null);function jY({defaultValue:e,value:t,onValueChange:n,children:r}){return(0,H.jsx)(AY.Provider,{value:{value:t,onValueChange:n},children:r})}function MY({children:e,className:t}){return(0,H.jsx)(`div`,{role:`tablist`,onKeyDown:e=>{if(![`ArrowLeft`,`ArrowRight`,`Home`,`End`].includes(e.key))return;let t=Array.from(e.currentTarget.querySelectorAll(`[role="tab"]:not(:disabled)`));if(t.length===0)return;let n=t.indexOf(document.activeElement),r=e.key===`Home`?0:e.key===`End`?t.length-1:e.key===`ArrowRight`?(Math.max(n,-1)+1)%t.length:(n<=0?t.length:n)-1;e.preventDefault(),t[r]?.focus(),t[r]?.click()},className:c(`inline-flex h-9 items-center justify-center rounded-xl bg-muted p-1 text-muted-foreground`,t),children:e})}function NY({value:e,children:t,className:n}){let r=V.useContext(AY);if(!r)throw Error(`TabsTrigger must be used within Tabs`);let i=r.value===e;return(0,H.jsx)(`button`,{type:`button`,onClick:()=>r.onValueChange(e),role:`tab`,"aria-selected":i,tabIndex:i?0:-1,"data-state":i?`active`:`inactive`,className:c(`inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-[13px] 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`,i?`bg-card text-foreground shadow-sm`:`text-muted-foreground hover:bg-[var(--interaction-hover)] hover:text-accent-foreground`,n),children:t})}function PY({value:e,children:t,className:n}){let r=V.useContext(AY);if(!r)throw Error(`TabsContent must be used within Tabs`);return r.value===e?(0,H.jsx)(`div`,{className:c(`mt-2 animate-fade-in`,n),children:t}):null}var FY=[];function IY({onOpenPanelApp:e}){let t=vY(),n=SY(),r=yY(),i=bY(),a=xY(),o=q9(),s=oe(),[c,l]=(0,V.useState)(`smart`),u=t.data?.entries??FY,d=(0,V.useMemo)(()=>CY(u,c),[u,c]),f=async t=>{if(await p(t))try{e(await i.mutateAsync(t.id))}catch{e(t)}},p=async e=>!e.clientDeclared||e.clientGranted?!0:await o.serviceActionAuthorizationManager.requestAuthorization({panelAppId:e.appId,actions:[{actionId:`nextclaw.client`,actionTitle:T(`panelAppsClientGrantTitle`),actionDescription:T(`panelAppsClientGrantDescription`),risk:`dangerous`}]})?(await a.mutateAsync(e.appId),!0):!1,m=e=>{r.mutate({id:e.id,preferences:{favorite:!e.favorite}})},h=e=>{n.mutate(e.id)},g=()=>{s(`/chat`),o.chatDraftIntentManager.requestDraft(T(`panelAppsExamplePrompt`))};return t.isLoading?(0,H.jsx)(`div`,{className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:T(`panelAppsLoading`)}):t.isError?(0,H.jsx)(`div`,{className:`p-4 text-sm text-rose-600`,children:t.error instanceof Error?t.error.message:T(`panelAppsLoadFailed`)}):(0,H.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col bg-card text-card-foreground`,children:[(0,H.jsxs)(`div`,{className:`flex min-h-12 shrink-0 items-center justify-end gap-2 border-b border-border/70 px-4 py-2`,children:[(0,H.jsx)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:t.data?.panelsPath?(0,H.jsx)(ti,{delayDuration:250,children:(0,H.jsxs)(oi,{children:[(0,H.jsx)(si,{asChild:!0,children:(0,H.jsx)(`button`,{type:`button`,className:`rounded p-0.5 text-muted-foreground/70 transition-colors hover:bg-[var(--interaction-hover)] hover:text-accent-foreground`,"aria-label":T(`panelAppsTitle`),children:(0,H.jsx)(ua,{className:`h-3.5 w-3.5`})})}),(0,H.jsx)(Yr,{side:`bottom`,className:`max-w-[320px] break-all font-mono text-xs`,children:t.data.panelsPath})]})}):null}),(0,H.jsx)(`button`,{type:`button`,onClick:()=>void t.refetch(),className:`rounded-md p-1.5 text-muted-foreground transition-colors hover:bg-[var(--interaction-hover)] hover:text-accent-foreground`,title:T(`panelAppsRefresh`),"aria-label":T(`panelAppsRefresh`),children:(0,H.jsx)(gi,{className:`h-3.5 w-3.5`})})]}),(0,H.jsx)(`div`,{className:`border-b border-border/70 px-3 py-2`,children:(0,H.jsx)(jY,{value:c,onValueChange:e=>l(e),children:(0,H.jsxs)(MY,{className:`grid h-auto w-full grid-cols-5 rounded-lg bg-muted/70 p-0.5`,children:[(0,H.jsx)(NY,{value:`smart`,className:`px-2 py-1 text-xs`,children:T(`panelAppsSortSmart`)}),(0,H.jsx)(NY,{value:`favorites`,className:`px-2 py-1 text-xs`,children:T(`panelAppsFavorites`)}),(0,H.jsx)(NY,{value:`recent-open`,className:`px-2 py-1 text-xs`,children:T(`panelAppsSortRecentOpen`)}),(0,H.jsx)(NY,{value:`updated`,className:`px-2 py-1 text-xs`,children:T(`panelAppsSortUpdated`)}),(0,H.jsx)(NY,{value:`name`,className:`px-2 py-1 text-xs`,children:T(`panelAppsSortName`)})]})})}),u.length===0?(0,H.jsx)(LY,{panelsPath:t.data?.panelsPath,onCreateExample:g,onRefresh:()=>void t.refetch()}):d.length===0?(0,H.jsx)(`div`,{className:`flex flex-1 items-center justify-center px-6 text-center text-sm text-muted-foreground`,children:T(`panelAppsEmptyFiltered`)}):(0,H.jsx)(`div`,{className:`custom-scrollbar min-h-0 flex-1 overflow-y-auto p-3`,children:(0,H.jsx)(`div`,{className:`space-y-1.5`,children:d.map(e=>(0,H.jsx)(fY,{entry:e,deletePending:n.isPending,favoritePending:r.isPending,onDelete:()=>h(e),onOpen:()=>void f(e),onToggleFavorite:()=>m(e)},e.id))})})]})}function LY({onCreateExample:e,panelsPath:t,onRefresh:n}){return(0,H.jsx)(`div`,{className:`flex flex-1 items-center justify-center overflow-y-auto px-5 py-6 text-center`,children:(0,H.jsxs)(`div`,{className:`w-full max-w-sm`,children:[(0,H.jsx)(`div`,{className:`mx-auto flex h-10 w-10 items-center justify-center rounded-lg bg-primary/10 text-primary`,children:(0,H.jsx)(Gr,{className:`h-5 w-5`})}),(0,H.jsx)(`h2`,{className:`mt-3 text-sm font-semibold text-foreground`,children:T(`panelAppsEmptyTitle`)}),(0,H.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-muted-foreground`,children:T(`panelAppsEmptyDescription`)}),(0,H.jsxs)(`div`,{className:`mt-4 space-y-2 text-left`,children:[(0,H.jsx)(RY,{icon:(0,H.jsx)(uo,{className:`h-4 w-4`}),title:T(`panelAppsEmptyAskTitle`),description:T(`panelAppsEmptyAskDescription`),actionLabel:T(`panelAppsEmptyAskAction`),onAction:e}),(0,H.jsx)(RY,{icon:(0,H.jsx)(ka,{className:`h-4 w-4`}),title:T(`panelAppsEmptyFileTitle`),description:T(`panelAppsEmptyFileDescription`)})]}),t?(0,H.jsxs)(`div`,{className:`mt-4 rounded-md bg-muted/60 px-3 py-2 text-left`,children:[(0,H.jsx)(`div`,{className:`text-[11px] font-medium uppercase text-muted-foreground/70`,children:T(`panelAppsPanelsPath`)}),(0,H.jsx)(`code`,{className:`mt-1 block break-all text-xs text-muted-foreground`,children:t})]}):null,(0,H.jsxs)(`button`,{type:`button`,onClick:n,className:`mt-4 inline-flex items-center justify-center gap-1.5 rounded-md border border-border px-3 py-1.5 text-xs 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`,children:[(0,H.jsx)(gi,{className:`h-3.5 w-3.5`}),T(`panelAppsRefresh`)]})]})})}function RY({actionLabel:e,description:t,icon:n,onAction:r,title:i}){let a=(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`div`,{className:`mt-0.5 text-muted-foreground`,children:n}),(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsx)(`div`,{className:`text-xs font-medium text-foreground`,children:i}),(0,H.jsx)(`div`,{className:`mt-0.5 text-xs leading-5 text-muted-foreground`,children:t}),e?(0,H.jsx)(`div`,{className:`mt-2 text-xs font-medium text-primary`,children:e}):null]})]});return r?(0,H.jsx)(`button`,{type:`button`,onClick:r,className:`flex w-full gap-2 rounded-md bg-muted/60 px-3 py-2.5 text-left transition-colors hover:bg-[var(--interaction-hover)] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,children:a}):(0,H.jsx)(`div`,{className:`flex gap-2 rounded-md bg-muted/60 px-3 py-2.5`,children:a})}var zY=class{constructor(e){this.authorizationManager=e,this.handleIframeMessage=({event:e,iframe:t,iframeInstanceId:n,tab:r})=>{this.isBridgeRequest(e.data)&&(!t?.contentWindow||e.source!==t.contentWindow||this.handleBridgeRequest({event:e,iframe:t,iframeInstanceId:n,tab:r},e.data))},this.handleBridgeRequest=async(e,t)=>{try{let n=this.getBridgeContext(t),r=await this.dispatchRequest(n,t);this.postResponse(e,{type:`nextclaw:panel-app-service-actions:response`,requestId:t.requestId,ok:!0,data:r})}catch(n){this.postResponse(e,{type:`nextclaw:panel-app-service-actions:response`,requestId:t.requestId,ok:!1,error:this.toBridgeError(n)})}},this.dispatchRequest=async(e,t)=>{switch(t.method){case`list`:return await I.serviceApps.listServiceActions({bridgeSessionToken:e.token});case`requestGrant`:return await this.confirmAndGrant(e,this.requireActionId(t));case`revokeGrant`:return await I.serviceApps.revokeServiceAction(this.requireActionId(t),{bridgeSessionToken:e.token});case`invoke`:return await this.invokeWithAuthorization(e,t);case`agent.send`:return await this.sendAgentMessageWithAuthorization(e,t);case`agent.generateObject`:return await this.generateAgentObjectWithAuthorization(e,t);default:throw Error(`Unsupported panel bridge method: ${String(t.method)}`)}},this.invokeWithAuthorization=async(e,t)=>{let n=this.requireActionId(t);try{return await I.serviceApps.invokeServiceAction(n,this.readOptionalRecord(t.payload?.input),{bridgeSessionToken:e.token})}catch(r){if(!(r instanceof Pe)||r.code!==`AUTHORIZATION_REQUIRED`)throw r;return await this.confirmAndGrant(e,n,this.readOptionalRecord(t.payload?.input)),await I.serviceApps.invokeServiceAction(n,this.readOptionalRecord(t.payload?.input),{bridgeSessionToken:e.token})}},this.sendAgentMessageWithAuthorization=async(e,t)=>{try{return await I.panelApps.sendAgentMessage(this.readAgentSendRequest(t),{bridgeSessionToken:e.token})}catch(n){if(!(n instanceof Pe)||n.code!==`AUTHORIZATION_REQUIRED`)throw n;return await this.confirmAndGrantAgentCapability(e,`agent:send`),await I.panelApps.sendAgentMessage(this.readAgentSendRequest(t),{bridgeSessionToken:e.token})}},this.generateAgentObjectWithAuthorization=async(e,t)=>{try{return await I.panelApps.generateAgentObject(this.readGenerateObjectRequest(t),{bridgeSessionToken:e.token})}catch(n){if(!(n instanceof Pe)||n.code!==`AUTHORIZATION_REQUIRED`)throw n;return await this.confirmAndGrantAgentCapability(e,`agent:generateObject`),await I.panelApps.generateAgentObject(this.readGenerateObjectRequest(t),{bridgeSessionToken:e.token})}},this.confirmAndGrantAgentCapability=async(e,t)=>{if(!await this.authorizationManager.requestAuthorization({panelAppId:e.appId,actions:[{actionId:t,actionTitle:t===`agent:send`?`Send agent message`:`Generate object`,actionDescription:t===`agent:send`?`Send a message to a NextClaw Agent session.`:`Send context to a NextClaw Agent session and receive a structured object.`,risk:`write`}]}))throw new Pe({code:`AUTHORIZATION_REJECTED`,message:`Permission rejected for ${t}.`});return await I.panelApps.grantAgentCapability(t,{bridgeSessionToken:e.token})},this.confirmAndGrant=async(e,t,n)=>{let r=await this.listGrantCandidateActions(e,t);if(!await this.authorizationManager.requestAuthorization({panelAppId:e.appId,actions:r.map(e=>({actionId:e.id,actionTitle:e.title,actionDescription:e.description,risk:e.risk})),inputPreview:this.createInputPreview(n)}))throw new Pe({code:`AUTHORIZATION_REJECTED`,message:`Permission rejected for ${t}.`});let i=await I.serviceApps.grantServiceActions(r.map(e=>e.id),{bridgeSessionToken:e.token}),a=i.grants.find(e=>e.actionId===t)??i.grants[0];if(!a)throw Error(`No permission grant returned for ${t}.`);return a},this.listGrantCandidateActions=async(e,t)=>{let n=await I.serviceApps.listServiceActions({bridgeSessionToken:e.token}),r=n.actions.find(e=>e.id===t);if(r&&r.grantState!==`not-granted`)return[r];let i=n.actions.filter(e=>e.grantState===`not-granted`),a=[...i.filter(e=>e.id===t),...i.filter(e=>e.id!==t)];return a.length>0?a:[{appId:r?.appId??t.split(`.`)[0]??t,description:r?.description,id:t,name:r?.name??t,risk:r?.risk??`dangerous`,title:r?.title}]},this.createInputPreview=e=>{if(!(!e||Object.keys(e).length===0))try{let t=JSON.stringify(e,null,2);return t.length>500?`${t.slice(0,500)}...`:t}catch{return`[unserializable input]`}},this.getBridgeContext=e=>({appId:e.appId,token:e.runtimeToken}),this.requireActionId=e=>{let t=e.payload?.actionId?.trim();if(!t)throw Error(`Panel bridge actionId is required.`);return t},this.readOptionalRecord=e=>{if(e!==void 0)return this.requireRecord(e,`input`)},this.readAgentSendRequest=e=>({payload:this.requireRecord(e.payload?.request,`agent.send request`)}),this.readGenerateObjectRequest=e=>({input:this.requireRecord(e.payload?.input,`generateObject input`)}),this.requireRecord=(e,t)=>{if(!e||typeof e!=`object`||Array.isArray(e))throw Error(`${t} is required.`);return e},this.postResponse=(e,t)=>{e.iframe?.contentWindow?.postMessage(t,`*`)},this.toBridgeError=e=>e instanceof Pe?{code:e.code,message:e.message,details:e.details}:{message:e instanceof Error?e.message:String(e)},this.isBridgeRequest=e=>{if(!e||typeof e!=`object`)return!1;let t=e;return t.type===`nextclaw:panel-app-service-actions:request`&&typeof t.requestId==`string`&&typeof t.runtimeToken==`string`&&typeof t.appId==`string`&&(t.method===`invoke`||t.method===`agent.send`||t.method===`agent.generateObject`||t.method===`list`||t.method===`requestGrant`||t.method===`revokeGrant`)}}};function BY(e,t){let n=t.trim();return[e.id,e.appId,e.fileName,e.title].some(e=>e.trim()===n)}function VY(e,t){let n=t.trim();return n?e.find(e=>BY(e,n))??null:null}var HY=`allow-scripts allow-forms allow-modals allow-popups allow-popups-to-escape-sandbox allow-downloads allow-pointer-lock allow-presentation`;function UY(e){e?.focus({preventScroll:!0}),e?.contentWindow?.focus()}function WY({className:e,icon:t,name:n}){let[r,i]=(0,V.useState)(),a=GY(t),o=r===t;return(0,H.jsx)(`span`,{className:c(`relative flex h-11 w-11 shrink-0 items-center justify-center overflow-hidden rounded-[13px] bg-gradient-to-br from-violet-500/15 via-primary/10 to-emerald-500/15 text-sm font-semibold text-foreground ring-1 ring-black/[0.04] dark:ring-white/[0.06]`,e),children:a&&!o?(0,H.jsx)(`img`,{src:t,alt:``,className:`h-full w-full object-cover`,onError:()=>i(t)}):t&&!a?(0,H.jsx)(`span`,{className:`text-base leading-none`,"aria-hidden":`true`,children:t}):(0,H.jsx)(`span`,{"aria-hidden":`true`,children:KY(n)})})}function GY(e){return!!e&&(e.startsWith(`data:`)||e.startsWith(`/`)||e.startsWith(`http://`)||e.startsWith(`https://`))}function KY(e){return[...e.trim()][0]?.toLocaleUpperCase()??`A`}function qY({accentColor:e,className:t,coverPreview:n,coverUrl:r,name:i}){let[a,o]=(0,V.useState)(),s=r&&a!==r?r:void 0;return(0,H.jsx)(`span`,{className:c(`relative block aspect-[8/5] overflow-hidden rounded-2xl bg-muted ring-1 ring-black/[0.05] dark:ring-white/[0.07]`,t),style:{"--app-accent":e??`#78716c`},children:s?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`img`,{src:s,alt:`${i} app cover`,className:`h-full w-full object-cover transition-transform duration-500 group-hover:scale-[1.015]`,loading:`lazy`,onError:()=>o(s)}),null]}):(0,H.jsx)(`span`,{"aria-label":`${i} 暂无封面`,className:`flex h-full w-full items-center justify-center bg-[radial-gradient(circle_at_30%_25%,color-mix(in_srgb,var(--app-accent)_28%,transparent),transparent_50%),linear-gradient(145deg,var(--muted),var(--background))]`,children:(0,H.jsx)(`span`,{className:`flex h-14 w-14 items-center justify-center rounded-2xl bg-background/65 text-xl font-semibold text-foreground/65 shadow-sm ring-1 ring-black/[0.05] backdrop-blur-sm`,children:JY(i)})})})}function JY(e){let t=e.trim().split(/\s+/).filter(Boolean);return t.length>1?t.slice(0,2).map(e=>e[0]).join(``).toLocaleUpperCase():[...t[0]??`?`].slice(0,1).join(``).toLocaleUpperCase()}function YY({active:e,canUpdate:t,failed:n,installed:r,isStarting:i,onAction:a,operation:o}){return(0,H.jsx)(R,{type:`button`,size:`sm`,variant:r&&!t||e?`secondary`:`default`,disabled:r&&!t||e||i,onClick:a,className:`shrink-0 rounded-full px-4`,children:r&&!t?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Tr,{className:`mr-1.5 h-3.5 w-3.5`}),T(`appPackagesMarketplaceInstalled`)]}):e||i?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(mi,{className:`mr-1.5 h-3.5 w-3.5 animate-spin`}),o?QY(o):T(`appPackagesPreparing`)]}):T(t?`appPackagesUpdate`:n?`appPackagesRetry`:`appPackagesInstall`)})}function XY({operation:e}){let t=Math.max(4,Math.round(e.completedSteps/e.totalSteps*100)),n=e.status===`failed`||e.status===`interrupted`;return(0,H.jsxs)(`div`,{className:`mt-2`,role:n?`alert`:`status`,"aria-live":`polite`,children:[(0,H.jsx)(`div`,{className:`h-1 overflow-hidden rounded-full bg-muted`,children:(0,H.jsx)(`div`,{className:c(`h-full rounded-full transition-[width] duration-300`,n?`bg-destructive`:`bg-primary`),style:{width:n?`100%`:`${t}%`}})}),(0,H.jsx)(`p`,{className:c(`mt-1.5 truncate text-[11px]`,n?`text-destructive`:`text-muted-foreground`),children:n?e.error??T(`appPackagesActionFailed`):QY(e)})]})}function ZY(e,t,n){return e.find(e=>e.appId===t||e.source===n)}function QY(e){switch(e.status){case`queued`:return T(`appPackagesPreparing`);case`resolving`:return T(`appPackagesResolving`);case`downloading`:return T(`appPackagesDownloading`);case`verifying`:return T(`appPackagesVerifying`);case`installing`:return e.action===`rollback`?T(`appPackagesSwitchingVersion`):e.action===`uninstall`?T(`appPackagesUninstalling`):T(`appPackagesInstalling`);case`finalizing`:return T(`appPackagesFinalizing`);case`succeeded`:return T(`appPackagesCompleted`);case`failed`:case`interrupted`:return T(`appPackagesActionFailed`)}}function $Y({checked:e,description:t,destructive:n=!1,disabled:r=!1,label:i,onClick:a}){return(0,H.jsxs)(`button`,{type:`button`,"aria-pressed":e,"aria-disabled":r,disabled:r,onClick:a,className:c(`flex items-start gap-3 rounded-xl border px-3 py-3 text-left transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border disabled:cursor-not-allowed disabled:opacity-50`,e?`border-foreground/25 bg-muted/55`:`border-border/60 hover:bg-muted/35`),children:[(0,H.jsx)(`span`,{className:c(`mt-0.5 flex h-4 w-4 shrink-0 items-center justify-center rounded-full border`,e?`border-foreground bg-foreground text-background`:`border-border`),children:e?(0,H.jsx)(Tr,{className:`h-2.5 w-2.5`}):null}),(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`span`,{className:c(`block text-sm font-medium`,n?`text-destructive`:`text-foreground`),children:i}),(0,H.jsx)(`span`,{className:`mt-0.5 block text-xs leading-5 text-muted-foreground`,children:t})]})]})}function eX({storage:e,usage:t}){let n=[[T(`appDataClassData`),t.dataBytes],[T(`appDataClassConfig`),t.configBytes],[T(`appDataClassState`),t.stateBytes],[T(`appDataClassCache`),t.cacheBytes],[T(`appDataClassTemporary`),t.temporaryBytes],[T(`appDataClassLogs`),t.logsBytes]];return(0,H.jsxs)(`div`,{className:`rounded-xl bg-muted/45 px-3 py-2.5`,children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-3 text-xs`,children:[(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 font-medium text-foreground`,children:[(0,H.jsx)(qa,{className:`h-3.5 w-3.5`}),T(`appDataStorageTotal`)]}),(0,H.jsx)(`span`,{className:`tabular-nums text-foreground`,children:tX(t.totalBytes)})]}),(0,H.jsx)(`dl`,{className:`mt-2 grid grid-cols-2 gap-x-4 gap-y-1 text-[11px] sm:grid-cols-3`,children:n.map(([e,t])=>(0,H.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-2`,children:[(0,H.jsx)(`dt`,{className:`truncate text-muted-foreground`,children:e}),(0,H.jsx)(`dd`,{className:`shrink-0 tabular-nums text-foreground/80`,children:tX(t)})]},e))}),(0,H.jsxs)(`div`,{className:`mt-2 border-t border-border/50 pt-2`,children:[(0,H.jsx)(`div`,{className:`text-[10px] text-muted-foreground`,children:T(`appDataStoragePath`)}),(0,H.jsx)(`code`,{"aria-label":T(`appDataStoragePath`),className:`mt-0.5 block select-all break-all font-mono text-[10px] leading-4 text-foreground/75`,tabIndex:0,children:e.instanceDirectory})]})]})}function tX(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:e<1024*1024*1024?`${(e/(1024*1024)).toFixed(1)} MB`:`${(e/(1024*1024*1024)).toFixed(1)} GB`}var nX=[`app-data`];function rX(){return dn({queryKey:nX,queryFn:()=>I.appData.list(),staleTime:0})}function iX(){let e=yn();return zt({mutationFn:({dataId:e,confirmAppId:t})=>I.appData.deleteRetained(e,t),onSuccess:async()=>{await e.invalidateQueries({queryKey:nX}),L.success(T(`appDataDeleteCompleted`))}})}function aX({diagnostics:e,entries:t,error:n,isLoading:r,onDeletionFocusReturn:i}){let[a,o]=(0,V.useState)(null),s=(0,V.useRef)(null),c=(0,V.useRef)(null),l=iX(),u=t.filter(e=>e.lifecycle===`retained`),d=()=>{l.isPending||o(null)};return(0,V.useEffect)(()=>{l.isError&&s.current?.focus()},[l.isError]),!r&&!n&&e.length===0&&u.length===0?null:(0,H.jsxs)(`section`,{className:`mt-6`,"aria-labelledby":`retained-app-data-title`,children:[(0,H.jsxs)(`div`,{className:`mb-2.5 px-1`,children:[(0,H.jsx)(`h2`,{ref:c,id:`retained-app-data-title`,tabIndex:-1,className:`text-sm font-semibold text-foreground`,children:T(`appDataRetainedTitle`)}),(0,H.jsx)(`p`,{className:`mt-0.5 text-xs leading-5 text-muted-foreground`,children:T(`appDataRetainedDescription`)})]}),r?(0,H.jsx)(xi,{className:`h-28 w-full rounded-xl`}):null,n?(0,H.jsx)(`div`,{role:`alert`,className:`rounded-xl border border-destructive/20 bg-destructive/5 px-3 py-2.5 text-xs text-destructive`,children:n instanceof Error?n.message:T(`appDataLoadFailed`)}):null,e.length>0?(0,H.jsxs)(`div`,{role:`alert`,className:`mb-2.5 rounded-xl border border-amber-500/20 bg-amber-500/5 px-3 py-2.5 text-xs text-amber-800 dark:text-amber-200`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-1.5 font-medium`,children:[(0,H.jsx)(Ir,{className:`h-3.5 w-3.5`}),T(`appDataDiagnosticsTitle`)]}),(0,H.jsx)(`ul`,{className:`mt-1 space-y-1`,children:e.map(e=>(0,H.jsxs)(`li`,{className:`break-all`,children:[e.message,` — `,e.instanceDirectory]},e.instanceDirectory))})]}):null,(0,H.jsx)(`div`,{className:`space-y-2.5`,children:u.map(e=>(0,H.jsxs)(`article`,{className:`rounded-xl border border-border/65 bg-card p-3.5`,children:[(0,H.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,H.jsx)(`span`,{className:`flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-muted text-muted-foreground`,children:(0,H.jsx)(Ui,{className:`h-4 w-4`})}),(0,H.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,H.jsx)(`div`,{className:`truncate text-sm font-medium text-foreground`,children:e.displayName}),(0,H.jsxs)(`div`,{className:`mt-0.5 truncate font-mono text-[10px] text-muted-foreground`,children:[e.appId,e.publisherId?` · ${e.publisherId}`:``]})]}),(0,H.jsxs)(R,{type:`button`,size:`sm`,variant:`outline`,onClick:()=>{l.reset(),o(e)},children:[(0,H.jsx)(Yo,{className:`mr-1.5 h-3.5 w-3.5`}),T(`appDataDeleteAction`)]})]}),(0,H.jsx)(`div`,{className:`mt-3`,children:(0,H.jsx)(eX,{storage:e.storage,usage:e.usage})})]},e.id))}),(0,H.jsx)(Rr,{open:!!a,onOpenChange:e=>!e&&d(),children:(0,H.jsx)(Vr,{className:`max-w-md [&>:last-child]:hidden`,onEscapeKeyDown:e=>l.isPending&&e.preventDefault(),onInteractOutside:e=>l.isPending&&e.preventDefault(),children:a?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(zr,{children:[(0,H.jsx)(Hr,{children:T(`appDataDeleteTitle`)}),(0,H.jsx)(Fr,{children:T(`appDataDeleteDescription`)})]}),(0,H.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[(0,H.jsxs)(`div`,{className:`rounded-lg border border-destructive/20 bg-destructive/5 px-3 py-2 text-xs text-destructive`,children:[a.displayName,` · `,a.appId]}),(0,H.jsx)(eX,{storage:a.storage,usage:a.usage}),l.isError?(0,H.jsx)(`p`,{ref:s,role:`alert`,tabIndex:-1,className:`text-xs text-destructive`,children:l.error instanceof Error?l.error.message:T(`appDataDeleteFailed`)}):null]}),(0,H.jsxs)(kr,{className:`mt-5 gap-2 sm:gap-0`,children:[(0,H.jsx)(R,{autoFocus:!0,type:`button`,variant:`outline`,disabled:l.isPending,onClick:d,children:T(`cancel`)}),(0,H.jsxs)(R,{type:`button`,variant:`destructive`,disabled:l.isPending,onClick:()=>l.mutate({dataId:a.id,confirmAppId:a.appId},{onSuccess:()=>{o(null),window.requestAnimationFrame(()=>{c.current?c.current.focus():i?.()})}}),children:[l.isPending?(0,H.jsx)(mi,{className:`mr-1.5 h-3.5 w-3.5 animate-spin`}):null,l.isPending?T(`appDataDeleting`):T(`appDataDeletePermanently`)]})]})]}):null})})]})}var oX=[`app-packages`],sX=[`panel-apps`],cX=[`service-apps`],lX=[`service-actions`],uX=[`app-package-operations`],dX=new Set([`queued`,`resolving`,`downloading`,`verifying`,`installing`,`finalizing`]);function fX(){return dn({queryKey:oX,queryFn:()=>I.appPackages.list({includeStorageUsage:!1}),staleTime:0})}function pX(){return dn({queryKey:uX,queryFn:()=>I.appPackages.listOperations(),refetchInterval:e=>(e.state.data?.entries??[]).some(e=>mX(e.status))?500:!1,staleTime:0})}function mX(e){return dX.has(e)}function hX({isLoaded:e,operations:t,refetchPackages:n,refetchPanels:r,refetchAppData:i,settlementManager:a}){(0,V.useEffect)(()=>{a.settle({isLoaded:e,operations:t,refetchPackages:n,refetchPanels:r,refetchAppData:i})},[e,t,n,r,i,a])}function gX(){let e=yn();return zt({mutationFn:async e=>{switch(e.action){case`enable`:return await I.appPackages.enable(e.appId);case`disable`:return await I.appPackages.disable(e.appId);case`install`:return await I.appPackages.startInstall({source:e.source,registryUrl:e.registryUrl});case`update`:return await I.appPackages.startUpdate(e.appId);case`rollback`:return await I.appPackages.startRollback(e.appId,e.version);case`uninstall`:return await I.appPackages.startUninstall(e.appId,e.purgeData??!1)}},onSuccess:async()=>{await Promise.all([e.invalidateQueries({queryKey:oX}),e.invalidateQueries({queryKey:sX}),e.invalidateQueries({queryKey:cX}),e.invalidateQueries({queryKey:lX}),e.invalidateQueries({queryKey:uX}),e.invalidateQueries({queryKey:nX})])}})}var _X={darwin:`macOS`,linux:`Linux`,win32:`Windows`};function vX(e,t){return!e||e.mode===`universal`?t:e.operatingSystems.map(e=>_X[e]).join(` · `)}function yX(e){return Array.from(new Set(e.map(e=>e.spec).filter(Boolean)))}function bX(e){let{request:t,result:n}=e,r=new Date().toISOString();return n.type===`skill`?{type:`skill`,spec:n.spec,id:t.skill??n.spec,label:t.skill??n.name??n.spec,source:`workspace`,installPath:t.installPath,installedAt:r}:{type:n.type,spec:n.spec,id:n.name??n.spec,label:n.name??n.spec,source:`marketplace`,origin:`marketplace`,enabled:t.enabled??!0,runtimeStatus:t.enabled===!1?`disabled`:`ready`,installedAt:r}}function xX(e,t){let{id:n,spec:r}=t;return!!(r&&e.spec===r||n&&e.id===n)}function SX(e,t){return t??{type:e,total:0,specs:[],records:[]}}function CX(e){let{result:t,view:n}=e,r=SX(t.type,n),i=bX(e),a=r.records.findIndex(e=>xX(e,{id:i.id,spec:i.spec})),o=[...r.records];return a>=0?o[a]={...o[a],...i}:o.unshift(i),{...r,type:t.type,records:o,specs:yX(o),total:o.length}}function wX(e){let{request:t,result:n,view:r}=e,i=SX(n.type,r);if(n.action===`uninstall`||n.action===`remove`){let e=i.records.filter(e=>!xX(e,{id:n.id,spec:t.spec}));return{...i,records:e,specs:yX(e),total:e.length}}let a=i.records.map(e=>xX(e,{id:n.id,spec:t.spec})?n.action===`disable`?{...e,enabled:!1,runtimeStatus:`disabled`}:n.action===`update`?{...e,installedAt:new Date().toISOString(),origin:e.origin??`marketplace`}:{...e,enabled:!0,runtimeStatus:`ready`}:e);return{...i,records:a,specs:yX(a),total:a.length}}var TX=3e4;function EX(e){return e instanceof Pe&&e.code===`MARKETPLACE_SKILL_LOCAL_CHANGES`}function DX(e){let t=zn({queryKey:[`marketplace-items`,e],initialPageParam:1,queryFn:({pageParam:t})=>et({...e,page:t}),getNextPageParam:e=>e.page<e.totalPages?e.page+1:void 0,placeholderData:(t,n)=>{let r=n?.queryKey?.[1];if(!(!r||typeof r!=`object`||!r))return(`type`in r?r.type:void 0)===e.type&&kX(r,e)?t:void 0},staleTime:15e3,refetchInterval:e.q?!1:TX,refetchOnMount:`always`,refetchOnReconnect:`always`,refetchOnWindowFocus:`always`}),n=(0,V.useMemo)(()=>On(t.data),[t.data]);return{...t,data:n}}function OX(e,t=!0){return dn({queryKey:[`marketplace-recent-items`,e],queryFn:()=>et({type:e,sort:`updated`,page:1,pageSize:6}),enabled:t,staleTime:15e3,refetchInterval:TX,refetchOnMount:`always`,refetchOnReconnect:`always`,refetchOnWindowFocus:`always`})}function kX(e,t){return e.tag===t.tag&&e.scene===t.scene&&e.pageSize===t.pageSize}function AX(e=!0){return dn({queryKey:[`marketplace-skill-scenes`],queryFn:Fe,enabled:e,staleTime:6e4})}function jX(e,t=!0){let n=Vi({queries:e.map(e=>({queryKey:[`marketplace-skill-scene-count`,e.scene],queryFn:()=>et({type:`skill`,scene:e.scene,pageSize:1}),enabled:t&&typeof e.count!=`number`,staleTime:6e4}))});return(0,V.useMemo)(()=>{let t=new Map;return e.forEach((e,r)=>{let i=typeof e.count==`number`?e.count:n[r]?.data?.total;typeof i==`number`&&t.set(e.scene,i)}),t},[n,e])}function MX(e){return dn({queryKey:[`marketplace-installed`,e],queryFn:()=>Qe(e),staleTime:1e4})}function NX(){let e=yn();return zt({mutationFn:e=>$t(e),onSuccess:(t,n)=>{e.setQueryData([`marketplace-installed`,t.type],e=>CX({view:e,request:n,result:t})),e.invalidateQueries({queryKey:[`marketplace-installed`,t.type],refetchType:`inactive`}),L.success(t.message||T(`marketplaceInstallSuccessSkill`))},onError:e=>{L.error(e.message||T(`marketplaceInstallFailed`))}})}function PX(){let e=yn();return zt({mutationFn:e=>Ne(e),onSuccess:(t,n)=>{e.setQueryData([`marketplace-installed`,t.type],e=>wX({view:e,request:n,result:t})),e.invalidateQueries({queryKey:[`marketplace-installed`,t.type],refetchType:`inactive`});let r=t.action===`enable`?T(`marketplaceEnableSuccess`):t.action===`disable`?T(`marketplaceDisableSuccess`):t.action===`update`?T(`marketplaceUpdateSuccess`):T(`marketplaceUninstallSuccess`);L.success(t.message||r)},onError:e=>{EX(e)||L.error(e.message||T(`marketplaceOperationFailed`))}})}var FX=[`bg-amber-600`,`bg-orange-500`,`bg-yellow-600`,`bg-emerald-600`,`bg-teal-600`,`bg-cyan-600`,`bg-stone-600`,`bg-rose-500`,`bg-violet-500`];function IX(e){let{name:t,fallback:n,className:r}=e,i=t||n,a=i.substring(0,2).toUpperCase();return(0,H.jsx)(`div`,{className:c(`flex h-10 w-10 shrink-0 items-center justify-center rounded-xl text-sm font-semibold text-white`,LX(i),r),children:a})}function LX(e){let t=0;for(let n=0;n<e.length;n++)t=e.charCodeAt(n)+((t<<5)-t);return FX[Math.abs(t)%FX.length]}function RX({title:e,spec:t}){return(0,H.jsxs)(ti,{delayDuration:400,children:[(0,H.jsxs)(oi,{children:[(0,H.jsx)(si,{asChild:!0,children:(0,H.jsx)(`div`,{className:`truncate text-[14px] font-semibold leading-tight text-gray-950`,children:e})}),(0,H.jsx)(Yr,{className:`max-w-[300px] text-xs`,children:e})]}),(0,H.jsx)(`div`,{className:`mb-2 mt-1 flex min-w-0 items-center gap-1.5`,children:t?(0,H.jsxs)(oi,{children:[(0,H.jsx)(si,{asChild:!0,children:(0,H.jsx)(`span`,{className:`max-w-full truncate text-[11px] font-mono leading-tight text-gray-400`,children:t})}),(0,H.jsx)(Yr,{className:`max-w-[300px] break-all font-mono text-xs`,children:t})]}):null})]})}function zX(e){let{item:t,record:n,state:r,onInstall:i,onManage:a}=e,{isInstalling:o,canUpdate:s,canUninstall:l,busyAction:u}=r,d=!!u;return t&&!n||n&&(s||l)?(0,H.jsxs)(`div`,{className:c(`flex shrink-0 items-center justify-end gap-1.5 opacity-100 transition-opacity duration-150`,`md:pointer-events-none md:opacity-0`,`md:group-hover:pointer-events-auto md:group-hover:opacity-100`,`md:group-focus-within:pointer-events-auto md:group-focus-within:opacity-100`),children:[t&&!n&&(0,H.jsxs)(`button`,{onClick:e=>{e.stopPropagation(),i(t)},disabled:o,className:`inline-flex h-6 items-center gap-1 whitespace-nowrap rounded-md bg-primary px-2 text-[11px] font-medium text-white transition-colors hover:bg-primary-600 disabled:opacity-50`,children:[(0,H.jsx)(Sa,{className:`h-3 w-3`}),T(o?`marketplaceInstalling`:`marketplaceInstall`)]}),n&&s&&(0,H.jsxs)(`button`,{disabled:d,onClick:e=>{e.stopPropagation(),a(`update`,n)},className:`inline-flex h-6 items-center gap-1 whitespace-nowrap rounded-md border border-blue-200/80 bg-white px-2 text-[11px] font-medium text-blue-600 transition-colors hover:border-blue-300 hover:bg-blue-50 disabled:opacity-50`,children:[(0,H.jsx)(gi,{className:`h-3 w-3`}),T(u===`update`?`marketplaceUpdating`:`marketplaceUpdate`)]}),n&&l&&(0,H.jsxs)(`button`,{disabled:d,onClick:e=>{e.stopPropagation(),a(`uninstall`,n)},className:`inline-flex h-6 items-center gap-1 whitespace-nowrap rounded-md border border-gray-200/80 bg-white px-2 text-[11px] font-medium text-gray-500 transition-colors hover:border-rose-200 hover:bg-rose-50 hover:text-rose-600 disabled:opacity-50`,children:[(0,H.jsx)(Yo,{className:`h-3 w-3`}),T(u===`uninstall`?`marketplaceRemoving`:`marketplaceUninstall`)]})]}):null}function BX(e){let{record:t,disabled:n}=e;return t?(0,H.jsx)(`div`,{className:`flex h-5 w-5 shrink-0 items-center justify-end`,children:(0,H.jsx)(VX,{disabled:n})}):null}function VX(e){let{disabled:t}=e,n=T(t?`marketplaceDisabledStatus`:`marketplaceInstalledStatus`);return(0,H.jsx)(ti,{delayDuration:300,children:(0,H.jsxs)(oi,{children:[(0,H.jsx)(si,{asChild:!0,children:(0,H.jsx)(`span`,{"aria-label":n,className:c(`inline-flex h-5 w-5 items-center justify-center`,t?`text-gray-400`:`text-emerald-700`),children:t?(0,H.jsx)(ca,{className:`h-4 w-4 opacity-40`}):(0,H.jsx)(ca,{className:`h-4 w-4`})})}),(0,H.jsx)(Yr,{className:`text-xs`,children:n})]})})}function HX(e){let{item:t,record:n,installState:r,manageState:i,onOpen:a,onInstall:o,onManage:s}=e,{language:c}=Nn(),l=Ln(c),u=t?.name??n?.label??n?.id??n?.spec??T(`marketplaceUnknownItem`),d=En(t?.summaryI18n,t?.summary,l)||(n?T(`marketplaceInstalledLocalSummary`):``),f=t?.install.spec??n?.spec??``,p=t?.tags??[],m=n?.id||n?.spec,h=m?i.actionsByTarget.get(m):void 0,g=n?.type===`skill`&&n.source===`workspace`,_=n?.type===`skill`&&n.origin===`marketplace`,v=n?n.enabled===!1||n.runtimeStatus===`disabled`:!1,y=t?.install.spec,b=typeof y==`string`&&r.installingSpecs.has(y);return(0,H.jsxs)(`article`,{onClick:a,className:`group flex h-full min-h-[156px] cursor-pointer flex-col rounded-xl border border-gray-200/60 bg-white p-3.5 shadow-sm transition-colors hover:border-gray-300 hover:bg-gray-50/60`,children:[(0,H.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2.5`,children:[(0,H.jsx)(IX,{name:u,fallback:f||T(`marketplaceTypeSkill`),className:`h-9 w-9 rounded-lg text-xs`}),(0,H.jsx)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:(0,H.jsx)(RX,{title:u,spec:f})}),(0,H.jsx)(BX,{record:n,disabled:v})]}),(0,H.jsxs)(`div`,{className:`mt-2 flex min-w-0 flex-1 flex-col`,children:[(0,H.jsx)(`p`,{className:`line-clamp-2 text-left text-[12px] leading-relaxed text-gray-500`,children:d}),(0,H.jsxs)(`div`,{className:`mt-auto flex min-w-0 items-end justify-between gap-2 pt-2`,children:[(0,H.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,H.jsx)(UX,{tags:p})}),(0,H.jsx)(zX,{item:t,record:n,state:{isInstalling:b,canUpdate:_,canUninstall:g,busyAction:h},onInstall:o,onManage:s})]})]})]})}function UX({tags:e}){let t=e.filter(WX).slice(0,3);return t.length===0?null:(0,H.jsx)(`div`,{className:`flex min-w-0 flex-wrap gap-1.5 overflow-hidden`,children:t.map(e=>(0,H.jsx)(`span`,{className:`max-w-[104px] truncate rounded-md bg-gray-100 px-2 py-0.5 text-[11px] font-medium leading-5 text-gray-500`,children:e},e))})}function WX(e){let t=e.trim().toLowerCase();return t.length>0&&t!==`skill`}function GX({model:e,showTitle:t,operationState:n,scroll:r,actions:i}){let{scope:a,entries:o,header:s,status:l,emptyLabel:u,errorLabel:d}=e,{showSkeleton:f,isRefreshing:p,error:m}=l,{hasMore:h,loadingMore:g,sentinelRef:_}=r,{installState:v,manageState:y}=n,{onOpen:b,onInstall:x,onManage:S}=i;return(0,H.jsxs)(`section`,{className:c(`flex min-h-full flex-col`,t&&`gap-3`),children:[t&&(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,H.jsx)(`h3`,{className:`text-[14px] font-semibold text-gray-950`,children:s.title}),(0,H.jsxs)(`div`,{className:`flex items-center gap-2 text-[12px] text-gray-500`,children:[p&&(0,H.jsx)(`span`,{className:`font-medium text-primary`,children:s.refreshingLabel}),(0,H.jsx)(`span`,{children:s.summary})]})]}),m&&(0,H.jsxs)(`div`,{className:`rounded-xl border border-rose-200 bg-rose-50 p-4 text-sm text-rose-700`,children:[d,`: `,m.message]}),p&&(0,H.jsx)(`div`,{"data-testid":`marketplace-list-refreshing`,className:`h-0.5 overflow-hidden rounded-full bg-primary/10`,children:(0,H.jsx)(`div`,{className:`h-full w-1/3 animate-pulse rounded-full bg-primary`})}),(0,H.jsxs)(`div`,{"data-testid":f?`marketplace-list-skeleton`:void 0,className:c(`grid grid-cols-1 gap-2.5 md:grid-cols-2 xl:grid-cols-3`,f&&`min-h-0 flex-1 auto-rows-[156px] content-start`),children:[f&&(0,H.jsx)(Dn,{count:36}),!f&&!m&&o.map(e=>(0,H.jsx)(HX,{item:e.item,record:e.record,installState:v,manageState:y,onOpen:()=>b(e.item,e.record),onInstall:x,onManage:S},e.key))]}),!f&&!m&&o.length===0&&(0,H.jsx)(`div`,{className:`py-8 text-center text-[13px] text-gray-500`,children:u}),a===`all`&&!f&&!m&&(0,H.jsx)(Rn,{hasMore:h,loading:g,sentinelRef:_})]})}function KX(e){let{entry:t,language:n,localeFallbacks:r,installState:i,layout:a=`rail`,onOpen:o,onInstall:s}=e,{item:l,record:u}=t,d=En(l.summaryI18n,l.summary,r),f=l.install.spec,p=i.installingSpecs.has(f),m=!!u;return(0,H.jsxs)(`article`,{onClick:()=>o(t),className:c(`group flex min-h-[166px] cursor-pointer flex-col justify-between rounded-xl border border-gray-200/70 bg-white p-3 shadow-sm transition-colors hover:border-gray-300 hover:bg-gray-50/60`,a===`rail`?`w-[260px] shrink-0`:`w-full min-w-0`),children:[(0,H.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,H.jsxs)(`div`,{className:`mb-2.5 flex min-w-0 items-start gap-2.5`,children:[(0,H.jsx)(IX,{name:l.name,fallback:l.install.spec}),(0,H.jsxs)(`div`,{className:`min-w-0 flex-1 pt-0.5`,children:[(0,H.jsx)(`div`,{className:`truncate text-[13px] font-semibold leading-tight text-gray-950`,children:l.name}),(0,H.jsx)(`div`,{className:`mt-0.5 truncate text-[11px] font-mono leading-tight text-gray-400`,children:qX(l)})]})]}),(0,H.jsx)(`p`,{className:`line-clamp-2 text-[12px] leading-relaxed text-gray-500`,children:d}),(0,H.jsx)(JX,{tags:l.tags})]}),(0,H.jsxs)(`div`,{className:`mt-3 flex items-center justify-between gap-3 border-t border-gray-100 pt-2.5`,children:[(0,H.jsx)(`span`,{className:`min-w-0 truncate text-[11px] text-gray-400`,children:XX(l.updatedAt)}),m?(0,H.jsxs)(`span`,{className:`inline-flex h-7 items-center gap-1.5 text-[11px] font-semibold text-emerald-700`,children:[(0,H.jsx)(ca,{className:`h-3.5 w-3.5`}),ZX({zh:`已安装`,en:`Installed`},n)]}):(0,H.jsxs)(`button`,{type:`button`,disabled:p,onClick:e=>{e.stopPropagation(),s(l)},className:`inline-flex h-7 items-center gap-1.5 rounded-md border border-gray-200 bg-white px-2 text-[11px] font-semibold text-gray-700 transition-colors hover:border-gray-300 hover:bg-gray-50 disabled:opacity-50`,children:[(0,H.jsx)(Sa,{className:`h-3.5 w-3.5`}),T(p?`marketplaceInstalling`:`marketplaceInstall`)]})]})]})}function qX(e){return e.slug||e.install.spec}function JX({tags:e}){let t=e.filter(YX).slice(0,2);return t.length===0?null:(0,H.jsx)(`div`,{className:`mt-auto truncate pt-2 text-[11px] font-medium text-gray-400`,children:t.join(` / `)})}function YX(e){let t=e.trim().toLowerCase();return t.length>0&&t!==`skill`}function XX(e){return e.slice(0,10)||e}function ZX(e,t){return t.startsWith(`zh`)?e.zh:e.en}var QX=[{scene:`development-debugging`,title:{zh:`开发与调试`,en:`Development`},summary:{zh:`代码审查、错误定位、架构分析与交付验证。`,en:`Review, debug, analyze, and verify delivery work.`},icon:Uo,tone:`dark`,span:`md:col-span-2`},{scene:`office-collaboration`,title:{zh:`办公协作`,en:`Office Work`},summary:{zh:`连接文档、日历、会议、邮件和团队通信。`,en:`Connect docs, calendars, meetings, mail, and teams.`},icon:ea,tone:`green`,span:`md:col-span-2`},{scene:`writing-content`,title:{zh:`写作与内容`,en:`Writing`},summary:{zh:`把调研、写作、润色和发布组织成连续工作流。`,en:`Turn research, writing, polishing, and publishing into one flow.`},icon:Do,tone:`amber`,span:`md:col-span-2`},{scene:`browser-automation`,title:{zh:`浏览器自动化`,en:`Browser`},summary:{zh:`操作网页、捕获动态内容并验证真实用户路径。`,en:`Operate pages, capture dynamic content, and verify user paths.`},icon:Ca,tone:`blue`,span:`md:col-span-2`},{scene:`local-environment`,title:{zh:`本地环境`,en:`Local`},summary:{zh:`管理终端、文件、运行时和本地服务。`,en:`Manage shells, files, runtimes, and local services.`},icon:xa,tone:`violet`,span:`md:col-span-1`},{scene:`social-platforms`,title:{zh:`社交平台`,en:`Social`},summary:{zh:`处理发布、互动、检索和内容分发。`,en:`Handle posting, interaction, search, and distribution.`},icon:ho,tone:`sky`,span:`md:col-span-1`},{scene:`nextclaw-official`,title:{zh:`NextClaw 官方`,en:`NextClaw Official`},summary:{zh:`优先查看由 NextClaw 维护的原生能力。`,en:`Browse native capabilities maintained by NextClaw.`},icon:Ar,tone:`teal`,span:`md:col-span-2`}],$X={icon:Ar,tone:`dark`,span:`md:col-span-2`},eZ={dark:{card:`border-gray-200/80 bg-white text-gray-950`,icon:`border-stone-600 bg-stone-600 text-white`,title:`text-gray-950`,text:`text-gray-500`,meta:`text-gray-400`},blue:{card:`border-gray-200/80 bg-white text-gray-950`,icon:`border-cyan-600 bg-cyan-600 text-white`,title:`text-gray-950`,text:`text-gray-500`,meta:`text-gray-400`},green:{card:`border-gray-200/80 bg-white text-gray-950`,icon:`border-emerald-600 bg-emerald-600 text-white`,title:`text-gray-950`,text:`text-gray-500`,meta:`text-gray-400`},amber:{card:`border-gray-200/80 bg-white text-gray-950`,icon:`border-amber-600 bg-amber-600 text-white`,title:`text-gray-950`,text:`text-gray-500`,meta:`text-gray-400`},violet:{card:`border-gray-200/80 bg-white text-gray-950`,icon:`border-violet-500 bg-violet-500 text-white`,title:`text-gray-950`,text:`text-gray-500`,meta:`text-gray-400`},sky:{card:`border-gray-200/80 bg-white text-gray-950`,icon:`border-sky-500 bg-sky-500 text-white`,title:`text-gray-950`,text:`text-gray-500`,meta:`text-gray-400`},teal:{card:`border-gray-200/80 bg-white text-gray-950`,icon:`border-teal-600 bg-teal-600 text-white`,title:`text-gray-950`,text:`text-gray-500`,meta:`text-gray-400`}},tZ=`grid grid-cols-[repeat(auto-fill,minmax(240px,320px))] justify-start gap-3`;function nZ(e){let{recentEntries:t,scenes:n,isScenesLoading:r,isItemsLoading:i,language:a,installState:o,onOpen:s,onInstall:c,onOpenScene:l}=e,u=Ln(a);return(0,H.jsxs)(`div`,{className:`mb-4 space-y-5`,children:[(0,H.jsxs)(`section`,{className:`space-y-2.5`,children:[(0,H.jsx)(oZ,{icon:va,title:sZ({zh:`场景`,en:`Scenes`},a),description:sZ({zh:`按使用场景浏览适合的技能组合。`,en:`Browse skills by how you plan to use them.`},a)}),r?(0,H.jsx)(`div`,{"data-testid":`marketplace-scenes-skeleton`,className:`grid auto-rows-[104px] grid-cols-2 gap-2 md:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-5`,children:(0,H.jsx)(Dn,{count:QX.length})}):(0,H.jsx)(`div`,{className:`grid grid-cols-2 gap-2 md:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-5`,children:n.map(e=>(0,H.jsx)(rZ,{scene:e,language:a,onSelect:l},e.scene))})]}),(i||t.length>0)&&(0,H.jsx)(aZ,{icon:pa,title:sZ({zh:`最近更新`,en:`Recently updated`},a),description:sZ({zh:`看看生态最近在补齐哪些能力。`,en:`See what the ecosystem has been improving lately.`},a),entries:t,language:a,localeFallbacks:u,isLoading:i,installState:o,onOpen:s,onInstall:c})]})}function rZ(e){let{scene:t,language:n,onSelect:r}=e,i=cZ(t.scene),a=i.icon,o=eZ[i.tone];return(0,H.jsx)(`button`,{type:`button`,onClick:()=>r(t.scene),className:c(`group flex min-h-[74px] flex-col justify-center rounded-lg border px-3 py-2.5 text-left shadow-sm transition-colors hover:border-gray-300 hover:bg-gray-50/70`,o.card),children:(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,H.jsx)(`span`,{className:c(`flex h-7 w-7 shrink-0 items-center justify-center rounded-md border`,o.icon),children:(0,H.jsx)(a,{className:`h-3.5 w-3.5`})}),(0,H.jsx)(`div`,{className:`min-w-0 flex-1 truncate text-[13px] font-semibold text-gray-950`,children:lZ(t,i,n)}),typeof t.count==`number`&&(0,H.jsx)(`span`,{className:`shrink-0 text-[11px] font-medium text-gray-400`,children:dZ(t.count,n)})]}),(0,H.jsx)(`p`,{className:c(`mt-1 line-clamp-1 text-[11px] leading-relaxed`,o.text),children:uZ(t,i,n)})]})})}function iZ(e){let{scene:t,entries:n,isLoading:r,language:i,localeFallbacks:a,installState:o,onBack:s,onOpen:l,onInstall:u}=e,d=cZ(t.scene),f=d.icon,p=eZ[d.tone];return(0,H.jsxs)(`section`,{className:`flex min-h-full flex-col`,children:[(0,H.jsxs)(`div`,{className:`mb-4 flex min-w-0 items-start gap-2.5`,children:[(0,H.jsx)(`button`,{type:`button`,onClick:s,className:`inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-lg text-gray-600 transition-colors hover:bg-gray-100 hover:text-gray-900`,"aria-label":sZ({zh:`返回`,en:`Back`},i),children:(0,H.jsx)(di,{className:`h-4 w-4`})}),(0,H.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,H.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,H.jsx)(`span`,{className:c(`flex h-8 w-8 shrink-0 items-center justify-center rounded-lg border`,p.icon),children:(0,H.jsx)(f,{className:`h-4 w-4`})}),(0,H.jsx)(`h3`,{className:`min-w-0 flex-1 truncate text-[15px] font-semibold text-gray-950`,children:lZ(t,d,i)}),(0,H.jsx)(`span`,{className:`shrink-0 text-[11px] font-medium text-gray-400`,children:sZ(r?{zh:`加载中`,en:`Loading`}:{zh:`${n.length} 个技能`,en:`${n.length} skills`},i)})]}),(0,H.jsx)(`div`,{className:`mt-1.5 flex min-w-0 items-center gap-2`,children:(0,H.jsx)(`p`,{className:`min-w-0 flex-1 truncate text-[12px] leading-relaxed text-gray-500`,children:uZ(t,d,i)})})]})]}),r?(0,H.jsx)(`div`,{"data-testid":`marketplace-scene-skeleton`,className:c(tZ,`min-h-0 flex-1 auto-rows-[166px] content-start`),children:(0,H.jsx)(Dn,{count:24})}):n.length>0?(0,H.jsx)(`div`,{className:tZ,children:n.map(e=>(0,H.jsx)(KX,{entry:e,language:i,localeFallbacks:a,installState:o,layout:`grid`,onOpen:l,onInstall:u},e.item.id))}):(0,H.jsx)(`div`,{className:`rounded-lg border border-dashed border-gray-200 py-8 text-center text-[12px] text-gray-500`,children:sZ({zh:`这个模块暂无技能。`,en:`No skills in this module yet.`},i)})]})}function aZ(e){let{icon:t,title:n,description:r,entries:i,language:a,localeFallbacks:o,isLoading:s,installState:c,onOpen:l,onInstall:u}=e;return(0,H.jsxs)(`section`,{className:`space-y-2.5`,children:[(0,H.jsx)(oZ,{icon:t,title:n,description:r}),s?(0,H.jsx)(`div`,{"data-testid":`marketplace-recent-skeleton`,className:`-mx-1 grid auto-rows-[166px] grid-cols-[repeat(4,260px)] gap-2.5 overflow-hidden px-1 pb-1.5`,children:(0,H.jsx)(Dn,{count:4})}):(0,H.jsx)(`div`,{className:`-mx-1 flex gap-2.5 overflow-x-auto px-1 pb-1.5 custom-scrollbar`,children:i.map(e=>(0,H.jsx)(KX,{entry:e,language:a,localeFallbacks:o,installState:c,onOpen:l,onInstall:u},e.item.id))})]})}function oZ({icon:e,title:t,description:n}){return(0,H.jsx)(`div`,{className:`flex items-end justify-between gap-4`,children:(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(`h3`,{className:`flex items-center gap-2 text-[14px] font-semibold text-gray-950`,children:[(0,H.jsx)(e,{className:`h-4 w-4 text-primary`}),t]}),(0,H.jsx)(`p`,{className:`mt-0.5 text-[12px] leading-relaxed text-gray-500`,children:n})]})})}function sZ(e,t){return t.startsWith(`zh`)?e.zh:e.en}function cZ(e){return QX.find(t=>t.scene===e)??{scene:e,...$X}}function lZ(e,t,n){return t.title?sZ(t.title,n):e.title}function uZ(e,t,n){return t.summary?sZ(t.summary,n):e.description??e.scene}function dZ(e,t){return t.startsWith(`zh`)?`${e} 个技能`:`${e} skills`}var fZ=`https://skillhub.cn/`;function pZ(){return(0,H.jsx)(me,{href:fZ,external:!0,className:`h-7 shrink-0 px-1.5 text-[13px]`,children:T(`marketplaceExternalSkillSourceTitle`)})}function mZ(e){return(e??``).trim().toLowerCase()}function hZ(e,t){let n=mZ(t);return n.length>0?`${e}:${n}`:``}function gZ(e){let t=new Map;for(let n of e){let e=[n.install.spec,n.slug,n.id];for(let r of e){let e=hZ(n.type,r);!e||t.has(e)||t.set(e,n)}}return t}function _Z(e){let t=new Map;for(let n of e){let e=[n.spec,n.id,n.label];for(let r of e){let e=hZ(n.type,r);!e||t.has(e)||t.set(e,n)}}return t}function vZ(e,t){let n=[e.install.spec,e.slug,e.id];for(let r of n){let n=hZ(e.type,r);if(!n)continue;let i=t.get(n);if(i)return i}}function yZ(e,t){return t.get(hZ(e.type,e.spec))||t.get(hZ(e.type,e.id))||t.get(hZ(e.type,e.label))}function bZ(e,t,n,r){let i=mZ(n);if(!i)return!0;let a=En(t?.summaryI18n,t?.summary,r);return[e.id,e.spec,e.label,t?.name,t?.slug,t?.summary,a,...t?.tags??[]].map(e=>mZ(e)).filter(Boolean).some(e=>e.includes(i))}function xZ(e){let{items:t,recentItems:n,installedRecordLookup:r,scene:i,forcedType:a,typeFilter:o,scope:s,searchText:c,query:l,showListSkeleton:u,hasCatalogError:d}=e,f=AX(o===`skill`),p=(0,V.useMemo)(()=>f.data?.scenes??[],[f.data?.scenes]),m=jX(p,o===`skill`),h=(0,V.useMemo)(()=>p.map(e=>({...e,count:typeof e.count==`number`?e.count:m.get(e.scene)})),[m,p]),g=(0,V.useMemo)(()=>t.map(e=>({item:e,record:vZ(e,r)})),[t,r]),_=(0,V.useMemo)(()=>n.map(e=>({item:e,record:vZ(e,r)})),[r,n]),v=(0,V.useMemo)(()=>{let e=i?.trim();if(e)return h.find(t=>t.scene===e)??{scene:e,title:e}},[i,h]),y=o===`skill`&&!!i?.trim(),b=o===`skill`&&s===`all`&&!c.trim()&&!l&&!y,x=u||t.length>=4,S=b&&!d&&x&&h.length===0&&f.isLoading;return{entries:g,recentEntries:_,scenes:h,selectedScene:v,sceneEntries:g,isSceneRoute:y,isScenesLoading:S,showShelves:b&&!d&&x&&(u||h.length>0||S),backPath:a?`/skills`:`/marketplace/skills`,pathPrefix:a?`/skills/scenes`:`/marketplace/skills/scenes`}}function SZ(){let e=NX(),t=PX(),{confirm:n,ConfirmDialog:r}=An(),[i,a]=(0,V.useState)(new Set),[o,s]=(0,V.useState)(new Map);return{installState:{installingSpecs:i},manageState:{actionsByTarget:o},handleInstall:async t=>{let n=t.install.spec;if(!i.has(n)){a(e=>new Set(e).add(n));try{await e.mutateAsync({type:t.type,spec:n,kind:t.install.kind,skill:t.slug,installPath:`skills/${t.slug}`})}catch{}finally{a(e=>{let t=new Set(e);return t.delete(n),t})}}},handleManage:async(e,r)=>{let i=e===`update`?r.catalogSlug||r.id||r.spec:r.id||r.spec;if(!(!i||o.has(i))&&!(e===`uninstall`&&!await n({title:`${T(`marketplaceUninstallTitle`)} ${i}?`,description:T(`marketplaceUninstallDescription`),confirmLabel:T(`marketplaceUninstall`),variant:`destructive`}))){s(t=>new Map(t).set(i,e));try{let a={type:r.type,action:e,id:i,spec:r.spec};try{await t.mutateAsync(a)}catch(r){if(e!==`update`||!EX(r)||!await n({title:T(`marketplaceUpdateConflictTitle`),description:T(`marketplaceUpdateConflictDescription`),confirmLabel:T(`marketplaceUpdateConflictConfirm`),variant:`destructive`}))return;await t.mutateAsync({...a,force:!0})}}finally{s(e=>{let t=new Map(e);return t.delete(i),t})}}},ConfirmDialog:r}}function CZ(e){let t=ki(),n=(0,V.useRef)({byKey:new Map,seq:0});return{openItemDetail:async(r,i)=>{let a=r?.name??i?.label??i?.id??i?.spec??T(`marketplaceUnknownItem`),o=jn(r?`skill`:`skill-local`,r?.slug??i?.id??i?.spec??a),s=r?`marketplace:${r.type}:${r.slug}`:`marketplace:${i?.type??`unknown`}:${i?.id??i?.spec??a}`,c=T(`marketplaceTypeSkill`);if(!r){Tn(t,{id:o,title:a,typeLabel:c,spec:i?.spec??`-`,status:`ready`,summary:T(`marketplaceInstalledLocalSummary`),metadataRaw:JSON.stringify(i??{},null,2),contentRaw:`-`});return}let l=n.current.seq+1;n.current.seq=l,n.current.byKey.set(s,l);let u=En(r.summaryI18n,r.summary,e);Tn(t,{id:o,title:a,typeLabel:c,spec:r.install.spec,status:`loading`,summary:u,tags:r.tags,author:r.author});try{let e=await ke(r.slug);if(n.current.byKey.get(s)!==l)return;Tn(t,{id:o,title:a,typeLabel:c,spec:r.install.spec,status:`ready`,summary:u,metadataRaw:e.metadataRaw,contentRaw:e.bodyRaw||e.raw,sourceUrl:e.sourceUrl,sourceLabel:`Source (${e.source})`,tags:r.tags,author:r.author},{activate:!1})}catch(e){if(n.current.byKey.get(s)!==l)return;Tn(t,{id:o,title:a,typeLabel:c,spec:r.install.spec,status:`error`,summary:u,metadataRaw:JSON.stringify({error:e instanceof Error?e.message:String(e)},null,2),contentRaw:T(`marketplaceOperationFailed`)},{activate:!1})}}}}function wZ(e){let{scope:t,typeFilter:n,query:r,localeFallbacks:i,catalogView:a,installedView:o,isCatalogLoading:s,isCatalogFetching:c,isCatalogFetchingNextPage:l,catalogError:u,isInstalledLoading:d,installedError:f}=e,p=(0,V.useMemo)(()=>o?.records??[],[o?.records]),m=(0,V.useMemo)(()=>a?.items??[],[a?.items]),h=(0,V.useMemo)(()=>gZ(m),[m]),g=(0,V.useMemo)(()=>_Z(p),[p]),_=(0,V.useMemo)(()=>p.filter(e=>e.type===n).map(e=>({key:`${e.type}:${e.spec}:${e.id??``}`,record:e,item:yZ(e,h)})).filter(e=>bZ(e.record,e.item,r,i)).sort((e,t)=>TZ(e.record,t.record)),[p,n,h,r,i]),v=(0,V.useMemo)(()=>t===`installed`?_:m.map(e=>({key:e.id,item:e,record:vZ(e,g)})),[m,_,g,t]),y=t===`all`&&s&&!a||t===`installed`&&d&&!o,b=t===`all`&&!y&&!!a&&c&&!l,x=t===`installed`?d&&!o?T(`loading`):`${_.length} ${T(`marketplaceInstalledSkillsCountSuffix`)}`:a?`${a.total} ${T(`marketplaceSkillsCountSuffix`)}`:T(`loading`),S=t===`all`&&u?u:t===`installed`&&f?f:void 0,C={scope:t,entries:v,header:{title:T(t===`installed`?`marketplaceSectionInstalledSkills`:`marketplaceAllSkills`),summary:x,refreshingLabel:T(`marketplaceRefreshingResults`)},status:{showSkeleton:y,isRefreshing:b,error:S},emptyLabel:T(t===`installed`?`marketplaceNoInstalledSkills`:`marketplaceNoSkills`),errorLabel:T(t===`installed`?`marketplaceErrorLoadingInstalledSkills`:`marketplaceErrorLoadingSkillsData`)};return{allItems:m,installedRecordLookup:g,installedTotal:o?.total??0,itemListView:C,showListSkeleton:y,isRefreshingList:b}}function TZ(e,t){let n=Date.parse(e.installedAt??``),r=Date.parse(t.installedAt??``);return Number.isNaN(n)||Number.isNaN(r)||n===r?e.spec.localeCompare(t.spec):r-n}var EZ=20;function DZ({forcedType:e}={}){let t=oe(),n=se(),{language:r}=Nn(),i=`skill`,a=(0,V.useMemo)(()=>Ln(r),[r]),[o,s]=(0,V.useState)(``),[c,l]=(0,V.useState)(``),[u,d]=(0,V.useState)(`all`),[f,p]=(0,V.useState)(`relevance`),{installState:m,manageState:h,handleInstall:g,handleManage:_,ConfirmDialog:v}=SZ(),{openItemDetail:y}=CZ(a);(0,V.useEffect)(()=>{let e=setTimeout(()=>{l(o.trim())},250);return()=>clearTimeout(e)},[o]);let b=MX(i),x=i===`skill`?n.scene?.trim():void 0,S=DX({q:x?void 0:c||void 0,scene:x,type:i,sort:f,pageSize:EZ}),C=OX(i,u===`all`&&!o.trim()&&!c&&!x),{containerRef:w,sentinelRef:E}=eee({disabled:u!==`all`||S.isError||!S.hasNextPage||S.isFetchingNextPage,onLoadMore:()=>S.fetchNextPage(),watchValue:`${i}:${u}:${c}:${x??``}:${f}:${S.data?.loadedItems??0}:${S.data?.loadedPages??0}`});(0,V.useEffect)(()=>{let e=w.current;e&&typeof e.scrollTo==`function`&&e.scrollTo({top:0})},[w,c,x,u,f,i]);let D=wZ({scope:u,typeFilter:i,query:c,localeFallbacks:a,catalogView:S.data,installedView:b.data,isCatalogLoading:S.isLoading,isCatalogFetching:S.isFetching,isCatalogFetchingNextPage:S.isFetchingNextPage,catalogError:S.isError?S.error:void 0,isInstalledLoading:b.isLoading,installedError:b.isError?b.error:void 0}),O=xZ({items:D.allItems,recentItems:C.data?.items??[],installedRecordLookup:D.installedRecordLookup,scene:x,forcedType:e,typeFilter:i,scope:u,searchText:o,query:c,showListSkeleton:D.showListSkeleton,hasCatalogError:S.isError});return(0,H.jsxs)(bt,{className:`flex h-full min-h-0 flex-col pb-0`,children:[!O.isSceneRoute&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:`mb-3 flex items-start justify-between gap-3 border-b border-gray-200/60`,children:[(0,H.jsx)(jY,{value:u,onValueChange:e=>d(e),children:(0,H.jsxs)(MY,{className:`mb-0 h-auto flex-1 justify-start gap-6 rounded-none border-b-0 bg-transparent p-0 text-gray-500`,children:[(0,H.jsx)(NY,{value:`all`,className:`rounded-none border-b-2 border-transparent bg-transparent px-0 pb-3 pt-0 shadow-none hover:bg-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent data-[state=active]:text-gray-950 data-[state=active]:shadow-none`,children:T(`marketplaceTabMarketplaceSkills`)}),(0,H.jsxs)(NY,{value:`installed`,className:`gap-1.5 rounded-none border-b-2 border-transparent bg-transparent px-0 pb-3 pt-0 shadow-none hover:bg-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent data-[state=active]:text-gray-950 data-[state=active]:shadow-none`,children:[T(`marketplaceTabInstalledSkills`),(0,H.jsx)(`span`,{className:`text-[11px] font-medium text-gray-500`,children:D.installedTotal})]})]})}),(0,H.jsx)(pZ,{})]}),(0,H.jsx)(Mn,{scope:u,searchText:o,isRefreshing:D.isRefreshingList,searchPlaceholder:T(`marketplaceSearchPlaceholderSkills`),sort:f,onSearchTextChange:s,onSortChange:p})]}),(0,H.jsx)(`section`,{className:`flex min-h-0 flex-1 flex-col`,children:(0,H.jsxs)(`div`,{ref:w,className:`min-h-0 flex-1 overflow-y-auto custom-scrollbar pr-1`,"aria-busy":D.showListSkeleton||S.isFetchingNextPage,children:[O.isSceneRoute&&O.selectedScene&&(0,H.jsx)(iZ,{scene:O.selectedScene,entries:O.sceneEntries,isLoading:D.showListSkeleton,language:r,localeFallbacks:a,installState:m,onBack:()=>t(O.backPath),onOpen:e=>void y(e.item,e.record),onInstall:g}),O.isSceneRoute&&!D.showListSkeleton&&(0,H.jsx)(Rn,{hasMore:!!S.hasNextPage,loading:S.isFetchingNextPage,sentinelRef:E}),O.showShelves&&(0,H.jsx)(nZ,{recentEntries:O.recentEntries,scenes:O.scenes,isScenesLoading:O.isScenesLoading,isItemsLoading:D.showListSkeleton||C.isLoading,language:r,installState:m,onOpen:e=>void y(e.item,e.record),onInstall:g,onOpenScene:e=>t(`${O.pathPrefix}/${e}`)}),!O.isSceneRoute&&(0,H.jsx)(GX,{model:D.itemListView,showTitle:O.showShelves||!D.showListSkeleton,operationState:{installState:m,manageState:h},scroll:{hasMore:!!S.hasNextPage,loadingMore:S.isFetchingNextPage,sentinelRef:E},actions:{onOpen:(e,t)=>void y(e,t),onInstall:g,onManage:_}})]})}),(0,H.jsx)(v,{})]})}function OZ({error:e,filter:t,installedById:n,isError:r,isFetchingNextPage:i,isLoading:a,isStarting:o,items:s,localeFallbacks:c,onFilterChange:l,onInstall:u,onLoadMore:d,onSearchChange:f,onSelect:p,onUpdate:m,operations:h,hasNextPage:g,search:_,startingSource:v}){return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(kZ,{filter:t,onFilterChange:l,onSearchChange:f,search:_}),(0,H.jsxs)(`div`,{className:`custom-scrollbar min-h-0 flex-1 overflow-y-auto bg-background px-4 py-4 sm:px-6 sm:py-5`,children:[e?(0,H.jsx)(`div`,{role:`alert`,className:`mb-2 rounded-xl bg-destructive/8 px-3 py-2.5 text-xs leading-5 text-destructive ring-1 ring-destructive/15`,children:e.message||T(`appPackagesActionFailed`)}):null,(0,H.jsx)(AZ,{installedById:n,isError:r,isFetchingNextPage:i,isLoading:a,isStarting:o,items:s,localeFallbacks:c,onInstall:u,onLoadMore:d,onSelect:p,onUpdate:m,operations:h,hasNextPage:g,startingSource:v})]})]})}function kZ({filter:e,onFilterChange:t,onSearchChange:n,search:r}){let i=[{value:`all`,label:T(`appPackagesFilterAll`)},{value:`featured`,label:T(`appPackagesMarketplaceFeatured`)},{value:`personal`,label:T(`appPackagesFilterPersonal`)},{value:`local`,label:T(`appPackagesFilterLocal`)}];return(0,H.jsxs)(`div`,{className:`shrink-0 border-b border-border/60 bg-card px-5 pb-3.5 pt-[max(1.25rem,env(safe-area-inset-top))] sm:px-6 sm:pt-5`,children:[(0,H.jsxs)(zr,{className:`pr-8`,children:[(0,H.jsx)(Hr,{className:`text-xl`,children:T(`appPackagesMarketplaceTitle`)}),(0,H.jsx)(Fr,{className:`max-w-xl leading-5`,children:T(`appPackagesMarketplaceDescription`)})]}),(0,H.jsxs)(`div`,{className:`relative mt-4`,children:[(0,H.jsx)(fi,{className:`pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground`}),(0,H.jsx)(Gt,{autoFocus:!0,className:`h-10 rounded-xl border-transparent bg-muted/65 pl-9 shadow-none focus-visible:ring-1`,value:r,onChange:e=>n(e.target.value),placeholder:T(`appPackagesMarketplaceSearch`),"aria-label":T(`appPackagesMarketplaceSearch`)})]}),(0,H.jsx)(`div`,{className:`mt-3 flex gap-1 overflow-x-auto`,"aria-label":T(`appPackagesFilterLabel`),children:i.map(n=>(0,H.jsx)(`button`,{type:`button`,onClick:()=>t(n.value),className:c(`shrink-0 rounded-full px-3 py-1.5 text-xs font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,e===n.value?`bg-foreground text-background`:`text-muted-foreground hover:bg-[var(--interaction-hover)] hover:text-foreground`),children:n.label},n.value))})]})}function AZ({installedById:e,isError:t,isFetchingNextPage:n,isLoading:r,isStarting:i,items:a,localeFallbacks:o,onInstall:s,onLoadMore:c,onSelect:l,onUpdate:u,operations:d,hasNextPage:f,startingSource:p}){return r?(0,H.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2 min-[820px]:grid-cols-3`,"aria-label":T(`appPackagesMarketplaceLoading`),children:[(0,H.jsx)(xi,{className:`aspect-[16/9] w-full rounded-2xl`}),(0,H.jsx)(xi,{className:`aspect-[16/9] w-full rounded-2xl`}),(0,H.jsx)(xi,{className:`hidden aspect-[16/9] w-full rounded-2xl min-[820px]:block`})]}):t?(0,H.jsx)(`div`,{role:`alert`,className:`rounded-xl border border-destructive/20 bg-destructive/5 px-4 py-5 text-sm text-destructive`,children:T(`appPackagesMarketplaceFailed`)}):a.length===0?(0,H.jsxs)(`div`,{className:`flex flex-col items-center px-6 py-14 text-center`,children:[(0,H.jsx)(`span`,{className:`flex h-11 w-11 items-center justify-center rounded-2xl bg-muted`,children:(0,H.jsx)(fi,{className:`h-5 w-5 text-muted-foreground`})}),(0,H.jsx)(`p`,{className:`mt-3 text-sm font-medium text-foreground`,children:T(`appPackagesMarketplaceEmpty`)}),(0,H.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:T(`appPackagesMarketplaceEmptyHint`)})]}):(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 min-[820px]:grid-cols-3`,children:a.map(t=>(0,H.jsx)(jZ,{installedPackage:e.get(t.appId),isStarting:i&&p===t.install.spec,item:t,localeFallbacks:o,onInstall:s,onSelect:l,onUpdate:u,operation:ZY(d,t.appId,t.install.spec)},t.id))}),f?(0,H.jsx)(`div`,{className:`flex justify-center pt-5`,children:(0,H.jsx)(`button`,{type:`button`,disabled:n,onClick:c,className:`rounded-full border border-border bg-card px-4 py-2 text-xs font-medium text-foreground transition hover:bg-[var(--interaction-hover)] disabled:cursor-wait disabled:opacity-60`,children:T(n?`appPackagesMarketplaceLoadingMore`:`appPackagesMarketplaceLoadMore`)})}):null]})}function jZ({installedPackage:e,isStarting:t,item:n,localeFallbacks:r,onInstall:i,onSelect:a,onUpdate:o,operation:s}){let c=e?MZ(e.name,e.nameI18n):n.name,l=En(n.summaryI18n,n.summary,r),u=s?mX(s.status):!1,d=s?.status===`failed`||s?.status===`interrupted`,f=!!(e&&e.activeVersion!==n.latestVersion);return(0,H.jsxs)(`article`,{className:`group relative overflow-hidden rounded-2xl border border-border/60 bg-card shadow-sm transition duration-200 hover:-translate-y-0.5 hover:border-border hover:shadow-lg`,children:[(0,H.jsx)(`button`,{type:`button`,onClick:()=>a(n.slug),className:`block w-full text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring`,children:(0,H.jsx)(qY,{accentColor:n.accentColor,coverPreview:n.coverPreview,coverUrl:n.coverUrl,name:c,className:`aspect-[16/9] rounded-none ring-0`})}),(0,H.jsxs)(`div`,{className:`p-3.5`,children:[(0,H.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,H.jsx)(WY,{icon:n.iconUrl??e?.icon,name:c,className:`h-11 w-11 rounded-[13px]`}),(0,H.jsxs)(`button`,{type:`button`,onClick:()=>a(n.slug),className:`min-w-0 flex-1 rounded-lg text-left focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,children:[(0,H.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,H.jsx)(`span`,{className:`truncate text-sm font-semibold text-foreground`,children:c}),n.featured?(0,H.jsx)(Ar,{className:`h-3.5 w-3.5 shrink-0 text-amber-500`,"aria-label":T(`appPackagesMarketplaceFeatured`)}):null]}),(0,H.jsx)(`span`,{className:`mt-1 line-clamp-2 block min-h-10 text-xs leading-5 text-muted-foreground`,children:l}),(0,H.jsxs)(`span`,{className:`mt-2 flex items-center gap-1.5 text-[11px] text-muted-foreground/75`,children:[(0,H.jsx)(`span`,{children:n.publisher.name}),(0,H.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,H.jsxs)(`span`,{children:[`v`,n.latestVersion]}),(0,H.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,H.jsx)(`span`,{children:vX(n.availability,T(`appPackagesAllPlatforms`))}),(0,H.jsx)(oa,{className:`ml-0.5 h-3 w-3 opacity-0 transition-opacity group-hover:opacity-60`})]})]})]}),(0,H.jsx)(`div`,{className:`mt-3 flex items-center justify-end border-t border-border/50 pt-3`,children:(0,H.jsx)(YY,{active:u,canUpdate:f,failed:d,installed:!!e,isStarting:t,onAction:()=>f?o(n.appId):i(n.install.spec,n.install.registry),operation:s})})]}),s&&(u||d)?(0,H.jsx)(`div`,{className:`px-4 pb-4`,children:(0,H.jsx)(XY,{operation:s})}):null]})}function MZ(e,t){let n=A()===`zh`?`zh-CN`:`en-US`;return t?.[n]??e??``}function NZ({detail:e,error:t,installedPackage:n,isLoading:r,isStarting:i,localeFallbacks:a,onInstall:o,onUpdate:s,operation:c}){if(r)return(0,H.jsxs)(`div`,{className:`space-y-4 p-6`,children:[(0,H.jsx)(xi,{className:`h-24 w-full rounded-2xl`}),(0,H.jsx)(xi,{className:`h-40 w-full rounded-2xl`})]});if(t||!e)return(0,H.jsx)(`div`,{role:`alert`,className:`m-6 rounded-xl border border-destructive/20 bg-destructive/5 px-4 py-5 text-sm text-destructive`,children:t?.message??T(`appPackagesMarketplaceFailed`)});let l=En(e.summaryI18n,e.summary,a),u=En(e.descriptionI18n,e.description??l,a),d=c?mX(c.status):!1,f=c?.status===`failed`||c?.status===`interrupted`,p=e.manifest.components??[],m=p.filter(e=>e.kind===`panel`).length,h=p.filter(e=>e.kind===`service`).length,g=e.manifest.runtime?.profile??(h>0?`native-process`:`panel-only`),_=!!(n&&n.activeVersion!==e.latestVersion);return(0,H.jsxs)(`div`,{className:`mx-auto w-full max-w-3xl px-5 py-5 sm:px-7 sm:py-6`,children:[(0,H.jsxs)(`div`,{className:`grid items-stretch gap-5 sm:grid-cols-[minmax(0,1.18fr)_minmax(240px,0.82fr)]`,children:[(0,H.jsx)(qY,{accentColor:e.accentColor,coverPreview:e.coverPreview,coverUrl:e.coverUrl,name:e.name,className:`aspect-[16/9] rounded-2xl`}),(0,H.jsxs)(`div`,{className:`flex min-w-0 flex-col rounded-2xl border border-border/60 bg-card p-4`,children:[(0,H.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,H.jsx)(WY,{icon:e.iconUrl??n?.icon,name:e.name,className:`h-14 w-14 rounded-2xl`}),(0,H.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,H.jsx)(`h2`,{className:`text-lg font-semibold tracking-tight text-foreground`,children:e.name}),(0,H.jsxs)(`div`,{className:`mt-1.5 flex flex-wrap items-center gap-2 text-[11px] text-muted-foreground`,children:[(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,H.jsx)(Lo,{className:`h-3.5 w-3.5`}),e.publisher.name]}),(0,H.jsxs)(`span`,{children:[`v`,e.latestVersion]})]})]})]}),(0,H.jsx)(`p`,{className:`mt-3 text-sm leading-6 text-muted-foreground`,children:l}),(0,H.jsx)(`div`,{className:`mt-auto pt-4`,children:(0,H.jsx)(YY,{active:d,canUpdate:_,failed:f,installed:!!n,isStarting:i,onAction:()=>_?s(e.appId):o(e.install.spec,e.install.registry),operation:c})})]})]}),c&&(d||f)?(0,H.jsx)(XY,{operation:c}):null,(0,H.jsxs)(`section`,{className:`mt-7`,children:[(0,H.jsx)(`h3`,{className:`text-sm font-semibold text-foreground`,children:T(`appPackagesAboutApp`)}),(0,H.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-muted-foreground`,children:u})]}),(0,H.jsxs)(`div`,{className:`mt-6 grid gap-3 sm:grid-cols-2`,children:[(0,H.jsx)(PZ,{icon:vo,label:T(`appPackagesPlatformsLabel`),value:vX(e.availability,T(`appPackagesAllPlatforms`))}),(0,H.jsx)(PZ,{icon:wn,label:T(`appPackagesPanelsAdded`),value:m>0?String(m):T(`appPackagesNone`)}),(0,H.jsx)(PZ,{icon:Po,label:T(`appPackagesServicesAdded`),value:h>0?String(h):T(`appPackagesNone`)}),e.manifest.engines?.nextclaw?(0,H.jsx)(PZ,{icon:Lo,label:T(`appPackagesNextClawRequirement`),value:e.manifest.engines.nextclaw}):null,(0,H.jsx)(PZ,{icon:g===`native-process`?Io:Lo,label:T(`appPackagesIsolationLabel`),value:T(g===`native-process`?`appPackagesIsolationFullUser`:g===`wasi`?`appPackagesIsolationMediated`:`appPackagesIsolationPanel`)})]}),(0,H.jsxs)(`section`,{className:`mt-7 border-t border-border/60 pt-6`,children:[(0,H.jsx)(`h3`,{className:`text-sm font-semibold text-foreground`,children:T(`appPackagesAccessTitle`)}),(0,H.jsx)(`div`,{className:`mt-3 space-y-2`,children:FZ(e).map(e=>(0,H.jsxs)(`div`,{className:`flex items-start gap-2.5 rounded-xl bg-muted/45 px-3 py-2.5 text-xs leading-5 text-muted-foreground`,children:[(0,H.jsx)(Lo,{className:`mt-0.5 h-3.5 w-3.5 shrink-0`}),(0,H.jsx)(`span`,{children:e})]},e))})]}),(0,H.jsxs)(`a`,{href:e.webUrl,target:`_blank`,rel:`noreferrer`,className:`mt-6 inline-flex items-center gap-1.5 text-xs font-medium text-muted-foreground underline-offset-4 hover:text-foreground hover:underline focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,children:[T(`appPackagesOpenPublicDetails`),(0,H.jsx)(ue,{className:`h-3.5 w-3.5`})]})]})}function PZ({icon:e,label:t,value:n}){return(0,H.jsxs)(`div`,{className:`flex items-center gap-3 rounded-xl border border-border/60 px-3 py-3`,children:[(0,H.jsx)(`span`,{className:`flex h-8 w-8 items-center justify-center rounded-lg bg-muted text-muted-foreground`,children:(0,H.jsx)(e,{className:`h-4 w-4`})}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:t}),(0,H.jsx)(`p`,{className:`text-sm font-medium text-foreground`,children:n})]})]})}function FZ(e){let t=[],n=e.permissions.documentAccess??[];n.length>0&&t.push(T(`appPackagesDocumentAccess`).replace(`{count}`,String(n.length)));let r=e.permissions.allowedDomains??[];return r.length>0&&t.push(T(`appPackagesNetworkAccess`).replace(`{count}`,String(r.length))),e.permissions.capabilities?.hostBridge&&t.push(T(`appPackagesHostBridgeAccess`)),e.permissions.capabilities?.nativeProcess&&t.push(T(`appPackagesNativeProcessAccess`)),(e.permissions.storage===!0||typeof e.permissions.storage==`object`&&e.permissions.storage?.namespace)&&t.push(T(`appPackagesLocalStorageAccess`)),t.length>0?t:[T(`appPackagesNoExtraAccess`)]}var IZ=`https://apps-registry.nextclaw.io`,LZ=new Set([404,405,501]),RZ=(void 0)?.replace(/\/$/,``),zZ=void 0,BZ=new Set([`hello-notes`,`personal-organizer`,`starter-card`,`workspace-glance`]);async function VZ(e={},t){let n=await WZ(e,t);return LZ.has(n.status)?await KZ(e,t):await GZ(n)}async function HZ(e,t){let n=await fetch(`${IZ}/api/v1/apps/items/${encodeURIComponent(e)}`,{headers:{accept:`application/json`},signal:t});if(!n.ok)throw Error(`Marketplace detail request failed (${n.status})`);let r=await n.json();if(!ZZ(r)||r.ok!==!0||!ZZ(r.data))throw Error(`Marketplace returned an invalid app detail`);let{data:i}=r,a=i;if(!JZ(i)||!ZZ(a.manifest)||!ZZ(a.permissions))throw Error(`Marketplace returned an invalid app detail`);let{manifest:o,permissions:s}=a,c=Array.isArray(o.components)?o.components.filter(e=>ZZ(e)&&(e.kind===`panel`||e.kind===`service`)&&typeof e.path==`string`):void 0;return{...UZ(i),description:typeof a.description==`string`?a.description:void 0,descriptionI18n:XZ(a.descriptionI18n)?a.descriptionI18n:void 0,manifest:{schemaVersion:o.schemaVersion===2?2:1,icon:typeof o.icon==`string`?o.icon:void 0,engines:ZZ(o.engines)&&typeof o.engines.nextclaw==`string`?{nextclaw:o.engines.nextclaw}:void 0,components:c},permissions:s}}function UZ(e){if(e.coverUrl)return e;let t=qZ(e.slug);return e.publisher.id!==`nextclaw`||!t?e:{...e,coverUrl:t,coverPreview:!0}}async function WZ(e,t){let{cursor:n,featured:r,limit:i,publisher:a,q:o,sort:s,tag:c,tags:l}=e,u=new URLSearchParams;return o&&u.set(`q`,o),c&&u.set(`tag`,c),l?.length&&u.set(`tags`,l.join(`,`)),a&&u.set(`publisher`,a),r!==void 0&&u.set(`featured`,String(r)),s&&u.set(`sort`,s),n&&u.set(`cursor`,n),u.set(`limit`,String(i??24)),await fetch(`${IZ}/api/v2/apps/items?${u}`,{headers:{accept:`application/json`},signal:t})}async function GZ(e){if(!e.ok)throw Error(`Marketplace request failed (${e.status})`);let t=await e.json();if(!ZZ(t)||t.ok!==!0||!ZZ(t.data))throw Error(`Marketplace returned an invalid response`);return{items:(Array.isArray(t.data.items)?t.data.items.filter(JZ):[]).map(UZ),nextCursor:typeof t.data.nextCursor==`string`?t.data.nextCursor:void 0,hasMore:t.data.hasMore===!0,query:typeof t.data.query==`string`?t.data.query:void 0,tag:typeof t.data.tag==`string`?t.data.tag:void 0,featured:typeof t.data.featured==`boolean`?t.data.featured:void 0,sort:t.data.sort===`updated`||t.data.sort===`featured`?t.data.sort:`relevance`}}async function KZ(e,t){let{featured:n,publisher:r,q:i,sort:a,tag:o,tags:s}=e,c=new URLSearchParams({page:`1`,pageSize:`100`});i&&c.set(`q`,i),o&&c.set(`tag`,o);let l=await fetch(`${IZ}/api/v1/apps/items?${c}`,{headers:{accept:`application/json`},signal:t});if(!l.ok)throw Error(`Marketplace compatibility request failed (${l.status})`);let u=await l.json();if(!ZZ(u)||u.ok!==!0||!ZZ(u.data))throw Error(`Marketplace returned an invalid compatibility response`);let d=Array.isArray(u.data.items)?u.data.items.filter(JZ):[],f=new Set(s??[]);return{items:d.filter(e=>!r||e.publisher.id===r).filter(e=>n===void 0||e.featured===n).filter(e=>f.size===0||e.tags.some(e=>f.has(e))).map(UZ),hasMore:!1,query:i,tag:o,tags:s,featured:n,sort:a??(i?`relevance`:`featured`)}}function qZ(e){let t=RZ??zZ;if(t&&BZ.has(e))return`${t}/${encodeURIComponent(e)}.webp`}function JZ(e){return!ZZ(e)||!ZZ(e.install)||!ZZ(e.publisher)?!1:typeof e.id==`string`&&typeof e.slug==`string`&&typeof e.appId==`string`&&typeof e.name==`string`&&(e.iconUrl===void 0||typeof e.iconUrl==`string`)&&(e.coverUrl===void 0||typeof e.coverUrl==`string`)&&(e.coverPreview===void 0||typeof e.coverPreview==`boolean`)&&(e.accentColor===void 0||typeof e.accentColor==`string`)&&typeof e.summary==`string`&&XZ(e.summaryI18n)&&Array.isArray(e.tags)&&e.tags.every(e=>typeof e==`string`)&&typeof e.latestVersion==`string`&&typeof e.featured==`boolean`&&(e.availability===void 0||YZ(e.availability))&&typeof e.publisher.id==`string`&&typeof e.publisher.name==`string`&&e.install.kind===`registry`&&typeof e.install.spec==`string`&&typeof e.install.registry==`string`&&typeof e.webUrl==`string`}function YZ(e){return!ZZ(e)||e.mode!==`universal`&&e.mode!==`targeted`?!1:Array.isArray(e.targets)&&e.targets.every(e=>typeof e==`string`)&&Array.isArray(e.operatingSystems)&&e.operatingSystems.every(e=>e===`darwin`||e===`linux`||e===`win32`)}function XZ(e){return ZZ(e)&&Object.values(e).every(e=>typeof e==`string`)}function ZZ(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var QZ=[`app-marketplace`,`v3`];function $Z(e,t){let n=zn({queryKey:[...QZ,e],initialPageParam:void 0,queryFn:async({pageParam:t,signal:n})=>await VZ({...e,cursor:t,limit:24},n),getNextPageParam:e=>e.nextCursor,enabled:t,retry:1,staleTime:300*1e3}),r=(0,V.useMemo)(()=>{if(!n.data)return;let e=new Map;for(let t of n.data.pages)for(let n of t.items)e.set(n.id,n);return{items:[...e.values()],hasMore:n.data.pages.at(-1)?.hasMore??!1}},[n.data]);return{...n,data:r}}function eQ(e,t){return dn({queryKey:[`app-marketplace-detail`,`v2`,e],queryFn:async({signal:t})=>await HZ(e??``,t),enabled:t&&!!e,retry:1,staleTime:300*1e3})}var tQ=new Set([`nextclaw.starter-card`,`nextclaw.validation-task-board`]);function nQ({error:e,installedPackages:t,isStarting:n,onInstall:r,onOpenChange:i,onUpdate:a,open:o,operations:s,startingSource:c}){let[l,u]=(0,V.useState)(`all`),[d,f]=(0,V.useState)(``),[p,m]=(0,V.useState)(``),[h,g]=(0,V.useState)(null);(0,V.useEffect)(()=>{let e=window.setTimeout(()=>m(d.trim()),250);return()=>window.clearTimeout(e)},[d]);let _=$Z((0,V.useMemo)(()=>({q:p||void 0,featured:l===`featured`?!0:void 0,tags:l===`personal`?[`personal`,`productivity`,`notes`,`calendar`]:void 0,tag:l===`local`?`local`:void 0,sort:p?`relevance`:`featured`}),[p,l]),o),v=eQ(h,o),y=(0,V.useMemo)(()=>new Map(t.map(e=>[e.id,e])),[t]),b=Ln(A()===`zh`?`zh-CN`:`en-US`),x=(0,V.useMemo)(()=>(_.data?.items??[]).filter(e=>!tQ.has(e.appId)),[_.data?.items]);return(0,H.jsx)(Rr,{open:o,onOpenChange:e=>{e||g(null),i(e)},children:(0,H.jsxs)(Vr,{className:`flex h-dvh w-screen max-w-none flex-col gap-0 overflow-hidden rounded-none border-0 bg-background/95 p-0 shadow-[0_32px_100px_rgba(0,0,0,0.24)] backdrop-blur-xl [&>button.absolute]:top-[max(1rem,env(safe-area-inset-top))] sm:h-[min(680px,calc(100dvh-4rem))] sm:w-[min(920px,calc(100vw-3rem))] sm:max-w-none sm:rounded-2xl sm:border sm:border-border/55`,children:[h?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(rQ,{onBack:()=>g(null)}),(0,H.jsx)(`div`,{className:`custom-scrollbar min-h-0 flex-1 overflow-y-auto bg-background`,children:(0,H.jsx)(NZ,{detail:v.data,error:v.error instanceof Error?v.error:null,installedPackage:v.data?y.get(v.data.appId):void 0,isLoading:v.isLoading,isStarting:n&&v.data?.install.spec===c,localeFallbacks:b,onInstall:r,onUpdate:a,operation:v.data?ZY(s,v.data.appId,v.data.install.spec):void 0})})]}):(0,H.jsx)(OZ,{error:e,filter:l,installedById:y,isError:_.isError,isFetchingNextPage:_.isFetchingNextPage,isLoading:_.isLoading,isStarting:n,items:x,localeFallbacks:b,onFilterChange:u,onInstall:r,onLoadMore:()=>void _.fetchNextPage(),onSearchChange:f,onSelect:g,onUpdate:a,operations:s,hasNextPage:_.hasNextPage,search:d,startingSource:c}),(0,H.jsxs)(`div`,{className:`flex items-start gap-2 border-t border-border/60 bg-muted/25 px-5 pb-[max(.75rem,env(safe-area-inset-bottom))] pt-3 text-[11px] leading-4 text-muted-foreground sm:px-6 sm:pb-3`,children:[(0,H.jsx)(Lo,{className:`mt-0.5 h-3.5 w-3.5 shrink-0`}),(0,H.jsx)(`span`,{children:T(`appPackagesMarketplaceTrustHint`)})]})]})})}function rQ({onBack:e}){return(0,H.jsx)(`div`,{className:`border-b border-border/60 bg-card px-4 pb-3 pt-[max(.75rem,env(safe-area-inset-top))] sm:px-5 sm:pt-3`,children:(0,H.jsxs)(`button`,{type:`button`,onClick:e,className:`inline-flex items-center gap-2 rounded-lg px-2 py-1.5 text-sm font-medium text-muted-foreground transition-colors hover:bg-[var(--interaction-hover)] hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,children:[(0,H.jsx)(di,{className:`h-4 w-4`}),T(`appPackagesBackToMarketplace`)]})})}function iQ({appPackage:e,isPending:t,operation:n,onDisable:r,onEnable:i,onOpenPanelApp:a,onRollback:o,onUninstall:s,onUpdate:l,panelApps:u,storageUsage:d,storageUsageLoading:f,storageUsageUnavailable:p}){let[m,h]=(0,V.useState)(!1),[g,_]=(0,V.useState)(!1),[v,y]=(0,V.useState)(!1),b=(0,V.useRef)(!1),x=(0,V.useRef)(null),S=e.components.filter(e=>e.kind===`panel`),C=e.components.length-S.length,w=e.installedVersions.filter(t=>t!==e.activeVersion),E=pQ(e.name,e.nameI18n)??e.id,D=pQ(e.description,e.descriptionI18n),O=n?mX(n.status):!1,k=t||O,A=oQ(d,f,p);return(0,H.jsxs)(ks,{surface:`flat`,hover:!1,className:`overflow-hidden border-border/60 shadow-[0_1px_2px_rgba(0,0,0,0.025)]`,children:[(0,H.jsxs)(`div`,{className:`flex items-start gap-3.5 px-4 pb-3.5 pt-4`,children:[(0,H.jsx)(WY,{icon:e.icon,name:E}),(0,H.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,H.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,H.jsx)(`h2`,{className:`truncate text-sm font-semibold text-foreground`,children:E}),(0,H.jsx)(`span`,{className:c(`shrink-0 rounded-full px-2 py-0.5 text-[10px] font-medium`,e.enabled?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:`bg-muted text-muted-foreground`),children:e.enabled?T(`appPackagesEnabled`):T(`appPackagesAvailable`)})]}),D?(0,H.jsx)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-muted-foreground`,children:D}):null,(0,H.jsxs)(`div`,{className:`mt-1.5 flex flex-wrap items-center gap-x-2 gap-y-1 text-[11px] text-muted-foreground/75`,children:[(0,H.jsxs)(`span`,{children:[`v`,e.activeVersion]}),e.builtIn?(0,H.jsx)(`span`,{children:T(`appPackagesBuiltIn`)}):null,C>0?(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,H.jsx)(Po,{className:`h-3 w-3`}),T(`appPackagesLocalService`)]}):null,(0,H.jsxs)(`span`,{className:c(`inline-flex items-center gap-1`,e.isolation===`full-user`&&`text-amber-700 dark:text-amber-300`),children:[e.isolation===`full-user`?(0,H.jsx)(Io,{className:`h-3 w-3`}):(0,H.jsx)(Lo,{className:`h-3 w-3`}),e.isolation===`full-user`?T(`appPackagesIsolationFullUser`):e.isolation===`host-mediated`?T(`appPackagesIsolationMediated`):T(`appPackagesIsolationPanel`)]})]}),(0,H.jsxs)(`div`,{className:`mt-2 flex min-w-0 items-center gap-1.5 rounded-md bg-muted/35 px-2 py-1 text-[10px] text-muted-foreground`,title:e.storage.dataDirectory,children:[(0,H.jsx)(qa,{className:`h-3 w-3 shrink-0`}),(0,H.jsxs)(`span`,{className:`shrink-0`,children:[T(`appPackagesDataUsage`),` `,A]}),(0,H.jsx)(`code`,{className:`min-w-0 truncate font-mono text-[10px]`,children:e.storage.dataDirectory})]})]}),(0,H.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[(0,H.jsx)(R,{type:`button`,size:`sm`,variant:e.enabled?`outline`:`default`,disabled:k,onClick:e.enabled?r:i,children:sQ({enabled:e.enabled,isPending:t,operation:n,operationActive:O})}),(0,H.jsxs)(Tc,{open:m,onOpenChange:h,children:[(0,H.jsx)(Ec,{asChild:!0,children:(0,H.jsx)(`button`,{type:`button`,"aria-label":T(`appPackagesMoreActions`),title:T(`appPackagesMoreActions`),disabled:k,className:`rounded-full p-2 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 disabled:opacity-50`,children:(0,H.jsx)(wa,{className:`h-4 w-4`})})}),(0,H.jsxs)(Oc,{align:`end`,className:`w-52 rounded-xl p-1.5`,onCloseAutoFocus:e=>{b.current&&=(e.preventDefault(),!1)},children:[(0,H.jsx)(cQ,{icon:gi,label:T(`appPackagesCheckUpdate`),onClick:()=>{h(!1),l()}}),w.map(e=>(0,H.jsx)(cQ,{icon:Mo,label:`${T(`appPackagesRollback`)} v${e}`,onClick:()=>{h(!1),o(e)}},e)),(0,H.jsx)(cQ,{destructive:!0,icon:Yo,label:T(`appPackagesUninstall`),onClick:()=>{b.current=!0,h(!1),y(!1),_(!0)}})]})]})]})]}),n&&(O||n.status===`failed`||n.status===`interrupted`)?(0,H.jsx)(uQ,{operation:n}):null,S.length>0?(0,H.jsx)(`div`,{className:`border-t border-border/60 bg-muted/20 p-2`,children:(0,H.jsx)(`div`,{className:`grid grid-cols-2 gap-1.5`,children:S.map(t=>{let n=u.find(e=>e.appId===t.id),r=fQ(t.id),i=pQ(t.title,t.titleI18n)??t.id;return(0,H.jsxs)(`button`,{type:`button`,disabled:!e.enabled||!n||k,onClick:()=>n&&a({...n,title:i,description:pQ(t.description,t.descriptionI18n)}),className:`group flex min-w-0 items-center gap-2 rounded-lg px-2.5 py-2 text-left transition-colors hover:bg-[var(--interaction-hover)] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border disabled:cursor-default disabled:opacity-55`,title:e.enabled?i:T(`appPackagesEnableToOpen`),children:[(0,H.jsx)(`span`,{className:`flex h-7 w-7 shrink-0 items-center justify-center rounded-lg bg-card text-muted-foreground shadow-sm ring-1 ring-border/60`,children:(0,H.jsx)(lQ,{icon:t.icon,fallback:r})}),(0,H.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs font-medium text-foreground`,children:i}),e.enabled?(0,H.jsx)(oa,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground/50 transition-transform group-hover:translate-x-0.5`}):null]},t.id)})})}):null,(0,H.jsx)(Rr,{open:g,onOpenChange:_,children:(0,H.jsxs)(Vr,{className:`max-w-md [&>:last-child]:hidden`,onOpenAutoFocus:e=>{e.preventDefault(),x.current?.focus()},children:[(0,H.jsxs)(zr,{children:[(0,H.jsx)(Hr,{children:T(`appPackagesUninstallTitle`)}),(0,H.jsx)(Fr,{children:T(`appPackagesUninstallDescription`)})]}),(0,H.jsxs)(`div`,{className:`mt-4 grid gap-2`,children:[(0,H.jsx)($Y,{checked:!v,description:T(`appPackagesKeepDataDescription`),label:T(`appPackagesKeepData`),onClick:()=>y(!1)}),(0,H.jsx)($Y,{checked:v,destructive:!0,description:T(`appPackagesDeleteDataDescription`),label:T(`appPackagesDeleteData`),onClick:()=>y(!0)})]}),(0,H.jsx)(`div`,{className:`mt-3`,children:(0,H.jsx)(aQ,{loading:f,storage:e.storage,usage:d,unavailable:p})}),(0,H.jsxs)(kr,{className:`mt-5 gap-2 sm:gap-0`,children:[(0,H.jsx)(R,{ref:x,autoFocus:!0,type:`button`,variant:`outline`,onClick:()=>_(!1),children:T(`cancel`)}),(0,H.jsx)(R,{type:`button`,variant:`destructive`,onClick:()=>{s(v),_(!1)},children:T(`appPackagesUninstall`)})]})]})})]})}function aQ({loading:e,storage:t,unavailable:n,usage:r}){return r?(0,H.jsx)(eX,{storage:t,usage:r}):(0,H.jsxs)(`div`,{className:`rounded-xl bg-muted/45 px-3 py-3 text-xs text-muted-foreground`,children:[e?(0,H.jsx)(mi,{className:`mr-1.5 inline h-3.5 w-3.5 animate-spin`}):null,T(e?`appPackagesLoading`:n?`appPackagesDataUsageUnavailable`:`appPackagesNoDataYet`)]})}function oQ(e,t,n){return e?tX(e.totalBytes):T(t?`appPackagesLoading`:n?`appPackagesDataUsageUnavailable`:`appPackagesNoDataYet`)}function sQ({enabled:e,isPending:t,operation:n,operationActive:r}){return r?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(mi,{className:`mr-1.5 h-3.5 w-3.5 animate-spin`}),n?dQ(n):T(`appPackagesWorking`)]}):T(t?`appPackagesWorking`:e?`appPackagesDisable`:`appPackagesEnable`)}function cQ({destructive:e=!1,icon:t,label:n,onClick:r}){return(0,H.jsxs)(`button`,{type:`button`,onClick:r,className:c(`flex w-full items-center gap-2 rounded-lg px-2.5 py-2 text-left text-sm transition-colors`,e?`text-destructive hover:bg-destructive/10`:`text-muted-foreground hover:bg-[var(--interaction-hover)] hover:text-accent-foreground`),children:[(0,H.jsx)(t,{className:`h-4 w-4 shrink-0`}),(0,H.jsx)(`span`,{children:n})]})}function lQ({fallback:e,icon:t}){return t&&(t.startsWith(`data:`)||t.startsWith(`/`)||t.startsWith(`http://`)||t.startsWith(`https://`))?(0,H.jsx)(`img`,{src:t,alt:``,className:`h-4 w-4 rounded object-cover`}):t?(0,H.jsx)(`span`,{className:`text-sm leading-none`,children:t}):(0,H.jsx)(e,{className:`h-3.5 w-3.5`})}function uQ({operation:e}){let t=e.status===`failed`||e.status===`interrupted`,n=Math.max(4,Math.round(e.completedSteps/e.totalSteps*100));return(0,H.jsxs)(`div`,{className:`border-t border-border/50 px-4 py-2.5`,role:t?`alert`:`status`,"aria-live":`polite`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px]`,children:[t?(0,H.jsx)(Ir,{className:`h-3.5 w-3.5 text-destructive`}):(0,H.jsx)(mi,{className:`h-3.5 w-3.5 animate-spin text-primary`}),(0,H.jsx)(`span`,{className:t?`text-destructive`:`text-muted-foreground`,children:t?e.error??T(`appPackagesActionFailed`):dQ(e)})]}),(0,H.jsx)(`div`,{className:`mt-2 h-1 overflow-hidden rounded-full bg-muted`,children:(0,H.jsx)(`div`,{className:c(`h-full rounded-full transition-[width] duration-300`,t?`bg-destructive`:`bg-primary`),style:{width:t?`100%`:`${n}%`}})})]})}function dQ(e){switch(e.status){case`queued`:return T(`appPackagesPreparing`);case`resolving`:return T(`appPackagesResolving`);case`downloading`:return T(`appPackagesDownloading`);case`verifying`:return T(`appPackagesVerifying`);case`installing`:return e.action===`rollback`?`${T(`appPackagesSwitchingVersion`)} ${e.targetVersion?`v${e.targetVersion}`:``}`.trim():e.action===`uninstall`?T(`appPackagesUninstalling`):T(`appPackagesInstalling`);case`finalizing`:return T(`appPackagesFinalizing`);case`succeeded`:return T(`appPackagesCompleted`);case`failed`:case`interrupted`:return T(`appPackagesActionFailed`)}}function fQ(e){return e.endsWith(`-todos`)?Vo:e.endsWith(`-notes`)?bo:e.endsWith(`-favorites`)?Yi:e.endsWith(`-calendar`)?na:Gr}function pQ(e,t){let n=A()===`zh`?`zh-CN`:`en-US`;return t?.[n]??e}function mQ({focusedPackageId:e,onOpenPanelApp:t}){let n=fX(),r=rX(),i=pX(),a=vY(),o=gX(),s=bY(),c=xY(),l=q9(),u=(0,V.useRef)(null),[d,f]=(0,V.useState)(!1),[p,m]=(0,V.useState)(``),[h,g]=(0,V.useState)(!1),_=(0,V.useMemo)(()=>i.data?.entries??[],[i.data?.entries]);(0,V.useEffect)(()=>{if(!e||n.isLoading)return;let t=document.getElementById(`app-package-${e}`);t?.scrollIntoView({block:`nearest`}),t?.focus({preventScroll:!0})},[n.data,n.isLoading,e]),hX({isLoaded:!!i.data,operations:_,refetchPackages:n.refetch,refetchPanels:a.refetch,refetchAppData:r.refetch,settlementManager:l.appPackageOperationSettlementManager});let v=(e,t)=>{o.reset(),o.mutate(e,{onSuccess:t})},y=async e=>{if(e.clientDeclared&&!e.clientGranted){if(!await l.serviceActionAuthorizationManager.requestAuthorization({panelAppId:e.appId,actions:[{actionId:`nextclaw.client`,actionTitle:T(`panelAppsClientGrantTitle`),actionDescription:T(`panelAppsClientGrantDescription`),risk:`dangerous`}]}))return;await c.mutateAsync(e.appId)}try{t(await s.mutateAsync(e.id))}catch{t(e)}},b=e=>{e.preventDefault();let t=p.trim();t&&v({action:`install`,source:t},()=>{f(!1),m(``)})};return(0,H.jsxs)(`div`,{className:`@container flex h-full min-h-0 flex-col bg-card text-card-foreground`,children:[(0,H.jsxs)(`div`,{className:`flex min-h-12 shrink-0 items-center justify-end gap-1 border-b border-border/70 px-4 py-2`,children:[(0,H.jsx)(`button`,{type:`button`,onClick:()=>{n.refetch(),i.refetch(),a.refetch(),r.refetch()},className:`rounded-full p-2 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:T(`appPackagesRefresh`),"aria-label":T(`appPackagesRefresh`),children:(0,H.jsx)(gi,{className:`h-3.5 w-3.5`})}),(0,H.jsxs)(R,{type:`button`,size:`sm`,variant:`outline`,onClick:()=>{o.reset(),g(!0)},children:[(0,H.jsx)(Ko,{className:`mr-1.5 h-3.5 w-3.5`}),T(`appPackagesBrowse`)]}),(0,H.jsxs)(R,{type:`button`,size:`sm`,variant:`outline`,onClick:()=>{o.reset(),f(!0)},children:[(0,H.jsx)(xo,{className:`mr-1.5 h-3.5 w-3.5`}),T(`appPackagesInstall`)]})]}),(0,H.jsx)(`div`,{className:`custom-scrollbar min-h-0 flex-1 overflow-y-auto`,children:(0,H.jsxs)(`div`,{className:`mx-auto w-full max-w-3xl p-3 sm:p-5`,children:[(0,H.jsxs)(`div`,{className:`mb-4 px-1`,children:[(0,H.jsx)(`h1`,{ref:u,tabIndex:-1,className:`text-base font-semibold tracking-tight text-foreground`,children:T(`appPackagesLibraryTitle`)}),(0,H.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-muted-foreground`,children:T(`appPackagesLibraryDescription`)})]}),o.isError?(0,H.jsx)(`div`,{role:`alert`,className:`mb-3 rounded-xl bg-destructive/8 px-3 py-2.5 text-xs leading-5 text-destructive ring-1 ring-destructive/15`,children:o.error instanceof Error?o.error.message:T(`appPackagesActionFailed`)}):null,(0,H.jsx)(hQ,{appDataEntries:r.data?.entries??[],appDataLoading:r.isLoading,appDataUnavailable:r.isError,error:vQ(n.error,a.error),focusedPackageId:e,isLoading:n.isLoading||a.isLoading,isPending:o.isPending,mutationAppId:`appId`in(o.variables??{})?o.variables.appId:void 0,packages:n.data?.entries??[],panelApps:a.data?.entries??[],operations:_,onInstall:()=>f(!0),onMutate:v,onOpenPanelApp:e=>void y(e)}),(0,H.jsx)(aX,{diagnostics:r.data?.diagnostics??[],entries:r.data?.entries??[],error:r.error,isLoading:r.isLoading,onDeletionFocusReturn:()=>u.current?.focus()})]})}),(0,H.jsx)(nQ,{error:o.error instanceof Error?o.error:null,installedPackages:n.data?.entries??[],startingSource:o.variables?.action===`install`?o.variables.source:void 0,isStarting:o.isPending,operations:_,open:h,onOpenChange:g,onInstall:(e,t)=>v({action:`install`,source:e,registryUrl:t}),onUpdate:e=>v({action:`update`,appId:e})}),(0,H.jsx)(Rr,{open:d,onOpenChange:f,children:(0,H.jsx)(Vr,{className:`max-w-md [&>:last-child]:hidden`,children:(0,H.jsxs)(`form`,{onSubmit:b,children:[(0,H.jsxs)(zr,{children:[(0,H.jsx)(Hr,{children:T(`appPackagesInstallTitle`)}),(0,H.jsx)(Fr,{children:T(`appPackagesInstallDescription`)})]}),(0,H.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[(0,H.jsx)(Gt,{autoFocus:!0,value:p,onChange:e=>m(e.target.value),placeholder:T(`appPackagesInstallPlaceholder`),"aria-label":T(`appPackagesInstallSource`)}),(0,H.jsxs)(`div`,{className:`flex items-start gap-2 rounded-xl bg-muted/60 px-3 py-2.5 text-xs leading-5 text-muted-foreground`,children:[(0,H.jsx)(Lo,{className:`mt-0.5 h-3.5 w-3.5 shrink-0`}),(0,H.jsx)(`span`,{children:T(`appPackagesInstallTrustHint`)})]}),o.isError?(0,H.jsx)(`p`,{role:`alert`,className:`text-xs text-destructive`,children:o.error instanceof Error?o.error.message:T(`appPackagesActionFailed`)}):null]}),(0,H.jsxs)(kr,{className:`mt-5 gap-2 sm:gap-0`,children:[(0,H.jsx)(R,{type:`button`,variant:`outline`,onClick:()=>f(!1),children:T(`cancel`)}),(0,H.jsx)(R,{type:`submit`,disabled:!p.trim()||o.isPending,children:o.isPending?T(`appPackagesInstalling`):T(`appPackagesInstall`)})]})]})})})]})}function hQ({appDataEntries:e,appDataLoading:t,appDataUnavailable:n,error:r,focusedPackageId:i,isLoading:a,isPending:o,mutationAppId:s,onInstall:c,onMutate:l,onOpenPanelApp:u,packages:d,panelApps:f,operations:p}){if(a)return(0,H.jsxs)(`div`,{className:`space-y-2.5`,"aria-label":T(`appPackagesLoading`),children:[(0,H.jsx)(xi,{className:`h-44 w-full rounded-2xl`}),(0,H.jsx)(xi,{className:`h-32 w-full rounded-2xl`})]});if(r)return(0,H.jsx)(`div`,{className:`rounded-xl border border-destructive/20 bg-destructive/5 px-4 py-4 text-sm text-destructive`,children:r});if(d.length===0){let e=p.filter(e=>e.action===`install`&&mX(e.status));return e.length>0?(0,H.jsx)(`div`,{className:`space-y-2.5`,children:e.map(e=>(0,H.jsx)(gQ,{operation:e},e.id))}):(0,H.jsxs)(`div`,{className:`flex flex-col items-center rounded-2xl border border-dashed border-border px-6 py-10 text-center`,children:[(0,H.jsx)(xo,{className:`h-7 w-7 text-muted-foreground`}),(0,H.jsx)(`h2`,{className:`mt-3 text-sm font-semibold text-foreground`,children:T(`appPackagesEmptyTitle`)}),(0,H.jsx)(`p`,{className:`mt-1 max-w-sm text-xs leading-5 text-muted-foreground`,children:T(`appPackagesEmptyDescription`)}),(0,H.jsx)(R,{type:`button`,size:`sm`,className:`mt-4`,onClick:c,children:T(`appPackagesInstall`)})]})}return(0,H.jsxs)(`div`,{className:`space-y-2.5`,children:[p.filter(e=>e.action===`install`&&mX(e.status)&&!d.some(t=>t.id===e.appId)).map(e=>(0,H.jsx)(gQ,{operation:e},e.id)),d.map(r=>{let a=p.find(e=>e.appId===r.id),c=a&&(mX(a.status)||a.status===`failed`||a.status===`interrupted`)?a:void 0;return(0,H.jsx)(`section`,{id:`app-package-${r.id}`,"aria-label":r.name,tabIndex:-1,className:i===r.id?`rounded-xl outline-none ring-2 ring-primary/35 ring-offset-2 ring-offset-background`:`rounded-xl outline-none`,children:(0,H.jsx)(iQ,{appPackage:r,storageUsage:e.find(e=>e.source===`package`&&e.lifecycle===`active`&&e.appId===r.id&&e.instanceId===r.instanceId)?.usage??r.storageUsage,storageUsageLoading:t,storageUsageUnavailable:n,panelApps:f.filter(e=>e.packageId===r.id),isPending:o&&s===r.id,operation:c,onEnable:()=>l({action:`enable`,appId:r.id}),onDisable:()=>l({action:`disable`,appId:r.id}),onUpdate:()=>l({action:`update`,appId:r.id}),onRollback:e=>l({action:`rollback`,appId:r.id,version:e}),onUninstall:e=>l({action:`uninstall`,appId:r.id,purgeData:e}),onOpenPanelApp:u})},r.id)})]})}function gQ({operation:e}){let t=e.appId??e.source??T(`appPackagesInstall`),n=Math.max(4,Math.round(e.completedSteps/e.totalSteps*100));return(0,H.jsxs)(`div`,{className:`rounded-xl border border-border/60 bg-card px-4 py-3.5 shadow-[0_1px_2px_rgba(0,0,0,0.025)]`,role:`status`,"aria-live":`polite`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,H.jsx)(WY,{name:t}),(0,H.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,H.jsx)(`p`,{className:`truncate text-sm font-semibold text-foreground`,children:t}),(0,H.jsxs)(`p`,{className:`mt-0.5 flex items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,H.jsx)(mi,{className:`h-3.5 w-3.5 animate-spin`}),_Q(e)]})]})]}),(0,H.jsx)(`div`,{className:`ml-14 mt-2 h-1 overflow-hidden rounded-full bg-muted`,children:(0,H.jsx)(`div`,{className:`h-full rounded-full bg-primary transition-[width] duration-300`,style:{width:`${n}%`}})})]})}function _Q(e){switch(e.status){case`queued`:return T(`appPackagesPreparing`);case`resolving`:return T(`appPackagesResolving`);case`downloading`:return T(`appPackagesDownloading`);case`verifying`:return T(`appPackagesVerifying`);case`installing`:return T(`appPackagesInstalling`);case`finalizing`:return T(`appPackagesFinalizing`);case`succeeded`:return T(`appPackagesCompleted`);case`failed`:case`interrupted`:return e.error??T(`appPackagesActionFailed`)}}function vQ(...e){return e.find(e=>e instanceof Error)?.message||(e.some(Boolean)?T(`appPackagesLoadFailed`):void 0)}function yQ(){return`service-action-auth-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`}var bQ=N((e,t)=>({pending:null,requestAuthorization:async n=>await new Promise(r=>{t().pending?.resolve(!1),e({pending:{id:yQ(),...n,resolve:r}})}),resolveAuthorization:n=>{let{pending:r}=t();r&&(r.resolve(n),e({pending:null}))}}));function xQ(){let e=bQ(e=>e.pending),t=bQ(e=>e.resolveAuthorization);return(0,H.jsx)(Rr,{open:!!e,onOpenChange:e=>{e||t(!1)},children:(0,H.jsxs)(Vr,{className:`[&>:last-child]:hidden`,children:[(0,H.jsxs)(zr,{children:[(0,H.jsxs)(Hr,{className:`flex items-center gap-2`,children:[(0,H.jsx)(Io,{className:`h-4 w-4 text-amber-600`}),T(`serviceActionAuthorizationTitle`)]}),(0,H.jsx)(Fr,{children:T(`serviceActionAuthorizationDescription`)})]}),e?(0,H.jsxs)(`div`,{className:`space-y-3 rounded-md border border-border bg-muted/60 p-3 text-sm`,children:[(0,H.jsx)(CQ,{label:T(`serviceActionAuthorizationSource`),value:e.panelAppId}),(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(`div`,{className:`text-xs font-medium text-muted-foreground`,children:T(`serviceActionAuthorizationActions`)}),(0,H.jsx)(`div`,{className:`max-h-64 space-y-2 overflow-auto`,children:e.actions.map(e=>(0,H.jsx)(SQ,{action:e},e.actionId))})]}),e.inputPreview?(0,H.jsx)(CQ,{label:T(`serviceActionAuthorizationInput`),value:e.inputPreview}):null]}):null,(0,H.jsxs)(kr,{className:`gap-2 sm:gap-0`,children:[(0,H.jsx)(R,{type:`button`,variant:`outline`,onClick:()=>t(!1),children:T(`serviceActionAuthorizationReject`)}),(0,H.jsx)(R,{type:`button`,onClick:()=>t(!0),children:T(`serviceActionAuthorizationAllow`)})]})]})})}function SQ({action:e}){return(0,H.jsxs)(`div`,{className:`space-y-1 rounded border border-border bg-card px-3 py-2`,children:[(0,H.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,H.jsx)(`div`,{className:`min-w-0 break-words text-xs font-medium text-foreground`,children:e.actionTitle??e.actionId}),(0,H.jsx)(`div`,{className:`shrink-0 rounded bg-amber-50 px-1.5 py-0.5 text-[11px] font-medium text-amber-700`,children:e.risk??`dangerous`})]}),(0,H.jsx)(`div`,{className:`break-words text-[11px] text-muted-foreground`,children:e.actionId}),e.actionDescription?(0,H.jsx)(`div`,{className:`break-words text-xs text-muted-foreground`,children:e.actionDescription}):null]})}function CQ({label:e,value:t}){return(0,H.jsxs)(`div`,{className:`grid grid-cols-[5rem_minmax(0,1fr)] gap-3`,children:[(0,H.jsx)(`div`,{className:`text-xs font-medium text-muted-foreground`,children:e}),(0,H.jsx)(`div`,{className:`min-w-0 break-words text-xs text-foreground`,children:t})]})}var wQ=class{constructor(){this.requestAuthorization=async e=>await bQ.getState().requestAuthorization(e)}};function TQ({appId:e,appTitle:t,dataEntry:n,dataLoading:r,deleteError:i,deletePending:a,open:o,purgeData:s,onDelete:c,onOpenChange:l,onPurgeDataChange:u}){let d=(0,V.useRef)(null);(0,V.useEffect)(()=>{i&&d.current?.focus()},[i]);let f=()=>l(!1);return(0,H.jsx)(Rr,{open:o,onOpenChange:e=>!a&&l(e),children:(0,H.jsxs)(Vr,{className:`max-w-md [&>:last-child]:hidden`,onEscapeKeyDown:e=>a&&e.preventDefault(),onInteractOutside:e=>a&&e.preventDefault(),children:[(0,H.jsxs)(zr,{children:[(0,H.jsx)(Hr,{children:T(`serviceAppsDeleteConfirmTitle`)}),(0,H.jsxs)(Fr,{children:[T(`serviceAppsDeleteConfirmDescription`),` `,t]})]}),(0,H.jsxs)(`div`,{className:`mt-4 grid gap-2`,children:[(0,H.jsx)($Y,{checked:!s,description:T(`serviceAppsKeepDataDescription`),label:T(`appPackagesKeepData`),onClick:()=>u(!1)}),(0,H.jsx)($Y,{checked:s,destructive:!0,disabled:!n||r,description:T(`serviceAppsDeleteDataDescription`),label:T(`appPackagesDeleteData`),onClick:()=>u(!0)})]}),n?(0,H.jsx)(`div`,{className:`mt-3`,children:(0,H.jsx)(eX,{storage:n.storage,usage:n.usage})}):(0,H.jsx)(`p`,{role:`status`,className:`mt-3 text-xs text-muted-foreground`,children:T(r?`appPackagesLoading`:`serviceAppsDataUnavailable`)}),i?(0,H.jsx)(`p`,{ref:d,role:`alert`,tabIndex:-1,className:`mt-3 text-xs text-destructive`,children:i instanceof Error?i.message:T(`appPackagesActionFailed`)}):null,(0,H.jsxs)(kr,{className:`mt-5 gap-2 sm:gap-0`,children:[(0,H.jsx)(R,{autoFocus:!0,type:`button`,variant:`outline`,disabled:a,onClick:f,children:T(`cancel`)}),(0,H.jsxs)(R,{type:`button`,variant:s?`destructive`:`default`,disabled:a||s&&!n,onClick:()=>c(e,s,f),children:[a?(0,H.jsx)(mi,{className:`mr-1.5 h-3.5 w-3.5 animate-spin`}):null,T(s?`appDataDeletePermanently`:`serviceAppsDelete`)]})]})]})})}function EQ({app:e,actions:t,actionsOpen:n,grants:r,deletePending:i,deleteError:a,dataEntry:o,dataLoading:s,isDiscovering:l,onActionsOpenChange:u,onDiscover:d,onManagePackage:f,onDelete:p,onResetDelete:m,onRestart:h,onRevoke:g}){let[_,v]=(0,V.useState)(!1),[y,b]=(0,V.useState)(!1),[x,S]=(0,V.useState)(!1),[C,w]=(0,V.useState)(!1),E=e.status!==`starting`&&e.status!==`stopped`,D=e.status===`running`||e.status===`failed`,O=e.sourceKind===`package`?e.packageId:void 0,k=AQ(e),A=()=>{v(!1),w(!1),m(),b(!0)};return(0,H.jsx)(ti,{delayDuration:250,children:(0,H.jsxs)(`section`,{className:`group bg-card transition-colors hover:bg-muted/25`,children:[(0,H.jsxs)(`div`,{className:`flex items-start gap-3 px-4 py-3.5`,children:[(0,H.jsx)(`div`,{className:`flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-muted text-muted-foreground`,children:(0,H.jsx)(Po,{className:`h-4 w-4`})}),(0,H.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`div`,{className:`truncate text-sm font-medium text-foreground`,children:e.title}),(0,H.jsx)(DQ,{status:e.status})]}),e.description?(0,H.jsx)(`div`,{className:`mt-1 truncate text-xs leading-5 text-muted-foreground`,children:e.description}):null,e.lastError?(0,H.jsx)(`div`,{className:`mt-1.5 truncate text-xs text-rose-600`,title:e.lastError,children:e.lastError}):null]}),(0,H.jsxs)(`div`,{className:`flex shrink-0 items-center gap-0.5`,children:[E?(0,H.jsxs)(oi,{children:[(0,H.jsx)(si,{asChild:!0,children:(0,H.jsxs)(`button`,{type:`button`,disabled:l,className:`inline-flex h-7 items-center gap-1.5 rounded-md bg-foreground px-2.5 text-xs font-medium text-background transition-colors hover:bg-foreground/85 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-foreground/40 disabled:cursor-not-allowed disabled:opacity-50`,"aria-label":T(`serviceAppsDiscoverActions`),onClick:()=>d(e.id),children:[l?(0,H.jsx)(mi,{className:`h-3.5 w-3.5 animate-spin`}):(0,H.jsx)(Ao,{className:`h-3.5 w-3.5`}),(0,H.jsx)(`span`,{children:T(`serviceAppsConnect`)})]})}),(0,H.jsx)(Yr,{side:`bottom`,className:`max-w-56 text-xs`,children:T(`serviceAppsDiscoverActionsHint`)})]}):null,(0,H.jsxs)(Tc,{open:_,onOpenChange:v,children:[(0,H.jsxs)(oi,{children:[(0,H.jsx)(si,{asChild:!0,children:(0,H.jsx)(Ec,{asChild:!0,children:(0,H.jsx)(`button`,{type:`button`,className:`rounded-md p-1.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border disabled:opacity-50`,"aria-label":T(`serviceAppsMoreActions`),disabled:i,children:(0,H.jsx)(ui,{className:`h-3.5 w-3.5`})})})}),(0,H.jsx)(Yr,{side:`bottom`,className:`text-xs`,children:T(`serviceAppsMoreActions`)})]}),(0,H.jsxs)(Oc,{align:`end`,className:`w-48 rounded-xl p-1.5`,children:[(0,H.jsx)(kQ,{disabled:!D,icon:Zo,label:T(`serviceAppsDisconnectRuntime`),onClick:()=>{v(!1),h(e.id)}}),O?(0,H.jsx)(kQ,{icon:Jr,label:T(`serviceAppsManagePackage`),onClick:()=>{v(!1),f(O)}}):(0,H.jsx)(kQ,{destructive:!0,disabled:i,icon:Yo,label:T(`serviceAppsDelete`),onClick:A})]})]})]})]}),(0,H.jsxs)(`div`,{className:`border-t border-border/60`,children:[(0,H.jsxs)(`div`,{className:`flex items-stretch`,children:[(0,H.jsxs)(`button`,{type:`button`,onClick:()=>u(!n),className:`flex min-w-0 flex-1 items-center justify-between gap-2 px-4 py-2 text-left text-xs text-muted-foreground transition-colors hover:bg-muted/40 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-border`,"aria-expanded":n,children:[(0,H.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,H.jsx)(`span`,{children:T(`serviceAppsActionsSection`)}),(0,H.jsx)(`span`,{className:`tabular-nums text-muted-foreground/70`,children:t.length})]}),(0,H.jsx)(er,{className:c(`h-3.5 w-3.5 shrink-0 text-muted-foreground/70 transition-transform`,n&&`rotate-180`)})]}),k.length>0?(0,H.jsxs)(`button`,{type:`button`,onClick:()=>S(e=>!e),className:`flex shrink-0 items-center gap-1 border-l border-border/60 px-3 text-xs text-muted-foreground transition-colors hover:bg-muted/40 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-border`,"aria-expanded":x,children:[(0,H.jsx)(`span`,{children:T(`serviceAppsDetails`)}),(0,H.jsx)(er,{className:c(`h-3.5 w-3.5 transition-transform`,x&&`rotate-180`)})]}):null]}),n?(0,H.jsx)(`div`,{className:`border-t border-border/60 px-4 py-2.5`,children:t.length===0?(0,H.jsx)(`div`,{className:`py-1 text-xs text-muted-foreground`,children:T(`serviceAppsActionsEmpty`)}):(0,H.jsx)(`div`,{className:`divide-y divide-border/50`,children:t.map(e=>(0,H.jsx)(NQ,{action:e,grants:r.filter(t=>t.actionId===e.id),onRevoke:g},e.id))})}):null,x?(0,H.jsx)(jQ,{rows:k}):null]}),e.sourceKind===`package`?null:(0,H.jsx)(TQ,{appId:e.id,appTitle:e.title,dataEntry:o,dataLoading:s,deleteError:a,deletePending:i,open:y,purgeData:C,onDelete:p,onOpenChange:b,onPurgeDataChange:w})]})})}function DQ({status:e}){let t=OQ(e),n=t.icon;return(0,H.jsxs)(oi,{children:[(0,H.jsx)(si,{asChild:!0,children:(0,H.jsxs)(`span`,{className:c(`inline-flex shrink-0 items-center gap-1 text-xs`,t.className),"aria-label":t.label,children:[(0,H.jsx)(n,{className:c(`h-3 w-3`,t.iconClassName)}),(0,H.jsx)(`span`,{children:t.label})]})}),(0,H.jsx)(Yr,{side:`bottom`,className:`text-xs`,children:t.tooltip})]})}function OQ(e){switch(e){case`running`:return{className:`text-emerald-700`,icon:ca,label:T(`serviceAppsStatus_running`),tooltip:T(`serviceAppsStatusHint_running`)};case`starting`:return{className:`text-blue-700`,icon:mi,iconClassName:`animate-spin`,label:T(`serviceAppsStatus_starting`),tooltip:T(`serviceAppsStatusHint_starting`)};case`failed`:return{className:`text-rose-700`,icon:Xo,label:T(`serviceAppsStatus_failed`),tooltip:T(`serviceAppsStatusHint_failed`)};case`stopped`:return{className:`text-muted-foreground`,icon:da,label:T(`serviceAppsStatus_stopped`),tooltip:T(`serviceAppsStatusHint_stopped`)};default:return{className:`text-muted-foreground`,icon:la,label:T(`serviceAppsStatus_idle`),tooltip:T(`serviceAppsStatusHint_idle`)}}}function kQ({destructive:e=!1,disabled:t=!1,icon:n,label:r,onClick:i}){return(0,H.jsxs)(`button`,{type:`button`,className:c(`flex w-full items-center gap-2 rounded-lg px-2.5 py-2 text-left text-sm transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border disabled:cursor-not-allowed disabled:opacity-50`,e?`text-destructive hover:bg-destructive/10`:`text-muted-foreground hover:bg-[var(--interaction-hover)] hover:text-accent-foreground`),disabled:t,onClick:i,children:[(0,H.jsx)(n,{className:`h-4 w-4 shrink-0`}),(0,H.jsx)(`span`,{children:r})]})}function AQ(e){let t=[e.command,...e.args??[]].filter(e=>!!e?.trim()).join(` `);return[{label:T(`serviceAppsCommand`),value:t},{label:T(`serviceAppsCwd`),value:e.cwd},{label:T(`serviceAppsManifest`),value:e.manifestPath},{label:T(`serviceAppsLastStarted`),value:e.lastStartedAt},{label:T(`serviceAppsLastReady`),value:e.lastReadyAt},{label:T(`serviceAppsLastFailed`),value:e.lastFailedAt}].filter(e=>e.value)}function jQ({rows:e}){return(0,H.jsx)(`div`,{className:`border-t border-border/60 px-4 py-2.5`,children:(0,H.jsx)(`dl`,{className:`grid grid-cols-[4.75rem_minmax(0,1fr)] gap-x-3 gap-y-1.5 text-xs`,children:e.map(e=>(0,H.jsx)(MQ,{label:e.label,value:e.value},e.label))})})}function MQ({label:e,value:t}){return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`dt`,{className:`text-muted-foreground/70`,children:e}),(0,H.jsx)(`dd`,{className:`min-w-0 truncate font-mono text-muted-foreground`,title:t,children:t})]})}function NQ({action:e,grants:t,onRevoke:n}){return(0,H.jsxs)(`div`,{className:`py-2`,children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,H.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,H.jsx)(`span`,{className:`flex h-6 w-6 shrink-0 items-center justify-center text-muted-foreground`,children:(0,H.jsx)(ns,{className:`h-3.5 w-3.5`})}),(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsx)(`div`,{className:`truncate text-xs font-medium text-foreground`,children:e.title??e.name}),e.description?(0,H.jsx)(`div`,{className:`truncate text-[11px] text-muted-foreground`,children:e.description}):null]})]}),(0,H.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[e.runtimeState?(0,H.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:T(`serviceAppsRuntimeState_${e.runtimeState}`)}):null,(0,H.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:e.risk})]})]}),t.map(e=>(0,H.jsxs)(`div`,{className:`mt-1.5 flex items-center justify-between gap-2 pl-8`,children:[(0,H.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 text-[11px] text-muted-foreground`,children:[(0,H.jsx)(Lo,{className:`h-3 w-3 shrink-0 text-emerald-500`}),(0,H.jsxs)(`span`,{className:`truncate`,children:[T(`serviceAppsGrantedTo`),` `,e.caller.appId]})]}),(0,H.jsx)(`button`,{type:`button`,onClick:()=>n(e),className:`rounded-md p-1 text-muted-foreground/70 transition-colors hover:bg-muted hover:text-rose-600 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,title:T(`serviceAppsRevokeGrant`),"aria-label":T(`serviceAppsRevokeGrant`),children:(0,H.jsx)(Yo,{className:`h-3 w-3`})})]},`${e.caller.surface}:${e.caller.appId}:${e.actionId}`))]})}var PQ=[`service-apps`],FQ=[`service-actions`],IQ=[`service-action-grants`],LQ=[`app-data`];function RQ(){return dn({queryKey:PQ,queryFn:()=>I.serviceApps.listServiceApps()})}function zQ(){return dn({queryKey:FQ,queryFn:()=>I.serviceApps.listServiceActions()})}function BQ(){return dn({queryKey:IQ,queryFn:()=>I.serviceApps.listServiceActionGrants()})}function VQ(){let e=yn();return zt({mutationFn:e=>I.serviceApps.restartServiceApp(e),onSuccess:async()=>{await Promise.all([e.invalidateQueries({queryKey:PQ}),e.invalidateQueries({queryKey:FQ})])}})}function HQ(){let e=yn();return zt({mutationFn:e=>I.serviceApps.deleteServiceApp(e.appId,e.purgeData),onSuccess:async()=>{await Promise.all([e.invalidateQueries({queryKey:PQ}),e.invalidateQueries({queryKey:FQ}),e.invalidateQueries({queryKey:IQ}),e.invalidateQueries({queryKey:LQ})])}})}function UQ(){let e=yn();return zt({mutationFn:e=>I.serviceApps.discoverServiceAppActions(e),onSuccess:async()=>{await e.invalidateQueries({queryKey:PQ})}})}function WQ(){let e=yn();return zt({mutationFn:e=>I.serviceApps.revokeServiceActionGrant(e),onSuccess:async()=>{await Promise.all([e.invalidateQueries({queryKey:FQ}),e.invalidateQueries({queryKey:IQ})])}})}function GQ({onManagePackage:e}){let t=RQ(),n=rX(),r=zQ(),i=BQ(),a=HQ(),o=VQ(),s=UQ(),c=WQ(),[l,u]=(0,V.useState)({}),[d,f]=(0,V.useState)({}),p=()=>{t.refetch(),r.refetch(),i.refetch(),n.refetch()};if(t.isLoading||r.isLoading||i.isLoading)return(0,H.jsx)(`div`,{className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:T(`serviceAppsLoading`)});if(t.isError||r.isError||i.isError){let e=t.error??r.error??i.error;return(0,H.jsx)(`div`,{className:`p-4 text-sm text-rose-600`,children:e instanceof Error?e.message:T(`serviceAppsLoadFailed`)})}let m=t.data?.entries??[],h=t.data?.diagnostics??[],g=r.data?.actions??[],_=i.data?.grants??[],v=e=>{s.mutateAsync(e).then(t=>{u(n=>({...n,[e]:t.actions})),f(t=>({...t,[e]:!0}))})},y=(n.data?.entries??[]).filter(e=>e.source===`workspace-service`&&e.lifecycle===`active`);return(0,H.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col bg-card text-card-foreground`,children:[(0,H.jsx)(`div`,{className:`flex min-h-12 shrink-0 items-center justify-end border-b border-border/60 px-4 py-2`,children:(0,H.jsx)(ti,{delayDuration:250,children:(0,H.jsxs)(oi,{children:[(0,H.jsx)(si,{asChild:!0,children:(0,H.jsx)(`button`,{type:`button`,className:`rounded-md p-1.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,"aria-label":T(`serviceAppsRefresh`),onClick:p,children:(0,H.jsx)(gi,{className:`h-3.5 w-3.5`})})}),(0,H.jsx)(Yr,{side:`bottom`,className:`text-xs`,children:T(`serviceAppsRefresh`)})]})})}),h.length>0?(0,H.jsxs)(`div`,{role:`alert`,className:`mx-3 mt-3 rounded-xl border border-destructive/20 bg-destructive/5 px-3 py-2.5 text-xs text-destructive sm:mx-4`,children:[(0,H.jsx)(`div`,{className:`font-medium`,children:T(`serviceAppsLoadFailed`)}),(0,H.jsx)(`ul`,{className:`mt-1 space-y-1`,children:h.map(e=>(0,H.jsxs)(`li`,{className:`break-words`,children:[e.appId,`: `,e.message]},e.stagedPath))})]}):null,m.length===0?(0,H.jsx)(`div`,{className:`flex flex-1 items-center justify-center px-6 py-8 text-center`,children:(0,H.jsxs)(`div`,{className:`w-full max-w-xs`,children:[(0,H.jsx)(`div`,{className:`mx-auto flex h-10 w-10 items-center justify-center rounded-xl bg-muted text-muted-foreground`,children:(0,H.jsx)(Po,{className:`h-5 w-5`})}),(0,H.jsx)(`h2`,{className:`mt-3 text-sm font-semibold text-foreground`,children:T(`serviceAppsEmptyTitle`)}),(0,H.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-muted-foreground`,children:T(`serviceAppsEmptyDescription`)})]})}):(0,H.jsx)(`div`,{className:`custom-scrollbar min-h-0 flex-1 overflow-y-auto p-3 sm:p-4`,children:(0,H.jsx)(`div`,{className:`overflow-hidden rounded-xl border border-border/70 bg-card`,children:m.map(t=>(0,H.jsx)(EQ,{app:t,actions:l[t.id]??g.filter(e=>e.appId===t.id),actionsOpen:!!d[t.id],grants:_,deletePending:a.isPending,deleteError:a.error,dataEntry:y.find(e=>e.appId===t.id),dataLoading:n.isLoading,isDiscovering:s.isPending,onActionsOpenChange:e=>f(n=>({...n,[t.id]:e})),onDiscover:v,onManagePackage:e,onDelete:(e,t,n)=>void a.mutate({appId:e,purgeData:t},{onSuccess:n}),onResetDelete:a.reset,onRestart:e=>void o.mutate(e),onRevoke:e=>void c.mutate({actionId:e.actionId,caller:e.caller})},t.id))})})]})}function KQ({activeTab:e,onActiveTabChange:t,onOpenPanelApp:n}){let[r,i]=(0,V.useState)(),a=e=>{i(void 0),t(e)},o=e=>{i(e),t(`apps`)};return(0,H.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col bg-card text-card-foreground`,children:[(0,H.jsx)(`nav`,{className:`shrink-0 border-b border-border/70 px-4 py-3`,"aria-label":T(`appsTitle`),children:(0,H.jsx)(jY,{value:e,onValueChange:e=>a(e),children:(0,H.jsxs)(MY,{className:`grid h-auto w-full max-w-[390px] grid-cols-3 rounded-lg bg-muted/70 p-0.5`,children:[(0,H.jsxs)(NY,{value:`apps`,className:`min-w-0 gap-1.5 px-2 py-1.5 text-xs`,children:[(0,H.jsx)(Jr,{className:`h-3.5 w-3.5 shrink-0`}),(0,H.jsx)(`span`,{className:`truncate`,children:T(`appsTitle`)})]}),(0,H.jsxs)(NY,{value:`panel-apps`,className:`min-w-0 gap-1.5 px-2 py-1.5 text-xs`,children:[(0,H.jsx)(Gr,{className:`h-3.5 w-3.5 shrink-0`}),(0,H.jsx)(`span`,{className:`truncate`,children:T(`panelAppsTitle`)})]}),(0,H.jsxs)(NY,{value:`service-apps`,className:`min-w-0 gap-1.5 px-2 py-1.5 text-xs`,children:[(0,H.jsx)(Po,{className:`h-3.5 w-3.5 shrink-0`}),(0,H.jsx)(`span`,{className:`truncate`,children:T(`serviceAppsTitle`)})]})]})})}),(0,H.jsx)(`div`,{className:`min-h-0 flex-1`,children:e===`apps`?(0,H.jsx)(mQ,{focusedPackageId:r,onOpenPanelApp:n}):e===`panel-apps`?(0,H.jsx)(IY,{onOpenPanelApp:n}):(0,H.jsx)(GQ,{onManagePackage:o})})]})}var qQ=class{constructor(e){this.docBrowserManager=e,this.initialized=!1,this.knownTerminalOperationIds=new Set,this.settle=({isLoaded:e,operations:t,refetchPackages:n,refetchPanels:r,refetchAppData:i})=>{if(!e)return;let a=t.filter(e=>!mX(e.status));if(!this.initialized){a.forEach(e=>this.knownTerminalOperationIds.add(e.id)),this.initialized=!0;return}a.forEach(e=>{this.knownTerminalOperationIds.has(e.id)||(this.knownTerminalOperationIds.add(e.id),this.settleOperation(e,n,r,i))})},this.settleOperation=(e,t,n,r)=>{if(e.status===`succeeded`){L.success(JQ(e)),t(),r(),n().then(t=>{e.action!==`rollback`&&e.action!==`update`||this.docBrowserManager.reloadByDedupeKeys(t.data?.entries.filter(t=>t.packageId===e.appId).map(e=>`panel-app:${e.id}`)??[])});return}(e.status===`failed`||e.status===`interrupted`)&&(t(),n(),r(),L.error(e.error??T(`appPackagesActionFailed`)))}}};function JQ(e){switch(e.action){case`install`:return T(`appPackagesInstallCompleted`);case`update`:return e.result?.changed===!1?T(`appPackagesAlreadyCurrent`):T(`appPackagesUpdateCompleted`);case`rollback`:return e.result?.changed===!1?T(`appPackagesAlreadyOnVersion`):T(`appPackagesRollbackCompleted`);case`uninstall`:return T(`appPackagesUninstallCompleted`)}}function YQ({appTitle:e,onOpenApps:t,onRefresh:n}){return(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-2 border-b border-border/70 bg-card px-3.5 py-2 shrink-0`,children:[(0,H.jsx)(`button`,{type:`button`,onClick:t,className:`inline-flex shrink-0 items-center rounded-md p-1.5 text-muted-foreground transition-colors hover:bg-[var(--interaction-hover)] hover:text-accent-foreground`,title:T(`appsTitle`),"aria-label":T(`appsTitle`),children:(0,H.jsx)(di,{className:`h-3.5 w-3.5`})}),(0,H.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs font-medium text-muted-foreground`,title:e,children:e}),(0,H.jsx)(`button`,{type:`button`,onClick:n,className:`rounded-md p-1.5 text-muted-foreground transition-colors hover:bg-[var(--interaction-hover)] hover:text-accent-foreground`,title:T(`panelAppsRefreshCurrent`),"aria-label":T(`panelAppsRefreshCurrent`),children:(0,H.jsx)(gi,{className:`h-3.5 w-3.5`})})]})}function XQ(e){return e.split(`/`).map(e=>e.trim()).filter(e=>e.length>0)}function ZQ(e){let t=e.trim();try{let e=t.startsWith(`/`),n=e?new URL(t,`http://nextclaw.local`):new URL(t);return{authority:e?``:n.hostname,pathSegments:XQ(n.pathname),pathname:n.pathname,raw:t,scheme:e?``:n.protocol.replace(/:$/,``).toLowerCase(),searchParams:n.searchParams}}catch{return{authority:``,pathSegments:XQ(t),pathname:t,raw:t,scheme:``,searchParams:new URLSearchParams}}}var QQ=class{constructor(e,t){this.routeDefinitions=e,this.options=t,this.resolve=e=>{let t=ZQ(e);return this.findDefinition(t).resolve(t)},this.normalize=e=>this.options.getNormalizedUri(this.resolve(e)),this.areEquivalent=(e,t)=>this.findDefinition(ZQ(e)).areEquivalent?.(e,t)??this.normalize(e)===this.normalize(t),this.findDefinition=e=>{let t=this.routeDefinitions.find(t=>t.match(e));if(!t)throw Error(`Unsupported resource URI: ${e.raw}`);return t}}},$Q=`home`,e$=`nextclaw://new-tab`,t$=`apps`,n$=`nextclaw://apps`,r$=`${n$}?tab=panel-apps`,i$=`${n$}?tab=service-apps`,a$=`panel-app`,o$=new Set([e$,`about:blank`]);function s$(e){let t=e.resourceUri?.trim()||e.currentUrl.trim(),n=e.currentUrl.trim();return!t||!n||o$.has(t)?null:ne({uri:t,resourceKind:e.kind,title:e.title.trim()||t,currentUrl:n,...e.contentParams?{contentParams:structuredClone(e.contentParams)}:{}})}var c$=`apps`;function l$(e){return e===`apps`||e===`panel-apps`||e===`service-apps`}function u$(e=c$){return e===`panel-apps`?r$:e===`service-apps`?i$:n$}function d$(e){try{let t=new URL(e).searchParams.get(`tab`);return l$(t)?t:c$}catch{return c$}}function f$(e){return u$(d$(e))}function p$(e,t){let n=`nextclaw://panel-app/${encodeURIComponent(e)}`,r=t?.trim();return r?`${n}?${new URLSearchParams({path:r}).toString()}`:n}function m$(e,t){let n=`/api/panel-apps/${encodeURIComponent(e)}/content`,r=t?.trim();return r?`${n}?${new URLSearchParams({path:r}).toString()}`:n}function h$(e){return e.startsWith(`data:image/`)||e.startsWith(`http://`)||e.startsWith(`https://`)||e.startsWith(`/`)}function g$(e){let t=e.icon?.trim();if(t)return h$(t)?{type:`url`,url:t}:{type:`text`,value:t}}function _$(e){return{dedupeKey:`panel-app:${e.appId}`,dockIcon:g$(e),historyPolicy:`managed`,kind:a$,resourceUri:p$(e.appId),title:e.title,url:e.contentPath}}function v$(e,t){return e===t||e.startsWith(`${t}?`)||e.startsWith(`${t}/`)}function y$(e){let t=e.pathSegments.join(`/`);return Ii(t?`/${t}`:`/`,`docs`)}function b$(e){let t=e.filter(e=>e.trim().length>0).map(e=>encodeURIComponent(decodeURIComponent(e))).join(`/`);return t?`nextclaw://docs/${t}`:`nextclaw://docs`}function x$(e){let t=Si(e),n=t.startsWith(`/`)?t:(()=>{try{return new URL(e).pathname}catch{return``}})();return n?b$(n.split(`/`)):`nextclaw://docs`}function S$(e){if(e.scheme===`nextclaw`&&e.authority===`panel-app`)return e.pathSegments[0]??``;let[t,n,r,i]=e.pathSegments;return t===`api`&&n===`panel-apps`&&r!==void 0&&r.length>0&&i===`content`?r:``}function C$(e){return S$(e).length>0}function w$(e){let t=S$(e);if(!t)return`nextclaw://panel-app`;let n=e.searchParams.get(`path`)?.trim();return m$(decodeURIComponent(t),n)}function T$(e){let t=S$(e);if(!t)return`nextclaw://panel-app`;let n=`nextclaw://panel-app/${encodeURIComponent(decodeURIComponent(t))}`,r=e.searchParams.get(`path`)?.trim();return r?`${n}?${new URLSearchParams({path:r}).toString()}`:n}function E$(e,t){let n=ZQ(e),r=ZQ(t),i=S$(n),a=S$(r),o=n.searchParams.get(`path`)?.trim()??``,s=r.searchParams.get(`path`)?.trim()??``;return i.length>0&&a.length>0?decodeURIComponent(i)===decodeURIComponent(a)&&o===s:e===t}var D$=[{defaultUrl:()=>e$,id:`home`,kind:$Q,match:e=>e.raw===e$,resolve:()=>({historyPolicy:`managed`,kind:$Q,resourceUri:e$,title:T(`docBrowserHomeTitle`),url:e$}),areEquivalent:(e,t)=>e===t},{defaultUrl:ji,id:`docs-url`,kind:`docs`,match:e=>Ti(e.raw),resolve:e=>{let t=Ii(e.raw,`docs`);return{historyPolicy:`managed`,kind:`docs`,resourceUri:x$(t),title:T(`docBrowserHelp`),url:t}},areEquivalent:(e,t)=>Si(e)===Si(t)},{defaultUrl:ji,id:`nextclaw-docs`,kind:`docs`,match:e=>e.scheme===`nextclaw`&&e.authority===`docs`,resolve:e=>{let t=y$(e);return{historyPolicy:`managed`,kind:`docs`,resourceUri:b$(e.pathSegments),title:T(`docBrowserHelp`),url:t}},areEquivalent:(e,t)=>Si(e)===Si(t)},{defaultUrl:()=>n$,id:`apps`,kind:t$,match:e=>v$(e.raw,n$),resolve:e=>{let t=f$(e.raw);return{dedupeKey:`apps`,historyPolicy:`managed`,kind:t$,resourceUri:t,title:T(t===`nextclaw://apps`?`appsTitle`:`serviceAppsTitle`),url:t}},areEquivalent:(e,t)=>f$(e)===f$(t)},{defaultUrl:()=>`nextclaw://panel-app`,id:`panel-app`,kind:a$,match:e=>e.scheme===`nextclaw`&&e.authority===`panel-app`||C$(e),resolve:e=>{let t=w$(e),n=S$(e);return{dedupeKey:n?`panel-app:${e.searchParams.get(`path`)?.trim()||decodeURIComponent(n)}`:void 0,historyPolicy:`managed`,kind:a$,resourceUri:T$(e),title:T(`panelAppsTitle`),url:t}},areEquivalent:E$},{defaultUrl:()=>`about:blank`,id:`content`,kind:`content`,match:()=>!0,resolve:e=>({historyPolicy:`managed`,kind:`content`,resourceUri:e.raw||`about:blank`,title:Ei(e.raw,`content`,`Detail`),url:e.raw||`about:blank`}),areEquivalent:(e,t)=>e===t}],O$=D$.map(e=>({areEquivalent:e.areEquivalent,id:e.id,match:e.match,resolve:e.resolve}));function k$(){return[{id:`apps`,label:T(`appsTitle`),target:{type:`right-panel-resource`,uri:n$}},{id:`service-apps`,label:T(`serviceAppsTitle`),target:{type:`right-panel-resource`,uri:i$}},{id:`docs`,label:T(`docBrowserHelp`),target:{options:{newTab:!0},type:`right-panel-resource`,uri:ji()}},{id:`skill-marketplace`,label:T(`marketplaceSkillsPageTitle`),target:{path:`/marketplace/skills`,type:`app-route`}}]}var A$={apps:{accentClassName:`bg-emerald-50 text-emerald-700`,hoverAccentClassName:`group-hover:bg-emerald-100`,icon:(0,H.jsx)(Jr,{className:`h-5 w-5`})},"service-apps":{accentClassName:`bg-sky-50 text-sky-700`,hoverAccentClassName:`group-hover:bg-sky-100`,icon:(0,H.jsx)(Ka,{className:`h-5 w-5`})},docs:{accentClassName:`bg-amber-50 text-amber-700`,hoverAccentClassName:`group-hover:bg-amber-100`,icon:(0,H.jsx)(pi,{className:`h-5 w-5`})},"skill-marketplace":{accentClassName:`bg-rose-50 text-rose-700`,hoverAccentClassName:`group-hover:bg-rose-100`,icon:(0,H.jsx)(Qi,{className:`h-5 w-5`})}};function j$(e){return A$[e.id]??{accentClassName:`bg-gray-50 text-gray-700`,hoverAccentClassName:`group-hover:bg-gray-100`,icon:(0,H.jsx)(Jr,{className:`h-5 w-5`})}}function M$({open:e}){let t=oe(),n=k$(),r=n=>{if(n.type===`app-route`){t(n.path);return}e(n.uri,n.options)};return(0,H.jsx)(`div`,{className:`h-full overflow-auto bg-background px-4 py-5`,children:(0,H.jsx)(`div`,{className:`mx-auto w-full max-w-[520px]`,children:(0,H.jsx)(`div`,{className:`grid grid-cols-[repeat(auto-fit,minmax(76px,1fr))] gap-x-2 gap-y-4`,children:n.map(e=>{let t=j$(e);return(0,H.jsxs)(`button`,{type:`button`,onClick:()=>r(e.target),className:`group flex min-h-[68px] flex-col items-center gap-1.5 rounded-md px-1.5 py-1.5 text-center focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,children:[(0,H.jsx)(`span`,{className:c(`flex h-10 w-10 shrink-0 items-center justify-center rounded-md transition-colors`,t.accentClassName,t.hoverAccentClassName),children:t.icon}),(0,H.jsx)(`span`,{className:`line-clamp-2 min-w-0 max-w-full text-xs font-medium leading-snug text-gray-700 transition-colors group-hover:text-gray-900`,children:e.label})]},e.id)})})})})}function N$(e){return e&&Ti(e)?`docs`:`content`}var P$=class{constructor(){this.resourceUriResolver=new QQ(O$,{getNormalizedUri:e=>e.resourceUri??e.url}),this.resolve=e=>this.resourceUriResolver.resolve(e),this.normalize=e=>this.resourceUriResolver.normalize(e),this.areEquivalent=(e,t)=>this.resourceUriResolver.areEquivalent(e,t),this.resolveOpenTarget=e=>{let{activeTab:t,kind:n,url:r}=e,i=this.resolveRouteDefinition(r,n,t),a=r?.trim()||(!n&&t&&t.kind!==`docs`?t.currentUrl:i.defaultUrl());return i.resolve(ZQ(a))},this.areUrlsEquivalent=(e,t,n,r)=>n===r?this.resolveRouteDefinition(e,n).areEquivalent?.(e,t)??this.areEquivalent(e,t):!1,this.usesManagedHistory=e=>this.resolveRouteDefinition(e.currentUrl,e.kind).resolve(ZQ(e.currentUrl)).historyPolicy===`managed`,this.resolveRouteDefinition=(e,t,n)=>{let r=t??(e?void 0:n?.kind),i=r?D$.find(e=>e.kind===r):void 0;if(i)return i;let a=e?ZQ(e):null,o=a?D$.find(e=>e.match(a)):void 0;if(o)return o;let s=t??n?.kind??N$(e);return D$.find(e=>e.kind===s)??D$[D$.length-1]}}},F$=t$,I$=a$,L$=`apps`;function R$(e){return e===`apps`||e===`panel-apps`||e===`service-apps`}function z$(e=L$){return e===`panel-apps`?r$:e===`service-apps`?i$:n$}function B$(e){try{let t=new URL(e).searchParams.get(`tab`);return R$(t)?t:L$}catch{return L$}}function V$(e){e.open(z$(),{kind:F$,title:T(`appsTitle`),dedupeKey:`apps`})}var H$={[$Q]:{getTitle:()=>T(`docBrowserHomeTitle`),renderContent:({open:e})=>(0,H.jsx)(M$,{open:e})},[F$]:{getTitle:()=>T(`appsTitle`),renderIcon:()=>(0,H.jsx)(Jr,{className:`w-4 h-4 text-primary shrink-0`}),renderContent:({currentUrl:e,open:t,openTarget:n})=>(0,H.jsx)(KQ,{activeTab:B$(e),onActiveTabChange:e=>t(z$(e),{activate:!1,kind:F$,title:T(`appsTitle`),dedupeKey:`apps`}),onOpenPanelApp:e=>n(_$(e))})},[I$]:{getIframeSandbox:()=>HY,getTitle:e=>e.title||T(`panelAppsTitle`),onIframeMessage:e=>W9().panelAppBridgeManager.handleIframeMessage(e),onIframePointerOver:e=>UY(e.currentTarget),renderIcon:()=>(0,H.jsx)(Gr,{className:`w-4 h-4 text-primary shrink-0`}),renderToolbar:({open:e,refreshIframe:t,tab:n})=>(0,H.jsx)(YQ,{appTitle:n.title||T(`panelAppsTitle`),onOpenApps:()=>V$({open:e}),onRefresh:t}),supportsScrollRestoration:!0}};function U$(e,t){return m$(e,t)}function W$(e){return`${e}${e.includes(`?`)?`&`:`?`}${new URLSearchParams({[O.displayModeSearchParam]:O.displayMode,[O.placementSearchParam]:O.placement}).toString()}`}function G$(e){if(!e||typeof e!=`object`)return null;let t=e;return t.type===O.contentHeightMessageType&&typeof t.height==`number`&&Number.isFinite(t.height)&&t.height>0?Math.ceil(t.height):null}function K$(e){let{appId:t,params:n,path:r,title:i,url:a}=e;return{contentParams:n,currentUrl:a,dedupeKey:`panel-app:${r??t}`,history:[a],historyIndex:0,id:`inline-panel-app:${r??t}`,kind:a$,navVersion:0,resourceUri:p$(t,r),title:i}}function q$({panelApp:e,showExpandAction:t=!0}){let n=ki(),r=(0,V.useRef)(null),i=(0,V.useId)(),[a,o]=(0,V.useState)(null),s=vY(),c=(0,V.useMemo)(()=>e.path?void 0:VY(s.data?.entries??[],e.appId),[e.appId,e.path,s.data?.entries]),l=c?_$(c):null,u=e.title??l?.title??e.appId,d=e.path?U$(e.appId,e.path):s.isLoading?``:l?.url??U$(e.appId),f=(0,V.useMemo)(()=>d?W$(d):``,[d]),p=(0,V.useMemo)(()=>K$({appId:c?.id??e.appId,params:e.params,path:e.path,title:u,url:d}),[c?.id,e.appId,e.params,e.path,u,d]),m=te(e.params),h=`${p.id}:${p.navVersion}:${i}:${m??``}`;return(0,V.useEffect)(()=>{if(!d)return;let e=e=>{if(e.source!==r.current?.contentWindow)return;let t=G$(e.data);if(t!==null){o(t);return}W9().panelAppBridgeManager.handleIframeMessage({event:e,iframe:r.current,iframeInstanceId:h,tab:p})};return window.addEventListener(`message`,e),()=>window.removeEventListener(`message`,e)},[h,p,d]),d?(0,H.jsx)(uY,{actions:t?(0,H.jsx)(B,{size:`sm`,icon:(0,H.jsx)(co,{className:`h-3.5 w-3.5`}),label:T(`chatPanelCardExpand`),tooltipSide:`top`,onClick:()=>{if(l){n.openTarget({...l,contentParams:e.params});return}n.open(d,{dedupeKey:p.dedupeKey,kind:p.kind,contentParams:e.params,title:u})}}):void 0,contentHeight:a,children:(0,H.jsx)(`iframe`,{ref:r,src:f,name:m,title:u,sandbox:HY,tabIndex:0,onPointerOver:()=>UY(r.current),className:`h-full w-full border-0 bg-card`},h)}):(0,H.jsx)(uY,{isLoading:!0,children:(0,H.jsx)(`span`,{className:`sr-only`,children:u})})}function J$({checkpoint:e,inline:t=!1}){let n=!e||e.status===`compressing`,r=e?.status===`failed`,i=e?.status===`cancelled`,a=e?[`${T(`chatContextCompactionCoveredMessages`)}: ${e.coveredSessionMessageCount}`,`${T(`chatContextCompactionOriginalTokens`)}: ${e.originalEstimatedTokens}`,`${T(`chatContextCompactionProjectedTokens`)}: ${e.projectedEstimatedTokens}`].join(`
|
|
103
103
|
`):void 0;return(0,H.jsxs)(`div`,{"data-context-compaction-placement":t?`assistant`:`timeline`,className:t?`my-3 flex items-center gap-3 text-[11px] text-muted-foreground`:`my-4 flex items-center gap-3 text-[11px] text-muted-foreground`,"aria-live":`polite`,title:a,children:[(0,H.jsx)(`div`,{className:`h-px flex-1 bg-border`}),(0,H.jsxs)(`div`,{className:`inline-flex items-center gap-2 rounded-full border border-border bg-muted px-3 py-1`,children:[n?(0,H.jsx)(`span`,{className:`h-1.5 w-1.5 animate-pulse rounded-full bg-muted-foreground`}):(0,H.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full bg-muted-foreground/45`}),(0,H.jsx)(`span`,{children:T(n?`chatContextCompactionCompressing`:i?`chatContextCompactionCancelled`:r?`chatContextCompactionFailed`:`chatContextCompactionCompressed`)})]}),(0,H.jsx)(`div`,{className:`h-px flex-1 bg-border`})]})}function Y$({inheritance:e}){return(0,H.jsxs)(`div`,{className:`my-4 flex items-center gap-3 text-[11px] text-emerald-700`,title:[`${T(`chatContextInheritanceSourceSession`)}: ${e.sourceSessionId}`,`${T(`chatContextInheritanceMessages`)}: ${e.inheritedMessageCount}`].join(`
|
|
104
104
|
`),children:[(0,H.jsx)(`div`,{className:`h-px flex-1 bg-emerald-100`}),(0,H.jsxs)(`div`,{className:`inline-flex items-center gap-2 rounded-full border border-emerald-200 bg-emerald-50 px-3 py-1`,children:[(0,H.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full bg-emerald-400`}),(0,H.jsx)(`span`,{children:T(`chatContextInheritanceInherited`)})]}),(0,H.jsx)(`div`,{className:`h-px flex-1 bg-emerald-100`})]})}var X$=`nextclaw.chat.message-layout`,Z$=1,Q$=`flat`;function $$(e){if(!e||typeof e!=`object`)return Q$;let{layout:t}=e;return t===`flat`||t===`card`?t:Q$}var e1=N()(yi(e=>({layout:Q$,setLayout:t=>e({layout:t})}),{name:X$,version:Z$,storage:bi(()=>window.localStorage),partialize:e=>({layout:e.layout}),merge:(e,t)=>({...t,layout:$$(e)})}));function t1(e,t,n){let r=Array(e);return new Proxy(r,{get(r,i,a){if(typeof i==`string`){let a=i.charCodeAt(0);if(a>=48&&a<=57){let a=+i;if(Number.isInteger(a)&&a>=0&&a<e){let e=r[a];if(!e){let i=t[a*2];e=r[a]={index:a,key:n(a),start:i,size:t[a*2+1],end:i+t[a*2+1],lane:0}}return e}}if(i===`length`)return e}return Reflect.get(r,i,a)}})}function n1(e,t,n){let r=n.initialDeps??[],i,a=!0;function o(){let o=e();return o.length!==r.length||o.some((e,t)=>r[t]!==e)?(r=o,i=t(...o),n?.onChange&&!(a&&n.skipInitialOnChange)&&n.onChange(i),a=!1,i):i}return o.updateDeps=e=>{r=e},o}function r1(e,t){if(e===void 0)throw Error(`Unexpected undefined${t?`: ${t}`:``}`);return e}var i1=(e,t)=>Math.abs(e-t)<1.01,a1=(e,t,n)=>{let r;return function(...i){e.clearTimeout(r),r=e.setTimeout(()=>t.apply(this,i),n)}},o1,s1=()=>{if(o1!==void 0)return o1;if(typeof navigator>`u`)return o1=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return o1=!0;let e=navigator.maxTouchPoints;return o1=navigator.platform===`MacIntel`&&e!==void 0&&e>0},c1=e=>{let{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},l1=e=>e,u1=e=>{let t=Math.max(e.startIndex-e.overscan,0),n=Math.min(e.endIndex+e.overscan,e.count-1)-t+1,r=Array(n);for(let e=0;e<n;e++)r[e]=t+e;return r},d1=(e,t)=>{let n=e.scrollElement;if(!n)return;let r=e.targetWindow;if(!r)return;let i=e=>{let{width:n,height:r}=e;t({width:Math.round(n),height:Math.round(r)})};if(i(c1(n)),!r.ResizeObserver)return()=>{};let a=new r.ResizeObserver(t=>{let r=()=>{let e=t[0];if(e?.borderBoxSize){let t=e.borderBoxSize[0];if(t){i({width:t.inlineSize,height:t.blockSize});return}}i(c1(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(r):r()});return a.observe(n,{box:`border-box`}),()=>{a.unobserve(n)}},f1={passive:!0},p1=typeof window>`u`?!0:`onscrollend`in window,m1=(e,t,n)=>{let r=e.scrollElement;if(!r)return;let i=e.targetWindow;if(!i)return;let a=e.options.useScrollendEvent&&p1,o=0,s=a?null:a1(i,()=>t(o,!1),e.options.isScrollingResetDelay),c=e=>()=>{o=n(r),s?.(),t(o,e)},l=c(!0),u=c(!1);return r.addEventListener(`scroll`,l,f1),a&&r.addEventListener(`scrollend`,u,f1),()=>{r.removeEventListener(`scroll`,l),a&&r.removeEventListener(`scrollend`,u)}},h1=(e,t)=>m1(e,t,t=>{let{horizontal:n,isRtl:r}=e.options;return n?t.scrollLeft*(r&&-1||1):t.scrollTop}),g1=(e,t,n)=>{if(n.options.useCachedMeasurements){let t=n.indexFromElement(e),r=n.options.getItemKey(t);return n.itemSizeCache.get(r)??n.options.estimateSize(t)}if(t?.borderBoxSize){let e=t.borderBoxSize[0];if(e)return Math.round(e[n.options.horizontal?`inlineSize`:`blockSize`])}if(!t){let t=n.indexFromElement(e),r=n.options.getItemKey(t),i=n.itemSizeCache.get(r);if(i!==void 0)return i}return e[n.options.horizontal?`offsetWidth`:`offsetHeight`]},_1=(e,{adjustments:t=0,behavior:n},r)=>{var i,a;(a=(i=r.scrollElement)?.scrollTo)==null||a.call(i,{[r.options.horizontal?`left`:`top`]:e+t,behavior:n})},v1=class{constructor(e){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this._flatMeasurements=null,this.itemSizeCache=new Map,this.itemSizeCacheVersion=0,this.laneAssignments=new Map,this.pendingMin=null,this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.pendingScrollAnchor=null,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._intendedScrollOffset=null,this.elementsCache=new Map,this.now=()=>{var e;return((e=this.targetWindow?.performance)?.now)?.call(e)??Date.now()},this.observer=(()=>{let e=null,t=()=>e||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:e=new this.targetWindow.ResizeObserver(e=>{e.forEach(e=>{let t=()=>{let t=e.target,n=this.indexFromElement(t);if(!t.isConnected){this.observer.unobserve(t);for(let[e,n]of this.elementsCache)if(n===t){this.elementsCache.delete(e);break}return}this.shouldMeasureDuringScroll(n)&&this.resizeItem(n,this.options.measureElement(t,e,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(t):t()})}));return{disconnect:()=>{var n;(n=t())==null||n.disconnect(),e=null},observe:e=>t()?.observe(e,{box:`border-box`}),unobserve:e=>t()?.unobserve(e)}})(),this.range=null,this.setOptions=e=>{let t={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:l1,rangeExtractor:u1,onChange:()=>{},measureElement:g1,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:`data-index`,initialMeasurementsCache:[],lanes:1,anchorTo:`start`,followOnAppend:!1,scrollEndThreshold:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:`estimate`,useCachedMeasurements:!1};for(let n in e){let r=e[n];r!==void 0&&(t[n]=r)}let n=this.options,r=null,i=null,a=!1;if(n!==void 0&&n.enabled&&t.enabled&&t.anchorTo===`end`&&this.scrollElement!==null){let e=n.count,o=t.count,s=this.getMeasurements(),c=e>0?s[0]?.key??n.getItemKey(0):null,l=e>0?s[e-1]?.key??n.getItemKey(e-1):null;if(o!==e||e>0&&o>0&&(t.getItemKey(0)!==c||t.getItemKey(o-1)!==l)){a=!0;let c=e>0?this.getVirtualItemForOffset(this.getScrollOffset())??s[0]:null;c&&(r=[c.key,this.getScrollOffset()-c.start]);let u=t.followOnAppend===!0?`auto`:t.followOnAppend||null;u&&o>e&&this.isAtEnd(n.scrollEndThreshold)&&(e===0||t.getItemKey(o-1)!==l)&&(i=u)}}this.options=t,a&&(this.pendingMin=0,this.itemSizeCacheVersion++);let o=!1,s=0;if(r&&this.scrollOffset!==null){let[e,t]=r,n=this.getMeasurements(),{count:i,getItemKey:a}=this.options,c=0;for(;c<i&&a(c)!==e;)c++;if(c<i){let e=n[c];if(e){let n=e.start+t;n!==this.scrollOffset&&(s=n-this.scrollOffset,this.scrollOffset=n,o=!0)}}}(o||i)&&(this.pendingScrollAnchor=[o?r[0]:null,o?r[1]:0,i,s])},this.notify=e=>{var t,n;(n=(t=this.options).onChange)==null||n.call(t,this,e)},this.maybeNotify=n1(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),e=>{this.notify(e)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(e=>e()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{let e=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==e){if(this.cleanup(),!e){this.maybeNotify();return}if(this.scrollElement=e,this.scrollElement&&`ownerDocument`in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=this.scrollElement?.window??null,this.elementsCache.forEach(e=>{this.observer.observe(e)}),this.unsubs.push(this.options.observeElementRect(this,e=>{this.scrollRect=e,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(e,t)=>{if(t&&this._intendedScrollOffset===null&&e===this.scrollOffset)return;this._intendedScrollOffset!==null&&Math.abs(e-this._intendedScrollOffset)<1.5&&(e=this._intendedScrollOffset),this._intendedScrollOffset=null,this.scrollAdjustments=0;let n=this.getScrollOffset();this.scrollDirection=t?n===e?this.scrollDirection:n<e?`forward`:`backward`:null,this.scrollOffset=e,this.isScrolling=t,this._flushIosDeferredIfReady(),this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),`addEventListener`in this.scrollElement){let e=this.scrollElement,t=()=>{this._iosTouching=!0,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)},n=()=>{this._iosTouching=!1,!(!s1()||this.targetWindow==null)&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};e.addEventListener(`touchstart`,t,f1),e.addEventListener(`touchend`,n,f1),this.unsubs.push(()=>{e.removeEventListener(`touchstart`,t),e.removeEventListener(`touchend`,n),this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)})}this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}let t=this.pendingScrollAnchor;if(this.pendingScrollAnchor=null,t&&this.scrollElement&&this.options.enabled){let[e,n,r,i]=t;e!==null&&!r&&(s1()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?i!==0&&(this._iosDeferredAdjustment+=i):this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})),r&&this.scrollToEnd({behavior:r})}},this._flushIosDeferredIfReady=()=>{if(this._iosDeferredAdjustment===0||this.isScrolling||this._iosTouching||this._iosJustTouchEnded)return;let e=this.getScrollOffset(),t=this.getMaxScrollOffset();if(e<0||e>t)return;let n=this._iosDeferredAdjustment;this._iosDeferredAdjustment=0,this._scrollToOffset(e,{adjustments:this.scrollAdjustments+=n,behavior:void 0})},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?`width`:`height`]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset==`function`?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getMeasurementOptions=n1(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode,this.options.gap],(e,t,n,r,i,a,o,s)=>(this.prevLanes!==void 0&&this.prevLanes!==a&&(this.lanesChangedFlag=!0),this.prevLanes=a,this.pendingMin=null,{count:e,paddingStart:t,scrollMargin:n,getItemKey:r,enabled:i,lanes:a,laneAssignmentMode:o,gap:s}),{key:!1}),this.getMeasurements=n1(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:e,paddingStart:t,scrollMargin:n,getItemKey:r,enabled:i,lanes:a,laneAssignmentMode:o,gap:s},c)=>{let l=this.itemSizeCache;if(!i)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>e)for(let t of this.laneAssignments.keys())t>=e&&this.laneAssignments.delete(t);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMin=null),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(e=>{this.itemSizeCache.set(e.key,e.size)}));let u=this.lanesSettling?0:this.pendingMin??0;if(this.pendingMin=null,this.lanesSettling&&this.measurementsCache.length===e&&(this.lanesSettling=!1),a===1){let i=e*2,a=this._flatMeasurements;if(!a||a.length<i){let e=new Float64Array(i);a&&u>0&&e.set(a.subarray(0,u*2)),a=e,this._flatMeasurements=a}let o;if(u===0)o=t+n;else{let e=u-1;o=a[e*2]+a[e*2+1]+s}for(let t=u;t<e;t++){let e=r(t),n=l.get(e),i=typeof n==`number`?n:this.options.estimateSize(t);a[t*2]=o,a[t*2+1]=i,o+=i+s}let c=t1(e,a,r);return this.measurementsCache=c,c}let d=this.measurementsCache.slice(0,u),f=Array(a).fill(void 0),p=new Float64Array(a),m=0;for(let e=0;e<u;e++){let t=d[e];t&&(f[t.lane]===void 0&&m++,f[t.lane]=e,p[t.lane]=t.end)}for(let i=u;i<e;i++){let e=r(i),c=this.laneAssignments.get(i),u,h,g=o===`estimate`||l.has(e);if(c!==void 0&&this.options.lanes>1){u=c;let e=f[u],r=e===void 0?void 0:d[e];h=r?r.end+s:t+n}else if(m===a){let e=0,t=p[0],n=f[0];for(let r=1;r<a;r++){let i=p[r];(i<t||i===t&&f[r]<n)&&(e=r,t=i,n=f[r])}u=e,h=t+s,g&&this.laneAssignments.set(i,u)}else u=i%this.options.lanes,h=t+n,g&&this.laneAssignments.set(i,u);let _=l.get(e),v=typeof _==`number`?_:this.options.estimateSize(i),y=h+v;d[i]={index:i,start:h,size:v,end:y,key:e,lane:u},f[u]===void 0&&m++,f[u]=i,p[u]=y}return this.measurementsCache=d,d},{key:!1,debug:()=>this.options.debug}),this.calculateRange=n1(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(e,t,n,r)=>e.length===0||t===0?(this.range=null,null):(this.range=x1(e,t,n,r,r===1&&this._flatMeasurements!=null?this._flatMeasurements:null),this.range),{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=n1(()=>{let e=null,t=null,n=this.calculateRange();return n&&(e=n.startIndex,t=n.endIndex),this.maybeNotify.updateDeps([this.isScrolling,e,t]),[this.options.rangeExtractor,this.options.overscan,this.options.count,e,t]},(e,t,n,r,i)=>r===null||i===null?[]:e({startIndex:r,endIndex:i,overscan:t,count:n}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=e=>{let t=this.options.indexAttribute,n=e.getAttribute(t);return n?parseInt(n,10):(console.warn(`Missing attribute name '${t}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=e=>{if(!this.scrollState||this.scrollState.behavior!==`smooth`)return!0;let t=this.scrollState.index??this.getVirtualItemForOffset(this.scrollState.lastTargetOffset)?.index;if(t!==void 0&&this.range){let n=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),r=Math.max(0,t-n),i=Math.min(this.options.count-1,t+n);return e>=r&&e<=i}return!0},this.measureElement=e=>{if(!e){this.elementsCache.forEach((e,t)=>{e.isConnected||(this.observer.unobserve(e),this.elementsCache.delete(t))});return}let t=this.indexFromElement(e),n=this.options.getItemKey(t),r=this.elementsCache.get(n);r!==e&&(r&&this.observer.unobserve(r),this.observer.observe(e),this.elementsCache.set(n,e)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(t)&&this.resizeItem(t,this.options.measureElement(e,void 0,this))},this.resizeItem=(e,t)=>{if(e<0||e>=this.options.count)return;let n,r,i,a=this._flatMeasurements;if(this.options.lanes===1&&a!==null)i=this.options.getItemKey(e),r=a[e*2],n=a[e*2+1];else{let t=this.measurementsCache[e];if(!t)return;i=t.key,r=t.start,n=t.size}let o=t-(this.itemSizeCache.get(i)??n);if(o!==0){let a=this.options.anchorTo===`end`&&this.scrollState?.behavior!==`smooth`&&this.getVirtualDistanceFromEnd()<=this.options.scrollEndThreshold,s=a?this.getTotalSize():0,c=this.scrollState?.behavior!==`smooth`&&(this.shouldAdjustScrollPositionOnItemSizeChange===void 0?r<this.getScrollOffset()+this.scrollAdjustments&&(!this.itemSizeCache.has(i)||this.scrollDirection!==`backward`):this.shouldAdjustScrollPositionOnItemSizeChange(this.measurementsCache[e]??{index:e,key:i,start:r,size:n,end:r+n,lane:0},o,this));(this.pendingMin===null||e<this.pendingMin)&&(this.pendingMin=e),this.itemSizeCache.set(i,t),this.itemSizeCacheVersion++,a?this.applyScrollAdjustment(this.getTotalSize()-s):c&&this.applyScrollAdjustment(o),this.notify(!1)}},this.getVirtualItems=n1(()=>[this.getVirtualIndexes(),this.getMeasurements()],(e,t)=>{let n=[];for(let r=0,i=e.length;r<i;r++){let i=t[e[r]];n.push(i)}return n},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=e=>{let t=this.getMeasurements();if(t.length===0)return;let n=this._flatMeasurements,r=this.options.lanes===1&&n!=null;return r1(t[y1(0,t.length-1,r?e=>n[e*2]:e=>r1(t[e]).start,e)])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if(`scrollHeight`in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{let e=this.scrollElement.document.documentElement;return this.options.horizontal?e.scrollWidth-this.scrollElement.innerWidth:e.scrollHeight-this.scrollElement.innerHeight}},this.getVirtualDistanceFromEnd=()=>Math.max(this.getTotalSize()-this.getSize()-this.getScrollOffset(),0),this.getDistanceFromEnd=()=>Math.max(this.getMaxScrollOffset()-this.getScrollOffset(),0),this.isAtEnd=(e=this.options.scrollEndThreshold)=>this.getDistanceFromEnd()<=e,this.getOffsetForAlignment=(e,t,n=0)=>{if(!this.scrollElement)return 0;let r=this.getSize(),i=this.getScrollOffset();t===`auto`&&(t=e>=i+r?`end`:`start`),t===`center`?e+=(n-r)/2:t===`end`&&(e-=r);let a=this.getMaxScrollOffset();return Math.max(Math.min(a,e),0)},this.getOffsetForIndex=(e,t=`auto`)=>{e=Math.max(0,Math.min(e,this.options.count-1));let n=this.getSize(),r=this.getScrollOffset(),i=this.measurementsCache[e];if(!i)return;if(t===`auto`)if(i.end>=r+n-this.options.scrollPaddingEnd)t=`end`;else if(i.start<=r+this.options.scrollPaddingStart)t=`start`;else return[r,t];if(t===`end`&&e===this.options.count-1)return[this.getMaxScrollOffset(),t];let a=t===`end`?i.end+this.options.scrollPaddingEnd:i.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(a,t,i.size),t]},this.scrollToOffset=(e,{align:t=`start`,behavior:n=`auto`}={})=>{let r=this.getOffsetForAlignment(e,t);this.scrollState={index:null,align:t,behavior:n,startedAt:this.now(),lastTargetOffset:r,stableFrames:0},this._scrollToOffset(r,{adjustments:void 0,behavior:n}),this.scheduleScrollReconcile()},this.scrollToIndex=(e,{align:t=`auto`,behavior:n=`auto`}={})=>{e=Math.max(0,Math.min(e,this.options.count-1));let r=this.getOffsetForIndex(e,t);if(!r)return;let[i,a]=r,o=this.now();this.scrollState={index:e,align:a,behavior:n,startedAt:o,lastTargetOffset:i,stableFrames:0},this._scrollToOffset(i,{adjustments:void 0,behavior:n}),this.scheduleScrollReconcile()},this.scrollBy=(e,{behavior:t=`auto`}={})=>{let n=this.getScrollOffset()+e;this.scrollState={index:null,align:`start`,behavior:t,startedAt:this.now(),lastTargetOffset:n,stableFrames:0},this._scrollToOffset(n,{adjustments:void 0,behavior:t}),this.scheduleScrollReconcile()},this.scrollToEnd=({behavior:e=`auto`}={})=>{if(this.options.count>0){this.scrollToIndex(this.options.count-1,{align:`end`,behavior:e});return}this.scrollToOffset(Math.max(this.getTotalSize()-this.getSize(),0),{behavior:e})},this.getTotalSize=()=>{let e=this.getMeasurements(),t;if(e.length===0)t=this.options.paddingStart;else if(this.options.lanes===1){let n=e.length-1,r=this._flatMeasurements;t=r==null?e[n]?.end??0:r[n*2]+r[n*2+1]}else{let n=Array(this.options.lanes).fill(null),r=e.length-1;for(;r>=0&&n.some(e=>e===null);){let t=e[r];n[t.lane]===null&&(n[t.lane]=t.end),r--}t=Math.max(...n.filter(e=>e!==null))}return Math.max(t-this.options.scrollMargin+this.options.paddingEnd,0)},this.takeSnapshot=()=>{let e=[];if(this.itemSizeCache.size===0)return e;let t=this.getMeasurements();for(let n of t)n&&this.itemSizeCache.has(n.key)&&e.push({index:n.index,key:n.key,start:n.start,size:n.size,end:n.end,lane:n.lane});return e},this._scrollToOffset=(e,{adjustments:t,behavior:n})=>{this._intendedScrollOffset=e+(t??0),this.options.scrollToFn(e,{behavior:n,adjustments:t},this)},this.measure=()=>{this.pendingMin=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.itemSizeCacheVersion++,this.notify(!1)},this.setOptions(e)}applyScrollAdjustment(e,t){e!==0&&(s1()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?this._iosDeferredAdjustment+=e:(this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=e,behavior:t}),this.scrollOffset!==null&&(this.scrollOffset+=this.scrollAdjustments,this.scrollAdjustments=0)))}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId??=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()})}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}let e=this.scrollState.index==null?void 0:this.getOffsetForIndex(this.scrollState.index,this.scrollState.align),t=e?e[0]:this.scrollState.lastTargetOffset,n=t!==this.scrollState.lastTargetOffset;if(!n&&i1(t,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=1){this.getScrollOffset()!==t&&this._scrollToOffset(t,{adjustments:void 0,behavior:`auto`}),this.scrollState=null;return}}else if(this.scrollState.stableFrames=0,n){let e=this.getSize()||600,n=Math.abs(t-this.getScrollOffset()),r=this.scrollState.behavior===`smooth`&&n>e;this.scrollState.lastTargetOffset=t,r||(this.scrollState.behavior=`auto`),this._scrollToOffset(t,{adjustments:void 0,behavior:r?`smooth`:`auto`})}this.scheduleScrollReconcile()}},y1=(e,t,n,r)=>{for(;e<=t;){let i=(e+t)/2|0,a=n(i);if(a<r)e=i+1;else if(a>r)t=i-1;else return i}return e>0?e-1:0};function b1(e,t,n){let r=0;for(;r<=t;){let i=(r+t)/2|0,a=e[i*2];if(a<n)r=i+1;else if(a>n)t=i-1;else return i}return r>0?r-1:0}function x1(e,t,n,r,i){let a=e.length-1;if(e.length<=r)return{startIndex:0,endIndex:a};if(r===1&&i!==null){let e=b1(i,a,n),r=e,o=n+t;for(;r<a&&i[r*2]+i[r*2+1]<o;)r++;return{startIndex:e,endIndex:r}}let o=y1(0,a,t=>e[t].start,n),s=o;if(r===1)for(;s<a&&e[s].end<n+t;)s++;else if(r>1){let i=Array(r).fill(0);for(;s<a&&i.some(e=>e<n+t);){let t=e[s];i[t.lane]=t.end,s++}let c=Array(r).fill(n+t);for(;o>=0&&c.some(e=>e>=n);){let t=e[o];c[t.lane]=t.start,o--}o=Math.max(0,o-o%r),s=Math.min(a,s+(r-1-s%r))}return{startIndex:o,endIndex:s}}var S1=typeof document<`u`?V.useLayoutEffect:V.useEffect;function C1({useFlushSync:e=!0,directDomUpdates:t=!1,directDomUpdatesMode:n=`transform`,...r}){let i=V.useReducer(e=>e+1,0)[1],a=V.useRef({enabled:t,mode:n,container:null,lastSize:null,lastPositions:new WeakMap,prevRange:null});a.current.enabled=t,a.current.mode=n;let o=e=>{let t=a.current;if(!t.enabled||!t.container)return;let n=e.getTotalSize();if(n!==t.lastSize){t.lastSize=n;let r=e.options.horizontal?`width`:`height`;t.container.style[r]=`${n}px`}let r=!!e.options.horizontal,i=t.mode===`transform`,o=r?`left`:`top`,s=e.options.scrollMargin,c=e.getVirtualItems();for(let n of c){let a=n.start-s,c=e.elementsCache.get(n.key);c&&t.lastPositions.get(c)!==a&&(t.lastPositions.set(c,a),i?c.style.transform=r?`translate3d(${a}px, 0, 0)`:`translate3d(0, ${a}px, 0)`:c.style[o]=`${a}px`)}},s={...r,onChange:(t,n)=>{var s;let c=a.current,l=!0;if(c.enabled){o(t);let e=t.range,n=c.prevRange;l=!n||n.isScrolling!==t.isScrolling||n.startIndex!==e?.startIndex||n.endIndex!==e?.endIndex,l&&(c.prevRange=e?{startIndex:e.startIndex,endIndex:e.endIndex,isScrolling:t.isScrolling}:null)}l&&(e&&n?(0,JE.flushSync)(i):i()),(s=r.onChange)==null||s.call(r,t,n)}},[c]=V.useState(()=>{let e=new v1(s);return Object.assign(e,{containerRef:t=>{let n=a.current;if(n.container=t,n.lastSize=null,t&&n.enabled){let r=e.getTotalSize();n.lastSize=r;let i=e.options.horizontal?`width`:`height`;t.style[i]=`${r}px`}}})});return c.setOptions(s),S1(()=>c._didMount(),[]),S1(()=>c._willUpdate()),S1(()=>{o(c)}),c}function w1(e){return C1({observeElementRect:d1,observeElementOffset:h1,scrollToFn:_1,...e})}var T1=180;function E1(e){let{activeRowKey:t,focusedRowKey:n,rows:r,scrollRef:i}=e,a=(0,V.useMemo)(()=>r.flatMap((e,r)=>e.key===t||e.key===n?[r]:[]),[t,n,r]),o=(0,V.useCallback)(e=>[...new Set([...u1(e),...a])].sort((e,t)=>e-t),[a]),s=(0,V.useRef)(null),c=w1({anchorTo:`end`,count:r.length,directDomUpdates:!0,estimateSize:()=>T1,getItemKey:e=>r[e]?.key??e,getScrollElement:()=>i.current,initialOffset:()=>r.length*T1,initialRect:{width:0,height:800},overscan:8,rangeExtractor:o,scrollToFn:(e,t,n)=>{let r=s.current;r&&(r.style.height=`${n.getTotalSize()}px`),_1(e,t,n)}});return c.shouldAdjustScrollPositionOnItemSizeChange=e=>e.end<=(c.scrollOffset??0),{containerRef:(0,V.useCallback)(e=>{s.current=e,c.containerRef(e)},[c]),virtualizer:c}}function D1(e,t){if(t.length===0)return e;let n=e[e.length-1];return n?.type===`text`?[...e.slice(0,-1),{...n,text:n.text+t}]:[...e,{type:`text`,text:t}]}function O1(e){return e?.type===`token`&&!!pW(e)}function k1(e){let{index:t,nodes:n,tokenText:r}=e,i=n[t-1],a=n[t+1],o=i?.type===`text`&&/\S$/.test(i.text)||O1(i),s=a?.type===`text`&&/^\S/.test(a.text)||O1(a);return`${o?` `:``}${r}${s?` `:``}`}function A1(e){return Vh(e)}function j1(e){return Wh(e)}function M1(e){return Gh(e,`skill`)}function N1(e){return Gh(e,`file`)}function P1(e,t,n){let r=new Set(t),i=Qh(e,e=>e.tokenKind===`skill`&&!r.has(e.tokenKey)),a=Gh(i,`skill`),o=new Map(n.map(e=>[e.ref,e])),s=t.filter(e=>!a.includes(e)).map(e=>Rh({tokenKind:`skill`,tokenKey:e,label:o.get(e)?.name||e}));return s.length===0?i:Hh([...i,...s])}function F1(e,t){let n=new Set(N1(e));return t.filter(e=>n.has(e.id))}function I1(e,t){let n=new Map(t.map(e=>[e.id,e])),r=[];for(let[t,i]of e.entries()){if(i.type===`text`){r=D1(r,i.text);continue}let a=pW(i);if(a){r=D1(r,k1({index:t,nodes:e,tokenText:a}));continue}if(i.tokenKind!==`file`)continue;let o=n.get(i.tokenKey);o&&r.push({type:`file`,name:o.name,mimeType:o.mimeType,...o.assetUri?{assetUri:o.assetUri}:{},...o.url?{url:o.url}:{},...o.contentBase64?{contentBase64:o.contentBase64}:{},sizeBytes:o.sizeBytes})}return r}function L1(e){if(!Array.isArray(e))return[];let t=new Set;for(let n of e){let e=n.trim();e&&t.add(e)}return[...t]}function R1(e,t){return e?Object.fromEntries(t.map(t=>[t,e])):{}}function z1(e){let t=_l(e.projectRoot),n={...R1(e.model?.trim(),[`model`,`preferred_model`]),...R1(e.thinkingLevel?.trim(),[`thinkingEffort`,`thinking`,`preferred_thinking`]),...R1(e.sessionType?.trim(),[`agentRuntimeId`,`session_type`,`runtime`]),...R1(e.agentId?.trim(),[`agentId`,`agent_id`]),...R1(t??void 0,[`projectRoot`,`project_root`])},r=L1(e.requestedSkills);r.length>0&&(n.requested_skill_refs=r);let i=e.composerNodes?yW(e.composerNodes,e.skillRecords):[];return i.length>0&&(n[ee]=BW(i)),e.sessionMaterialization&&(n[d]=e.sessionMaterialization),n}function B1(e){return e.some(e=>e.type===`text`||e.type===`rich-text`||e.type===`reasoning`?e.text.trim().length>0:!0)}function V1({disabled:e,messageId:t,onCancel:n,onChange:r,onSave:i,snapshot:a}){let o=(0,V.useRef)(null),s=(0,V.useRef)([...a.nodes]),c=I1([...a.nodes],a.attachments),l=(0,V.useCallback)(e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),n())},[n]);return(0,V.useLayoutEffect)(()=>{o.current?.focusComposerAtEnd(s.current)},[t]),(0,H.jsxs)(`div`,{className:`w-full min-w-[min(32rem,76vw)] overflow-hidden rounded-xl border border-border bg-card shadow-sm`,onKeyDownCapture:l,children:[(0,H.jsx)(oO,{ref:o,actions:{canStopGeneration:!1,isSending:e,onSend:i,onStop:()=>void 0},disabled:e,nodes:[...a.nodes],onNodesChange:e=>{let t=[...e];r({...a,attachments:F1(t,a.attachments),nodes:t,selectedSkills:M1(t),text:j1(t)})},placeholder:T(`chatEditMessagePlaceholder`)},t),(0,H.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-border/70 px-3 py-2`,children:[(0,H.jsx)(`button`,{type:`button`,className:`rounded-lg px-3 py-1.5 text-xs font-medium text-muted-foreground transition-colors hover:bg-[var(--interaction-hover)] hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,disabled:e,onClick:n,children:T(`chatEditMessageCancel`)}),(0,H.jsx)(`button`,{type:`button`,className:`rounded-lg bg-foreground px-3 py-1.5 text-xs font-medium text-background transition-opacity hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-40`,disabled:e||!B1(c),onClick:()=>void i(),children:T(`chatEditMessageSubmit`)})]})]})}function H1(e){let t=nq(e.messages),n=t.findLast(e=>e.role===`user`),r=t.at(-1);return{continuationAssistantMessageId:e.canContinue&&r?.role===`assistant`?r.id:null,editableUserMessageId:e.isBusy?null:n?.id??null}}function U1(e,t){let n=[],r=0;for(;r<e.length;){let i=t.flatMap(t=>{let n=e.indexOf(t.rawText,r);return n<0?[]:[{index:n,token:t}]}).sort((e,t)=>e.index-t.index||t.token.rawText.length-e.token.rawText.length)[0];if(!i)return n.push(Lh(e.slice(r))),n;i.index>r&&n.push(Lh(e.slice(r,i.index))),n.push(Rh({tokenKind:i.token.kind,tokenKey:`ref`in i.token?i.token.ref:i.token.key,label:i.token.label,data:i.token.kind===`system_object`&&`reference`in i.token?{reference:i.token.reference}:void 0})),r=i.index+i.token.rawText.length}return n}function W1(e){let t=e.requested_skill_refs;return L1(Array.isArray(t)?t.filter(e=>typeof e==`string`):void 0)}function G1(e){let{attachmentIdPrefix:t,availableSkills:n,message:r}=e,i=e.metadata??r.metadata??{},a=FW(i),o=[],s=[];r.parts.forEach((e,n)=>{if(e.type===`text`||e.type===`rich-text`||e.type===`reasoning`){o.push(...U1(e.text,PW(e.text,a)));return}if(e.type!==`file`)return;let r=`${t}-${n}`,i={id:r,name:e.name??`attachment`,mimeType:e.mimeType??`application/octet-stream`,sizeBytes:e.sizeBytes??0,assetUri:e.assetUri,url:e.url,contentBase64:e.contentBase64};s.push(i),o.push(Rh({tokenKind:`file`,tokenKey:r,label:i.name,previewUrl:i.mimeType.startsWith(`image/`)?i.url:void 0}))});let c=Hh(o),l=W1(i),u=new Map(n.map(({ref:e,name:t})=>[e,t]));return{text:j1(c),nodes:c,selectedSkills:l,skillRecords:l.map(e=>({ref:e,name:u.get(e)??e})),attachments:s}}function K1(){return`edited-message-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`}function q1(e){return e.some(e=>e.type===`text`||e.type===`rich-text`||e.type===`reasoning`?e.text.trim().length>0:!0)}function J1(e,t){let n={...e.metadata};delete n.requested_skill_refs,delete n[ee];let r=FW(e.metadata).flatMap(e=>e.kind===`skill`&&`ref`in e&&e.source&&e.path?[{name:e.name,path:e.path,ref:e.ref,source:e.source}]:[]);return Object.assign(n,z1({composerNodes:[...t.nodes],requestedSkills:[...t.selectedSkills],skillRecords:r})),Object.keys(n).length>0?n:void 0}function Y1({adaptedMessages:e,canContinue:t,disabled:n,onContinueRun:r,onEditMessage:i,rawMessages:a}){let o=(0,V.useMemo)(()=>H1({canContinue:t,isBusy:n,messages:a}),[t,n,a]),s=(0,V.useMemo)(()=>e.map(e=>{let t=[];return i&&e.id===o.editableUserMessageId&&t.push({disabled:n,icon:`edit`,key:`edit-message`,label:T(`chatEditMessage`)}),r&&e.id===o.continuationAssistantMessageId&&t.push({disabled:n,icon:`continue`,key:`continue-run`,label:T(`chatContinueRun`)}),t.length>0?{...e,actions:t}:e}),[o,e,n,r,i]),[c,l]=(0,V.useState)(null),u=(0,V.useCallback)((e,t)=>{if(t.key===`continue-run`){Promise.resolve(r?.()).catch(()=>void 0);return}if(t.key!==`edit-message`||!i)return;let n=a.find(t=>t.id===e.id);n&&l({message:n,snapshot:G1({attachmentIdPrefix:`edited-attachment-${n.id}`,availableSkills:[],message:n})})},[r,i,a]),d=(0,V.useCallback)(async()=>{if(!c||!i)return;let e=I1([...c.snapshot.nodes],c.snapshot.attachments);q1(e)&&(await i({messageId:c.message.id,message:{...c.message,id:K1(),metadata:J1(c.message,c.snapshot),parts:e,role:`user`,status:`final`,timestamp:new Date().toISOString()}}),l(null))},[c,i]);return{handleMessageAction:u,messages:s,renderMessageContent:(0,V.useCallback)(e=>c?.message.id===e.id?(0,H.jsx)(V1,{disabled:n,messageId:c.message.id,onCancel:()=>l(null),onChange:e=>l(t=>t?{...t,snapshot:e}:null),onSave:d,snapshot:c.snapshot}):void 0,[n,c,d])}}function X1(e){let{selectedSession:t,sessionKey:n}=e,r=il(),i=q9(),a=t?.projectRoot??t?.workingDir,o=(0,V.useCallback)(e=>{if(e.kind===`ui_resource`&&`key`in e){i.docBrowserManager.open(e.key);return}if(e.kind===`panel_app`&&`key`in e){r.chatUiManager.showContent({target:{type:`panel_app`,payload:{appId:e.key}}});return}if(`key`in e&&(e.kind===`project`||e.kind===`workspace_file`||e.kind===`workspace_directory`)){let t=e.kind===`project`?e.key:DW({projectRoot:a,relativePath:e.key});t&&r.chatThreadManager.openFilePreview({path:t,label:e.label,viewMode:`preview`});return}if(e.kind===`workspace_excerpt`&&`excerpt`in e){let t=DW({projectRoot:a,relativePath:e.path});t&&r.chatThreadManager.openFilePreview({path:t,label:e.label,line:e.startLine??void 0,viewMode:`preview`});return}if(e.kind!==`skill`||!(`ref`in e))return;let o=e.path?.trim();if(o){r.chatThreadManager.openFilePreview({path:o,label:e.label||e.name,viewMode:`preview`,previewViewer:`rendered`});return}if(!n){L.error(T(`chatSkillPreviewUnavailable`));return}Ie(n,{projectRoot:t?.projectRoot??null}).then(({records:t})=>{let n=t.find(t=>t.ref===e.ref),i=t.filter(t=>t.name===e.name),a=n??(i.length===1?i[0]:null),o=a?.path.trim();if(!a||!o){L.error(T(`chatSkillPreviewUnavailable`));return}r.chatThreadManager.openFilePreview({path:o,label:e.label||a.name,viewMode:`preview`,previewViewer:`rendered`})}).catch(()=>L.error(T(`chatSkillPreviewUnavailable`)))},[i.docBrowserManager,r,a,t?.projectRoot,n]);return{handleAttachmentOpen:(0,V.useCallback)(e=>{let t=e.dataUrl?.trim();if(!t)return;let n=e.label.trim()||`attachment`;r.chatThreadManager.openFilePreview({path:n,label:n,viewMode:`preview`,contentUrl:t,mimeType:e.mimeType})},[r]),handleInlineTokenClick:o}}var Z1=new class{constructor(){this.cache=new WeakMap,this.adapt=e=>{let{continuationRunning:t,executionLabels:n,language:r,processedLabel:i,rawMessages:a,texts:o}=e;return nq(a,{continuationRunning:t}).map(e=>{let t=Eq({message:e,processedLabel:i}),a=t?.label??null,s=Aq({message:e,labels:n}),c=s?.cacheKey??null,l=this.cache.get(e);if(l&&l.language===r&&l.processSummaryLabel===a&&l.executionPresentationKey===c)return l.viewModel;let u=Zl(e),d=xq({id:u.id,role:u.role,meta:{timestamp:u.meta?.timestamp,status:u.meta?.status,inlineTokens:FW(e.metadata),processSummary:t,executionSummaryLabel:s?.summaryLabel,moreActions:s?.moreActions},parts:Yl(e.parts)},{formatTimestamp:e=>j(e,r),texts:o});return this.cache.set(e,{language:r,processSummaryLabel:a,executionPresentationKey:c,viewModel:d}),d})}}};function Q1(e){if(e.target.type===`panel_app`)return(0,H.jsx)(q$,{panelApp:{appId:e.target.payload.appId,params:e.target.payload.params,path:e.target.payload.path,title:e.title}})}var $1=e=>(0,H.jsx)(bf,{agentId:e,className:`h-4 w-4 shrink-0`}),e0=e=>(0,H.jsx)(q$,{panelApp:e}),t0=8e3;function n0(e){let t=e.commonAncestorContainer;return(t instanceof Element?t:t.parentElement)?.closest(`[data-chat-message-selectable="true"]`)??null}function r0(e,t){return e.kind===`typing`||e.key===t}function i0({canContinue:e=!1,messages:t,isSending:n,messageActionsDisabled:r=!1,onContinueRun:i,onEditMessage:a,scrollRef:o,sessionKey:s,className:l}){let u=il(),{language:d}=Nn(),f=e1(e=>e.layout),p=xd(s),m=du(e=>e.snapshot.selectedAgentId),h=nd(e=>e.snapshot.sessionTypesQuery?.data??null),g=Ou(p?.sessionType??h?.defaultType),_=g!==`native`||(p?.agentId??m).trim().toLowerCase()!==`main`,v=ju(h?.options??[]).find(e=>e.value===g),y=v?.icon?.src?.trim()?(0,H.jsx)(Ju,{icon:{kind:`runtime-image`,src:v.icon.src,alt:v.icon.alt??null,name:v.label},className:`h-[65%] w-[65%]`}):void 0,b=p?.workingDir??p?.projectRoot??null,x=(0,V.useCallback)(e=>{let t=Q1(e);if(t)return t;if(e.target.type===`file`)return(0,H.jsx)(dY,{display:e,parentSessionKey:s,sessionProjectRoot:p?.projectRoot??null,sessionWorkingDir:b,onFileOpen:u.chatThreadManager.openFilePreview})},[b,u.chatThreadManager,p?.projectRoot,s]),S=(0,V.useCallback)(e=>sn(e.path,b),[b]),C=(0,V.useMemo)(()=>jq(d),[d]),w=(0,V.useMemo)(()=>Nq(d),[d]),{handleMessageAction:E,messages:D,renderMessageContent:O}=Y1({adaptedMessages:(0,V.useMemo)(()=>Z1.adapt({continuationRunning:n,executionLabels:w,language:d,processedLabel:T(`chatProcessSummaryProcessed`),rawMessages:t,texts:C}),[w,n,d,t,C]),canContinue:e,disabled:r,onContinueRun:i,onEditMessage:a,rawMessages:t}),k=D.findLast(e=>e.role===`assistant`&&(e.status===`streaming`||e.status===`pending`)),A=!!k,j=(0,V.useMemo)(()=>Pq(d),[d]),M=(0,V.useCallback)(({range:e})=>!!n0(e),[]),N=(0,V.useCallback)(({range:e,text:t})=>{let n=n0(e),r=n?.dataset.chatMessageId?.trim(),i=n?.dataset.chatMessageRole,a=n?.dataset.chatMessageRoleLabel?.trim();!r||!a||i!==`assistant`&&i!==`user`||u.chatComposerIntentManager.requestConversationExcerptReference({targetSessionKey:s,messageId:r,role:i,label:a,excerpt:t})},[u.chatComposerIntentManager,s]),P=(0,V.useMemo)(()=>aq({rawMessages:t,messages:D}),[D,t]),ee=(0,V.useMemo)(()=>n&&!A?[...P,{kind:`typing`,key:`typing`}]:P,[A,n,P]),[te,ne]=(0,V.useState)(null),re=k?`message:${k.id}`:null,{containerRef:F,virtualizer:ie}=E1({rows:ee,scrollRef:o,activeRowKey:re,focusedRowKey:te}),{handleAttachmentOpen:ae,handleInlineTokenClick:oe}=X1({selectedSession:p,sessionKey:s}),se=(0,V.useCallback)(e=>{e.currentTarget.contains(e.relatedTarget)||ne(null)},[]),ce=(0,V.useCallback)(e=>{if(e.customType!==`nextclaw.context-compaction`)return;let t=e.data;return(0,H.jsx)(J$,{checkpoint:t.checkpoint,inline:!0})},[]);return(0,H.jsx)(HU,{actionLabel:j.addSelectionToChatLabel??T(`chatWorkspaceAddToChat`),isSelectionAllowed:M,maxCharacters:t0,onAddToChat:N,selectionTooLongLabel:j.selectionTooLongLabel??T(`chatWorkspaceExcerptSelectionTooLong`),children:(0,H.jsx)(`div`,{className:c(`relative`,l),ref:F,children:ie.getVirtualItems().map(e=>{let t=ee[e.index];return t?(0,H.jsx)(`div`,{"data-index":e.index,ref:ie.measureElement,onBlurCapture:se,onFocusCapture:()=>ne(t.key),className:`absolute left-0 top-0 w-full`,children:t.kind===`compaction`?(0,H.jsx)(J$,{checkpoint:t.checkpoint}):t.kind===`context-inheritance`?(0,H.jsx)(Y$,{inheritance:t.inheritance}):(0,H.jsx)(`div`,{className:t.kind===`message`?`pb-5`:void 0,children:(0,H.jsx)(PU,{assistantAvatarIcon:y,showAssistantHeader:_,layout:f,messages:t.kind===`message`?[t.message]:[],isSending:r0(t,re),hasAssistantDraft:A,texts:j,onToolAction:u.chatThreadManager.handleToolAction,onFileOpen:u.chatThreadManager.openFilePreview,onAttachmentOpen:ae,onInlineTokenClick:oe,onMessageAction:E,resolveFileContentUrl:S,renderCustomPart:ce,renderInlineDisplay:x,renderMessageContent:O,renderToolAgent:$1,renderPanelAppCard:e0})})},t.key):null})})})}function a0({children:e,className:t,width:n=`messages`}){let r=e1(e=>e.layout);return(0,H.jsx)(`div`,{"data-chat-conversation-track":r,"data-chat-conversation-track-width":n,className:c(`mx-auto w-full px-4 sm:px-6`,r===`flat`?n===`composer`?`max-w-[min(54rem,100%)]`:`max-w-[min(52rem,100%)]`:`max-w-[min(1120px,100%)]`,t),children:e})}function o0({bottomSlot:e,canContinue:t=!1,isHistoryLoading:n,hasPreviousMessages:r,historyError:i,isLoadingPreviousMessages:a,isContextCompacting:o=!1,isSending:s,messageActionsDisabled:c=!1,messages:l,sessionKey:u,showWelcome:d,onLoadPreviousMessages:f,onContinueRun:p,onEditMessage:m,welcomeSlot:h}){let g=(0,V.useRef)(null),_=(0,V.useRef)(null),v=l.length>0||s,{isAtBottom:y,onScroll:b,scrollToBottom:x}=rV({contentRef:_,scrollRef:g,resetKey:u,isLoading:n,hasContent:v,contentVersion:l[l.length-1]??s}),S=l.length>0;return(0,H.jsxs)(`div`,{className:`relative min-h-0 flex-1`,children:[(0,H.jsx)(`div`,{ref:g,onScroll:(0,V.useCallback)(e=>{b(),e.currentTarget.scrollTop<=320&&r&&!a&&f()},[r,a,f,b]),"data-chat-scroll-container":`true`,className:d?`h-full overflow-y-auto custom-scrollbar`:`h-full overflow-y-auto custom-scrollbar ${Rc}`,style:{overflowAnchor:`none`},children:d?h??null:(0,H.jsxs)(`div`,{ref:_,className:`pb-7`,children:[v?(0,H.jsxs)(a0,{className:`relative py-4 sm:py-5`,children:[i?(0,H.jsx)(`div`,{role:`alert`,className:`flex h-8 justify-center`,children:(0,H.jsxs)(`button`,{type:`button`,"aria-label":T(`chatHistoryRetry`),className:`rounded px-1.5 text-xs text-foreground underline-offset-2 hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,onClick:()=>void f(),children:[T(`chatHistoryLoadFailed`),` · `,T(`chatHistoryRetry`)]})}):a?(0,H.jsx)(`span`,{"aria-hidden":`true`,className:`pointer-events-none absolute left-1/2 top-[13px] block h-1.5 w-1.5 -translate-x-1/2 animate-pulse rounded-full bg-muted-foreground/50 sm:top-[17px]`}):null,(0,H.jsx)(i0,{canContinue:t,messages:l,isSending:s,messageActionsDisabled:c,onContinueRun:p,onEditMessage:m,scrollRef:g,sessionKey:u}),o?(0,H.jsx)(J$,{}):null]}):null,e?(0,H.jsx)(a0,{className:`pb-4 sm:pb-5`,children:e}):null]})}),S&&!d&&!y?(0,H.jsx)(B,{icon:(0,H.jsx)(Wi,{className:`h-4 w-4`}),label:T(`chatScrollToBottom`),onClick:x,tooltipSide:`top`,className:`absolute bottom-4 left-1/2 z-10 h-9 w-9 -translate-x-1/2 rounded-full border border-border bg-background/90 text-foreground shadow-lg backdrop-blur hover:bg-[var(--interaction-hover)] hover:text-accent-foreground`}):null]})}function s0(e){let t=e.split(/\r?\n/),n=`message`,r=[];for(let e of t){let t=e.trimEnd();if(!(!t||t.startsWith(`:`))){if(t.startsWith(`event:`)){n=t.slice(6).trim()||`message`;continue}t.startsWith(`data:`)&&r.push(t.slice(5).trimStart())}}return r.length===0?null:{event:n,data:r.join(`
|
|
105
105
|
`)}}async function*c0(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}=l0(i);i=s;for(let e of o)yield e}i+=r.decode();let{frames:e}=l0(i,!0);for(let t of e)yield t}finally{n.releaseLock()}}function l0(e,t=!1){let n=e.split(/\r?\n\r?\n/),r=n.pop()??``,i=[];for(let e of n){let t=s0(e);t&&i.push(t)}if(t&&r.trim()){let e=s0(r);return e&&i.push(e),{frames:i,rest:``}}return{frames:i,rest:r}}var u0=`/ncp/agent`,d0=class extends Error{ncpError;alreadyPublished;constructor(e,t=!1){super(e.message),this.name=`NcpHttpAgentClientError(${e.code})`,this.ncpError=e,this.alreadyPublished=t}};function f0(e){let t=e.trim();if(!t)throw Error(`NcpHttpAgentClient requires a non-empty baseUrl.`);return new URL(t)}function p0(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 m0(e){let t=(e??`/ncp/agent`).trim();if(!t)return u0;let n=t.startsWith(`/`)?t:`/${t}`;return n.endsWith(`/`)?n.slice(0,-1):n}async function h0(e){try{return(await e.text()).trim()}catch{return``}}function g0(e){if(b0(e))return e.ncpError;if(v0(e))return e;let t=e instanceof Error?e.message:String(e??`Unknown error`);return{code:S0(void 0),message:t,...e instanceof Error&&e.stack?{details:{stack:e.stack}}:{}}}function _0(e,t={}){return new d0(e,t.alreadyPublished??!1)}function v0(e){return y0(e)&&typeof e.code==`string`&&typeof e.message==`string`}function y0(e){return!!e&&typeof e==`object`&&!Array.isArray(e)}function b0(e){return e instanceof d0}var x0={"config-error":`config-error`,"auth-error":`auth-error`,"runtime-error":`runtime-error`,"timeout-error":`timeout-error`,"abort-error":`abort-error`};function S0(e){if(!e)return`runtime-error`;let t=x0[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 C0(e){let t=T0(e);return!t||typeof t.type!=`string`||!t.type.trim()?null:t}function w0(e){let t=T0(e);if(!t)return{code:`runtime-error`,message:e||`Unknown stream error.`};let n=typeof t.code==`string`?t.code:void 0,r=S0(n),i=y0(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 T0(e){try{let t=JSON.parse(e);return y0(t)?t:null}catch{return null}}var E0=[`text`,`file`,`source`,`step-start`,`reasoning`,`tool-invocation`,`card`,`rich-text`,`action`,`extension`];function D0(e){return typeof e==`number`&&Number.isFinite(e)&&e>0?Math.trunc(e):null}var O0=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=f0(n),this.basePath=m0(t),this.fetchImpl=p0(i),this.defaultHeaders=a??{},this.streamOpenTimeoutMs=D0(s),this.streamIdleTimeoutMs=D0(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:E0,expectedLatency:`seconds`,metadata:{transport:`http+sse`,scope:`agent`}}}start=async()=>{this.started||(this.started=!0,this.publish(LK({type:IK.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 h0(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(b0(e))throw e;let n=g0(e);throw this.publish(LK({type:IK.EndpointError,payload:n})),_0(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 h0(n)}`)}catch(e){if(t.signal.aborted)return;let n=g0(e);throw this.publish(LK({type:IK.EndpointError,payload:n})),_0(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 h0(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 c0(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 b0(e)?e:_0(s??g0(e))}finally{c(),this.activeControllers.delete(a)}};handleSseFrame=e=>{if(e.event===`ncp-event`){let t=C0(e.data);if(!t){this.publish(LK({type:IK.EndpointError,payload:{code:`runtime-error`,message:`Received malformed ncp-event frame.`}}));return}this.publish(t);return}if(e.event===`error`){let t=w0(e.data);throw this.publish(LK({type:IK.EndpointError,payload:t})),_0(t,{alreadyPublished:!0})}}};function k0(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 A0(e){return k0(HK(e))}var j0=class{execution=null;get isEmpty(){return!this.execution}clear=()=>{this.execution=null};observe=e=>{let t=FK(e.metadata);t&&(!e.runId||e.runId===t.runId)&&(this.execution=structuredClone(t))};take=e=>{let t=this.execution;return this.execution=null,!t||e?.trim()&&t.runId!==e?null:t};attach=(e,t)=>t?{...e,metadata:{...e.metadata??{},[AK]:structuredClone(t)}}:e},M0=`__nextclaw_aborted_tool_call__`;function N0(e,t){switch(t.type){case IK.MessageSent:e.handleMessageSent(t.payload);break;case IK.MessageAbort:e.handleMessageAbort(t.payload,t.occurredAt);break;case IK.MessageFailed:e.handleMessageFailed(t.payload,t.occurredAt);break;case IK.MessageTextStart:e.handleMessageTextStart(t.payload);break;case IK.MessageTextDelta:e.handleMessageTextDelta(t.payload);break;case IK.MessageTextEnd:e.handleMessageTextEnd(t.payload);break;case IK.MessageReasoningStart:e.handleMessageReasoningStart(t.payload);break;case IK.MessageReasoningDelta:e.handleMessageReasoningDelta(t.payload);break;case IK.MessageReasoningEnd:e.handleMessageReasoningEnd(t.payload);break;case IK.MessageToolCallStart:e.handleMessageToolCallStart(t.payload);break;case IK.MessageToolCallArgs:e.handleMessageToolCallArgs(t.payload);break;case IK.MessageToolCallArgsDelta:e.handleMessageToolCallArgsDelta(t.payload);break;case IK.MessageToolCallEnd:e.handleMessageToolCallEnd(t.payload);break;case IK.MessageToolExecutionStarted:e.handleMessageToolExecutionStarted(t.payload,t.occurredAt);break;case IK.MessageToolCallResult:e.handleMessageToolCallResult(t.payload,t.occurredAt);break;case IK.RunStarted:e.handleRunStarted(t.payload,t.occurredAt);break;case IK.RunFinished:e.handleRunFinished(t.payload,t.occurredAt);break;case IK.RunError:e.handleRunError(t.payload,t.occurredAt);break;case IK.RunMetadata:e.handleRunMetadata(t.payload);break;case IK.ContextWindowUpdated:e.handleContextWindowUpdated(t.payload);break;case IK.EndpointError:e.handleEndpointError(t.payload,t.occurredAt);break;default:break}}function P0(e,t){let n=F0(e?.startedAt),r=F0(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 F0(e){if(!e)return;let t=Date.parse(e);return Number.isFinite(t)?new Date(t).toISOString():void 0}function I0(e,t){if(!e)return t;if(!t)return e;let n=P0(e),r=P0(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 L0(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 R0(e){if(!(!e.startedAt&&!e.endedAt))return{startedAt:e.startedAt,endedAt:e.endedAt}}function z0(e,t,n){let r=t===`error`||n?.endedAt?q0(e.parts,n?.endedAt).parts:e.parts;return n?{...e,status:t,parts:r,lifecycle:n}:{...e,status:t,parts:r}}function B0(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 V0(e,t){let n=[...e];return n.splice(B0(e,t),0,t),n}function H0(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=V0(i,A0(e)));return i}function U0(e,t){return t.trim()?e.id.startsWith(`tool-`)?!0:e.parts.some(e=>e.type===`tool-invocation`):!1}function W0(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 G0(e,t){return W0(e,t)?.toolName??null}function K0(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 q0(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 J0(e){return e.state===`result`||e.state===`cancelled`||!!e.execution?.endedAt||typeof e.execution?.durationMs==`number`}var Y0=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,M0))};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:K0(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:K0(t.parts,{type:`tool-invocation`,toolCallId:e.toolCallId,toolName:G0(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=F0(t);if(!n||this.port.updateMessageContainingToolCall(e.toolCallId,(e,t)=>{if(J0(t))return e.parts;let r=F0(t.execution?.startedAt),i=r&&Date.parse(r)<=Date.parse(n)?r:n;return K0(e.parts,{...t,execution:{...t.execution,startedAt:i}})}))return;let r=this.resolveToolCallTargetMessage(e.sessionId,e.toolCallId,e.messageId);this.port.replaceStreamingMessage({...r,parts:K0(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=P0(e.execution,n?t:void 0);if(this.port.updateMessageContainingToolCall(e.toolCallId,(t,i)=>i.state===`cancelled`||!n&&J0(i)?t.parts:K0(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:I0(i.execution,r)}:{}})))return;let i=this.resolveToolCallTargetMessage(e.sessionId,e.toolCallId);this.port.replaceStreamingMessage({...i,parts:K0(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=G0(i.parts,t)??`unknown`;this.port.replaceStreamingMessage({...i,parts:K0(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`)}},X0=`assistant`,Z0=class{messages=[];streamingMessage=null;error=null;activeRun=null;contextWindow=null;listeners=new Set;runExecution=new j0;toolCalls;lastSettledRunId=null;snapshotCache=null;snapshotVersion=-1;stateVersion=0;constructor(){this.toolCalls=new Y0({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,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.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,A0(e)])).values()],this.streamingMessage=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=H0(this.messages,this.streamingMessage,e);t!==this.messages&&(this.messages=t,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=>N0(this,e)),this.stateVersion!==t&&this.notifyListeners()};handleMessageSent=e=>{this.upsertMessage(e.message),this.setError(null)};handleMessageAbort=(e,t)=>{let n=e.messageId?.trim(),r=this.runExecution.take(e.runId??this.activeRun?.runId);if(this.clearActiveRun(),this.setError(null),this.streamingMessage&&(!n||this.streamingMessage.id===n)){let e=this.streamingMessage.id,{parts:i,toolCallIds:a}=q0(this.streamingMessage.parts,t);this.upsertMessage(this.runExecution.attach({...this.streamingMessage,status:`final`,parts:i},r)),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.clear(),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`,R0({...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`,R0({...e,endedAt:e.endedAt??t}),e.runId??this.activeRun?.runId),this.setError(L0(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=k0(this.messages[r]),i=[...this.messages];i.splice(r,1),this.messages=i,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&&U0(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:X0,status:n,parts:[],timestamp:new Date().toISOString()};return this.replaceStreamingMessage(a),a};updateMessageContainingToolCall=(e,t)=>{if(this.streamingMessage){let n=W0(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=W0(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=A0(e);this.streamingMessage?.id===t.id&&(this.streamingMessage=null);let n=this.messages.findIndex(e=>e.id===t.id);if(n<0){this.messages=V0(this.messages,t),this.stateVersion+=1;return}let r=[...this.messages];r[n]=t,this.messages=r,this.stateVersion+=1};replaceStreamingMessage=e=>{!e&&!this.streamingMessage||(this.streamingMessage=e?A0(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(z0(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)}},Q0=16,$0={code:`abort-error`,message:`User stopped the current run.`,details:{source:`chat-ui`}},e2=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()},Q0))},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 t2(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 n2(e){return e.parts.some(e=>e.type===`text`||e.type===`rich-text`||e.type===`reasoning`?e.text.trim().length>0:!0)}function r2(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(!n2(e.message))return null;let n=e.sessionId||e.message.sessionId||t;return{...e,...n?{sessionId:n}:{},message:{...e.message,...n?{sessionId:n}:{}}}}function i2(e,t){return{...e.message,sessionId:t}}function a2(e){let t=(0,V.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 Z0}):t.current={sessionId:e??null,manager:new Z0},t.current.manager}function o2({sessionId:e,client:t,manager:n}){let r=(0,V.useRef)(e),i=(0,V.useSyncExternalStore)(e=>n.subscribe(()=>e()),()=>n.getSnapshot(),()=>n.getSnapshot()),[a,o]=(0,V.useState)(null),[s,c]=(0,V.useState)(null);(0,V.useEffect)(()=>{r.current=e},[e]),(0,V.useEffect)(()=>{let e=new e2(n.dispatchBatch),i=t.subscribe(t=>{t2(t,r.current)&&e.enqueue(t)});return()=>{i(),e.dispose(),t.stop()}},[t,n]);let l=s&&(!e||s.sessionId===e)&&!i.messages.some(e=>e.id===s.id)?V0(i.messages,s):i.messages,u=i.streamingMessage?V0(l,i.streamingMessage):l,d=i.activeRun?.runId??null,f=!!i.activeRun,p=a===e,m=async(e,t)=>{e.runId!==null&&(n.clearError(),await n.dispatchBatch([...t?[{type:IK.MessageSent,payload:{sessionId:e.sessionId,message:t}}]:[],{type:IK.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=r2(r,e);if(!i)return null;n.clearError(),o(e);let a=i.sessionId?i2(i,i.sessionId):null,s=async()=>{c(null),a&&await n.dispatch({type:IK.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,i2(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:$0})},streamRun:async()=>{e&&(await t.stop(),await t.stream({sessionId:e}))}}}var s2=500,c2=1e4,l2=3;function u2(e){return e instanceof Error?e:Error(String(e))}function d2(e,t){let n=e.getSnapshot();return n.activeRun?.sessionId===t||n.streamingMessage?.sessionId===t||n.messages.some(e=>e.sessionId===t)}function f2(){return new Promise(e=>window.setTimeout(e,s2))}function p2(e,t,n){let r=e.consecutiveFailures+1;return n(!e.hasHydrated||r>=l2?u2(t):null),{...e,consecutiveFailures:r}}function m2(e,t,n){return t.stable?(n(null),{...e,consecutiveFailures:0}):p2(e,t.error,n)}async function h2(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?g2(o,s):o.messages;n.hydrate({sessionId:i,messages:l,activeRun:c?s.activeRun:o.status===`running`?{runId:null,sessionId:i,abortDisabledReason:null}:null})}function g2(e,t){let n=[...t.messages,...t.streamingMessage?[t.streamingMessage]:[]],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 _2(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>=c2}}async function v2(e,t,n){t.reset(),n(null),await e.stop()}function y2({sessionId:e,client:t,loadSeed:n}){let r=a2(e),i=o2({sessionId:e,client:t,manager:r}),[a,o]=(0,V.useState)({sessionId:null,error:null});(0,V.useEffect)(()=>{let i=new AbortController,{signal:a}=i,s=t=>{o({sessionId:e??null,error:t})};return(async()=>{if(!e){await v2(t,r,s);return}let i=!d2(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 h2({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=p2(c,e,s),await f2();continue}let o=Promise.resolve(),l=await _2({client:t,sessionId:e,signal:a,onOpen:()=>{o=h2({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=p2(c,e,s))})}});if(await o,!l)return;c=m2(c,l,s),i=!0,await f2()}})().catch(e=>{a.aborted||s(u2(e))}),()=>{i.abort()}},[t,n,r,e]);let s=(0,V.useCallback)(e=>r.prependHistory(e),[r]),c=(0,V.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 b2=200*1024*1024,x2=`application/octet-stream`;function S2(e){let t=e.type.trim().toLowerCase();return t.length>0?t:x2}function C2(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=S2(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 w2(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 T2(e,t){let n=[],r=[];for(let i of e){let e=C2(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:S2(e),sizeBytes:e.size,reason:`read-failed`}))),{attachments:[],rejected:r}}}function E2(e){return typeof e==`string`?e:e instanceof URL?e.toString():e.url}function D2(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 O2(e,t){let n=Error(e);return t!==void 0&&(n.cause=t),n}function k2(){return async(e,t)=>{try{return await fetch(e,{credentials:`include`,...t})}catch(n){throw Ae.reportTransportFailure(D2(n)),O2(`NCP fetch failed for ${(t?.method||`GET`).toUpperCase()} ${E2(e)}: ${D2(n)}`,n)}}}var A2={sessionId:null,contextWindow:null,total:0,cursor:null,hasPreviousPage:!1,isLoading:!1,error:null};function j2(e){return e instanceof Error&&e.message.includes(`ncp session not found:`)}async function M2(e,t,n=40){t.throwIfAborted();try{let r=await Pt(e,{limit:n,signal:t});return t.throwIfAborted(),{messages:r.messages,status:r.status??`idle`,contextWindow:r.contextWindow??null,total:r.total,pageInfo:r.pageInfo}}catch(e){if(t.throwIfAborted(),!j2(e))throw e;return{messages:[],status:`idle`,total:0,pageInfo:{startCursor:null,hasPreviousPage:!1}}}}function N2(e){let{hydrationRetryVersion:t,messageLimit:n,sessionId:r}=e,[i,a]=(0,V.useState)(A2),o=(0,V.useRef)(A2),s=(0,V.useRef)(null),c=(0,V.useCallback)((e,t)=>{let n=t(o.current.sessionId===e?o.current:{...A2,sessionId:e});o.current=n,a(n)},[]);return(0,V.useEffect)(()=>(s.current?.abort(),s.current=null,()=>s.current?.abort()),[r]),{loadSeed:(0,V.useCallback)(async(e,t)=>{let r=await M2(e,t,n);return t.aborted||c(e,e=>({...e,contextWindow:r.contextWindow??null,total:r.total,cursor:r.pageInfo.startCursor,hasPreviousPage:r.pageInfo.hasPreviousPage,error:null})),{messages:r.messages,status:r.status}},[t,n,c]),loadPreviousMessages:(0,V.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 Pt(r,{limit:n,cursor:t.cursor,signal:i.signal});if(i.signal.aborted||s.current!==i)return;e(a.messages),c(r,e=>({...e,contextWindow:a.contextWindow??e.contextWindow,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]),state:i.sessionId===r?i:A2}}var P2=`ncp agent unavailable during startup`,F2=15e3,I2=7e4;function L2(e){return e?.trim().toLowerCase().includes(P2)??!1}function R2(){return new O0({baseUrl:en,basePath:`/api/ncp/agent`,fetchImpl:k2(),streamOpenTimeoutMs:F2,streamIdleTimeoutMs:I2})}function z2(e,t){let n=(0,V.useRef)(null),r=(0,V.useCallback)(e=>{if(!e){n.current=null;return}n.current!==e&&(n.current=e,t())},[t]);(0,V.useEffect)(()=>{r(e)},[e,r])}function B2(e,t={}){let[n]=(0,V.useState)(()=>R2()),r=$e(),[i,a]=(0,V.useState)(0),[o,s]=(0,V.useState)(null),c=(0,V.useRef)(null),{loadSeed:l,loadPreviousMessages:u,state:d}=N2({sessionId:e,messageLimit:t.messageLimit??40,hydrationRetryVersion:i}),f=y2({sessionId:e,client:n,loadSeed:l}),{acceptRun:p}=f,m=(0,V.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 p(e),e}finally{c.current===e&&(c.current=null),s(t=>t===e?null:t)}},[p]),h=(0,V.useCallback)(async e=>await m(e.sessionId,async()=>{let t={messages:f.visibleMessages,status:f.isRunning?`running`:`idle`},n=f.visibleMessages.findIndex(t=>t.id===e.messageId);if(n<0)throw Error(`The message being edited is no longer in the current session history.`);f.replaceHistory({messages:[...f.visibleMessages.slice(0,n),{...e.message,sessionId:e.sessionId}],status:`idle`});try{return await I.agentRuns.editMessage(e)}catch(n){f.replaceHistory(t);try{let t=new AbortController;f.replaceHistory(await l(e.sessionId,t.signal))}catch{}throw n}}),[f,m,l]),g=(0,V.useCallback)(async e=>await m(e.sessionId,()=>I.agentRuns.continue(e)),[m]),_=(0,V.useCallback)(async()=>await u(f.prependHistory),[f.prependHistory,u]),v=f.hydrateError?.message??f.snapshot.error?.message??null;return z2(e&&r.phase===`ready`&&L2(v)?`${e}:${r.lastReadyAt??0}`:null,()=>{a(e=>e+1)}),(0,V.useMemo)(()=>({...f,isSending:f.isSending||o===e,editMessage:h,continueRun:g,snapshot:{...f.snapshot,contextWindow:f.snapshot.contextWindow??d.contextWindow},hasPreviousMessages:d.hasPreviousPage,historyError:d.error,isLoadingPreviousMessages:d.isLoading,loadPreviousMessages:_,messageTotal:d.total}),[f,g,h,_,o,e,d])}function V2(e){return e.bootstrapStatus?.ncpAgent.state!==`ready`}function H2(e){return e.activeSystemAction?.message?.trim()||(e.lifecyclePhase===`cold-starting`?T(`chatRuntimeInitializing`):e.lifecyclePhase===`startup-failed`?e.bootstrapStatus?.ncpAgent.error?.trim()||e.bootstrapStatus?.lastError?.trim()||e.lastError?.trim()||T(`chatRuntimeInitializationFailed`):null)}function U2(e){let{message:t,status:n}=e,r=t?.trim();if(!r)return H2(n);let i=n.activeSystemAction?.message?.trim();if(n.phase===`service-transitioning`&&i)return i;let a=He(r);return n.phase===`recovering`&&a?T(`runtimeControlRecoveringHelp`):n.phase===`stalled`&&a?null:r}function W2(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 G2(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:T(`chatContextWindowUsed`),value:W2(e.usedContextTokens)}];return e.triggerContextTokens!==void 0&&o.push({label:T(`chatContextWindowTrigger`),value:W2(e.triggerContextTokens)}),o.push(e.availableBeforeCompactionTokens===void 0?{label:T(`chatContextWindowAvailable`),value:W2(e.availableContextTokens)}:{label:T(`chatContextWindowAvailableBeforeCompaction`),value:W2(e.availableBeforeCompactionTokens)}),e.fixedInputTokens!==void 0&&o.push({label:T(`chatContextWindowFixed`),value:W2(e.fixedInputTokens),dividerBefore:!0}),e.dynamicInputTokens!==void 0&&o.push({label:T(`chatContextWindowDynamic`),value:W2(e.dynamicInputTokens)}),e.reservedContextTokens!==void 0&&o.push({label:T(`chatContextWindowReserve`),value:W2(e.reservedContextTokens)}),o.push({label:T(`chatContextWindowTotal`),value:W2(e.totalContextTokens)}),e.prunedUsedContextTokens!==e.usedContextTokens&&o.push({label:T(`chatContextWindowPruned`),value:W2(e.prunedUsedContextTokens)}),e.droppedHistoryCount>0&&o.push({label:T(`chatContextWindowDroppedHistory`),value:String(e.droppedHistoryCount)}),e.truncatedToolResultCount>0&&o.push({label:T(`chatContextWindowTruncatedTools`),value:String(e.truncatedToolResultCount)}),{label:T(`chatContextWindow`),percentLabel:i,ratio:r,tone:a,details:o}}var K2=vr(`18rem`);function q2({agents:e,selectedAgent:t,selectedAgentId:n,onSelectAgent:r}){return(0,H.jsxs)(Sr,{value:n,onValueChange:r,children:[(0,H.jsxs)(mr,{"aria-label":T(`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,H.jsx)(`span`,{className:`sr-only`,children:T(`chatDraftAgentTitle`)}),(0,H.jsx)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:t?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(mf,{agentId:t.id,displayName:t.displayName,avatarUrl:t.avatarUrl,className:`h-5 w-5 shrink-0`}),(0,H.jsx)(`span`,{className:`max-w-28 truncate text-sm font-medium`,children:t.displayName?.trim()||t.id})]}):null})]}),(0,H.jsx)(_r,{className:`rounded-xl border-border shadow-lg`,style:{maxHeight:K2},children:e.map(e=>(0,H.jsx)(br,{value:e.id,className:`rounded-lg pr-10`,children:(0,H.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,H.jsx)(mf,{agentId:e.id,displayName:e.displayName,avatarUrl:e.avatarUrl,className:`h-5 w-5 shrink-0`}),(0,H.jsx)(`span`,{className:`truncate text-sm font-medium text-foreground`,children:e.displayName?.trim()||e.id})]})},e.id))})]})}var J2=[{labelKey:`chatWelcomeSuggestion1Label`,promptKey:`chatWelcomeSuggestion1Prompt`},{labelKey:`chatWelcomeSuggestion2Label`,promptKey:`chatWelcomeSuggestion2Prompt`},{labelKey:`chatWelcomeSuggestion3Label`,promptKey:`chatWelcomeSuggestion3Prompt`}];function Y2({onSelectPrompt:e}){return(0,H.jsx)(`div`,{className:`mt-5 flex flex-wrap justify-center gap-2`,children:J2.map(t=>(0,H.jsx)(`button`,{type:`button`,onClick:()=>e(T(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:T(t.labelKey)},t.labelKey))})}var X2=Cc(`20rem`);function Z2({isSaving:e,projectOptions:t,projectRoot:n,selectable:r,onOpenProjectDialog:i,onSelectProjectRoot:a}){let[o,s]=(0,V.useState)(!1),c=vl(n)??T(`chatWelcomeProjectPickerPlaceholder`),l=async e=>{s(!1),await a(e)};return(0,H.jsxs)(Tc,{open:o,onOpenChange:s,children:[(0,H.jsx)(Ec,{asChild:!0,children:(0,H.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":T(`chatWelcomeProjectPickerLabel`),disabled:!r||e,children:[(0,H.jsx)(Ra,{className:`h-4 w-4 shrink-0`}),(0,H.jsx)(`span`,{className:`truncate`,children:c}),(0,H.jsx)(er,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground/70`})]})}),(0,H.jsxs)(Oc,{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:X2},children:[(0,H.jsx)(`div`,{className:`shrink-0 px-3 pb-2 pt-3 text-[10px] font-semibold uppercase tracking-[0.18em] text-muted-foreground`,children:T(`chatWelcomeProjectRecentTitle`)}),(0,H.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,H.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,H.jsx)(Ra,{className:`mt-0.5 h-4 w-4 shrink-0 text-muted-foreground/70`}),(0,H.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,H.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,H.jsx)(`span`,{className:`truncate text-[13px] font-semibold text-foreground`,children:e.projectName}),e.isDefault?(0,H.jsx)(`span`,{className:`shrink-0 rounded-full bg-muted px-1.5 py-0.5 text-[10px] font-medium text-muted-foreground`,children:T(`chatWelcomeProjectDefaultBadge`)}):null]}),(0,H.jsx)(`span`,{className:`block truncate text-[11px] leading-4 text-muted-foreground`,children:e.projectRoot})]}),e.sessionCount>0?(0,H.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,H.jsx)(`div`,{className:`px-2 py-5 text-center text-xs text-muted-foreground`,children:T(`chatWelcomeProjectNoRecent`)})}),(0,H.jsx)(`div`,{className:`shrink-0 border-t border-border p-1.5`,children:(0,H.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,H.jsx)(Ra,{className:`h-4 w-4 shrink-0 text-muted-foreground/70`}),(0,H.jsx)(`span`,{children:T(`chatWelcomeProjectOpenFolder`)})]})})]})]})}function Q2(e){let{disabled:t=!1,option:n,onSelect:r,selected:i=!1}=e,a=n.ready===!1?n.reasonMessage?.trim()||T(`statusSetup`):null;return(0,H.jsx)(`button`,{type:`button`,"aria-pressed":i,disabled:t,onClick:r,className:c(`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,H.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,H.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-start gap-2.5`,children:[n.icon?.src?(0,H.jsx)(`span`,{className:`inline-flex h-5 w-5 shrink-0 items-center justify-center pt-0.5`,children:(0,H.jsx)(Ju,{icon:{kind:`runtime-image`,src:n.icon.src,alt:n.icon.alt??null,name:n.label}})}):(0,H.jsx)(`span`,{className:`inline-flex h-5 w-5 shrink-0 items-center justify-center pt-0.5 text-muted-foreground`,children:(0,H.jsx)(Xi,{className:`h-4 w-4`})}),(0,H.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,H.jsx)(`div`,{className:`truncate text-[13px] font-semibold text-gray-900`,children:n.label}),(0,H.jsx)(as,{status:n.ready===!1?`warning`:`ready`,label:n.ready===!1?T(`statusSetup`):T(`statusReady`),className:`bg-transparent px-0`})]}),a?(0,H.jsx)(`div`,{className:`mt-1 pr-4 text-[11px] leading-4 text-gray-500`,children:a}):null]})]}),i?(0,H.jsx)(Tr,{className:`mt-1 h-3.5 w-3.5 shrink-0 text-primary`}):null]})})}var $2=Cc(`18rem`);function e4({options:e,selectedSessionType:t,onSelectSessionType:n}){let[r,i]=(0,V.useState)(!1),a=e.find(e=>e.value===t)??e[0]??null;return a?(0,H.jsxs)(Tc,{open:r,onOpenChange:i,children:[(0,H.jsx)(Ec,{asChild:!0,children:(0,H.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":T(`chatWelcomeSessionTypePickerLabel`),children:[a.icon?.src?(0,H.jsx)(Ju,{icon:{kind:`runtime-image`,src:a.icon.src,alt:a.icon.alt??null,name:a.label},className:`h-4 w-4`}):(0,H.jsx)(Xi,{className:`h-4 w-4 shrink-0`}),(0,H.jsx)(`span`,{className:`truncate`,children:a.label}),(0,H.jsx)(er,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground/70`})]})}),(0,H.jsx)(Oc,{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:$2},children:(0,H.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:e.map(e=>(0,H.jsx)(Q2,{option:e,onSelect:()=>{n(e.value),i(!1)}},e.value))})})]}):null}function t4({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,V.useState)(!1),[h,g]=(0,V.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,H.jsxs)(`div`,{className:`flex min-h-full items-center justify-center px-4 py-10 sm:p-8`,children:[(0,H.jsxs)(`div`,{className:`w-full min-w-0 max-w-[min(680px,100%)]`,children:[(0,H.jsx)(`div`,{className:`text-center`,children:(0,H.jsx)(`h2`,{className:`text-2xl font-semibold leading-tight text-foreground sm:text-[2rem]`,children:T(`chatWelcomeTitle`)})}),n?(0,H.jsx)(`div`,{className:`mt-6`,children:n}):null,(0,H.jsx)(`div`,{className:`mt-2 flex justify-center px-1`,children:(0,H.jsxs)(`div`,{role:`group`,"aria-label":T(`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,H.jsx)(Z2,{isSaving:h,projectOptions:r,projectRoot:_,selectable:y,onOpenProjectDialog:()=>m(!0),onSelectProjectRoot:v}):null,(0,H.jsx)(q2,{agents:e,selectedAgent:f,selectedAgentId:i,onSelectAgent:c}),(0,H.jsx)(e4,{options:s,selectedSessionType:o,onSelectSessionType:d})]})}),(0,H.jsx)(Y2,{onSelectPrompt:l})]}),u?(0,H.jsx)(Zc,{open:p,currentProjectRoot:_,defaultWorkspacePath:t,isSaving:h,onOpenChange:m,onSave:v}):null]})}function n4(e){let{agents:t,fallbackAgentId:n}=e;return(t?.length??0)>0?t??[]:[{id:n}]}function r4(e){return e.agents.find(t=>t.id===e.agentId)??null}function i4(e,t){if(typeof e!=`string`||e.trim().length===0)return null;let n=Ou(e);return t.some(e=>e.value===n)?n:null}function a4(e){let{agentId:t,agents:n,defaultSessionType:r,pendingSessionType:i,selectedSessionType:a,sessionTypeOptions:o}=e;return(i4(a,o)??i4(i,o))||((n&&t?i4(ku(r4({agents:n,agentId:t}),r),o):null)??i4(r,o)??o[0]?.value??Ou(r))}function o4(e){return new Date(e.lastMessageAt??e.createdAt).getTime()}function s4(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 $l([...r])){let n=e.projectRoot?.trim();if(!n||n===t)continue;let r=i.get(n),a=o4(e);if(r){r.sessionCount+=1,r.latestUpdatedAt=Math.max(r.latestUpdatedAt,a);continue}i.set(n,{projectRoot:n,projectName:e.projectName?.trim()||vl(n)||n,sessionCount:1,isDefault:!1,latestUpdatedAt:a})}return t&&i.set(t,{projectRoot:t,projectName:vl(t)||t,sessionCount:0,isDefault:!0,latestUpdatedAt:1/0}),[...i.values()].sort((e,t)=>t.latestUpdatedAt-e.latestUpdatedAt).map(({latestUpdatedAt:e,...t})=>t)}var c4=[];function l4({inputSlot:e,pendingProjectRoot:t,pendingSessionType:n,selectedSessionTypeValue:r,onSelectProjectRoot:i,onSelectPrompt:a,onSelectSessionType:o}){let s=il(),c=du(e=>e.snapshot.selectedAgentId),l=U(e=>e.snapshot),u=nd(e=>e.snapshot.configQuery?.data??null),d=nd(e=>e.snapshot.sessionsQuery?.data?.sessions??c4),f=nd(e=>e.snapshot.sessionTypesQuery?.data??null),p=hf(),m=id(),h=l.agentId??c,g=n4({agents:p.data?.agents,fallbackAgentId:h}),_=_l(u?.agents.defaults.workspace),v=_l(t),y=ju(f?.options??[]),b=Ou(f?.defaultType??`native`),x=a4({defaultSessionType:b,pendingSessionType:n,selectedSessionType:r,sessionTypeOptions:y}),S=s4({defaultProjectRoot:_,projects:m.data?.projects??[],sessionSummaries:d});return(0,H.jsx)(t4,{agents:g,defaultProjectRoot:_,inputSlot:e,projectOptions:S,selectedAgentId:h,selectedProjectRoot:v,selectedSessionType:x,sessionTypeOptions:y,onSelectAgent:e=>{s.chatSessionListManager.setSelectedAgentId(e),o(a4({agents:g,agentId:e,defaultSessionType:b,pendingSessionType:null,selectedSessionType:null,sessionTypeOptions:y}))},onSelectPrompt:a,onSelectProjectRoot:i,onSelectSessionType:o})}function u4(e){return e.modelOptions.length>0}function d4(e){return!e.isProviderStateResolved&&!u4(e)}function f4(e){return e.isProviderStateResolved&&!u4(e)}function p4(e){return!1}function m4(e){let{hasSendableDraft:t,isRuntimeBlocked:n}=e;return n||!t}function h4(e){return{...e.metadata,...e.message.metadata}}function g4(e){let t=FW(h4(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()||e.message.parts.flatMap(e=>e.type===`file`&&e.name?[e.name]:[]).join(`, `)}function _4(e,t){return G1({attachmentIdPrefix:`queued-attachment-${e.id}`,availableSkills:t,message:e.message,metadata:h4(e)})}function v4({agent:e,sessionKey:t,setSendError:n}){return{continueRun:(0,V.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,V.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 y4=e=>e.some(e=>e.type!==`text`||e.text.trim().length>0),b4=e=>e?.trim()||void 0;function x4(e){return{isProviderStateResolved:e.isProviderStateResolved,modelOptions:e.modelOptions,sessionTypeUnavailable:e.sessionTypeState.sessionTypeUnavailable}}function S4(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=I1([...l.nodes],l.attachments);return m4({snapshot:x4(r),hasSendableDraft:y4(u),isRuntimeBlocked:a})||t?null:{composerSnapshot:l,metadata:z1({agentId:o?void 0:r.selectedSession?.agentId?.trim()||s,model:b4(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 C4(e,t){return w2({sessionId:t??void 0,text:e.composerSnapshot.text.trim(),attachments:[...e.composerSnapshot.attachments],parts:I1([...e.composerSnapshot.nodes],e.composerSnapshot.attachments),metadata:e.metadata})}function w4(e){let t=e.sessionId?.trim();if(!t)return null;let n={...e.message,sessionId:t},r=new Date().toISOString(),i={id:`submitting-${n.id}`,sessionId:t,enqueuedAt:r,message:n,metadata:structuredClone(e.metadata??{})};return{id:i.id,preview:g4(i),sessionId:t,userMessageId:n.id}}function T4(e,t){let[n,r]=(0,V.useState)(null),i=(0,V.useCallback)(e=>{let t=w4(e);return t&&r(t),t},[]);return{clearSubmittingInput:(0,V.useCallback)(e=>{r(t=>t?.userMessageId===e.userMessageId?null:t)},[]),queuedInputs:(0,V.useMemo)(()=>{let r=e.map(e=>({id:e.id,preview:g4(e)}));return n?.sessionId===t&&!e.some(e=>e.message.id===n.userMessageId)&&r.push({id:n.id,isSubmitting:!0,preview:n.preview}),r},[e,t,n]),stageSubmittingInput:i}}function E4(e){let{availableSkills:t,restoreComposer:n,runQueue:r,setSendError:i}=e,a=(0,V.useCallback)(e=>{r.inputs.find(t=>t.id===e)&&r.removeQueuedInput(e).then(e=>{e&&(n(_4(e,t)),i(null))}).catch(e=>{i(e instanceof Error?e.message:String(e))})},[t,n,r,i]);return{deleteQueuedInput:(0,V.useCallback)(e=>{r.removeQueuedInput(e).then(()=>i(null)).catch(e=>{i(e instanceof Error?e.message:String(e))})},[r,i]),editQueuedInput:a}}function D4(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,V.useCallback)(async(e,d)=>{let f=C4(e,c??(r?null:eu()));if(!f)return;let p=t.isRunning?u(f):null;d===`reset-and-restore`&&a(),l(null);try{let e=await t.send(f);p&&e?.runId===null&&await s.refreshQueuedInputs().catch(()=>void 0),p&&n(p);let r=e?.sessionId?.trim()||t.snapshot.activeRun?.sessionId?.trim()||null;!c&&r&&i?.(r)}catch(t){throw p&&n(p),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 O4(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}=T4(o.inputs,c),{deleteQueuedInput:g,editQueuedInput:_}=E4({availableSkills:r.skillRecords,restoreComposer:d,runQueue:o,setSendError:f}),v=y4((0,V.useMemo)(()=>I1([...n.nodes],n.attachments),[n.attachments,n.nodes])),y=t.isSending||t.isRunning,b=r.selectedSession?.activityPreview?.state,x=!!(c&&!y&&!i&&(b===`cancelled`||b===`failed`)),S=x&&!v?`continue`:`send`,C=S===`continue`?!1:m4({snapshot:x4(r),hasSendableDraft:v,isRuntimeBlocked:i})||t.isSending,{continueRun:w,editMessage:T}=v4({agent:t,sessionKey:c,setSendError:f}),E=D4({agent:t,clearSubmittingInput:p,materializationContext:a,onSessionMaterialized:l,resetComposer:u,restoreComposer:d,runQueue:o,sessionKey:c,setSendError:f,stageSubmittingInput:h}),D=(0,V.useCallback)(async()=>{if(S===`continue`){await w();return}let e=S4({agentIsSending:t.isSending,inputSnapshot:n,inputQuery:r,isRuntimeBlocked:i,materializationContext:a,selectedAgentId:s,sessionKey:c});e&&await E(e,`reset-and-restore`)},[t.isSending,w,r,n,i,a,S,s,c,E]),O=(0,V.useCallback)(async e=>{let o=e.trim();if(!o)return;let l=S4({agentIsSending:t.isSending,composerSnapshot:{text:o,nodes:A1(o),selectedSkills:[],skillRecords:[],attachments:[]},inputSnapshot:n,inputQuery:r,isRuntimeBlocked:i,materializationContext:a,selectedAgentId:s,sessionKey:c});l&&await E(l,`preserve`)},[t.isSending,r,n,i,a,s,c,E]),k=(0,V.useCallback)(async()=>{await t.abort()},[t]);return{canContinue:x,canStopGeneration:t.isRunning,continueRun:w,deleteQueuedInput:g,editMessage:T,editQueuedInput:_,hasSendableDraft:v,isSending:y,queuedInputs:m,send:D,sendPresetMessage:O,sendDisabled:C,primaryAction:S,stop:k,stopDisabled:!t.isRunning}}var k4=[`off`,`minimal`,`low`,`medium`,`high`,`adaptive`,`xhigh`],A4=new Set(k4);function j4(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 M4(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 N4(e,t){let n=e.trim();if(!n)return``;for(let e of t)n=M4(n,e);return n.trim()}function P4(e,t){let n=t.trim(),r=e.trim();return n?r?`${r}/${n}`:n:``}function F4(e){if(typeof e!=`string`)return null;let t=e.trim().toLowerCase();return t&&A4.has(t)?t:null}function I4(e){if(!Array.isArray(e))return[];let t=[];for(let n of e){let e=F4(n);!e||t.includes(e)||t.push(e)}return t}function L4(e){return e.includes(`off`)?[...e]:[`off`,...e]}function R4(e,t){if(!e)return{};let n={};for(let[r,i]of Object.entries(e)){let e=N4(r,t);if(!e)continue;let a={},o=I4(i?.thinking?.supported);if(o.length>0){let e=F4(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 z4(e){return Object.fromEntries(Object.entries(e).filter(e=>!!e[1].thinking).map(([e,t])=>[e,t.thinking]))}function B4(e,t,n){let r=N4(t,n);return r?e[r]??null:null}function V4(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=N4(n,e.aliases);if(t&&j4(e.models??[]).some(e=>e===t))return e.name}return null}function H4(e){return e?e.enabled!==!1&&(e.apiKeyRequired===!1||e.apiKeySet===!0):!1}function U4(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=j4([t,n?.modelPrefix||``,n?.providerType||``]),o=j4((e?.models??[]).map(e=>N4(e,i))),s={...R4(n?.modelConfig,i),...R4(e?.modelConfig,i)},c=z4(s),l=e?.displayName?.trim(),u=H4(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 W4(e,t){return{value:r,modelLabel:e,providerLabel:``,isRuntimeDefault:!0,thinkingCapability:t??null}}function G4(e){let t=new Set;return U4({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=P4(e.prefix,n);return!r||t.has(r)?null:(t.add(r),{value:r,modelLabel:n,providerLabel:e.displayName,thinkingCapability:B4(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 K4(e){let{catalogView:t,config:n,providersView:r,templatesView:i}=e,a=t?.providers??{},o=new Set;return U4({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=N4(n,e.aliases),i=P4(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:B4(e.modelThinking,r,e.aliases)})}).filter(e=>e!==null)})}function q4(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 J4(e){let{modelOptions:t,modelSelectionMode:n,runtimeDefaultThinkingCapability:r,runtimeDefaultModelLabel:i=`Runtime default`,supportedModels:a}=e,o=W4(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 Y4(e){return e?.trim().toLowerCase()||`native`}function X4(e,t){if(typeof t!=`string`)return!1;let n=t.trim();return n?e.some(e=>e.value===n):!1}function Z4(e,t){return typeof t==`string`&&e.includes(t)}function Q4(e){return e.length===0?null:e.includes(`off`)?`off`:e[0]??null}function $4(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 e3(e){let{modelOptions:t,currentSelectedModel:n,selectedSessionPreferredModel:r,fallbackPreferredModel:i,defaultModel:a,preferSessionPreferredModel:o,preserveCurrentSelectedModelOnSessionChange:s}=e;return t.length===0?``:$4({currentValue:n,selectedSessionPreferredValue:r,fallbackPreferredValue:i,defaultValue:a,isValueSupported:e=>X4(t,e),firstAvailableValue:t[0]?.value??``,preferSessionPreferredValue:o,preserveCurrentValueOnSessionChange:s})}function t3(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=L4(t);return $4({currentValue:n,selectedSessionPreferredValue:r,fallbackPreferredValue:i,defaultValue:a,isValueSupported:e=>Z4(c,e),firstAvailableValue:Q4(c)??`off`,preferSessionPreferredValue:o,preserveCurrentValueOnSessionChange:s})}function n3(e){let{sessions:t,selectedSessionKey:n,sessionType:r,readPreference:i}=e,a=Y4(r),o,s=-1/0;for(let e of t){if(e.key===n||Y4(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 r3(e){let{selectedSession:t,pendingSessionType:n,setPendingSessionType:r,sessionTypesData:i}=e,a=(0,V.useMemo)(()=>ju(i?.options??[]),[i?.options]),o=(0,V.useMemo)(()=>{let e=[...a],n=Ou(t?.sessionType);return e.some(e=>e.value===n)||e.push({value:n,label:Au(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,V.useMemo)(()=>Ou(i?.defaultType??`native`),[i?.defaultType]),c=(0,V.useRef)(null),l=typeof n==`string`&&n.trim().length>0?n:void 0,u=(0,V.useMemo)(()=>Ou(t?.sessionType??l??s),[s,l,t?.sessionType]),d=(0,V.useMemo)(()=>o.find(e=>e.value===u)??null,[u,o]);(0,V.useEffect)(()=>{if(t)return;let e=typeof n==`string`?n.trim():``,i=Ou(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,V.useMemo)(()=>new Set(a.map(e=>e.value)),[a]),m=(0,V.useMemo)(()=>t&&!p.has(Ou(t.sessionType))?!0:d?.ready===!1,[p,t,d?.ready]),h=(0,V.useMemo)(()=>t&&!p.has(Ou(t.sessionType))?`${Au(u)} ${T(`chatSessionTypeUnavailableSuffix`)}`:d?.ready===!1?d.reasonMessage?.trim()||`${d.label} setup required`:null,[p,t,u,d]);return(0,V.useMemo)(()=>({sessionTypeOptions:o,selectedSessionTypeOption:d,defaultSessionType:s,selectedSessionType:u,canEditSessionType:f,sessionTypeUnavailable:m,sessionTypeUnavailableMessage:h}),[f,s,u,d,o,m,h])}var i3=`nextclaw.chat.recent-selection.store`;function a3(e){if(typeof e!=`string`)return null;let t=e.trim();return t.length>0?t:null}function o3(e,t){return Array.isArray(e)?Array.from(new Set(e.map(a3).filter(e=>!!e))).slice(0,t):[]}function s3(e,t){let n=a3(t?.namespace);return n?`${e.storageKey}.${encodeURIComponent(n.toLowerCase())}`:e.storageKey}function c3(e){if(!e||typeof e!=`object`)return{};let t={};for(let[n,r]of Object.entries(e)){let e=a3(n);if(!e)continue;let i=o3(r,1/0);i.length>0&&(t[e]=i)}return t}var l3=N()(yi(e=>({entriesByKey:{},setEntries:(t,n)=>e(e=>({entriesByKey:{...e.entriesByKey,[t]:o3(n,1/0)}}))}),{name:i3,storage:bi(()=>window.localStorage),partialize:e=>({entriesByKey:e.entriesByKey}),merge:(e,t)=>({...t,entriesByKey:c3(e?.entriesByKey)})})),u3=class{constructor(e){this.options=e,this.read=(e={})=>{let t=s3(this.options,e);return o3(l3.getState().entriesByKey[t],this.options.limit)},this.remember=(e,t={})=>{let n=a3(e);if(!n)return this.read(t);let r=s3(this.options,t),i=[n,...this.read(t).filter(e=>e!==n)].slice(0,this.options.limit);return l3.getState().setEntries(r,i),i},this.resolveVisible=e=>{let t=o3(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}}},d3=new u3({storageKey:`nextclaw.chat.recent-models`,limit:3});function f3(){return dn({queryKey:[`config`],queryFn:ln,staleTime:3e4,refetchOnWindowFocus:!0})}function p3(){return dn({queryKey:[`config-meta`],queryFn:Kt,staleTime:1/0})}function m3(){return dn({queryKey:[`providers`],queryFn:_t,staleTime:3e4,refetchOnWindowFocus:!0})}function h3(){return dn({queryKey:[`provider-templates`],queryFn:on,staleTime:1/0})}function g3(e={}){return dn({queryKey:[`provider-model-catalog`],queryFn:Yt,staleTime:3e4,refetchInterval:t=>e.pollWhileRefreshing&&t.state.data?.refreshing?1e3:!1,refetchOnMount:e.refreshOnMount?`always`:!0,refetchOnWindowFocus:!0})}function _3(){return dn({queryKey:[`config-schema`],queryFn:nn,staleTime:1/0})}function v3(){let e=yn();return zt({mutationFn:Dt,onSuccess:()=>{e.invalidateQueries({queryKey:[`config`]}),L.success(T(`configSaved`))},onError:e=>{L.error(T(`configSaveFailed`)+`: `+e.message)}})}function y3(){let e=yn();return zt({mutationFn:({data:e})=>Sn(e),onSuccess:()=>{e.invalidateQueries({queryKey:[`config`]}),e.invalidateQueries({queryKey:[`config-meta`]}),L.success(T(`configSavedApplied`))},onError:e=>{L.error(T(`configSaveFailed`)+`: `+e.message)}})}function b3(){let e=yn();return zt({mutationFn:({provider:e,data:t})=>lt(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(T(`configSaved`))},onError:e=>{L.error(T(`configSaveFailed`)+`: `+e.message)}})}function x3(){let e=yn();return zt({mutationFn:({data:e})=>it(e??{}),onSuccess:()=>{e.invalidateQueries({queryKey:[`providers`]}),e.invalidateQueries({queryKey:[`config`]}),L.success(T(`configSaved`))},onError:e=>{L.error(T(`configSaveFailed`)+`: `+e.message)}})}function S3(){let e=yn();return zt({mutationFn:({provider:e})=>at(e),onSuccess:()=>{e.invalidateQueries({queryKey:[`providers`]}),e.invalidateQueries({queryKey:[`config`]}),L.success(T(`configSaved`))},onError:e=>{L.error(T(`configSaveFailed`)+`: `+e.message)}})}function C3(){return zt({mutationFn:({provider:e,data:t})=>Ut(e,t)})}function w3(){return zt({mutationFn:({provider:e,data:t})=>Ge(e,t)})}function T3(){return zt({mutationFn:({provider:e,data:t})=>Qt(e,t)})}function E3(){return zt({mutationFn:({provider:e,data:t})=>fn(e,t)})}function D3(){return zt({mutationFn:({provider:e})=>Bt(e)})}function O3(){let e=yn();return zt({mutationFn:({channel:e,data:t})=>At(e,t),onSuccess:()=>{e.invalidateQueries({queryKey:[`config`]}),e.invalidateQueries({queryKey:[`config-meta`]}),L.success(T(`configSavedApplying`))},onError:e=>{L.error(T(`configSaveFailed`)+`: `+e.message)}})}function k3(){let e=yn();return zt({mutationFn:({data:e})=>hn(e),onSuccess:()=>{e.invalidateQueries({queryKey:[`config`]}),L.success(T(`configSavedApplied`))},onError:e=>{L.error(T(`configSaveFailed`)+`: `+e.message)}})}function A3(){let e=yn();return zt({mutationFn:({data:e})=>ht(e),onSuccess:()=>{e.invalidateQueries({queryKey:[`config`]}),L.success(T(`configSavedApplied`))},onError:e=>{L.error(T(`configSaveFailed`)+`: `+e.message)}})}function j3(){return zt({mutationFn:({actionId:e,data:t})=>ge(e,t),onError:e=>{L.error(T(`error`)+`: `+e.message)}})}var M3=`nextclaw.chat.provider-model-catalog-notices`,N3=1,P3={version:N3,acknowledgedModelsByProvider:{}};function F3(){return typeof window>`u`?null:window.localStorage}function I3(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 L3=new class{constructor(){this.read=()=>{let e=F3();if(!e)return P3;try{let t=JSON.parse(e.getItem(M3)??`null`);return t?.version===N3&&t.acknowledgedModelsByProvider?{version:N3,acknowledgedModelsByProvider:t.acknowledgedModelsByProvider}:P3}catch{return P3}},this.write=e=>{let t=F3();if(!t)return!1;try{return t.setItem(M3,JSON.stringify(e)),!0}catch{return!1}},this.initializeLargeCatalogs=e=>{let t={...this.read().acknowledgedModelsByProvider},n=!1;for(let[r,i]of I3(e))i.length>50&&!Object.prototype.hasOwnProperty.call(t,r)&&(t[r]=i,n=!0);return n&&this.write({version:N3,acknowledgedModelsByProvider:t})},this.filterUnseen=e=>{let t=this.read().acknowledgedModelsByProvider,n=I3(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 I3(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:N3,acknowledgedModelsByProvider:t})}}},R3=`__nextclaw-preview__`,z3=[{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 B3(e){return!e.enabled||new URLSearchParams(e.search).get(`preview`)!==`model-discovery`?[]:z3.flatMap(e=>e.models.map(t=>({value:`${R3}${e.providerId}/${t}`,providerId:`${R3}${e.providerId}`,providerModel:t,modelLabel:t,providerLabel:e.providerLabel,thinkingCapability:null})))}function V3(e){return e.providerId.startsWith(R3)}function H3(e){let{config:t,modelSelectionMode:n,providersView:r,supportedModels:i,templatesView:a}=e,o=g3(),{mutateAsync:s}=b3(),[c,l]=(0,V.useState)(0),[u,d]=(0,V.useState)(!1),f=(0,V.useMemo)(()=>B3({enabled:!1,search:typeof window>`u`?``:window.location.search}),[]),p=(0,V.useMemo)(()=>K4({catalogView:o.data??null,config:t,providersView:r,templatesView:a}),[o.data,t,r,a]);(0,V.useEffect)(()=>{L3.initializeLargeCatalogs(p)},[p]);let m=(0,V.useMemo)(()=>f.length>0&&!u?f:q4({modelOptions:L3.filterUnseen(p),modelSelectionMode:n,supportedModels:i}),[p,n,c,u,f,i]);return{addDiscoveredModel:(0,V.useCallback)(async e=>{let t=m.find(t=>t.value===e);if(t&&V3(t))return t;let n=t?r?.providers[t.providerId]:void 0;return!t||!n?null:(await s({provider:t.providerId,data:{models:j4([...n.models??[],t.providerModel])},silentSuccess:!0}),L3.acknowledge([t]),l(e=>e+1),t)},[m,r,s]),dismissDiscoveredModels:(0,V.useCallback)(()=>{if(m.some(V3)){d(!0);return}L3.acknowledge(m)&&l(e=>e+1)},[m]),discoveredModelOptions:m,refreshProviderModelCatalog:o.refetch}}var U3=[],W3=[];function G3(e){let{sessionKey:t,inputSnapshot:n,setPendingSessionType:r}=e,i=t??null,a=bd(),o=nd(e=>e.snapshot),s=o.configQuery?.data??null,c=o.providersQuery?.data??null,l=o.providerTemplatesQuery?.data??null,u=o.sessionsQuery?.data?.sessions??W3,d=mu({sessionId:i?.trim()||`draft-session`,projectRoot:_l(n.pendingProjectRoot)}),f=d.data?.records??U3,p=!!(d.isLoading||d.isFetching),m=(0,V.useMemo)(()=>$l(u),[u]),h=(0,V.useMemo)(()=>m.find(e=>e.key===i)??null,[i,m]),g=r3({selectedSession:h,pendingSessionType:n.pendingSessionType,setPendingSessionType:r,sessionTypesData:o.sessionTypesQuery?.data??null}),_=(0,V.useMemo)(()=>G4({config:s,providersView:c,templatesView:l}),[s,c,l]),v=(0,V.useMemo)(()=>J4({modelOptions:_,modelSelectionMode:g.selectedSessionTypeOption?.modelSelectionMode,runtimeDefaultThinkingCapability:g.selectedSessionTypeOption?.runtimeDefaultThinking??null,runtimeDefaultModelLabel:T(`chatRuntimeDefaultModel`),supportedModels:g.selectedSessionTypeOption?.supportedModels}),[_,g.selectedSessionTypeOption?.modelSelectionMode,g.selectedSessionTypeOption?.runtimeDefaultThinking,g.selectedSessionTypeOption?.supportedModels]),{addDiscoveredModel:y,dismissDiscoveredModels:b,discoveredModelOptions:x,refreshProviderModelCatalog:S}=H3({config:s,providersView:c,templatesView:l,modelSelectionMode:g.selectedSessionTypeOption?.modelSelectionMode,supportedModels:g.selectedSessionTypeOption?.supportedModels}),C=(0,V.useMemo)(()=>new Set(v.map(e=>e.value)),[v]),w=d3.read({namespace:g.selectedSessionType}).find(e=>C.has(e)),E=(0,V.useMemo)(()=>w??n3({sessions:m,selectedSessionKey:i,sessionType:g.selectedSessionType,readPreference:e=>e.preferredModel?.trim()||void 0}),[w,i,g.selectedSessionType,m]),D=(0,V.useMemo)(()=>n3({sessions:m,selectedSessionKey:i,sessionType:g.selectedSessionType,readPreference:e=>e.preferredThinking??void 0}),[i,g.selectedSessionType,m]),O=_l(s?.agents.defaults.workspace);return(0,V.useMemo)(()=>({addDiscoveredModel:y,defaultModel:g.selectedSessionTypeOption?.recommendedModel??s?.agents.defaults.model,defaultProjectRoot:O,dismissDiscoveredModels:b,discoveredModelOptions:x,fallbackPreferredModel:E,fallbackPreferredThinking:D,isProviderStateResolved:a,isSkillsLoading:p,modelOptions:v,providersView:c,refreshProviderModelCatalog:S,selectedSession:h,selectedSessionKey:i,sessionTypeState:g,skillRecords:f}),[s?.agents.defaults.model,O,E,D,a,p,v,y,b,x,S,c,h,i,g,f])}var K3=`new-session`,q3=`nextclaw.chat.composer-drafts`,J3=1;function Y3(e){let t=e?.trim();return t?`session:${t}`:K3}var X3=N()(yi(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:q3,version:J3,storage:bi(()=>window.localStorage),partialize:e=>({drafts:Object.fromEntries(Object.entries(e.drafts).map(([e,t])=>[e,{...t,composerFocusRequestId:0,sendError:null}]))})})),Z3=({preferenceOwnerKey:e,selectedModel:t,selectedThinkingLevel:n,updatePreferences:r})=>{let i=(0,V.useRef)(void 0),a=(0,V.useRef)(null),o=(0,V.useCallback)(t=>{a.current={ownerKey:e,value:t},r({selectedThinkingLevel:t})},[e,r]),s=(0,V.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=e3({currentSelectedModel:t??void 0,modelOptions:l,selectedSessionPreferredModel:p,fallbackPreferredModel:s,defaultModel:o,preferSessionPreferredModel:_,preserveCurrentSelectedModelOnSessionChange:v}),C=l.find(e=>e.value===S),w=t3({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,V.useMemo)(()=>({setSelectedThinkingLevel:o,syncSessionPreferences:s}),[o,s])},Q3={text:``,nodes:[],selectedSkills:[],skillRecords:[]},$3=e=>{let t=e?.trim()??``;return{...t?{...Q3,text:t,nodes:A1(t)}:Q3,attachments:[],selectedModel:void 0,selectedThinkingLevel:null,pendingSessionType:Du,selectedSessionType:Du,composerFocusRequestId:t?1:0,sendError:null}},e6=e=>e?.trim()||Du,t6=e=>[e.assetUri??``,e.url??``,e.name,e.mimeType,String(e.sizeBytes),e.contentBase64??``].join(`:`),n6=(e,t)=>{let n=new Set(e.map(t6)),r=[...e];return t.forEach(e=>{let t=t6(e);n.has(t)||(n.add(t),r.push(e))}),r};function r6(e){let{attachments:t,update:n}=e,r=(0,V.useCallback)(e=>{n({attachments:e})},[n]);return{addAttachments:(0,V.useCallback)(e=>{if(e.length===0)return[];let r=new Set(t.map(t6)),i=n6(t,e),a=i.filter(e=>!r.has(t6(e)));return a.length>0&&n({attachments:i}),a},[t,n]),removeAttachment:(0,V.useCallback)(e=>{n(t=>({attachments:t.attachments.filter(t=>t.id!==e)}))},[n]),setAttachments:r}}function i6(e,t){let n=Y3(t),r=(0,V.useMemo)(()=>$3(e),[e]),i=X3(e=>e.drafts[n]??r);return(0,V.useEffect)(()=>{X3.getState().ensureDraft(n,r)},[n,r]),{draftKey:n,snapshot:i,update:(0,V.useCallback)(e=>{X3.getState().updateDraft(n,r,t=>{let n=typeof e==`function`?e({...t,pendingProjectRoot:U.getState().snapshot.draftProjectRoot}):e;return{...t,...n}})},[n,r])}}var a6=(e,t=null)=>{let n=U(e=>e.snapshot.draftProjectRoot),{draftKey:r,snapshot:i,update:a}=i6(e,t),o=(0,V.useCallback)(e=>{a({text:e.text,nodes:e.nodes,selectedSkills:e.selectedSkills,skillRecords:e.skillRecords,sendError:null})},[a]),s=(0,V.useCallback)(()=>{a({...Q3,attachments:[],sendError:null})},[a]),c=(0,V.useCallback)(e=>{a({...e})},[a]),l=(0,V.useCallback)(e=>{a({text:e,nodes:A1(e),selectedSkills:[],skillRecords:[],sendError:null,composerFocusRequestId:Date.now()})},[a]),u=(0,V.useCallback)(()=>{a(e=>({composerFocusRequestId:e.composerFocusRequestId+1}))},[a]),d=(0,V.useCallback)(()=>{a({composerFocusRequestId:0})},[a]),{addAttachments:f,removeAttachment:p,setAttachments:m}=r6({attachments:i.attachments,update:a}),h=Z3({preferenceOwnerKey:r,selectedModel:i.selectedModel,selectedThinkingLevel:i.selectedThinkingLevel,updatePreferences:a}),g=(0,V.useCallback)(e=>{a(t=>{let n=e6(typeof e==`function`?e(t.pendingSessionType):e);return{pendingSessionType:n,selectedSessionType:n}})},[a]),_=(0,V.useCallback)(e=>{U.getState().setSnapshot({draftProjectRoot:e})},[]),v=(0,V.useCallback)((e,t)=>{a({selectedSkills:e,skillRecords:t,sendError:null})},[a]),y=(0,V.useCallback)(e=>{a({sendError:e})},[a]),b=(0,V.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}},o6=`ncp-session-run-queue`;function s6(e){let t=yn(),n=e?.trim()||null,{data:r,isLoading:i,refetch:a}=dn({queryKey:[o6,n],queryFn:()=>I.sessions.listQueuedInputs(n),enabled:!!n,retry:!1,staleTime:5e3});(0,V.useEffect)(()=>{if(n)return I.eventBus.on(p.sessionRunQueueUpdated,async({sessionKey:e})=>{if(e!==n)return;let r=[o6,n];await t.cancelQueries({queryKey:r,exact:!0}),await t.invalidateQueries({queryKey:r,exact:!0})})},[n,t]);let o=(0,V.useCallback)(async e=>n?await I.sessions.deleteQueuedInput(n,e):null,[n]),s=(0,V.useCallback)(async()=>n?(await a()).data?.inputs??[]:[],[n,a]);return{inputs:r?.inputs??[],isLoading:i,refreshQueuedInputs:s,removeQueuedInput:o}}function c6(){return(0,V.useEffect)(()=>Us.attach(),[]),{isMobile:Hs(e=>e.mode)===`mobile`}}var l6={exactId:1200,exactLabel:1150,prefixId:1e3,prefixLabel:950,prefixToken:900,containsId:800,containsLabel:760,containsDescription:500,subsequence:300,fallback:1};function u6(e){return(e??``).trim().toLowerCase()}function d6(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 f6(e,t){let n=u6(t);if(!n)return l6.fallback;let r=u6(e.id),i=u6(e.label||e.id),a=u6(e.description),o=(e.aliases??[]).map(u6).filter(Boolean),s=i.split(/[\s/_-]+/).filter(Boolean),c=[r,...o];return c.some(e=>e===n)?l6.exactId:i===n?l6.exactLabel:c.some(e=>e.startsWith(n))?l6.prefixId:i.startsWith(n)?l6.prefixLabel:s.some(e=>e.startsWith(n))?l6.prefixToken:c.some(e=>e.includes(n))?l6.containsId:i.includes(n)?l6.containsLabel:a.includes(n)?l6.containsDescription:d6(n,i)||c.some(e=>d6(n,e))?l6.subsequence:0}function p6(e){return e>=l6.exactLabel?4:e>=l6.prefixToken?3:e>=l6.containsLabel?2:e>0?1:0}var m6=`context-reference:navigate:files`,h6=`context-reference:navigate:folders`,g6=`context-reference:navigate:projects`,_6=`context-reference:navigate:root`,v6=`context-reference:navigate:system-object-group:`,y6=`context-reference:system-object:`,b6=`workspace-files`,x6=`workspace-folders`,S6=`projects`;function C6(e,t){return e.translations?.[t]??e.default}function w6(e){return e.groups.map(t=>({key:`${v6}${t.objectType}`,icon:t.icon,title:C6(t.label,e.language),subtitle:e.texts.systemObjectSectionLabel,description:C6(t.description,e.language),detailLines:[],hintLabel:e.texts.systemObjectGroupHintLabel,sectionKey:`system-object-groups`,sectionLabel:e.texts.systemObjectSectionLabel,selectionBehavior:`navigate`,value:t.objectType}))}function T6(e){return e.groups.flatMap(t=>{let n=C6(t.label,e.language);return t.items.map(e=>({key:`${y6}${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 E6(e){return e.split(/[\\/]+/).filter(Boolean).at(-1)??e}function D6(e){let{kind:t,projectRoot:n,relativePath:r}=e,i=r.split(`/`).filter(Boolean);return{rootLabel:E6(n),segments:i.map((e,n)=>({label:e,kind:n===i.length-1?t:`directory`}))}}function O6(e){let t=new Intl.Collator(void 0,{sensitivity:`base`,numeric:!0});return e.projects.map((t,n)=>({order:n,project:t,score:f6({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=p6(e.score),i=p6(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:S6,sectionLabel:e.texts.projectSectionLabel,value:t.rootPath,tokenKind:g,tokenKey:t.rootPath}))}function k6(e){let t=E6(e.projectRoot);return e.entries.map(n=>{let r=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:r?void 0:n.kind===`directory`?o:D,tokenKey:r?void 0:n.relativePath,selectionBehavior:r?`navigate`:void 0,pathPreview:D6({kind:n.kind,projectRoot:e.projectRoot,relativePath:n.relativePath})}})}function A6(e){let{projectRoot:t,referencePath:n,texts:r}=e,i=n.split(`/`).filter(Boolean).join(`/`),a=i||`.`,s=i.split(`/`).filter(Boolean).at(-1)??E6(t);return{key:`context-reference:current-directory:${a}`,icon:`folder`,title:r.currentDirectoryLabel,subtitle:s,description:r.directoryDescription,detailLines:[`${r.projectRootLabel}: ${t}`,a],sectionKey:x6,sectionLabel:r.foldersLabel,value:a,tokenKind:o,tokenKey:a,pathPreview:D6({kind:`directory`,projectRoot:t,relativePath:i})}}function j6(e){return{key:m6,icon:`files`,title:e.filesLabel,subtitle:e.filesSubtitle,description:e.filesDescription,detailLines:[],hintLabel:e.filesHintLabel,selectionBehavior:`navigate`}}function M6(e){return{key:h6,icon:`folder`,title:e.foldersLabel,subtitle:e.foldersSubtitle,description:e.foldersDescription,detailLines:[],hintLabel:e.foldersHintLabel,selectionBehavior:`navigate`}}function N6(e){return{key:g6,icon:`project`,title:e.projectsLabel,subtitle:e.projectsSubtitle,description:e.projectsDescription,detailLines:[],hintLabel:e.projectsHintLabel,selectionBehavior:`navigate`}}function P6(e){let t=e.split(`/`).filter(Boolean);return t.length===0?null:t.slice(0,-1).join(`/`)}function F6(e){let{location:t,texts:n}=e,r=t.view===`files`||t.view===`folders`,i=r?t.path:``,a=!r||!i;return{key:_6,icon:`back`,title:a?n.backLabel:n.parentLabel,subtitle:``,description:a?n.backDescription:n.parentDescription,detailLines:[],hintLabel:a?n.backHintLabel:n.parentHintLabel,value:P6(i)??``,selectionBehavior:`navigate`}}var I6=`panel-apps`;function L6(e){return Date.parse(e.lastOpenedAt??e.updatedAt)||0}function R6(e){let t=new Intl.Collator(void 0,{sensitivity:`base`,numeric:!0});return e.entries.map((t,n)=>({entry:t,order:n,score:f6({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=p6(e.score),i=p6(n.score);if(i!==r)return i-r;if(e.entry.favorite!==n.entry.favorite)return e.entry.favorite?-1:1;let a=L6(n.entry),o=L6(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 z6(e){let t=e.keyPrefix??`panel-app`;return R6({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 B6(e){return z6(e).map(({item:e})=>e)}function V6(e){return z6(e).map(({entry:t,item:n})=>({...n,sectionKey:I6,sectionLabel:e.sectionLabel,tokenKind:`panel_app`,tokenKey:t.appId,value:t.appId}))}var H6={key:`context-reference`,marker:`@`};function U6(e){let{entries:t,isBrowsing:n,isFoldersMode:r,projectRoot:i,texts:a}=e,o=(e,t,n)=>k6({entries:e,navigateDirectories:n,projectRoot:i,sectionKey:t===`folders`?x6:b6,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 W6(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 G6(e){return UU({key:`context-reference`,trigger:H6,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}=U6({entries:t.serverPathEntries,isBrowsing:l,isFoldersMode:i,projectRoot:t.projectRoot,texts:e.itemTexts.context}),m=O6({projects:t.projects,query:n.query,texts:e.itemTexts.context}),h=i&&l?A6({projectRoot:t.projectRoot,referencePath:u,texts:e.itemTexts.context}):null,g=t.systemObjectGroups??[],_=T6({groups:g,language:e.language,texts:e.itemTexts.context}),v=r?[F6({location:t.referenceLocation,texts:e.itemTexts.context}),...l?d:f]:i?[F6({location:t.referenceLocation,texts:e.itemTexts.context}),...h?[h]:[],...l?d:p]:a?[F6({location:t.referenceLocation,texts:e.itemTexts.context}),...m]:o?[F6({location:t.referenceLocation,texts:e.itemTexts.context}),..._]:[j6(e.itemTexts.context),M6(e.itemTexts.context),N6(e.itemTexts.context),...c?f:[],...c?p:[],...c?m:[],...c?_:w6({groups:g,language:e.language,texts:e.itemTexts.context}),...V6({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=>W6({isFoldersMode:i,isWorkspaceMode:s,item:t,onNavigate:e.onNavigate,onSelectSystemObject:e.onSelectSystemObject,referencePath:u}),texts:e.menuTexts}}})}function K6(e){let t=e.modelLabel.trim(),n=e.providerLabel.trim();return n?`${n}/${t}`:t}function q6(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 J6(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 Y6(e){let{isModelOptionsEmpty:t,onGoToProviders:n,texts:r}=e;return t?{tone:`warning`,text:r.noModelOptionsLabel,actionLabel:r.configureProviderLabel,onAction:n}:null}function X6(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:q6(r),onDismiss:t,onSelect:n}}function Z6({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:K6(e)}))},{key:`recent-models`,label:f.recentModelsLabel,options:v.map(e=>({value:e.value,label:K6(e)}))},{key:`all-models`,label:f.allModelsLabel,options:b.map(e=>({value:e.value,label:K6(e)}))}].filter(e=>e.options.length>0):void 0,S=t??[];return{key:`model`,value:m,placeholder:f.modelSelectPlaceholder,selectedLabel:p?K6(p):void 0,icon:`sparkles`,options:e.map(e=>({value:e.value,label:K6(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:X6({options:S,onDismiss:l,onSelect:c,texts:f}),manageLabel:f.manageModelsLabel,manageHref:`/providers`,onOpen:u,onValueChange:d}}function Q6(e){let{defaultThinkingLevel:t,onValueChange:n,selectedThinkingLevel:r,supportedLevels:i,texts:a}=e;if(i.length===0)return null;let o=L4(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 $6={exactSpec:1200,exactLabel:1150,prefixSpec:1e3,prefixLabel:950,prefixToken:900,containsSpec:800,containsLabel:760,containsDescription:500,subsequence:300,fallback:1};function e8(e){return(e??``).trim().toLowerCase()}function t8(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=e8(t);if(!n)return $6.fallback;let r=e8(e.key),i=e8(e.label||e.key),a=e8(`${e.descriptionZh??``} ${e.description??``}`),o=i.split(/[\s/_-]+/).filter(Boolean);return r===n?$6.exactSpec:i===n?$6.exactLabel:r.startsWith(n)?$6.prefixSpec:i.startsWith(n)?$6.prefixLabel:o.some(e=>e.startsWith(n))?$6.prefixToken:r.includes(n)?$6.containsSpec:i.includes(n)?$6.containsLabel:a.includes(n)?$6.containsDescription:t8(n,i)||t8(n,r)?$6.subsequence:0}function r8(e){return e>=$6.exactLabel?4:e>=$6.prefixToken?3:e>=$6.containsLabel?2:e>0?1:0}function i8(e){return new Map(e.map((e,t)=>[e,t]))}function a8(e,t){let n=i8(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 o8(e,t,n,r=[]){let i=new Intl.Collator(void 0,{sensitivity:`base`,numeric:!0}),a=i8(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:n8(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=r8(e.score),c=r8(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 s8(e){return e.map(e=>({key:e.key,label:e.label,description:e.descriptionZh||e.description||``,badgeLabel:e.badgeLabel}))}function c8(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:s8(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:s8(a)}]:[],...s].filter(e=>e.options.length>0)}function l8(e){let{groupedRecentSkillValues:t,isLoading:n,onSelectedKeysChange:r,recentSkillValues:i,selectedSkills:a,skillRecords:o,texts:s}=e,c=a8(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:s8(c),groups:c8({skillRecords:c,recentKeySet:l,recentSkillsLabel:s.recentSkillsLabel,allSkillsLabel:s.allSkillsLabel}),selectedKeys:a,onSelectedKeysChange:r}}var u8=`commands`,d8=`panel-app-action`,f8=`panel-apps`,p8=`skills`;function m8(e){let t=new Intl.Collator(void 0,{sensitivity:`base`,numeric:!0});return e.commands.map((t,n)=>({command:t,order:n,score:f6({id:t.key,label:t.title,description:t.description,aliases:t.keywords},e.query)})).filter(e=>e.score>0).sort((e,n)=>{let r=p6(e.score),i=p6(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:u8,sectionLabel:e.texts.commandSectionLabel}))}function h8(e){let{data:t,itemTexts:n,query:r,skillHintLabel:i,skillSectionLabel:a}=e;return o8([...t.skillRecords],r,n,[...t.recentSkillValues]).map(e=>({...e,icon:`skill`,hintLabel:i,sectionKey:e.sectionKey?`${p8}:${e.sectionKey}`:p8,sectionLabel:e.sectionLabel||a}))}function g8(e){return B6({entries:e.data.panelApps,keyPrefix:d8,query:e.query,texts:e.itemTexts}).map(t=>({...t,icon:`panel-app`,hintLabel:e.panelAppHintLabel,sectionKey:f8,sectionLabel:e.panelAppSectionLabel}))}function _8(e){let t=`${d8}:`;return e.key.startsWith(t)?e.key.slice(t.length):null}function v8(e){return UU({key:`slash-command`,trigger:Fh,resolvePanel:t=>{let{data:n,trigger:r}=t,i=h8({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:u8,label:e.labels.filterCommandsLabel,sectionKeys:[u8]},{key:p8,label:e.labels.filterSkillsLabel,sectionKeys:a.length>0?a:[p8]},{key:f8,label:e.labels.filterPanelAppsLabel,sectionKeys:[f8]}],isLoading:n.isPanelAppsLoading||n.isSkillsLoading,items:[...m8({commands:e.commands,query:r.query,texts:{commandHintLabel:e.labels.commandHintLabel,commandSectionLabel:e.labels.commandSectionLabel,commandSubtitle:e.labels.commandSubtitle}}),...i,...g8({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=_8(t);if(n){e.onSelectPanelApp(n);return}let r=t.tokenKey??t.value;r&&e.onSelectSkill?.(r)},texts:e.menuTexts}}})}function y8(e){let{commands:t,language:n,onNavigate:r,onSelectPanelApp:i,onSelectSkill:a,onSelectSystemObject:o,slashTexts:s}=e,c={appIdLabel:T(`chatPanelAppReferenceAppId`,n),fileLabel:T(`chatPanelAppReferenceFile`,n),noDescriptionLabel:T(`chatPanelAppReferenceNoDescription`,n),subtitle:T(`chatPanelAppReferenceType`,n)};return[v8({commands:t,itemTexts:{panelAppTexts:c,skillTexts:s},menuTexts:{loadingLabel:T(`chatSlashLoading`,n),sectionLabel:T(`chatSlashSection`,n),emptyLabel:T(`chatSlashNoResult`,n),hintLabel:T(`chatSlashHint`,n),itemHintLabel:T(`chatSlashSkillHint`,n)},labels:{commandHintLabel:T(`chatSlashCommandHint`,n),commandSectionLabel:T(`chatSlashSectionCommands`,n),commandSubtitle:T(`chatSlashTypeCommand`,n),filterAllLabel:T(`chatSlashFilterAll`,n),filterCommandsLabel:T(`chatSlashFilterCommands`,n),filterPanelAppsLabel:T(`chatSlashFilterPanelApps`,n),filterSkillsLabel:T(`chatSlashFilterSkills`,n),panelAppHintLabel:T(`chatSlashPanelAppHint`,n),panelAppSectionLabel:T(`chatPanelAppReferenceSection`,n),skillHintLabel:T(`chatSlashSkillHint`,n),skillSectionLabel:T(`chatSlashSectionSkills`,n)},onSelectPanelApp:i,onSelectSkill:a}),G6({itemTexts:{context:{backLabel:T(`chatContextReferenceBack`,n),backDescription:T(`chatContextReferenceBackDescription`,n),backHintLabel:T(`chatContextReferenceBackHint`,n),currentDirectoryLabel:T(`chatContextReferenceCurrentDirectory`,n),directoryDescription:T(`chatContextReferenceDirectoryDescription`,n),fileDescription:T(`chatContextReferenceFileDescription`,n),filesDescription:T(`chatContextReferenceFilesDescription`,n),filesHintLabel:T(`chatContextReferenceFilesHint`,n),filesLabel:T(`chatContextReferenceFilesLabel`,n),filesSubtitle:T(`chatContextReferenceFilesType`,n),foldersDescription:T(`chatContextReferenceFoldersDescription`,n),foldersHintLabel:T(`chatContextReferenceFoldersHint`,n),foldersLabel:T(`chatContextReferenceFoldersLabel`,n),foldersSubtitle:T(`chatContextReferenceFoldersType`,n),panelAppSectionLabel:T(`chatPanelAppReferenceSection`,n),parentLabel:T(`chatContextReferenceParent`,n),parentDescription:T(`chatContextReferenceParentDescription`,n),parentHintLabel:T(`chatContextReferenceParentHint`,n),projectDescription:T(`chatContextReferenceProjectDescription`,n),projectPathLabel:T(`chatContextReferenceProjectPath`,n),projectSectionLabel:T(`chatContextReferenceProjectSection`,n),projectSubtitle:T(`chatContextReferenceProjectType`,n),projectsDescription:T(`chatContextReferenceProjectsDescription`,n),projectsHintLabel:T(`chatContextReferenceProjectsHint`,n),projectsLabel:T(`chatContextReferenceProjectsLabel`,n),projectsLoadFailedLabel:T(`chatContextReferenceProjectsLoadFailed`,n),projectsSubtitle:T(`chatContextReferenceProjectsType`,n),projectRootLabel:T(`chatContextReferenceProjectRoot`,n),searchFailedLabel:T(`chatContextReferenceSearchFailed`,n),systemObjectGroupHintLabel:T(`chatSystemObjectGroupHint`,n),systemObjectSectionLabel:T(`chatSystemObjectSection`,n)},panelApp:c},menuTexts:{loadingLabel:T(`chatContextReferenceLoading`,n),sectionLabel:T(`chatContextReferenceSection`,n),emptyLabel:T(`chatContextReferenceNoResult`,n),hintLabel:T(`chatContextReferenceHint`,n),itemHintLabel:T(`chatContextReferenceItemHint`,n)},language:n,onNavigate:r,onSelectSystemObject:o})]}function b8(e){return[`server-path-search`,e.basePath.trim(),e.query?.trim()??``,e.limit??null]}function x8(e){let{enabled:t,limit:n}=e,r=e.basePath.trim(),i=e.query?.trim()??``;return dn({queryKey:b8({basePath:r,query:i,limit:n}),queryFn:()=>rn({basePath:r,query:i,limit:n}),enabled:(t??!0)&&!!r,staleTime:5e3})}function S8(e){let{enabled:t,limit:n,objectType:r}=e,i=e.query.trim();return dn({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 C8(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 w8(e){let{inputSurfaceTrigger:t,isContextReferenceTrigger:n,query:r,referenceLocation:i}=e,a=vY({enabled:n&&i.view===`root`||t?.key===Fh.key}),o=id({enabled:!!(n&&(i.view===`root`||i.view===`projects`))}),s=i.view===`system-objects`?i.objectType:void 0;return{panelApps:a,projects:o,systemObjects:S8({enabled:!!(n&&(i.view===`root`||i.view===`system-objects`)),query:r,limit:s?20:6,objectType:s})}}function T8(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,V.useState)({view:`root`}),[p,m]=(0,V.useState)(null),h=(0,V.useRef)(`null`),g=(0,V.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===H6.key,v=d.view===`files`||d.view===`folders`,y=v?d.path:``,b=(0,V.useDeferredValue)(_?p.query:``),x=!!(_&&s&&v&&!b.trim()),S=!!(_&&s&&(d.view===`root`||v)&&b.trim()),C=Ic({path:y||`.`,basePath:s,includeFiles:d.view===`files`,enabled:x}),w=x8({basePath:s,query:b,enabled:S}),T=x?C:w,E=(0,V.useMemo)(()=>x?C8({entries:C.data?.entries??[],parentRelativePath:y}):w.data?.entries??[],[x,y,C.data?.entries,w.data?.entries]),{panelApps:D,projects:O,systemObjects:k}=w8({inputSurfaceTrigger:p,isContextReferenceTrigger:_,query:b,referenceLocation:d}),A=(0,V.useMemo)(()=>y8({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,V.useMemo)(()=>WU({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 E8=Se.chat.modelFavorites,D8=[`preference`,E8];function O8(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 k8(e){let t=yn(),n=(0,V.useMemo)(()=>new Set(e),[e]),r=dn({queryKey:D8,queryFn:()=>gn(E8),staleTime:3e4}),i=(0,V.useMemo)(()=>O8(r.data?.value),[r.data?.value]),a=(0,V.useMemo)(()=>i.filter(e=>n.has(e)),[n,i]),o=zt({mutationFn:async e=>await Ye(E8,e),onMutate:async e=>{await t.cancelQueries({queryKey:D8});let n=t.getQueryData(D8);return t.setQueryData(D8,{key:E8,value:e,updatedAt:new Date().toISOString()}),{previous:n}},onError:(e,n,r)=>{r?.previous&&t.setQueryData(D8,r.previous)},onSuccess:e=>{t.setQueryData(D8,e)}}),s=(0,V.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 A8=new u3({storageKey:`nextclaw.chat.recent-skills`,limit:5});function j8(e){let{addAttachments:t,attachmentSupported:n,inputBarRef:r}=e,i=(0,V.useCallback)(e=>{if(e===`unsupported-type`){L.error(T(`chatInputAttachmentUnsupported`));return}if(e===`too-large`){L.error(T(`chatInputAttachmentTooLarge`).replace(`{maxMb}`,String(b2/(1024*1024))));return}L.error(T(`chatInputAttachmentReadFailed`))},[]),a=(0,V.useCallback)(async e=>{if(!n||e.length===0)return;let a=await T2(e,{uploadBatch:Me});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,V.useCallback)(async e=>{let t=Array.from(e.target.files??[]);e.currentTarget.value=``,await a(t)},[a])}}function M8(e){let{inputBarRef:t,intentManager:n,selectedSessionKey:r}=e;(0,V.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 N8(e){return(0,V.useCallback)(t=>{let n=[...t];e.update(e=>({nodes:n,attachments:F1(n,e.attachments),text:j1(n),selectedSkills:M1(n),sendError:null}))},[e])}function P8(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function F8(e){let{inputActions:t,selectedSessionKey:n}=e,r=kc(),i=(0,V.useRef)(0),a=(0,V.useRef)(new Map),o=(0,V.useRef)(Promise.resolve());return(0,V.useCallback)((e,s,c)=>{let l=n?.trim();if(!l)return;let u=++i.current,d=`${l}:model`,f=`${l}:thinking`;P8(e,`preferredModel`)&&a.current.set(d,u),P8(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 P8(e,`preferredModel`)&&a.current.get(d)===u&&t.selectedModel===s.selectedModel&&P8(c,`selectedModel`)&&(n.selectedModel=c.selectedModel),P8(e,`preferredThinking`)&&a.current.get(f)===u&&t.selectedThinkingLevel===s.selectedThinkingLevel&&P8(c,`selectedThinkingLevel`)&&(n.selectedThinkingLevel=c.selectedThinkingLevel),n})})},[t,n,r])}function I8(e){let{language:t,onContextCompactingChange:n,onSendPresetMessage:r,selectedSessionKey:i}=e,a=il(),o=(0,V.useRef)(new Set),s=(0,V.useCallback)(async e=>{if(!o.current.has(e)){o.current.add(e),n?.(e,!0);try{await It(e),L.success(T(`chatSlashCommandCompactContextSuccess`,t))}catch(e){let n=e instanceof Error?e.message:String(e);L.error(`${T(`chatSlashCommandCompactContextFailed`,t)}: ${n}`)}finally{o.current.delete(e),n?.(e,!1)}}},[t,n]);return(0,V.useMemo)(()=>{let e=i?.trim();return e?[{key:`side-chat`,icon:`message-square-plus`,title:T(`chatSlashCommandSideChatTitle`,t),description:T(`chatSlashCommandSideChatDescription`,t),detailLines:[T(`chatSlashCommandSideChatDetail`,t)],keywords:[`side`,`chat`,`child`,`branch`,`new`],onSelect:()=>a.chatThreadManager.openSideChatDraft(e)},{key:`update-session-title`,icon:`command`,title:T(`chatSlashCommandUpdateSessionTitleTitle`,t),description:T(`chatSlashCommandUpdateSessionTitleDescription`,t),detailLines:[T(`chatSlashCommandUpdateSessionTitleDetail`,t)],keywords:[`update`,`rename`,`title`,`session`,`更新`,`重命名`,`标题`,`会话`],onSelect:()=>void r(T(`chatSlashCommandUpdateSessionTitlePrompt`,t))},{key:`compact-context`,icon:`list-collapse`,title:T(`chatSlashCommandCompactContextTitle`,t),description:T(`chatSlashCommandCompactContextDescription`,t),detailLines:[T(`chatSlashCommandCompactContextDetail`,t)],keywords:[`compact`,`compress`,`context`,`summary`,`压缩`,`上下文`],onSelect:()=>void s(e)}]:[]},[s,t,r,a.chatThreadManager,i])}function L8(e){return(0,V.useCallback)(t=>{I.systemObjectReferences.resolve(t).then(t=>{e.current?.insertInputSurfaceToken({tokenKind:s,tokenKey:t.uri,label:t.label,data:{reference:t}})}).catch(e=>{let t=e instanceof Error?e.message:T(`error`);L.error(`${T(`chatSystemObjectResolveFailed`)}: ${t}`)})},[e])}function R8(){return{off:T(`chatThinkingLevelOff`),minimal:T(`chatThinkingLevelMinimal`),low:T(`chatThinkingLevelLow`),medium:T(`chatThinkingLevelMedium`),high:T(`chatThinkingLevelHigh`),adaptive:T(`chatThinkingLevelAdaptive`),xhigh:T(`chatThinkingLevelXhigh`)}}function z8(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:b,thinkingDefaultLevel:x,thinkingSupportedLevels:S,unfavoriteModelLabel:C}=e;return[Z6({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:T(`chatSelectModel`),modelNoOptionsLabel:T(`chatModelNoOptions`),modelSearchPlaceholder:u,modelSearchEmptyLabel:l,favoriteModelsLabel:i,favoriteModelLabel:n,unfavoriteModelLabel:C,manageModelsLabel:T(`chatManageModels`),discoveredModelsSummaryLabel:T(`chatDiscoveredModelsSummary`),discoveredModelsViewLabel:T(`chatDiscoveredModelsView`),discoveredModelsGroupLabel:T(`chatDiscoveredModelsGroup`),discoveredModelAddLabel:T(`chatDiscoveredModelAdd`),discoveredModelAddedLabel:T(`chatDiscoveredModelAddedShort`),discoveredModelsDismissLabel:T(`chatDiscoveredModelsDismiss`),discoveredModelsDoneLabel:T(`chatDiscoveredModelsDone`),discoveredModelsCloseLabel:T(`chatDiscoveredModelsClose`),recentModelsLabel:v,allModelsLabel:t}}),Q6({supportedLevels:S,selectedThinkingLevel:b,defaultThinkingLevel:x,onValueChange:g,texts:{thinkingLabels:R8()}})].filter(e=>e!==null)}function B8(e){let{allSkillsLabel:t,isSkillsLoading:n,onSelectedKeysChange:r,recentSkillGroupValues:i,recentSkillValues:a,recentSkillsLabel:o,selectedSkills:s,skillRecords:c}=e;return l8({skillRecords:c,recentSkillValues:a,groupedRecentSkillValues:i,selectedSkills:[...s],isLoading:n,onSelectedKeysChange:r,texts:{title:T(`chatSkillsPickerTitle`),searchPlaceholder:T(`chatSkillsPickerSearchPlaceholder`),emptyLabel:T(`chatSkillsPickerEmpty`),loadingLabel:T(`sessionsLoading`),manageLabel:T(`chatSkillsPickerManage`),recentSkillsLabel:o,allSkillsLabel:t}})}function V8(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 H8({children:e,disabled:t=!1,label:n,onClick:r}){return(0,H.jsxs)(oi,{children:[(0,H.jsx)(si,{asChild:!0,children:(0,H.jsx)(`span`,{className:`inline-flex`,children:(0,H.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,H.jsx)(Yr,{side:`top`,children:n})]})}function U8({controller:e}){return e.queuedInputs.length===0?null:(0,H.jsx)(ti,{delayDuration:120,children:(0,H.jsx)(`div`,{className:`flex flex-col gap-0.5`,children:e.queuedInputs.map(t=>(0,H.jsxs)(`div`,{className:`flex min-h-8 min-w-0 items-center gap-2 text-sm`,children:[(0,H.jsx)(ba,{className:`h-4 w-4 shrink-0 text-muted-foreground/70`}),(0,H.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-medium text-foreground/80`,children:t.preview||T(`chatQueuedBannerAttachmentFallback`)}),t.isSubmitting?(0,H.jsxs)(`span`,{"aria-label":T(`chatQueuedSubmitting`),className:`inline-flex shrink-0 items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,H.jsx)(mi,{className:`h-3.5 w-3.5 animate-spin`}),T(`chatQueuedSubmitting`)]}):(0,H.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,H.jsx)(H8,{label:T(`chatQueuedEdit`),onClick:()=>e.editQueuedInput(t.id),children:(0,H.jsx)(Oo,{className:`h-4 w-4`})}),(0,H.jsx)(H8,{label:T(`chatQueuedDelete`),onClick:()=>e.deleteQueuedInput(t.id),children:(0,H.jsx)(Yo,{className:`h-4 w-4`})})]})]},t.id))})})}function W8(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 G8(e){let{skillGroupLabels:t,skillScopeLabels:n}=(0,V.useMemo)(()=>({skillScopeLabels:{builtin:T(`chatSkillScopeBuiltin`),global:T(`chatSkillScopeGlobal`),project:T(`chatSkillScopeProject`),workspace:T(`chatSkillScopeWorkspace`)},skillGroupLabels:{builtin:T(`chatSkillGroupBuiltin`),global:T(`chatSkillGroupGlobal`),project:T(`chatSkillGroupProject`),workspace:T(`chatSkillGroupWorkspace`)}}),[e]);return{skillScopeLabels:n,skillGroupLabels:t,slashTexts:(0,V.useMemo)(()=>({slashSkillSubtitle:T(`chatSlashTypeSkill`),slashSkillSpecLabel:T(`chatSlashSkillSpec`),slashSkillScopeLabel:T(`chatSlashSkillScope`),noSkillDescription:T(`chatSkillsPickerNoDescription`)}),[e]),recentModelsLabel:T(`chatPickerRecentModels`),allModelsLabel:T(`chatPickerAllModels`),favoriteModelsLabel:T(`chatPickerFavoriteModels`),modelSearchPlaceholder:T(`chatModelSearchPlaceholder`),modelSearchEmptyLabel:T(`chatModelSearchEmpty`),favoriteModelLabel:T(`chatFavoriteModel`),unfavoriteModelLabel:T(`chatUnfavoriteModel`),recentSkillsLabel:T(`chatPickerRecent`),allSkillsLabel:T(`chatPickerAllSkills`)}}function K8(e){let{modelOptions:t,skillGroupLabels:n,skillRecords:r,skillScopeLabels:i}=e,a=(0,V.useMemo)(()=>W8(r,i,n),[n,i,r]),o=(0,V.useMemo)(()=>J6(t),[t]);return{skillRecords:a,modelRecords:o,recentModelValues:d3.resolveVisible({availableValues:o.map(e=>e.value),minAvailableCount:5}),recentSkillValues:A8.resolveVisible({availableValues:a.map(e=>e.key),minAvailableCount:0}),recentSkillGroupValues:A8.resolveVisible({availableValues:a.map(e=>e.key),minAvailableCount:4})}}var q8=(0,V.memo)(function(e){let{contextWindow:t,controller:n,inputActions:r,inputQuery:i,inputSnapshot:a,onContextCompactingChange:o,placeholder:s,surface:c=`default`}=e,l=il(),{language:u}=Nn(),d=e1(e=>e.layout),{isMobile:f}=c6(),p=(0,V.useRef)(null),m=(0,V.useRef)(null),h=G8(u),{skillRecords:g,modelRecords:_,recentModelValues:v,recentSkillValues:y,recentSkillGroupValues:b}=K8({modelOptions:i.modelOptions,skillRecords:i.skillRecords,skillGroupLabels:h.skillGroupLabels,skillScopeLabels:h.skillScopeLabels}),x=(0,V.useMemo)(()=>J6(i.discoveredModelOptions),[i.discoveredModelOptions]),S=I8({language:u,onContextCompactingChange:o,onSendPresetMessage:n.sendPresetMessage,selectedSessionKey:i.selectedSessionKey}),C=(0,V.useCallback)(e=>void l.chatUiManager.showContent({target:{type:`panel_app`,payload:{appId:e}}}),[l.chatUiManager]),w=i.selectedSessionKey?i.selectedSession?.projectRoot??i.defaultProjectRoot??``:a.pendingProjectRoot??i.defaultProjectRoot??``,D=L8(p),{inputSurfaceState:O,setInputSurfaceTrigger:k}=T8({commands:S,isSkillsLoading:i.isSkillsLoading,itemTexts:{slashTexts:h.slashTexts},language:u,onSelectPanelApp:C,onSelectSkill:A8.remember,onSelectSystemObject:D,projectRoot:w,recentSkillValues:y,skillRecords:g}),{favoriteModelValues:A,setModelFavorite:j}=k8((0,V.useMemo)(()=>_.map(e=>e.value),[_])),M=a.selectedModel??``,N=a.selectedThinkingLevel,P={isProviderStateResolved:i.isProviderStateResolved,modelOptions:i.modelOptions,sessionTypeUnavailable:i.sessionTypeState.sessionTypeUnavailable},ee=u4(P),te=d4(P),ne=f4(P),re=p4(P),F=ne?T(`chatModelNoOptions`):s??T(f?`chatInputPlaceholderCompact`:`chatInputPlaceholder`),ie=_.find(e=>e.value===M),ae=ie?.thinkingCapability?.supported??[],{handleFilesAdd:oe,handleFileInputChange:se}=j8({attachmentSupported:!0,inputBarRef:p,addAttachments:r.addAttachments}),ce=F8({inputActions:r,selectedSessionKey:i.selectedSessionKey}),le=N8(r);M8({inputBarRef:p,intentManager:l.chatComposerIntentManager,selectedSessionKey:i.selectedSessionKey});let ue=(0,V.useCallback)(e=>{let t=V8(_.find(t=>t.value===e)??x.find(t=>t.value===e),N);r.update({selectedModel:e,selectedThinkingLevel:t,sendError:null}),d3.remember(e,{namespace:i.sessionTypeState.selectedSessionType}),E(e)||d3.remember(e),ce({preferredModel:E(e)?null:e,preferredThinking:t},{selectedModel:e,selectedThinkingLevel:t},{selectedModel:M,selectedThinkingLevel:N})},[r,x,i.sessionTypeState.selectedSessionType,_,N,ce,M]),de=(0,V.useCallback)(async e=>{let t=await i.addDiscoveredModel(e);if(!t)throw L.error(T(`chatDiscoveredModelUnavailable`)),Error(`Discovered provider model is no longer available.`);L.success(T(`chatDiscoveredModelAdded`).replace(`{model}`,t.modelLabel))},[i]),fe=(0,V.useCallback)(e=>{r.setSelectedThinkingLevel(e),ce({preferredThinking:e},{selectedThinkingLevel:e},{selectedThinkingLevel:N})},[r,ce,N]),pe=(0,V.useCallback)(e=>{let t=a.selectedSkills;e.filter(e=>!t.includes(e)).forEach(e=>A8.remember(e)),le(P1([...a.nodes],e,i.skillRecords.map(e=>({ref:e.ref,name:e.name}))))},[le,i.skillRecords,a.nodes,a.selectedSkills]);(0,V.useEffect)(()=>{a.composerFocusRequestId&&(p.current?.focusComposerAtEnd([...a.nodes]),r.consumeComposerFocusRequest())},[r,a.composerFocusRequestId,a.nodes]);let me=z8({allModelsLabel:h.allModelsLabel,favoriteModelLabel:h.favoriteModelLabel,favoriteModelValues:A,favoriteModelsLabel:h.favoriteModelsLabel,hasModelOptions:ee,isModelOptionsLoading:te,discoveredModelRecords:x,modelRecords:_,modelSearchEmptyLabel:h.modelSearchEmptyLabel,modelSearchPlaceholder:h.modelSearchPlaceholder,onFavoriteModelToggle:j,onDiscoveredModelSelect:de,onDiscoveredModelsDismiss:i.dismissDiscoveredModels,onModelSelectOpen:()=>{i.refreshProviderModelCatalog()},onModelChange:ue,onThinkingChange:fe,recentModelValues:v,recentModelsLabel:h.recentModelsLabel,selectedModel:M,selectedThinkingLevel:N,thinkingSupportedLevels:ae,thinkingDefaultLevel:ie?.thinkingCapability?.default??null,unfavoriteModelLabel:h.unfavoriteModelLabel}),he=B8({allSkillsLabel:h.allSkillsLabel,onSelectedKeysChange:pe,recentSkillGroupValues:b,recentSkillValues:y,recentSkillsLabel:h.recentSkillsLabel,isSkillsLoading:i.isSkillsLoading,skillRecords:g,selectedSkills:a.selectedSkills}),ge=(0,V.useMemo)(()=>[...a.nodes],[a.nodes]),_e=c===`default`&&d===`flat`,ve=(0,H.jsx)(cO,{ref:p,surface:_e?`embedded`:c,topSlot:n.queuedInputs.length>0?(0,H.jsx)(U8,{controller:n}):null,composer:{nodes:ge,placeholder:F,excerptCharacterCountTemplate:T(`chatWorkspaceExcerptCharacterCount`),removeTokenLabel:T(`chatInputRemoveReference`),disabled:re,onNodesChange:le,onFilesAdd:oe,inputSurfaceTriggerSpecs:O.triggerSpecs,onInputSurfaceTriggerChange:k},inputSurface:O.panel??void 0,hint:Y6({isModelOptionsEmpty:ne,onGoToProviders:l.chatUiManager.goToProviders,texts:{noModelOptionsLabel:T(`chatModelNoOptions`),configureProviderLabel:T(`chatGoConfigureProvider`)}}),toolbar:{addMenuLabel:T(`chatInputAdd`),selects:[],trailingSelects:me,accessories:[{key:`attach`,label:T(`chatInputAttach`),icon:`paperclip`,disabled:re,onClick:()=>m.current?.click()}],skillPicker:he,actions:{isSending:n.isSending,canStopGeneration:n.canStopGeneration,sendDisabled:n.sendDisabled,stopDisabled:n.stopDisabled,stopHint:T(`chatStopUnavailable`),sendButtonLabel:n.primaryAction===`continue`?T(`chatContinueRun`):n.isSending?T(`chatQueueSend`):T(`chatSend`),sendIcon:n.primaryAction,stopButtonLabel:T(`chatStop`),contextWindow:t,onSend:n.send,onStop:n.stop}}});return(0,H.jsxs)(H.Fragment,{children:[_e?(0,H.jsx)(a0,{className:`pb-4 pt-2`,width:`composer`,children:ve}):ve,(0,H.jsx)(`input`,{ref:m,type:`file`,multiple:!0,className:`hidden`,onChange:se})]})});function J8(e){let{applyPromptSuggestion:t,applySystemObjectReference:n,consumeDraftIntent:r}=e,i=q9(),a=il();(0,V.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 Y8(e){if(!e||typeof e!=`object`)return null;let t=e.chatDraft;return!t||typeof t!=`object`?null:t}function X8(e){let{applyPromptSuggestion:t,sessionKey:n,setPendingProjectRoot:r,setPendingSessionType:i}=e,a=he(),o=(0,V.useRef)(null);(0,V.useEffect)(()=>{if(n)return;let e=Y8(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 Z8({inputQuery:e}){let t=il(),n=e.isProviderStateResolved&&e.modelOptions.length===0,r=e.sessionTypeState.sessionTypeUnavailableMessage?.trim()||null;return(0,H.jsxs)(H.Fragment,{children:[n?(0,H.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,H.jsx)(`span`,{className:`text-xs text-amber-800`,children:T(`chatModelNoOptions`)}),(0,H.jsx)(`button`,{type:`button`,onClick:t.chatUiManager.goToProviders,className:`text-xs font-semibold text-amber-900 underline-offset-2 hover:underline`,children:T(`chatGoConfigureProvider`)})]}):null,e.sessionTypeState.sessionTypeUnavailable&&r?(0,H.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,H.jsx)(`span`,{className:`text-xs text-amber-800`,children:r})}):null]})}function Q8(e){let{consumeDraftIntent:t=!1,materializationContext:n=null,onSessionMaterialized:r,sessionKey:i,showWelcomeForDraft:a=!0}=e,o=he(),s=i?null:Y8(o.state),c=typeof s?.prompt==`string`?s.prompt:null,l=$e(),u=du(e=>e.snapshot.selectedAgentId),d=B2(i??void 0),f=s6(i),{inputActions:p,inputSnapshot:m}=a6(c,i),h=(0,V.useCallback)(e=>{p.update(t=>{let n=rW(t.nodes,e);return{nodes:n,text:j1(n),composerFocusRequestId:Date.now(),sendError:null}})},[p]),g=G3({sessionKey:i,inputSnapshot:m,setPendingSessionType:p.setPendingSessionType}),[_,v]=(0,V.useState)(()=>new Set),y=(0,V.useCallback)((e,t)=>{v(n=>{let r=new Set(n);return t?r.add(e):r.delete(e),r})},[]);(0,V.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]),X8({applyPromptSuggestion:p.applyPromptSuggestion,sessionKey:i,setPendingProjectRoot:p.setPendingProjectRoot,setPendingSessionType:p.setPendingSessionType});let b=V2(l),x=d.isRunning||g.selectedSession?.status===`running`,S=d.snapshot.error,C=d.hydrateError?.message??(S?.code===`run-interrupted`?null:S?.message)??null,w=l.phase===`ready`&&L2(C)?null:C,E=b?null:l.phase===`ready`?w:U2({message:w,status:l}),D=O4({agent:(0,V.useMemo)(()=>({...d,isRunning:x,isSending:d.isSending}),[d,x]),inputSnapshot:m,inputQuery:g,isRuntimeBlocked:b,materializationContext:n,runQueue:f,selectedAgentId:u,sessionKey:i,onSessionMaterialized:r,resetComposer:p.resetComposer,restoreComposer:p.restoreComposer,setSendError:p.setSendError}),O=(0,V.useRef)(D);(0,V.useEffect)(()=>{O.current=D},[D]);let k=(0,V.useMemo)(()=>({canStopGeneration:D.canStopGeneration,deleteQueuedInput:e=>O.current.deleteQueuedInput(e),editQueuedInput:e=>O.current.editQueuedInput(e),isSending:D.isSending,primaryAction:D.primaryAction,queuedInputs:D.queuedInputs,send:()=>O.current.send(),sendPresetMessage:e=>O.current.sendPresetMessage(e).catch(()=>void 0),sendDisabled:D.sendDisabled,stop:()=>O.current.stop(),stopDisabled:D.stopDisabled}),[D.canStopGeneration,D.isSending,D.primaryAction,D.queuedInputs,D.sendDisabled,D.stopDisabled]),A=(0,V.useMemo)(()=>G2(KK(d.snapshot.contextWindow)),[d.snapshot.contextWindow]),{selectedSession:j}=g,M=m.sendError?.trim()||E?.trim()||(j?.activityPreview?.state===`failed`&&j.activityPreview.statusKind!==`run-interrupted`?j.activityPreview.statusText?.trim():null)||null,N=M?(0,H.jsx)(`div`,{className:`rounded-lg border-l-2 border-destructive/40 bg-muted/45 px-3 py-2.5`,role:`status`,children:(0,H.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:M})}):null;J8({consumeDraftIntent:t,applyPromptSuggestion:p.applyPromptSuggestion,applySystemObjectReference:h});let P=(0,V.useCallback)((e,t)=>(0,H.jsx)(q8,{contextWindow:A,controller:k,inputActions:p,inputQuery:g,inputSnapshot:m,onContextCompactingChange:y,placeholder:t,surface:e}),[A,k,p,g,m,y]),ee=a&&!i&&d.visibleMessages.length===0&&!d.isHydrating&&!D.isSending;return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Z8,{inputQuery:g}),(0,H.jsx)(o0,{hasPreviousMessages:d.hasPreviousMessages,historyError:d.historyError,isHistoryLoading:d.isHydrating,isLoadingPreviousMessages:d.isLoadingPreviousMessages,isSending:D.isSending,canContinue:D.canContinue,messageActionsDisabled:D.isSending||b,isContextCompacting:!!(i&&_.has(i)),bottomSlot:ee?null:N,messages:d.visibleMessages,sessionKey:i,showWelcome:ee,onLoadPreviousMessages:d.loadPreviousMessages,onContinueRun:()=>O.current.continueRun(),onEditMessage:e=>O.current.editMessage(e),welcomeSlot:(0,H.jsx)(l4,{inputSlot:(0,H.jsxs)(`div`,{className:`space-y-2`,children:[P(`embedded`,T(`chatWelcomeInputPlaceholder`)),N]}),pendingProjectRoot:m.pendingProjectRoot,pendingSessionType:m.pendingSessionType,selectedSessionTypeValue:m.selectedSessionType,onSelectProjectRoot:p.setPendingProjectRoot,onSelectPrompt:p.applyPromptSuggestion,onSelectSessionType:p.setPendingSessionType})}),ee?null:P(`default`)]})}var $8=Pr,e5=Lr,t5=V.forwardRef(({className:e,...t},n)=>(0,H.jsx)(Br,{ref:n,className:c(`fixed inset-0 z-[var(--z-modal-backdrop,10000)] bg-black/35 backdrop-blur-[1px] data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0`,e),...t}));t5.displayName=Br.displayName;var n5=dt(`fixed z-[var(--z-modal,10050)] bg-background shadow-2xl transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500`,{variants:{side:{top:`inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top`,bottom:`inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom`,left:`inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm`,right:`inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm`}},defaultVariants:{side:`right`}}),r5=V.forwardRef(({children:e,className:t,closeLabel:n=`Close`,side:r,...i},a)=>(0,H.jsxs)(e5,{children:[(0,H.jsx)(t5,{}),(0,H.jsxs)(jr,{ref:a,className:c(n5({side:r}),t),...i,children:[e,(0,H.jsxs)(Wr,{className:`absolute right-4 top-4 rounded-lg p-1.5 text-muted-foreground opacity-75 transition-colors hover:bg-muted hover:text-foreground hover:opacity-100 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border disabled:pointer-events-none`,children:[(0,H.jsx)(_i,{className:`h-4 w-4`}),(0,H.jsx)(`span`,{className:`sr-only`,children:n})]})]})]}));r5.displayName=jr.displayName;function i5({className:e,...t}){return(0,H.jsx)(`div`,{className:c(`flex flex-col space-y-2 text-left`,e),...t})}i5.displayName=`SheetHeader`;function a5({className:e,...t}){return(0,H.jsx)(`div`,{className:c(`flex flex-col-reverse gap-2 sm:flex-row sm:justify-end`,e),...t})}a5.displayName=`SheetFooter`;var o5=V.forwardRef(({className:e,...t},n)=>(0,H.jsx)(Nr,{ref:n,className:c(`text-lg font-semibold tracking-tight text-foreground`,e),...t}));o5.displayName=Nr.displayName;var s5=V.forwardRef(({className:e,...t},n)=>(0,H.jsx)(Mr,{ref:n,className:c(`text-sm leading-relaxed text-muted-foreground`,e),...t}));s5.displayName=Mr.displayName;function c5(e){return j(e??void 0)}function l5(e){if(!e)return`-`;let t=new Date(e);if(Number.isNaN(t.getTime()))return`-`;let n=Date.now(),r=t.getTime()-n,i=A(),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 u5(e){return typeof e!=`number`||!Number.isFinite(e)?`-`:j(new Date(e))}function d5(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 f5=[`周日`,`周一`,`周二`,`周三`,`周四`,`周五`,`周六`],p5=[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`];function m5(e){return e.padStart(2,`0`)}function h5(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=`${m5(i)}:${m5(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?f5[e]:p5[e];return t?`${t} ${l}`:null}return r!==`*`&&i!==`*`&&a!==`*`&&o===`*`&&s===`*`?c?`每月 ${a} 日 ${l}`:`monthly ${a} ${l}`:null}function g5(e){let t=A(),n=t===`zh`,{schedule:r}=e;if(r.kind===`cron`)return r.expr?h5(r.expr,t)??`cron ${r.expr}`:`cron`;if(r.kind===`every`){let e=d5(r.everyMs);return n?`每 ${e}`:`every ${e}`}return r.kind===`at`?`${n?`定时`:`at`} ${u5(r.atMs)}`:`-`}function _5(e){return e.payload.sessionId?.trim()||`cron:${e.id}`}function v5(e){return!!(e.payload.sessionId?.trim()||e.state.lastRunAt)}function y5(e,t){let n=t?.trim();return!!(n&&e.payload.sessionId?.trim()===n)}function b5({label:e,value:t}){return(0,H.jsxs)(`div`,{className:`flex items-start justify-between gap-4 border-b border-border/50 py-3 last:border-b-0`,children:[(0,H.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e}),(0,H.jsx)(`span`,{className:`max-w-[65%] break-words text-right text-xs font-medium text-foreground`,children:t})]})}function x5({job:e,open:t,onDelete:n,onOpenChange:r,onRun:i,onToggle:a}){if(!e)return null;let o=_5(e),s=!!e.payload.sessionId?.trim(),l=v5(e)?p9(o):null,u=e.state.lastStatus?T(`cronLastStatus${e.state.lastStatus[0].toUpperCase()}${e.state.lastStatus.slice(1)}`):T(`cronNeverRun`);return(0,H.jsx)($8,{open:t,onOpenChange:r,children:(0,H.jsxs)(r5,{side:`right`,closeLabel:T(`cronCloseDetails`),className:`flex w-full flex-col overflow-hidden p-0 sm:max-w-[510px]`,children:[(0,H.jsxs)(i5,{className:`shrink-0 border-b border-border/60 px-5 pb-5 pt-6 pr-14 sm:px-7 sm:pt-7`,children:[(0,H.jsxs)(`div`,{className:`mb-1 flex flex-wrap items-center gap-2 text-xs text-muted-foreground`,children:[(0,H.jsx)(`span`,{children:g5(e)}),(0,H.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,H.jsx)(`span`,{children:T(s?`cronBoundSession`:`cronDedicatedSession`)})]}),(0,H.jsx)(o5,{children:e.name||e.id}),(0,H.jsx)(s5,{children:T(`cronDetailDescription`)})]}),(0,H.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-6 overflow-y-auto px-5 py-6 sm:px-7`,children:[(0,H.jsxs)(`section`,{children:[(0,H.jsx)(`h3`,{className:`mb-2 text-xs font-semibold uppercase tracking-wide text-muted-foreground`,children:T(`cronTaskPrompt`)}),(0,H.jsx)(`div`,{className:`rounded-2xl bg-muted/55 px-4 py-3 text-sm leading-6 text-foreground`,children:e.payload.message})]}),(0,H.jsxs)(`section`,{children:[(0,H.jsx)(`h3`,{className:`mb-1 text-xs font-semibold uppercase tracking-wide text-muted-foreground`,children:T(`cronTaskDetails`)}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(b5,{label:T(`cronScheduleLabel`),value:g5(e)}),(0,H.jsx)(b5,{label:T(`cronNextRun`),value:c5(e.state.nextRunAt)}),(0,H.jsx)(b5,{label:T(`cronAgentLabel`),value:e.payload.agentId?.trim()||`main`}),(0,H.jsx)(b5,{label:T(`cronSessionLabel`),value:l?(0,H.jsx)(me,{href:l,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,H.jsx)(b5,{label:T(`cronCreatedAt`),value:c5(e.createdAt)})]})]}),(0,H.jsxs)(`section`,{children:[(0,H.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-4`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h3`,{className:`text-xs font-semibold uppercase tracking-wide text-muted-foreground`,children:T(`cronLatestRun`)}),(0,H.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:T(`cronLatestRunHint`)})]}),(0,H.jsx)(`span`,{className:c(`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:u})]}),(0,H.jsxs)(`div`,{className:`rounded-2xl border border-border/60 px-4 py-1`,children:[(0,H.jsx)(b5,{label:T(`cronLastRun`),value:c5(e.state.lastRunAt)}),e.state.lastError?(0,H.jsx)(b5,{label:T(`cronLastError`),value:e.state.lastError}):null]})]}),(0,H.jsxs)(`section`,{className:`flex items-center justify-between rounded-2xl border border-border/60 px-4 py-3`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`div`,{className:`text-sm font-medium text-foreground`,children:e.enabled?T(`cronEnabledState`):T(`cronPaused`)}),(0,H.jsx)(`div`,{className:`mt-0.5 text-xs text-muted-foreground`,children:T(`cronToggleHint`)})]}),(0,H.jsx)(ze,{checked:e.enabled,onCheckedChange:t=>a(e,t),"aria-label":e.enabled?T(`cronDisable`):T(`cronEnable`)})]}),l?null:(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:T(`cronSessionAvailableAfterRun`)})]}),(0,H.jsxs)(a5,{className:`shrink-0 border-t border-border/60 bg-background px-5 py-4 sm:px-7`,children:[(0,H.jsxs)(R,{variant:`ghost`,className:`text-red-600 hover:bg-red-50 hover:text-red-700`,onClick:()=>n(e),children:[(0,H.jsx)(Yo,{className:`mr-2 h-4 w-4`}),T(`delete`)]}),l?(0,H.jsx)(me,{href:l,className:c(Mt({variant:`outline`}),`hover:no-underline`),children:T(`cronOpenSession`)}):(0,H.jsx)(R,{variant:`outline`,disabled:!0,children:T(`cronOpenSession`)}),(0,H.jsxs)(R,{onClick:()=>i(e),children:[(0,H.jsx)(ko,{className:`mr-2 h-4 w-4`}),T(`cronRunNow`)]})]})]})})}function S5({job:e}){let t=e.state.lastStatus===`error`,n=t?T(`cronNeedsAttention`):e.enabled?T(`cronRunningNormally`):T(`cronPaused`);return(0,H.jsxs)(`span`,{className:c(`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,H.jsx)(`span`,{className:c(`h-1.5 w-1.5 rounded-full`,t?`bg-red-500`:e.enabled?`bg-emerald-500`:`bg-muted-foreground/50`)}),n]})}function C5({expanded:e,job:t,onDelete:n,onEdit:r,onRun:i,onToggleExpanded:a,onToggle:o}){let[s,l]=(0,V.useState)(!1),u=!!t.payload.sessionId?.trim(),d=t.state.lastStatus===`error`,f=d?Xo:Tr,p=t.name||t.id,m=`cron-job-preview-${t.id}`,h=_5(t),g=v5(t)?p9(h):null;return(0,H.jsxs)(`div`,{className:c(`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,H.jsxs)(`div`,{className:`flex items-center gap-3 px-1 py-3.5`,children:[(0,H.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":`${T(e?`cronCollapseTask`:`cronExpandTask`)} ${p}`,onClick:()=>a(t),children:[(0,H.jsx)(`span`,{className:c(`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,H.jsx)(f,{className:`h-4 w-4`,"aria-hidden":`true`})}),(0,H.jsxs)(`span`,{className:`min-w-0`,children:[(0,H.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[(0,H.jsx)(`strong`,{className:`truncate text-[13px] font-semibold text-foreground`,children:p}),(0,H.jsx)(S5,{job:t}),(0,H.jsx)(`span`,{className:`rounded-full bg-muted px-2 py-0.5 text-[10px] font-medium text-muted-foreground`,children:T(u?`cronBoundSession`:`cronDedicatedSession`)}),t.deleteAfterRun?(0,H.jsx)(`span`,{className:`rounded-full bg-muted px-2 py-0.5 text-[10px] font-medium text-muted-foreground`,children:T(`cronOneShot`)}):null]}),(0,H.jsxs)(`span`,{className:`mt-1 flex flex-wrap items-center gap-x-3 gap-y-1 text-[11px] text-muted-foreground`,children:[(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,H.jsx)(ta,{className:`h-3.5 w-3.5`,"aria-hidden":`true`}),g5(t)]}),t.state.nextRunAt?(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,H.jsx)(ma,{className:`h-3.5 w-3.5`,"aria-hidden":`true`}),T(`cronNextRun`),` `,l5(t.state.nextRunAt)]}):null]})]})]}),(0,H.jsx)(ti,{delayDuration:250,children:(0,H.jsxs)(`div`,{className:`relative flex shrink-0 items-center`,children:[(0,H.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,H.jsxs)(oi,{children:[(0,H.jsx)(si,{asChild:!0,children:(0,H.jsx)(R,{variant:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:()=>r(t),"aria-label":`${T(`edit`)} ${p}`,children:(0,H.jsx)(Oo,{className:`h-3.5 w-3.5`})})}),(0,H.jsx)(Yr,{children:T(`cronEditDetails`)})]}),(0,H.jsxs)(Tc,{open:s,onOpenChange:l,children:[(0,H.jsxs)(oi,{children:[(0,H.jsx)(si,{asChild:!0,children:(0,H.jsx)(Ec,{asChild:!0,children:(0,H.jsx)(R,{variant:`ghost`,size:`icon`,className:`h-8 w-8`,"aria-label":`${T(`cronMoreActions`)} ${p}`,children:(0,H.jsx)(ui,{className:`h-4 w-4`})})})}),(0,H.jsx)(Yr,{children:T(`cronMoreActions`)})]}),(0,H.jsxs)(Oc,{align:`end`,sideOffset:4,className:`w-40 p-1`,children:[(0,H.jsxs)(`button`,{type:`button`,onClick:()=>{l(!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,H.jsx)(ko,{className:`h-3.5 w-3.5 text-muted-foreground`}),T(`cronRunNow`)]}),(0,H.jsxs)(`button`,{type:`button`,onClick:()=>{l(!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,H.jsx)(Yo,{className:`h-3.5 w-3.5`}),T(`delete`)]})]})]})]}),(0,H.jsx)(ze,{checked:t.enabled,onCheckedChange:e=>o(t,e),"aria-label":t.enabled?T(`cronDisable`):T(`cronEnable`)})]})})]}),(0,H.jsx)(`div`,{id:m,"aria-hidden":!e,className:c(`grid transition-[grid-template-rows,opacity] duration-200 ease-out`,e?`grid-rows-[1fr] opacity-100`:`grid-rows-[0fr] opacity-0`),children:(0,H.jsx)(`div`,{className:`overflow-hidden`,children:(0,H.jsxs)(`div`,{className:`mb-3 ml-12 mr-1 rounded-xl bg-background/70 px-4 py-3`,children:[(0,H.jsx)(`div`,{className:`text-[10px] font-semibold uppercase tracking-[0.1em] text-muted-foreground`,children:T(`cronTaskPrompt`)}),(0,H.jsx)(`p`,{className:`mt-1.5 line-clamp-4 text-xs leading-5 text-foreground`,children:t.payload.message}),(0,H.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,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsx)(`dt`,{className:`text-muted-foreground`,children:T(`cronAgentLabel`)}),(0,H.jsx)(`dd`,{className:`mt-0.5 truncate font-medium text-foreground`,children:t.payload.agentId?.trim()||`main`})]}),(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsx)(`dt`,{className:`text-muted-foreground`,children:T(`cronSessionLabel`)}),(0,H.jsx)(`dd`,{className:`mt-0.5 truncate font-medium text-foreground`,children:g?(0,H.jsx)(me,{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,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsx)(`dt`,{className:`text-muted-foreground`,children:T(`cronLastRun`)}),(0,H.jsx)(`dd`,{className:`mt-0.5 truncate font-medium text-foreground`,children:c5(t.state.lastRunAt)})]})]}),t.state.lastError?(0,H.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 w5=[{titleKey:`cronTemplateAiNewsTitle`,descriptionKey:`cronTemplateAiNewsDescription`,promptKey:`cronTemplateAiNewsPrompt`,icon:yo},{titleKey:`cronTemplateWeeklyReviewTitle`,descriptionKey:`cronTemplateWeeklyReviewDescription`,promptKey:`cronTemplateWeeklyReviewPrompt`,icon:ra},{titleKey:`cronTemplateMeetingPrepTitle`,descriptionKey:`cronTemplateMeetingPrepDescription`,promptKey:`cronTemplateMeetingPrepPrompt`,icon:na},{titleKey:`cronTemplateLearningTitle`,descriptionKey:`cronTemplateLearningDescription`,promptKey:`cronTemplateLearningPrompt`,icon:pi},{titleKey:`cronTemplateCompetitorTitle`,descriptionKey:`cronTemplateCompetitorDescription`,promptKey:`cronTemplateCompetitorPrompt`,icon:no},{titleKey:`cronTemplateFamilyTitle`,descriptionKey:`cronTemplateFamilyDescription`,promptKey:`cronTemplateFamilyPrompt`,icon:Ja}],T5=(0,V.forwardRef)(function({prominent:e=!1,value:t,onChange:n,onSubmit:r},i){return(0,H.jsxs)(`form`,{className:c(`relative w-full`,e&&`mx-auto max-w-3xl`),onSubmit:e=>{e.preventDefault(),r()},children:[(0,H.jsx)(Ar,{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,H.jsx)(Gt,{ref:i,value:t,onChange:e=>n(e.target.value),className:`pl-9 pr-11`,placeholder:T(`cronComposerPlaceholder`),"aria-label":T(`cronComposerLabel`)}),(0,H.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":T(`cronComposerSubmit`),children:(0,H.jsx)(Ki,{className:`h-4 w-4`})})]})});function E5({compact:e=!1,onSelect:t}){return(0,H.jsx)(`div`,{className:`grid grid-cols-[repeat(auto-fit,minmax(min(100%,17.5rem),1fr))] gap-3`,children:(e?w5.slice(0,4):w5).map(e=>{let n=e.icon;return(0,H.jsxs)(`button`,{type:`button`,onClick:()=>t(T(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,H.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,H.jsx)(n,{className:`h-4 w-4`,"aria-hidden":`true`})}),(0,H.jsxs)(`span`,{className:`min-w-0`,children:[(0,H.jsx)(`strong`,{className:`block text-sm font-medium text-foreground`,children:T(e.titleKey)}),(0,H.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-muted-foreground`,children:T(e.descriptionKey)})]})]},e.titleKey)})})}function D5(e={all:!0}){return dn({queryKey:[`cron`,e],queryFn:()=>Nt(e),placeholderData:e=>e,staleTime:1e4})}function O5(){let e=yn();return{onSuccess:()=>{e.invalidateQueries({queryKey:[`cron`]}),L.success(T(`configSavedApplied`))},onError:e=>{L.error(T(`configSaveFailed`)+`: `+e.message)}}}function k5(){return zt({mutationFn:({id:e})=>nt(e),...O5()})}function A5(){return zt({mutationFn:({id:e,enabled:t})=>wt(e,{enabled:t}),...O5()})}function j5(){return zt({mutationFn:({id:e,force:t})=>yt(e,{force:t}),...O5()})}var M5=10;function N5({summary:e}){let{attention:t,disabled:n,enabled:r,total:i}=e,a=[{label:T(`cronSummaryTotal`),value:i},{label:T(`cronSummaryEnabled`),value:r},{label:T(`cronSummaryPaused`),value:n}],o=t>0?Ir:ca;return(0,H.jsxs)(`section`,{"aria-label":T(`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,H.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,H.jsx)(`span`,{className:c(`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,H.jsx)(o,{className:`h-4 w-4`,"aria-hidden":`true`})}),(0,H.jsxs)(`span`,{className:`min-w-0`,children:[(0,H.jsx)(`strong`,{className:`block truncate text-xs font-semibold text-foreground`,children:t>0?`${t} ${T(`cronAttentionSummary`)}`:T(`cronAllHealthy`)}),(0,H.jsx)(`span`,{className:`mt-1 block truncate text-[11px] text-muted-foreground`,children:T(t>0?`cronAttentionSummaryHint`:`cronAllHealthyHint`)})]})]}),a.map(e=>(0,H.jsxs)(`div`,{className:`bg-muted/40 px-4 py-3.5 sm:px-5`,children:[(0,H.jsx)(`div`,{className:`text-lg font-semibold tabular-nums text-foreground`,children:e.value}),(0,H.jsx)(`div`,{className:`mt-1 text-[11px] text-muted-foreground`,children:e.label})]},e.label))]})}function P5({page:e,total:t,disabled:n,onPageChange:r}){let i=Math.ceil(t/M5);if(i<=1)return null;let a=e*M5+1,o=Math.min(t,a+M5-1);return(0,H.jsxs)(`nav`,{"aria-label":T(`cronPaginationLabel`),className:`flex items-center justify-between gap-3 border-b border-border/60 py-3 text-xs text-muted-foreground`,children:[(0,H.jsxs)(`span`,{className:`tabular-nums`,children:[a,`–`,o,` / `,t]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,H.jsx)(R,{type:`button`,variant:`ghost`,size:`icon`,className:`h-8 w-8`,disabled:n||e===0,onClick:()=>r(e-1),"aria-label":T(`cronPreviousPage`),children:(0,H.jsx)(aa,{className:`h-4 w-4`})}),(0,H.jsxs)(`span`,{className:`min-w-14 text-center tabular-nums text-foreground`,children:[e+1,` / `,i]}),(0,H.jsx)(R,{type:`button`,variant:`ghost`,size:`icon`,className:`h-8 w-8`,disabled:n||e>=i-1,onClick:()=>r(e+1),"aria-label":T(`cronNextPage`),children:(0,H.jsx)(oa,{className:`h-4 w-4`})})]})]})}function F5(){let[e,t]=(0,V.useState)(``),[n,r]=(0,V.useState)(``),[i,a]=(0,V.useState)(`all`),[o,s]=(0,V.useState)(0),[l,u]=(0,V.useState)(null),[d,f]=(0,V.useState)(null),p=(0,V.useDeferredValue)(n.trim()),m=(0,V.useRef)(null),h=il(),g=D5({all:!0,limit:M5,offset:o*M5,query:p,status:i}),_=k5(),v=A5(),y=j5(),{confirm:b,ConfirmDialog:x}=An(),S=g.data?.jobs??[],C=g.data?.total??0,w=g.data?.summary,E=S.find(e=>e.id===d)??null,D=()=>{let t=e.trim();if(!t){m.current?.focus();return}h.chatSessionListManager.createSession({prompt:t})},O=e=>{t(e),m.current?.focus()},k=async e=>{await b({title:`${T(`cronDeleteConfirm`)}?`,description:e.name?`${e.name} (${e.id})`:e.id,variant:`destructive`,confirmLabel:T(`delete`)})&&(u(null),f(null),S.length===1&&o>0&&s(o-1),_.mutate({id:e.id}))},A=(e,t)=>{(i===`enabled`&&!t||i===`disabled`&&t)&&S.length===1&&o>0&&s(o-1),v.mutate({id:e.id,enabled:t})},j=async e=>{let t=!e.enabled;t&&!await b({title:`${T(`cronRunForceConfirm`)}?`,description:e.name?`${e.name} (${e.id})`:e.id,confirmLabel:T(`cronRunNow`)})||y.mutate({id:e.id,force:t})},M=e=>{u(null),s(e)},N=e=>{u(t=>t===e.id?null:e.id)},P=(w?.total??0)>0;return(0,H.jsxs)(bt,{className:`space-y-6`,children:[(0,H.jsx)(_e,{headingLevel:1,title:T(`cronPageTitle`),description:T(`cronPageDescription`),actions:(0,H.jsx)(B,{size:`lg`,label:T(`refresh`),icon:(0,H.jsx)(gi,{className:c(`h-4 w-4`,g.isFetching&&`animate-spin`)}),onClick:()=>{o===0?(u(null),g.refetch()):M(0)}})}),P?(0,H.jsx)(T5,{ref:m,value:e,onChange:t,onSubmit:D}):null,g.isLoading?(0,H.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-20 text-muted-foreground`,children:[(0,H.jsx)(gi,{className:`mb-3 h-5 w-5 animate-spin`}),(0,H.jsx)(`span`,{className:`text-sm`,children:T(`cronLoading`)})]}):P?(0,H.jsxs)(H.Fragment,{children:[w?(0,H.jsx)(N5,{summary:w}):null,(0,H.jsxs)(`section`,{className:`pt-1`,children:[(0,H.jsx)(`div`,{className:`mb-3 flex items-end justify-between gap-4`,children:(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h2`,{className:`text-base font-semibold text-foreground`,children:T(`cronMyTasks`)}),(0,H.jsxs)(`p`,{className:`mt-0.5 text-xs text-muted-foreground`,children:[C,` `,T(`cronTaskCountUnit`)]})]})}),(0,H.jsxs)(`div`,{className:`mb-2 flex flex-wrap items-center justify-between gap-2.5`,children:[(0,H.jsxs)(`div`,{className:`relative min-w-[220px] flex-1`,children:[(0,H.jsx)(fi,{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,H.jsx)(Gt,{value:n,onChange:e=>{r(e.target.value),M(0)},placeholder:T(`cronSearchPlaceholder`),className:`pl-9`})]}),(0,H.jsx)(`div`,{className:`flex flex-wrap items-center gap-1`,"aria-label":T(`cronStatusLabel`),children:[[`all`,`cronStatusAll`],[`enabled`,`cronStatusEnabled`],[`disabled`,`cronStatusDisabled`],[`attention`,`cronStatusAttention`]].map(([e,t])=>(0,H.jsx)(`button`,{type:`button`,"aria-pressed":i===e,onClick:()=>{a(e),M(0)},className:c(`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:T(t)},e))})]}),S.length>0?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`div`,{"aria-busy":g.isFetching,className:c(`border-y border-border/60 transition-opacity`,g.isFetching&&`opacity-60`),children:S.map(e=>(0,H.jsx)(C5,{expanded:l===e.id,job:e,onDelete:k,onEdit:e=>f(e.id),onRun:j,onToggleExpanded:N,onToggle:A},e.id))}),(0,H.jsx)(P5,{page:o,total:C,disabled:g.isFetching,onPageChange:M})]}):(0,H.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-12 text-center text-muted-foreground`,children:[(0,H.jsx)(fi,{className:`mb-3 h-5 w-5`}),(0,H.jsx)(`span`,{className:`text-sm font-medium text-foreground`,children:T(`cronNoMatchingTasks`)}),(0,H.jsx)(`span`,{className:`mt-1 text-xs`,children:T(`cronNoMatchingTasksHint`)})]})]}),(0,H.jsxs)(`section`,{className:`pt-2`,children:[(0,H.jsxs)(`div`,{className:`mb-3`,children:[(0,H.jsx)(`h2`,{className:`text-base font-semibold text-foreground`,children:T(`cronNeedInspiration`)}),(0,H.jsx)(`p`,{className:`mt-0.5 text-xs text-muted-foreground`,children:T(`cronTemplateSelectionHint`)})]}),(0,H.jsx)(E5,{compact:!0,onSelect:O})]})]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.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,H.jsx)(`span`,{className:`mb-4 flex h-11 w-11 items-center justify-center rounded-2xl bg-card shadow-sm`,children:(0,H.jsx)(ao,{className:`h-5 w-5 text-primary`})}),(0,H.jsx)(`h2`,{className:`text-xl font-semibold text-foreground`,children:T(`cronEmptyHeroTitle`)}),(0,H.jsx)(`p`,{className:`mb-6 mt-2 max-w-2xl text-sm leading-6 text-muted-foreground`,children:T(`cronEmptyHeroDescription`)}),(0,H.jsx)(T5,{ref:m,prominent:!0,value:e,onChange:t,onSubmit:D}),(0,H.jsx)(`p`,{className:`mt-3 text-xs text-muted-foreground`,children:T(`cronComposerHint`)})]}),(0,H.jsxs)(`section`,{children:[(0,H.jsxs)(`div`,{className:`mb-3`,children:[(0,H.jsx)(`h2`,{className:`text-base font-semibold text-foreground`,children:T(`cronStartFromResult`)}),(0,H.jsx)(`p`,{className:`mt-0.5 text-xs text-muted-foreground`,children:T(`cronTemplateSelectionHint`)})]}),(0,H.jsx)(E5,{onSelect:O})]})]}),(0,H.jsx)(x5,{job:E,open:!!E,onOpenChange:e=>{e||f(null)},onDelete:k,onRun:j,onToggle:A}),(0,H.jsx)(x,{})]})}function I5({jobs:e}){let t=k5(),{confirm:n,ConfirmDialog:r}=An(),i=async e=>{await n({title:`${T(`cronDeleteConfirm`)}?`,description:e.name?`${e.name} (${e.id})`:e.id,confirmLabel:T(`delete`)})&&t.mutate({id:e.id})};return(0,H.jsxs)(`div`,{className:`h-full overflow-y-auto custom-scrollbar px-4 py-4`,children:[(0,H.jsxs)(`div`,{className:`mb-4`,children:[(0,H.jsx)(`div`,{className:`text-sm font-semibold text-gray-900`,children:T(`chatWorkspaceSessionCronJobs`)}),(0,H.jsxs)(`div`,{className:`mt-1 text-xs text-gray-500`,children:[T(`cronTotalLabel`),`: `,e.length]})]}),e.length===0?(0,H.jsx)(`div`,{className:`py-8 text-center text-sm text-gray-500`,children:T(`chatWorkspaceCronJobEmpty`)}):(0,H.jsx)(`div`,{className:`space-y-3`,children:e.map(e=>(0,H.jsxs)(`div`,{className:`rounded-lg border border-gray-200 bg-white px-3 py-3`,children:[(0,H.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsx)(`div`,{className:`truncate text-sm font-semibold text-gray-900`,children:e.name||e.id}),(0,H.jsx)(`div`,{className:`mt-1 text-[11px] text-gray-400`,children:e.id})]}),(0,H.jsxs)(R,{type:`button`,variant:`subtle`,size:`sm`,className:`h-7 gap-1 rounded-lg px-2`,onClick:()=>void i(e),disabled:t.isPending,children:[(0,H.jsx)(Yo,{className:`h-3.5 w-3.5`}),T(`delete`)]})]}),(0,H.jsxs)(`div`,{className:`mt-3 space-y-1.5 text-xs text-gray-500`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(`span`,{className:`font-medium text-gray-700`,children:[T(`cronScheduleLabel`),`:`]}),` `,g5(e)]}),(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(`span`,{className:`font-medium text-gray-700`,children:[T(`cronNextRun`),`:`]}),` `,c5(e.state.nextRunAt)]}),(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(`span`,{className:`font-medium text-gray-700`,children:[T(`cronLastRun`),`:`]}),` `,c5(e.state.lastRunAt)]}),(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(`span`,{className:`font-medium text-gray-700`,children:[T(`cronLastStatus`),`:`]}),` `,e.state.lastStatus??`-`]}),(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(`span`,{className:`font-medium text-gray-700`,children:[T(`cronSessionLabel`),`:`]}),` `,_5(e)]})]}),(0,H.jsx)(`div`,{className:`mt-3 whitespace-pre-wrap break-words text-sm text-gray-700`,children:e.payload.message})]},e.id))}),(0,H.jsx)(r,{})]})}function L5({childSessionTabs:e,sessionKey:t}){let n=il();return(0,H.jsx)(`div`,{className:`h-full overflow-auto bg-gray-50/45 px-4 py-5 custom-scrollbar`,children:(0,H.jsxs)(`div`,{className:`mx-auto max-w-xl`,children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,H.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,H.jsx)(`h2`,{className:`truncate text-base font-semibold text-gray-900`,children:T(`chatWorkspaceChildSessions`)}),(0,H.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,H.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,H.jsx)(uo,{className:`h-3.5 w-3.5`}),(0,H.jsx)(`span`,{children:T(`chatWorkspaceCreateChildSession`)})]})]}),e.length===0?(0,H.jsx)(`div`,{className:`py-10 text-center text-sm text-gray-500`,children:T(`chatWorkspaceChildSessionsEmpty`)}):(0,H.jsx)(`div`,{className:`mt-4 space-y-2`,children:e.map(e=>(0,H.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:()=>n.chatThreadManager.selectChildSessionDetail(e.sessionKey),children:[(0,H.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,H.jsx)(Wa,{className:`h-4 w-4`})}),(0,H.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,H.jsx)(`span`,{className:`block truncate text-sm font-medium text-gray-900`,children:e.title}),e.projectName||e.sessionTypeLabel?(0,H.jsx)(`span`,{className:`mt-0.5 block truncate text-xs text-gray-500`,children:[e.sessionTypeLabel,e.projectName].filter(Boolean).join(` · `)}):null]}),(0,H.jsx)(oa,{className:`h-4 w-4 shrink-0 text-gray-300 transition-transform group-hover:translate-x-0.5 group-hover:text-gray-500`})]},e.sessionKey))})]})})}function R5(e){return e===null?`—`:new Intl.NumberFormat().format(e)}function z5(e){return e===null?`—`:new Intl.NumberFormat(void 0,{style:`percent`,maximumFractionDigits:1}).format(e)}function B5({status:e}){return(0,H.jsx)(`span`,{className:c(`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:T(e===`reported`?`chatWorkspaceTokenUsageReported`:e===`partial`?`chatWorkspaceTokenUsagePartial`:`chatWorkspaceTokenUsageUnavailable`)})}function V5({label:e,value:t}){return(0,H.jsxs)(`div`,{className:`min-w-0 rounded-md bg-gray-50 px-2.5 py-2`,children:[(0,H.jsx)(`div`,{className:`truncate text-[10px] font-medium text-gray-500`,children:e}),(0,H.jsx)(`div`,{className:`mt-0.5 truncate text-sm font-semibold tabular-nums text-gray-900`,children:t})]})}function H5({sessionKey:e}){let t=hu(e),n=t.data;return(0,H.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,H.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,H.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,H.jsx)(ia,{className:`h-4 w-4`})}),(0,H.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,H.jsx)(`h3`,{id:`chat-workspace-token-usage-title`,className:`text-sm font-semibold text-gray-900`,children:T(`chatWorkspaceTokenUsage`)}),n?(0,H.jsx)(B5,{status:n.status}):null]}),(0,H.jsx)(`p`,{className:`mt-0.5 text-xs leading-5 text-gray-500`,children:T(`chatWorkspaceTokenUsageDescription`)})]})]}),t.isLoading?(0,H.jsx)(`p`,{className:`py-5 text-center text-xs text-gray-500`,"aria-live":`polite`,children:T(`chatWorkspaceTokenUsageLoading`)}):t.isError?(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-3 py-4 text-xs text-rose-600`,role:`alert`,children:[(0,H.jsx)(`span`,{children:T(`chatWorkspaceTokenUsageLoadFailed`)}),(0,H.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:T(`chatWorkspaceTokenUsageRetry`)})]}):n&&n.runCount>0?(0,H.jsxs)(`div`,{className:`mt-3 space-y-3`,children:[(0,H.jsxs)(`div`,{className:`grid grid-cols-2 gap-1.5`,children:[(0,H.jsx)(V5,{label:T(`chatWorkspaceTokenUsageTotal`),value:R5(n.totals.totalTokens)}),(0,H.jsx)(V5,{label:T(`chatWorkspaceTokenUsageInput`),value:R5(n.totals.inputTokens)}),(0,H.jsx)(V5,{label:T(`chatWorkspaceTokenUsageOutput`),value:R5(n.totals.outputTokens)}),(0,H.jsx)(V5,{label:T(`chatWorkspaceTokenUsageCachedInput`),value:R5(n.totals.cachedInputTokens)}),(0,H.jsx)(V5,{label:T(`chatWorkspaceTokenUsageCacheHitRate`),value:z5(n.totals.cacheHitRate)}),(0,H.jsx)(V5,{label:T(`chatWorkspaceTokenUsageRuns`),value:String(n.runCount)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`div`,{className:`mb-1.5 text-[11px] font-medium text-gray-700`,children:T(`chatWorkspaceTokenUsageByModel`)}),(0,H.jsx)(`div`,{className:`space-y-1.5`,children:n.models.map(e=>(0,H.jsxs)(`div`,{className:`rounded-md border border-gray-200/70 px-2.5 py-2`,children:[(0,H.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-2`,children:[(0,H.jsx)(`span`,{className:`min-w-0 truncate text-xs font-semibold text-gray-900`,title:e.model,children:e.model}),(0,H.jsx)(B5,{status:e.status})]}),(0,H.jsxs)(`div`,{className:`mt-1 text-[10px] text-gray-500`,children:[T(`chatWorkspaceTokenUsageModelRunCount`).replace(`{count}`,String(e.runCount)),` · `,T(`chatWorkspaceTokenUsageModelCacheHitRate`).replace(`{rate}`,z5(e.cacheHitRate))]}),(0,H.jsx)(`dl`,{className:`mt-2 grid grid-cols-2 gap-x-3 gap-y-1 text-[10px] sm:grid-cols-4`,children:[[T(`chatWorkspaceTokenUsageInput`),e.inputTokens],[T(`chatWorkspaceTokenUsageOutput`),e.outputTokens],[T(`chatWorkspaceTokenUsageCachedInput`),e.cachedInputTokens],[T(`chatWorkspaceTokenUsageTotal`),e.totalTokens]].map(([e,t])=>(0,H.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-1 sm:block`,children:[(0,H.jsx)(`dt`,{className:`truncate text-gray-500`,children:e}),(0,H.jsx)(`dd`,{className:`shrink-0 font-semibold tabular-nums text-gray-800 sm:mt-0.5`,children:R5(t)})]},String(e)))})]},e.model))})]})]}):(0,H.jsx)(`p`,{className:`py-5 text-center text-xs leading-5 text-gray-500`,children:T(`chatWorkspaceTokenUsageEmpty`)})]})}function U5({fileActive:e,projectFilesActive:t}){let n=il(),r=(0,V.useRef)(null),i=(0,V.useRef)(null),a=U(e=>e.snapshot.workspaceExplorerOpen),o=U(e=>e.snapshot.workspaceExplorerWidth),s=U(e=>e.setSnapshot),[c,l]=(0,V.useState)(!1),[u,d]=(0,V.useState)(null),f=u??o,p=(0,V.useCallback)(e=>s({workspaceExplorerOpen:e}),[s]);return(0,V.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,V.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=Md(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 W5({count:e,description:t,icon:n,onClick:r,title:i}){return(0,H.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,H.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,H.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,H.jsxs)(`span`,{className:`flex items-center gap-2 text-sm font-medium text-gray-900`,children:[(0,H.jsx)(`span`,{className:`truncate`,children:i}),typeof e==`number`?(0,H.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,H.jsx)(`span`,{className:`mt-0.5 block text-xs leading-5 text-gray-500`,children:t})]}),(0,H.jsx)(oa,{className:`h-4 w-4 shrink-0 text-gray-300 transition-transform group-hover:translate-x-0.5 group-hover:text-gray-500`})]})}function G5({childSessionTabs:e,sessionCronJobs:t,sessionKey:n}){let r=il();return(0,H.jsx)(`div`,{className:`h-full overflow-auto bg-gray-50/45 px-4 py-5 custom-scrollbar`,children:(0,H.jsxs)(`div`,{className:`mx-auto max-w-xl`,children:[(0,H.jsx)(`h2`,{className:`text-base font-semibold text-gray-900`,children:T(`chatWorkspaceOverview`)}),(0,H.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-gray-500`,children:T(`chatWorkspaceOverviewDescription`)}),(0,H.jsxs)(`div`,{className:`mt-4 space-y-2`,children:[(0,H.jsx)(W5,{count:e.length,description:T(`chatWorkspaceChildSessionsDescription`),icon:(0,H.jsx)(Wa,{className:`h-4 w-4`}),title:T(`chatWorkspaceChildSessions`),onClick:()=>{n&&r.chatThreadManager.openChildSessions(n)}}),(0,H.jsx)(W5,{count:t.length,description:T(`chatWorkspaceSessionCronJobsDescription`),icon:(0,H.jsx)(Hi,{className:`h-4 w-4`}),title:T(`chatWorkspaceSessionCronJobs`),onClick:()=>{n&&r.chatThreadManager.openSessionCronPanel(n)}}),(0,H.jsx)(W5,{description:T(`chatWorkspaceProjectFilesDescription`),icon:(0,H.jsx)(Ba,{className:`h-4 w-4`}),title:T(`chatWorkspaceProjectFiles`),onClick:()=>{n&&r.chatThreadManager.openProjectFiles(n)}})]}),(0,H.jsx)(H5,{sessionKey:n})]})})}function K5({activePath:e,onFileOpen:t,projectRoot:n,sessionKey:r,workingDir:i}){let a=il(),o=n??i,s=Ic({path:o,includeFiles:!0,enabled:!!o});return o?(0,H.jsx)(OJ,{activeRelativePath:e?Tl({path:e,sessionProjectRoot:o}):null,browseQuery:s,onFileOpen:t??a.chatThreadManager.openFilePreview,sessionKey:r,renderStatus:({text:e,tone:t=`muted`})=>(0,H.jsx)(`div`,{className:c(`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,H.jsx)(`div`,{className:`flex h-full items-center justify-center px-6 text-center text-sm text-gray-500`,children:T(`chatWorkspaceProjectFilesUnavailable`)})}function q5({value:e}){return(0,H.jsx)(`span`,{className:`inline-flex max-w-full shrink-0 items-center rounded border border-gray-200 bg-gray-50 px-1.5 py-0.5 text-[10px] font-medium text-gray-600`,children:(0,H.jsx)(`span`,{className:`truncate`,children:e})})}function J5({tab:e}){let t=[e.sessionTypeLabel,e.preferredModel,e.projectName].filter(e=>!!e?.trim());return t.length===0&&!e.projectRoot?null:(0,H.jsxs)(`div`,{className:`flex min-h-9 min-w-0 items-center gap-1.5 border-b border-gray-200/70 px-3 py-1.5 text-[11px] text-gray-500`,children:[t.map(e=>(0,H.jsx)(q5,{value:e},e)),e.projectRoot?(0,H.jsx)(`span`,{title:e.projectRoot,className:`min-w-0 flex-1 truncate rounded border border-gray-200 bg-gray-50 px-1.5 py-0.5 font-mono text-[10px] text-gray-500`,children:e.projectRoot}):null]})}function Y5(){return(0,H.jsxs)(`div`,{className:`border-b border-gray-200/70 px-4 py-3`,children:[(0,H.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 text-sm font-semibold text-gray-900`,children:[(0,H.jsx)(uo,{className:`h-4 w-4 shrink-0 text-primary`}),(0,H.jsx)(`span`,{className:`truncate`,children:T(`chatWorkspaceSideChatDraftTitle`)})]}),(0,H.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-gray-500`,children:T(`chatWorkspaceSideChatDraftSubtitle`)})]})}function X5({activeSelection:e,childSessionTabs:t,filePreviewRefreshVersion:n,sessionKey:r,sessionCronJobs:i,sessionProjectRoot:a,sessionWorkingDir:o,explorerControl:s}){let c=il();return e.kind===`overview`?(0,H.jsx)(G5,{childSessionTabs:t,sessionCronJobs:i,sessionKey:r}):e.kind===`child-sessions`?(0,H.jsx)(L5,{childSessionTabs:t,sessionKey:r}):e.kind===`side-chat-draft`?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Y5,{}),(0,H.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:(0,H.jsx)(Q8,{materializationContext:{kind:`child`,parentSessionKey:e.draft.parentSessionKey,inheritContext:!0},sessionKey:null,showWelcomeForDraft:!1,onSessionMaterialized:t=>c.chatThreadManager.materializeSideChatDraft({draftKey:e.draft.draftKey,sessionKey:t})})})]}):e.kind===`child-session`?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(J5,{tab:e.tab}),(0,H.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:(0,H.jsx)(Q8,{sessionKey:e.tab.sessionKey})})]}):e.kind===`file`?(0,H.jsx)(cY,{breadcrumbLeading:(0,H.jsx)(B,{"data-testid":`workspace-explorer-toggle`,icon:s?.open?(0,H.jsx)(Co,{className:`h-4 w-4`}):(0,H.jsx)(wo,{className:`h-4 w-4`}),label:T(s?.open?`chatWorkspaceHideProjectFiles`:`chatWorkspaceShowProjectFiles`),size:`sm`,tooltipSide:`bottom`,onClick:s?.onToggle}),file:e.file,refreshVersion:n,sessionProjectRoot:a,sessionWorkingDir:o,onFileOpen:c.chatThreadManager.openFilePreview,onTextExcerptAdd:e=>{c.chatComposerIntentManager.requestExcerptReference({targetSessionKey:r,...e})}}):(0,H.jsx)(I5,{jobs:i})}function Z5({activeSelection:e,sessionKey:t,sessionProjectRoot:n,sessionWorkingDir:r,...i}){let a=e.kind===`project-files`,o=e.kind===`file`,s=il(),{compact:l,containerRef:u,explorerOpen:d,explorerOverlay:f,explorerWidth:p,onResizeStart:m,setExplorerOpen:h,showExplorer:g}=U5({fileActive:o,projectFilesActive:a});return(0,H.jsxs)(`div`,{ref:u,"data-testid":`workspace-shared-explorer-layout`,className:`relative flex h-full min-h-0 flex-1 overflow-hidden`,children:[f?(0,H.jsx)(`button`,{"data-testid":`workspace-explorer-scrim`,type:`button`,"aria-label":T(`chatWorkspaceHideProjectFiles`),className:`absolute inset-0 z-10 bg-black/15`,onClick:()=>h(!1)}):null,(0,H.jsxs)(`div`,{"data-testid":`workspace-shared-explorer`,"data-mode":a?`full`:f?`overlay`:`side`,className:c(`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,H.jsx)(K5,{activePath:o?e.file.path:null,onFileOpen:e=>{l&&h(!1),s.chatThreadManager.openFilePreview(e)},projectRoot:n,sessionKey:t,workingDir:r}),o&&!l?(0,H.jsx)(`div`,{"data-testid":`workspace-explorer-resize-handle`,"aria-label":T(`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,H.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,children:(0,H.jsx)(X5,{...i,activeSelection:e,explorerControl:o?{open:d,onToggle:()=>h(!d)}:void 0,sessionKey:t,sessionProjectRoot:n,sessionWorkingDir:r})})]})}function Q5({sessionKey:e,childSessionTabs:t,activeChildSessionKey:n,activeSideChatDraft:r,workspaceFileTabs:i,activeWorkspaceFileKey:a,closedWorkspaceTabEntries:o,workspaceNavigationHistory:s=[],workspaceNavigationHistoryIndex:l=0,activePanelKind:u,sessionCronJobs:d=[],sessionProjectRoot:f,sessionWorkingDir:p,workspacePanelWidth:m=480,displayMode:h=`docked`}){let g=il(),_=yn(),[v,y]=(0,V.useState)(!1),[b,x]=(0,V.useState)(0),S=wf(t),C=du(e=>e.optimisticReadAtBySessionKey),w=Ef({activeChildSessionKey:n,activeSideChatDraft:r,activeWorkspaceFileKey:a,activePanelKind:u,childSessionTabs:S,workspaceFileTabs:i}),T={entries:s,index:l};(0,V.useEffect)(()=>{g.chatThreadManager.syncVisibleWorkspaceSelection(w)},[w,g]);let E=(0,V.useMemo)(()=>Of({hasSession:!!e,resolvedChildTabs:S,activeSideChatDraft:r,closedWorkspaceTabEntries:o,workspaceFileTabs:i,activeSelection:w,optimisticReadAtBySessionKey:C,sessionProjectRoot:f??p,onAddFileToChat:({label:t,tokenKey:n})=>{g.chatComposerIntentManager.requestFileReference({targetSessionKey:e,tokenKey:n,label:t})},onSelectSession:g.chatThreadManager.selectChildSessionDetail,onSelectFile:g.chatThreadManager.selectWorkspaceFile,onOpenFileViewer:g.chatThreadManager.openWorkspaceFileViewer,onCloseTab:g.chatThreadManager.closeWorkspaceTab,onSelectOverview:()=>{e&&g.chatThreadManager.openWorkspaceOverview(e)},onSelectChildSessions:()=>{e&&g.chatThreadManager.openChildSessions(e)},onSelectProjectFiles:()=>{g.chatThreadManager.openProjectFiles(e)},onSelectCronJobs:()=>{e&&g.chatThreadManager.openSessionCronPanel(e)}}),[w,r,o,C,g.chatThreadManager,g.chatComposerIntentManager,S,e,f,p,i]);if(!w)return null;let D=h===`docked`&&v,O=h===`overlay`||D,k=w.kind===`file`&&w.file.viewMode===`preview`?w.file:null,A=k?()=>{_.invalidateQueries({queryKey:ZJ({path:k.path,basePath:p})}),_.invalidateQueries({queryKey:Fc({path:k.path,basePath:p,includeFiles:!0})}),x(e=>e+1)}:void 0;return(0,H.jsxs)(ri,{"data-testid":`chat-session-workspace-panel`,className:c(O?`bg-white`:`hidden border-gray-200/70 bg-white/95 backdrop-blur-sm md:flex`,D?`shadow-xl`:null),defaultWidth:m,width:m,minWidth:360,maxWidth:860,onWidthCommit:g.chatThreadManager.setWorkspacePanelWidth,overlay:O,overlayScope:D?`container`:`viewport`,children:[(0,H.jsx)(Ph,{tabs:E,canGoBack:Nd(T),canGoForward:Pd(T),isMaximized:D,onGoBack:g.chatThreadManager.goBackWorkspacePanel,onGoForward:g.chatThreadManager.goForwardWorkspacePanel,onRefreshFile:A,onToggleMaximize:h===`docked`?()=>y(e=>!e):void 0,onClose:g.chatThreadManager.closeWorkspacePanel}),(0,H.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col bg-white`,children:(0,H.jsx)(Z5,{activeSelection:w,childSessionTabs:S,filePreviewRefreshVersion:b,sessionKey:e,sessionCronJobs:d,sessionProjectRoot:f,sessionWorkingDir:p})})]})}var $5=[];function e7(e,t){let n=nd(e=>e.snapshot.sessionsQuery?.data?.sessions??$5),r=(0,V.useMemo)(()=>{let r=e.childSessionTabs.filter(e=>e.parentSessionKey===t),i=new Set(r.map(e=>e.sessionKey));return[...r,...$l(n).filter(e=>e.parentSessionId===t&&!i.has(e.key)).map(e=>({sessionKey:e.key,parentSessionKey:t}))]},[t,n,e.childSessionTabs]),i=(0,V.useMemo)(()=>e.workspaceFileTabs.filter(e=>e.parentSessionKey===t),[t,e.workspaceFileTabs]),a=e.activeSideChatDraft?.parentSessionKey===t?e.activeSideChatDraft:null,o=D5({all:!0});return{childSessionTabs:r,activeSideChatDraft:a,workspaceFileTabs:i,sessionCronJobs:(0,V.useMemo)(()=>(o.data?.jobs??[]).filter(e=>y5(e,t)),[o.data?.jobs,t]),showWorkspacePanel:e.workspacePanelParentKey===t&&e.activeWorkspacePanelKind!=null}}function t7({layoutMode:e,sessionKey:t}){let n=U(e=>e.snapshot),r=nd(e=>_l(e.snapshot.configQuery?.data?.agents.defaults.workspace)),i=xd(t),a=t?null:n.draftProjectRoot??r,{childSessionTabs:o,activeSideChatDraft:s,workspaceFileTabs:c,sessionCronJobs:l,showWorkspacePanel:u}=e7(n,t);return u?(0,H.jsx)(Q5,{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:[],sessionProjectRoot:i?.projectRoot??a,sessionWorkingDir:i?.workingDir??i?.projectRoot??a,workspacePanelWidth:n.workspacePanelWidth,displayMode:e===`mobile`?`overlay`:`docked`}):null}function n7({layoutMode:e=`desktop`,onBackToList:t}){let n=il(),r=du(e=>e.snapshot.selectedSessionKey);return(0,H.jsxs)(`section`,{className:`relative flex-1 min-h-0 flex overflow-hidden bg-background`,children:[(0,H.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden`,children:[(0,H.jsx)(Sf,{}),(0,H.jsx)(xf,{layoutMode:e,onBackToList:t}),(0,H.jsx)(Q8,{consumeDraftIntent:!0,sessionKey:r,onSessionMaterialized:n.chatThreadManager.materializeRootDraftSession})]}),(0,H.jsx)(t7,{layoutMode:e,sessionKey:r})]})}function r7(){let e=Ac(),[t,n]=(0,V.useState)(null),[r,i]=(0,V.useState)(``),[a,o]=(0,V.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 i7=`nextclaw.ui.theme`,a7=`work`,o7=[{value:`work`,labelKey:`themeWork`,appearance:`light`},{value:`night`,labelKey:`themeNight`,appearance:`dark`},{value:`charcoal`,labelKey:`themeCharcoal`,appearance:`dark`},{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`}],s7=o7.map(({value:e})=>e),c7=o7.map(({value:e,labelKey:t})=>({value:e,labelKey:t}));function l7(e){return typeof e==`string`?s7.includes(e)?e:e===`leaf`?`warm`:null:null}function u7(e){return o7.find(t=>t.value===e)?.appearance??`light`}var d7=new class{constructor(){this.activeTheme=a7,this.initialized=!1,this.listeners=new Set,this.resolveInitialTheme=()=>{if(typeof window>`u`)return a7;try{let e=l7(window.localStorage.getItem(i7));if(e)return e}catch{}return a7},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=u7(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(i7,e)}catch{}}}};function Wte(){return d7.initializeTheme()}function Gte(){return d7.getTheme()}function Kte(e){d7.setTheme(e)}function qte(e){return d7.subscribeThemeChange(e)}var f7=`nextclaw-pwa-install-banner-dismissed`,p7=`nextclaw-pwa-install-banner-dismissed-until`;function m7(){let e=g7();return e?e.getItem(`nextclaw-pwa-install-banner-dismissed`)===`1`?!0:Yte(e):!1}function Jte(){let e=g7();e?.setItem(f7,`1`),e?.removeItem(p7)}function h7(){let e=g7();e?.removeItem(f7),e?.removeItem(p7)}function g7(){if(typeof window>`u`)return null;try{return window.localStorage}catch{return null}}function Yte(e){let t=e.getItem(p7);if(!t)return!1;let n=Number.parseInt(t,10);return e.removeItem(p7),!Number.isFinite(n)||n<=Date.now()?!1:(e.setItem(f7,`1`),!0)}function _7(){return{initialized:!1,installability:`unsupported`,installMethod:`none`,blockedReason:`missing-browser-support`,dismissedInstallPrompt:m7()}}var v7=N(()=>_7()),y7=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(),v7.setState(_7())},this.refreshState=()=>{let e=this.resolveInstallability();v7.setState(t=>({...t,initialized:!0,installability:e.installability,installMethod:e.installMethod,blockedReason:e.blockedReason,dismissedInstallPrompt:m7()}))},this.dismissInstallPrompt=()=>{Jte(),v7.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`?(h7(),this.refreshState(),L.success(T(`pwaInstallAccepted`)),`accepted`):(this.dismissInstallPrompt(),this.refreshState(),`dismissed`)},this.handleBeforeInstallPrompt=e=>{e.preventDefault(),this.deferredPrompt=e,this.refreshState()},this.handleAppInstalled=()=>{this.deferredPrompt=null,h7(),v7.setState({dismissedInstallPrompt:!0}),L.success(T(`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 Xte(){let e=v7(e=>e.installability);return(0,H.jsx)(`span`,{className:c(`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:Zte(e)})}function Zte(e){return T(e===`available`?`pwaInstallStatusAvailable`:e===`installed`?`pwaInstallStatusInstalled`:e===`suppressed`?`pwaInstallStatusDesktopHost`:`pwaInstallStatusUnavailable`)}function Qte(e,t,n){return T(e===`installed`?`pwaInstallCardInstalled`:e===`suppressed`?`pwaInstallCardSuppressed`:e===`available`&&t===`prompt`?`pwaInstallCardPrompt`:e===`available`?`pwaInstallCardManual`:n===`insecure-context`?`pwaInstallCardInsecureContext`:n===`dev-server`?`pwaInstallCardDevServer`:`pwaInstallCardUnsupported`)}function $te(){let e=v7(e=>e.installability),t=v7(e=>e.installMethod),n=v7(e=>e.blockedReason);return(0,H.jsx)(ot,{title:T(`pwaInstallTitle`),description:T(`pwaInstallDescription`),actions:(0,H.jsx)(Xte,{}),children:(0,H.jsx)(rt,{children:(0,H.jsxs)(`div`,{className:`space-y-4 p-4`,children:[(0,H.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:Qte(e,t,n)}),e===`available`&&t===`prompt`?(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,H.jsxs)(R,{type:`button`,className:`gap-2`,onClick:()=>void y7.promptInstall(),children:[(0,H.jsx)(Sa,{className:`h-4 w-4`}),T(`pwaInstallAction`)]}),(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:T(`pwaInstallPromptHint`)})]}):null,e===`available`&&t===`manual`?(0,H.jsxs)(`div`,{className:`flex items-start gap-3 rounded-xl bg-background/65 p-4`,children:[(0,H.jsx)(zo,{className:`mt-0.5 h-4 w-4 text-muted-foreground`}),(0,H.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:T(`pwaInstallManualHint`)})]}):null]})})})}function ene(){let e=v7(e=>e.installability),t=v7(e=>e.installMethod),n=v7(e=>e.dismissedInstallPrompt);return e!==`available`||t!==`prompt`||n?null:(0,H.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,H.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,H.jsxs)(`div`,{className:`space-y-1`,children:[(0,H.jsx)(`p`,{className:`text-sm font-semibold text-gray-900`,children:T(`pwaInstallBannerTitle`)}),(0,H.jsx)(`p`,{className:`text-sm leading-6 text-gray-600`,children:T(`pwaInstallBannerDescription`)})]}),(0,H.jsx)(`button`,{type:`button`,"aria-label":T(`pwaInstallDismiss`),className:`rounded-full p-1 text-gray-400 transition hover:bg-gray-100 hover:text-gray-600`,onClick:()=>{y7.dismissInstallPrompt()},children:(0,H.jsx)(_i,{className:`h-4 w-4`})})]}),(0,H.jsxs)(`div`,{className:`mt-4 flex items-center gap-3`,children:[(0,H.jsxs)(R,{type:`button`,size:`sm`,className:`gap-2`,onClick:()=>{y7.promptInstall()},children:[(0,H.jsx)(Sa,{className:`h-4 w-4`}),T(`pwaInstallAction`)]}),(0,H.jsx)(R,{type:`button`,size:`sm`,variant:`ghost`,onClick:()=>{y7.dismissInstallPrompt()},children:T(`pwaInstallDismiss`)})]})]})}var tne=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)))}}},b7=!1;function nne(){b7||typeof window>`u`||(b7=!0,y7.start(),tne.start())}var rne={natural:`#FAF9F7`,work:`#FFFFFF`,minimal:`#FFFFFF`,warm:`#FAF8F4`,cool:`#F8FAFC`,dawn:`#FAF7F4`,graphite:`#F8F8F7`,night:`#101318`,charcoal:`#1C1C1C`,probe:`#FEFCF6`},ine=new class{constructor(){this.syncTheme=e=>{if(typeof document>`u`)return;let t=rne[e];this.updateThemeMeta(t),this.updateSurfaceBackgrounds(t),document.documentElement.style.colorScheme=u7(e)},this.syncCurrentTheme=()=>{if(typeof document>`u`)return;let e=document.documentElement.getAttribute(`data-theme`);this.syncTheme(l7(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)}}},x7=(0,V.createContext)(null);function ane({children:e}){let[t,n]=(0,V.useState)(()=>Wte());(0,V.useEffect)(()=>{ine.syncTheme(t)},[t]),(0,V.useEffect)(()=>qte(e=>{n(e)}),[]);let r=(0,V.useCallback)(e=>{Kte(e),n(Gte())},[]),i=(0,V.useMemo)(()=>({theme:t,setTheme:r}),[t,r]);return(0,H.jsx)(x7.Provider,{value:i,children:e})}function S7(){let e=(0,V.useContext)(x7);if(!e)throw Error(`useTheme must be used within ThemeProvider`);return e}function one({sessionKey:e,draftLabel:t,isSaving:n,onDraftLabelChange:r,onSave:i,onCancel:a}){return(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(Gt,{value:t,onChange:e=>r(e.target.value),onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),i()):e.key===`Escape`&&(e.preventDefault(),a())},placeholder:T(`sessionsLabelPlaceholder`),className:`h-8 rounded-lg border-border bg-background text-xs`,autoFocus:!0,disabled:n}),(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,H.jsx)(`div`,{className:`min-w-0 truncate text-[11px] text-muted-foreground/65`,children:e}),(0,H.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,H.jsx)(B,{icon:(0,H.jsx)(Tr,{className:`h-3.5 w-3.5`}),label:T(`save`),tooltip:!1,onClick:()=>void i(),disabled:n}),(0,H.jsx)(B,{icon:(0,H.jsx)(_i,{className:`h-3.5 w-3.5`}),label:T(`cancel`),tooltip:!1,onClick:a,disabled:n})]})]})]})}function sne({active:e,showUnreadDot:t,runStatus:n,context:r,isPinned:i,title:a,previewText:o,trailingText:s,agentId:l,agentLabel:u,agentAvatarUrl:d,childSessionCount:f=0,onSelect:p,onOpenChildSessions:m,onStartEditing:h,onTogglePinned:g}){return(0,H.jsxs)(`div`,{className:`group/session relative`,children:[(0,H.jsxs)(`button`,{type:`button`,onClick:p,className:`w-full text-left`,children:[(0,H.jsx)(`div`,{className:c(`flex min-h-6 min-w-0 items-center`,f>0&&m?`pr-20`:`pr-12`),children:(0,H.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[l?.trim()&&l.trim().toLowerCase()!==`main`?(0,H.jsx)(mf,{agentId:l,displayName:u,avatarUrl:d,className:`h-5 w-5 shrink-0`}):null,(0,H.jsx)(`span`,{className:`truncate leading-6 font-medium`,children:a}),r.label?(0,H.jsx)(`span`,{className:c(`shrink-0 rounded-full border px-1.5 py-0.5 text-[10px] font-semibold leading-none`,e?`border-border/70 bg-background/80 text-foreground/75`:`border-transparent bg-muted/70 text-muted-foreground`),children:r.label}):null,r.icon?(0,H.jsx)(`span`,{className:`inline-flex h-4 w-4 shrink-0 items-center justify-center`,children:(0,H.jsx)(Ju,{icon:r.icon,className:c(`h-[13px] w-[13px]`,e?`text-foreground/75`:`text-muted-foreground`)})}):null]})}),(0,H.jsxs)(`div`,{className:`mt-0.5 flex items-center gap-2 text-[11px] text-muted-foreground/65`,children:[(0,H.jsx)(`span`,{className:`min-w-0 truncate`,children:o}),t?(0,H.jsx)(`span`,{"aria-label":T(`chatSessionUnread`),className:`ml-auto h-2 w-2 shrink-0 rounded-full bg-primary`}):(0,H.jsx)(`span`,{className:`ml-auto shrink-0`,children:s})]})]}),f>0&&m?(0,H.jsxs)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),m()},className:`pointer-events-none absolute right-12 top-0 inline-flex h-6 items-center gap-1 rounded-md px-1.5 text-[10px] font-medium text-muted-foreground opacity-0 transition-colors hover:bg-background/80 hover:text-foreground group-hover/session:pointer-events-auto group-hover/session:opacity-100 focus-visible:pointer-events-auto focus-visible:opacity-100`,"aria-label":T(`chatSessionOpenChildSessions`),title:T(`chatSessionOpenChildSessions`),children:[(0,H.jsx)(Wa,{className:`h-3.5 w-3.5`}),(0,H.jsx)(`span`,{children:f})]}):null,n?(0,H.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,H.jsx)(Xu,{status:n})}):null,(0,H.jsxs)(`div`,{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,H.jsx)(B,{size:`sm`,tone:`strong`,icon:(0,H.jsx)(Qr,{className:c(`h-3.5 w-3.5`,i&&`fill-current text-foreground`)}),label:T(i?`chatSidebarUnpinSession`:`chatSidebarPinSession`),tooltipSide:`right`,onClick:e=>{e.stopPropagation(),g()}}),(0,H.jsx)(B,{size:`sm`,tone:`strong`,icon:(0,H.jsx)(Oo,{className:`h-3.5 w-3.5`}),label:T(`edit`),tooltipSide:`right`,onClick:e=>{e.stopPropagation(),h()}})]})]})}function cne({sessionKey:e,active:t,showUnreadDot:n,runStatus:r,context:i,isPinned:a,title:o,previewText:s,trailingText:l,agentId:u,agentLabel:d,agentAvatarUrl:f,childSessionCount:p,isEditing:m,draftLabel:h,isSaving:g,onSelect:_,onOpenChildSessions:v,onStartEditing:y,onDraftLabelChange:b,onSave:x,onCancel:S,onTogglePinned:C}){return(0,H.jsx)(`div`,{className:c(`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:m?(0,H.jsx)(one,{sessionKey:e,draftLabel:h,isSaving:g,onDraftLabelChange:b,onSave:x,onCancel:S}):(0,H.jsx)(sne,{active:t,showUnreadDot:n,runStatus:r,context:i,isPinned:a,title:o,previewText:s,trailingText:l,agentId:u,agentLabel:d,agentAvatarUrl:f,onSelect:_,childSessionCount:p,onOpenChildSessions:v,onStartEditing:y,onTogglePinned:C})})}function lne(e){let{item:t,selectedSessionKey:n,optimisticReadAtBySessionKey:r,agentsById:i,childSessionsByParentKey:a,editingSessionKey:o,draftLabel:s,savingSessionKey:c,sessionTypeOptions:l,isPinned:u,sessionTitle:d,onSelectSession:f,onOpenChildSessions:p,onStartEditingSessionLabel:m,onDraftLabelChange:h,onSaveSessionLabel:g,onCancelEditingSessionLabel:_,onTogglePinned:v}=e,{session:y,runStatus:b}=t,x=n===y.key,S=r[y.key],C=S&&y.readAt?S.localeCompare(y.readAt)>0?S:y.readAt:S??y.readAt,w=a.get(y.key)??[],T=y.agentId?i.get(y.agentId)?.displayName??y.agentId:null,E=cl(y)??`${T?.trim()?`${T} · `:``}${y.messageCount}`;return(0,H.jsx)(cne,{sessionKey:y.key,active:x,showUnreadDot:su({active:x,lastMessageAt:y.lastMessageAt,readAt:C,runStatus:b}),runStatus:b,context:Uu(y,l),isPinned:u,title:d(y),previewText:E,trailingText:fl(y.lastMessageAt??y.createdAt),agentId:y.agentId??null,agentLabel:T,agentAvatarUrl:y.agentId?i.get(y.agentId)?.avatarUrl??null:null,childSessionCount:w.length,isEditing:o===y.key,draftLabel:s,isSaving:c===y.key,onSelect:()=>f(y.key),onOpenChildSessions:()=>p(y.key,w[0]?.session.key??null),onStartEditing:()=>m(y),onDraftLabelChange:h,onSave:()=>g(y),onCancel:_,onTogglePinned:v})}var une={maxHeight:Cc(`18rem`)};function C7({className:e,onSelect:t,options:n,selectedSessionType:r,title:i=T(`chatSessionTypeLabel`),titleClassName:a}){return(0,H.jsxs)(`div`,{className:c(`space-y-1 overflow-y-auto overscroll-contain`,e),style:une,children:[(0,H.jsx)(`div`,{className:c(`px-3 pb-1 pt-2 text-[10px] font-semibold uppercase tracking-[0.18em] text-gray-400`,a),children:i}),n.map(e=>(0,H.jsx)(Q2,{disabled:e.ready===!1,option:e,selected:e.value===r,onSelect:()=>t(e.value)},e.value))]})}var w7=`w-[56px]`,T7=`px-2`,E7=`h-9 w-9 rounded-xl`,D7=`h-4 w-4`,O7=`space-y-1`,k7=`gap-1`,A7=`text-muted-foreground transition-colors duration-base hover:bg-gray-200/60 hover:text-gray-900 active:bg-gray-200/80 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,dne=`bg-gray-200/80 text-gray-900`;function j7({option:e}){return e?.icon?.src?(0,H.jsx)(`span`,{className:`inline-flex h-4 w-4 shrink-0 items-center justify-center`,children:(0,H.jsx)(Ju,{icon:{kind:`runtime-image`,src:e.icon.src,alt:e.icon.alt??null,name:e.label},className:`h-4 w-4`})}):(0,H.jsx)(Xi,{className:`h-4 w-4 shrink-0`})}function fne(e){let{query:t,selectedNewSessionType:n,selectedNewSessionTypeOption:r,sessionTypeOptions:i,isCreateMenuOpen:a,onCreateMenuOpenChange:o,onCreateSession:s,onSelectNewSessionType:l,onQueryChange:u,collapsed:d=!1}=e,f=i.length>1;return d?(0,H.jsx)(`div`,{className:`px-2 pb-2`,children:(0,H.jsxs)(`div`,{className:c(`flex flex-col items-center`,k7),children:[(0,H.jsx)(B,{icon:(0,H.jsx)(hi,{className:D7}),label:T(`chatSidebarNewTask`),className:c(E7,A7),onClick:()=>{o(!1),s(n)}}),f?(0,H.jsxs)(Tc,{open:a,onOpenChange:o,children:[(0,H.jsx)(Ec,{asChild:!0,children:(0,H.jsx)(B,{icon:(0,H.jsx)(j7,{option:r}),label:T(`chatSessionTypeLabel`),className:c(E7,A7)})}),(0,H.jsx)(Oc,{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,H.jsx)(C7,{options:i,selectedSessionType:n,onSelect:e=>{l(e),o(!1)}})})]}):null]})}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`div`,{className:`px-4 pb-2`,children:(0,H.jsxs)(`div`,{className:`flex overflow-hidden rounded-lg bg-primary/10 text-primary ring-1 ring-primary/10`,children:[(0,H.jsxs)(R,{variant:`ghost`,className:c(`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,H.jsx)(hi,{className:`mr-1.5 h-4 w-4`}),T(`chatSidebarNewTask`)]}),f?(0,H.jsxs)(Tc,{open:a,onOpenChange:o,children:[(0,H.jsx)(Ec,{asChild:!0,children:(0,H.jsx)(B,{icon:(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,H.jsx)(j7,{option:r}),(0,H.jsx)(er,{className:`h-3 w-3 opacity-50`})]}),label:T(`chatSessionTypeLabel`),tooltip:T(`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,H.jsx)(Oc,{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,H.jsx)(C7,{options:i,selectedSessionType:n,onSelect:e=>{l(e),o(!1)}})})]}):null]})}),(0,H.jsx)(`div`,{className:`px-4 pb-2`,children:(0,H.jsxs)(`div`,{className:`relative`,children:[(0,H.jsx)(fi,{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,H.jsx)(Gt,{value:t,onChange:e=>u(e.target.value),placeholder:T(`chatSidebarSearchPlaceholder`),className:`h-8 rounded-lg border-0 bg-background/55 pl-8 text-xs shadow-none hover:bg-background/75`})]})})]})}function pne(e){let{query:t,defaultSessionType:n,sessionTypeOptions:r,isCreateMenuOpen:i,onCreateMenuOpenChange:a,onCreateSession:o,onQueryChange:s}=e,c=r.length>1;return(0,H.jsx)(`div`,{className:`px-4 pb-2 pt-1`,children:(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsxs)(`div`,{className:`relative min-w-0 flex-1`,children:[(0,H.jsx)(fi,{className:`pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground/70`}),(0,H.jsx)(Gt,{value:t,onChange:e=>s(e.target.value),placeholder:T(`chatSidebarSearchPlaceholder`),className:`h-9 rounded-full border-0 bg-muted pl-9 pr-3 text-[13px] shadow-none`})]}),c?(0,H.jsxs)(Tc,{open:i,onOpenChange:a,children:[(0,H.jsx)(Ec,{asChild:!0,children:(0,H.jsx)(B,{icon:(0,H.jsx)(hi,{className:`h-4 w-4`}),label:T(`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,H.jsx)(Oc,{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,H.jsx)(C7,{options:r,selectedSessionType:n,title:T(`chatSidebarNewTask`),titleClassName:`pb-1.5 text-[11px] font-medium normal-case tracking-normal`,onSelect:e=>{o(e),a(!1)}})})]}):(0,H.jsx)(B,{icon:(0,H.jsx)(hi,{className:`h-4 w-4`}),label:T(`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 mne(){return dn({queryKey:[`app-meta`],queryFn:xt,staleTime:1/0})}var hne={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 gne(){let e=je(),t=e.actionLabel===T(`runtimeStatusRestartAction`),n=()=>{e.tone!==`healthy`&&Ae.requestRuntimeBootstrapProbeNow()},r=async()=>{if(t)try{let e=await Ae.runRuntimeControlAction(`restart-service`);L.success(e.message)}catch(e){let t=e instanceof Error?e.message:T(`runtimeControlActionFailed`);L.error(`${T(`runtimeControlActionFailed`)}: ${t}`)}};return(0,H.jsxs)(Tc,{children:[(0,H.jsx)(Ec,{asChild:!0,children:(0,H.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,H.jsx)(`span`,{className:c(`h-2.5 w-2.5 rounded-full`,hne[e.tone])})})}),(0,H.jsxs)(Oc,{align:`start`,sideOffset:10,className:`w-[290px] space-y-3 rounded-2xl border border-border bg-popover p-4 text-popover-foreground`,children:[(0,H.jsxs)(`div`,{className:`space-y-1`,children:[(0,H.jsx)(`div`,{className:`text-sm font-semibold text-foreground`,children:e.title}),(0,H.jsx)(`p`,{className:`text-xs leading-5 text-muted-foreground`,children:e.description})]}),e.reasonLines.length>0?(0,H.jsx)(`div`,{className:`space-y-2`,children:e.reasonLines.map(e=>(0,H.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,H.jsxs)(`div`,{className:`flex items-center justify-between border-t border-border/70 pt-1`,children:[(0,H.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:T(`runtimeStatusActionHint`)}),(0,H.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?T(`runtimeStatusRestartingAction`):e.actionLabel})]}):null]})]})}function M7({className:e,density:t=`sidebar`,suffix:n}){let{data:r}=mne(),{supported:i,busyAction:a,snapshot:o}=xe(),s=r?.name??`NextClaw`,l=r?.productVersion?.trim(),u=l?`v${l}`:null,d=We(l),f=n??(0,H.jsx)(gne,{}),p=typeof window<`u`&&window.nextclawDesktop?.platform===`darwin`,m=t===`chrome`;return(0,H.jsxs)(`div`,{className:c(e??`flex min-w-0 items-center gap-2`,p&&`pl-[58px]`),children:[(0,H.jsx)(`div`,{className:c(`flex shrink-0 items-center justify-center overflow-hidden`,`h-6 w-6 rounded-md`),children:(0,H.jsx)(`img`,{src:`/logo.svg`,alt:s,className:`h-full w-full object-contain`})}),(0,H.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,H.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-baseline gap-1.5`,children:[(0,H.jsx)(`span`,{className:c(`shrink-0 font-semibold text-gray-800`,m?`text-[15px]`:`text-[14px]`),children:s}),u?(0,H.jsx)(_ne,{versionLabel:u,density:t,releaseNotesLink:d}):null]}),(0,H.jsx)(vne,{supported:i,busyAction:a,snapshot:o}),f?(0,H.jsx)(`span`,{className:`inline-flex items-center shrink-0`,children:f}):null]})]})}function _ne({versionLabel:e,density:t,releaseNotesLink:n}){let r=c(`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?[T(`desktopUpdatesVersionTooltipCurrent`).replace(`{version}`,e),T(`desktopUpdatesVersionTooltipReleaseNotes`).replace(`{version}`,n.versionLabel)].join(`
|
|
106
106
|
`):e;return(0,H.jsx)(ti,{delayDuration:250,children:(0,H.jsxs)(oi,{children:[(0,H.jsx)(si,{asChild:!0,children:n?(0,H.jsx)(me,{href:n.url,external:!0,icon:null,"aria-label":T(`desktopUpdatesVersionReleaseNotesLabel`).replace(`{currentVersion}`,e).replace(`{releaseVersion}`,n.versionLabel),className:c(r,`p-0 text-left`),children:e}):(0,H.jsx)(`span`,{tabIndex:0,"aria-label":e,className:r,children:e})}),(0,H.jsx)(Yr,{side:`bottom`,className:`max-w-72 whitespace-pre-line text-xs leading-relaxed`,children:i})]})})}function vne({supported:e,busyAction:t,snapshot:n}){if(!e||!n)return null;let r=qe(n);return n.status===`downloading`?(0,H.jsx)(P7,{snapshot:n,releaseNotesLink:r}):n.status===`blocked`||n.status===`failed`?(0,H.jsx)(P7,{snapshot:n}):n.status===`downloaded`?(0,H.jsx)(N7,{link:r,children:(0,H.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 Cn.applyDownloadedUpdate(),children:T(t===`applying`?`desktopUpdatesInlineApplying`:`desktopUpdatesInlineReady`)})}):n.status===`update-available`?(0,H.jsx)(N7,{link:r,children:(0,H.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 Cn.downloadUpdate(),children:T(t===`downloading`?`desktopUpdatesInlineDownloading`:`desktopUpdatesInlineDownload`)})}):null}function N7({children:e,link:t}){if(!t)return e;let n=T(`desktopUpdatesUpdateReleaseNotesLabel`).replace(`{version}`,t.versionLabel);return(0,H.jsxs)(`span`,{className:`group/update-release-notes relative inline-flex shrink-0`,children:[e,(0,H.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,H.jsx)(me,{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 P7({snapshot:e,releaseNotesLink:t}){if(e.status===`blocked`||e.status===`failed`)return(0,H.jsx)(yne,{snapshot:e});let n=e.status===`downloading`?xne(e):null;return n?(0,H.jsx)(N7,{link:t??null,children:(0,H.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 yne({snapshot:e}){let t=bne(e),n=e.recoveryCommand?.trim()||null,r=e.diagnosticCommand?.trim()?T(`desktopUpdatesDiagnosticCommand`).replace(`{command}`,e.diagnosticCommand.trim()):null,i=e.errorMessage?.trim()||e.blockReason?.trim()||null,a=[t,e.status===`blocked`&&e.blockReason?T(`desktopUpdatesBlockedRootCause.${e.blockReason}`):null,i,n,r].filter(Boolean).join(`
|
|
107
107
|
`);return(0,H.jsx)(ti,{delayDuration:250,children:(0,H.jsxs)(oi,{children:[(0,H.jsx)(si,{asChild:!0,children:(0,H.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,H.jsx)(Yr,{side:`bottom`,className:`max-w-80 whitespace-pre-line break-words text-xs leading-relaxed`,children:a})]})})}function bne(e){return e.status===`blocked`?T(`desktopUpdatesStatusBlocked`):T(e.failureStage?`desktopUpdatesFailureStage.${e.failureStage}`:`desktopUpdatesStatusFailed`)}function xne(e){let t=e.progress?.percent;return t==null?T(`desktopUpdatesInlineDownloading`):T(`desktopUpdatesInlineDownloadingPercent`).replace(`{percent}`,String(t))}var Sne={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 Cne({status:e,className:t}){let n=Sne[e],r=T(e===`connected`?`connected`:e===`disconnected`?`disconnected`:`connecting`);return(0,H.jsx)(ti,{delayDuration:250,children:(0,H.jsxs)(oi,{children:[(0,H.jsx)(si,{asChild:!0,children:(0,H.jsx)(`span`,{role:`status`,"aria-label":r,className:c(`inline-flex h-5 w-5 items-center justify-center`,t),children:e===`connecting`?(0,H.jsx)(mi,{className:c(`h-3 w-3 animate-spin`,n.dotClass)}):(0,H.jsx)(`span`,{className:c(e===`connected`?`h-2 w-2 rounded-full`:``,n.dotClass)})})}),(0,H.jsx)(Yr,{side:`bottom`,className:`text-xs`,children:r})]})})}var wne={default:{row:`gap-3 px-3 py-2.5 text-[14px]`,icon:`h-[17px] w-[17px]`,value:`text-xs`,gap:`gap-3`,stack:`space-y-1`},compact:{row:`gap-2.5 px-3 py-2 text-[13px]`,icon:`h-4 w-4`,value:`text-[11px]`,gap:`gap-2.5`,stack:`space-y-0.5`}};function F7(e){return wne[e]}function I7(e){return F7(e).stack}function Tne(e,t){let n=e.toLowerCase(),r=t.toLowerCase();return n===r||n.startsWith(`${r}/`)}function L7({children:e,label:t,side:n=`right`}){return(0,H.jsx)(ti,{delayDuration:250,children:(0,H.jsxs)(oi,{children:[(0,H.jsx)(si,{asChild:!0,children:e}),(0,H.jsx)(Yr,{side:n,className:`text-xs`,children:t})]})})}function R7({to:e,label:t,icon:n,density:r=`default`,className:i,collapsed:a=!1,indicator:o=!1,trailing:s}){let l=F7(r),{pathname:u}=he(),d=Tne(u,e),f=(0,H.jsxs)(ce,{to:e,"aria-label":t,"aria-current":d?`page`:void 0,className:c(`group flex w-full items-center rounded-xl font-medium transition-colors duration-base focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,a?c(E7,`justify-center px-0 py-0`):l.row,d?a?dne:`bg-gray-200/80 text-gray-900 shadow-sm`:a?A7:`text-muted-foreground hover:bg-gray-200/60 hover:text-gray-900`,i),children:[(0,H.jsxs)(`span`,{className:`relative shrink-0`,children:[(0,H.jsx)(n,{className:c(a?D7:l.icon,`block transition-colors`,d?`text-gray-700`:`text-muted-foreground group-hover:text-gray-700`)}),o?(0,H.jsx)(`span`,{className:`absolute -right-1 -top-1 h-1.5 w-1.5 rounded-full bg-primary ring-2 ring-background`}):null]}),(0,H.jsx)(`span`,{className:a?`sr-only`:`min-w-0 flex-1 text-left`,children:t}),!a&&s?(0,H.jsx)(`span`,{className:c(`shrink-0 text-muted-foreground`,l.value),children:s}):null]});return a?(0,H.jsx)(L7,{label:t,children:f}):f}function z7({isCollapsed:e,items:t,density:n,className:r}){return(0,H.jsx)(`ul`,{className:c(I7(n),r),children:t.map(t=>(0,H.jsx)(`li`,{className:e?`flex justify-center`:void 0,children:(0,H.jsx)(R7,{to:t.target,label:t.label,icon:t.icon,density:n,collapsed:e})},t.target))})}function B7({label:e,icon:t,onClick:n,density:r=`default`,className:i,labelClassName:a,trailing:o,trailingClassName:s,testId:l,trailingTestId:u,collapsed:d=!1}){let f=F7(r),p=(0,H.jsxs)(`button`,{type:`button`,onClick:n,"aria-label":e,className:c(`group flex w-full items-center rounded-xl font-medium text-muted-foreground transition-colors duration-base hover:bg-gray-200/60 hover:text-gray-900 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,d?c(E7,`justify-center px-0 py-0`,A7):f.row,i),"data-testid":l,children:[(0,H.jsx)(t,{className:c(d?D7:f.icon,`shrink-0 text-muted-foreground transition-colors group-hover:text-gray-700`)}),(0,H.jsx)(`span`,{className:c(d?`sr-only`:`min-w-0 flex-1 text-left`,a),children:e}),!d&&o?(0,H.jsx)(`span`,{className:c(`shrink-0 text-muted-foreground`,f.value,s),"data-testid":u,children:o}):null]});return d?(0,H.jsx)(L7,{label:e,children:p}):p}var Ene=[`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 Dne(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`,Ene),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
108
|
`),n.after(r),`<!doctype html>${t.documentElement.outerHTML}`}function One({content:e,fillHeight:t,title:n}){let r=(0,V.useMemo)(()=>Dne(e),[e]);return(0,H.jsx)(`iframe`,{className:c(`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 V7({className:e,content:t,contentType:n,fillHeight:r=!1,title:i}){return(0,H.jsx)(`div`,{className:c(`inbox-delivery-content`,e),children:n===`html`?(0,H.jsx)(One,{content:t,fillHeight:r,title:i}):(0,H.jsx)(SB,{text:t,role:`assistant`,texts:{copyCodeLabel:T(`chatCodeCopy`),copiedCodeLabel:T(`chatCodeCopied`)}})})}var kne={readerOpen:!1,activeDeliveryId:null},H7=N(e=>({snapshot:kne,setSnapshot:t=>e(e=>({snapshot:{...e.snapshot,...t}}))})),U7=[`inbox-deliveries`];function W7(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 Ane=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(p.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=()=>{H7.getState().setSnapshot({readerOpen:!1})},this.selectInReader=async e=>{let t=await this.updateState(e,`present`);return H7.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(U7,t=>t&&W7(t.deliveries.filter(({id:t})=>t!==e)));let{snapshot:t}=H7.getState();t.activeDeliveryId===e&&H7.getState().setSnapshot({activeDeliveryId:null,readerOpen:!1})}return t},this.prepareChatReference=async e=>{let t=await I.systemObjectReferences.resolve(C(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(U7,t=>t&&W7(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:U7}),this.offerPendingDelivery()},this.handleVisibilityChange=()=>{document.visibilityState===`visible`&&this.offerPendingDelivery()},this.offerPendingDelivery=()=>{this.offerPromise||!this.isVisible()||H7.getState().snapshot.readerOpen||(this.offerPromise=this.openOldestPendingDelivery().catch(()=>void 0).finally(()=>{this.offerPromise=null}))},this.openOldestPendingDelivery=async()=>{let e=(await this.queryClient.fetchQuery({queryKey:U7,queryFn:()=>I.inboxDeliveries.list(),staleTime:0})).deliveries.filter(e=>!e.presentedAt&&!e.readAt&&!e.archivedAt),t=e[e.length-1];!t||!this.isVisible()||H7.getState().snapshot.readerOpen||await this.selectInReader(t.id)},this.isVisible=()=>typeof document>`u`||document.visibilityState===`visible`}};function G7(){return dn({queryKey:U7,queryFn:()=>I.inboxDeliveries.list()})}function K7(){return G7().data?.unreadCount??0}function jne(e,t){return T(`inboxReaderPosition`).replace(`{current}`,String(e)).replace(`{total}`,String(t))}function Mne(){let e=(0,V.useRef)(null),t=oe(),{chatDraftIntentManager:n,inboxManager:r}=q9(),{data:i}=G7(),{activeDeliveryId:a,readerOpen:o}=H7(e=>e.snapshot),[s,l]=(0,V.useState)(null),[u,d]=(0,V.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)=>{l(e),d(null);try{await t()}catch{d(T(`inboxActionError`))}finally{l(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(d9)})},b=()=>{m&&g(`read`,async()=>{await r.markRead(m.id),r.closeReader()})},x=f.length>1?(0,H.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1 pr-1`,children:[(0,H.jsx)(`span`,{className:`mr-1 text-[11px] tabular-nums text-muted-foreground`,children:jne(p+1,f.length)}),(0,H.jsx)(B,{icon:(0,H.jsx)(aa,{className:`h-4 w-4`}),label:T(`inboxPrevious`),disabled:p<=0||s===`select`,onClick:()=>_(p-1)}),(0,H.jsx)(B,{icon:(0,H.jsx)(oa,{className:`h-4 w-4`}),label:T(`inboxNext`),disabled:p>=f.length-1||s===`select`,onClick:()=>_(p+1)})]}):null;return(0,H.jsx)(Rr,{open:o&&!!m,onOpenChange:e=>{e||r.closeReader()},children:(0,H.jsx)(Vr,{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,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`header`,{className:`shrink-0 border-b border-border/50 px-5 py-3 pr-14 sm:px-6`,children:[(0,H.jsxs)(`div`,{className:`flex min-h-7 items-center justify-between gap-3`,children:[(0,H.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,H.jsx)(`span`,{className:`flex h-7 w-7 shrink-0 items-center justify-center rounded-lg bg-muted/70 text-muted-foreground`,children:(0,H.jsx)(Za,{className:`h-3.5 w-3.5`})}),(0,H.jsx)(Hr,{ref:e,tabIndex:-1,title:m.title,className:`min-w-0 truncate text-sm font-medium text-foreground outline-none`,children:m.title}),(0,H.jsx)(`span`,{className:`hidden shrink-0 text-muted-foreground sm:inline`,"aria-hidden":`true`,children:`·`}),(0,H.jsx)(`time`,{className:`hidden shrink-0 text-[11px] tabular-nums text-muted-foreground sm:block`,dateTime:m.createdAt,children:j(m.createdAt)})]}),x]}),(0,H.jsx)(Fr,{className:`sr-only`,children:m.summary??T(`inboxNoSummary`)})]}),(0,H.jsx)(`div`,{className:c(`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,H.jsx)(V7,{className:h?`h-full`:void 0,content:m.content,contentType:m.contentType,fillHeight:h,title:m.title})}),(0,H.jsxs)(`footer`,{className:`shrink-0 border-t border-border/50 bg-background px-5 py-3 sm:px-6`,children:[u?(0,H.jsx)(`p`,{role:`alert`,className:`mb-3 text-sm text-destructive`,children:u}):null,(0,H.jsxs)(`div`,{className:`flex flex-col-reverse gap-2 sm:flex-row sm:items-center sm:justify-between`,children:[(0,H.jsxs)(`div`,{className:`flex flex-col-reverse gap-1 sm:flex-row sm:flex-wrap`,children:[(0,H.jsx)(R,{size:`sm`,variant:`ghost`,onClick:r.closeReader,children:T(`inboxReadLater`)}),(0,H.jsx)(R,{size:`sm`,variant:`outline`,disabled:s!==null,onClick:b,children:T(`inboxMarkRead`)}),(0,H.jsx)(R,{size:`sm`,variant:`ghost`,disabled:s!==null,onClick:v,children:T(`inboxOpenInbox`)})]}),(0,H.jsx)(R,{size:`sm`,disabled:s!==null,onClick:y,children:T(`inboxContinueChat`)})]})]})]}):null})})}function Nne(){let{inboxManager:e}=q9();return(0,V.useEffect)(()=>(e.start(),()=>e.stop()),[e]),(0,H.jsx)(Mne,{})}function Pne(e,t){return t||(e.some(e=>!e.readAt&&!e.archivedAt)?`unread`:`all`)}function q7(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 J7({selection:e=!1}){return(0,H.jsxs)(`div`,{className:`flex h-full min-h-56 flex-col items-center justify-center px-8 text-center`,children:[(0,H.jsx)(`span`,{className:`mb-4 flex h-12 w-12 items-center justify-center rounded-2xl bg-muted text-muted-foreground`,children:(0,H.jsx)(Za,{className:`h-5 w-5`})}),(0,H.jsx)(`h2`,{className:`text-base font-semibold text-foreground`,children:T(e?`inboxSelectTitle`:`inboxEmptyTitle`)}),(0,H.jsx)(`p`,{className:`mt-2 max-w-sm text-sm leading-6 text-muted-foreground`,children:T(e?`inboxSelectDescription`:`inboxEmptyDescription`)})]})}function Fne({activeDeliveryId:e,deliveries:t,filter:n,onFilterChange:r}){let i=[{id:`unread`,label:T(`inboxUnread`),count:q7(t,`unread`).length},{id:`all`,label:T(`inboxAll`),count:q7(t,`all`).length},{id:`archived`,label:T(`inboxArchived`),count:q7(t,`archived`).length}],a=q7(t,n);return(0,H.jsxs)(`aside`,{className:`flex min-h-0 flex-col border-border/60 bg-muted/20 md:border-r`,children:[(0,H.jsx)(`div`,{className:`flex shrink-0 gap-1 border-b border-border/50 px-3 py-2`,children:i.map(e=>(0,H.jsxs)(`button`,{type:`button`,onClick:()=>r(e.id),className:c(`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,H.jsx)(`span`,{"aria-hidden":`true`,className:`text-[10px] font-normal tabular-nums opacity-60`,children:e.count})]},e.id))}),(0,H.jsx)(`div`,{className:`custom-scrollbar min-h-0 flex-1 overflow-y-auto p-2`,children:a.length>0?(0,H.jsx)(`ul`,{className:`space-y-0.5`,children:a.map(t=>(0,H.jsx)(`li`,{children:(0,H.jsxs)(ce,{to:`/inbox/${encodeURIComponent(t.id)}`,className:c(`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,H.jsx)(`h2`,{className:c(`truncate font-medium leading-5`,!t.readAt&&`font-semibold text-foreground`),children:t.title}),(0,H.jsxs)(`div`,{className:`mt-0.5 flex items-center gap-2 text-[11px] leading-4 text-muted-foreground/65`,children:[(0,H.jsx)(`p`,{className:`min-w-0 flex-1 truncate`,children:t.summary??T(`inboxNoSummary`)}),t.readAt?(0,H.jsx)(`time`,{className:`shrink-0 tabular-nums`,dateTime:t.createdAt,children:k(t.createdAt)}):(0,H.jsx)(`span`,{className:`h-2 w-2 shrink-0 rounded-full bg-primary`,"aria-label":T(`inboxUnread`)})]})]})},t.id))}):(0,H.jsx)(J7,{})})]})}function Ine({delivery:e,error:t,isMobile:n,pending:r,onArchiveToggle:i,onBack:a,onContinue:o,onDelete:s,onReadToggle:l}){if(!e)return(0,H.jsx)(`main`,{className:`flex min-h-0 flex-col`,children:(0,H.jsx)(J7,{selection:!0})});let u=e.contentType===`html`;return(0,H.jsxs)(`main`,{className:`flex min-h-0 flex-col`,children:[(0,H.jsxs)(`div`,{className:`shrink-0 border-b border-border/50 px-5 py-3 sm:px-6`,children:[n?(0,H.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,H.jsx)(di,{className:`h-4 w-4`}),T(`inboxTitle`)]}):null,(0,H.jsxs)(`div`,{className:`flex min-h-7 min-w-0 items-center gap-2`,children:[(0,H.jsx)(`h2`,{title:e.title,className:`min-w-0 truncate text-sm font-medium text-foreground`,children:e.title}),(0,H.jsx)(`span`,{className:`hidden shrink-0 text-muted-foreground sm:inline`,"aria-hidden":`true`,children:`·`}),(0,H.jsx)(`time`,{className:`hidden shrink-0 text-[11px] tabular-nums text-muted-foreground sm:block`,dateTime:e.createdAt,children:j(e.createdAt)})]})]}),(0,H.jsx)(`div`,{className:c(`min-h-0 flex-1`,u?`p-3 sm:p-4`:`custom-scrollbar overflow-y-auto px-5 py-5 sm:px-6 sm:py-6`),children:(0,H.jsx)(`div`,{className:c(`mx-auto max-w-5xl`,u&&`h-full`),children:(0,H.jsx)(V7,{className:u?`h-full`:void 0,content:e.content,contentType:e.contentType,fillHeight:u,title:e.title})})}),(0,H.jsxs)(`div`,{className:`shrink-0 border-t border-border/50 px-5 py-3 sm:px-6`,children:[t?(0,H.jsx)(`p`,{role:`alert`,className:`mb-2 text-sm text-destructive`,children:t}):null,(0,H.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1`,children:[(0,H.jsx)(R,{size:`sm`,variant:`outline`,disabled:r,onClick:l,children:e.readAt?T(`inboxMarkUnread`):T(`inboxMarkRead`)}),(0,H.jsxs)(R,{size:`sm`,variant:`ghost`,disabled:r,onClick:i,children:[e.archivedAt?(0,H.jsx)(Mo,{className:`mr-2 h-4 w-4`}):(0,H.jsx)(Ui,{className:`mr-2 h-4 w-4`}),e.archivedAt?T(`inboxRestore`):T(`inboxArchive`)]}),(0,H.jsxs)(R,{size:`sm`,variant:`ghost`,disabled:r,onClick:s,children:[(0,H.jsx)(Yo,{className:`mr-2 h-4 w-4`}),T(`inboxDelete`)]})]}),(0,H.jsxs)(R,{size:`sm`,disabled:r,onClick:o,children:[(0,H.jsx)(lo,{className:`mr-2 h-4 w-4`}),T(`inboxContinueChat`)]})]})]})]})}function Lne(){let e=oe(),{deliveryId:t}=se(),{isMobile:n}=c6(),{chatDraftIntentManager:r,inboxManager:i}=q9(),a=G7(),{confirm:o,ConfirmDialog:s}=An(),[c,l]=(0,V.useState)(null),[u,d]=(0,V.useState)(null),[f,p]=(0,V.useState)(null),m=(0,V.useMemo)(()=>a.data?.deliveries??[],[a.data?.deliveries]),h=(0,V.useMemo)(()=>t?m.find(({id:e})=>e===t)??null:null,[m,t]),g=Pne(m,c);(0,V.useEffect)(()=>{h&&!h.readAt&&i.markRead(h.id).catch(()=>p(T(`inboxActionError`)))},[h,i]);let _=async(e,t)=>{d(e),p(null);try{await t()}catch{p(T(`inboxActionError`))}finally{d(null)}},v=()=>{h&&_(`continue`,async()=>{let{reference:t}=await i.prepareChatReference(h.id);r.requestSystemObjectReference(t),e(d9)})},y=async()=>{!h||!await o({title:T(`inboxDeleteTitle`),description:T(`inboxDeleteDescription`),confirmLabel:T(`inboxDeleteConfirm`),variant:`destructive`})||_(`delete`,async()=>{await i.delete(h.id),e(`/inbox`,{replace:!0})})},b=()=>{h&&_(`read`,async()=>{if(h.readAt){await i.markUnread(h.id),e(`/inbox`,{replace:!0});return}await i.markRead(h.id)})},x=()=>{h&&_(`archive`,async()=>{if(h.archivedAt){await i.restore(h.id);return}await i.archive(h.id),e(`/inbox`,{replace:!0})})},S=!n||!h,C=!n||!!h;return(0,H.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col gap-6`,children:[(0,H.jsx)(_e,{headingLevel:1,title:T(`inboxTitle`),className:`px-4 sm:px-0`}),(0,H.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,H.jsx)(`div`,{role:`alert`,className:`p-6 text-sm text-destructive`,children:T(`inboxLoadError`)}):(0,H.jsxs)(`div`,{className:`grid h-full min-h-0 grid-cols-1 md:grid-cols-[300px_minmax(0,1fr)]`,children:[S?(0,H.jsx)(Fne,{activeDeliveryId:h?.id??null,deliveries:m,filter:g,onFilterChange:l}):null,C?(0,H.jsx)(Ine,{delivery:h,error:f,isMobile:n,pending:u!==null,onArchiveToggle:x,onBack:()=>e(`/inbox`),onContinue:v,onDelete:()=>void y(),onReadToggle:b}):null]})}),(0,H.jsx)(s,{})]})}function Rne(e,t){return t.some(t=>t.value===e)?e:t[0]?.value??e}function zne(e){let{groups:t,defaultSessionType:n,sessionTypeOptions:r,renderSessionItem:i}=e,a=il(),o=du(e=>e.snapshot.collapsedProjectRoots),[s,c]=(0,V.useState)(null),l=(0,V.useMemo)(()=>Rne(n,r),[n,r]),u=r.length>1;return(0,H.jsx)(`div`,{className:`space-y-0.5`,children:t.map(e=>{let t=`${T(`chatSidebarNewTask`)} · ${e.projectName}`,n=o.includes(e.projectRoot),d=T(e.isPinned?`chatSidebarUnpinProject`:`chatSidebarPinProject`);return(0,H.jsxs)(`div`,{children:[(0,H.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,H.jsxs)(`button`,{type:`button`,"aria-expanded":!n,"aria-label":T(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:()=>a.chatSessionListManager.toggleProjectCollapsed(e.projectRoot),children:[(0,H.jsx)(Ua,{className:`h-3.5 w-3.5 shrink-0`,"aria-hidden":`true`}),(0,H.jsx)(`span`,{className:`truncate text-[11px] font-medium uppercase tracking-wider`,title:e.projectRoot,children:e.projectName}),n?(0,H.jsx)(oa,{className:`h-3.5 w-3.5 shrink-0`,"aria-hidden":`true`}):(0,H.jsx)(er,{className:`h-3.5 w-3.5 shrink-0`,"aria-hidden":`true`}),(0,H.jsx)(`span`,{className:`shrink-0 text-[10px] text-muted-foreground/70`,children:e.items.length})]}),(0,H.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:[u?(0,H.jsxs)(Tc,{open:s===e.projectRoot,onOpenChange:t=>{c(t?e.projectRoot:null)},children:[(0,H.jsx)(Ec,{asChild:!0,children:(0,H.jsx)(B,{icon:(0,H.jsx)(hi,{className:`h-3.5 w-3.5`}),label:t})}),(0,H.jsx)(Oc,{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,H.jsx)(C7,{options:r,selectedSessionType:l,onSelect:t=>{a.chatSessionListManager.createSession({projectRoot:e.projectRoot,sessionType:t}),c(null)}})})]}):(0,H.jsx)(B,{icon:(0,H.jsx)(hi,{className:`h-3.5 w-3.5`}),label:t,onClick:()=>a.chatSessionListManager.createSession({projectRoot:e.projectRoot,sessionType:l})}),(0,H.jsx)(B,{icon:(0,H.jsx)(Qr,{className:e.isPinned?`h-3.5 w-3.5 fill-current text-foreground`:`h-3.5 w-3.5`}),label:d,tooltipSide:`right`,onClick:()=>a.chatSessionListManager.toggleProjectPinned(e.projectRoot)})]})]}),n?null:(0,H.jsx)(`div`,{className:`mt-0.5 space-y-0.5 pl-2`,children:e.items.map(i)})]},e.projectRoot)})})}function Y7({label:e}){return(0,H.jsxs)(`div`,{className:`p-4 text-center`,children:[(0,H.jsx)(po,{className:`mx-auto mb-2 h-6 w-6 text-muted-foreground/45`}),(0,H.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:e})]})}function Bne({defaultSessionType:e,groups:t,isLoading:n,isProjectFirstView:r,projectGroups:i,renderSessionItem:a,sessionTypeOptions:o}){return n?(0,H.jsx)(`div`,{className:`p-3 text-xs text-muted-foreground`,children:T(`sessionsLoading`)}):r?i.length===0?(0,H.jsx)(Y7,{label:T(`chatSidebarProjectViewEmpty`)}):(0,H.jsx)(zne,{groups:i,defaultSessionType:e,sessionTypeOptions:o,renderSessionItem:a}):t.length===0?(0,H.jsx)(Y7,{label:T(`sessionsEmpty`)}):(0,H.jsx)(`div`,{className:`space-y-2`,children:t.map(e=>(0,H.jsxs)(`div`,{children:[(0,H.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,H.jsx)(`div`,{className:`space-y-0.5`,children:e.items.map(a)})]},e.label))})}function Vne({isOpen:e,onOpenChange:t,currentTheme:n,currentThemeLabel:r,themeOptions:i,onSelectTheme:a,currentLanguage:o,currentLanguageLabel:s,languageOptions:l,onSelectLanguage:u,onOpenDocs:d,onOpenApps:f,collapsed:p=!1}){return(0,H.jsxs)(Tc,{open:e,onOpenChange:t,children:[p?(0,H.jsx)(ti,{delayDuration:250,children:(0,H.jsxs)(oi,{children:[(0,H.jsx)(si,{asChild:!0,children:(0,H.jsx)(Ec,{asChild:!0,children:(0,H.jsx)(`button`,{type:`button`,"aria-label":T(`settingsMenu`),className:c(`flex items-center justify-center`,E7,A7),children:(0,H.jsx)(Fo,{className:c(D7,`shrink-0 text-muted-foreground`)})})})}),(0,H.jsx)(Yr,{side:`right`,className:`text-xs`,children:T(`settingsMenu`)})]})}):(0,H.jsx)(Ec,{asChild:!0,children:(0,H.jsxs)(`button`,{type:`button`,"aria-label":T(`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,H.jsx)(Fo,{className:`h-4 w-4 shrink-0 text-muted-foreground/70`}),(0,H.jsx)(`span`,{className:`min-w-0 flex-1 text-left`,children:T(`settings`)})]})}),(0,H.jsxs)(Oc,{side:p?`right`:`top`,align:p?`end`:`start`,className:`w-64 p-2`,children:[(0,H.jsxs)(`div`,{className:`space-y-1`,children:[(0,H.jsxs)(de,{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,H.jsx)(Fo,{className:`h-4 w-4 text-muted-foreground/70`}),(0,H.jsx)(`span`,{className:`flex-1 text-left`,children:T(`settings`)})]}),[{key:`docs`,icon:pi,label:T(`docBrowserHelp`),action:d},{key:`apps`,icon:Jr,label:T(`appsTitle`),action:f}].map(({key:e,icon:n,label:r,action:i})=>(0,H.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,H.jsx)(n,{className:`h-4 w-4 text-muted-foreground/70`}),(0,H.jsx)(`span`,{className:`flex-1 text-left`,children:r})]},e))]}),(0,H.jsx)(`div`,{className:`my-2 h-px bg-border`}),(0,H.jsx)(X7,{icon:So,label:T(`theme`),options:i,value:n,valueLabel:r,onSelect:a,onCloseMenu:()=>t(!1)}),(0,H.jsx)(X7,{icon:$a,label:T(`language`),options:l,value:o,valueLabel:s,onSelect:u,onCloseMenu:()=>t(!1)})]})]})}function X7({icon:e,label:t,options:n,value:r,valueLabel:i,onSelect:a,onCloseMenu:o}){return(0,H.jsxs)(Sr,{value:r,onOpenChange:e=>{e||o()},onValueChange:e=>a(e),children:[(0,H.jsxs)(mr,{"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,H.jsx)(oa,{className:`h-4 w-4 text-muted-foreground/70`}),children:[(0,H.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2.5`,children:[(0,H.jsx)(e,{className:`h-4 w-4 shrink-0 text-muted-foreground/70`}),(0,H.jsx)(`span`,{className:`text-left`,children:t})]}),(0,H.jsx)(`span`,{className:`ml-auto max-w-[96px] truncate text-[13px] text-muted-foreground`,children:i})]}),(0,H.jsx)(_r,{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,H.jsx)(br,{value:e.value,className:`text-[13px]`,children:e.label},e.value))})]})}var Z7=N(()=>({supported:!1,initialized:!1,busyAction:null,snapshot:null})),Hne=new class{constructor(){this.start=async()=>{let e=this.getDesktopApi();if(!e){this.markUnsupported();return}Z7.setState({supported:!0,initialized:!1,busyAction:`loading`});try{let t=await e.getPresenceState();Z7.setState({supported:!0,initialized:!0,busyAction:null,snapshot:t})}catch(e){Z7.setState({supported:!0,initialized:!0,busyAction:null}),L.error(`${T(`runtimePresenceLoadFailed`)}: ${this.getErrorMessage(e)}`)}},this.markUnsupported=()=>{Z7.setState({supported:!1,initialized:!0,busyAction:null,snapshot:null})},this.updatePreferences=async e=>{let t=this.getDesktopApi();if(!t)throw Error(T(`runtimePresenceLaunchAtLoginUnavailable`));Z7.setState({busyAction:`saving-preferences`});try{let n=await t.updatePresencePreferences(e);return Z7.setState({supported:!0,initialized:!0,snapshot:n}),L.success(T(`runtimePresenceSaved`)),n}catch(e){throw L.error(`${T(`runtimePresenceSaveFailed`)}: ${this.getErrorMessage(e)}`),e}finally{Z7.setState({busyAction:null})}},this.getDesktopApi=()=>typeof window>`u`?null:window.nextclawDesktop??null,this.getErrorMessage=e=>e instanceof Error?e.message:T(`error`)}},Q7=N(()=>({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){Q7.setState({supported:!1,initialized:!0,snapshot:null});return}this.unsubscribe||=e.onUpdateStateChanged(e=>{Q7.setState({supported:!0,initialized:!0,snapshot:e})}),Q7.setState({supported:!0,initialized:!1});try{let t=await e.getUpdateState();Q7.setState({supported:!0,initialized:!0,snapshot:t})}catch(e){Q7.setState({supported:!0,initialized:!0}),L.error(`${T(`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`,T(`desktopUpdatesCheckFailed`),async e=>await e.checkForUpdates())}catch{return}if(e.status===`up-to-date`){L.success(T(`desktopUpdatesAlreadyLatest`));return}if(e.status===`update-available`){L.success(T(`desktopUpdatesAvailable`).replace(`{version}`,e.availableVersion??T(`desktopUpdatesUnknownVersion`)));return}if(e.status===`downloaded`){L.success(T(`desktopUpdatesReadyToApply`));return}e.status===`failed`&&e.errorMessage&&L.error(e.errorMessage)},this.downloadUpdate=async()=>{let e;try{e=await this.runSnapshotCommand(`downloading`,T(`desktopUpdatesDownloadFailed`),async e=>await e.downloadUpdate())}catch{return}e.status===`downloaded`&&L.success(T(`desktopUpdatesReadyToApply`))},this.applyDownloadedUpdate=async()=>{try{await this.runSnapshotCommand(`applying`,T(`desktopUpdatesApplyFailed`),async e=>await e.applyDownloadedUpdate())}catch{return}},this.updateChannel=async e=>{if(Q7.getState().snapshot?.channel===e)return;let t;try{t=await this.runSnapshotCommand(`switching-channel`,T(`desktopUpdatesChannelChangeFailed`),async t=>await t.updateChannel(e))}catch{return}if(t.status===`update-available`&&t.availableVersion){L.success(T(`desktopUpdatesChannelChangedWithUpdate`).replace(`{channel}`,this.getChannelLabel(e)).replace(`{version}`,t.availableVersion));return}L.success(T(`desktopUpdatesChannelChanged`).replace(`{channel}`,this.getChannelLabel(e)))},this.runSnapshotCommand=async(e,t,n)=>{let r=this.getDesktopApi();if(!r)throw Error(T(`desktopUpdatesDesktopOnlyDescription`));Q7.setState({busyAction:e});try{let e=await n(r);return Q7.setState({snapshot:e}),e}catch(e){throw L.error(`${t}: ${this.getErrorMessage(e)}`),e}finally{Q7.setState({busyAction:null})}},this.getDesktopApi=()=>typeof window>`u`?null:window.nextclawDesktop??null,this.getErrorMessage=e=>e instanceof Error?e.message:T(`error`),this.getChannelLabel=e=>T(e===`beta`?`desktopUpdatesChannelBeta`:`desktopUpdatesChannelStable`)}};function $7(e,t){let n=e.toLowerCase(),r=t.toLowerCase();return n===r||n.startsWith(`${r}/`)}function e9(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/`)}function t9(e){let t=e.toLowerCase();return t.startsWith(`/chat/`)&&t!==`/chat`}function Une(e){return[{target:`/chat`,label:e(`chat`),icon:lo},{target:`/inbox`,label:e(`inboxTitle`),icon:Za},{target:`/skills`,label:e(`marketplaceFilterSkills`),icon:Qi},{target:`/agents`,label:e(`agentsPageTitle`),icon:Xi},{target:`/settings`,label:e(`settings`),icon:Fo}]}function n9(e){return[{target:`/model`,label:e(`model`),icon:xa},{target:`/providers`,label:e(`providers`),icon:Ar},{target:`/channels`,label:e(`channels`),icon:mo},{target:`/appearance`,label:e(`appearance`),icon:So},{target:`/security`,label:e(`security`),icon:Ro},{target:`/search`,label:e(`searchChannels`),icon:fi},{target:`/updates`,label:e(`updates`),icon:Sa},{target:`/remote`,label:e(`remote`),icon:es},{target:`/runtime`,label:e(`runtime`),icon:xa},{target:`/secrets`,label:e(`secrets`),icon:Qa},{target:`/marketplace/mcp`,label:e(`marketplaceFilterMcp`),icon:ns}]}function Wne(e){let t=n9(e);return[{label:e(`settingsGroupBasic`),items:t.slice(0,3)},{label:e(`settingsGroupAdvanced`),items:t.slice(3)}]}function Gne(e){let t=e.toLowerCase();return t===`/settings`?!0:n9(e=>e).some(e=>$7(t,e.target))}function Kne(e,t){let n=e.toLowerCase(),r=n9(t);if(t9(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===`/settings`)return{title:t(`settings`),backTarget:null,backLabel:null};for(let e of r)if($7(n,e.target))return{title:e.label,backTarget:`/settings`,backLabel:t(`settings`)};return{title:t(`settings`),backTarget:null,backLabel:null}}function r9({isCollapsed:e,onToggle:t}){let n=T(e?`sidebarExpand`:`sidebarCollapse`);return(0,H.jsx)(B,{icon:(0,H.jsx)(e?wo:Co,{className:D7}),label:n,className:c(A7,e&&`h-9 w-9 rounded-xl`),onClick:t})}function qne({isCollapsed:e,onToggle:t}){return(0,H.jsx)(`div`,{className:c(`shrink-0`,e?`px-0 py-1.5`:`px-2 py-2`),children:(0,H.jsxs)(`div`,{className:c(`flex items-center py-1`,e?c(`flex-col px-0`,k7):`gap-2 px-1`),"data-testid":`settings-sidebar-header`,children:[e?(0,H.jsx)(r9,{isCollapsed:e,onToggle:t}):null,(0,H.jsxs)(de,{to:`/chat`,"aria-label":T(`backToMain`),className:c(`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?c(E7,A7,`justify-center p-0`):`gap-1.5 px-1 py-1`),children:[(0,H.jsx)(di,{className:c(e?D7:`h-3.5 w-3.5`,`shrink-0 text-muted-foreground/75 group-hover:text-gray-700`)}),(0,H.jsx)(`span`,{className:e?`sr-only`:`truncate`,children:T(`backToMain`)})]}),e?null:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`span`,{className:`h-4 w-px shrink-0 bg-border`,"aria-hidden":`true`}),(0,H.jsx)(`h1`,{className:`truncate text-[15px] font-semibold tracking-[-0.01em] text-foreground`,children:T(`settings`)}),(0,H.jsx)(`div`,{className:`ml-auto`,children:(0,H.jsx)(r9,{isCollapsed:e,onToggle:t})})]})]})})}function Jne({isCollapsed:e,sections:t}){return(0,H.jsx)(`nav`,{className:c(`custom-scrollbar min-h-0 flex-1 overflow-y-auto`,e?`pr-0`:`pr-1`,Rc),children:e?(0,H.jsx)(z7,{isCollapsed:e,items:t.flatMap(e=>e.items),density:`compact`,className:c(O7,`pb-3`)}):(0,H.jsx)(`div`,{className:`space-y-3 pb-3`,children:t.map(t=>(0,H.jsxs)(`section`,{"aria-label":t.label,className:`space-y-1`,children:[(0,H.jsx)(`h2`,{className:`px-3 text-[11px] font-semibold text-muted-foreground/70`,children:t.label}),(0,H.jsx)(z7,{isCollapsed:e,items:t.items,density:`compact`})]},t.label))})})}function Yne(){let e=q9(),t=ki(),n=os(),r=Hs(e=>e.isSidebarCollapsed),i=Us.toggleSidebarCollapsed,a=n.data?.account.email?.trim(),o=!!n.data?.account.loggedIn,s=Wne(T),l=r?O7:I7(`compact`);return(0,H.jsxs)(`aside`,{className:c(`shrink-0 flex h-full min-h-0 flex-col overflow-hidden bg-secondary pb-6 transition-[width] duration-200 ease-out`,r?c(w7,T7):`w-[240px] px-4`),"data-sidebar-collapsed":r?`true`:`false`,children:[(0,H.jsx)(qne,{isCollapsed:r,onToggle:i}),(0,H.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,H.jsx)(Jne,{isCollapsed:r,sections:s}),(0,H.jsxs)(`div`,{className:c(`shrink-0 bg-secondary`,r?`mt-2 flex flex-col items-center pt-2`:`mt-2 pt-3`,l),children:[(0,H.jsx)(B7,{onClick:()=>t.open(void 0,{kind:`docs`,title:T(`docBrowserHelp`)}),icon:pi,label:T(`docBrowserHelp`),density:`compact`,collapsed:r}),(0,H.jsx)(B7,{onClick:()=>e.accountManager.openAccountPanel(),icon:Qa,label:T(`remoteAccountEntryManage`),density:`compact`,trailing:o?a||T(`remoteAccountEntryConnected`):T(`remoteAccountEntryDisconnected`),trailingClassName:`max-w-[92px] truncate text-right`,testId:`settings-sidebar-account-entry`,trailingTestId:`settings-sidebar-account-status`,collapsed:r})]})]})]})}var i9=[{action:`minimize`,label:`Minimize`,icon:_o},{action:`close`,label:`Close`,icon:_i,variant:`danger`}];function Xne({sidebarCollapsed:e=!1}){let t=Qne()?{action:`toggle-maximize`,label:`Restore`,icon:ya}:{action:`toggle-maximize`,label:`Maximize`,icon:Wo};return(0,H.jsxs)(`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,H.jsx)(`div`,{className:`desktop-window-no-drag absolute left-0 right-0 top-0 h-1`,"data-testid":`desktop-window-chrome-resize-strip`}),(0,H.jsx)(`div`,{className:c(`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,H.jsx)(`img`,{src:`/logo.svg`,alt:`NextClaw`,className:`h-6 w-6 shrink-0 object-contain`}):(0,H.jsx)(M7,{className:`flex min-w-0 shrink-0 items-center gap-2.5`,density:`chrome`})}),(0,H.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:[i9[0],t,i9[1]].map(e=>(0,H.jsx)(Zne,{control:e},e.action))})]})}function Zne({control:e}){let t=e.icon;return(0,H.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,H.jsx)(t,{className:`h-3.5 w-3.5`})})}function Qne(){let[e,t]=(0,V.useState)(!1);return(0,V.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 a9(){return typeof window>`u`?null:$ne()??window.nextclawDesktop?.platform??null}function o9(){return a9()===`win32`}function $ne(){return null}function s9(){let{pathname:e}=he(),t=ki(),n=K7();return(0,H.jsx)(`nav`,{"data-testid":`mobile-bottom-nav`,"aria-label":T(`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,H.jsxs)(`ul`,{className:`grid grid-cols-6 gap-1 px-2 pt-1`,children:[Une(T).map(t=>{let r=t.target===`/settings`?Gne(e):$7(e,t.target);return(0,H.jsx)(`li`,{children:(0,H.jsxs)(ce,{to:t.target,"aria-current":r?`page`:void 0,"data-testid":r?`mobile-nav-active-indicator`:void 0,className:c(`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,H.jsxs)(`span`,{className:`relative`,children:[(0,H.jsx)(t.icon,{className:c(`h-3.5 w-3.5`,r?`text-gray-900`:`text-gray-400`)}),t.target===`/inbox`&&n>0?(0,H.jsx)(`span`,{className:`absolute -right-1 -top-1 h-1.5 w-1.5 rounded-full bg-primary ring-1 ring-white`}):null]}),(0,H.jsx)(`span`,{className:`max-w-full truncate`,children:t.label})]})},t.target)}),(0,H.jsx)(`li`,{children:(0,H.jsxs)(`button`,{type:`button`,onClick:()=>V$(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,H.jsx)(Jr,{className:`h-3.5 w-3.5 text-gray-400`}),(0,H.jsx)(`span`,{className:`max-w-full truncate`,children:T(`appsTitle`)})]})})]})})}function ere({leadingInset:e}){let t=oe(),{pathname:n}=he(),r=Kne(n,T);return(0,H.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,H.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,H.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??T(`backToMain`),children:(0,H.jsx)(di,{className:`h-4 w-4`})}):null,(0,H.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,H.jsx)(`h1`,{className:`truncate text-center text-[15px] font-semibold text-gray-900`,children:r.title})}),r.backTarget?(0,H.jsx)(`div`,{className:`h-8 w-8 shrink-0`,"aria-hidden":`true`}):null]})})}var tre=(0,V.lazy)(async()=>({default:(await F(async()=>{let{DocBrowser:e}=await import(`./doc-browser-D0arfzHY.js`);return{DocBrowser:e}},__vite__mapDeps([25,26,4,27,28,29,30,31,32,1,33,34,35,36,37,38]))).DocBrowser}));function nre({pathname:e,isDocBrowserOpen:t,docBrowserDockControls:n,docBrowserRenderers:r={},docBrowserTabMenuGroups:i,topbarLeadingInset:a,children:o}){let s=e9(e),c=!t9(e),l=!t9(e);return(0,H.jsxs)(`div`,{className:`flex h-[100svh] flex-col bg-background font-sans text-foreground supports-[height:100dvh]:h-[100dvh]`,children:[c?(0,H.jsx)(ere,{leadingInset:a}):null,(0,H.jsx)(`div`,{className:`relative flex-1 min-h-0 overflow-hidden`,children:s?(0,H.jsx)(`div`,{className:`h-full min-h-0 overflow-hidden`,children:o}):(0,H.jsx)(`main`,{className:`h-full overflow-auto px-4 py-4 custom-scrollbar`,children:(0,H.jsx)(`div`,{className:`mx-auto max-w-3xl animate-fade-in`,children:o})})}),l?(0,H.jsx)(s9,{}):null,t?(0,H.jsx)(V.Suspense,{fallback:null,children:(0,H.jsx)(tre,{customTabRenderers:r,displayMode:`fullscreen`,dockControls:n,getTabMenuGroups:i})}):null]})}function rre(){let e=n9(T);return(0,H.jsx)(`div`,{"data-testid":`mobile-settings-shell`,className:`space-y-3 pb-4`,children:e.map(e=>(0,H.jsxs)(de,{to:e.target,className:({isActive:e})=>c(`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,H.jsx)(`div`,{className:`flex h-10 w-10 shrink-0 items-center justify-center rounded-2xl bg-gray-100 text-gray-600`,children:(0,H.jsx)(e.icon,{className:`h-4 w-4`})}),(0,H.jsx)(`div`,{className:`min-w-0`,children:(0,H.jsx)(`p`,{className:`truncate text-sm font-semibold text-gray-900`,children:e.label})})]},e.target))})}function ire(){let{pathname:e}=he(),t=oe();return t9(e)?(0,H.jsx)(n7,{layoutMode:`mobile`,onBackToList:()=>t(`/chat`)}):(0,H.jsx)(l9,{variant:`mobile`})}var c9=(0,V.lazy)(async()=>({default:(await F(async()=>{let{DocBrowser:e}=await import(`./doc-browser-D0arfzHY.js`);return{DocBrowser:e}},__vite__mapDeps([25,26,4,27,28,29,30,31,32,1,33,34,35,36,37,38]))).DocBrowser}));function are({pathname:e,isMobileLayout:t=!1,isDocBrowserOpen:n,docBrowserMode:r,docBrowserDockControls:i,docBrowserRenderers:a={},docBrowserTabMenuGroups:o,sideDock:s,children:l}){let u=e9(e),d=Hs(e=>e.isSidebarCollapsed),f=t&&!t9(e),p=o9(),m=d?`56px`:u?`280px`:`240px`;return(0,H.jsxs)(`div`,{className:c(`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:[p?(0,H.jsx)(Xne,{sidebarCollapsed:d}):null,(0,H.jsxs)(`div`,{className:`flex min-h-0 flex-1 overflow-hidden`,children:[!u&&(0,H.jsx)(Yne,{}),(0,H.jsxs)(`div`,{className:`flex-1 flex min-w-0 overflow-hidden relative`,children:[(0,H.jsx)(`div`,{className:`flex-1 flex flex-col min-w-0 overflow-hidden`,children:u?(0,H.jsx)(`div`,{className:`flex-1 h-full overflow-hidden`,children:l}):(0,H.jsx)(`main`,{className:`flex-1 overflow-auto p-8 pb-16 custom-scrollbar`,children:(0,H.jsx)(`div`,{className:`mx-auto h-full max-w-6xl animate-fade-in`,children:l})})}),n&&r===`docked`?(0,H.jsx)(V.Suspense,{fallback:null,children:(0,H.jsx)(c9,{customTabRenderers:a,dockControls:i,getTabMenuGroups:o})}):null,s]})]}),f?(0,H.jsx)(s9,{}):null,n&&r===`floating`?(0,H.jsx)(V.Suspense,{fallback:null,children:(0,H.jsx)(c9,{customTabRenderers:a,dockControls:i,getTabMenuGroups:o})}):null]})}var ore=[{target:`/inbox`,label:()=>T(`inboxTitle`),icon:Za},{target:`/cron`,label:()=>T(`chatSidebarScheduledTasks`),icon:Hi},{target:`/skills`,label:()=>T(`chatSidebarSkills`),icon:Qi},{target:`/agents`,label:()=>T(`agentsPageTitle`),icon:Xi}];function sre({isCollapsed:e}){let t=T(e?`sidebarExpand`:`sidebarCollapse`);return(0,H.jsx)(B,{icon:(0,H.jsx)(e?wo:Co,{className:D7}),label:t,className:c(A7,e&&`h-9 w-9 rounded-xl`),onClick:Us.toggleSidebarCollapsed})}function cre({connectionStatus:e,isCollapsed:t}){let n=o9(),r=typeof window<`u`&&window.nextclawDesktop?.platform===`darwin`;return(0,H.jsxs)(`div`,{className:c(`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,H.jsx)(M7,{className:`flex min-w-0 flex-1 items-center gap-2`,suffix:(0,H.jsx)(Cne,{status:e})}),(0,H.jsx)(sre,{isCollapsed:t})]})}function lre({isCollapsed:e}){let t=K7();return(0,H.jsx)(`div`,{className:c(`pb-1`,e?`px-0`:`px-3`),children:(0,H.jsx)(`ul`,{className:e?O7:`space-y-0.5`,children:ore.map(n=>(0,H.jsx)(`li`,{className:e?`flex justify-center`:void 0,children:(0,H.jsx)(R7,{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))})})}function ure({defaultSessionType:e,groups:t,isCollapsed:n,isLoading:r,isProjectFirstView:i,onAddProject:a,onSelectMode:o,projectGroups:s,renderSessionItem:l,sessionTypeOptions:u}){return n?(0,H.jsx)(`div`,{className:`min-h-0 flex-1`,"aria-hidden":`true`}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:`flex h-8 items-center justify-end gap-1 px-3`,children:[i?(0,H.jsx)(B,{icon:(0,H.jsx)(za,{className:`h-3.5 w-3.5`}),label:T(`chatProjectAdd`),tone:`surface`,onClick:a}):null,(0,H.jsx)(Eu,{isProjectFirstView:i,onSelectMode:o})]}),(0,H.jsx)(`div`,{className:c(`custom-scrollbar min-h-0 flex-1 overflow-y-auto px-3 pb-4 pt-1`,Rc),children:(0,H.jsx)(Bne,{isLoading:r,isProjectFirstView:i,groups:t,projectGroups:s,defaultSessionType:e,sessionTypeOptions:u,renderSessionItem:l})})]})}function dre({currentLanguage:e,currentLanguageLabel:t,currentTheme:n,currentThemeLabel:r,isCollapsed:i,isOpen:a,languageOptions:o,onOpenApps:s,onOpenChange:l,onOpenDocs:u,onSelectLanguage:d,onSelectTheme:f,themeOptions:p}){return(0,H.jsx)(`div`,{className:c(`py-2`,i?c(`flex justify-center`,T7):`px-3`),children:(0,H.jsx)(Vne,{isOpen:a,onOpenChange:l,currentTheme:n,currentThemeLabel:r,themeOptions:p,onSelectTheme:f,currentLanguage:e,currentLanguageLabel:t,languageOptions:o,onSelectLanguage:d,onOpenDocs:u,onOpenApps:s,collapsed:i})})}function fre(e){return T(e===`knowledge-base`?`chatProjectTemplateKnowledgeBase`:`chatProjectTemplateEmpty`)}function pre({open:e,defaultWorkspacePath:t,templates:n,isCreating:r,isAddingExisting:i,createErrorMessage:a,addExistingErrorMessage:o,onOpenChange:s,onCreate:c,onAddExisting:l}){let[u,d]=(0,V.useState)(`create`),[f,p]=(0,V.useState)(``),[m,h]=(0,V.useState)(``),[g,_]=(0,V.useState)(``),[v,y]=(0,V.useState)(!1),[b,x]=(0,V.useState)(`empty`),S=n.length>0?n.map(e=>e.id):[`empty`],C=f.trim(),w=m.trim(),E=g.trim(),D=r||i,O=D||(u===`create`?!C:!E),k=u===`create`?a:o,A=()=>{d(`create`),p(``),h(``),_(``),x(`empty`),y(!1)},j=()=>{D||(A(),s(!1))};return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Rr,{open:e,onOpenChange:e=>{if(e){s(!0);return}j()},children:(0,H.jsxs)(Vr,{className:`sm:max-w-lg`,children:[(0,H.jsxs)(zr,{children:[(0,H.jsx)(Hr,{children:T(`chatProjectAddTitle`)}),(0,H.jsx)(Fr,{children:T(`chatProjectAddDescription`)})]}),(0,H.jsxs)(`form`,{className:`space-y-4`,onSubmit:e=>{e.preventDefault(),!O&&(u===`create`?c({name:C,template:b,rootPath:w||void 0}):l({rootPath:E})).then(A).catch(()=>void 0)},children:[(0,H.jsxs)(jY,{value:u,onValueChange:e=>{D||d(e===`existing`?`existing`:`create`)},children:[(0,H.jsxs)(MY,{className:`grid w-full grid-cols-2`,children:[(0,H.jsx)(NY,{value:`create`,children:T(`chatProjectCreateMode`)}),(0,H.jsx)(NY,{value:`existing`,children:T(`chatProjectExistingMode`)})]}),(0,H.jsxs)(PY,{value:`create`,className:`mt-4 space-y-4`,children:[(0,H.jsx)(`p`,{className:`text-sm leading-relaxed text-muted-foreground`,children:T(`chatProjectCreateModeDescription`)}),(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(cn,{htmlFor:`chat-project-name`,children:T(`chatProjectNameLabel`)}),(0,H.jsx)(Gt,{id:`chat-project-name`,value:f,onChange:e=>p(e.target.value),placeholder:T(`chatProjectNamePlaceholder`),autoFocus:!0,disabled:D})]}),(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(cn,{htmlFor:`chat-project-template`,children:T(`chatProjectTemplateLabel`)}),(0,H.jsxs)(Sr,{value:b,onValueChange:e=>x(e),disabled:D,children:[(0,H.jsx)(mr,{id:`chat-project-template`,children:(0,H.jsx)(sr,{})}),(0,H.jsx)(_r,{children:S.map(e=>(0,H.jsx)(br,{value:e,children:fre(e)},e))})]})]}),(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(cn,{htmlFor:`chat-project-create-root-path`,children:T(`chatProjectCreatePathLabel`)}),(0,H.jsxs)(`div`,{className:`flex gap-2`,children:[(0,H.jsx)(Gt,{id:`chat-project-create-root-path`,value:m,onChange:e=>h(e.target.value),placeholder:T(`chatProjectCreatePathPlaceholder`),disabled:D}),(0,H.jsxs)(R,{type:`button`,variant:`outline`,onClick:()=>y(!0),disabled:D,children:[(0,H.jsx)(Ra,{className:`mr-2 h-4 w-4`}),T(`browse`)]})]}),(0,H.jsx)(`p`,{className:`text-xs leading-relaxed text-muted-foreground`,children:T(`chatProjectCreatePathHint`)})]})]}),(0,H.jsxs)(PY,{value:`existing`,className:`mt-4 space-y-4`,children:[(0,H.jsx)(`p`,{className:`text-sm leading-relaxed text-muted-foreground`,children:T(`chatProjectExistingModeDescription`)}),(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(cn,{htmlFor:`chat-project-existing-root-path`,children:T(`chatProjectExistingPathLabel`)}),(0,H.jsxs)(`div`,{className:`flex gap-2`,children:[(0,H.jsx)(Gt,{id:`chat-project-existing-root-path`,value:g,onChange:e=>_(e.target.value),placeholder:T(`chatProjectExistingPathPlaceholder`),autoFocus:!0,disabled:D}),(0,H.jsxs)(R,{type:`button`,variant:`outline`,onClick:()=>y(!0),disabled:D,children:[(0,H.jsx)(Ra,{className:`mr-2 h-4 w-4`}),T(`browse`)]})]}),(0,H.jsx)(`p`,{className:`text-xs leading-relaxed text-muted-foreground`,children:T(`chatProjectExistingPathHint`)})]})]})]}),k?(0,H.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:k}):null,(0,H.jsxs)(kr,{children:[(0,H.jsx)(R,{type:`button`,variant:`outline`,onClick:j,disabled:D,children:T(`cancel`)}),(0,H.jsx)(R,{type:`submit`,disabled:O,children:T(D?`saving`:u===`create`?`chatProjectCreateAction`:`chatProjectExistingAction`)})]})]})]})}),(0,H.jsx)(Yc,{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:T(u===`create`?`chatProjectCreatePathPickerTitle`:`chatProjectExistingPathPickerTitle`),description:T(u===`create`?`chatProjectCreatePathPickerDescription`:`chatProjectExistingPathPickerDescription`),pathLabel:T(u===`create`?`chatProjectCreatePathLabel`:`chatProjectExistingPathLabel`),pathPlaceholder:T(u===`create`?`chatProjectCreatePathPlaceholder`:`chatProjectExistingPathPlaceholder`),confirmLabel:T(`selectCurrentDirectory`),hint:T(u===`create`?`chatProjectCreatePathHint`:`chatProjectExistingPathHint`)})]})}function mre(e,t,n){let r=du(e=>e.optimisticReadAtBySessionKey);return(0,V.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 l9({variant:e=`desktop`}){let t=e===`mobile`,n=il(),r=ki(),i=Hs(e=>e.isSidebarCollapsed),[a,o]=(0,V.useState)(!1),[s,l]=(0,V.useState)(!1),[u,d]=(0,V.useState)(!1),f=du(e=>e.snapshot),p=nd(e=>e.snapshot.sessionTypesQuery?.data??null),m=nd(e=>e.snapshot.configQuery?.data??null),h=$e(),g=hf(),_=id(),v=ad(),b=od(),{isLoading:x,items:S}=vu(),{language:C,setLanguage:w}=Nn(),{theme:E,setTheme:D}=S7(),O=T(c7.find(e=>e.value===E)?.labelKey??`themeWork`),k=y.find(e=>e.value===C)?.label??C,A=(0,V.useMemo)(()=>c7.map(e=>({value:e.value,label:T(e.labelKey)})),[]),j=(0,V.useMemo)(()=>y.map(e=>({value:e.value,label:e.label})),[]),M=(0,V.useMemo)(()=>new Map((g.data?.agents??[]).map(e=>[e.id,e])),[g.data?.agents]),N=(0,V.useMemo)(()=>new Set(f.pinnedSessionKeys),[f.pinnedSessionKeys]),P=(0,V.useMemo)(()=>new Set(f.pinnedProjectRoots),[f.pinnedProjectRoots]),ee=(0,V.useMemo)(()=>bu(S),[S]),te=(0,V.useMemo)(()=>wu(S),[S]),ne=(0,V.useMemo)(()=>Su(ee,N),[N,ee]),re=(0,V.useMemo)(()=>Cu(ee,N,P,_.data?.projects??[]),[P,N,_.data?.projects,ee]),F=(0,V.useMemo)(()=>ju(p?.options??[]),[p?.options]),ie=(0,V.useMemo)(()=>Ou(p?.defaultType??`native`),[p?.defaultType]),ae=vd({defaultSessionType:ie,sessionTypeOptions:F}),oe=f.listMode===`project-first`,se=!t&&i,ce=mre(S,f.selectedSessionKey,n.chatSessionListManager.markSessionRead),{editingSessionKey:le,draftLabel:ue,savingSessionKey:de,setDraftLabel:fe,startEditingSessionLabel:pe,cancelEditingSessionLabel:me,saveSessionLabel:he}=r7(),ge=e=>{C!==e&&(w(e),window.location.reload())},_e=e=>(0,H.jsx)(lne,{item:e,selectedSessionKey:f.selectedSessionKey,optimisticReadAtBySessionKey:ce,agentsById:M,childSessionsByParentKey:te,editingSessionKey:le,draftLabel:ue,savingSessionKey:de,sessionTypeOptions:F,isPinned:N.has(e.session.key),sessionTitle:Tu,onSelectSession:n.chatSessionListManager.selectSession,onOpenChildSessions:(e,t)=>n.chatThreadManager.openChildSessionPanel({parentSessionKey:e,activeChildSessionKey:t}),onStartEditingSessionLabel:pe,onDraftLabelChange:fe,onSaveSessionLabel:he,onCancelEditingSessionLabel:me,onTogglePinned:()=>n.chatSessionListManager.toggleSessionPinned(e.session.key)},e.session.key),ve=(e,t)=>{n.chatSessionListManager.createSession({projectRoot:typeof t==`string`?t:void 0,sessionType:e})},ye=()=>{v.reset(),b.reset(),l(!0)},be=async e=>{await v.mutateAsync(e),l(!1)},xe=async e=>{await b.mutateAsync(e),l(!1)};return(0,H.jsxs)(`aside`,{className:c(`flex h-full min-h-0 flex-col bg-secondary transition-[width] duration-200 ease-out`,t?`flex-1 overflow-hidden`:se?c(w7,`shrink-0`):`w-[280px] shrink-0`),"data-sidebar-collapsed":se?`true`:`false`,children:[t?null:(0,H.jsx)(cre,{connectionStatus:h.connectionStatus,isCollapsed:se}),t?(0,H.jsx)(pne,{query:f.query,defaultSessionType:ae.selectedSessionType,sessionTypeOptions:F,selectedNewSessionType:ae.selectedSessionType,selectedNewSessionTypeOption:ae.selectedSessionTypeOption,isCreateMenuOpen:a,onCreateMenuOpenChange:o,onCreateSession:ve,onSelectNewSessionType:ae.setSelectedSessionType,onQueryChange:n.chatSessionListManager.setQuery}):(0,H.jsx)(fne,{query:f.query,defaultSessionType:ie,sessionTypeOptions:F,selectedNewSessionType:ae.selectedSessionType,selectedNewSessionTypeOption:ae.selectedSessionTypeOption,isCreateMenuOpen:a,onCreateMenuOpenChange:o,onCreateSession:ve,onSelectNewSessionType:ae.setSelectedSessionType,onQueryChange:n.chatSessionListManager.setQuery,collapsed:se}),t?null:(0,H.jsx)(lre,{isCollapsed:se}),(0,H.jsx)(ure,{defaultSessionType:ae.selectedSessionType,groups:ne,isCollapsed:se,isLoading:x,isProjectFirstView:oe,onAddProject:ye,onSelectMode:n.chatSessionListManager.setListMode,projectGroups:re,renderSessionItem:_e,sessionTypeOptions:F}),t?null:(0,H.jsx)(dre,{currentLanguage:C,currentLanguageLabel:k,currentTheme:E,currentThemeLabel:O,isCollapsed:se,isOpen:u,languageOptions:j,onOpenApps:()=>V$(r),onOpenChange:d,onOpenDocs:()=>r.open(void 0,{kind:`docs`,title:T(`docBrowserHelp`)}),onSelectLanguage:ge,onSelectTheme:D,themeOptions:A}),(0,H.jsx)(pre,{open:s,defaultWorkspacePath:_l(m?.agents.defaults.workspace),templates:_.data?.templates??[],isCreating:v.isPending,isAddingExisting:b.isPending,createErrorMessage:v.error?.message,addExistingErrorMessage:b.error?.message,onOpenChange:l,onCreate:be,onAddExisting:xe})]})}var u9=`sid_`,d9=`/chat/draft`,hre=d9.slice(6);function gre(e){let t=new TextEncoder().encode(e),n=``;for(let e of t)n+=String.fromCharCode(e);return`${u9}${btoa(n).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/g,``)}`}function _re(e){if(!e.startsWith(u9))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 f9(e){if(!e||e===hre)return null;let t=_re(e);if(t)return t;try{return decodeURIComponent(e)}catch{return e}}function p9(e){return`/chat/${gre(e)}`}function m9(e,t){let n=t.trim();return n?e.includes(n)?e.filter(e=>e!==n):[n,...e]:e}var vre=class{constructor(e){this.uiManager=e,this.syncDraftThreadState=e=>{let t=U.getState().snapshot.workspaceFileTabs.filter(e=>e.parentSessionKey!==null);U.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=du.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=du.getState().snapshot.selectedAgentId,n=this.resolveUpdateValue(t,e);n!==t&&du.getState().setSnapshot({selectedAgentId:n})},this.syncSelectedSessionAgent=()=>{let e=U.getState().snapshot.agentId?.trim();e&&this.setSelectedAgentId(e)},this.setSelectedSessionKey=e=>{e!==du.getState().snapshot.selectedSessionKey&&du.getState().setSnapshot({selectedSessionKey:e})},this.syncRouteSessionSelection=e=>{this.setSelectedSessionKey(e),e&&U.getState().setSnapshot({draftProjectRoot:null})},this.setListMode=e=>{let t=du.getState().snapshot.listMode,n=this.resolveUpdateValue(t,e);n!==t&&du.getState().setSnapshot({listMode:n})},this.toggleSessionPinned=e=>{let{pinnedSessionKeys:t}=du.getState().snapshot;du.getState().setSnapshot({pinnedSessionKeys:m9(t,e)})},this.toggleProjectPinned=e=>{let{pinnedProjectRoots:t}=du.getState().snapshot;du.getState().setSnapshot({pinnedProjectRoots:m9(t,e)})},this.toggleProjectCollapsed=e=>{let{collapsedProjectRoots:t}=du.getState().snapshot;du.getState().setSnapshot({collapsedProjectRoots:m9(t,e)})},this.markSessionRead=(e,t,n)=>{let r=e?.trim(),i=t?.trim();!r||!i||this.shouldPersistReadAt(r,i,n)&&(du.getState().markSessionRead(r,i),Oe(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=Ou(r??`native`),a=_l(t),o=n?.trim()||null;this.syncDraftThreadState(a),this.uiManager.navigateTo(d9,{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=du.getState().snapshot.query,n=this.resolveUpdateValue(t,e);n!==t&&du.getState().setSnapshot({query:n})}}},yre=async()=>!1,bre=class{constructor(e){this.docBrowserManager=e,this.state={pathname:``},this.actions={navigate:null,confirm:yre},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=()=>Us.getSnapshot().mode===`mobile`,this.resolvePanelAppEntry=async e=>{let t=e.trim();if(!t)return null;try{return VY((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(p$(r,a),{contentParams:i,title:n});return}let o=await this.resolvePanelAppEntry(r);if(o){this.docBrowserManager.openTarget({..._$(o),contentParams:i},{title:n});return}this.docBrowserManager.open(p$(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(p9(e),t)}}};function h9(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 xre(e,t){return JSON.stringify(h9(e))!==JSON.stringify(h9({...e,...t}))}var Sre=class{constructor(){this.syncSnapshot=e=>{let t=nd.getState();xre(t.snapshot,e)&&t.setSnapshot(e)}}};function g9(e,t,n){return e===t?n:e.startsWith(`${t}/`)||e.startsWith(`${t}\\`)?`${n}${e.slice(t.length)}`:null}function Cre(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=g9(e.path,n,r);if(!a)return e;let o=Gd(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 wre(e,t){let n=t.trim();if(!n)return null;let r=e,i=e.workspaceFileTabs.filter(e=>g9(e.path,n,n)!==null).map(e=>e.key);for(let e of i){let t=Xd(r,{kind:`file`,key:e});t&&(r={...r,...t})}return i.length>0?r:null}var Tre=class{constructor(e,t,n){this.uiManager=e,this.sessionListManager=t,this.onWorkspacePanelOpened=n,this.handledUiShowContentEventIds=new Set,this.hasSnapshotChanges=e=>{let t=U.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)&&U.getState().setSnapshot(e)},this.clearDeletedSessionState=()=>{U.getState().setSnapshot({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})},this.resolveWorkspaceParentSessionKey=()=>du.getState().snapshot.selectedSessionKey?.trim()||U.getState().snapshot.sessionKey?.trim()||(du.getState().snapshot.selectedSessionKey??null),this.activateWorkspaceFileTab=(e,t)=>{let{parentSessionKey:n}=e,{workspaceFileTabs:r}=U.getState().snapshot;this.setWorkspaceSelection({workspacePanelParentKey:n,activeWorkspacePanelKind:`file`,workspaceFileTabs:Wd(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}}=du.getState();t!==e&&this.uiManager.goToSession(e)},this.setWorkspaceSelection=(e,t)=>{let{snapshot:n}=U.getState(),r=Fd({entries:n.workspaceNavigationHistory,index:n.workspaceNavigationHistoryIndex},t,qd),i=e.workspacePanelParentKey&&e.workspacePanelParentKey!==n.workspacePanelParentKey?[]:n.closedWorkspaceTabEntries.filter(e=>!qd(e,t));U.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}=U.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:jd(e)})},this.setWorkspaceExplorerWidth=e=>{this.syncSnapshot({workspaceExplorerWidth:Md(e)})},this.renameWorkspacePath=e=>{let t=Cre(U.getState().snapshot,e);t&&this.syncSnapshot(t)},this.removeWorkspacePath=e=>{let t=wre(U.getState().snapshot,e);t&&U.getState().setSnapshot(t)},this.openChildSessions=e=>{this.openWorkspacePage(e,`child-sessions`)},this.openProjectFiles=e=>{this.openWorkspacePage(e,`project-files`)},this.materializeRootDraftSession=e=>{let t=e.trim();if(!t||!this.uiManager.isAtChatRoot())return;let n=$d(U.getState().snapshot,t);n&&(this.sessionListManager.syncRouteSessionSelection(t),U.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=Qd(U.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}):U.getState().setSnapshot(o),this.ensureWorkspaceParentRoute(i),this.onWorkspacePanelOpened?.()},this.openSideChatDraft=e=>{let t=e?.trim()||this.resolveWorkspaceParentSessionKey()?.trim();if(!t)return;let n=Zd(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=ef({snapshot:U.getState().snapshot,...e});t&&(U.getState().setSnapshot(t.patch),this.ensureWorkspaceParentRoute(t.parentSessionKey))},this.openFilePreview=e=>{let t=Ud(e,this.resolveWorkspaceParentSessionKey());t&&this.activateWorkspaceFileTab(t)},this.openWorkspaceFileViewer=(e,t)=>{let n=U.getState().snapshot.workspaceFileTabs.find(t=>t.key===e.trim());if(!n||n.viewMode!==`preview`)return;let r=t??Hd(n.path,n.previewViewer);if(!r)return;let i=Ud({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()||du.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}=U.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}=U.getState(),n=Xd(t,e);n&&U.getState().setSnapshot(n)},this.closeWorkspacePanel=()=>{U.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}=U.getState(),n=Id({entries:t.workspaceNavigationHistory,index:t.workspaceNavigationHistoryIndex},e);if(!n)return;let r=Yd(n.entry,t);r&&U.getState().setSnapshot({...r,workspaceNavigationHistory:[...n.history.entries],workspaceNavigationHistoryIndex:n.history.index})},this.goToParentSession=()=>{let{parentSessionKey:e,activeSideChatDraft:t,childSessionTabs:n,activeChildSessionKey:r}=U.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()=>{let{snapshot:{selectedSessionKey:e}}=du.getState();if(e&&await this.uiManager.confirm({title:T(`chatDeleteSessionConfirm`),variant:`destructive`,confirmLabel:T(`delete`)})){U.getState().setSnapshot({isDeletePending:!0});try{await ve(e),vn(Jt,e),Jt.removeQueries({queryKey:[`ncp-session-messages`,e]}),this.clearDeletedSessionState(),this.uiManager.goToChatRoot({replace:!0})}finally{U.getState().setSnapshot({isDeletePending:!1})}}}}},Ere=class{constructor(e){this.chatUiManager=new bre(e.docBrowserManager),this.chatSessionListManager=new vre(this.chatUiManager),this.chatQueryManager=new Sre,this.chatComposerIntentManager=e.chatComposerIntentManager,this.chatThreadManager=new Tre(this.chatUiManager,this.chatSessionListManager,e.notifyRightPanelOpened)}},Dre=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 _9(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 Ore=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:D,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:o,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:f,targetSessionKey:o,tokenKey:_9(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:o}=e,s=n.trim(),c=i.trim(),l=o.trim();!s||!c||!l||this.publish({kind:a,targetSessionKey:t,tokenKey:_9(s,`${s}:${l}`),messageId:s,role:r,label:c,excerpt:l})},this.requestUiResourceReference=e=>{let t=ne(e.reference);if(!t)return;let n=t.uri.trim(),r=t.title.trim();this.publish({kind:P,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)}}}},v9=120,kre=200;function Are(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<=v9?t:`${n.slice(0,v9-1).join(``)}…`}function jre(e){return Are(e.parts.filter(e=>e.type===`text`||e.type===`rich-text`).map(e=>e.text).join(` `))}var Mre=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(p.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!==IK.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`||kK(t)||(this.rememberHandledMessage(t.id),this.visibleSessionIds.has(n)))return;let r=this.resolveSessionTitle(n),i=jre(t);this.notificationManager.show({id:`chat-reply:${t.id}`,title:r,description:i||T(`chatBackgroundReplyFallbackPreview`),href:p9(n),ariaLabel:T(`chatBackgroundReplyOpenAriaLabel`).replace(`{title}`,r)})},this.resolveSessionTitle=e=>{let t=(nd.getState().snapshot.sessionsQuery?.data?.sessions??[]).find(t=>t.sessionId===e);return t?ol(Ql(t)):T(`chatBackgroundReplyFallbackTitle`)},this.rememberHandledMessage=e=>{if(this.handledMessageIds.add(e),this.handledMessageIds.size<=kre)return;let t=this.handledMessageIds.values().next().value;t&&this.handledMessageIds.delete(t)}}};function Nre(){return dn({queryKey:[`ncp-session-types`],queryFn:ft,staleTime:1e4,retry:!1})}var y9=`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)]`,b9=`flex min-h-[72px] min-w-0 flex-1 items-center gap-3 rounded-[inherit] py-3 pl-[18px] pr-[52px]`;function x9({title:e,description:t,iconSrc:n}){return(0,H.jsxs)(H.Fragment,{children:[(0,H.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,H.jsx)(`img`,{"aria-hidden":`true`,alt:``,src:n??`/logo.svg`,className:`h-full w-full object-contain`})}),(0,H.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,H.jsx)(`span`,{className:`block truncate text-[15px] font-semibold leading-5 tracking-[-0.01em]`,children:e}),t?(0,H.jsx)(`span`,{className:`mt-0.5 block truncate text-[14px] leading-5 text-muted-foreground`,children:t}):null]})]})}function S9({dismissLabel:e,onDismiss:t}){return(0,H.jsx)(B,{className:`absolute right-2.5 top-2.5 z-10`,icon:(0,H.jsx)(_i,{className:`h-4 w-4`,"aria-hidden":`true`}),label:e,onClick:t,size:`lg`,tooltipSide:`left`})}function Pre({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,H.jsxs)(`div`,{className:y9,children:[(0,H.jsx)(ce,{to:n,"aria-label":s,className:`${b9} focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-primary/50`,onClick:o,children:(0,H.jsx)(x9,{title:e,description:t,iconSrc:r})}),(0,H.jsx)(S9,{dismissLabel:a,onDismiss:o})]}):(0,H.jsxs)(`div`,{className:y9,children:[(0,H.jsx)(`div`,{role:`status`,"aria-label":s,className:b9,children:(0,H.jsx)(x9,{title:e,description:t,iconSrc:r})}),(0,H.jsx)(S9,{dismissLabel:a,onDismiss:o})]})}var Fre=8e3,Ire=class{constructor(){this.show=e=>L.custom(t=>(0,V.createElement)(Pre,{title:e.title,description:e.description,href:e.href,iconSrc:e.iconSrc,ariaLabel:e.ariaLabel,dismissLabel:e.dismissLabel??T(`notificationDismiss`),onDismiss:()=>{L.dismiss(t)}}),{id:e.id,duration:e.durationMs??Fre,unstyled:!0}),this.dismiss=e=>{L.dismiss(e)}}},Lre=`nextclaw://docs`,C9=`github-project`,Rre=`https://github.com/Peiiii/nextclaw`;function w9(){return[{builtIn:!0,icon:{type:`builtin`,name:`apps`},id:`apps`,label:T(`appsTitle`),removable:!1,target:{type:`right-panel-resource`,uri:n$}},{builtIn:!0,icon:{type:`builtin`,name:`docs`},id:`docs`,label:T(`docBrowserHelp`),removable:!1,target:{type:`right-panel-resource`,uri:Lre}},{builtIn:!0,icon:{type:`builtin`,name:`new-tab`},id:`new-tab`,label:T(`docBrowserHomeTitle`),removable:!1,target:{type:`right-panel-resource`,uri:e$}},{builtIn:!0,icon:{type:`builtin`,name:`github`},id:C9,label:T(`sideDockGitHubProject`),removable:!1,target:{type:`external-url`,url:Rre}}]}var zre=[`apps`,`docs`,`github`,`new-tab`,`panel-app`,`service-apps`];function T9(e){return!!e&&typeof e==`object`}function Bre(e){return zre.includes(e)}function Vre(e){return!T9(e)||typeof e.type!=`string`?null:e.type===`builtin`&&Bre(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 Hre(e){if(!T9(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||!T9(e.target)||e.target.type!==`right-panel-resource`||typeof e.target.uri!=`string`||e.target.uri.trim().length===0)return null;let t=Vre(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 E9(e){if(!Array.isArray(e))return[];let t=new Map;return e.forEach(e=>{let n=Hre(e);n&&t.set(n.id,n)}),Array.from(t.values())}function Ure(e,t){return{createdAt:t,icon:e.icon,id:e.id,label:e.label,target:e.target}}function Wre(e){return e.target.type===`right-panel-resource`?e.target.uri:null}function Gre(e){return{builtIn:!1,icon:e.icon,id:e.id,label:e.label,removable:!0,target:e.target}}function D9(e,t){let n=new Set(e.map(e=>e.id)),r=new Set(e.map(Wre).filter(e=>e!==null)),i=t.filter(e=>!n.has(e.id)&&!r.has(e.target.uri)).map(Gre);return[...e,...i]}var Kre=`nextclaw.side-dock.state`,qre=1;function O9(e){return!!e&&typeof e==`object`}var k9=N()(yi(e=>({isVisible:!0,pinnedItems:[],setVisible:t=>e({isVisible:t}),setPinnedItems:t=>e({pinnedItems:E9(t)})}),{name:Kre,version:qre,storage:bi(()=>window.localStorage),partialize:e=>({isVisible:e.isVisible,pinnedItems:e.pinnedItems}),merge:(e,t)=>{let n=O9(e)?E9(e.pinnedItems):[],r=O9(e)&&typeof e.isVisible==`boolean`?e.isVisible:!0;return{...t,isVisible:r,pinnedItems:n}}})),Jre={apps:Jr,docs:pi,github:ci,"new-tab":hi,"panel-app":Gr,"service-apps":Gr},Yre=new Set([C9]),Xre=/^\p{Extended_Pictographic}(?:\uFE0F|\uFE0E)?(?:\u200D\p{Extended_Pictographic}(?:\uFE0F|\uFE0E)?)*$/u;function Zre(e){return Xre.test(e.trim())}function Qre({icon:e}){if(e.type===`url`)return(0,H.jsx)(`img`,{src:e.url,alt:``,className:`h-5 w-5 rounded object-cover`});if(e.type===`text`)return Zre(e.value)?(0,H.jsx)(`span`,{className:`flex h-7 w-7 items-center justify-center text-[20px] leading-none`,"aria-hidden":`true`,children:e.value}):(0,H.jsx)(`span`,{className:`max-w-7 truncate text-center text-[13px] font-semibold leading-none`,"aria-hidden":`true`,children:e.value});let t=Jre[e.name];return(0,H.jsx)(t,{className:`h-5 w-5`,"aria-hidden":`true`})}function A9({active:e,item:t,onOpen:n,onUnpin:r}){let{label:i}=t;return(0,H.jsxs)(oi,{children:[(0,H.jsxs)(`div`,{className:`group relative`,children:[(0,H.jsx)(si,{asChild:!0,children:(0,H.jsx)(`button`,{type:`button`,"aria-label":i,title:i,"data-side-dock-item-id":t.id,onClick:()=>n(t),className:c(`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,H.jsx)(Qre,{icon:t.icon})})}),t.removable?(0,H.jsx)(`button`,{type:`button`,"aria-label":T(`sideDockUnpinItem`),title:T(`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,H.jsx)(_i,{className:`h-3 w-3`,"aria-hidden":`true`})}):null]}),(0,H.jsx)(Yr,{side:`left`,children:i})]})}function $re({icon:e,label:t,onClick:n}){return(0,H.jsxs)(oi,{children:[(0,H.jsx)(si,{asChild:!0,children:(0,H.jsx)(`button`,{type:`button`,"aria-label":t,title:t,"data-side-dock-action":`hide`,onClick:n,className:c(`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,H.jsx)(e,{className:`h-5 w-5`,"aria-hidden":`true`})})}),(0,H.jsx)(Yr,{side:`left`,children:t})]})}function j9(e){return e?.trim()??``}function M9(e){return e.target.type===`right-panel-resource`?e.target.uri:null}function N9(e,t,n,r=!1){if(!t||!n)return!1;let i=j9(M9(e)??void 0);if(!i)return!1;let a=j9(n.resourceUri);return a&&a===i||j9(n.currentUrl)===i?!0:r?!1:e.id===`docs`&&n.kind===`docs`}function eie(e,t){if(!t)return!1;let n=j9(t.resourceUri),r=j9(t.currentUrl);return e.some(e=>{let t=j9(M9(e)??void 0);return t===n||t===r})}function P9(e){return Yre.has(e.id)}function tie({manager:e}){let t=k9(e=>e.pinnedItems),n=k9(e=>e.setVisible),{currentTab:r,isOpen:i}=ki(),{confirm:a,ConfirmDialog:o}=An(),s=D9(w9(),t),c=s.filter(e=>!P9(e)),l=s.filter(P9),u=eie(s,r),d=async()=>{await a({title:T(`sideDockHideConfirmTitle`),description:T(`sideDockHideConfirmDescription`),confirmLabel:T(`sideDockHideConfirmAction`),cancelLabel:T(`cancel`)})&&n(!1)};return(0,H.jsx)(ti,{delayDuration:250,children:(0,H.jsxs)(`aside`,{"data-testid":`side-dock`,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,H.jsx)(`div`,{className:`flex w-full flex-col items-center gap-1`,children:c.map(t=>(0,H.jsx)(A9,{active:N9(t,i,r,u),item:t,onOpen:e.openItem,onUnpin:t=>e.unpinItem(t.id)},t.id))}),l.length>0?(0,H.jsxs)(`div`,{"data-testid":`side-dock-utility`,className:`mt-auto flex w-full flex-col items-center gap-1`,children:[l.map(t=>(0,H.jsx)(A9,{active:N9(t,i,r,u),item:t,onOpen:e.openItem,onUnpin:t=>e.unpinItem(t.id)},t.id)),(0,H.jsx)($re,{icon:To,label:T(`sideDockHide`),onClick:()=>{d()}})]}):null,(0,H.jsx)(o,{})]})})}var nie=`pinned`,rie=new Set([`apps`,`docs`,`github`,`new-tab`,`panel-app`,`service-apps`]);function F9(e){return e.trim()}function iie(e){let t=0;return Array.from(F9(e)).forEach(e=>{t=t*31+e.charCodeAt(0)>>>0}),`${nie}-${F9(e).replace(/[^a-zA-Z0-9]+/g,`-`).replace(/^-+|-+$/g,``).toLowerCase()||`resource`}-${t.toString(36)}`}function aie(e){return e?.type===`builtin`&&rie.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 oie(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 sie=class{constructor(e){this.docBrowserManager=e,this.getItems=()=>D9(w9(),k9.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 vi.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:aie(e.dockIcon)??{type:`builtin`,name:oie(e)},id:iie(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=F9(e.target.uri),r={...e,target:{type:`right-panel-resource`,uri:n}};this.setPinnedItems(i=>i.some(t=>t.id===e.id||F9(t.target.uri)===n)?i:[...i,Ure(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}=k9.getState();n(e(t))},this.getTabResourceUri=e=>{let t=e?.resourceUri??e?.currentUrl,n=t?F9(t):``;return n.length>0?n:null},this.findItemByUri=e=>{let t=F9(e);return this.getItems().find(e=>e.target.type===`right-panel-resource`&&F9(e.target.uri)===t)}}},cie=new class{constructor(){this.resolveOpenTarget=e=>{let{activeTab:t,kind:n,url:r}=e,i=n??(r?void 0:t?.kind)??(r&&Ti(r)?`docs`:`home`),a=r?.trim()||(!n&&t&&t.kind!==`docs`?t.currentUrl:i===`home`?`nextclaw://new-tab`:i===`docs`?ji():`about:blank`),o=i===`docs`?Ii(a,`docs`):a;return{historyPolicy:`managed`,kind:i,title:i===`home`?T(`docBrowserHomeTitle`):Ei(o,i,i===`docs`?T(`docBrowserHelp`):`Detail`),url:o}},this.areUrlsEquivalent=(e,t,n,r)=>n===r?n===`docs`?Si(e)===Si(t):e===t:!1,this.usesManagedHistory=e=>e.currentUrl!==Fi}};function I9(e,t,n){return{...e,tabs:e.tabs.map(e=>e.id===t?n(e):e)}}function L9(e,t){return I9(e,e.activeTabId,t)}function lie(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 R9(e,t){return{kind:t.kind,resourceUri:t.resourceUri??t.url,tabId:e,url:t.url}}function z9(e,t,n){let r=Fd({entries:t.activeHistory,index:t.activeHistoryIndex},n,(t,n)=>lie(e,t,n));return{...t,activeHistory:[...r.entries],activeHistoryIndex:r.index}}function uie(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 B9(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=uie(e,r,a.url),s=n.resourceUri!==void 0&&n.resourceUri===r.resourceUri;return I9({...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 die(e,t){return!e.isOpen&&e.tabs.length===1&&t?.kind===`home`&&t.currentUrl===`nextclaw://new-tab`}function V9(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=I9(t,u.id,t=>Oi(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?z9(e,l,R9(u.id,n)):l}if(o||c||!l||l.kind!==n.kind){let i=Ni(n.url,n.kind,s??n.title,c,n.resourceUri??n.url,r?.dockIcon??n.dockIcon,n.contentParams);return die(t,l)?{...t,isOpen:!0,tabs:[i],activeTabId:i.id,activeHistory:[Ai(i)],activeHistoryIndex:0}:z9(e,{...t,isOpen:!0,tabs:[...t.tabs,i],activeTabId:i.id},Ai(i))}return z9(e,{...L9(t,t=>Oi(e,t,n,r,c)),isOpen:!0},R9(t.activeTabId,n))}function fie(e,t,n,r){let i=t.tabs.find(e=>e.id===t.activeTabId)??t.tabs[0];return V9(e,t,{...e.resolveOpenTarget({activeTab:i,kind:r?.kind,url:n}),contentParams:r?.contentParams},r)}var pie=class{constructor(e=cie,t){this.routeResolver=e,this.onRightPanelOpened=t,this.setSnapshot=e=>{Mi.getState().setSnapshot(e)},this.open=(e,t)=>{this.setSnapshot(n=>fie(this.routeResolver,n,e,t)),this.onRightPanelOpened?.()},this.openTarget=(e,t)=>{this.setSnapshot(n=>V9(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:wi,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:Ci(e)}))},this.navigate=e=>{this.setSnapshot(t=>{if(!t.tabs.length){let e=Ni(ji(),`docs`,`Docs`);return{...t,tabs:[e],activeTabId:e.id,isOpen:!0}}let n=L9(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,...Di(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?z9(this.routeResolver,n,Ai(r)):n})},this.syncUrl=e=>{this.setSnapshot(t=>{if(!t.tabs.length){let e=Ni(ji(),`docs`,`Docs`);return{...t,tabs:[e],activeTabId:e.id}}let n=L9(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,...Di(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?z9(this.routeResolver,n,Ai(r)):n})},this.goBack=()=>{this.setSnapshot(e=>{let t=Id({entries:e.activeHistory,index:e.activeHistoryIndex},`back`);return t?B9(this.routeResolver,{...e,activeHistory:[...t.history.entries],activeHistoryIndex:t.history.index},t.entry):e})},this.goForward=()=>{this.setSnapshot(e=>{let t=Id({entries:e.activeHistory,index:e.activeHistoryIndex},`forward`);return t?B9(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{...tee(),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=Ld({entries:a.activeHistory,index:a.activeHistoryIndex},t=>t.tabId!==e,Ai(o)),c={...a,activeHistory:[...s.entries],activeHistoryIndex:s.index};return t.activeTabId===e?z9(this.routeResolver,c,Ai(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?z9(this.routeResolver,{...t,activeTabId:e,isOpen:!0},Ai(n)):t})}}};function mie(e){return e.activeWorkspacePanelKind!=null}var hie=class{constructor(){this.notificationManager=new Ire,this.inboxManager=new Ane,this.chatCompletionNotificationManager=new Mre(this.notificationManager),this.accountManager=new Is,this.rightPanelResourceRouteResolver=new P$,this.notifyRightPanelOpened=()=>{let e=Mi.getState().snapshot,t=U.getState().snapshot;Us.collapseSidebarForDenseRightPanels({isDocBrowserDocked:e.mode===`docked`,isDocBrowserOpen:e.isOpen,isWorkspacePanelOpen:mie(t)})},this.docBrowserManager=new pie(this.rightPanelResourceRouteResolver,this.notifyRightPanelOpened),this.appPackageOperationSettlementManager=new qQ(this.docBrowserManager),this.sideDockManager=new sie(this.docBrowserManager),this.chatComposerIntentManager=new Ore,this.chatDraftIntentManager=new Dre,this.serviceActionAuthorizationManager=new wQ,this.panelAppBridgeManager=new zY(this.serviceActionAuthorizationManager),this.remoteAccessManager=new vs({accountManager:this.accountManager})}},H9=null;function U9(){return H9??=new hie,H9}function W9(){return U9()}var G9=globalThis,K9=G9.__NEXTCLAW_APP_PRESENTER_CONTEXT__??(0,V.createContext)(null);G9.__NEXTCLAW_APP_PRESENTER_CONTEXT__=K9;function gie({children:e}){let t=(0,V.useMemo)(()=>U9(),[]);return(0,H.jsx)(K9.Provider,{value:t,children:e})}function q9(){let e=(0,V.useContext)(K9);if(!e)throw Error(`useAppPresenter must be used inside AppPresenterProvider`);return e}function _ie(){let e=q9();return(0,V.useEffect)(()=>(e.chatCompletionNotificationManager.start(),()=>{e.chatCompletionNotificationManager.stop()}),[e.chatCompletionNotificationManager]),null}var vie=`NextClaw`,yie=[{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 bie(e,t){return e===t||e.startsWith(`${t}/`)}function xie(e){let t=e.toLowerCase();for(let{prefix:e,key:n}of yie)if(bie(t,e))return T(n);return T(`settings`)}function Sie(e){let t=e.toLowerCase();return t===`localhost`||t.endsWith(`.localhost`)||t===`::1`||t===`[::1]`||t.startsWith(`127.`)}function Cie(e){let t=e?.host.trim(),n=e?.hostname.trim(),r=e?.port.trim();return!t||!n?null:Sie(n)?r||null:t}function wie(e,t){let n=Cie(t);return`${vie}${n?` ${n}`:``} - ${xie(e)}`}var J9={...H$,...In};function Tie({children:e,sideDockManager:t}){let{isOpen:n,mode:r}=ki();Pn();let{pathname:i}=he(),a=oe(),o=W9(),{language:s}=Nn(),{isMobile:c}=c6(),l=a9(),u=k9(e=>e.isVisible);k9(e=>e.pinnedItems);let d={getDockState:t.getDockState,pinTab:t.pinTab,unpinTab:t.unpinTab},f=(0,V.useCallback)(e=>{let t=s$(e);if(t)return[{key:`chat`,items:[{key:`add-to-chat`,icon:(0,H.jsx)(uo,{className:`h-4 w-4`}),label:T(`docBrowserAddToChat`),restoreFocus:!1,onSelect:()=>{let e=i===`/chat`||i.startsWith(`/chat/`),n=i===`/chat`?null:f9(i.slice(6));o.chatComposerIntentManager.requestUiResourceReference({targetSessionKey:e?n:null,reference:t}),e||a(d9)}}]}]},[a,i,o]);return(0,V.useEffect)(()=>{document.title=wie(i,window.location)},[i,s]),c&&l!==`win32`?(0,H.jsx)(nre,{pathname:i,isDocBrowserOpen:n,docBrowserDockControls:d,docBrowserRenderers:J9,docBrowserTabMenuGroups:f,topbarLeadingInset:l===`darwin`?`4.75rem`:void 0,children:e}):(0,H.jsx)(are,{pathname:i,isMobileLayout:c,isDocBrowserOpen:n,docBrowserMode:r,docBrowserDockControls:d,docBrowserRenderers:J9,docBrowserTabMenuGroups:f,sideDock:u?(0,H.jsx)(tie,{manager:t}):null,children:e})}function Eie({children:e}){let t=W9();return(0,H.jsx)(Pi,{manager:t.docBrowserManager,children:(0,H.jsx)(Tie,{sideDockManager:t.sideDockManager,children:e})})}function Die(){let{isMobile:e}=c6();return e?(0,H.jsx)(rre,{}):(0,H.jsx)(pe,{to:`/model`,replace:!0})}function Oie(e){let t=e.trim().toLowerCase();return t?!t.startsWith(`skills`):!0}function kie(e,t){t.startsWith(`mcp`)&&(e?.invalidateQueries({queryKey:[`marketplace-mcp-installed`]}),e?.invalidateQueries({queryKey:[`marketplace-mcp-items`]}),e?.invalidateQueries({queryKey:[`marketplace-mcp-doctor`]}))}function Aie(e,t){e&&Oie(t)&&e.invalidateQueries({queryKey:[`config`]}),kie(e,t)}function Y9(e){let t=e.trim().replace(/\\/g,`/`).replace(/\/+$/g,``);return/^[a-z]:/i.test(t)?t.toLowerCase():t}function jie(e,t){if(!e)return;let n=Y9(t);e.invalidateQueries({predicate:e=>e.queryKey[0]===`server-path-browse`&&typeof e.queryKey[1]==`string`&&Y9(e.queryKey[1])===n})}function Mie(e){let t=(0,V.useRef)(!1);(0,V.useEffect)(()=>{let n=I.eventBus.on(p.connectionOpen,()=>{Ae.handleConnectionRestored(),Cn.refreshAfterRealtimeReconnect(),t.current&&(t.current=!1,e?.invalidateQueries({queryKey:[`ncp-sessions`]}))}),r=I.eventBus.on(p.connectionClose,()=>{Ae.handleConnectionInterrupted(null),t.current=!0}),i=I.eventBus.on(p.connectionError,e=>{Ae.handleConnectionInterrupted(e?.message??null),t.current=!0}),a=I.eventBus.on(p.configUpdated,({path:t})=>{Aie(e,t)}),o=I.eventBus.on(p.serverPathChanged,({directoryPath:t})=>jie(e,t)),s=I.eventBus.on(p.runtimeUpdateSnapshot,e=>{Cn.reportSnapshot(e)}),c=I.eventBus.on(p.sessionRunStatus,t=>{pt(e,{type:`session.run-status`,payload:t})}),l=I.eventBus.on(p.sessionSummaryUpsert,t=>{pt(e,{type:`session.summary.upsert`,payload:t})}),u=I.eventBus.on(p.sessionSummaryDelete,t=>{pt(e,{type:`session.summary.delete`,payload:t})}),d=I.eventBus.on(p.error,e=>{console.error(`Realtime transport error:`,e.message)});return()=>{n(),r(),i(),a(),o(),s(),c(),l(),u(),d()}},[e])}var X9={"--width":`320px`},Nie=(0,V.lazy)(async()=>({default:(await F(async()=>{let{ModelConfigPage:e}=await import(`./model-config-page-B7QR33ED.js`);return{ModelConfigPage:e}},__vite__mapDeps([39,4,40,28,31,27,41,42,32,1,33,43,37,38,44,45,46]))).ModelConfigPage})),Pie=(0,V.lazy)(async()=>({default:(await F(async()=>{let{AppearanceSettingsPage:e}=await import(`./appearance-settings-page-2ilQwMl0.js`);return{AppearanceSettingsPage:e}},__vite__mapDeps([47,4,42,27,28,40,48,49,29,36,26,30,31,32,1,33,34,35,37,38,43,50,45]))).AppearanceSettingsPage})),Z9=(0,V.lazy)(async()=>({default:(await F(async()=>{let{ChatPage:e}=await import(`./chat-page-DDR-Q4Kf.js`);return{ChatPage:e}},__vite__mapDeps([51,4,27,28,42,49,29,40,36,48,26,30,31,32,1,33,34,35,37,38,43,50,45,41,52]))).ChatPage})),Fie=(0,V.lazy)(async()=>({default:(await F(async()=>{let{SearchConfigPage:e}=await import(`./search-config-page-QS-kqNDZ.js`);return{SearchConfigPage:e}},__vite__mapDeps([53,4,42,27,28,40,30,32,1,33,54,44]))).SearchConfigPage})),Iie=(0,V.lazy)(async()=>({default:(await F(async()=>{let{ProvidersConfigPage:e}=await import(`./providers-config-page-B5yakiZe.js`);return{ProvidersConfigPage:e}},__vite__mapDeps([55,4,27,28,42,49,29,40,36,30,43,34,35,52,54,44,46,33]))).ProvidersConfigPage})),Lie=(0,V.lazy)(async()=>({default:(await F(async()=>{let{ChannelsList:e}=await import(`./channels-list-page-BPy2mXoD.js`);return{ChannelsList:e}},__vite__mapDeps([56,4,27,28,42,40,30,31,32,1,33,43,36,54,50,44,46]))).ChannelsList})),Rie=(0,V.lazy)(async()=>({default:(await F(async()=>{let{RuntimeConfig:e}=await import(`./runtime-config-page-Big45YWb.js`);return{RuntimeConfig:e}},__vite__mapDeps([57,4,42,27,28,40,48,49,29,36,26,30,31,32,1,33,34,35,37,38,43,50,45,58,59,44]))).RuntimeConfig})),zie=(0,V.lazy)(async()=>({default:(await F(async()=>{let{DesktopUpdateConfig:e}=await import(`./desktop-update-config-Ds4pN7kz.js`);return{DesktopUpdateConfig:e}},__vite__mapDeps([60,42,4,27,28,40,32,1,33,35,58]))).DesktopUpdateConfig})),Bie=(0,V.lazy)(async()=>({default:(await F(async()=>{let{SecurityConfig:e}=await import(`./security-config-Ds_2SXBh.js`);return{SecurityConfig:e}},__vite__mapDeps([61,40,4,28]))).SecurityConfig})),Vie=(0,V.lazy)(async()=>({default:(await F(async()=>{let{SecretsConfigPage:e}=await import(`./secrets-config-page-DE3kmDHk.js`);return{SecretsConfigPage:e}},__vite__mapDeps([62,4,42,27,28,40,34,59,44]))).SecretsConfigPage})),Hie=(0,V.lazy)(async()=>({default:(await F(async()=>{let{RemoteAccessPage:e}=await import(`./remote-BfRYDhkz.js`);return{RemoteAccessPage:e}},[])).RemoteAccessPage})),Uie=(0,V.lazy)(async()=>({default:(await F(async()=>{let{McpMarketplacePage:e}=await import(`./mcp-marketplace-page-q6T-vKoH.js`);return{McpMarketplacePage:e}},__vite__mapDeps([63,48,4,27,28,42,49,29,40,36,26,30,31,32,1,33,34,35,37,38,43,50,45]))).McpMarketplacePage}));function Wie(){return(0,H.jsx)(`div`,{className:`h-full w-full animate-pulse rounded-2xl border border-border/40 bg-card/40`})}function Gie({children:e}){return(0,H.jsx)(V.Suspense,{fallback:(0,H.jsx)(Wie,{}),children:e})}function Q9(e){return(0,H.jsx)(Gie,{children:e})}var Kie=[{path:`/chat/skills`,redirectTo:`/skills`},{path:`/chat/cron`,redirectTo:`/cron`},{path:`/chat/agents`,redirectTo:`/agents`},{path:`/chat/:sessionId?`,element:Q9((0,H.jsx)(Z9,{view:`chat`}))},{path:`/agents`,element:Q9((0,H.jsx)(Z9,{view:`agents`}))},{path:`/skills`,element:Q9((0,H.jsx)(Z9,{view:`skills`}))},{path:`/skills/scenes/:scene`,element:Q9((0,H.jsx)(Z9,{view:`skills`}))},{path:`/cron`,element:Q9((0,H.jsx)(Z9,{view:`cron`}))},{path:`/inbox/:deliveryId?`,element:Q9((0,H.jsx)(Z9,{view:`inbox`}))},{path:`/appearance`,element:Q9((0,H.jsx)(Pie,{}))},{path:`/model`,element:Q9((0,H.jsx)(Nie,{}))},{path:`/search`,element:Q9((0,H.jsx)(Fie,{}))},{path:`/providers`,element:Q9((0,H.jsx)(Iie,{}))},{path:`/channels`,element:Q9((0,H.jsx)(Lie,{}))},{path:`/runtime`,element:Q9((0,H.jsx)(Rie,{}))},{path:`/updates`,element:Q9((0,H.jsx)(zie,{}))},{path:`/remote`,element:Q9((0,H.jsx)(Hie,{}))},{path:`/security`,element:Q9((0,H.jsx)(Bie,{}))},{path:`/secrets`,element:Q9((0,H.jsx)(Vie,{}))},{path:`/settings`,element:(0,H.jsx)(Die,{})},{path:`/marketplace/skills`,redirectTo:`/skills`},{path:`/marketplace`,redirectTo:`/skills`},{path:`/marketplace/mcp`,element:Q9((0,H.jsx)(Uie,{}))},{path:`/`,redirectTo:`/chat`},{path:`*`,redirectTo:`/chat`}];function qie(e){return`redirectTo`in e?(0,H.jsx)(ae,{path:e.path,element:(0,H.jsx)(pe,{to:e.redirectTo,replace:!0})},e.path):(0,H.jsx)(ae,{path:e.path,element:e.element},e.path)}function Jie(){return(0,H.jsx)(le,{children:Kie.map(qie)})}function $9(){return Mie(Jt),tt(),(0,V.useEffect)(()=>(Cn.start(),()=>{Cn.stop()}),[]),(0,H.jsxs)(gie,{children:[(0,H.jsx)(_ie,{}),(0,H.jsx)(Nne,{}),(0,H.jsx)(Eie,{children:(0,H.jsx)(Jie,{})}),(0,H.jsx)(Os,{}),(0,H.jsx)(xQ,{})]})}function Yie(){let e=Ft(),t=e.isError&&be(e.error);return e.isLoading&&!e.isError||t||e.isError?(0,H.jsx)($9,{}):e.data?.enabled&&!e.data.authenticated?(0,H.jsx)(Fs,{username:e.data.username}):(0,H.jsx)($9,{})}function Xie(){return(0,V.useEffect)(()=>{nne()},[]),(0,H.jsxs)(mt,{client:Jt,children:[(0,H.jsx)(Yie,{}),(0,H.jsx)(ene,{}),(0,H.jsx)(an,{position:`top-right`,richColors:!0,offset:{top:window.nextclawDesktop?.platform===`win32`?56:44,right:72},mobileOffset:window.nextclawDesktop?.platform===`win32`?56:void 0,style:X9})]})}var Zie=window.nextclawDesktop?.platform===`win32`?ie:fe;(0,rs.createRoot)(document.getElementById(`root`)).render((0,H.jsx)(V.StrictMode,{children:(0,H.jsx)(ane,{children:(0,H.jsx)(Fn,{children:(0,H.jsx)(Zie,{children:(0,H.jsx)(Xie,{})})})})}));export{_f as $,C3 as A,ms as At,V4 as B,Oo as Bt,j3 as C,Cs as Ct,h3 as D,ls as Dt,g3 as E,_s as Et,y3 as F,Yo as Ft,N4 as G,Ga as Gt,R4 as H,lo as Ht,A3 as I,Wo as It,jY as J,oa as Jt,e1 as K,Ea as Kt,k4 as L,Lo as Lt,v3 as M,cs as Mt,b3 as N,os as Nt,m3 as O,fs as Ot,k3 as P,as as Pt,hf as Q,U4 as R,Fo as Rt,w3 as S,js as St,E3 as T,vs as Tt,I4 as U,Qa as Ut,H4 as V,mo as Vt,F4 as W,Ya as Wt,MY as X,Xi as Xt,PY as Y,$i as Yt,NY as Z,f3 as _,Cc as _t,f9 as a,ju as at,x3 as b,Ms as bt,Hne as c,Au as ct,S7 as d,rl as dt,gf as et,$te as f,il as ft,c6 as g,Ec as gt,F5 as h,Oc as ht,Ere as i,Pu as it,O3 as j,gs as jt,T3 as k,ps as kt,Z7 as l,mu as lt,n7 as m,Dc as mt,k9 as n,U as nt,l9 as o,Ou as ot,c7 as p,Tc as pt,DZ as q,wa as qt,Nre as r,qu as rt,ire as s,ku as st,q9 as t,mf as tt,Lne as u,pu as ut,p3 as v,ks as vt,D3 as w,Ss as wt,S3 as x,As as xt,_3 as y,Ns as yt,P4 as z,ko as zt};
|
|
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<=v9?t:`${n.slice(0,v9-1).join(``)}…`}function jre(e){return Are(e.parts.filter(e=>e.type===`text`||e.type===`rich-text`).map(e=>e.text).join(` `))}var Mre=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(p.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!==IK.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`||kK(t)||(this.rememberHandledMessage(t.id),this.visibleSessionIds.has(n)))return;let r=this.resolveSessionTitle(n),i=jre(t);this.notificationManager.show({id:`chat-reply:${t.id}`,title:r,description:i||T(`chatBackgroundReplyFallbackPreview`),href:p9(n),ariaLabel:T(`chatBackgroundReplyOpenAriaLabel`).replace(`{title}`,r)})},this.resolveSessionTitle=e=>{let t=(nd.getState().snapshot.sessionsQuery?.data?.sessions??[]).find(t=>t.sessionId===e);return t?ol(Ql(t)):T(`chatBackgroundReplyFallbackTitle`)},this.rememberHandledMessage=e=>{if(this.handledMessageIds.add(e),this.handledMessageIds.size<=kre)return;let t=this.handledMessageIds.values().next().value;t&&this.handledMessageIds.delete(t)}}};function Nre(){return dn({queryKey:[`ncp-session-types`],queryFn:ft,staleTime:1e4,retry:!1})}var y9=`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)]`,b9=`flex min-h-[72px] min-w-0 flex-1 items-center gap-3 rounded-[inherit] py-3 pl-[18px] pr-[52px]`;function x9({title:e,description:t,iconSrc:n}){return(0,H.jsxs)(H.Fragment,{children:[(0,H.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,H.jsx)(`img`,{"aria-hidden":`true`,alt:``,src:n??`/logo.svg`,className:`h-full w-full object-contain`})}),(0,H.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,H.jsx)(`span`,{className:`block truncate text-[15px] font-semibold leading-5 tracking-[-0.01em]`,children:e}),t?(0,H.jsx)(`span`,{className:`mt-0.5 block truncate text-[14px] leading-5 text-muted-foreground`,children:t}):null]})]})}function S9({dismissLabel:e,onDismiss:t}){return(0,H.jsx)(B,{className:`absolute right-2.5 top-2.5 z-10`,icon:(0,H.jsx)(_i,{className:`h-4 w-4`,"aria-hidden":`true`}),label:e,onClick:t,size:`lg`,tooltipSide:`left`})}function Pre({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,H.jsxs)(`div`,{className:y9,children:[(0,H.jsx)(ce,{to:n,"aria-label":s,className:`${b9} focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-primary/50`,onClick:o,children:(0,H.jsx)(x9,{title:e,description:t,iconSrc:r})}),(0,H.jsx)(S9,{dismissLabel:a,onDismiss:o})]}):(0,H.jsxs)(`div`,{className:y9,children:[(0,H.jsx)(`div`,{role:`status`,"aria-label":s,className:b9,children:(0,H.jsx)(x9,{title:e,description:t,iconSrc:r})}),(0,H.jsx)(S9,{dismissLabel:a,onDismiss:o})]})}var Fre=8e3,Ire=class{constructor(){this.show=e=>L.custom(t=>(0,V.createElement)(Pre,{title:e.title,description:e.description,href:e.href,iconSrc:e.iconSrc,ariaLabel:e.ariaLabel,dismissLabel:e.dismissLabel??T(`notificationDismiss`),onDismiss:()=>{L.dismiss(t)}}),{id:e.id,duration:e.durationMs??Fre,unstyled:!0}),this.dismiss=e=>{L.dismiss(e)}}},Lre=`nextclaw://docs`,C9=`github-project`,Rre=`https://github.com/Peiiii/nextclaw`;function w9(){return[{builtIn:!0,icon:{type:`builtin`,name:`apps`},id:`apps`,label:T(`appsTitle`),removable:!1,target:{type:`right-panel-resource`,uri:n$}},{builtIn:!0,icon:{type:`builtin`,name:`docs`},id:`docs`,label:T(`docBrowserHelp`),removable:!1,target:{type:`right-panel-resource`,uri:Lre}},{builtIn:!0,icon:{type:`builtin`,name:`new-tab`},id:`new-tab`,label:T(`docBrowserHomeTitle`),removable:!1,target:{type:`right-panel-resource`,uri:e$}},{builtIn:!0,icon:{type:`builtin`,name:`github`},id:C9,label:T(`sideDockGitHubProject`),removable:!1,target:{type:`external-url`,url:Rre}}]}var zre=[`apps`,`docs`,`github`,`new-tab`,`panel-app`,`service-apps`];function T9(e){return!!e&&typeof e==`object`}function Bre(e){return zre.includes(e)}function Vre(e){return!T9(e)||typeof e.type!=`string`?null:e.type===`builtin`&&Bre(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 Hre(e){if(!T9(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||!T9(e.target)||e.target.type!==`right-panel-resource`||typeof e.target.uri!=`string`||e.target.uri.trim().length===0)return null;let t=Vre(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 E9(e){if(!Array.isArray(e))return[];let t=new Map;return e.forEach(e=>{let n=Hre(e);n&&t.set(n.id,n)}),Array.from(t.values())}function Ure(e,t){return{createdAt:t,icon:e.icon,id:e.id,label:e.label,target:e.target}}function Wre(e){return e.target.type===`right-panel-resource`?e.target.uri:null}function Gre(e){return{builtIn:!1,icon:e.icon,id:e.id,label:e.label,removable:!0,target:e.target}}function D9(e,t){let n=new Set(e.map(e=>e.id)),r=new Set(e.map(Wre).filter(e=>e!==null)),i=t.filter(e=>!n.has(e.id)&&!r.has(e.target.uri)).map(Gre);return[...e,...i]}var Kre=`nextclaw.side-dock.state`,qre=1;function O9(e){return!!e&&typeof e==`object`}var k9=N()(yi(e=>({isVisible:!0,pinnedItems:[],setVisible:t=>e({isVisible:t}),setPinnedItems:t=>e({pinnedItems:E9(t)})}),{name:Kre,version:qre,storage:bi(()=>window.localStorage),partialize:e=>({isVisible:e.isVisible,pinnedItems:e.pinnedItems}),merge:(e,t)=>{let n=O9(e)?E9(e.pinnedItems):[],r=O9(e)&&typeof e.isVisible==`boolean`?e.isVisible:!0;return{...t,isVisible:r,pinnedItems:n}}})),Jre={apps:Jr,docs:pi,github:ci,"new-tab":hi,"panel-app":Gr,"service-apps":Gr},Yre=new Set([C9]),Xre=/^\p{Extended_Pictographic}(?:\uFE0F|\uFE0E)?(?:\u200D\p{Extended_Pictographic}(?:\uFE0F|\uFE0E)?)*$/u;function Zre(e){return Xre.test(e.trim())}function Qre({icon:e}){if(e.type===`url`)return(0,H.jsx)(`img`,{src:e.url,alt:``,className:`h-5 w-5 rounded object-cover`});if(e.type===`text`)return Zre(e.value)?(0,H.jsx)(`span`,{className:`flex h-7 w-7 items-center justify-center text-[20px] leading-none`,"aria-hidden":`true`,children:e.value}):(0,H.jsx)(`span`,{className:`max-w-7 truncate text-center text-[13px] font-semibold leading-none`,"aria-hidden":`true`,children:e.value});let t=Jre[e.name];return(0,H.jsx)(t,{className:`h-5 w-5`,"aria-hidden":`true`})}function A9({active:e,item:t,onOpen:n,onUnpin:r}){let{label:i}=t;return(0,H.jsxs)(oi,{children:[(0,H.jsxs)(`div`,{className:`group relative`,children:[(0,H.jsx)(si,{asChild:!0,children:(0,H.jsx)(`button`,{type:`button`,"aria-label":i,title:i,"data-side-dock-item-id":t.id,onClick:()=>n(t),className:c(`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,H.jsx)(Qre,{icon:t.icon})})}),t.removable?(0,H.jsx)(`button`,{type:`button`,"aria-label":T(`sideDockUnpinItem`),title:T(`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,H.jsx)(_i,{className:`h-3 w-3`,"aria-hidden":`true`})}):null]}),(0,H.jsx)(Yr,{side:`left`,children:i})]})}function $re({icon:e,label:t,onClick:n}){return(0,H.jsxs)(oi,{children:[(0,H.jsx)(si,{asChild:!0,children:(0,H.jsx)(`button`,{type:`button`,"aria-label":t,title:t,"data-side-dock-action":`hide`,onClick:n,className:c(`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,H.jsx)(e,{className:`h-5 w-5`,"aria-hidden":`true`})})}),(0,H.jsx)(Yr,{side:`left`,children:t})]})}function j9(e){return e?.trim()??``}function M9(e){return e.target.type===`right-panel-resource`?e.target.uri:null}function N9(e,t,n,r=!1){if(!t||!n)return!1;let i=j9(M9(e)??void 0);if(!i)return!1;let a=j9(n.resourceUri);return a&&a===i||j9(n.currentUrl)===i?!0:r?!1:e.id===`docs`&&n.kind===`docs`}function eie(e,t){if(!t)return!1;let n=j9(t.resourceUri),r=j9(t.currentUrl);return e.some(e=>{let t=j9(M9(e)??void 0);return t===n||t===r})}function P9(e){return Yre.has(e.id)}function tie({manager:e}){let t=k9(e=>e.pinnedItems),n=k9(e=>e.setVisible),{currentTab:r,isOpen:i}=ki(),{confirm:a,ConfirmDialog:o}=An(),s=D9(w9(),t),c=s.filter(e=>!P9(e)),l=s.filter(P9),u=eie(s,r),d=async()=>{await a({title:T(`sideDockHideConfirmTitle`),description:T(`sideDockHideConfirmDescription`),confirmLabel:T(`sideDockHideConfirmAction`),cancelLabel:T(`cancel`)})&&n(!1)};return(0,H.jsx)(ti,{delayDuration:250,children:(0,H.jsxs)(`aside`,{"data-testid":`side-dock`,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,H.jsx)(`div`,{className:`flex w-full flex-col items-center gap-1`,children:c.map(t=>(0,H.jsx)(A9,{active:N9(t,i,r,u),item:t,onOpen:e.openItem,onUnpin:t=>e.unpinItem(t.id)},t.id))}),l.length>0?(0,H.jsxs)(`div`,{"data-testid":`side-dock-utility`,className:`mt-auto flex w-full flex-col items-center gap-1`,children:[l.map(t=>(0,H.jsx)(A9,{active:N9(t,i,r,u),item:t,onOpen:e.openItem,onUnpin:t=>e.unpinItem(t.id)},t.id)),(0,H.jsx)($re,{icon:To,label:T(`sideDockHide`),onClick:()=>{d()}})]}):null,(0,H.jsx)(o,{})]})})}var nie=`pinned`,rie=new Set([`apps`,`docs`,`github`,`new-tab`,`panel-app`,`service-apps`]);function F9(e){return e.trim()}function iie(e){let t=0;return Array.from(F9(e)).forEach(e=>{t=t*31+e.charCodeAt(0)>>>0}),`${nie}-${F9(e).replace(/[^a-zA-Z0-9]+/g,`-`).replace(/^-+|-+$/g,``).toLowerCase()||`resource`}-${t.toString(36)}`}function aie(e){return e?.type===`builtin`&&rie.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 oie(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 sie=class{constructor(e){this.docBrowserManager=e,this.getItems=()=>D9(w9(),k9.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 vi.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:aie(e.dockIcon)??{type:`builtin`,name:oie(e)},id:iie(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=F9(e.target.uri),r={...e,target:{type:`right-panel-resource`,uri:n}};this.setPinnedItems(i=>i.some(t=>t.id===e.id||F9(t.target.uri)===n)?i:[...i,Ure(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}=k9.getState();n(e(t))},this.getTabResourceUri=e=>{let t=e?.resourceUri??e?.currentUrl,n=t?F9(t):``;return n.length>0?n:null},this.findItemByUri=e=>{let t=F9(e);return this.getItems().find(e=>e.target.type===`right-panel-resource`&&F9(e.target.uri)===t)}}},cie=new class{constructor(){this.resolveOpenTarget=e=>{let{activeTab:t,kind:n,url:r}=e,i=n??(r?void 0:t?.kind)??(r&&Ti(r)?`docs`:`home`),a=r?.trim()||(!n&&t&&t.kind!==`docs`?t.currentUrl:i===`home`?`nextclaw://new-tab`:i===`docs`?ji():`about:blank`),o=i===`docs`?Ii(a,`docs`):a;return{historyPolicy:`managed`,kind:i,title:i===`home`?T(`docBrowserHomeTitle`):Ei(o,i,i===`docs`?T(`docBrowserHelp`):`Detail`),url:o}},this.areUrlsEquivalent=(e,t,n,r)=>n===r?n===`docs`?Si(e)===Si(t):e===t:!1,this.usesManagedHistory=e=>e.currentUrl!==Fi}};function I9(e,t,n){return{...e,tabs:e.tabs.map(e=>e.id===t?n(e):e)}}function L9(e,t){return I9(e,e.activeTabId,t)}function lie(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 R9(e,t){return{kind:t.kind,resourceUri:t.resourceUri??t.url,tabId:e,url:t.url}}function z9(e,t,n){let r=Fd({entries:t.activeHistory,index:t.activeHistoryIndex},n,(t,n)=>lie(e,t,n));return{...t,activeHistory:[...r.entries],activeHistoryIndex:r.index}}function uie(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 B9(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=uie(e,r,a.url),s=n.resourceUri!==void 0&&n.resourceUri===r.resourceUri;return I9({...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 die(e,t){return!e.isOpen&&e.tabs.length===1&&t?.kind===`home`&&t.currentUrl===`nextclaw://new-tab`}function V9(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=I9(t,u.id,t=>Oi(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?z9(e,l,R9(u.id,n)):l}if(o||c||!l||l.kind!==n.kind){let i=Ni(n.url,n.kind,s??n.title,c,n.resourceUri??n.url,r?.dockIcon??n.dockIcon,n.contentParams);return die(t,l)?{...t,isOpen:!0,tabs:[i],activeTabId:i.id,activeHistory:[Ai(i)],activeHistoryIndex:0}:z9(e,{...t,isOpen:!0,tabs:[...t.tabs,i],activeTabId:i.id},Ai(i))}return z9(e,{...L9(t,t=>Oi(e,t,n,r,c)),isOpen:!0},R9(t.activeTabId,n))}function fie(e,t,n,r){let i=t.tabs.find(e=>e.id===t.activeTabId)??t.tabs[0];return V9(e,t,{...e.resolveOpenTarget({activeTab:i,kind:r?.kind,url:n}),contentParams:r?.contentParams},r)}var pie=class{constructor(e=cie,t){this.routeResolver=e,this.onRightPanelOpened=t,this.setSnapshot=e=>{Mi.getState().setSnapshot(e)},this.open=(e,t)=>{this.setSnapshot(n=>fie(this.routeResolver,n,e,t)),this.onRightPanelOpened?.()},this.openTarget=(e,t)=>{this.setSnapshot(n=>V9(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:wi,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:Ci(e)}))},this.navigate=e=>{this.setSnapshot(t=>{if(!t.tabs.length){let e=Ni(ji(),`docs`,`Docs`);return{...t,tabs:[e],activeTabId:e.id,isOpen:!0}}let n=L9(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,...Di(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?z9(this.routeResolver,n,Ai(r)):n})},this.syncUrl=e=>{this.setSnapshot(t=>{if(!t.tabs.length){let e=Ni(ji(),`docs`,`Docs`);return{...t,tabs:[e],activeTabId:e.id}}let n=L9(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,...Di(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?z9(this.routeResolver,n,Ai(r)):n})},this.goBack=()=>{this.setSnapshot(e=>{let t=Id({entries:e.activeHistory,index:e.activeHistoryIndex},`back`);return t?B9(this.routeResolver,{...e,activeHistory:[...t.history.entries],activeHistoryIndex:t.history.index},t.entry):e})},this.goForward=()=>{this.setSnapshot(e=>{let t=Id({entries:e.activeHistory,index:e.activeHistoryIndex},`forward`);return t?B9(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{...tee(),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=Ld({entries:a.activeHistory,index:a.activeHistoryIndex},t=>t.tabId!==e,Ai(o)),c={...a,activeHistory:[...s.entries],activeHistoryIndex:s.index};return t.activeTabId===e?z9(this.routeResolver,c,Ai(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?z9(this.routeResolver,{...t,activeTabId:e,isOpen:!0},Ai(n)):t})}}};function mie(e){return e.activeWorkspacePanelKind!=null}var hie=class{constructor(){this.notificationManager=new Ire,this.inboxManager=new Ane,this.chatCompletionNotificationManager=new Mre(this.notificationManager),this.accountManager=new Is,this.rightPanelResourceRouteResolver=new P$,this.notifyRightPanelOpened=()=>{let e=Mi.getState().snapshot,t=U.getState().snapshot;Us.collapseSidebarForDenseRightPanels({isDocBrowserDocked:e.mode===`docked`,isDocBrowserOpen:e.isOpen,isWorkspacePanelOpen:mie(t)})},this.docBrowserManager=new pie(this.rightPanelResourceRouteResolver,this.notifyRightPanelOpened),this.appPackageOperationSettlementManager=new qQ(this.docBrowserManager),this.sideDockManager=new sie(this.docBrowserManager),this.chatComposerIntentManager=new Ore,this.chatDraftIntentManager=new Dre,this.serviceActionAuthorizationManager=new wQ,this.panelAppBridgeManager=new zY(this.serviceActionAuthorizationManager),this.remoteAccessManager=new vs({accountManager:this.accountManager})}},H9=null;function U9(){return H9??=new hie,H9}function W9(){return U9()}var G9=globalThis,K9=G9.__NEXTCLAW_APP_PRESENTER_CONTEXT__??(0,V.createContext)(null);G9.__NEXTCLAW_APP_PRESENTER_CONTEXT__=K9;function gie({children:e}){let t=(0,V.useMemo)(()=>U9(),[]);return(0,H.jsx)(K9.Provider,{value:t,children:e})}function q9(){let e=(0,V.useContext)(K9);if(!e)throw Error(`useAppPresenter must be used inside AppPresenterProvider`);return e}function _ie(){let e=q9();return(0,V.useEffect)(()=>(e.chatCompletionNotificationManager.start(),()=>{e.chatCompletionNotificationManager.stop()}),[e.chatCompletionNotificationManager]),null}var vie=`NextClaw`,yie=[{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 bie(e,t){return e===t||e.startsWith(`${t}/`)}function xie(e){let t=e.toLowerCase();for(let{prefix:e,key:n}of yie)if(bie(t,e))return T(n);return T(`settings`)}function Sie(e){let t=e.toLowerCase();return t===`localhost`||t.endsWith(`.localhost`)||t===`::1`||t===`[::1]`||t.startsWith(`127.`)}function Cie(e){let t=e?.host.trim(),n=e?.hostname.trim(),r=e?.port.trim();return!t||!n?null:Sie(n)?r||null:t}function wie(e,t){let n=Cie(t);return`${vie}${n?` ${n}`:``} - ${xie(e)}`}var J9={...H$,...In};function Tie({children:e,sideDockManager:t}){let{isOpen:n,mode:r}=ki();Pn();let{pathname:i}=he(),a=oe(),o=W9(),{language:s}=Nn(),{isMobile:c}=c6(),l=a9(),u=k9(e=>e.isVisible);k9(e=>e.pinnedItems);let d={getDockState:t.getDockState,pinTab:t.pinTab,unpinTab:t.unpinTab},f=(0,V.useCallback)(e=>{let t=s$(e);if(t)return[{key:`chat`,items:[{key:`add-to-chat`,icon:(0,H.jsx)(uo,{className:`h-4 w-4`}),label:T(`docBrowserAddToChat`),restoreFocus:!1,onSelect:()=>{let e=i===`/chat`||i.startsWith(`/chat/`),n=i===`/chat`?null:f9(i.slice(6));o.chatComposerIntentManager.requestUiResourceReference({targetSessionKey:e?n:null,reference:t}),e||a(d9)}}]}]},[a,i,o]);return(0,V.useEffect)(()=>{document.title=wie(i,window.location)},[i,s]),c&&l!==`win32`?(0,H.jsx)(nre,{pathname:i,isDocBrowserOpen:n,docBrowserDockControls:d,docBrowserRenderers:J9,docBrowserTabMenuGroups:f,topbarLeadingInset:l===`darwin`?`4.75rem`:void 0,children:e}):(0,H.jsx)(are,{pathname:i,isMobileLayout:c,isDocBrowserOpen:n,docBrowserMode:r,docBrowserDockControls:d,docBrowserRenderers:J9,docBrowserTabMenuGroups:f,sideDock:u?(0,H.jsx)(tie,{manager:t}):null,children:e})}function Eie({children:e}){let t=W9();return(0,H.jsx)(Pi,{manager:t.docBrowserManager,children:(0,H.jsx)(Tie,{sideDockManager:t.sideDockManager,children:e})})}function Die(){let{isMobile:e}=c6();return e?(0,H.jsx)(rre,{}):(0,H.jsx)(pe,{to:`/model`,replace:!0})}function Oie(e){let t=e.trim().toLowerCase();return t?!t.startsWith(`skills`):!0}function kie(e,t){t.startsWith(`mcp`)&&(e?.invalidateQueries({queryKey:[`marketplace-mcp-installed`]}),e?.invalidateQueries({queryKey:[`marketplace-mcp-items`]}),e?.invalidateQueries({queryKey:[`marketplace-mcp-doctor`]}))}function Aie(e,t){e&&Oie(t)&&e.invalidateQueries({queryKey:[`config`]}),kie(e,t)}function Y9(e){let t=e.trim().replace(/\\/g,`/`).replace(/\/+$/g,``);return/^[a-z]:/i.test(t)?t.toLowerCase():t}function jie(e,t){if(!e)return;let n=Y9(t);e.invalidateQueries({predicate:e=>e.queryKey[0]===`server-path-browse`&&typeof e.queryKey[1]==`string`&&Y9(e.queryKey[1])===n})}function Mie(e){let t=(0,V.useRef)(!1);(0,V.useEffect)(()=>{let n=I.eventBus.on(p.connectionOpen,()=>{Ae.handleConnectionRestored(),Cn.refreshAfterRealtimeReconnect(),t.current&&(t.current=!1,e?.invalidateQueries({queryKey:[`ncp-sessions`]}))}),r=I.eventBus.on(p.connectionClose,()=>{Ae.handleConnectionInterrupted(null),t.current=!0}),i=I.eventBus.on(p.connectionError,e=>{Ae.handleConnectionInterrupted(e?.message??null),t.current=!0}),a=I.eventBus.on(p.configUpdated,({path:t})=>{Aie(e,t)}),o=I.eventBus.on(p.serverPathChanged,({directoryPath:t})=>jie(e,t)),s=I.eventBus.on(p.runtimeUpdateSnapshot,e=>{Cn.reportSnapshot(e)}),c=I.eventBus.on(p.sessionRunStatus,t=>{pt(e,{type:`session.run-status`,payload:t})}),l=I.eventBus.on(p.sessionSummaryUpsert,t=>{pt(e,{type:`session.summary.upsert`,payload:t})}),u=I.eventBus.on(p.sessionSummaryDelete,t=>{pt(e,{type:`session.summary.delete`,payload:t})}),d=I.eventBus.on(p.error,e=>{console.error(`Realtime transport error:`,e.message)});return()=>{n(),r(),i(),a(),o(),s(),c(),l(),u(),d()}},[e])}var X9={"--width":`320px`},Nie=(0,V.lazy)(async()=>({default:(await F(async()=>{let{ModelConfigPage:e}=await import(`./model-config-page-DQ-iQFSO.js`);return{ModelConfigPage:e}},__vite__mapDeps([39,4,40,28,31,27,41,42,32,1,33,43,37,38,44,45,46]))).ModelConfigPage})),Pie=(0,V.lazy)(async()=>({default:(await F(async()=>{let{AppearanceSettingsPage:e}=await import(`./appearance-settings-page-CEPxG1w0.js`);return{AppearanceSettingsPage:e}},__vite__mapDeps([47,4,42,27,28,40,48,49,29,36,26,30,31,32,1,33,34,35,37,38,43,50,45]))).AppearanceSettingsPage})),Z9=(0,V.lazy)(async()=>({default:(await F(async()=>{let{ChatPage:e}=await import(`./chat-page-sGhIjLSr.js`);return{ChatPage:e}},__vite__mapDeps([51,4,27,28,42,49,29,40,36,48,26,30,31,32,1,33,34,35,37,38,43,50,45,41,52]))).ChatPage})),Fie=(0,V.lazy)(async()=>({default:(await F(async()=>{let{SearchConfigPage:e}=await import(`./search-config-page-ydeDD1OQ.js`);return{SearchConfigPage:e}},__vite__mapDeps([53,4,42,27,28,40,30,32,1,33,54,44]))).SearchConfigPage})),Iie=(0,V.lazy)(async()=>({default:(await F(async()=>{let{ProvidersConfigPage:e}=await import(`./providers-config-page-DUYwVuYe.js`);return{ProvidersConfigPage:e}},__vite__mapDeps([55,4,27,28,42,49,29,40,36,30,43,34,35,52,54,44,46,33]))).ProvidersConfigPage})),Lie=(0,V.lazy)(async()=>({default:(await F(async()=>{let{ChannelsList:e}=await import(`./channels-list-page-DKrUSeNz.js`);return{ChannelsList:e}},__vite__mapDeps([56,4,27,28,42,40,30,31,32,1,33,43,36,54,50,44,46]))).ChannelsList})),Rie=(0,V.lazy)(async()=>({default:(await F(async()=>{let{RuntimeConfig:e}=await import(`./runtime-config-page-CaWoWoQk.js`);return{RuntimeConfig:e}},__vite__mapDeps([57,4,42,27,28,40,48,49,29,36,26,30,31,32,1,33,34,35,37,38,43,50,45,58,59,44]))).RuntimeConfig})),zie=(0,V.lazy)(async()=>({default:(await F(async()=>{let{DesktopUpdateConfig:e}=await import(`./desktop-update-config-VgvIATTT.js`);return{DesktopUpdateConfig:e}},__vite__mapDeps([60,42,4,27,28,40,32,1,33,35,58]))).DesktopUpdateConfig})),Bie=(0,V.lazy)(async()=>({default:(await F(async()=>{let{SecurityConfig:e}=await import(`./security-config-Ds_2SXBh.js`);return{SecurityConfig:e}},__vite__mapDeps([61,40,4,28]))).SecurityConfig})),Vie=(0,V.lazy)(async()=>({default:(await F(async()=>{let{SecretsConfigPage:e}=await import(`./secrets-config-page-BZYqw8BF.js`);return{SecretsConfigPage:e}},__vite__mapDeps([62,4,42,27,28,40,34,59,44]))).SecretsConfigPage})),Hie=(0,V.lazy)(async()=>({default:(await F(async()=>{let{RemoteAccessPage:e}=await import(`./remote-CNFQ6bFY.js`);return{RemoteAccessPage:e}},[])).RemoteAccessPage})),Uie=(0,V.lazy)(async()=>({default:(await F(async()=>{let{McpMarketplacePage:e}=await import(`./mcp-marketplace-page-q6T-vKoH.js`);return{McpMarketplacePage:e}},__vite__mapDeps([63,48,4,27,28,42,49,29,40,36,26,30,31,32,1,33,34,35,37,38,43,50,45]))).McpMarketplacePage}));function Wie(){return(0,H.jsx)(`div`,{className:`h-full w-full animate-pulse rounded-2xl border border-border/40 bg-card/40`})}function Gie({children:e}){return(0,H.jsx)(V.Suspense,{fallback:(0,H.jsx)(Wie,{}),children:e})}function Q9(e){return(0,H.jsx)(Gie,{children:e})}var Kie=[{path:`/chat/skills`,redirectTo:`/skills`},{path:`/chat/cron`,redirectTo:`/cron`},{path:`/chat/agents`,redirectTo:`/agents`},{path:`/chat/:sessionId?`,element:Q9((0,H.jsx)(Z9,{view:`chat`}))},{path:`/agents`,element:Q9((0,H.jsx)(Z9,{view:`agents`}))},{path:`/skills`,element:Q9((0,H.jsx)(Z9,{view:`skills`}))},{path:`/skills/scenes/:scene`,element:Q9((0,H.jsx)(Z9,{view:`skills`}))},{path:`/cron`,element:Q9((0,H.jsx)(Z9,{view:`cron`}))},{path:`/inbox/:deliveryId?`,element:Q9((0,H.jsx)(Z9,{view:`inbox`}))},{path:`/appearance`,element:Q9((0,H.jsx)(Pie,{}))},{path:`/model`,element:Q9((0,H.jsx)(Nie,{}))},{path:`/search`,element:Q9((0,H.jsx)(Fie,{}))},{path:`/providers`,element:Q9((0,H.jsx)(Iie,{}))},{path:`/channels`,element:Q9((0,H.jsx)(Lie,{}))},{path:`/runtime`,element:Q9((0,H.jsx)(Rie,{}))},{path:`/updates`,element:Q9((0,H.jsx)(zie,{}))},{path:`/remote`,element:Q9((0,H.jsx)(Hie,{}))},{path:`/security`,element:Q9((0,H.jsx)(Bie,{}))},{path:`/secrets`,element:Q9((0,H.jsx)(Vie,{}))},{path:`/settings`,element:(0,H.jsx)(Die,{})},{path:`/marketplace/skills`,redirectTo:`/skills`},{path:`/marketplace`,redirectTo:`/skills`},{path:`/marketplace/mcp`,element:Q9((0,H.jsx)(Uie,{}))},{path:`/`,redirectTo:`/chat`},{path:`*`,redirectTo:`/chat`}];function qie(e){return`redirectTo`in e?(0,H.jsx)(ae,{path:e.path,element:(0,H.jsx)(pe,{to:e.redirectTo,replace:!0})},e.path):(0,H.jsx)(ae,{path:e.path,element:e.element},e.path)}function Jie(){return(0,H.jsx)(le,{children:Kie.map(qie)})}function $9(){return Mie(Jt),tt(),(0,V.useEffect)(()=>(Cn.start(),()=>{Cn.stop()}),[]),(0,H.jsxs)(gie,{children:[(0,H.jsx)(_ie,{}),(0,H.jsx)(Nne,{}),(0,H.jsx)(Eie,{children:(0,H.jsx)(Jie,{})}),(0,H.jsx)(Os,{}),(0,H.jsx)(xQ,{})]})}function Yie(){let e=Ft(),t=e.isError&&be(e.error);return e.isLoading&&!e.isError||t||e.isError?(0,H.jsx)($9,{}):e.data?.enabled&&!e.data.authenticated?(0,H.jsx)(Fs,{username:e.data.username}):(0,H.jsx)($9,{})}function Xie(){return(0,V.useEffect)(()=>{nne()},[]),(0,H.jsxs)(mt,{client:Jt,children:[(0,H.jsx)(Yie,{}),(0,H.jsx)(ene,{}),(0,H.jsx)(an,{position:`top-right`,richColors:!0,offset:{top:window.nextclawDesktop?.platform===`win32`?56:44,right:72},mobileOffset:window.nextclawDesktop?.platform===`win32`?56:void 0,style:X9})]})}var Zie=window.nextclawDesktop?.platform===`win32`?ie:fe;(0,rs.createRoot)(document.getElementById(`root`)).render((0,H.jsx)(V.StrictMode,{children:(0,H.jsx)(ane,{children:(0,H.jsx)(Fn,{children:(0,H.jsx)(Zie,{children:(0,H.jsx)(Xie,{})})})})}));export{_f as $,C3 as A,ms as At,V4 as B,Oo as Bt,j3 as C,Cs as Ct,h3 as D,ls as Dt,g3 as E,_s as Et,y3 as F,Yo as Ft,N4 as G,Ga as Gt,R4 as H,lo as Ht,A3 as I,Wo as It,jY as J,oa as Jt,e1 as K,Ea as Kt,k4 as L,Lo as Lt,v3 as M,cs as Mt,b3 as N,os as Nt,m3 as O,fs as Ot,k3 as P,as as Pt,hf as Q,U4 as R,Fo as Rt,w3 as S,js as St,E3 as T,vs as Tt,I4 as U,Qa as Ut,H4 as V,mo as Vt,F4 as W,Ya as Wt,MY as X,Xi as Xt,PY as Y,$i as Yt,NY as Z,f3 as _,Cc as _t,f9 as a,ju as at,x3 as b,Ms as bt,Hne as c,Au as ct,S7 as d,rl as dt,gf as et,$te as f,il as ft,c6 as g,Ec as gt,F5 as h,Oc as ht,Ere as i,Pu as it,O3 as j,gs as jt,T3 as k,ps as kt,Z7 as l,mu as lt,n7 as m,Dc as mt,k9 as n,U as nt,l9 as o,Ou as ot,c7 as p,Tc as pt,DZ as q,wa as qt,Nre as r,qu as rt,ire as s,ku as st,q9 as t,mf as tt,Lne as u,pu as ut,p3 as v,ks as vt,D3 as w,Ss as wt,S3 as x,As as xt,_3 as y,Ns as yt,P4 as z,ko as zt};
|