@qredence/fleet 0.5.8 → 0.5.9
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 +6 -0
- package/dist/web/client/assets/{index-CyutYeAE.js → index-CwtZA4hF.js} +2 -2
- package/dist/web/client/assets/{routes-C6dbDcUx.js → routes-DkefU9yA.js} +1 -1
- package/dist/web/client/bundle-budget.json +2 -2
- package/dist/web/server/{_tanstack-start-manifest_v-CHn_lOG6-M45IQFJF.js → _tanstack-start-manifest_v-DkghjPW8-5E6WBVI6.js} +4 -4
- package/dist/web/server/{router-DeyBfh_j-PIACYVFX.js → router-dnEmu1cU-LUH74TAC.js} +2 -2
- package/dist/web/server/{routes-Clwss4Ef-7P22ZVYC.js → routes-Ci5_8lws-F54KB46D.js} +2 -2
- package/dist/web/server/server.js +2 -2
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/model-selector-list-CJY9pyt2.js","assets/rolldown-runtime-hePW80VL.js","assets/bundle-mjs-DKHVkVWu.js","assets/jsx-runtime-NZYk81nU.js","assets/ease-u56MhKYS.js","assets/layout-gyLzPvVv.js","assets/utils-Eg7xtNmV.js","assets/check-JjHKAZas.js","assets/createLucideIcon-DwxZHm0M.js","assets/gauge-DNpstbBn.js","assets/command-Cx-UYeQ9.js","assets/dialog-Dh7WpGIu.js","assets/react-dom-Bwxum3ti.js","assets/button-BV9NafmI.js","assets/createBaseUIEventDetails-DV0dQrBX.js","assets/useBaseUiId-CHqXB2UQ.js","assets/x-CsRC_tCI.js","assets/search-eWVnAJsb.js","assets/dist-BPaFisIZ.js","assets/input-group-D5gi9zBK.js","assets/input-Bol3TP4v.js","assets/useControlled-CJJ9BOQB.js","assets/fleet-pi-tool-renderer-DMjrKLi2.js","assets/use-reduced-motion-eORd7fqW.js","assets/tool-result-Cp13oeRn.js","assets/chevron-down-BEVGmnSb.js","assets/loader-circle-DjfHXUPB.js","assets/circle-x-CkKCB__4.js","assets/action-swap-roll-BB8DFMuf.js","assets/rotate-ccw-WNFNkKQD.js","assets/square-terminal-BYTN_I86.js","assets/wrench-BJNNe07k.js","assets/preload-helper-Czpn1I53.js","assets/agent-disclosure-B8SnhQXL.js","assets/citations-BQ_pr_9_.js","assets/earth-DGZXAN5r.js","assets/shield-check-CkA2viVW.js","assets/safe-external-url-D3PJJIcM.js","assets/chevron-right-DrJxToLs.js","assets/chevron-up-CnSvySGH.js","assets/circle-alert-CONlFReH.js","assets/ipython-tool-BrMePqD-.js","assets/cn-C8c0S2mI.js","assets/eye-B0DFz5hL.js","assets/file-text-T-NcAlZs.js","assets/sparkles-DuclzqlE.js","assets/terminal-DOS1s1gm.js","assets/dist-CZDnnosQ.js","assets/lib-ChrQ49PO.js","assets/character-entities-legacy-Wut6vMuj.js","assets/workspace-path-nav-C0AQNZyy.js","assets/collapsible-BoXtZZWN.js","assets/surfaces-cW-gp56p.js","assets/range-BWOHiLNe.js","assets/agent-activity-CDcDNVC6.js","assets/image-BbPmlw-n.js","assets/message-square-hbDao-A1.js","assets/fleet-reasoning-panel-MtbSdoCv.js","assets/fleet-tool-timeline-COzPrwr8.js","assets/fleet-subagent-list-BnRnrWKS.js","assets/subagent-utils-DDH5qm9Z.js","assets/prompt-suggestions-CXM6knMK.js","assets/fleet-message-queue-DPBMIZSU.js","assets/notify-BnNaNaBU.js","assets/toast-BzAKULar.js","assets/triangle-alert-CU-gd7ui.js","assets/chat-command-palette-C_HgND2N.js","assets/right-panel-registry-DOyEvIMD.js","assets/bot-Bs7QWJ2q.js","assets/folder-BC5p7qK7.js","assets/package-CdcJFPf2.js","assets/right-panel-context-DHlNWJsF.js","assets/skeleton-CkR2VmWc.js","assets/sun-BWiZFty0.js","assets/plus-DXN1Bg_z.js","assets/square-Bhn8gjr0.js","assets/settings-dialog-B6rt69m_.js","assets/provider-catalog-CO1GxLYe.js","assets/provider-label-B0E-wWFV.js","assets/plug-Dt6VN0zF.js","assets/hard-drive-CHqgr7VQ.js","assets/refresh-cw-IThTJ3j-.js","assets/ui-preferences-DUEFuJFj.js","assets/switch-J2Lvo_tF.js","assets/fork-picker-dialog-CAhWx0G5.js","assets/subagent-chat-panel-Ck06wcIJ.js","assets/prompt-input-BpuTiX7Z.js","assets/subagent-transcript-BwCv3nTL.js","assets/generative-text-renderer-CzwNIs3b.js","assets/openui-utils-DawGoQNp.js","assets/prime-agent-artifacts-C-g1VPiW.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t}from"./bundle-mjs-DKHVkVWu.js";import{t as n}from"./react-dom-Bwxum3ti.js";import{t as r}from"./jsx-runtime-NZYk81nU.js";import{D as i,E as a,F as o,M as s,O as c,P as l,d as u,g as d,h as f,j as p,k as m,l as h,m as g,o as _,p as v,s as y,v as b,w as x,x as S}from"./analytics-stub-Cas1He0w.js";import{A as C,B as w,D as T,E,Q as D,S as O,T as k,V as A,b as j,c as M,et as N,f as P,k as F,m as I,n as L,nt as R,p as z,r as B,t as V,v as H,x as U,z as W}from"./button-BV9NafmI.js";import{$ as G,C as ee,I as te,K as ne,L as re,M as ie,N as ae,P as oe,U as se,V as ce,W as le,X as ue,Y as de,Z as fe,at as pe,ct as me,et as he,h as ge,it as _e,j as ve,m as ye,nt as be,ot as xe,q as Se,rt as Ce,tt as we,y as Te,z as Ee}from"./layout-gyLzPvVv.js";import{d as K,h as De,l as Oe,m as ke,n as Ae,o as je,p as Me,r as Ne,t as Pe,u as Fe}from"./ease-u56MhKYS.js";import{a as Ie,c as Le,i as Re,n as ze,o as Be,r as Ve,s as He,t as Ue}from"./prompt-input-BpuTiX7Z.js";import{n as We,t as Ge}from"./use-reduced-motion-eORd7fqW.js";import{C as Ke,K as qe,O as Je,b as Ye,c as Xe,d as Ze,et as Qe,f as $e,h as et,i as tt,j as nt,nt as rt,o as it,ot as at,rt as ot,s as st,st as ct,t as lt,v as ut,w as dt,x as ft}from"./createBaseUIEventDetails-DV0dQrBX.js";import{$ as pt,A as mt,B as ht,C as gt,D as _t,E as vt,F as yt,G as bt,H as xt,I as St,J as Ct,K as wt,L as Tt,M as Et,N as Dt,O as Ot,P as kt,Q as At,R as jt,S as Mt,U as Nt,V as Pt,W as Ft,X as It,Z as Lt,_ as Rt,a as zt,b as Bt,et as Vt,g as Ht,h as Ut,i as Wt,j as Gt,n as Kt,o as qt,q as Jt,r as Yt,t as Xt,w as Zt,x as Qt,y as $t}from"./dialog-Dh7WpGIu.js";import{_ as en,b as tn,c as nn,f as rn,g as an,j as on,m as sn,s as cn,u as ln,v as un,x as dn,y as fn}from"./provider-catalog-CO1GxLYe.js";import{t as pn}from"./useBaseUiId-CHqXB2UQ.js";import{A as mn,C as hn,D as gn,E as _n,O as vn,S as yn,T as bn,a as xn,c as Sn,d as Cn,f as wn,h as Tn,i as En,l as Dn,m as On,n as kn,o as An,p as jn,s as Mn,t as Nn,u as Pn,x as Fn,y as In}from"./provider-label-B0E-wWFV.js";import{t as q}from"./utils-Eg7xtNmV.js";import{t as Ln}from"./createLucideIcon-DwxZHm0M.js";import{n as Rn,r as zn,t as Bn}from"./right-panel-registry-DOyEvIMD.js";import{c as Vn,i as Hn,l as Un,n as Wn,o as Gn,s as Kn,t as qn,u as Jn}from"./citations-BQ_pr_9_.js";import{r as Yn}from"./resource-helpers-Q2T0YCMO.js";import{t as Xn}from"./bot-Bs7QWJ2q.js";import{t as Zn}from"./check-JjHKAZas.js";import{t as Qn}from"./chevron-down-BEVGmnSb.js";import{a as $n,c as er,d as tr,f as nr,i as rr,l as ir,n as ar,o as or,r as sr,s as cr,t as lr,u as ur}from"./generative-text-renderer-CzwNIs3b.js";import{t as dr}from"./chevron-right-DrJxToLs.js";import{t as fr}from"./chevron-up-CnSvySGH.js";import{t as pr}from"./circle-alert-CONlFReH.js";import{t as mr}from"./loader-circle-DjfHXUPB.js";import{n as hr,r as gr,t as _r}from"./action-swap-roll-BB8DFMuf.js";import{t as vr}from"./file-text-T-NcAlZs.js";import{a as yr,c as br,d as xr,f as Sr,h as Cr,i as wr,l as Tr,m as Er,n as Dr,r as Or,s as kr,t as Ar,u as jr,v as Mr,y as Nr}from"./horizontal-resize-Bl3AyBJg.js";import{t as Pr}from"./folder-BC5p7qK7.js";import{t as Fr}from"./gauge-DNpstbBn.js";import{t as Ir}from"./package-CdcJFPf2.js";import{t as Lr}from"./plus-DXN1Bg_z.js";import{t as Rr}from"./refresh-cw-IThTJ3j-.js";import{t as zr}from"./rotate-ccw-WNFNkKQD.js";import{t as Br}from"./subagent-utils-DDH5qm9Z.js";import{t as Vr}from"./search-eWVnAJsb.js";import{t as Hr}from"./sparkles-DuclzqlE.js";import{t as Ur}from"./triangle-alert-CU-gd7ui.js";import{t as Wr}from"./x-CsRC_tCI.js";import{t as Gr}from"./preload-helper-Czpn1I53.js";import"./cn-C8c0S2mI.js";import{t as Kr}from"./notify-BnNaNaBU.js";import{n as qr}from"./workspace-path-nav-C0AQNZyy.js";import{t as Jr}from"./useControlled-CJJ9BOQB.js";import{t as Yr}from"./agent-disclosure-B8SnhQXL.js";import{a as Xr,i as Zr,o as Qr,s as $r}from"./surfaces-cW-gp56p.js";import{t as ei}from"./prime-agent-artifacts-C-g1VPiW.js";import{A as ti,C as ni,D as ri,E as ii,F as ai,I as oi,J as si,L as ci,M as li,O as ui,P as J,R as di,S as fi,T as pi,V as Y,_ as mi,a as hi,c as gi,d as _i,f as vi,g as yi,h as bi,i as xi,j as Si,l as Ci,m as wi,n as Ti,o as Ei,p as Di,q as Oi,r as ki,s as Ai,t as ji,u as Mi,v as Ni,w as Pi,y as Fi,z as X}from"./chat-DdPRGn-U.js";import{i as Ii,n as Li,t as Ri}from"./right-panel-context-DHlNWJsF.js";import{t as zi}from"./input-Bol3TP4v.js";import{t as Bi}from"./artifacts-utils-N_kUFbz2.js";var Vi=class extends f{#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p=new Set;constructor(e,t){super(),this.options=t,this.#e=e,this.#o=null,this.bindMethods(),this.setOptions(t)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),Ui(this.#t,this.options)?this.#m():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Wi(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Wi(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof i(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!c(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&Gi(this.#t,n,this.options,t)&&this.#m(),this.updateResult(),r&&(this.#t!==n||i(this.options.enabled,this.#t)!==i(t.enabled,this.#t)||i(this.options.staleTime,this.#t)!==i(t.staleTime,this.#t))&&this.#g();let a=this.#_();r&&(this.#t!==n||i(this.options.enabled,this.#t)!==i(t.enabled,this.#t)||a!==this.#f)&&this.#v(a)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return c(this.getCurrentResult(),n)||(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),Reflect.get(e,n))})}trackProp(e){this.#p.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t),r=()=>{},i,a=new Promise(e=>{i=e,r=this.#e.getQueryCache().subscribe(i=>{i.type===`updated`&&i.query.queryHash===n.queryHash&&n.state.data!==void 0&&(r(),e(this.createResult(n,t)))})});return Promise.race([n.fetch().then(()=>{let e=this.createResult(n,t);return i?.(e),e}).finally(()=>{r()}),a])}fetch(e){return this.#m({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#m(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(x)),t}#h(e){return!d()&&i(this.options.enabled,this.#t)!==!1&&S(e)}#g(){this.#b();let e=i(this.options.staleTime,this.#t);if(this.#r.isStale||!this.#h(e))return;let t=p(this.#r.dataUpdatedAt,e)+1;this.#u=s.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return(typeof this.options.refetchInterval==`function`?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#x(),this.#f=e,!(this.#f===0||!this.#h(this.#f))&&(this.#d=s.setInterval(()=>{(this.options.refetchIntervalInBackground||g.isFocused())&&this.#m()},this.#f))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#u!==void 0&&(s.clearTimeout(this.#u),this.#u=void 0)}#x(){this.#d!==void 0&&(s.clearInterval(this.#d),this.#d=void 0)}createResult(e,t){let n=this.#t,r=this.options,o=this.#r,s=this.#i,c=this.#a,l=e===n?this.#n:e.state,{state:d}=e,f={...d},p=!1,m;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&Ui(e,t),o=i&&Gi(e,n,t,r);(a||o)&&(f={...f,...u(d.data,e.options)}),t._optimisticResults===`isRestoring`&&(f.fetchStatus=`idle`)}let{error:h,errorUpdatedAt:g,status:_}=f;m=f.data;let v=!1;if(t.placeholderData!==void 0&&m===void 0&&_===`pending`){let e;o?.isPlaceholderData&&t.placeholderData===c?.placeholderData?(e=o.data,v=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#l?.state.data,this.#l):t.placeholderData,e!==void 0&&(_=`success`,m=a(o?.data,e,t),p=!0)}if(t.select&&m!==void 0&&!v){if(o&&m===s?.data&&t.select===this.#s)m=this.#c;else try{this.#s=t.select,m=t.select(m),m=a(o?.data,m,t),this.#c=m,this.#o=null}catch(e){this.#o=e}}else m===void 0&&(this.#o=null);this.#o&&(h=this.#o,m=this.#c,g=Date.now(),_=`error`,p=!1);let y=f.fetchStatus===`fetching`,b=_===`pending`,x=_===`error`,S=b&&y,C=m!==void 0;return{status:_,fetchStatus:f.fetchStatus,isPending:b,isSuccess:_===`success`,isError:x,isInitialLoading:S,isLoading:S,data:m,dataUpdatedAt:f.dataUpdatedAt,error:h,errorUpdatedAt:g,failureCount:f.fetchFailureCount,failureReason:f.fetchFailureReason,errorUpdateCount:f.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:f.dataUpdateCount>l.dataUpdateCount||f.errorUpdateCount>l.errorUpdateCount,isFetching:y,isRefetching:y&&!b,isLoadingError:x&&!C,isPaused:f.fetchStatus===`paused`,isPlaceholderData:p,isRefetchError:x&&C,isStale:Ki(e,t),refetch:this.refetch,isEnabled:i(t.enabled,e)!==!1}}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);if(this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#l=this.#t),c(t,e))return;this.#r=t;let n=(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#p.size)return!0;let r=new Set(n??this.#p);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})();v.batch(()=>{n&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}};function Hi(e,t){return i(t.enabled,e)!==!1&&e.state.data===void 0&&(e.state.status!==`error`||i(t.retryOnMount,e)!==!1)}function Ui(e,t){return Hi(e,t)||e.state.data!==void 0&&Wi(e,t,t.refetchOnMount)}function Wi(e,t,n){if(i(t.enabled,e)!==!1&&i(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&Ki(e,t)}return!1}function Gi(e,t,n,r){return(e!==t||i(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&Ki(e,n)}function Ki(e,t){return i(t.enabled,e)!==!1&&e.isStaleByTime(i(t.staleTime,e))}var qi=class extends f{#e;#t=void 0;#n;#r;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),c(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&b(t.mutationKey)!==b(this.options.mutationKey)?this.reset():this.#n?.state.status===`pending`&&this.#n.setOptions(this.options)}onSubscribe(){this.listeners.size===1&&this.#n&&(this.#n.addObserver(this),this.#i())}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#a(e)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#a()}mutate(e,t){return this.#r=t,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(e)}#i(){let e=this.#n?.state??h();this.#t={...e,isPending:e.status===`pending`,isSuccess:e.status===`success`,isError:e.status===`error`,isIdle:e.status===`idle`,mutate:this.mutate,reset:this.reset}}#a(e){v.batch(()=>{if(this.#r&&this.hasListeners()){let t=this.#t.variables,n=this.#t.context,r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type===`success`){try{this.#r.onSuccess?.(e.data,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(e.data,null,t,n,r)}catch(e){Promise.reject(e)}}else if(e?.type===`error`){try{this.#r.onError?.(e.error,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(void 0,e.error,t,n,r)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}},Z=e(t(),1),Ji=Z.createContext(!1),Yi=()=>Z.useContext(Ji);Ji.Provider;var Q=r();function Xi(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Zi=Z.createContext(Xi()),Qi=()=>Z.useContext(Zi),$i=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?m(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||r)&&(t.isReset()||(e.retryOnMount=!1))},ea=e=>{Z.useEffect(()=>{e.clearReset()},[e])},ta=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||m(n,[e.error,r])),na=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},ra=(e,t)=>e?.suspense&&t.isPending,ia=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function aa(e,t,n){let r=Yi(),i=Qi(),a=l(n),o=a.defaultQueryOptions(e),s=a.getQueryCache().get(o.queryHash),c=e.subscribed!==!1;o._optimisticResults=r?`isRestoring`:c?`optimistic`:void 0,na(o),$i(o,i,s),ea(i);let[u]=Z.useState(()=>new t(a,o)),d=u.getOptimisticResult(o),f=!r&&c;if(Z.useSyncExternalStore(Z.useCallback(e=>{let t=f?u.subscribe(v.batchCalls(e)):x;return u.updateResult(),t},[u,f]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),Z.useEffect(()=>{u.setOptions(o)},[o,u]),ra(o,d))throw ia(o,u,i);if(ta({result:d,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw d.error;return o.notifyOnChangeProps?d:u.trackResult(d)}function oa(e,t){return aa(e,Vi,t)}function sa(e,t){let n=l(t),[r]=Z.useState(()=>new qi(n,e));Z.useEffect(()=>{r.setOptions(e)},[r,e]);let i=Z.useSyncExternalStore(Z.useCallback(e=>r.subscribe(v.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=Z.useCallback((...e)=>{r.mutate(e[0],e[1]).catch(x)},[r]);if(i.error&&m(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}var ca=(e,t,n)=>{let r=t-e;return((n-e)%r+r)%r+e};function la(e,t){return he(e)?e[ca(0,e.length,t)]:e}var ua=class{constructor(e){this.stop=()=>this.runAll(`stop`),this.animations=e.filter(Boolean)}get finished(){return Promise.all(this.animations.map(e=>e.finished))}getAll(e){return this.animations[0][e]}setAll(e,t){for(let n=0;n<this.animations.length;n++)this.animations[n][e]=t}attachTimeline(e){let t=this.animations.map(t=>t.attachTimeline(e));return()=>{t.forEach((e,t)=>{e&&e(),this.animations[t].stop()})}}get time(){return this.getAll(`time`)}set time(e){this.setAll(`time`,e)}get speed(){return this.getAll(`speed`)}set speed(e){this.setAll(`speed`,e)}get state(){return this.getAll(`state`)}get startTime(){return this.getAll(`startTime`)}get duration(){return da(this.animations,`duration`)}get iterationDuration(){return da(this.animations,`iterationDuration`)}runAll(e){this.animations.forEach(t=>t[e]())}play(){this.runAll(`play`)}pause(){this.runAll(`pause`)}cancel(){this.runAll(`cancel`)}complete(){this.runAll(`complete`)}};function da(e,t){let n=0;for(let r=0;r<e.length;r++){let i=e[r][t];i!==null&&i>n&&(n=i)}return n}var fa=class extends ua{then(e,t){return this.finished.finally(e).then(()=>{})}};function pa(e,t){return e in t}var ma=class extends ee{constructor(){super(...arguments),this.type=`object`}readValueFromInstance(e,t){if(pa(t,e)){let n=e[t];if(typeof n==`string`||typeof n==`number`)return n}}getBaseTargetFromProps(){}removeValueFromRenderState(e,t){delete t.output[e]}measureInstanceViewportBox(){return ie()}build(e,t){Object.assign(e.output,t)}renderInstance(e,{output:t}){Object.assign(e,t)}sortInstanceNodePosition(){return 0}},ha=e=>!e.isLayoutDirty&&e.willUpdate(!1);function ga(){let e=new Set,t=new WeakMap,n=()=>e.forEach(ha);return{add:r=>{e.add(r),t.set(r,r.addEventListener(`willUpdate`,n))},remove:r=>{e.delete(r);let i=t.get(r);i&&(i(),t.delete(r)),n()},dirty:n}}var _a=(0,Z.createContext)(null);function va(){let e=(0,Z.useRef)(!1);return ke(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function ya(){let e=va(),[t,n]=(0,Z.useState)(0),r=(0,Z.useCallback)(()=>{e.current&&n(t+1)},[t]);return[(0,Z.useCallback)(()=>G.postRender(r),[r]),t]}var ba=e=>e===!0,xa=e=>ba(e===!0)||e===`id`,Sa=({children:e,id:t,inherit:n=!0})=>{let r=(0,Z.useContext)(me),i=(0,Z.useContext)(_a),[a,o]=ya(),s=(0,Z.useRef)(null),c=r.id||i;s.current===null&&(xa(n)&&c&&(t=t?c+`-`+t:c),s.current={id:t,group:ba(n)&&r.group||ga()});let l=(0,Z.useMemo)(()=>({...s.current,forceRender:a}),[o]);return(0,Q.jsx)(me.Provider,{value:l,children:e})};function Ca({children:e,...t}){let n=(0,Z.useContext)(Me);t={...n,...t},t.transition=ce(t.transition,n.transition),t.isStatic=De(()=>t.isStatic);let r=(0,Z.useMemo)(()=>t,[JSON.stringify(t.transition),t.transformPagePoint,t.reducedMotion,t.skipAnimations,t.isValidProp]);return(0,Q.jsx)(Me.Provider,{value:r,children:e})}function wa(e){return typeof e==`object`&&!Array.isArray(e)}function Ta(e,t,n,r){return e==null?[]:typeof e==`string`&&wa(t)?te(e,n,r):e instanceof NodeList?Array.from(e):Array.isArray(e)?e.filter(e=>e!=null):[e]}function Ea(e,t,n){return e*(t+1)+n*t}function Da(e,t,n,r){return typeof t==`number`?t:t.startsWith(`-`)||t.startsWith(`+`)?Math.max(0,e+parseFloat(t)):t===`<`?n:t.startsWith(`<`)?Math.max(0,n+parseFloat(t.slice(1))):r.get(t)??e}function Oa(e,t,n){for(let r=0;r<e.length;r++){let i=e[r];i.at>t&&i.at<n&&(xe(e,i),r--)}}function ka(e,t,n,r,i,a){Oa(e,i,a);for(let o=0;o<t.length;o++)e.push({value:t[o],at:fe(i,a,r[o]),easing:la(n,o)})}function Aa(e,t,n=0){let r=t+1+t*n;for(let t=0;t<e.length;t++)e[t]=e[t]/r}function ja(e,t){return e.at===t.at?e.value===null?1:t.value===null?-1:0:e.at-t.at}var Ma=`easeInOut`,Na=20;function Pa(e,{defaultTransition:t={},...n}={},r,i){let a=t.duration||.3,o=new Map,s=new Map,c={},l=new Map,u=0,d=0,f=0;for(let n=0;n<e.length;n++){let o=e[n];if(typeof o==`string`){l.set(o,d);continue}if(!Array.isArray(o)){l.set(o.name,Da(d,o.at,u,l));continue}let[p,m,h={}]=o;h.at!==void 0&&(d=Da(d,h.at,u,l));let g=0,_=(e,n,r,o=0,s=0)=>{let c=La(e),{delay:l=0,times:u=ne(c),type:p=t.type||`keyframes`,repeat:m,repeatType:h,repeatDelay:_=0,...v}=n,{ease:y=t.ease||`easeOut`,duration:b}=n,x=typeof l==`function`?l(o,s):l,S=c.length,C=le(p)?p:i?.[p||`keyframes`];if(S<=2&&C){let e=100;if(S===2&&Ba(c)){let t=c[1]-c[0];e=Math.abs(t)}let n={...t,...v};b!==void 0&&(n.duration=be(b));let r=ue(n,e,C);y=r.ease,b=r.duration}b??=a;let w=d+x;u.length===1&&u[0]===0&&(u[1]=1);let T=u.length-c.length;if(T>0&&Se(u,T),c.length===1&&c.unshift(null),m&&pe(m<Na,`Sequence segments can't repeat ${m} times — ignoring repeat option. Use a value below ${Na} or apply repeat at the sequence level instead.`),m&&m<Na){let e=b>0?_/b:0;b=Ea(b,m,_);let t=[...c],n=[...u];y=Array.isArray(y)?[...y]:[y];let r=[...y],i=h===`reverse`||h===`mirror`,a=t,o=r;i&&(a=[...t].reverse(),h===`reverse`&&(o=[...r].reverse().map(e=>typeof e==`function`?we(e):e)));for(let s=0;s<m;s++){let l=i&&s%2==0,d=l?a:t,f=l?o:r,p=(s+1)*(1+e);e>0&&(c.push(c[c.length-1]),u.push(p),y.push(`linear`)),c.push(...d);for(let e=0;e<d.length;e++)u.push(n[e]+p),y.push(e===0?`linear`:la(f,e-1))}Aa(u,m,e)}let E=w+b;ka(r,c,y,u,w,E),g=Math.max(x+b,g),f=Math.max(E,f)};if(Ee(p)){let e=Fa(p,s);_(m,h,Ia(`default`,e))}else{let e=Ta(p,m,r,c),t=e.length;for(let n=0;n<t;n++){m=m,h=h;let r=e[n],i=Fa(r,s);for(let e in m)_(m[e],Ra(h,e),Ia(e,i),n,t)}}u=d,d+=g}return s.forEach((e,r)=>{for(let i in e){let a=e[i];a.sort(ja);let s=[],c=[],l=[];for(let e=0;e<a.length;e++){let{at:t,value:n,easing:r}=a[e];s.push(n),c.push(Ce(0,f,t)),l.push(r||`easeOut`)}c[0]!==0&&(c.unshift(0),s.unshift(s[0]),l.unshift(Ma)),c[c.length-1]!==1&&(c.push(1),s.push(null)),o.has(r)||o.set(r,{keyframes:{},transition:{}});let u=o.get(r);u.keyframes[i]=s;let{type:d,...p}=t;u.transition[i]={...p,duration:f,ease:l,times:c,...n}}}),o}function Fa(e,t){return!t.has(e)&&t.set(e,{}),t.get(e)}function Ia(e,t){return t[e]||(t[e]=[]),t[e]}function La(e){return Array.isArray(e)?e:[e]}function Ra(e,t){return e&&e[t]?{...e,...e[t]}:{...e}}var za=e=>typeof e==`number`,Ba=e=>e.every(za);function Va(e){let t={presenceContext:null,props:{},visualState:{renderState:{transform:{},transformOrigin:{},style:{},vars:{},attrs:{}},latestValues:{}}},n=oe(e)&&!ae(e)?new ge(t):new Te(t);n.mount(e),ve.set(e,n)}function Ha(e){let t=new ma({presenceContext:null,props:{},visualState:{renderState:{output:{}},latestValues:{}}});t.mount(e),ve.set(e,t)}function Ua(e,t){return Ee(e)||typeof e==`number`||typeof e==`string`&&!wa(t)}function Wa(e,t,n,r){let i=[];if(Ua(e,t))i.push(ye(e,wa(t)&&t.default||t,n&&(n.default||n)));else{if(e==null)return i;let a=Ta(e,t,r),o=a.length;_e(!!o,`No valid elements provided.`,`no-valid-elements`);for(let e=0;e<o;e++){let r=a[e],s=r instanceof Element?Va:Ha;ve.has(r)||s(r);let c=ve.get(r),l={...n};`delay`in l&&typeof l.delay==`function`&&(l.delay=l.delay(e,o)),i.push(...re(c,{...t,transition:l},{}))}}return i}function Ga(e,t,n){let r=[];return Pa(e.map(e=>{if(Array.isArray(e)&&typeof e[0]==`function`){let t=e[0],n=se(0);return n.on(`change`,t),e.length===1?[n,[0,1]]:e.length===2?[n,[0,1],e[1]]:[n,e[1],e[2]]}return e}),t,n,{spring:de}).forEach(({keyframes:e,transition:t},n)=>{r.push(...Wa(n,e,t))}),r}function Ka(e){return Array.isArray(e)&&e.some(Array.isArray)}function qa(e={}){let{scope:t,reduceMotion:n,skipAnimations:r}=e;function i(e,i,a){let o=[],s,c={};if(n!==void 0&&(c.reduceMotion=n),r!==void 0&&(c.skipAnimations=r),Ka(e)){let{onComplete:n,...r}=i||{};typeof n==`function`&&(s=n),o=Ga(e,{...c,...r},t)}else{let{onComplete:n,...r}=a||{};typeof n==`function`&&(s=n),o=Wa(e,i,{...c,...r},t)}let l=new fa(o);return s&&l.finished.then(s),t&&(t.animations.push(l),l.finished.then(()=>{xe(t.animations,l)})),l}return i}var Ja=qa(),Ya=Ln(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),Xa=Ln(`bookmark`,[[`path`,{d:`M17 3a2 2 0 0 1 2 2v15a1 1 0 0 1-1.496.868l-4.512-2.578a2 2 0 0 0-1.984 0l-4.512 2.578A1 1 0 0 1 5 20V5a2 2 0 0 1 2-2z`,key:`oz39mx`}]]),Za=Ln(`chevrons-up-down`,[[`path`,{d:`m7 15 5 5 5-5`,key:`1hf1tw`}],[`path`,{d:`m7 9 5-5 5 5`,key:`sgt6xg`}]]),Qa=Ln(`circle-question-mark`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),$a=Ln(`circle-stop`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`rect`,{x:`9`,y:`9`,width:`6`,height:`6`,rx:`1`,key:`1ssd4o`}]]),eo=Ln(`clock-3`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6h4`,key:`135r8i`}]]),to=Ln(`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`}]]),no=Ln(`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`}]]),ro=Ln(`file-plus-corner`,[[`path`,{d:`M11.35 22H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v5.35`,key:`17jvcc`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M14 19h6`,key:`bvotb8`}],[`path`,{d:`M17 16v6`,key:`18yu1i`}]]),io=Ln(`folder-plus`,[[`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`}]]),ao=Ln(`folder-tree`,[[`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`}]]),oo=Ln(`list-restart`,[[`path`,{d:`M21 5H3`,key:`1fi0y6`}],[`path`,{d:`M7 12H3`,key:`13ou7f`}],[`path`,{d:`M7 19H3`,key:`wbqt3n`}],[`path`,{d:`M12 18a5 5 0 0 0 9-3 4.5 4.5 0 0 0-4.5-4.5c-1.33 0-2.54.54-3.41 1.41L11 14`,key:`qth677`}],[`path`,{d:`M11 10v4h4`,key:`172dkj`}]]),so=Ln(`message-square-plus`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}],[`path`,{d:`M12 8v6`,key:`1ib9pf`}],[`path`,{d:`M9 11h6`,key:`1fldmi`}]]),co=Ln(`message-square-text`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}],[`path`,{d:`M7 11h10`,key:`1twpyw`}],[`path`,{d:`M7 15h6`,key:`d9of3u`}],[`path`,{d:`M7 7h8`,key:`af5zfr`}]]),lo=Ln(`panel-right`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}]]),uo=Ln(`pin`,[[`path`,{d:`M12 17v5`,key:`bb1du9`}],[`path`,{d:`M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z`,key:`1nkz8b`}]]),fo=Ln(`settings-2`,[[`path`,{d:`M14 17H5`,key:`gfn3mx`}],[`path`,{d:`M19 7h-9`,key:`6i9tg`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}],[`circle`,{cx:`7`,cy:`7`,r:`3`,key:`dfmy0x`}]]),po=Ln(`square-pen`,[[`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`}]]),mo=Ln(`thumbs-down`,[[`path`,{d:`M9 18.12 10 14H4.17a2 2 0 0 1-1.92-2.56l2.33-8A2 2 0 0 1 6.5 2H20a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2.76a2 2 0 0 0-1.79 1.11L12 22a3.13 3.13 0 0 1-3-3.88Z`,key:`m61m77`}],[`path`,{d:`M17 14V2`,key:`8ymqnk`}]]),ho=Ln(`thumbs-up`,[[`path`,{d:`M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z`,key:`emmmcr`}],[`path`,{d:`M7 10v12`,key:`1qc93n`}]]),go=Ln(`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`}]]);function _o(e){return`agent-tab-${encodeURIComponent(e)}`}function vo(e){return`agent-tab-panel-${encodeURIComponent(e)}`}function yo(e){switch(e){case`queued`:return`queued`;case`running`:case`recovering`:return`streaming`;case`error`:case`failed`:return`error`;case`cancelled`:return`cancelled`;case`done`:return`complete`;default:return`ready`}}function bo(e){switch(e){case`running`:case`recovering`:return`bg-emerald-400 motion-safe:animate-pulse`;case`error`:case`failed`:return`bg-destructive`;case`queued`:return`bg-amber-300`;case`cancelled`:return`bg-foreground/35`;default:return`bg-foreground/35`}}function xo({tabs:e,value:t,onValueChange:n,onClose:r,onNewSession:i}){let a=(0,Z.useRef)(new Map),o=(0,Z.useCallback)((e,t)=>{t?a.current.set(e,t):a.current.delete(e)},[]);(0,Z.useEffect)(()=>{for(let t of a.current.keys())e.some(e=>e.id===t)||a.current.delete(t)},[e]);let s=(0,Z.useCallback)(t=>{let r=e[t];r&&(a.current.get(r.id)?.focus(),n(r.id))},[n,e]),c=(0,Z.useCallback)((t,n)=>{let r=e.findIndex(e=>e.id===n);if(r<0)return;let i;t.key===`ArrowRight`&&(i=(r+1)%e.length),t.key===`ArrowLeft`&&(i=(r-1+e.length)%e.length),t.key===`Home`&&(i=0),t.key===`End`&&(i=e.length-1),i!==void 0&&(t.preventDefault(),s(i))},[s,e]);return(0,Q.jsxs)(`div`,{className:`flex min-w-0 max-w-full items-center gap-1`,"data-testid":`agent-tab-bar`,children:[(0,Q.jsx)(`div`,{"aria-label":`Agent conversations`,className:`flex min-w-0 flex-1 items-center gap-1 overflow-x-auto overscroll-contain [scrollbar-width:none] [&::-webkit-scrollbar]:hidden`,role:`tablist`,children:e.map(e=>{let i=e.id===t,a=yo(e.status);return(0,Q.jsxs)(`div`,{className:`group/tab relative min-w-0 shrink-0 basis-[164px] sm:max-w-[164px]`,"data-tab-id":e.id,children:[(0,Q.jsxs)(V,{ref:t=>o(e.id,t),"aria-controls":vo(e.id),"aria-selected":i,"aria-label":`${e.label}, ${a}`,className:q(`h-7 w-full min-w-0 justify-start gap-1.5 rounded-[7px] border border-transparent px-2 text-[12px] font-medium leading-none transition-colors motion-reduce:transition-none`,i?`bg-[#2c2c2c] text-foreground shadow-none`:`bg-transparent text-foreground/45 hover:bg-foreground/5 hover:text-foreground/75`,e.kind===`subagent`&&`pr-7`),"data-state":i?`active`:`inactive`,id:_o(e.id),onClick:()=>n(e.id),onKeyDown:t=>c(t,e.id),role:`tab`,size:`sm`,tabIndex:i?0:-1,type:`button`,variant:`ghost`,children:[e.kind===`main`?(0,Q.jsx)(Xn,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}):(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:q(`size-1.5 shrink-0 rounded-full`,bo(e.status))}),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.label})]}),e.kind===`subagent`&&r?(0,Q.jsx)(V,{"aria-label":`Close ${e.label} tab`,className:`absolute top-1/2 right-1 size-5 -translate-y-1/2 rounded-[5px] p-0 text-foreground/35 opacity-0 transition-opacity motion-reduce:transition-none hover:bg-foreground/10 hover:text-foreground/75 focus-visible:opacity-100 group-hover/tab:opacity-100`,onClick:t=>{t.stopPropagation(),r(e.id)},size:`icon-xs`,title:`Close ${e.label} tab`,type:`button`,variant:`ghost`,children:(0,Q.jsx)(Wr,{"aria-hidden":`true`,className:`size-3`})}):null]},e.id)})}),i?(0,Q.jsx)(V,{"aria-label":`New chat`,className:`size-7 shrink-0 rounded-[7px] text-foreground/50 hover:bg-foreground/7 hover:text-foreground/85`,"data-testid":`new-chat-tab`,onClick:i,size:`icon-sm`,title:`New chat`,type:`button`,variant:`ghost`,children:(0,Q.jsx)(Lr,{"aria-hidden":`true`,className:`size-3.5`})}):null]})}function So({children:e,dataTestid:t,headerLeading:n,loading:r,onClose:i,onRefresh:a,onResizeStart:o,open:s,headerActions:c,title:l,titleIcon:u,width:d}){let f=Ge(),p=(0,Z.useRef)(null);return(0,Z.useEffect)(()=>{s&&p.current?.focus({preventScroll:!0})},[s]),(0,Q.jsx)(y,{features:_,children:(0,Q.jsx)(We,{children:s&&(0,Q.jsxs)(K.aside,{ref:p,initial:!f&&{x:d,opacity:.8},animate:{x:0,opacity:1},exit:f?{opacity:0}:{x:d,opacity:.8},transition:f?{duration:0}:{duration:.2,ease:`easeInOut`},className:`relative h-full shrink-0 border-l border-border/70 bg-background/95 outline-none hidden min-[960px]:flex`,"data-fleet-panel-focus":!0,"data-testid":t,style:{width:d},tabIndex:-1,role:`dialog`,"aria-label":l,onKeyDown:e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),i())},children:[(0,Q.jsx)(`button`,{type:`button`,"aria-label":`Resize ${l} panel`,className:`absolute top-0 bottom-0 left-0 z-10 w-2 -translate-x-1 cursor-col-resize touch-none bg-transparent transition-colors outline-none hover:bg-foreground/10 focus-visible:bg-foreground/10`,"data-testid":`pi-resources-resize-handle`,onPointerDown:o}),(0,Q.jsxs)(`div`,{className:`flex h-full min-w-0 flex-1 flex-col overflow-hidden`,children:[(0,Q.jsxs)(`div`,{className:`flex h-[60px] min-w-0 shrink-0 items-center justify-between gap-2 border-b border-border/60 px-3 py-1`,children:[(0,Q.jsx)(`div`,{className:`min-w-0 flex-1`,children:n??(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 text-[13px] font-medium text-foreground/80`,children:[(0,Q.jsx)(u,{className:`size-3.5 shrink-0`}),(0,Q.jsx)(`span`,{children:l})]})}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[c,(0,Q.jsx)(V,{type:`button`,onClick:a,disabled:!a,variant:`ghost`,size:`icon-sm`,className:`relative after:absolute after:inset-x-0 after:-top-1.5 after:-bottom-1.5 text-foreground/40 hover:text-foreground/70 disabled:cursor-not-allowed disabled:opacity-35`,"aria-label":`Refresh ${l}`,title:`Refresh ${l}`,children:(0,Q.jsx)(Rr,{"data-icon":`inline-start`,className:`size-3.5 ${r?`animate-spin`:``}`})}),(0,Q.jsx)(V,{type:`button`,onClick:i,variant:`ghost`,size:`icon-sm`,className:`relative after:absolute after:inset-x-0 after:-top-1.5 after:-bottom-1.5 text-foreground/40 hover:text-foreground/70`,"aria-label":`Close panel`,title:`Close panel`,children:(0,Q.jsx)(Wr,{"data-icon":`inline-start`,className:`size-3.5`})})]})]}),(0,Q.jsx)(`div`,{className:`flex-1 overflow-y-auto px-3 py-2`,children:e})]})]})})})}var Co=Z.createContext(void 0);function wo(){let e=Z.useContext(Co);if(e===void 0)throw Error(rt(64));return e}var To={tabActivationDirection:e=>({"data-activation-direction":e})},Eo=Z.forwardRef(function(e,t){let{className:n,defaultValue:r=0,onValueChange:i,orientation:a=`horizontal`,render:o,value:s,style:c,...l}=e,u=e.defaultValue!==void 0,d=Z.useRef([]),[f,p]=Z.useState(()=>new Map),[m,h]=Jr({controlled:s,default:r,name:`Tabs`,state:`value`}),g=s!==void 0,[_,v]=Z.useState(()=>new Map),y=Z.useRef(void 0),b=Z.useCallback(e=>Do(_,e),[_]),[x,S]=Z.useState(()=>({previousValue:m,tabActivationDirection:`none`})),{previousValue:C,tabActivationDirection:w}=x,T=w,E=!1;C!==m&&(T=Oo(C,m,a,_),E=C!=null&&m!=null&&b(m)==null);let D=E?C:m,O=C!==D||w!==T;ot(()=>{O&&S({previousValue:D,tabActivationDirection:T})},[D,O,T]);let k=Qe((e,t)=>{t.activationDirection=Oo(m,e,a,_),i?.(e,t),!t.isCanceled&&h(e)}),A=Qe((e,t)=>{i?.(e,lt(t,void 0,void 0,{activationDirection:`none`}))}),j=Qe((e,t)=>(p(n=>{let r=new Map(n);return r.set(e,t),r}),()=>{p(n=>{if(n.get(e)!==t)return n;let r=new Map(n);return r.delete(e),r})})),M=Z.useCallback(e=>f.get(e),[f]),N=Z.useCallback(e=>{for(let t of _.values())if(e===t.value)return t.id},[_]),P=Z.useMemo(()=>({getTabElementBySelectedValue:b,getTabIdByPanelValue:N,getTabPanelIdByValue:M,onValueChange:k,orientation:a,registerMountedTabPanel:j,setTabMap:v,tabActivationDirection:T,value:m}),[b,N,M,k,a,j,v,T,m]),F=Z.useMemo(()=>{for(let e of _.values())if(e.value===m)return e},[_,m]),I=Z.useMemo(()=>{for(let e of _.values())if(!e.disabled)return e.value},[_]),L=Z.useRef(!u),R=Z.useRef(r),z=Z.useRef(u),B=Z.useRef(!1);ot(()=>{if(g)return;function e(e,t){h(e),S({previousValue:e,tabActivationDirection:`none`}),A(e,t),L.current=!1}if(_.size===0){B.current&&m!==null&&!y.current?.isConnected&&e(null,Ze);return}B.current=!0,y.current=_.keys().next().value;let t=F?.disabled,n=F==null&&m!==null;if(!t&&m===R.current&&(z.current=!1),z.current&&t&&m===R.current)return;let r=L.current;if(t||n){let n=I??null;if(m===n){L.current=!1;return}let i=Ze;r?i=Xe:t&&(i=tt),e(n,i);return}r&&F!=null&&(A(m,Xe),L.current=!1)},[I,g,A,F,h,_,m]);let V=Je(`div`,e,{state:{orientation:a,tabActivationDirection:T},ref:t,props:l,stateAttributesMapping:To});return(0,Q.jsx)(Co.Provider,{value:P,children:(0,Q.jsx)(en,{elementsRef:d,children:V})})});function Do(e,t){for(let[n,r]of e.entries())if(t===r.value)return n;return null}function Oo(e,t,n,r){if(e==null||t==null)return`none`;let[i,a,o]=n===`horizontal`?[`left`,`left`,`right`]:[`top`,`up`,`down`],s=Do(r,e),c=Do(r,t);if(s==null||c==null)return s!==c&&(typeof e==`number`||typeof e==`string`)&&typeof e==typeof t?t>e?o:a:`none`;let l=s.getBoundingClientRect()[i],u=c.getBoundingClientRect()[i];return u<l?a:u>l?o:`none`}var ko=`data-composite-item-active`;function Ao(e={}){let{highlightItemOnHover:t,highlightedIndex:n,onHighlightedIndexChange:r}=ft(),{ref:i,index:a}=an(e),o=n===a,s=Z.useRef(null),c=nt(i,s);return{compositeProps:{tabIndex:o?0:-1,onFocus(){r(a)},onMouseMove(){let e=s.current;if(!t||!e)return;let n=e.hasAttribute(`disabled`)||e.ariaDisabled===`true`;!o&&!n&&e.focus()}},compositeRef:c,index:a}}var jo=Z.createContext(void 0);function Mo(){let e=Z.useContext(jo);if(e===void 0)throw Error(rt(65));return e}var No=Z.forwardRef(function(e,t){let{className:n,disabled:r=!1,render:i,value:a,id:o,nativeButton:s=!0,style:c,...l}=e,{value:u,getTabPanelIdByValue:d,onValueChange:f,orientation:p,tabActivationDirection:m}=wo(),{activateOnFocus:h,registerTabResizeObserverElement:g,tabsListElement:_}=Mo(),{highlightedIndex:v,onHighlightedIndexChange:y}=ft(),b=pn(o),{compositeProps:x,compositeRef:S,index:C}=Ao({metadata:Z.useMemo(()=>({disabled:r,id:b,value:a}),[r,b,a])}),T=a===u,E=Z.useRef(!1),D=Z.useRef(null),O=Qe(e=>{D.current?.(),D.current=e?g(e):null});ot(()=>{if(E.current){E.current=!1;return}if(!(T&&C>-1&&v!==C))return;let e=_;if(e!=null){let t=W(N(e));if(t&&w(e,t))return}r||y(C)},[T,C,v,y,r,_]);let{getButtonProps:k,buttonRef:A}=ut({disabled:r,native:s,focusableWhenDisabled:!0}),j=d(a),M=Z.useRef(!1),P=Z.useRef(!1);function F(e){f(a,lt($e,e.nativeEvent,void 0,{activationDirection:`none`}))}function I(e){T||r||F(e)}function L(e){T||r||h&&(!M.current||P.current)&&F(e)}function R(e){if(T||r)return;M.current=!0,P.current=e.button===0;let t=N(e.currentTarget);function n(){M.current=!1,P.current=!1,t.removeEventListener(`pointerup`,n),t.removeEventListener(`pointercancel`,n)}t.addEventListener(`pointerup`,n),t.addEventListener(`pointercancel`,n)}return Je(`button`,e,{state:{disabled:r,active:T,orientation:p,tabActivationDirection:m},ref:[t,A,S,O],props:[x,{role:`tab`,"aria-controls":j,"aria-selected":T,id:b,onClick:I,onFocus:L,onPointerDown:R,[ko]:T?``:void 0,onKeyDownCapture(){E.current=!0}},l,k],stateAttributesMapping:To})}),Po=[];function Fo(e){let{loopFocus:t=!0,orientation:n=`both`,grid:r,onLoop:i,direction:a,highlightedIndex:o,onHighlightedIndexChange:s,rootRef:c,enableHomeAndEndKeys:l=!1,stopEventPropagation:u,disabledIndices:d,modifierKeys:f=Po}=e,[p,m]=Z.useState(0),h=r!=null,g=Z.useRef(null),_=nt(g,c),v=Z.useRef([]),y=Z.useRef(!1),b=o??p,x=Qe((e,t=!1)=>{if((s??m)(e),t){let t=v.current[e];Ot(g.current,t,a,n)}}),S=Qe(e=>{if(e.size===0||y.current)return;y.current=!0;let t=Array.from(e.keys()),r=t.find(e=>e?.hasAttribute(`data-composite-item-active`))??null,i=r?e.get(r)?.index??-1:-1;if(i!==-1)x(i);else if(C(t,b,d)){let e=k(t,{disabledIndices:d});F(t,e)||x(e)}Ot(g.current,r,a,n)});ot(()=>{if(d==null||o!=null||!y.current)return;let e=v.current;if(C(e,b,d)){let t=k(e,{disabledIndices:d});F(e,t)||x(t)}},[d,o,b,v,x]);let w=Qe((e,t,n)=>i?i(e,t,n,v):n),D=Qe(e=>{let o=e.key===`Home`||e.key===`End`;if(!Zt.has(e.key)||!l&&o||Io(e,f)||!g.current)return;let s=a===`rtl`,c=s?Qt:Mt,p=s?Mt:Qt,m=n===`vertical`?Bt:c,_=n===`vertical`?gt:p,y=A(e.nativeEvent);if(y!=null&&_t(y)&&!sn(y)){let t=y.selectionStart,n=y.selectionEnd,r=y.value;if(t==null||e.shiftKey||t!==n||e.key!==_&&t<r.length||e.key!==m&&t>0)return}let S=b,C=T(v,d),D=E(v,d);r!=null&&(S=r({disabledIndices:d,elementsRef:v,event:e,highlightedIndex:b,loopFocus:t,maxIndex:D,minIndex:C,onLoop:w,orientation:n,rtl:s}));let O=n!==`vertical`&&e.key===c||n!==`horizontal`&&e.key===`ArrowDown`,j=n!==`vertical`&&e.key===p||n!==`horizontal`&&e.key===`ArrowUp`;l&&(e.key===`Home`?S=C:e.key===`End`&&(S=D)),S===b&&(O||j)&&(t&&S===D&&O?(S=C,i&&(S=i(e,b,S,v))):t&&S===C&&j?(S=D,i&&(S=i(e,b,S,v))):S=k(v.current,{startingIndex:S,decrement:j,disabledIndices:d})),S!==b&&!F(v.current,S)&&(u&&e.stopPropagation(),(h||o||O||j)&&e.preventDefault(),x(S,!0),queueMicrotask(()=>{v.current[S]?.focus()}))});return{props:{ref:_,onFocus(e){let t=g.current,n=A(e.nativeEvent);!t||n==null||!_t(n)||n.setSelectionRange(0,n.value.length)},onKeyDown:D},highlightedIndex:b,onHighlightedIndexChange:x,elementsRef:v,onMapChange:S,relayKeyboardEvent:D}}function Io(e,t){for(let n of vt)if(!t.includes(n)&&e.getModifierState(n))return!0;return!1}function Lo(e){let{render:t,className:n,style:r,refs:i=at,props:a=at,state:o=ct,stateAttributesMapping:s,highlightedIndex:c,onHighlightedIndexChange:l,orientation:u,grid:d,loopFocus:f,onLoop:p,enableHomeAndEndKeys:m,onMapChange:h,stopEventPropagation:g=!0,rootRef:_,disabledIndices:v,modifierKeys:y,highlightItemOnHover:b=!1,tag:x=`div`,...S}=e,{props:C,highlightedIndex:w,onHighlightedIndexChange:T,elementsRef:E,onMapChange:D,relayKeyboardEvent:O}=Fo({grid:d,loopFocus:f,onLoop:p,orientation:u,highlightedIndex:c,onHighlightedIndexChange:l,rootRef:_,stopEventPropagation:g,enableHomeAndEndKeys:m,direction:dn(),disabledIndices:v,modifierKeys:y}),k=Je(x,e,{state:o,ref:i,props:[C,...a,S],stateAttributesMapping:s}),A=Z.useMemo(()=>({highlightedIndex:w,onHighlightedIndexChange:T,highlightItemOnHover:b,relayKeyboardEvent:O}),[w,T,b,O]);return(0,Q.jsx)(Ye.Provider,{value:A,children:(0,Q.jsx)(en,{elementsRef:E,onMapChange:e=>{h?.(e),D(e)},children:k})})}var Ro=Z.forwardRef(function(e,t){let{activateOnFocus:n=!1,className:r,loopFocus:i=!0,render:a,style:o,...s}=e,{orientation:c,setTabMap:l,tabActivationDirection:u}=wo(),[d,f]=Z.useState(0),[p,m]=Z.useState(null),h=Z.useRef(new Set),g=Z.useRef(new Set),_=Z.useRef(null);ot(()=>{if(typeof ResizeObserver>`u`)return;let e=new ResizeObserver(()=>{h.current.forEach(e=>{e()})});return _.current=e,p&&e.observe(p),g.current.forEach(t=>{e.observe(t)}),()=>{e.disconnect(),_.current=null}},[p]);let v=Qe(e=>(h.current.add(e),()=>{h.current.delete(e)})),y=Qe(e=>(g.current.add(e),_.current?.observe(e),()=>{g.current.delete(e),_.current?.unobserve(e)})),b={orientation:c,tabActivationDirection:u},x={"aria-orientation":c===`vertical`?`vertical`:void 0,role:`tablist`},S=Z.useMemo(()=>({activateOnFocus:n,registerIndicatorUpdateListener:v,registerTabResizeObserverElement:y,tabsListElement:p}),[n,v,y,p]);return(0,Q.jsx)(jo.Provider,{value:S,children:(0,Q.jsx)(Lo,{render:a,className:r,style:o,state:b,refs:[t,m],props:[x,s],stateAttributesMapping:To,highlightedIndex:d,enableHomeAndEndKeys:!0,loopFocus:i,orientation:c,onHighlightedIndexChange:f,onMapChange:l,disabledIndices:at})})});function zo({className:e,orientation:t=`horizontal`,...n}){return(0,Q.jsx)(Eo,{"data-slot":`tabs`,"data-orientation":t,className:q(`group/tabs flex gap-2 data-horizontal:flex-col`,e),...n})}var Bo=L(`group/tabs-list inline-flex w-fit items-center justify-center rounded-lg p-[3px] text-muted-foreground group-data-horizontal/tabs:h-8 group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col data-[variant=line]:rounded-none`,{variants:{variant:{default:`bg-muted`,line:`gap-1 bg-transparent`}},defaultVariants:{variant:`default`}});function Vo({className:e,variant:t=`default`,...n}){return(0,Q.jsx)(Ro,{"data-slot":`tabs-list`,"data-variant":t,className:q(Bo({variant:t}),e),...n})}function Ho({className:e,...t}){return(0,Q.jsx)(No,{"data-slot":`tabs-trigger`,className:q(`relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-sm font-medium whitespace-nowrap text-foreground/60 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 aria-disabled:pointer-events-none aria-disabled:opacity-50 dark:text-muted-foreground dark:hover:text-foreground group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,`group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent`,`data-active:bg-background data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 dark:data-active:text-foreground`,`after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-right-1 group-data-vertical/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100`,e),...t})}function Uo(e,t={}){let{axis:n=`y`}=t,r=(0,Z.useRef)(new Map),i=(0,Z.useRef)(new Map),[a,o]=(0,Z.useState)(null),[s,c]=(0,Z.useState)([]),l=(0,Z.useRef)([]),u=(0,Z.useRef)(null),d=(0,Z.useRef)(null),f=(0,Z.useCallback)(()=>{if(!e.current)return;let t=[];r.current.forEach((e,n)=>{t[n]={top:e.offsetTop,height:e.offsetHeight,left:e.offsetLeft,width:e.offsetWidth}});let n=l.current,i=n.length!==t.length;for(let e=0;!i&&e<t.length;e++){let r=n[e],a=t[e];r!==a&&(i=!r||!a||r.top!==a.top||r.left!==a.left||r.width!==a.width||r.height!==a.height)}i&&(l.current=t,c(t))},[e]),p=(0,Z.useCallback)(()=>{d.current!==null&&cancelAnimationFrame(d.current),d.current=requestAnimationFrame(()=>{d.current=null,f()})},[f]),m=(0,Z.useCallback)((e,t)=>{let n=i.current.get(e);if(n&&(n.disconnect(),i.current.delete(e)),t){if(r.current.set(e,t),typeof ResizeObserver<`u`){let n=new ResizeObserver(()=>p());n.observe(t),i.current.set(e,n)}}else r.current.delete(e);p()},[p]),h=(0,Z.useCallback)(t=>{let r=t.clientX,i=t.clientY;u.current!==null&&cancelAnimationFrame(u.current),u.current=requestAnimationFrame(()=>{u.current=null;let t=e.current;if(!t)return;let a=t.getBoundingClientRect(),s=n===`x`?r:i,c=null,d=1/0,f=null,p=l.current,m=n===`x`?t.scrollLeft:t.scrollTop,h=n===`x`?t.clientLeft:t.clientTop,g=n===`x`?a.left:a.top,_=n===`x`?t.offsetWidth:t.offsetHeight,v=n===`x`?a.width:a.height,y=_>0?v/_:1;for(let e=0;e<p.length;e++){let t=p[e];if(!t)continue;let r=g+(h+(n===`x`?t.left:t.top)-m)*y,i=(n===`x`?t.width:t.height)*y,a=r+i;s>=r&&s<=a&&(f=e);let o=r+i/2,l=Math.abs(s-o);l<d&&(d=l,c=e)}o(f??c)})},[n,e]),g=(0,Z.useCallback)(()=>{u.current!==null&&(cancelAnimationFrame(u.current),u.current=null),o(null)},[]);return(0,Z.useEffect)(()=>{let t=e.current;if(!t||typeof ResizeObserver>`u`)return;let n=new ResizeObserver(()=>p());return n.observe(t),()=>n.disconnect()},[e,p]),(0,Z.useEffect)(()=>()=>{u.current!==null&&cancelAnimationFrame(u.current),d.current!==null&&cancelAnimationFrame(d.current),i.current.forEach(e=>{e.disconnect()}),i.current.clear()},[]),{activeIndex:a,setActiveIndex:o,itemRects:s,onMouseMove:h,onMouseLeave:g,registerItem:m,measureItems:f}}var Wo={normal:`'wght' 400, 'opsz' 14`,medium:`'wght' 450, 'opsz' 15`,semibold:`'wght' 550, 'opsz' 20`,bold:`'wght' 700, 'opsz' 25`},Go={fast:{enter:{type:`spring`,duration:.08,bounce:0},exit:{duration:.06}},moderate:{enter:{type:`spring`,duration:.16,bounce:0},exit:{duration:.12}},slow:{enter:{type:`spring`,duration:.24,bounce:.12},exit:{duration:.16}}},Ko=`bg-background shadow-sm`,qo=`rounded-full border border-border/70 bg-sidebar p-0.5 shadow-sm backdrop-blur`,Jo=`rounded-full`;function Yo(e,t){return t?e?`text-foreground/75`:`text-foreground`:e?`text-foreground/55`:`text-muted-foreground`}var Xo=(0,Z.createContext)(null);function Zo(){let e=(0,Z.useContext)(Xo);if(!e)throw Error(`useTabsSubtle must be used within a TabsSubtle`);return e}function Qo({selectedRect:e,hoverRect:t,focusRect:n,isHovering:r,isHoveringSelected:i}){let a=Ge()?{duration:0}:void 0;return(0,Q.jsxs)(y,{features:_,children:[e?(0,Q.jsx)(K.div,{className:q(`pointer-events-none absolute`,Ko,Jo),layout:!0,initial:!1,style:{left:e.left,top:e.top,width:e.width,height:e.height},animate:{opacity:r?.8:1},transition:a??{...Go.moderate.enter,opacity:{duration:.08}}}):null,(0,Q.jsx)(We,{children:t&&!i?(0,Q.jsx)(K.div,{className:q(`pointer-events-none absolute`,Ko,Jo),layout:!0,style:{left:t.left,top:t.top,width:t.width,height:t.height},initial:{opacity:0},animate:{opacity:.4},exit:{opacity:0,transition:a??Go.fast.exit},transition:a??{...Go.fast.enter,opacity:{duration:.08}}}):null}),(0,Q.jsx)(We,{children:n?(0,Q.jsx)(K.div,{className:q(`pointer-events-none absolute z-20 border border-ring`,Jo),layout:!0,initial:!1,style:{left:n.left-2,top:n.top-2,width:n.width+4,height:n.height+4},exit:{opacity:0,transition:a??Go.fast.exit},transition:a??{...Go.fast.enter,opacity:{duration:.08}}}):null})]})}var $o=(0,Z.forwardRef)(({children:e,selectedIndex:t,onSelect:n,idPrefix:r,activeLabel:i=!1,variant:a=`default`,className:o,...s},c)=>{let l=(0,Z.useRef)(null),u=(0,Z.useRef)(!1),d=a===`pill`,{activeIndex:f,setActiveIndex:p,itemRects:m,onMouseMove:h,onMouseLeave:g,registerItem:_}=Uo(l,{axis:`x`}),v=(0,Z.useCallback)((e,t)=>{_(e,t)},[_]),y=(0,Z.useCallback)(e=>{u.current=!0,h(e)},[h]),b=(0,Z.useCallback)(()=>{u.current=!1,g()},[g]),[x,S]=(0,Z.useState)(null),C=t>=0?m[t]:void 0,w=f===null?null:m[f],T=x===null?null:m[x],E=f===t,D=f!==null&&!E,O=(0,Z.useMemo)(()=>({registerTab:v,hoveredIndex:f,selectedIndex:t,idPrefix:r,activeLabel:i,variant:a,onSelect:n}),[v,f,t,r,i,a,n]);return(0,Q.jsx)(Xo.Provider,{value:O,children:(0,Q.jsx)(zo,{className:`data-horizontal:!flex-row !gap-0.5`,value:t>=0?t:null,onValueChange:e=>{let t=typeof e==`number`?e:Number(e);Number.isInteger(t)&&n(t)},render:(0,Q.jsxs)(Vo,{activateOnFocus:!1,variant:`line`,ref:e=>{l.current=e,typeof c==`function`?c(e):c&&(c.current=e)},onMouseMove:y,onMouseLeave:b,onFocus:e=>{let t=e.target.closest(`[data-proximity-index]`)?.getAttribute(`data-proximity-index`);if(t!=null){let n=Number(t);p(n),S(e.target.matches(`:focus-visible`)?n:null)}},onBlur:e=>{l.current?.contains(e.relatedTarget)||(S(null),!u.current&&p(null))},className:q(`relative flex max-w-full [scrollbar-width:none] items-center gap-0.5 overflow-x-auto select-none [-ms-overflow-style:none] [&::-webkit-scrollbar]:hidden`,d?qo:`-mx-1 -my-1 px-1 py-1`,o),...s,children:[(0,Q.jsx)(Qo,{selectedRect:C,hoverRect:w,focusRect:T,isHovering:D,isHoveringSelected:E}),e]})})})});$o.displayName=`TabsSubtle`;var es=(0,Z.forwardRef)(({icon:e,label:t,index:n,badge:r,className:i,"aria-label":a,onClick:o,...s},c)=>{let l=(0,Z.useRef)(null),{registerTab:u,hoveredIndex:d,selectedIndex:f,idPrefix:p,activeLabel:m,variant:h,onSelect:g}=Zo();(0,Z.useEffect)(()=>(u(n,l.current),()=>u(n,null)),[n,u]);let v=f===n,b=d===n||v,x=m&&!!e,S=!x||v,C=h===`pill`,w=Yo(C,b),T=a??(x&&!S?t:void 0),E=(0,Q.jsxs)(`span`,{className:q(`inline-grid whitespace-nowrap`,C?`text-[12px] font-medium`:`text-[13px]`),children:[(0,Q.jsx)(`span`,{className:`invisible col-start-1 row-start-1 [text-box:trim-both_cap_alphabetic]`,style:{fontVariationSettings:Wo.semibold},"aria-hidden":`true`,children:t}),(0,Q.jsx)(`span`,{className:q(`col-start-1 row-start-1 transition-[color,font-variation-settings] duration-80 [text-box:trim-both_cap_alphabetic]`,w),style:{fontVariationSettings:v?Wo.semibold:Wo.normal},children:t})]});return(0,Q.jsxs)(Ho,{ref:e=>{let t=e;l.current=t,typeof c==`function`?c(t):c&&(c.current=t)},value:n,"data-proximity-index":n,id:p?`${p}-tab-${n}`:void 0,"aria-controls":p?`${p}-panel-${n}`:void 0,"aria-label":T,className:q(`relative z-10 flex flex-none cursor-pointer items-center border-none !bg-transparent !shadow-none outline-none after:hidden`,C?`h-8 px-2.5`:x?`h-8 px-3`:`h-9 gap-2 px-3`,Jo,i),...s,onClick:e=>{o?.(e),v&&g(n)},children:[e?(0,Q.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1`,children:[(0,Q.jsx)(e,{"data-icon":`inline-start`,size:C?14:16,strokeWidth:b?2:1.5,className:q(`shrink-0 transition-[color,stroke-width] duration-80`,w)}),r===void 0?null:(0,Q.jsx)(`span`,{className:q(`text-[11px] tabular-nums transition-colors duration-80`,w),children:r})]}):null,x?null:E,(0,Q.jsx)(y,{features:_,children:(0,Q.jsx)(We,{initial:!1,children:x&&S?(0,Q.jsx)(K.span,{className:`ml-2 overflow-hidden`,initial:{clipPath:`inset(0 100% 0 0)`,opacity:0},animate:{clipPath:`inset(0 0% 0 0)`,opacity:1},exit:{clipPath:`inset(0 100% 0 0)`,opacity:0},transition:{...Go.fast.enter,opacity:{duration:.06}},children:E},`label`):null})})]})});es.displayName=`TabsSubtleItem`;var ts=(0,Z.forwardRef)(({index:e,selectedIndex:t,idPrefix:n,children:r,className:i,...a},o)=>{let s=t===e;return(0,Q.jsx)(`div`,{ref:o,id:`${n}-panel-${e}`,role:`tabpanel`,"aria-labelledby":`${n}-tab-${e}`,hidden:!s,tabIndex:-1,className:q(`outline-none`,i),...a,children:s?r:null})});ts.displayName=`TabsSubtlePanel`;function ns({active:e=!1,ariaLabel:t,className:n,title:r,...i}){return(0,Q.jsx)(V,{...i,type:`button`,variant:`ghost`,size:`sm`,className:q(On,e?jn:Tn,n),"aria-label":t,title:r??t})}var rs=`[&_[data-proximity-index]]:!h-7 [&_[data-proximity-index]]:!px-2 [&_[data-proximity-index]]:!text-[11px]`;function is({compact:e=!1}={}){let{reopenRightPanel:t,rightPanel:n}=Li();return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`min-[960px]:hidden`,children:(0,Q.jsx)(as,{compact:e,idPrefix:`right-panel-mobile`})}),(0,Q.jsx)(`div`,{className:`hidden min-[960px]:block`,children:n===null?(0,Q.jsx)(os,{compact:e,onOpen:t}):null})]})}function as({compact:e=!1,idPrefix:t=`right-panel`}){let{artifactRuns:n,messages:r,rightPanel:i,setRightPanel:a,resources:o}=Li(),{workspaceTree:s}=Ii();return(0,Q.jsx)(ss,{activePanel:i,onPanelChange:a,resources:o,replRuns:n.flatMap(e=>e.artifacts).filter(e=>e.kind===`ipython`).length,sessionBlocks:Bi(r).length,openUIArtifacts:n.flatMap(e=>e.artifacts).filter(e=>e.kind===`openui-html`).length,workspace:s,idPrefix:t,compact:e})}function os({compact:e=!1,onOpen:t}){return(0,Q.jsx)(ns,{ariaLabel:`Open side panel`,className:e?`!size-7 !rounded-[7px] !px-0`:`size-9 justify-center px-0`,onClick:t,children:(0,Q.jsx)(lo,{className:`size-4`})})}function ss({activePanel:e,onPanelChange:t,resources:n,replRuns:r=0,sessionBlocks:i=0,openUIArtifacts:a=0,workspace:o,idPrefix:s=`right-panel`,compact:c=!1}){let l=Yn(n,o).reduce((e,t)=>e+t.items.length,0),u=(0,Z.useMemo)(()=>{let e=i+a;return e>0?e:void 0},[a,i]),d=(0,Z.useMemo)(()=>Bn.map(e=>({...e,badge:e.badgeSource===`resources`?l||void 0:e.badgeSource===`artifacts`?u:e.badgeSource===`repl`&&r||void 0})),[r,u,l]),f=d.findIndex(t=>t.id===e),p=(0,Z.useMemo)(()=>d.map(e=>({value:e.id,label:e.title,icon:e.icon})),[d]);return(0,Q.jsx)(cs,{"data-testid":`right-panel-inline-launcher`,"data-active-panel":e??`closed`,activePanel:e,options:p,panelOptions:d,idPrefix:s,selectedIndex:f,onSelect:n=>{let r=d.at(n)?.id;r&&t(r===e?null:r)},compact:c})}function cs({activePanel:e,className:t,compact:n=!1,idPrefix:r,onSelect:i,options:a,panelOptions:o,selectedIndex:s,...c}){let l=(0,Z.useRef)(null),u=(0,Z.useRef)(null),[d,f]=(0,Z.useState)(!1),p=(0,Z.useCallback)(()=>{let e=l.current,t=u.current;if(!e||!t)return;let n=e.parentElement?.clientWidth??e.clientWidth,r=t.getBoundingClientRect().width;f(r>n+1)},[]);(0,Z.useLayoutEffect)(()=>{p();let e=l.current,t=u.current;if(!e||!t||typeof ResizeObserver>`u`)return;let n=new ResizeObserver(p);return e.parentElement&&n.observe(e.parentElement),n.observe(e),n.observe(t),()=>n.disconnect()},[p,o,s]);let m=(0,Z.useCallback)(e=>{let t=o.findIndex(t=>t.id===e);t>=0&&i(t)},[i,o]);return(0,Q.jsxs)(`div`,{ref:l,className:`relative ${d?`w-full`:`w-fit`} min-w-0 max-w-full overflow-hidden ${t??``}`,"data-panel-launcher-mode":d?`dropdown`:`tabs`,...c,children:[d?(0,Q.jsx)(cn,{"aria-label":`Select panel`,className:`w-full min-w-0 max-w-full rounded-full border-border/70 bg-sidebar ${n?`h-7`:``}`,onValueChange:m,options:a,placeholder:`Open panel`,value:e}):(0,Q.jsx)($o,{activeLabel:!0,className:`w-fit max-w-full ${n?rs:``}`,idPrefix:r,selectedIndex:s,onSelect:i,children:o.map((e,t)=>(0,Q.jsx)(es,{index:t,icon:e.icon,label:e.title,badge:e.badge,"aria-label":e.ariaLabel},e.id))}),(0,Q.jsx)(`div`,{ref:u,"aria-hidden":`true`,className:`pointer-events-none invisible absolute top-0 left-0 -z-10 h-0 w-max max-w-none overflow-hidden`,"data-panel-launcher-measurement":!0,inert:!0,children:(0,Q.jsx)($o,{activeLabel:!0,className:`w-max max-w-none ${n?rs:``}`,idPrefix:`${r}-measurement`,selectedIndex:s,onSelect:()=>void 0,children:o.map((e,t)=>(0,Q.jsx)(es,{index:t,icon:e.icon,label:e.title,badge:e.badge,"aria-label":e.ariaLabel},e.id))})})]})}function ls({children:e,dataTestid:t,headerActions:n,icon:r,onClose:i,open:a,title:o}){let s=(0,Z.useRef)(null),c=(0,Z.useId)(),l=(0,Z.useRef)(!1),u=(0,Z.useEffectEvent)(e=>{s.current&&e.target===s.current&&i?.()});return(0,Z.useEffect)(()=>{if(!a)return;let e=s.current;if(!e)return;let t=e=>u(e);return e.addEventListener(`click`,t),()=>e.removeEventListener(`click`,t)},[a]),(0,Z.useEffect)(()=>{let e=s.current;if(!e)return;if(!a){e.open&&(l.current=!0,e.close(),l.current=!1);return}let t=window.matchMedia(`(min-width: 960px)`),n=()=>{if(t.matches){e.open&&(l.current=!0,e.close());return}e.open||(e.showModal(),e.focus())};return n(),t.addEventListener(`change`,n),()=>t.removeEventListener(`change`,n)},[a]),a?(0,Q.jsx)(`dialog`,{ref:s,"data-testid":t,className:`fixed top-[var(--chat-chrome-top)] right-3 bottom-3 m-0 ${In} backdrop:bg-black/20 ${Er}`,"aria-labelledby":c,onClose:()=>{if(l.current){l.current=!1;return}i?.()},children:(0,Q.jsxs)(`div`,{className:`flex h-full min-h-0 min-w-0 flex-col overflow-hidden`,children:[(0,Q.jsx)(`span`,{id:c,className:`sr-only`,children:o??`Panel`}),o&&(0,Q.jsxs)(`div`,{className:`flex h-10 shrink-0 items-center justify-between gap-2 border-b border-border/60 px-3`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 text-[13px] font-medium text-foreground/80`,children:[r&&(0,Q.jsx)(r,{className:`size-3.5 shrink-0`}),(0,Q.jsx)(`span`,{className:`truncate`,children:o})]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[n,i&&(0,Q.jsx)(V,{type:`button`,onClick:i,variant:`ghost`,size:`icon-sm`,className:`relative after:absolute after:top-1/2 after:left-1/2 after:size-10 after:-translate-x-1/2 after:-translate-y-1/2 text-foreground/40 hover:text-foreground/70`,"aria-label":`Close panel`,title:`Close panel`,children:(0,Q.jsx)(Wr,{"data-icon":`inline-start`,className:`size-3.5`})})]})]}),(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain px-3 py-2`,children:e})]})}):null}function us({handleResourceCanvasResizeStart:e,onClose:t,resourceCanvasWidth:n}){let r=Li(),i=Ii(),{rightPanel:a}=r,o=a!==null,s=a?Rn(a):null,c=s?.component,l=s?.loadingSource===`resources`?r.resourcesLoading:s?.loadingSource===`workspace`&&i.workspaceLoading,u=s?.refreshSource===`resources`?r.refreshResources:s?.refreshSource===`workspace`?i.refreshWorkspace:void 0;return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(ls,{dataTestid:s?.mobileDataTestid,icon:s?.icon,onClose:t,open:o,title:s?.title??``,children:c?(0,Q.jsx)(c,{}):null}),(0,Q.jsx)(So,{dataTestid:s?.dataTestid,headerLeading:(0,Q.jsx)(as,{idPrefix:`right-panel-desktop`}),loading:l,onClose:t,onRefresh:u,onResizeStart:e,open:o,title:s?.title??``,titleIcon:s?.icon??zn,width:n,children:c?(0,Q.jsx)(c,{}):null})]})}var ds={"--chat-chrome-top":`52px`,"--chat-header-height":`44px`,"--chat-header-top":`0px`};function fs({children:e,headerCenter:t,headerLeft:n,headerRight:r,panel:i}){return(0,Q.jsxs)(`div`,{className:`flex h-svh min-w-0 overflow-hidden`,"data-testid":`chat-shell`,style:ds,children:[(0,Q.jsxs)(`div`,{className:`relative flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden`,"data-testid":`chat-column`,children:[(0,Q.jsxs)(`header`,{className:q(wn,`grid h-[var(--chat-header-height)] min-h-[var(--chat-header-height)] shrink-0 grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-1 border-b border-[#2e3033] px-2 py-2`),"data-testid":`chat-header`,children:[(0,Q.jsx)(`div`,{className:`min-w-0 justify-self-start`,children:n}),(0,Q.jsx)(`div`,{className:`flex min-w-0 items-center justify-start gap-1 overflow-hidden justify-self-stretch`,children:t}),(0,Q.jsx)(`div`,{className:`min-w-0 justify-self-end`,children:r})]}),(0,Q.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden`,children:e})]}),i]})}var ps=e(n(),1),ms=`(max-width: 767px)`,hs=`b`,gs={duration:.36,ease:Pe},_s={type:`spring`,stiffness:380,damping:35,mass:.75},vs={duration:.18,ease:Ne},ys={closed:{opacity:0,clipPath:`inset(0 0 100% 0 round 8px)`,transition:{duration:.14,ease:Ne,staggerChildren:.025,staggerDirection:-1}},open:{opacity:1,clipPath:`inset(0 0 0% 0 round 8px)`,transition:{duration:.2,delayChildren:.035,ease:Ne,staggerChildren:.045}}},bs={closed:{opacity:0,y:-6,filter:`blur(3px)`},open:{opacity:1,y:0,filter:`blur(0px)`,transition:vs}},xs={duration:.16,ease:Ne},Ss=[`a[href]`,`button:not([disabled])`,`input:not([disabled])`,`select:not([disabled])`,`textarea:not([disabled])`,`[tabindex]:not([tabindex='-1'])`].join(`,`);function Cs(e){let t=window.matchMedia(ms);return t.addEventListener(`change`,e),()=>t.removeEventListener(`change`,e)}function ws(){return window.matchMedia(ms).matches}function Ts(){return!1}function Es(){return(0,Z.useSyncExternalStore)(Cs,ws,Ts)}var Ds=(0,Z.createContext)(null),Os=(0,Z.createContext)(null);function ks(){let e=(0,Z.useContext)(Ds);if(!e)throw Error(`useAnimatedSidebar must be used inside AnimatedSidebarProvider.`);return e}function As(){let e=(0,Z.useContext)(Os);if(!e)throw Error(`Animated Sidebar parts must be used inside AnimatedSidebar.`);return e}function js({children:e,open:t,defaultOpen:n=!0,onOpenChange:r,openMobile:i,defaultOpenMobile:a=!1,onOpenMobileChange:o,className:s,style:c,...l}){let[u,d]=(0,Z.useState)(n),[f,p]=(0,Z.useState)(a),m=Es(),h=Ge()??!1,g=(0,Z.useId)(),_=(0,Z.useRef)(null),v=t??u,y=i??f,b=(0,Z.useCallback)(e=>{t===void 0&&d(e),r?.(e)},[r,t]),x=(0,Z.useCallback)(e=>{i===void 0&&p(e),o?.(e)},[o,i]),S=(0,Z.useCallback)(()=>{m?x(!y):b(!v)},[v,m,y,b,x]),C=(0,Z.useMemo)(()=>({isMobile:m,layoutId:`${g}-active`,open:v,openMobile:y,reduce:h,setOpen:b,setOpenMobile:x,state:v?`expanded`:`collapsed`,toggleSidebar:S,triggerRef:_}),[v,g,m,y,h,b,x,S]);return(0,Z.useEffect)(()=>{let e=e=>{e.key.toLowerCase()===hs&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),S())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[S]),(0,Q.jsx)(Ds.Provider,{value:C,children:(0,Q.jsx)(`div`,{...l,"data-slot":`sidebar-wrapper`,"data-state":v?`expanded`:`collapsed`,style:{"--sidebar-width":`16rem`,"--sidebar-width-icon":`4.25rem`,"--sidebar-width-mobile":`18rem`,...c},className:q(`group/sidebar-wrapper flex min-h-svh w-full min-w-0`,s),children:e})})}function Ms({ariaLabel:e,children:t,className:n,side:r}){let i=ks(),a=(0,Z.useRef)(null),[o,s]=(0,Z.useState)(!1),c=(0,Z.useMemo)(()=>({collapsed:!1,collapsible:`none`,side:r}),[r]);return(0,Z.useEffect)(()=>s(!0),[]),(0,Z.useEffect)(()=>{if(!i.openMobile)return;let e=a.current;if(!e)return;let t=i.triggerRef.current,n=document.body,r=window.scrollY,o={left:n.style.left,overflow:n.style.overflow,position:n.style.position,right:n.style.right,top:n.style.top};n.style.position=`fixed`,n.style.top=`-${r}px`,n.style.left=`0`,n.style.right=`0`,n.style.overflow=`hidden`;let s=requestAnimationFrame(()=>{(e.querySelector(Ss)??e).focus({preventScroll:!0})});return()=>{cancelAnimationFrame(s),n.style.position=o.position,n.style.top=o.top,n.style.left=o.left,n.style.right=o.right,n.style.overflow=o.overflow,window.scrollTo(0,r),t?.focus({preventScroll:!0})}},[i.openMobile,i.triggerRef,o]),o?(0,ps.createPortal)((0,Q.jsxs)(`div`,{className:q(`pointer-events-none fixed inset-0 z-50 md:hidden`,i.openMobile?`visible`:`invisible`),children:[(0,Q.jsx)(K.button,{type:`button`,"aria-label":`Close sidebar`,tabIndex:i.openMobile?0:-1,initial:!1,animate:{opacity:+!!i.openMobile},transition:i.reduce?xs:gs,onClick:()=>i.setOpenMobile(!1),className:q(`absolute inset-0 bg-black/40`,i.openMobile?`pointer-events-auto`:`pointer-events-none`)}),(0,Q.jsx)(K.div,{ref:a,role:`dialog`,"aria-modal":`true`,"aria-label":e,"aria-hidden":!i.openMobile,inert:!i.openMobile,tabIndex:-1,"data-mobile":`true`,"data-state":i.openMobile?`expanded`:`collapsed`,"data-side":r,initial:!1,animate:{opacity:i.reduce?+!!i.openMobile:1,x:i.reduce?0:i.openMobile?`0%`:r===`left`?`-100%`:`100%`},transition:i.reduce?xs:gs,onKeyDown:e=>{if(e.key===`Escape`){e.preventDefault(),i.setOpenMobile(!1);return}if(e.key!==`Tab`)return;let t=a.current?Array.from(a.current.querySelectorAll(Ss)):[];if(t.length===0){e.preventDefault(),a.current?.focus();return}let n=t[0],r=t[t.length-1];e.shiftKey&&document.activeElement===n?(e.preventDefault(),r.focus()):!e.shiftKey&&document.activeElement===r&&(e.preventDefault(),n.focus())},className:q(`pointer-events-auto absolute inset-y-0 flex h-dvh w-(--sidebar-width-mobile) max-w-[88vw] flex-col overflow-hidden`,`border-border bg-background shadow-2xl will-change-transform`,r===`left`?`left-0 border-r`:`right-0 border-l`,!i.openMobile&&`pointer-events-none`,n),children:(0,Q.jsx)(Os.Provider,{value:c,children:t})})]}),document.body):null}var Ns=(0,Z.forwardRef)(function({side:e=`left`,variant:t=`sidebar`,collapsible:n=`icon`,ariaLabel:r=`Sidebar`,children:i,className:a,panelClassName:o,style:s,...c},l){let u=ks(),d=n!==`none`&&!u.open,f=d&&n===`offcanvas`,p=t===`floating`||t===`inset`,m=f?`0px`:d?p?`calc(var(--sidebar-width-icon) + 1rem)`:`var(--sidebar-width-icon)`:p?`calc(var(--sidebar-width) + 1rem)`:`var(--sidebar-width)`,h=(0,Z.useMemo)(()=>({collapsed:d,collapsible:n,side:e}),[d,n,e]);return u.isMobile?(0,Q.jsx)(Ms,{ariaLabel:r,className:a,side:e,children:i}):(0,Q.jsx)(K.aside,{...c,ref:l,initial:!1,"aria-label":r,"data-slot":`sidebar`,"data-state":d?`collapsed`:`expanded`,"data-collapsible":n,"data-variant":t,"data-side":e,transition:u.reduce?{duration:0}:_s,layout:`size`,style:{...s,width:m},className:q(`group/sidebar relative hidden h-auto shrink-0 md:block will-change-transform`,`peer`,e===`right`&&`order-last`,a),children:(0,Q.jsx)(K.div,{initial:!1,animate:{opacity:+!f,x:f?e===`left`?`-120%`:`120%`:`0%`},transition:u.reduce?xs:gs,className:q(`sticky top-0 flex h-svh w-full flex-col overflow-hidden`,p&&(d?`w-[var(--sidebar-width-icon)]`:`w-[var(--sidebar-width)]`),n===`offcanvas`&&`w-[var(--sidebar-width)]`,t===`sidebar`&&(e===`left`?`border-border border-r bg-background`:`border-border border-l bg-background`),t===`floating`&&`m-2 h-[calc(100svh-1rem)] rounded-2xl bg-sidebar shadow-surface-3`,t===`inset`&&`m-2 h-[calc(100svh-1rem)] rounded-2xl bg-background`,o),children:(0,Q.jsx)(Os.Provider,{value:h,children:i})})})}),Ps=(0,Z.forwardRef)(function({className:e,onClick:t,type:n=`button`,...r},i){let a=ks(),o=a.isMobile?a.openMobile:a.open;return(0,Q.jsx)(V,{...r,ref:e=>{a.triggerRef.current=e,typeof i==`function`?i(e):i&&(i.current=e)},type:n,variant:`ghost`,size:`icon-lg`,"aria-label":r[`aria-label`]??`Toggle sidebar`,"aria-expanded":o,"data-slot":`sidebar-trigger`,"data-state":o?`expanded`:`collapsed`,onClick:e=>{t?.(e),e.defaultPrevented||a.toggleSidebar()},className:q(`focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background`,e)})});(0,Z.forwardRef)(function({className:e,onClick:t,type:n=`button`,...r},i){let a=ks();return(0,Q.jsx)(V,{...r,ref:i,type:n,variant:`ghost`,size:`icon-lg`,"aria-label":r[`aria-label`]??`Close sidebar`,onClick:e=>{t?.(e),!e.defaultPrevented&&(a.isMobile?a.setOpenMobile(!1):a.setOpen(!1))},className:q(`focus-visible:ring-2 focus-visible:ring-ring`,e)})});var Fs=(0,Z.forwardRef)(function({className:e,onClick:t,type:n=`button`,...r},i){let a=ks(),o=As();return(0,Q.jsx)(`button`,{...r,ref:i,type:n,"data-side":o.side,"aria-label":r[`aria-label`]??`Toggle sidebar`,title:`Toggle sidebar`,tabIndex:-1,onClick:e=>{t?.(e),e.defaultPrevented||a.toggleSidebar()},className:q(`absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 outline-none md:block`,`after:absolute after:inset-y-0 after:left-1/2 after:w-px after:bg-transparent after:transition-colors hover:after:bg-border`,`data-[side=right]:right-0 data-[side=right]:translate-x-1/2 data-[side=left]:left-full`,e)})}),Is=(0,Z.forwardRef)(function({className:e,...t},n){return(0,Q.jsx)(K.main,{...t,ref:n,"data-slot":`sidebar-inset`,className:q(`relative flex min-h-svh min-w-0 flex-1 flex-col bg-background`,`md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-2xl md:peer-data-[variant=inset]:shadow-sm`,e)})}),Ls=(0,Z.forwardRef)(function({className:e,...t},n){return(0,Q.jsx)(`div`,{...t,ref:n,"data-slot":`sidebar-header`,className:q(`flex shrink-0 flex-col gap-2 p-3`,e)})}),Rs=(0,Z.forwardRef)(function({className:e,...t},n){return(0,Q.jsx)(`div`,{...t,ref:n,"data-slot":`sidebar-content`,className:q(`flex min-h-0 flex-1 flex-col gap-2 overflow-y-auto overflow-x-hidden overscroll-contain px-2 py-2`,e)})}),zs=(0,Z.forwardRef)(function({className:e,...t},n){return(0,Q.jsx)(`div`,{...t,ref:n,"data-slot":`sidebar-footer`,className:q(`flex shrink-0 flex-col gap-2 border-border border-t p-3 pb-[max(0.75rem,env(safe-area-inset-bottom))]`,e)})}),Bs=(0,Z.forwardRef)(function({className:e,...t},n){return(0,Q.jsx)(`div`,{...t,ref:n,"data-slot":`sidebar-group`,className:q(`flex w-full min-w-0 flex-col px-1 py-1.5`,e)})}),Vs=(0,Z.forwardRef)(function({children:e,className:t,...n},r){let{collapsed:i}=As();return(0,Q.jsx)(`div`,{...n,ref:r,"aria-hidden":i,"data-slot":`sidebar-group-label`,className:q(`mb-1 h-7 overflow-hidden px-2 text-[10px] font-medium uppercase tracking-[0.14em] text-muted-foreground transition-opacity`,i?`opacity-0`:`opacity-100`,t),children:e})}),Hs=(0,Z.forwardRef)(function({className:e,...t},n){return(0,Q.jsx)(`div`,{...t,ref:n,"data-slot":`sidebar-group-content`,className:q(`w-full min-w-0`,e)})});(0,Z.forwardRef)(function({children:e,className:t,...n},r){return(0,Q.jsx)(Sr,{...n,ref:r,as:`ul`,inset:0,pillClassName:`rounded-xl bg-muted/70`,pillContainerClassName:`inset-y-auto top-0 h-9`,"data-slot":`sidebar-menu`,className:q(`flex w-full min-w-0 list-none flex-col gap-0.5`,t),children:e})}),(0,Z.forwardRef)(function({className:e,...t},n){return(0,Q.jsx)(K.li,{...t,ref:n,layout:`position`,transition:je,"data-slot":`sidebar-menu-item`,className:q(`relative`,e)})}),(0,Z.forwardRef)(function({open:e,children:t,className:n,...r},i){let a=ks(),o=As();return(0,Q.jsx)(We,{initial:!1,mode:`popLayout`,children:e&&!o.collapsed?(0,Z.createElement)(K.ul,{...r,ref:i,key:`sidebar-submenu`,variants:a.reduce?void 0:ys,initial:!a.reduce&&`closed`,animate:a.reduce?{opacity:1}:`open`,exit:a.reduce?{opacity:0}:`closed`,transition:a.reduce?{duration:.12}:void 0,"data-slot":`sidebar-menu-sub`,className:q(`relative mt-1 ml-5 flex min-w-0 flex-col gap-0.5 border-border border-l pl-3`,n)},t):null})}),(0,Z.forwardRef)(function({className:e,...t},n){return(0,Q.jsx)(K.li,{...t,ref:n,variants:bs,"data-slot":`sidebar-menu-sub-item`,className:q(`relative min-w-0`,e)})});function Us({children:e,className:t,sidebarWidth:n=`17rem`,style:r,...i}){return(0,Q.jsx)(js,{...i,style:{...r,"--sidebar-width":n},className:q(`min-h-0 w-full overflow-hidden rounded-2xl border border-border bg-background`,t),children:e})}var Ws=`https://docs.qredence.ai`,Gs=`fleet-prime:v1:sidebar-expanded-projects`,Ks=[],qs=`new-session:`,Js=`project:`,Ys=`session:`;function Xs(e){return`${Js}${e}`}function Zs(e){return`${Ys}${e}`}function Qs(e){return`${qs}${e}`}function $s(e,t){return e.startsWith(t)?e.slice(t.length):null}function ec(e){return kr(e.title||e.firstMessage||e.sessionId.slice(0,8))}function tc(e,t){return`${e.projectId?t.get(e.projectId)?.name??`Unassigned`:`Unassigned`} · ${e.status===`idle`?`Ready`:e.status} · ${`${String(e.messageCount)} ${e.messageCount===1?`message`:`messages`}`}`}function nc(e){let t=Date.parse(e);if(!Number.isFinite(t))return`Earlier`;let n=new Date,r=new Date(n.getFullYear(),n.getMonth(),n.getDate()).getTime(),i=Math.floor((r-new Date(t).setHours(0,0,0,0))/864e5);return i<=0?`Today`:i===1?`Yesterday`:`Earlier`}function rc(e){return e.hasChildren?`${e.name}/`:e.name}function ic(e,t){return e instanceof Error&&e.message.trim()?e.message:t}function ac(e){if(typeof window>`u`)return e?[Xs(e)]:[];let t=window.localStorage.getItem(Gs);if(!t)return e?[Xs(e)]:[];try{let e=JSON.parse(t);return Array.isArray(e)?e.filter(e=>typeof e==`string`):[]}catch{return e?[Xs(e)]:[]}}function oc(e,t){return t.type===`update`?t.update(e):{...e,[t.field.key]:t.field.value}}function sc(e){let[t,n]=(0,Z.useReducer)(oc,e,e=>({brandMenuOpen:!1,projectActionsOpen:!1,searchOpen:!1,query:``,expandedProjectIds:ac(e),revealedProjectIds:new Set,renameTarget:null,renameTitle:``,renameProjectTarget:null,renameProjectName:``,deleteTarget:null,unregisterTarget:null,createOpen:!1,createPath:``,createName:``,directoryToken:void 0,directoryBrowser:null,directoryBrowseLoading:!1,directoryBrowseError:null,createSubmitting:!1,createSubmitError:null,forkTarget:null,forkProjectId:void 0})),r=(0,Z.useCallback)(function(e,t){n({type:`set`,field:{key:e,value:t}})},[]),i=(0,Z.useCallback)(function(e,t){n({type:`update`,update:n=>({...n,[e]:t(n[e])})})},[]),a=(0,Z.useCallback)(e=>r(`brandMenuOpen`,e),[r]),o=(0,Z.useCallback)(e=>r(`projectActionsOpen`,e),[r]),s=(0,Z.useCallback)(e=>r(`searchOpen`,e),[r]),c=(0,Z.useCallback)(e=>r(`query`,e),[r]),l=(0,Z.useCallback)(e=>typeof e==`function`?i(`expandedProjectIds`,e):r(`expandedProjectIds`,e),[r,i]),u=(0,Z.useCallback)(e=>typeof e==`function`?i(`revealedProjectIds`,e):r(`revealedProjectIds`,e),[r,i]),d=(0,Z.useCallback)(e=>r(`renameTarget`,e),[r]),f=(0,Z.useCallback)(e=>r(`renameTitle`,e),[r]),p=(0,Z.useCallback)(e=>r(`renameProjectTarget`,e),[r]),m=(0,Z.useCallback)(e=>r(`renameProjectName`,e),[r]),h=(0,Z.useCallback)(e=>r(`deleteTarget`,e),[r]),g=(0,Z.useCallback)(e=>r(`unregisterTarget`,e),[r]),_=(0,Z.useCallback)(e=>r(`createOpen`,e),[r]),v=(0,Z.useCallback)(e=>r(`createPath`,e),[r]),y=(0,Z.useCallback)(e=>r(`createName`,e),[r]),b=(0,Z.useCallback)(e=>r(`directoryToken`,e),[r]),x=(0,Z.useCallback)(e=>r(`directoryBrowser`,e),[r]),S=(0,Z.useCallback)(e=>r(`directoryBrowseLoading`,e),[r]),C=(0,Z.useCallback)(e=>r(`directoryBrowseError`,e),[r]),w=(0,Z.useCallback)(e=>r(`createSubmitting`,e),[r]),T=(0,Z.useCallback)(e=>r(`createSubmitError`,e),[r]),E=(0,Z.useCallback)(e=>r(`forkTarget`,e),[r]),D=(0,Z.useCallback)(e=>r(`forkProjectId`,e),[r]);return{...t,setBrandMenuOpen:a,setProjectActionsOpen:o,setSearchOpen:s,setQuery:c,setExpandedProjectIds:l,setRevealedProjectIds:u,setRenameTarget:d,setRenameTitle:f,setRenameProjectTarget:p,setRenameProjectName:m,setDeleteTarget:h,setUnregisterTarget:g,setCreateOpen:_,setCreatePath:v,setCreateName:y,setDirectoryToken:b,setDirectoryBrowser:x,setDirectoryBrowseLoading:S,setDirectoryBrowseError:C,setCreateSubmitting:w,setCreateSubmitError:T,setForkTarget:E,setForkProjectId:D}}function cc(e,t){return e.filter(e=>e.messageCount>0||e.sessionId===t)}function lc(e){return e.toSorted((e,t)=>Date.parse(t.updatedAt)-Date.parse(e.updatedAt))}function uc(e,t,n){let r=lc(e);if(n||r.length<=5)return r;let i=r.slice(0,5),a=r.find(e=>e.sessionId===t);return a&&!i.some(e=>e.sessionId===a.sessionId)&&(i[4]=a),i}function dc(e,t){let n=new Map(e.map((e,t)=>[e.projectId,t])),r=new Map;for(let e of t){if(!e.projectId)continue;let t=Date.parse(e.updatedAt);r.set(e.projectId,Math.max(r.get(e.projectId)??0,t))}return e.toSorted((e,t)=>{let i=r.get(e.projectId)??0,a=r.get(t.projectId)??0;return i===a?(n.get(e.projectId)??0)-(n.get(t.projectId)??0):a-i})}var fc=[[`resources`,`Open Resources`,zn],[`workspace`,`Open Workspace`,Pr],[`artifacts`,`Open Artifacts`,Ir]];function pc({icon:e,label:t,destructive:n=!1,onClick:r}){return(0,Q.jsxs)(`button`,{type:`button`,onClick:r,className:n?`flex h-8 w-full items-center gap-2 rounded-lg px-2.5 text-left text-xs text-destructive hover:bg-destructive/10`:`flex h-8 w-full items-center gap-2 rounded-lg px-2.5 text-left text-xs hover:bg-muted`,children:[(0,Q.jsx)(e,{className:`size-3.5`}),t]})}function mc({sessions:e,projects:t=Ks,projectSessions:n=e,activeProjectId:r,activeSessionId:i,onNewSession:a,onNewSessionInProject:o,onProjectSelect:s,onResumeSession:c,onCreateProject:l,onForkSessionIntoProject:u,onOpenPanelAction:d,onBrowseDirectories:f,createOpen:p,expandedProjectIds:m,revealedProjectIds:h,setExpandedProjectIds:g,setRevealedProjectIds:_,setSearchOpen:v,setDirectoryBrowser:y,setDirectoryBrowseLoading:b,setDirectoryBrowseError:x,setDirectoryToken:S,setCreatePath:C,setRenameTarget:w,setRenameTitle:T,setForkTarget:E,setForkProjectId:D,setDeleteTarget:O,setRenameProjectTarget:k,setRenameProjectName:A,setUnregisterTarget:j,createPath:M,directoryToken:N,createName:P,setCreateName:F,setCreateOpen:I,setCreateSubmitError:L,setCreateSubmitting:R}){let z=(0,Z.useRef)(!1),B=(0,Z.useCallback)(async e=>{if(!f)return!1;b(!0),x(null);try{let t=await f(e);return y(t),S(t.directoryToken),C(t.pathLabel),!0}catch(e){return x(ic(e,`Could not browse this directory.`)),!1}finally{b(!1)}},[f,C,x,b,y,S]);(0,Z.useEffect)(()=>{let e=p&&!z.current;z.current=p,!(!e||!f)&&B({})},[p,B,f]);let V=(0,Z.useMemo)(()=>new Map(t.map(e=>[e.projectId,e])),[t]),H=(0,Z.useMemo)(()=>dc(t,n),[n,t]);(0,Z.useEffect)(()=>{if(!r)return;let e=Xs(r);g(t=>t.includes(e)?t:[...t,e])},[r,g]),(0,Z.useEffect)(()=>{window.localStorage.setItem(Gs,JSON.stringify(m))},[m]);let U=(0,Z.useMemo)(()=>{let e=H.map(e=>{let t=cc(n.filter(t=>t.projectId===e.projectId),i),r=h.has(e.projectId),a=uc(t,i,r).map(e=>({id:Zs(e.sessionId),label:ec(e),kind:`file`,...e.isSubagent?{indent:1}:{}}));return t.length===0?a.push({id:Qs(e.projectId),label:`Start first chat`,kind:`action`}):t.length>5&&a.push({id:`toggle:${e.projectId}`,label:r?`Show less`:`Show more`,kind:`action`}),{id:Xs(e.projectId),label:e.name,kind:`project`,children:a}}),t=lc(cc(n.filter(e=>!e.projectId),i));if(t.length>0){let n=uc(t,i,h.has(`unassigned`)).map(e=>({id:Zs(e.sessionId),label:ec(e),kind:`file`,...e.isSubagent?{indent:1}:{}}));t.length>5&&n.push({id:`toggle:unassigned`,label:h.has(`unassigned`)?`Show less`:`Show more`,kind:`action`}),e.push({id:`project:unassigned`,label:`Unassigned`,kind:`folder`,children:n})}return e},[i,n,h,H]),W=(0,Z.useCallback)(e=>{o?o(e):(s?.(e),a())},[a,o,s]);return{loadDirectories:B,projectById:V,sortedProjects:H,sidebarItems:U,resumeResource:(0,Z.useCallback)(e=>{let t=$s(e,`toggle:`);if(t){_(e=>{let n=new Set(e);return n.has(t)?n.delete(t):n.add(t),n});return}let r=$s(e,qs);if(r){W(r);return}let i=$s(e,Ys);if(!i)return;let a=n.find(e=>e.sessionId===i);a&&c(a)},[W,c,n,_]),toggleProjectResource:(0,Z.useCallback)(e=>{g(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},[g]),selectSearchResult:(0,Z.useCallback)(e=>{let t=$s(e,`search-project:`);if(t){let e=Xs(t);g(t=>t.includes(e)?t:[...t,e]),s?.(t),v(!1);return}let r=$s(e,`search-session:`),i=r?n.find(e=>e.sessionId===r):void 0;if(i){if(i.projectId){let e=Xs(i.projectId);g(t=>t.includes(e)?t:[...t,e])}c(i),v(!1)}},[s,c,n,g,v]),renderMenu:(0,Z.useCallback)((e,r)=>{let i=$s(e.id,Ys),a=$s(e.id,`project:`);if(i){let e=n.find(e=>e.sessionId===i);if(!e)return null;let a=e.projectId??void 0;return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(pc,{icon:hn,label:`Rename`,onClick:()=>{r.close(),w(e),T(ec(e))}}),u&&t.length>1?(0,Q.jsx)(pc,{icon:ao,label:`Fork into project`,onClick:()=>{r.close(),E(e),D(t.find(t=>t.projectId!==e.projectId)?.projectId)}}):null,d&&a?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`my-1 border-t`}),fc.map(([e,t,n])=>(0,Q.jsx)(pc,{icon:n,label:t,onClick:()=>{r.close(),d({panel:e,projectId:a,focus:!0})}},e))]}):null,(0,Q.jsx)(pc,{icon:Fn,label:`Delete`,destructive:!0,onClick:()=>{r.close(),O(e)}})]})}if(a&&a!==`unassigned`){let e=V.get(a);return e?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(pc,{icon:hn,label:`Rename project`,onClick:()=>{r.close(),k(e),A(e.name)}}),(0,Q.jsx)(pc,{icon:go,label:`Unregister project`,destructive:!0,onClick:()=>{r.close(),j(e)}}),d?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`my-1 border-t`}),fc.map(([e,t,n])=>(0,Q.jsx)(pc,{icon:n,label:t,onClick:()=>{r.close(),d({panel:e,projectId:a,focus:!0})}},e))]}):null]}):null}return null},[u,d,V,n,t,O,D,E,A,k,w,T,j]),submitCreate:async()=>{let e=M.trim();if(!(!l||!e&&!N)){R(!0),L(null);try{await l({path:N?void 0:e,directoryToken:N,name:P.trim()||void 0}),I(!1),C(``),F(``),S(void 0),y(null),x(null)}catch(e){L(ic(e,`Could not add this project.`))}finally{R(!1)}}}}}var hc=Z.createContext(void 0);function gc(e){let t=Z.useContext(hc);if(t===void 0&&!e)throw Error(rt(47));return t}var _c={...yt,disabled:e=>e.disabled,instantType:e=>e.instantType,openMethod:e=>e.openMethod,openChangeReason:e=>e.openChangeReason,modal:e=>e.modal,focusManagerModal:e=>e.focusManagerModal,stickIfOpen:e=>e.stickIfOpen,titleElementId:e=>e.titleElementId,descriptionElementId:e=>e.descriptionElementId,openOnHover:e=>e.openOnHover,closeDelay:e=>e.closeDelay,adaptiveOrigin:e=>e.adaptiveOrigin},vc=class extends R{constructor(e,t,n){let r=new St;super(yc(e,r,t,n),bc(r),_c)}setOpen=(e,t)=>{let n=t.reason===et,r=t.reason===`trigger-press`&&t.event.detail===0,i=!e&&(t.reason===`escape-key`||t.reason==null),a=ht(t),o=this.select(`activeTriggerId`);if(!e&&t.reason===`close-press`&&t.trigger==null&&o!=null&&(t.trigger=this.context.triggerElements.getById(o)??this.select(`activeTriggerElement`)??void 0),this.context.onOpenChange?.(e,t),t.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(e,t);let s=()=>{let n={open:e,openChangeReason:t.reason};xt(n,e,t.trigger,a()),this.update(n)};n?(this.set(`stickIfOpen`,!0),this.context.stickIfOpenTimeout.start(500,()=>{this.set(`stickIfOpen`,!1)}),ps.flushSync(s)):s();let c;r?c=`click`:i?c=`dismiss`:t.reason===`focus-out`&&(c=`focus`),this.set(`instantType`,c)}};function yc(e,t,n,r=!1){let i={...Dt(),disabled:!1,modal:!1,focusManagerModal:!1,instantType:void 0,openMethod:null,openChangeReason:null,titleElementId:void 0,descriptionElementId:void 0,stickIfOpen:!0,openOnHover:!1,closeDelay:0,adaptiveOrigin:void 0,...e};return i.open&&e?.mounted===void 0&&(i.mounted=!0),i.floatingRootContext=kt(t,n,r),i}function bc(e){return{popupRef:Z.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:Z.createRef(),beforeContentFocusGuardRef:Z.createRef(),stickIfOpenTimeout:new D,triggerElements:e}}function xc({props:e}){let{children:t,open:n,defaultOpen:r=!1,onOpenChange:i,onOpenChangeComplete:a,modal:o=!1,handle:s,triggerId:c,defaultTriggerId:l=null}=e,u=Cc(s,{modal:o,open:r,openProp:n,activeTriggerId:l,triggerIdProp:c});u.useControlledProp(`openProp`,n),u.useControlledProp(`triggerIdProp`,c);let d=u.useState(`open`),f=u.useState(`mounted`),p=u.useState(`payload`);u.useContextCallback(`onOpenChange`,i),u.useContextCallback(`onOpenChangeComplete`,a),Jt(u,d),Nt(u);let{forceUnmount:m}=Ft(d,u,()=>{u.update({stickIfOpen:!0,openChangeReason:null})});u.useSyncedValues({modal:o}),Z.useEffect(()=>{d||u.context.stickIfOpenTimeout.clear()},[u,d]),Z.useImperativeHandle(e.actionsRef,()=>({unmount:m,close:()=>u.setOpen(!1,lt(st))}),[m,u]);let h=d||f;return(0,Q.jsxs)(hc.Provider,{value:u,children:[s&&(0,Q.jsx)(jt,{handle:s,store:u}),h&&(0,Q.jsx)(wc,{store:u,modal:o}),typeof t==`function`?t({payload:p}):t]})}function Sc(e){return gc(!0)?(0,Q.jsx)(xc,{props:e}):(0,Q.jsx)(pt,{children:(0,Q.jsx)(xc,{props:e})})}function Cc(e,t){let n=wt((e,n)=>new vc(t,e,n));return Z.useEffect(()=>n.context.stickIfOpenTimeout.disposeEffect(),[n]),n}function wc({store:e,modal:t}){let n=e.useState(`floatingRootContext`),r=It(n,{outsidePressEvent:{mouse:t===`trap-focus`?`sloppy`:`intentional`,touch:`sloppy`}}),i=r.reference,a=r.floating;return bt(e,{activeTriggerProps:i,inactiveTriggerProps:i,popupProps:a}),null}function Tc(e,t){let n=Z.useRef(null);function r(t){ps.flushSync(()=>{e.setOpen(!1,lt(it,t.nativeEvent,t.currentTarget))}),U(n.current)?.focus()}function i(n){let r=e.select(`positionerElement`);if(r&&O(n,r))e.context.beforeContentFocusGuardRef.current?.focus();else{ps.flushSync(()=>{e.setOpen(!1,lt(it,n.nativeEvent,n.currentTarget))});let i=j(e.context.triggerFocusTargetRef.current||t.current);for(;i!==null&&w(r,i);){let e=i;if(i=H(i),i===e)break}i?.focus()}}return{preFocusGuardRef:n,handlePreFocusGuardFocus:r,handleFocusTargetFocus:i}}var Ec=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:o=!0,handle:s,payload:c,openOnHover:l=!1,delay:u=300,closeDelay:d=0,id:f,...p}=e,m=gc(!0),h=mn(s)??m;if(!h)throw Error(rt(74));let g=pn(f),_=h.useState(`isTriggerActive`,g),v=h.useState(`floatingRootContext`),y=h.useState(`isOpenedByTrigger`,g),b=h.useState(`triggerPopupId`,g),x=Z.useRef(null),{registerTrigger:S,isMountedByThisTrigger:C}=Ct(g,x,h,{payload:c,disabled:a,openOnHover:l,closeDelay:d}),w=h.useState(`openChangeReason`),T=h.useState(`stickIfOpen`),E=h.useState(`openMethod`),D=h.useState(`focusManagerModal`),O=gn(v,{enabled:!a&&l&&(E!==`touch`||w!==`trigger-press`),mouseOnly:!0,move:!1,handleClose:_n(),restMs:u,delay:{close:d},triggerElementRef:x,isActiveTrigger:_,isClosing:()=>h.select(`transitionStatus`)===`ending`}),k=on(v,{stickIfOpen:T}),A=rn(()=>h.select(`open`),e=>{h.set(`openMethod`,e)}),j=h.useState(`triggerProps`,C),{getButtonProps:N,buttonRef:P}=ut({disabled:a,native:o}),F={open(e){return e&&w===`trigger-press`?Gt.open(e):Et.open(e)}},{preFocusGuardRef:L,handlePreFocusGuardFocus:R,handleFocusTargetFocus:z}=Tc(h,x),B=Je(`button`,e,{state:{disabled:a,open:y},ref:[P,t,S,x],props:[k.reference,O,j,A,{[M]:``,id:g,"aria-haspopup":`dialog`,"aria-expanded":y,"aria-controls":b},p,N],stateAttributesMapping:F}),V=(0,Q.jsx)(Z.Fragment,{children:B},g);return C&&!D?(0,Q.jsxs)(Z.Fragment,{children:[(0,Q.jsx)(I,{ref:L,onFocus:R}),V,(0,Q.jsx)(I,{ref:h.context.triggerFocusTargetRef,onFocus:z})]}):V}),Dc=Z.createContext(void 0);function Oc(){let e=Z.useContext(Dc);if(e===void 0)throw Error(rt(45));return e}var kc=Z.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e;return gc().useState(`mounted`)||n?(0,Q.jsx)(Dc.Provider,{value:n,children:(0,Q.jsx)(B,{ref:t,...r})}):null}),Ac=Z.createContext(void 0);function jc(){let e=Z.useContext(Ac);if(!e)throw Error(rt(46));return e}var Mc=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,anchor:a,positionMethod:o,side:s,align:c,sideOffset:l,alignOffset:u,collisionBoundary:d=`clipping-ancestors`,collisionPadding:f,arrowPadding:p,sticky:m,disableAnchorTracking:h=!1,collisionAvoidance:g=P,..._}=e,v=gc(),y=Oc(),b=Vt(),x=v.useState(`floatingRootContext`),S=v.useState(`mounted`),C=v.useState(`open`),w=v.useState(`openChangeReason`),T=v.useState(`activeTriggerElement`),E=v.useState(`modal`),D=v.useState(`openMethod`),O=v.useState(`positionerElement`),k=v.useState(`instantType`),A=v.useState(`transitionStatus`),j=v.useState(`adaptiveOrigin`),M=Z.useRef(null),N=dt(O),F=tn({anchor:a,floatingRootContext:x,positionMethod:o,mounted:S,side:s,sideOffset:l,align:c,alignOffset:u,arrowPadding:p,collisionBoundary:d,collisionPadding:f,sticky:m,disableAnchorTracking:h,keepMounted:y,nodeId:b,collisionAvoidance:g,adaptiveOrigin:j}),I=x.useState(`domReferenceElement`);ot(()=>{let e=I,t=M.current;if(e&&(M.current=e),t&&e&&e!==t){v.set(`instantType`,void 0);let e=new AbortController;return N(()=>{v.set(`instantType`,`trigger-change`)},e.signal),()=>{e.abort()}}},[I,N,v]);let L=E===!0&&w!==`trigger-hover`;ln(C&&L,D===`touch`,O,T);let R=v.useStateSetter(`positionerElement`),B={open:C,side:F.side,align:F.align,anchorHidden:F.anchorHidden,instant:k},V=un(e,B,{styles:F.positionerStyles,transitionStatus:A,props:_,refs:[t,R],hidden:!S,inert:!C});return(0,Q.jsxs)(Ac.Provider,{value:F,children:[S&&L&&(0,Q.jsx)($t,{inert:z(!C),cutout:T}),(0,Q.jsx)(At,{id:b,children:V})]})}),Nc=Z.createContext(void 0);function Pc(){let[e,t]=Z.useState(0),n=Qe(()=>(t(e=>e+1),()=>{t(e=>Math.max(0,e-1))}));return{context:Z.useMemo(()=>({register:n}),[n]),hasClosePart:e>0}}var Fc=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,initialFocus:a,finalFocus:o,...s}=e,c=gc(),l=jc(),u=nn(!0)!=null,{context:d,hasClosePart:f}=Pc(),p=c.useState(`open`),m=c.useState(`openMethod`),h=c.useState(`instantType`),g=c.useState(`transitionStatus`),_=c.useState(`popupProps`),v=c.useState(`titleElementId`),y=c.useState(`descriptionElementId`),b=c.useState(`modal`),x=c.useState(`mounted`),S=c.useState(`openChangeReason`),C=c.useState(`activeTriggerElement`),w=c.useState(`floatingRootContext`),T=w.useState(`floatingId`),E=c.useState(`disabled`),D=c.useState(`openOnHover`),O=c.useState(`closeDelay`);Ke({open:p,ref:c.context.popupRef,onComplete(){p&&c.context.onOpenChangeComplete?.(!0)}}),vn(w,{enabled:D&&!E,closeDelay:O});let k=a===void 0?Pt(c.context.popupRef):a,A=b!==!1&&f;c.useSyncedValue(`focusManagerModal`,A);let j=c.useStateSetter(`popupElement`),M={open:p,side:l.side,align:l.align,instant:h,transitionStatus:g},N=Je(`div`,e,{state:M,ref:[t,c.context.popupRef,j],props:[_,{id:T,role:`dialog`,...Tt,"aria-labelledby":v,"aria-describedby":y,onKeyDown(e){u&&Zt.has(e.key)&&e.stopPropagation()}},fn(g),s],stateAttributesMapping:mt});return(0,Q.jsx)(Lt,{context:w,openInteractionType:m,modal:A,disabled:!x||S===`trigger-hover`,initialFocus:k,returnFocus:o,restoreFocus:`popup`,previousFocusableElement:qe(C)?C:void 0,nextFocusableElement:c.context.triggerFocusTargetRef,beforeContentFocusGuardRef:c.context.beforeContentFocusGuardRef,children:(0,Q.jsx)(Nc.Provider,{value:d,children:N})})}),Ic=2;function Lc({...e}){return(0,Q.jsx)(Sc,{"data-slot":`popover`,...e})}function Rc({...e}){return(0,Q.jsx)(Ec,{"data-slot":`popover-trigger`,...e})}function zc({className:e,children:t,align:n=`center`,alignOffset:r=0,side:i=`bottom`,sideOffset:a=4,...o}){let s=Ht(),c=Math.min(s+Ic,8);return(0,Q.jsx)(kc,{children:(0,Q.jsx)(Mc,{align:n,alignOffset:r,side:i,sideOffset:a,className:`isolate z-50`,children:(0,Q.jsx)(Fc,{"data-slot":`popover-content`,className:q(`z-50 flex w-72 origin-(--transform-origin) flex-col gap-2.5 rounded-lg p-2.5 text-sm text-popover-foreground outline-hidden duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-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 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,Rt(c,3),e),...o,children:(0,Q.jsx)(Ut,{value:c,children:t})})})})}function Bc({trigger:e,children:t,contentId:n,open:r,defaultOpen:i,onOpenChange:a,side:o=`top`,align:s=`start`,sideOffset:c=6,className:l,overlay:u=!1}){let d=(0,Z.useId)(),f=n??d,[p,m]=(0,Z.useState)(i??!1),h=r??p;return(0,Q.jsxs)(Lc,{open:h,onOpenChange:e=>{r===void 0&&m(e),a?.(e)},children:[(0,Z.isValidElement)(e)?(0,Q.jsx)(Rc,{render:e,"aria-controls":f,className:`inline-flex`}):(0,Q.jsx)(Rc,{render:(0,Q.jsx)(V,{type:`button`,variant:`ghost`,children:e}),"aria-controls":f,className:`inline-flex`}),u&&h?(0,Q.jsx)(`div`,{className:`fixed inset-0 z-40 bg-black/20`,"aria-hidden":`true`}):null,(0,Q.jsx)(zc,{id:f,side:o,align:s,sideOffset:c,className:q(`max-h-[min(320px,var(--available-height,320px))] max-w-[calc(100vw-16px)] min-w-[180px] overflow-y-auto overscroll-contain p-1`,l),children:t})]})}function Vc({threads:e,query:t,activeId:n,onQueryChange:r,onSelect:i,className:a,...o}){let s=e.filter(e=>`${e.title} ${e.preview} ${(e.keywords??[]).join(` `)}`.toLowerCase().includes(t.toLowerCase())),c=s.filter(e=>e.pinned),l=[...new Set(s.flatMap(e=>e.pinned?[]:[e.group]))],u=[...c,...l.flatMap(e=>s.filter(t=>!t.pinned&&t.group===e))],[d,f]=(0,Z.useState)(null),p=e=>{if(u.length===0)return;let t=u.findIndex(e=>e.id===d),n=u[((t===-1?e>0?-1:0:t)+e+u.length)%u.length];f(n?n.id:null)},m=e=>{e.nativeEvent.isComposing||(e.key===`ArrowDown`?(e.preventDefault(),p(1)):e.key===`ArrowUp`?(e.preventDefault(),p(-1)):e.key===`Enter`&&d&&(e.preventDefault(),i?.(d)))},h=e=>(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>{f(e.id),i?.(e.id)},className:q(`flex flex-col gap-0.5 rounded-xl px-2 py-1 text-start transition-colors`,e.id===d?`bg-foreground/[0.05]`:e.id===n?`bg-foreground/[0.02] hover:bg-foreground/[0.03]`:`hover:bg-foreground/[0.03]`),children:[(0,Q.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[e.pinned&&(0,Q.jsx)(uo,{className:`text-foreground/30 size-2.5 shrink-0`}),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[13px]`,children:e.title})]}),(0,Q.jsx)(`span`,{className:`text-foreground/35 truncate text-xs`,children:e.preview})]},e.id);return(0,Q.jsxs)(`div`,{"data-slot":`thread-search`,className:q($r,`flex w-full max-w-sm flex-col gap-1.5 rounded-2xl p-3`,a),...o,children:[(0,Q.jsxs)(`div`,{className:q(Zr,`flex items-center gap-2 rounded-xl px-2.5 py-1.5`),children:[(0,Q.jsx)(Vr,{className:`text-foreground/30 size-3.5 shrink-0`}),(0,Q.jsx)(`input`,{value:t,onChange:e=>{f(null),r?.(e.target.value)},onKeyDown:m,placeholder:`Search threads`,"aria-label":`Search threads`,className:`text-foreground/85 placeholder:text-foreground/30 min-w-0 flex-1 bg-transparent text-base outline-none md:text-[13px]`})]}),c.length>0&&(0,Q.jsxs)(`div`,{className:`flex flex-col`,children:[(0,Q.jsx)(`span`,{className:q(`font-mono text-[11px] tracking-tight`,`text-foreground/25 px-2 pb-1`),children:`pinned`}),c.map(h)]}),l.map(e=>(0,Q.jsxs)(`div`,{className:`flex flex-col`,children:[(0,Q.jsx)(`span`,{className:q(Qr,`text-foreground/25 px-2 pb-1`),children:e}),s.flatMap(t=>!t.pinned&&t.group===e?[h(t)]:[])]},e)),s.length===0&&(0,Q.jsxs)(`span`,{className:`text-foreground/30 px-2 py-4 text-center text-xs`,children:[`No thread matches “`,t,`”`]})]})}function Hc(){try{return`0.5.8`}catch{return`dev`}}function Uc(){let e=Hc();return(0,Q.jsxs)(Oi,{variant:`secondary`,title:`Fleet ${e}`,"aria-label":`Fleet version ${e}`,className:`shrink-0 font-mono text-[10px] font-normal text-muted-foreground`,children:[`v`,e]})}var Wc={duration:.16,ease:Ne},Gc=[],Kc=[];function qc(e){return e.kind===`folder`||e.kind===`project`}function Jc(e,t,n=0,r=null){return e.flatMap(e=>{let i={item:e,depth:n,parentId:r};return!e.children?.length||!t.has(e.id)?[i]:[i,...Jc(e.children,t,n+1,e.id)]})}function Yc(e,t){for(let n of e){if(n.id===t)return n;let e=n.children?Yc(n.children,t):void 0;if(e)return e}}function Xc(e,t){return e.id===t||e.children?.some(e=>Xc(e,t))===!0}function Zc(e,t){let n,r=[];for(let i of e){if(i.id===t){n=i;continue}if(i.children?.length){let e=Zc(i.children,t);if(e.removed){n=e.removed,r.push({...i,children:e.items});continue}}r.push(i)}return{items:r,removed:n}}function Qc(e,t,n,r){if(n===null)return[...e,t];let i=[];for(let a of e){if(a.id===n){r===`before`?i.push(t,a):r===`after`?i.push(a,t):i.push({...a,children:[...a.children??[],t]});continue}a.children?.length?i.push({...a,children:Qc(a.children,t,n,r)}):i.push(a)}return i}function $c(e,t){let n=Yc(e,t.itemId);if(!n||n.disabled||t.targetId&&Xc(n,t.targetId))return null;let r=t.targetId?Yc(e,t.targetId):void 0;if(t.position===`inside`&&(!r||r.disabled||!qc(r)))return null;let i=Zc(e,t.itemId);return i.removed?Qc(i.items,i.removed,t.targetId,t.position):null}function el(e,t,n){return e.map(e=>({...e,label:e.id===t?n:e.label,children:e.children?el(e.children,t,n):void 0}))}function tl(e,t){if(e.kind===`action`)return null;let n=e.kind===`folder`||e.kind===`project`?t?Mr:Pr:e.kind===`bookmark`?Xa:vr;return(0,Q.jsx)(n,{className:`size-4`})}function nl({active:e,children:t}){let n=Ge()??!1,r=(0,Z.useRef)(null),i=(0,Z.useRef)(null),[a,o]=(0,Z.useState)(0);(0,Z.useEffect)(()=>{let e=()=>{let e=r.current,t=i.current;!e||!t||o(t.scrollWidth>e.clientWidth?t.scrollWidth+24:0)};e();let t=new ResizeObserver(e);return r.current&&t.observe(r.current),i.current&&t.observe(i.current),()=>t.disconnect()},[]);let s=e&&a>0&&!n;return(0,Q.jsx)(`span`,{ref:r,className:`block min-w-0 flex-1 overflow-hidden`,children:(0,Q.jsxs)(K.span,{className:`flex w-max items-center gap-6 whitespace-nowrap`,animate:{x:s?[0,-a]:0},transition:s?{duration:Math.max(2.4,a/34),ease:`linear`,repeat:1/0,repeatDelay:2}:Wc,children:[(0,Q.jsx)(`span`,{ref:i,children:t}),s?(0,Q.jsx)(`span`,{"aria-hidden":`true`,children:t}):null]})})}function rl({label:e,onCommit:t,onCancel:n}){let[r,i]=(0,Z.useState)(e),a=(0,Z.useRef)(null),o=(0,Z.useRef)(!1);return(0,Z.useEffect)(()=>{o.current=!1,i(e),requestAnimationFrame(()=>{a.current?.focus(),a.current?.select()})},[e]),(0,Q.jsx)(`input`,{ref:a,value:r,"aria-label":`Rename ${e}`,onChange:e=>i(e.target.value),draggable:!1,onClick:e=>e.stopPropagation(),onDoubleClick:e=>e.stopPropagation(),onBlur:()=>{o.current||t(r)},onKeyDown:e=>{e.stopPropagation(),e.key===`Enter`&&(o.current=!0,t(r)),e.key===`Escape`&&(o.current=!0,n())},className:`mx-1 h-7 min-w-0 flex-1 rounded-md border border-border bg-background px-2 text-base text-foreground outline-none focus-visible:ring-2 focus-visible:ring-ring md:text-sm`})}function il({item:e,menuOpen:t,onMenuOpenChange:n,onRenameStart:r,renderMenu:i}){let a=i?.(e,{close:()=>n(!1),rename:()=>{n(!1),r()}})??(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>{n(!1),r()},className:`flex h-8 w-full items-center gap-2 rounded-lg px-2.5 text-left text-xs text-foreground outline-none transition-colors hover:bg-muted focus-visible:bg-muted focus-visible:ring-2 focus-visible:ring-ring`,children:[(0,Q.jsx)(hn,{"aria-hidden":`true`,className:`size-3.5`}),`Rename`]});return(0,Q.jsxs)(ze,{open:t,onOpenChange:n,children:[(0,Q.jsx)(Re,{children:(0,Q.jsx)(`button`,{type:`button`,draggable:!1,tabIndex:-1,"aria-label":`Actions for ${e.label}`,onClick:e=>e.stopPropagation(),className:`grid size-7 shrink-0 place-items-center rounded-lg opacity-0 outline-none transition-opacity hover:bg-foreground/5 focus-visible:opacity-100 focus-visible:ring-2 focus-visible:ring-ring group-hover/resource:opacity-100 group-data-[menu-open=true]/resource:opacity-100`,children:(0,Q.jsx)(no,{"aria-hidden":`true`,className:`size-4`})})}),(0,Q.jsx)(Ve,{side:`bottom`,align:`end`,sideOffset:8,radius:12,className:`w-40 p-1.5`,children:(0,Q.jsx)(`div`,{"data-sidebar-resource-menu":e.id,children:a})})]})}function al(e,t,n,r,i){return q(`group/resource relative flex min-h-8 min-w-0 cursor-pointer items-center gap-2 rounded-lg pr-2 text-[13px] outline-none`,`text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`,`focus-visible:bg-muted/70 focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset`,`data-[menu-open=true]:bg-muted data-[menu-open=true]:text-foreground`,`data-[dragging=true]:opacity-40`,`data-[drop=inside]:bg-primary/10 data-[drop=inside]:ring-1 data-[drop=inside]:ring-primary/45`,`data-[drop=before]:before:absolute data-[drop=before]:before:-top-0.5 data-[drop=before]:before:right-2 data-[drop=before]:before:left-2 data-[drop=before]:before:h-0.5 data-[drop=before]:before:rounded-full data-[drop=before]:before:bg-primary`,`data-[drop=after]:after:absolute data-[drop=after]:after:-bottom-0.5 data-[drop=after]:after:right-2 data-[drop=after]:after:left-2 data-[drop=after]:after:h-0.5 data-[drop=after]:after:rounded-full data-[drop=after]:after:bg-primary`,!e&&t&&`bg-muted text-foreground`,e&&n&&`bg-muted/55 text-foreground ring-1 ring-border/70`,r===`action`&&`text-xs text-muted-foreground`,i&&`cursor-not-allowed opacity-45`)}function ol({acceptsChildren:e,allowMove:t,disabled:n,kind:r,onContainerSelect:i,onDragEnd:a,onDragOver:o,onDragStart:s,onDrop:c,onRenameStart:l,onSelect:u,renaming:d,row:f}){let p=(0,Z.useRef)(!1);return{handleClick:t=>{t.defaultPrevented||p.current||d||n||(e?i():u())},handleDoubleClick:t=>{e||r===`action`||n||(t.preventDefault(),l())},handleDragStartCapture:e=>{t&&(p.current=!0,s(e,f.item.id))},handleDragEndCapture:()=>{a(),requestAnimationFrame(()=>{p.current=!1})},handleDragOver:e=>{t&&o(e,f)},handleDrop:e=>{t&&c(e)}}}function sl({icon:e,renaming:t,label:n,onCommit:r,onCancel:i,activeLabel:a,item:o,secondaryAction:s,menuOpen:c,onMenuOpenChange:l,onRenameStart:u,renderMenu:d}){return t?(0,Q.jsxs)(Q.Fragment,{children:[e!==null&&(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`grid size-4 shrink-0 place-items-center`,children:e}),(0,Q.jsx)(rl,{label:n,onCommit:r,onCancel:i})]}):(0,Q.jsxs)(Q.Fragment,{children:[e!==null&&(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`grid size-4 shrink-0 place-items-center`,children:e}),(0,Q.jsx)(nl,{active:a,children:n}),s,!o.disabled&&o.kind!==`action`&&(0,Q.jsx)(il,{item:o,menuOpen:c,onMenuOpenChange:l,onRenameStart:u,renderMenu:d})]})}function cl(e,t,n,r,i,a,o,s,c,l){return{"aria-level":e.depth+1,"aria-selected":t?void 0:n,"aria-expanded":t?r:void 0,"aria-disabled":e.item.disabled||void 0,tabIndex:i?0:-1,draggable:a&&!e.item.disabled&&!o,"data-menu-open":s||void 0,"data-kind":e.item.kind,"data-drop":c??void 0,"data-dragging":l||void 0}}function ll(e){let t=Ge()??!1,[n,r]=(0,Z.useState)(!1),i=qc(e.row.item),a=e.renderIcon?.(e.row.item),o=a===void 0?tl(e.row.item,e.expanded):a,s=e.draggingId===e.row.item.id,c=e.dropTarget?.id===e.row.item.id?e.dropTarget.position:null,l=ol({acceptsChildren:i,allowMove:e.allowMove,disabled:e.row.item.disabled,kind:e.row.item.kind,onContainerSelect:e.onContainerSelect,onDragEnd:e.onDragEnd,onDragOver:e.onDragOver,onDragStart:e.onDragStart,onDrop:e.onDrop,onRenameStart:e.onRenameStart,onSelect:e.onSelect,renaming:e.renaming,row:e.row}),u=cl(e.row,i,e.active,e.expanded,e.focused,e.allowMove,e.renaming,e.menuOpen,c,s);return(0,Q.jsx)(K.div,{ref:e.setRef,layout:`position`,transition:t?{duration:0}:je,role:`treeitem`,...u,onFocus:e.onFocus,onKeyDown:e.onKeyDown,onClick:l.handleClick,onDoubleClick:l.handleDoubleClick,onMouseEnter:()=>r(!0),onMouseLeave:()=>r(!1),onDragStartCapture:l.handleDragStartCapture,onDragEndCapture:l.handleDragEndCapture,onDragOver:l.handleDragOver,onDrop:l.handleDrop,className:al(i,e.active,e.containerActive,e.row.item.kind,e.row.item.disabled),style:{paddingLeft:`${8+(e.row.depth+(e.row.item.indent??0))*14}px`},children:(0,Q.jsx)(sl,{icon:o,renaming:e.renaming,label:e.row.item.label,onCommit:e.onRenameCommit,onCancel:e.onRenameCancel,activeLabel:n||e.menuOpen,item:e.row.item,secondaryAction:e.renaming?null:e.renderSecondaryAction?.(e.row.item),menuOpen:e.menuOpen,onMenuOpenChange:e.onMenuOpenChange,onRenameStart:e.onRenameStart,renderMenu:e.renderMenu})})}function ul({flat:e,selectedId:t,activeContainerId:n,expandedIds:r,focusedId:i,draggingId:a,dropTarget:o,menuOpenId:s,renamingId:c,allowMove:l,announcement:u,ariaLabel:d,className:f,renderIcon:p,renderSecondaryAction:m,renderMenu:h,onFocus:g,onSelect:_,onContainerSelect:v,onKeyDown:y,onRenameStart:b,onRenameCancel:x,onRenameCommit:S,onMenuOpenChange:C,onDragStart:w,onDragEnd:T,onDragOver:E,onRootDragOver:D,onDrop:O,setRef:k}){return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{role:`tree`,"aria-label":d,"aria-multiselectable":`false`,onDragOver:D,onDrop:O,className:q(`relative flex min-w-0 flex-col gap-0.5 [overflow-anchor:none] group-data-[state=collapsed]/sidebar:hidden`,a&&`select-none pb-9`,f),children:[(0,Q.jsx)(We,{initial:!1,children:e.map(e=>(0,Q.jsx)(ll,{row:e,active:t===e.item.id,containerActive:n===e.item.id,expanded:r.has(e.item.id),focused:i===e.item.id,draggingId:a,dropTarget:o,menuOpen:s===e.item.id,renaming:c===e.item.id,onFocus:()=>g(e.item.id),onSelect:()=>_(e.item.id),onContainerSelect:()=>v(e.item.id),allowMove:l,onKeyDown:t=>y(t,e),onRenameStart:()=>b(e.item.id),onRenameCancel:x,onRenameCommit:t=>S(e,t),onMenuOpenChange:t=>C(e.item.id,t),onDragStart:w,onDragEnd:T,onDragOver:(e,t)=>E(e,t),onDrop:O,renderIcon:p,renderSecondaryAction:m,renderMenu:h,setRef:t=>k(e.item.id,t)},e.item.id))}),a?(0,Q.jsx)(`div`,{"aria-hidden":`true`,"data-active":o?.id===null||void 0,className:`absolute inset-x-1 bottom-0 flex h-8 items-center justify-center rounded-lg border border-dashed border-border text-[10px] text-muted-foreground data-[active=true]:border-primary/50 data-[active=true]:bg-primary/10 data-[active=true]:text-foreground`,children:`Move to top level`}):null]}),(0,Q.jsx)(`span`,{className:`sr-only`,"aria-live":`polite`,children:u})]})}function dl({expandedIds:e,flat:t,focusRow:n,onContainerSelect:r,performMove:i,select:a,setMenuOpenId:o,setRenamingId:s,toggle:c,updateExpandedIds:l}){return(0,Z.useCallback)((u,d)=>{let f=t.findIndex(({item:e})=>e.id===d.item.id),p=t[f-1],m=t[f+1],h=u.altKey&&u.shiftKey;if(u.key===`ArrowDown`&&!h&&m){u.preventDefault(),n(m.item.id);return}if(u.key===`ArrowUp`&&!h&&p){u.preventDefault(),n(p.item.id);return}if(u.key===`Home`&&t[0]){u.preventDefault(),n(t[0].item.id);return}if(u.key===`End`&&t.at(-1)){u.preventDefault(),n(t.at(-1)?.item.id??d.item.id);return}if(d.item.disabled){u.key===`ArrowLeft`&&d.parentId?(u.preventDefault(),n(d.parentId)):(h||[`ArrowRight`,`Enter`,` `,`F2`,`ContextMenu`].includes(u.key)||u.shiftKey&&u.key===`F10`)&&u.preventDefault();return}if(h&&u.key===`ArrowUp`&&p){u.preventDefault(),i({itemId:d.item.id,targetId:p.item.id,position:`before`});return}if(h&&u.key===`ArrowDown`&&m){u.preventDefault(),i({itemId:d.item.id,targetId:m.item.id,position:`after`});return}if(h&&u.key===`ArrowRight`&&p&&qc(p.item)){u.preventDefault(),l(e=>new Set(e).add(p.item.id)),i({itemId:d.item.id,targetId:p.item.id,position:`inside`});return}if(h&&u.key===`ArrowLeft`&&d.parentId){u.preventDefault(),i({itemId:d.item.id,targetId:d.parentId,position:`after`});return}u.key===`ArrowRight`&&qc(d.item)?(u.preventDefault(),e.has(d.item.id)?m?.parentId===d.item.id&&n(m.item.id):c(d.item.id)):u.key===`ArrowLeft`?(u.preventDefault(),e.has(d.item.id)?c(d.item.id):d.parentId&&n(d.parentId)):u.key===`Enter`||u.key===` `?(u.preventDefault(),qc(d.item)?r?r(d.item.id):c(d.item.id):a(d.item.id)):u.key===`F2`&&d.item.kind!==`action`?(u.preventDefault(),s(d.item.id)):(u.key===`ContextMenu`||u.shiftKey&&u.key===`F10`)&&(u.preventDefault(),o(d.item.id))},[e,t,n,r,i,a,o,s,c,l])}function fl({items:e,defaultItems:t=Gc,onItemsChange:n,onMove:r,onMoveError:i,allowMove:a=!0,onRename:o,activeId:s,activeContainerId:c,defaultActiveId:l=null,onActiveChange:u,onContainerSelect:d,expandedIds:f,defaultExpandedIds:p=Kc,onExpandedIdsChange:m,renderIcon:h,renderSecondaryAction:g,renderMenu:_,ariaLabel:v=`Resources`,className:y}){let[b,x]=(0,Z.useState)(e??t),[S,C]=(0,Z.useState)(l),[w,T]=(0,Z.useState)(()=>new Set(p)),[E,D]=(0,Z.useState)(s??l),[O,k]=(0,Z.useState)(null),[A,j]=(0,Z.useState)(null),[M,N]=(0,Z.useState)(null),[P,F]=(0,Z.useState)(null),[I,L]=(0,Z.useState)(``),R=(0,Z.useRef)(new Map),z=(0,Z.useRef)(!1),B=b,V=s??S,H=(0,Z.useMemo)(()=>f===void 0?w:new Set(f),[f,w]);(0,Z.useEffect)(()=>{e&&x(e)},[e]),(0,Z.useEffect)(()=>{f===void 0&&p.length!==0&&T(e=>{let t=new Set(e),n=!1;for(let e of p)t.has(e)||(t.add(e),n=!0);return n?t:e})},[f,p]);let U=(0,Z.useMemo)(()=>Jc(B,H),[H,B]);(0,Z.useEffect)(()=>{E&&U.some(e=>e.item.id===E)||D(U[0]?.item.id??null)},[U,E]),(0,Z.useEffect)(()=>{if(!M)return;let e=requestAnimationFrame(()=>{Array.from(document.querySelectorAll(`[data-sidebar-resource-menu]`)).find(e=>e.dataset.sidebarResourceMenu===M)?.querySelector(`button, a[href]`)?.focus()});return()=>cancelAnimationFrame(e)},[M]);let W=(0,Z.useCallback)(e=>{x(e),n?.(e)},[n]),G=(0,Z.useCallback)(async e=>{if(z.current){L(`Wait for the current move to finish.`);return}let t=B,n=$c(t,e);if(!n||n===t)return;z.current=!0,W(n),j(null),k(null);let a=Yc(t,e.itemId),o=e.targetId?Yc(t,e.targetId):null;L(o?`Moved ${a?.label??`item`} ${e.position} ${o.label}.`:`Moved ${a?.label??`item`} to the top level.`);try{await r?.(e)}catch(n){W(t),L(`Move failed. ${a?.label??`Item`} was restored.`),i?.(n,e)}finally{z.current=!1}},[r,i,B,W]),ee=(0,Z.useCallback)(e=>{D(e),requestAnimationFrame(()=>R.current.get(e)?.focus())},[]),te=(0,Z.useCallback)(e=>{s===void 0&&C(e),u?.(e)},[s,u]),ne=(0,Z.useCallback)(e=>{let t=e(new Set(H));f===void 0&&T(t),m?.([...t])},[f,H,m]),re=(0,Z.useCallback)(e=>{ne(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[ne]),ie=dl({expandedIds:H,flat:U,focusRow:ee,onContainerSelect:d,performMove:G,select:te,setMenuOpenId:N,setRenamingId:F,toggle:re,updateExpandedIds:ne});return(0,Q.jsx)(ul,{flat:U,selectedId:V,activeContainerId:c,expandedIds:H,focusedId:E,draggingId:O,dropTarget:A,menuOpenId:M,renamingId:P,allowMove:a,announcement:I,ariaLabel:v,className:y,renderIcon:h,renderSecondaryAction:g,renderMenu:_,onFocus:D,onSelect:te,onContainerSelect:e=>{d?d(e):re(e)},onKeyDown:ie,onRenameStart:F,onRenameCancel:()=>F(null),onRenameCommit:(e,t)=>{let n=t.trim();if(F(null),!n||n===e.item.label)return;let r=B;W(el(r,e.item.id,n)),Promise.resolve(o?.(e.item,n)).catch(()=>{W(r),L(`Rename failed. ${e.item.label} was restored.`)})},onMenuOpenChange:(e,t)=>{N(t?e:null),t||ee(e)},onDragStart:(e,t)=>{k(t),e.dataTransfer.effectAllowed=`move`,e.dataTransfer.setData(`text/plain`,t)},onDragEnd:()=>{k(null),j(null)},onDragOver:(e,t)=>{if(!O||O===t.item.id)return;let n=Yc(B,O);if(n&&Xc(n,t.item.id))return;e.preventDefault(),e.stopPropagation();let r=e.currentTarget.getBoundingClientRect(),i=(e.clientY-r.top)/r.height,a=!t.item.disabled&&qc(t.item)&&i>=.25&&i<=.75?`inside`:i<.5?`before`:`after`;j({id:t.item.id,position:a})},onRootDragOver:e=>{!O||e.target!==e.currentTarget||(e.preventDefault(),j({id:null,position:`after`}))},onDrop:e=>{e.preventDefault(),e.stopPropagation(),O&&A&&G({itemId:O,targetId:A.id,position:A.position})},setRef:(e,t)=>{t?R.current.set(e,t):R.current.delete(e)}})}var pl=5,ml=[`a[href]`,`button:not([disabled])`,`input:not([disabled])`,`select:not([disabled])`,`textarea:not([disabled])`,`[tabindex]:not([tabindex="-1"])`].join(`,`);function hl(e,t){let n=e-(t-1)/2,r=Math.abs(n),i=Math.max(0,2-r)*8;return{x:n*44,y:8-i,rotate:n*6,scale:r===0?1.04:r===1?.95:.88,opacity:r===0?1:r===1?.78:.58,zIndex:10-r}}function gl({title:e,countText:t,dialogTitleId:n,previewItems:r,isExpanded:i,isClosing:a,reduce:o,transition:s,dialogRef:c,closeButtonRef:l,closeOverlay:u}){return!i&&!a?null:(0,Q.jsxs)(`div`,{ref:c,role:`dialog`,"aria-modal":`true`,"aria-labelledby":n,"aria-hidden":i?void 0:`true`,className:q(`fixed inset-0 z-50 flex items-start justify-center overflow-y-auto sm:items-center`,a&&`pointer-events-none`),children:[(0,Q.jsx)(We,{initial:!1,children:i?(0,Q.jsx)(K.button,{type:`button`,tabIndex:-1,"aria-label":`Close file overlay`,onClick:u,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:o?{duration:0}:{duration:.18},className:`absolute inset-0 cursor-default bg-background/80 backdrop-blur-xl`},`project-files-backdrop`):null}),(0,Q.jsxs)(`div`,{className:`relative z-10 w-full max-w-5xl px-6 py-8`,children:[(0,Q.jsx)(We,{initial:!1,children:i?(0,Q.jsxs)(K.div,{initial:{opacity:0,y:o?0:8},animate:{opacity:1,y:0},exit:{opacity:0,y:o?0:-8},transition:o?{duration:0}:{duration:.18},className:`mb-6 flex items-center justify-between gap-4`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h2`,{id:n,className:`text-xl font-medium text-foreground`,children:e}),(0,Q.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:t})]}),(0,Q.jsx)(`button`,{ref:l,type:`button`,onClick:u,"aria-label":`Close ${e}`,className:`flex size-10 items-center justify-center rounded-full border border-foreground/10 bg-background/50 text-muted-foreground backdrop-blur-xl transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,children:(0,Q.jsx)(Wr,{className:`size-4`,"aria-hidden":`true`})})]},`project-files-header`):null}),(0,Q.jsx)(`div`,{className:`grid grid-cols-2 place-items-center gap-3 sm:grid-cols-3 lg:grid-cols-5`,children:i?r.map(e=>(0,Q.jsx)(K.div,{layoutId:`file-${e.id}`,transition:s,className:`aspect-[3/4] w-full max-w-40 overflow-hidden rounded-xl border border-foreground/10 bg-background/50 backdrop-blur-xl`,children:e.content},e.id)):null})]})]})}function _l({title:e,description:t=`Updated recently`,previews:n=[],count:r=n.length,itemLabel:i=`file`,open:a,defaultOpen:o=!1,onOpenChange:s,expanded:c,defaultExpanded:l=!1,onExpandedChange:u,onClick:d,disabled:f=!1,ariaLabel:p,className:m}){let h=Ge(),g=Gn(),_=(0,Z.useId)(),v=`${_}-title`,y=(0,Z.useRef)(!1),b=(0,Z.useRef)(!1),x=(0,Z.useRef)(!1),S=(0,Z.useRef)(null),C=(0,Z.useRef)(null),w=(0,Z.useRef)(null),T=Ie(),[E,D]=(0,Z.useState)(o),[O,k]=(0,Z.useState)(l),[A,j]=(0,Z.useState)(!1),M=a!==void 0,N=c!==void 0,P=c??O,F=(a??E)||P,I=n.slice(0,pl),L=h?{duration:0}:je,R=`${r} ${i}${r===1?``:`s`}`,z=(0,Z.useCallback)(e=>{f||(M||D(e),s?.(e))},[f,s,M]),B=(0,Z.useCallback)(e=>{f||I.length===0||(N||k(e),u?.(e))},[f,N,u,I.length]),V=(0,Z.useCallback)(()=>{j(!1),x.current=!0,requestAnimationFrame(()=>S.current?.focus())},[]),H=(0,Z.useCallback)(()=>{j(!0),z(!1),B(!1)},[B,z]),U=(0,Z.useEffectEvent)(H);(0,Z.useEffect)(()=>{h&&A&&V()},[V,A,h]),(0,Z.useEffect)(()=>{if(!P)return;let e=document.body.style.overflow,t=requestAnimationFrame(()=>C.current?.focus());document.body.style.overflow=`hidden`;let n=e=>{if(e.key===`Escape`){e.preventDefault(),U();return}if(e.key!==`Tab`||!w.current)return;let t=Array.from(w.current.querySelectorAll(ml)).filter(e=>e.tabIndex>=0),n=t[0],r=t.at(-1);!n||!r||(e.shiftKey&&document.activeElement===n?(e.preventDefault(),r.focus()):!e.shiftKey&&document.activeElement===r&&(e.preventDefault(),n.focus()))};return document.addEventListener(`keydown`,n),()=>{cancelAnimationFrame(t),document.body.style.overflow=e,document.removeEventListener(`keydown`,n)}},[P]);let W=()=>{j(!1),B(!0),z(!0),d?.()},G=(0,Q.jsx)(gl,{title:e,countText:R,dialogTitleId:v,previewItems:I,isExpanded:P,isClosing:A,reduce:h??!1,transition:L,dialogRef:w,closeButtonRef:C,closeOverlay:H});return(0,Q.jsxs)(Sa,{id:_,children:[(0,Q.jsxs)(K.button,{ref:S,type:`button`,disabled:f,"aria-label":p,"aria-haspopup":`dialog`,"aria-expanded":P,"data-open":F?`true`:`false`,"data-expanded":P?`true`:`false`,tabIndex:P?-1:void 0,onPointerEnter:()=>{g&&(y.current=!0,z(!0))},onPointerLeave:()=>{g&&(y.current=!1,!P&&!A&&z(b.current))},onFocus:()=>{if(x.current){x.current=!1,b.current=!1;return}b.current=!0,z(!0)},onBlur:()=>{b.current=!1,!P&&!A&&z(y.current)},onClick:W,whileTap:h||f?void 0:{scale:.98},transition:h?{duration:0}:Oe,className:q(`relative block h-56 w-72 select-none rounded-2xl text-left outline-none [perspective:1200px] focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-4 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50`,m),children:[(0,Q.jsx)(K.span,{"aria-hidden":`true`,animate:{rotateX:F&&!h?15:0},transition:L,className:`absolute inset-0 rounded-2xl border border-foreground/10 bg-background/25 backdrop-blur-xl [transform-origin:center_bottom]`}),(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`pointer-events-none absolute inset-0`,children:(0,Q.jsx)(`span`,{className:`absolute left-1/2 top-0 block h-0 w-0`,children:(0,Q.jsx)(We,{initial:!1,children:P?null:I.map((e,t)=>{let n=hl(t,I.length);return(0,Q.jsx)(K.span,{layoutId:`file-${e.id}`,initial:!1,animate:F&&!h?{x:n.x*1.4,y:n.y-8,rotate:n.rotate*1.3,scale:n.scale*1.02,opacity:Math.min(1,n.opacity+.18)}:{x:n.x,y:n.y,rotate:n.rotate,scale:n.scale,opacity:n.opacity},transition:L,onLayoutAnimationComplete:()=>{A&&t===0&&V()},className:`absolute left-0 top-0 -ml-12 block h-40 w-24 overflow-hidden rounded-lg border border-foreground/10 bg-background/45 backdrop-blur-lg`,style:{zIndex:n.zIndex},children:e.content},e.id)})})})}),(0,Q.jsxs)(K.span,{initial:!1,animate:{rotateX:F&&!h?-25:0},transition:L,className:`absolute inset-x-0 bottom-0 z-20 overflow-hidden rounded-2xl border border-foreground/10 bg-background/60 backdrop-blur-2xl [backface-visibility:hidden] [transform-origin:center_bottom]`,children:[(0,Q.jsx)(`span`,{className:`flex h-16 items-center px-4`,children:(0,Q.jsx)(`span`,{className:`line-clamp-2 text-xl font-medium leading-tight text-foreground`,children:e})}),(0,Q.jsxs)(`span`,{className:`flex h-12 items-center justify-between gap-3 border-t border-foreground/10 px-4`,children:[(0,Q.jsx)(`span`,{className:`shrink-0 text-sm font-medium text-foreground/70`,children:R}),(0,Q.jsx)(`span`,{className:`truncate text-sm text-muted-foreground`,children:t})]})]})]}),T?(0,ps.createPortal)(G,document.body):null]})}function vl(e){return e?.status===`running`?(0,Q.jsx)(mr,{className:`size-3.5 animate-spin`}):e?.status===`failed`?(0,Q.jsx)(Ur,{className:`size-3.5 text-destructive`}):e?.status===`interrupted`?(0,Q.jsx)($a,{className:`size-3.5 text-muted-foreground`}):null}function yl({projectActionsOpen:e,setProjectActionsOpen:t,expandedProjectIds:n,setExpandedProjectIds:r,setCreateOpen:i,projects:a,projectSessions:o,sidebarItems:s,activeProjectId:c,activeSessionId:l,onNewSession:u,onNewSessionInProject:d,onProjectSelect:f,onRenameSession:p,onCreateProject:m,resumeResource:h,toggleProjectResource:g,renderMenu:_}){return(0,Q.jsx)(Rs,{className:`gap-0 px-2 pb-1 pt-2`,children:(0,Q.jsxs)(Bs,{className:`p-0`,children:[(0,Q.jsxs)(`div`,{className:`relative mb-1 h-8`,children:[(0,Q.jsx)(Vs,{className:`mb-0 h-8 pr-16 text-xs font-normal normal-case tracking-normal text-muted-foreground`,children:`Projects`}),(0,Q.jsxs)(`div`,{className:`absolute inset-y-0 right-1 flex items-center gap-0.5`,children:[(0,Q.jsxs)(Bc,{open:e,onOpenChange:t,side:`bottom`,align:`end`,className:`w-44 p-1`,trigger:(0,Q.jsx)(`button`,{type:`button`,"aria-label":`Project actions`,title:`Project actions`,className:`grid size-6 place-items-center rounded-md text-muted-foreground outline-none transition-colors hover:bg-muted hover:text-foreground focus-visible:ring-2 focus-visible:ring-sidebar-ring`,children:(0,Q.jsx)(no,{"aria-hidden":`true`,className:`size-3.5`})}),children:[m?(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>{t(!1),i(!0)},className:`flex h-8 w-full items-center gap-2 rounded-md px-2 text-xs outline-none hover:bg-muted focus-visible:bg-muted`,children:[(0,Q.jsx)(io,{"aria-hidden":`true`,className:`size-3.5`}),`Add project`]}):null,(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>{t(!1),r([])},className:`flex h-8 w-full items-center gap-2 rounded-md px-2 text-xs outline-none hover:bg-muted focus-visible:bg-muted`,children:[(0,Q.jsx)(Qn,{"aria-hidden":`true`,className:`size-3.5`}),`Collapse all`]})]}),m?(0,Q.jsx)(`button`,{type:`button`,"aria-label":`Add project`,title:`Add project`,onClick:()=>i(!0),className:`grid size-6 place-items-center rounded-md text-muted-foreground outline-none transition-colors hover:bg-muted hover:text-foreground focus-visible:ring-2 focus-visible:ring-sidebar-ring`,children:(0,Q.jsx)(Lr,{"aria-hidden":`true`,className:`size-3.5`})}):null]})]}),(0,Q.jsx)(Hs,{children:a.length===0?(0,Q.jsx)(`div`,{className:`px-2 py-4`,children:(0,Q.jsx)(_l,{title:`Add a project`,description:`Choose a local directory for Fleet Prime.`,count:0,itemLabel:`session`,previews:[{id:`empty-project`,content:(0,Q.jsx)(io,{className:`size-5 text-muted-foreground`})}],onClick:()=>i(!0),ariaLabel:`Add a project`,className:`w-full`})}):(0,Q.jsx)(fl,{items:s,activeId:l?Zs(l):null,activeContainerId:c?Xs(c):null,expandedIds:n,onExpandedIdsChange:r,onActiveChange:h,onContainerSelect:g,onRename:(e,t)=>{let n=$s(e.id,Ys);n&&p(n,t)},renderMenu:_,renderIcon:e=>{if($s(e.id,`project:`))return(0,Q.jsx)(Pr,{className:`size-4`});if(e.kind===`action`)return null;let t=$s(e.id,Ys);return vl(o.find(e=>e.sessionId===t))},renderSecondaryAction:e=>{let t=$s(e.id,Js);return!t||t===`unassigned`?null:(0,Q.jsx)(V,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":`New chat in ${e.label}`,title:`New chat in ${e.label}`,onClick:e=>{e.stopPropagation(),d?d(t):(f?.(t),u())},className:`size-7 shrink-0 opacity-0 group-hover/resource:opacity-100 group-focus-within/resource:opacity-100 focus-visible:opacity-100 [@media(hover:none)]:opacity-100`,children:(0,Q.jsx)(so,{"data-icon":`inline-start`,className:`size-3.5`})})},allowMove:!1,ariaLabel:`Projects and sessions`,className:`px-0`})})]})})}var bl=`flex h-8 w-full items-center gap-2 rounded-md px-2 text-xs outline-none transition-colors hover:bg-muted focus-visible:bg-muted`;function xl({icon:e,label:t,onClick:n,href:r}){return r?(0,Q.jsxs)(`a`,{href:r,target:`_blank`,rel:`noreferrer`,className:bl,children:[(0,Q.jsx)(e,{className:`size-3.5`}),t]}):(0,Q.jsxs)(`button`,{type:`button`,onClick:n,className:bl,children:[(0,Q.jsx)(e,{className:`size-3.5`}),t]})}function Sl({children:e}){return(0,Q.jsx)(`kbd`,{className:`rounded border border-border/60 bg-muted/60 px-1 font-mono text-[10px] leading-4 text-muted-foreground`,children:e})}function Cl({brandMenuOpen:e,setBrandMenuOpen:t,searchOpen:n,setSearchOpen:r,query:i,setQuery:a,projectActionsOpen:o,setProjectActionsOpen:s,expandedProjectIds:c,setExpandedProjectIds:l,setCreateOpen:u,projects:d,projectSessions:f,sidebarItems:p,sortedProjects:m,projectById:h,activeProjectId:g,activeSessionId:_,onNewSession:v,onNewSessionInProject:y,onProjectSelect:b,onRenameSession:x,onCreateProject:S,onOpenSettings:C,accountMenu:w,resumeResource:T,toggleProjectResource:E,selectSearchResult:D,renderMenu:O}){let k=(0,Z.useMemo)(()=>lc(f).map(e=>({id:e.sessionId,title:ec(e),preview:tc(e,h),group:nc(e.updatedAt),keywords:e.firstMessage?[kr(e.firstMessage)]:[]})),[h,f]),A=(0,Z.useMemo)(()=>{let e=i.trim().toLowerCase();return e?m.filter(t=>`${t.name} ${t.pathLabel}`.toLowerCase().includes(e)):m},[i,m]);return(0,Q.jsx)(Ns,{ariaLabel:`Fleet projects and sessions`,collapsible:`offcanvas`,variant:`floating`,className:`text-sidebar-foreground`,children:(0,Q.jsxs)(Ut,{value:2,children:[(0,Q.jsxs)(Ls,{className:`gap-2 border-0 px-2.5 pb-2 pt-2.5`,children:[(0,Q.jsxs)(`div`,{className:`relative flex h-9 min-w-0 items-center justify-between gap-1`,children:[(0,Q.jsxs)(Bc,{open:e,onOpenChange:t,side:`bottom`,align:`start`,trigger:(0,Q.jsxs)(`button`,{type:`button`,className:`flex h-8 w-fit shrink-0 items-center gap-1 rounded-lg px-2 text-left text-sm font-medium outline-none transition-colors hover:bg-sidebar-accent focus-visible:ring-2 focus-visible:ring-sidebar-ring`,children:[(0,Q.jsx)(`span`,{className:`truncate`,children:`Qredence Fleet`}),(0,Q.jsx)(Qn,{className:`size-3.5 text-muted-foreground`})]}),className:`w-52 p-1`,children:[S?(0,Q.jsx)(xl,{icon:io,label:`Add project`,onClick:()=>{t(!1),u(!0)}}):null,(0,Q.jsx)(xl,{icon:yn,label:`Settings`,onClick:()=>{t(!1),C?.()}}),(0,Q.jsx)(xl,{icon:Jn,label:`Documentation`,href:Ws})]}),(0,Q.jsx)(Bc,{open:n,onOpenChange:r,side:`bottom`,align:`end`,className:`w-64 p-0`,trigger:(0,Q.jsx)(V,{type:`button`,variant:`ghost`,size:`icon`,"aria-label":`Search projects and sessions`,title:`Search projects and sessions`,className:`shrink-0 text-muted-foreground hover:bg-sidebar-accent`,children:(0,Q.jsx)(Vr,{"data-icon":`inline-start`,className:`size-4`})}),children:(0,Q.jsxs)(`div`,{className:`max-h-[min(32rem,calc(100vh-5rem))] overflow-y-auto`,children:[(0,Q.jsx)(Vc,{threads:k,query:i,activeId:_??``,onQueryChange:a,onSelect:e=>D(`search-session:${e}`),className:`max-w-none rounded-none border-0 bg-transparent p-2 shadow-none`}),(0,Q.jsxs)(`div`,{className:`border-t border-border/60 px-2 pb-2 pt-1.5`,children:[(0,Q.jsx)(`span`,{className:`px-2 pb-1 font-mono text-[10px] uppercase tracking-[0.14em] text-muted-foreground/60`,children:`Projects`}),(0,Q.jsxs)(`div`,{className:`mt-1 flex flex-col gap-0.5`,children:[A.map(e=>(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>D(`search-project:${e.projectId}`),className:`flex w-full min-w-0 items-center gap-2 rounded-xl px-2 py-1.5 text-left text-xs outline-none transition-colors hover:bg-foreground/[0.03] focus-visible:ring-2 focus-visible:ring-ring`,children:[(0,Q.jsx)(Pr,{className:`size-3.5 shrink-0 text-muted-foreground/60`}),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.name}),(0,Q.jsx)(`span`,{className:`max-w-24 truncate text-[10px] text-muted-foreground/55`,children:e.pathLabel})]},e.projectId)),A.length===0?(0,Q.jsxs)(`span`,{className:`px-2 py-2 text-center text-[11px] text-muted-foreground/60`,children:[`No project matches “`,i,`”`]}):null]})]}),(0,Q.jsxs)(`div`,{className:`flex items-center justify-end gap-3 border-t border-border/60 px-3 py-2 text-[10px] text-muted-foreground/70`,children:[(0,Q.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,Q.jsx)(Sl,{children:`↑`}),(0,Q.jsx)(Sl,{children:`↓`}),`navigate`]}),(0,Q.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,Q.jsx)(Sl,{children:`↵`}),`open`]}),(0,Q.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,Q.jsx)(Sl,{children:`esc`}),`close`]})]})]})})]}),(0,Q.jsxs)(`button`,{type:`button`,onClick:v,className:`flex h-8 w-full items-center justify-start gap-2 rounded-lg px-2 text-[13px] font-normal text-sidebar-foreground outline-none transition-colors hover:bg-sidebar-accent focus-visible:bg-sidebar-accent focus-visible:ring-2 focus-visible:ring-sidebar-ring`,children:[(0,Q.jsx)(po,{className:`size-4 shrink-0 text-muted-foreground`}),`New chat`]})]}),(0,Q.jsx)(yl,{projectActionsOpen:o,setProjectActionsOpen:s,expandedProjectIds:c,setExpandedProjectIds:l,setCreateOpen:u,projects:d,projectSessions:f,sidebarItems:p,activeProjectId:g,activeSessionId:_,onNewSession:v,onNewSessionInProject:y,onProjectSelect:b,onRenameSession:x,onCreateProject:S,resumeResource:T,toggleProjectResource:E,renderMenu:O}),(0,Q.jsxs)(zs,{className:`flex-row items-center gap-1 border-sidebar-border px-2.5 py-2 pb-[max(0.5rem,env(safe-area-inset-bottom))]`,children:[(0,Q.jsx)(`div`,{className:`min-w-0 flex-1`,children:w??(0,Q.jsx)(`span`,{className:`flex h-8 items-center px-2 text-[13px]`,children:`Qredence`})}),(0,Q.jsx)(Uc,{}),(0,Q.jsx)(`a`,{href:Ws,target:`_blank`,rel:`noreferrer`,"aria-label":`Open Qredence documentation`,title:`Help`,className:`grid size-8 shrink-0 place-items-center rounded-lg text-muted-foreground outline-none transition-colors hover:bg-sidebar-accent hover:text-foreground focus-visible:ring-2 focus-visible:ring-sidebar-ring`,children:(0,Q.jsx)(Qa,{className:`size-4`})})]}),(0,Q.jsx)(Fs,{})]})})}var wl=(e,t,n)=>{let r=t.trim().toLocaleLowerCase();if(!r)return!0;let i=[e,...n].join(` `).toLocaleLowerCase(),a=0;for(let e of i)if(e===r[a]&&(a+=1),a===r.length)return!0;return!1},Tl=(0,Z.createContext)(null),El=(0,Z.createContext)(null);function Dl(e){let t=(0,Z.useContext)(Tl);if(!t)throw Error(`${e} must be used within <Combobox>`);return t}function Ol(...e){return t=>{for(let n of e)typeof n==`function`?n(t):n&&typeof n==`object`&&(n.current=t)}}function kl({children:e,value:t,defaultValue:n,onValueChange:r,open:i,defaultOpen:a=!1,onOpenChange:o,query:s,defaultQuery:c=``,onQueryChange:l,filter:u=wl,disabled:d=!1,className:f}){let p=Ge()??!1,m=(0,Z.useId)(),h=(0,Z.useRef)(null),g=(0,Z.useRef)(null),_=(0,Z.useRef)(null),v=(0,Z.useRef)(null),[y,b]=(0,Z.useState)(n),[x,S]=(0,Z.useState)(a),[C,w]=(0,Z.useState)(c),[T,E]=(0,Z.useState)(null),[D,O]=(0,Z.useState)(new Map),k=t!==void 0,A=i!==void 0,j=s!==void 0,M=k?t:y,N=A?i:x,P=j?s:C,F=(0,Z.useCallback)(e=>{j||w(e),l?.(e)},[l,j]),I=(0,Z.useCallback)((e,t=!1)=>{d&&e||(A||S(e),o?.(e),e||F(``),t&&requestAnimationFrame(()=>v.current?.focus({preventScroll:!0})))},[d,o,A,F]),L=(0,Z.useEffectEvent)(I),R=(0,Z.useCallback)(e=>{O(t=>{let n=t.get(e.value);if(n?.label===e.label&&n.disabled===e.disabled&&n.id===e.id&&n.ref===e.ref&&n.groupId===e.groupId&&n.keywords.join(`\0`)===e.keywords.join(`\0`))return t;let r=new Map(t);return r.set(e.value,e),r})},[]),z=(0,Z.useCallback)(e=>{O(t=>{if(!t.has(e))return t;let n=new Map(t);return n.delete(e),n})},[]),B=(0,Z.useMemo)(()=>Array.from(D.values()).filter(e=>u(e.value,P,[e.label,...e.keywords])),[u,D,P]),V=(0,Z.useMemo)(()=>B.filter(e=>!e.disabled),[B]),H=(0,Z.useMemo)(()=>new Set(B.map(e=>e.value)),[B]),U=(0,Z.useMemo)(()=>new Set(B.map(e=>e.groupId)),[B]),W=(0,Z.useCallback)(e=>{D.get(e)?.disabled||(k||b(e),r?.(e),I(!1,!0))},[D,r,I,k]),G=(0,Z.useCallback)(e=>{if(!V.length){E(null);return}if(e===`first`){E(V[0].value);return}if(e===`last`){E(V.at(-1)?.value??null);return}let t=V.findIndex(e=>e.value===T),n=t<0?e===1?0:V.length-1:(t+e+V.length)%V.length;E(V[n].value)},[T,V]),ee=(0,Z.useCallback)(()=>{T&&W(T)},[T,W]);(0,Z.useEffect)(()=>{if(!N)return;let e=M&&H.has(M)?M:null,t=T&&H.has(T)?T:null;E(t??e??V[0]?.value??null)},[T,V,N,M,H]),(0,Z.useEffect)(()=>{N&&requestAnimationFrame(()=>v.current?.focus({preventScroll:!0}))},[N]),(0,Z.useEffect)(()=>{if(!T||!N)return;let e=D.get(T)?.ref.current,t=e?.closest(`[role='listbox']`);if(!e||!t)return;let n=e.getBoundingClientRect(),r=t.getBoundingClientRect();n.top<r.top?t.scrollTop-=r.top-n.top:n.bottom>r.bottom&&(t.scrollTop+=n.bottom-r.bottom)},[T,D,N]),(0,Z.useEffect)(()=>{if(!N)return;let e=e=>h.current?.contains(e)||_.current?.contains(e),t=t=>{e(t.target)||L(!1)},n=t=>{e(t.target)||L(!1)},r=e=>{e.key===`Escape`&&(e.preventDefault(),L(!1,!0))};return window.addEventListener(`pointerdown`,t),window.addEventListener(`focusin`,n),window.addEventListener(`keydown`,r),()=>{window.removeEventListener(`pointerdown`,t),window.removeEventListener(`focusin`,n),window.removeEventListener(`keydown`,r)}},[N]);let te=T?D.get(T):void 0,ne=(0,Z.useMemo)(()=>({open:N,setOpen:I,value:M,select:W,query:P,setQuery:F,activeValue:T,setActiveValue:E,moveActive:G,selectActive:ee,registerItem:R,unregisterItem:z,labelFor:e=>e===void 0?void 0:D.get(e)?.label,isVisible:e=>!P.trim()||H.has(e),hasVisibleItems:e=>U.has(e),visibleCount:B.length,activeItemId:te?.id,triggerId:`${m}-trigger`,listId:`${m}-list`,inputId:`${m}-input`,disabled:d,reduce:p,triggerRef:g,contentRef:_,inputRef:v,activeLayoutId:`${m}-active`}),[te?.id,T,m,d,D,G,N,P,p,R,W,ee,z,I,F,M,B.length,U,H]);return(0,Q.jsx)(Tl.Provider,{value:ne,children:(0,Q.jsx)(`div`,{ref:h,className:q(`relative w-full`,f),children:e})})}var Al={type:`spring`,duration:.5,bounce:.22},jl=8;function Ml({children:e,side:t=`bottom`,align:n=`start`,sideOffset:r=6,avoidCollisions:i=!0,className:a}){let o=Dl(`ComboboxContent`),s=(0,Z.useRef)(null),c=Ie(),[l,u]=(0,Z.useState)(t),[d,f]=(0,Z.useState)(!1),p=Ht(),m=Math.min(p+2,8),h=Be(o.triggerRef,s,c);if((0,Z.useLayoutEffect)(()=>{if(!c)return;let e=requestAnimationFrame(()=>f(!0));return()=>cancelAnimationFrame(e)},[c]),(0,Z.useLayoutEffect)(()=>{if(!o.open||!h)return;if(!i){u(t);return}let e=window.innerHeight-(h.trigger.top+h.trigger.height),n=h.trigger.top;t===`bottom`&&e<h.content.height+r&&n>e?u(`top`):t===`top`&&n<h.content.height+r&&e>n?u(`bottom`):u(t)},[i,o.open,h,t,r]),!c)return null;let g=h?.trigger.left??0,_=h?.trigger.width??0,v=h?.content.width??_,y=n===`end`?g+_-v:n===`center`?g+(_-v)/2:g,b=Math.max(jl,window.innerWidth-v-jl),x=Math.min(Math.max(y,jl),b),S=h?.content.height??0;return(0,ps.createPortal)((0,Q.jsx)(K.div,{ref:o.contentRef,"data-combobox-content":``,"data-side":l,"aria-hidden":!o.open,inert:!o.open,initial:!1,animate:{opacity:+!!o.open,y:o.open?l===`bottom`?r:-r:0},transition:o.reduce||!d?{duration:0}:Al,layout:`size`,style:{height:o.open?S:0,left:x,top:l===`bottom`&&h?h.trigger.top+h.trigger.height:void 0,bottom:l===`top`&&h?window.innerHeight-h.trigger.top:void 0,minWidth:_,pointerEvents:o.open?`auto`:`none`,transformOrigin:l===`bottom`?`top`:`bottom`,visibility:h?`visible`:`hidden`,"--combobox-trigger-width":`${_}px`},className:q(`fixed z-[9999] w-(--combobox-trigger-width) overflow-hidden rounded-xl text-popover-foreground outline-none will-change-[height,transform]`,Rt(m,3),a),children:(0,Q.jsx)(Ut,{value:m,children:(0,Q.jsx)(K.div,{ref:s,initial:!1,animate:{opacity:+!!o.open},transition:o.reduce||!d?{duration:0}:Al,children:e})})}),document.body)}function Nl({children:e,ariaLabel:t=`Options`,className:n}){let r=Dl(`ComboboxList`);return(0,Q.jsx)(`div`,{id:r.listId,role:`listbox`,"aria-label":t,className:q(`relative isolate max-h-64 overflow-y-auto overscroll-contain p-1.5 [-ms-overflow-style:none] scrollbar-none [&::-webkit-scrollbar]:hidden`,n),children:e})}function Pl({children:e,className:t}){let n=Dl(`ComboboxGroup`),r=(0,Z.useId)();return(0,Q.jsx)(El.Provider,{value:r,children:(0,Q.jsx)(`fieldset`,{hidden:!n.hasVisibleItems(r),className:q(`m-0 min-w-0 border-0 p-0 py-0.5`,t),children:e})})}function Fl({children:e,className:t}){let n=(0,Z.useContext)(El),r=q(`w-full px-2 py-1.5 text-[0.68rem] font-medium uppercase tracking-[0.12em] text-muted-foreground`,t);return n?(0,Q.jsx)(`legend`,{className:r,children:e}):(0,Q.jsx)(`div`,{className:r,children:e})}function Il({value:e,children:t,textValue:n,keywords:r=[],disabled:i=!1,onSelect:a,className:o}){let s=Dl(`ComboboxItem`),c=(0,Z.useContext)(El),l=(0,Z.useId)(),u=(0,Z.useRef)(null),d=n??(typeof t==`string`?t:e),f=s.isVisible(e),p=s.activeValue===e,m=s.value===e,h=r.join(`\0`),g=(0,Z.useMemo)(()=>h?h.split(`\0`):[],[h]),{registerItem:_,unregisterItem:v}=s;return(0,Z.useLayoutEffect)(()=>(_({value:e,label:d,keywords:g,disabled:i,groupId:c,id:l,ref:u}),()=>v(e)),[i,c,l,d,g,_,v,e]),f?(0,Q.jsxs)(`button`,{ref:u,id:l,type:`button`,role:`option`,"aria-selected":m,disabled:i,tabIndex:-1,"data-combobox-item":``,"data-active":p||void 0,"data-selected":m||void 0,onPointerMove:()=>{i||s.setActiveValue(e)},onPointerDown:e=>e.preventDefault(),onClick:()=>{i||(a?.(e),s.select(e))},className:q(`relative flex w-full items-center gap-2 rounded-lg px-2 py-2 text-left text-sm outline-none transition-colors duration-150`,p?`text-foreground`:`text-muted-foreground`,`disabled:pointer-events-none disabled:opacity-45`,o),children:[p?(0,Q.jsx)(K.span,{"aria-hidden":!0,layoutId:s.activeLayoutId,className:`absolute inset-0 -z-10 rounded-lg bg-muted`,transition:s.reduce?{duration:0}:je}):null,(0,Q.jsx)(`span`,{className:`min-w-0 flex-1`,children:t}),(0,Q.jsx)(K.span,{"aria-hidden":!0,initial:!1,animate:{opacity:+!!m,transform:m?`scale(1)`:`scale(0.82)`},transition:s.reduce?{duration:0}:{duration:.14,ease:Ne},className:`grid size-5 shrink-0 place-items-center text-foreground`,children:(0,Q.jsx)(Zn,{className:`size-4`})})]}):null}function Ll({children:e=`No options found.`,className:t}){return Dl(`ComboboxEmpty`).visibleCount>0?null:(0,Q.jsx)(`div`,{role:`status`,className:q(`px-3 py-8 text-center text-sm text-muted-foreground`,t),children:e})}function Rl({children:e,className:t,showIndicator:n=!0}){let r=Dl(`ComboboxTrigger`);return(0,Q.jsxs)(`div`,{ref:r.triggerRef,id:r.triggerId,"data-state":r.open?`open`:`closed`,onPointerDown:e=>{r.disabled||e.target===r.inputRef.current||(e.preventDefault(),r.inputRef.current?.focus({preventScroll:!0}),r.setOpen(!0))},className:q(`relative z-20 flex h-10 w-full min-w-52 cursor-text items-center justify-between gap-3 rounded-xl border border-border bg-transparent px-3 text-sm text-foreground transition-[border-color] hover:border-(--color-border-strong)`,`focus-within:ring-2 focus-within:ring-foreground/20`,r.disabled&&`pointer-events-none opacity-50`,t),children:[(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 text-left`,children:e}),n?(0,Q.jsx)(`span`,{"aria-hidden":!0,className:`shrink-0 text-muted-foreground`,children:(0,Q.jsx)(Za,{className:`size-4`})}):null]})}function zl({ref:e,className:t,wrapperClassName:n,"aria-label":r=`Search options`,onChange:i,onClick:a,onFocus:o,onKeyDown:s,onPointerDown:c,placeholder:l=`Search…`,...u}){let d=Dl(`ComboboxInput`),f=d.labelFor(d.value),p=e=>{s?.(e),!e.defaultPrevented&&(e.key===`ArrowDown`?(e.preventDefault(),d.setOpen(!0),d.moveActive(1)):e.key===`ArrowUp`?(e.preventDefault(),d.setOpen(!0),d.moveActive(-1)):e.key===`Home`&&d.open?(e.preventDefault(),d.moveActive(`first`)):e.key===`End`&&d.open?(e.preventDefault(),d.moveActive(`last`)):e.key===`Enter`?(e.preventDefault(),d.open?d.selectActive():d.setOpen(!0)):e.key===`Escape`&&d.open&&(e.preventDefault(),d.setOpen(!1,!0)))};return(0,Q.jsxs)(`div`,{className:q(`flex min-w-0 flex-1 items-center gap-2`,n),children:[(0,Q.jsx)(Vr,{"aria-hidden":!0,className:`size-4 shrink-0 text-muted-foreground`}),(0,Q.jsx)(`input`,{...u,ref:Ol(e,d.inputRef),id:d.inputId,role:`combobox`,"aria-label":r,"aria-autocomplete":`list`,"aria-expanded":d.open,"aria-controls":d.listId,"aria-activedescendant":d.open?d.activeItemId:void 0,autoComplete:`off`,disabled:d.disabled,value:d.open?d.query:f??``,placeholder:l,onPointerDown:e=>{c?.(e),!(e.defaultPrevented||d.open)&&(e.preventDefault(),d.inputRef.current?.focus({preventScroll:!0}),d.setOpen(!0))},onFocus:e=>{d.setOpen(!0),o?.(e)},onClick:e=>{d.setOpen(!0),a?.(e)},onChange:e=>{d.setOpen(!0),d.setQuery(e.target.value),i?.(e)},onKeyDown:p,className:q(`h-10 min-w-0 flex-1 bg-transparent text-sm text-foreground outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed`,t)})]})}function Bl({createOpen:e,setCreateOpen:t,directoryBrowser:n,setDirectoryBrowser:r,directoryBrowseLoading:i,directoryBrowseError:a,setDirectoryBrowseError:o,onBrowseDirectories:s,directoryToken:c,setDirectoryToken:l,createName:u,setCreateName:d,createPath:f,setCreatePath:p,loadDirectories:m,createSubmitting:h,createSubmitError:g,setCreateSubmitError:_,submitCreate:v}){let y=(0,Z.useId)(),b=(0,Z.useId)(),x=(0,Z.useId)(),S=n?.pathLabel??f,C=!!(c||f.trim().startsWith(`/`)),w=()=>{r(null),l(void 0),p(``),o(null)},T=()=>{h||(w(),d(``),_(null),t(!1))};return(0,Q.jsx)(Xt,{open:e,onOpenChange:e=>{e?t(!0):T()},children:(0,Q.jsxs)(Kt,{className:`sm:max-w-xl`,children:[(0,Q.jsxs)(zt,{children:[(0,Q.jsx)(qt,{children:`Add project`}),(0,Q.jsx)(Yt,{children:`Choose the local directory that owns this project's sessions. Browse the server filesystem or paste an absolute path.`})]}),(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Q.jsx)(`label`,{className:`text-sm font-medium`,htmlFor:y,children:`Project name`}),(0,Q.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Optional`})]}),(0,Q.jsx)(zi,{id:y,value:u,onChange:e=>d(e.target.value),placeholder:`e.g. Fleet Prime`,"aria-label":`Project name`})]}),(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Q.jsx)(`label`,{className:`text-sm font-medium`,htmlFor:b,children:`Local directory`}),(0,Q.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Required`})]}),(0,Q.jsx)(zi,{id:b,value:f,onChange:e=>{p(e.target.value),l(void 0),r(null),o(null),_(null)},placeholder:`/absolute/path/to/project`,"aria-label":`Project directory`,"aria-describedby":x,spellCheck:!1,autoCapitalize:`off`,autoCorrect:`off`,className:`h-10 font-mono text-xs`}),(0,Q.jsx)(`p`,{id:x,className:`text-xs text-muted-foreground`,children:`Browse to select a directory, or paste an absolute path. The server validates the final choice before registering it.`})]}),i&&!n?(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 rounded-xl border border-dashed px-3 py-4 text-sm text-muted-foreground`,role:`status`,"aria-live":`polite`,children:[(0,Q.jsx)(Cn,{className:`size-4`}),`Loading directories…`]}):null,n?(0,Q.jsxs)(`div`,{className:`overflow-hidden rounded-xl border bg-muted/20`,"data-testid":`project-directory-browser`,children:[(0,Q.jsxs)(`div`,{className:`flex items-start gap-3 p-3`,children:[(0,Q.jsx)(`div`,{className:`grid size-9 shrink-0 place-items-center rounded-lg bg-primary/10 text-primary`,children:(0,Q.jsx)(Mr,{className:`size-4`})}),(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-[0.12em] text-muted-foreground`,children:`Selected directory`}),(0,Q.jsx)(`p`,{className:`mt-1 break-all font-mono text-xs text-foreground`,title:S,children:S})]}),(0,Q.jsx)(`span`,{className:`shrink-0 rounded-full bg-primary/10 px-2 py-1 text-[11px] font-medium text-primary`,children:`Selected`})]}),(0,Q.jsxs)(`div`,{className:`space-y-2 border-t px-3 py-3`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`text-sm font-medium`,children:`Browse child directories`}),(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Open a folder to make it the selected directory.`})]}),n.parentToken?(0,Q.jsxs)(V,{type:`button`,size:`sm`,variant:`outline`,disabled:i,onClick:()=>void m({token:n.parentToken??void 0}),"aria-label":`Go up one directory`,title:`Go up one directory`,children:[(0,Q.jsx)(Le,{className:`size-3.5`}),`Up`]}):null]}),i?(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg border border-dashed px-3 py-4 text-sm text-muted-foreground`,role:`status`,"aria-live":`polite`,children:[(0,Q.jsx)(Cn,{className:`size-4`}),`Loading directories…`]}):n.entries.length===0?(0,Q.jsx)(`p`,{className:`rounded-lg border border-dashed px-3 py-4 text-center text-sm text-muted-foreground`,children:`No child directories here.`}):(0,Q.jsxs)(kl,{value:c,onValueChange:e=>{n.entries.find(t=>t.directoryToken===e)&&m({token:e})},children:[(0,Q.jsx)(Rl,{className:`h-10 bg-background`,children:(0,Q.jsx)(zl,{"aria-label":`Search child directories`,placeholder:`Choose a child directory…`,className:`text-xs`})}),(0,Q.jsx)(Ml,{className:`w-[min(32rem,calc(100vw-3rem))]`,children:(0,Q.jsxs)(Nl,{ariaLabel:`Child directories`,children:[(0,Q.jsxs)(Pl,{children:[(0,Q.jsx)(Fl,{children:`Child directories`}),n.entries.map(e=>(0,Q.jsx)(Il,{value:e.directoryToken,textValue:`${e.name} ${e.pathLabel}`,keywords:[e.pathLabel],children:(0,Q.jsxs)(`span`,{className:`flex min-w-0 items-start gap-2`,children:[(0,Q.jsx)(ao,{className:`mt-0.5 size-4 shrink-0`}),(0,Q.jsxs)(`span`,{className:`min-w-0`,children:[(0,Q.jsx)(`span`,{className:`block truncate font-medium text-foreground`,children:rc(e)}),(0,Q.jsx)(`span`,{className:`block truncate text-[11px] text-muted-foreground`,title:e.pathLabel,children:e.pathLabel})]})]})},e.directoryToken))]}),(0,Q.jsx)(Ll,{children:`No matching directories.`})]})})]})]})]}):s?(0,Q.jsxs)(V,{type:`button`,variant:`outline`,disabled:i,onClick:()=>void m({}),className:`w-full justify-start`,children:[(0,Q.jsx)(Mr,{className:`size-4`}),`Browse directories`]}):null,a?(0,Q.jsxs)(`div`,{className:`flex items-start gap-2 rounded-lg border border-destructive/30 bg-destructive/5 px-3 py-2 text-sm text-destructive`,role:`alert`,children:[(0,Q.jsx)(Ur,{className:`mt-0.5 size-4 shrink-0`}),(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(`p`,{children:a}),(0,Q.jsx)(V,{type:`button`,variant:`link`,size:`xs`,className:`mt-1 h-auto p-0 text-destructive`,onClick:()=>void m(n?{token:n.directoryToken}:{}),children:`Try again`})]})]}):null,g?(0,Q.jsx)(`p`,{className:`text-sm text-destructive`,role:`alert`,children:g}):null]}),(0,Q.jsxs)(Wt,{children:[(0,Q.jsx)(V,{type:`button`,variant:`outline`,disabled:h,onClick:T,children:`Cancel`}),(0,Q.jsx)(V,{type:`button`,disabled:!C||h,onClick:()=>void v(),children:h?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Cn,{className:`size-3.5`}),`Adding project…`]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(io,{className:`size-3.5`}),`Add project`]})})]})]})})}function Vl({projects:e,onRenameSession:t,onDeleteSession:n,onRenameProject:r,onUnregisterProject:i,onForkSessionIntoProject:a,renameTarget:o,setRenameTarget:s,renameTitle:c,setRenameTitle:l,renameProjectTarget:u,setRenameProjectTarget:d,renameProjectName:f,setRenameProjectName:p,deleteTarget:m,setDeleteTarget:h,unregisterTarget:g,setUnregisterTarget:_,forkTarget:v,setForkTarget:y,forkProjectId:b,setForkProjectId:x}){let S=(0,Z.useMemo)(()=>e.flatMap(e=>e.projectId===v?.projectId?[]:[{value:e.projectId,label:`${e.name} — ${e.pathLabel}`,icon:Pr}]),[v?.projectId,e]);return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(En,{open:o!==null,onOpenChange:e=>!e&&s(null),children:(0,Q.jsxs)(Mn,{children:[(0,Q.jsx)(Pn,{children:`Rename session`}),(0,Q.jsx)(Sn,{children:`Choose a local display title for this Fleet Prime session.`}),(0,Q.jsx)(zi,{value:c,onChange:e=>l(e.target.value),"aria-label":`Session title`,autoFocus:!0}),(0,Q.jsxs)(Dn,{children:[(0,Q.jsx)(An,{children:`Cancel`}),(0,Q.jsx)(xn,{disabled:!c.trim(),onClick:()=>{o&&c.trim()&&(t(o.sessionId,c.trim()),s(null))},children:`Rename`})]})]})}),(0,Q.jsx)(En,{open:u!==null,onOpenChange:e=>!e&&d(null),children:(0,Q.jsxs)(Mn,{children:[(0,Q.jsx)(Pn,{children:`Rename project`}),(0,Q.jsx)(Sn,{children:`This changes the display name only. The registered directory stays the same.`}),(0,Q.jsx)(zi,{value:f,onChange:e=>p(e.target.value),"aria-label":`Project name`,autoFocus:!0}),(0,Q.jsxs)(Dn,{children:[(0,Q.jsx)(An,{children:`Cancel`}),(0,Q.jsx)(xn,{disabled:!f.trim()||!r,onClick:()=>{u&&f.trim()&&(r?.(u.projectId,f.trim()),d(null))},children:`Rename`})]})]})}),(0,Q.jsx)(En,{open:m!==null,onOpenChange:e=>!e&&h(null),children:(0,Q.jsxs)(Mn,{children:[(0,Q.jsx)(Pn,{children:`Delete session?`}),(0,Q.jsx)(Sn,{children:`This removes the Fleet Prime session and its managed session artifacts. This cannot be undone.`}),(0,Q.jsxs)(Dn,{children:[(0,Q.jsx)(An,{children:`Cancel`}),(0,Q.jsx)(xn,{className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,onClick:()=>{m&&n(m.sessionId),h(null)},children:`Delete`})]})]})}),(0,Q.jsx)(En,{open:g!==null,onOpenChange:e=>!e&&_(null),children:(0,Q.jsxs)(Mn,{children:[(0,Q.jsx)(Pn,{children:`Unregister project?`}),(0,Q.jsx)(Sn,{children:`The directory and its sessions remain intact. Existing sessions will move to Unassigned until the directory is registered again.`}),(0,Q.jsxs)(Dn,{children:[(0,Q.jsx)(An,{children:`Cancel`}),(0,Q.jsx)(xn,{className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,onClick:()=>{g&&i?.(g.projectId),_(null)},children:`Unregister`})]})]})}),(0,Q.jsx)(Xt,{open:v!==null,onOpenChange:e=>!e&&y(null),children:(0,Q.jsxs)(Kt,{className:`sm:max-w-md`,children:[(0,Q.jsxs)(zt,{children:[(0,Q.jsx)(qt,{children:`Fork session into project`}),(0,Q.jsx)(Yt,{children:`Create a new Fleet Prime session in another registered project.`})]}),(0,Q.jsx)(`div`,{className:`py-2`,children:(0,Q.jsx)(cn,{value:b??null,onValueChange:e=>x(e),options:S,placeholder:`Select a project…`,"aria-label":`Target project`})}),(0,Q.jsxs)(Wt,{children:[(0,Q.jsx)(V,{type:`button`,variant:`outline`,onClick:()=>y(null),children:`Cancel`}),(0,Q.jsx)(V,{type:`button`,disabled:!v||!b||!a,onClick:()=>{!v||!b||(a?.(v.sessionId,b),y(null))},children:`Fork session`})]})]})})]})}function Hl(e){return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Bl,{...e}),(0,Q.jsx)(Vl,{...e})]})}function Ul({data:e,sessionActions:t,projectActions:n={},navigationActions:r={},slots:i={}}){let{sessions:a,projects:o=Ks,projectSessions:s=a,activeProjectId:c,activeSessionId:l}=e,{onNewSession:u,onNewSessionInProject:d,onResumeSession:f,onRenameSession:p,onDeleteSession:m}=t,{onProjectSelect:h,onCreateProject:g,onRenameProject:_,onUnregisterProject:v,onForkSessionIntoProject:y}=n,{onOpenPanelAction:b,onBrowseDirectories:x,onOpenSettings:S}=r,{accountMenu:C}=i,w=sc(c),{loadDirectories:T,projectById:E,sortedProjects:D,sidebarItems:O,resumeResource:k,toggleProjectResource:A,selectSearchResult:j,renderMenu:M,submitCreate:N}=mc({sessions:a,projects:o,projectSessions:s,activeProjectId:c,activeSessionId:l,onNewSession:u,onNewSessionInProject:d,onProjectSelect:h,onResumeSession:f,onCreateProject:g,onForkSessionIntoProject:y,onOpenPanelAction:b,onBrowseDirectories:x,createOpen:w.createOpen,expandedProjectIds:w.expandedProjectIds,revealedProjectIds:w.revealedProjectIds,setExpandedProjectIds:w.setExpandedProjectIds,setRevealedProjectIds:w.setRevealedProjectIds,setSearchOpen:w.setSearchOpen,setDirectoryBrowser:w.setDirectoryBrowser,setDirectoryBrowseLoading:w.setDirectoryBrowseLoading,setDirectoryBrowseError:w.setDirectoryBrowseError,setDirectoryToken:w.setDirectoryToken,setCreatePath:w.setCreatePath,setRenameTarget:w.setRenameTarget,setRenameTitle:w.setRenameTitle,setForkTarget:w.setForkTarget,setForkProjectId:w.setForkProjectId,setDeleteTarget:w.setDeleteTarget,setRenameProjectTarget:w.setRenameProjectTarget,setRenameProjectName:w.setRenameProjectName,setUnregisterTarget:w.setUnregisterTarget,createPath:w.createPath,directoryToken:w.directoryToken,createName:w.createName,setCreateName:w.setCreateName,setCreateOpen:w.setCreateOpen,setCreateSubmitError:w.setCreateSubmitError,setCreateSubmitting:w.setCreateSubmitting});return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Cl,{brandMenuOpen:w.brandMenuOpen,setBrandMenuOpen:w.setBrandMenuOpen,searchOpen:w.searchOpen,setSearchOpen:w.setSearchOpen,query:w.query,setQuery:w.setQuery,projectActionsOpen:w.projectActionsOpen,setProjectActionsOpen:w.setProjectActionsOpen,expandedProjectIds:w.expandedProjectIds,setExpandedProjectIds:w.setExpandedProjectIds,setCreateOpen:w.setCreateOpen,projects:o,projectSessions:s,sidebarItems:O,sortedProjects:D,projectById:E,activeProjectId:c,activeSessionId:l,onNewSession:u,onNewSessionInProject:d,onProjectSelect:h,onRenameSession:p,onCreateProject:g,onOpenSettings:S,accountMenu:C,resumeResource:k,toggleProjectResource:A,selectSearchResult:j,renderMenu:M}),(0,Q.jsx)(Hl,{projects:o,onRenameSession:p,onDeleteSession:m,onRenameProject:_,onUnregisterProject:v,onForkSessionIntoProject:y,onBrowseDirectories:x,createOpen:w.createOpen,setCreateOpen:w.setCreateOpen,directoryBrowser:w.directoryBrowser,setDirectoryBrowser:w.setDirectoryBrowser,directoryBrowseLoading:w.directoryBrowseLoading,directoryBrowseError:w.directoryBrowseError,setDirectoryBrowseError:w.setDirectoryBrowseError,directoryToken:w.directoryToken,setDirectoryToken:w.setDirectoryToken,createName:w.createName,setCreateName:w.setCreateName,createPath:w.createPath,setCreatePath:w.setCreatePath,renameTarget:w.renameTarget,setRenameTarget:w.setRenameTarget,renameTitle:w.renameTitle,setRenameTitle:w.setRenameTitle,renameProjectTarget:w.renameProjectTarget,setRenameProjectTarget:w.setRenameProjectTarget,renameProjectName:w.renameProjectName,setRenameProjectName:w.setRenameProjectName,deleteTarget:w.deleteTarget,setDeleteTarget:w.setDeleteTarget,unregisterTarget:w.unregisterTarget,setUnregisterTarget:w.setUnregisterTarget,forkTarget:w.forkTarget,setForkTarget:w.setForkTarget,forkProjectId:w.forkProjectId,setForkProjectId:w.setForkProjectId,createSubmitting:w.createSubmitting,createSubmitError:w.createSubmitError,setCreateSubmitError:w.setCreateSubmitError,loadDirectories:T,submitCreate:N})]})}var Wl=[];function Gl({label:e,active:t=!1,onClick:n,children:r}){let i=Ge()??!1;return(0,Q.jsx)(K.button,{type:`button`,"aria-label":e,title:e,"aria-pressed":e===`Helpful`||e===`Not helpful`?t:void 0,onClick:n,whileTap:i?void 0:{scale:.9},transition:Oe,className:q(`grid size-7 place-items-center rounded-md text-muted-foreground outline-none transition-colors hover:bg-muted hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring`,t&&`bg-muted text-foreground`),children:r})}function Kl({children:e,status:t=`streaming`,copyText:n,onCopy:r,onRetry:i,sources:a=Wl,sourcesOpen:o,defaultSourcesOpen:s=!1,onSourcesOpenChange:c,sourceIdPrefix:l,feedback:u,defaultFeedback:d=null,onFeedbackChange:f,announce:p=!0,showActions:m=!0,className:h,contentClassName:g,actionsClassName:_}){let v=Ge()??!1,y=(0,Z.useId)(),[b,x]=(0,Z.useState)(!1),[S,C]=(0,Z.useState)(d),[w,T]=(0,Z.useState)(s),E=(0,Z.useRef)(void 0),D=u??S,O=o??w,k=t===`streaming`,A=t===`complete`,j=!!(n||r),M=a.length>0,N=m&&!k&&(j||i||A||M),P=`${y}-sources`,F=l??`response-source-${y.replace(/:/g,``)}`;(0,Z.useEffect)(()=>()=>{E.current&&window.clearTimeout(E.current)},[]);let I=(0,Z.useCallback)(async()=>{r?await r():n&&await navigator.clipboard?.writeText(n),x(!0),E.current&&window.clearTimeout(E.current),E.current=window.setTimeout(()=>x(!1),1600)},[n,r]),L=e=>{let t=D===e?null:e;u===void 0&&C(t),f?.(t)},R=(0,Z.useCallback)(e=>{o===void 0&&T(e),c?.(e)},[c,o]);return(0,Q.jsxs)(`div`,{"data-state":t,"aria-busy":k,className:q(`w-full`,h),children:[(0,Q.jsx)(`div`,{"aria-live":p?`polite`:`off`,className:q(`text-sm leading-6 text-foreground/90 [&_a]:font-medium [&_a]:underline [&_a]:underline-offset-4 [&_code]:rounded [&_code]:bg-muted [&_code]:px-1 [&_code]:py-0.5 [&_code]:font-mono [&_code]:text-[0.9em] [&_ol]:my-3 [&_ol]:list-decimal [&_ol]:space-y-1 [&_ol]:pl-5 [&_p+p]:mt-3 [&_pre]:my-3 [&_pre]:overflow-x-auto [&_pre]:rounded-xl [&_pre]:border [&_pre]:border-border [&_pre]:bg-muted/45 [&_pre]:p-3 [&_pre_code]:bg-transparent [&_pre_code]:p-0 [&_ul]:my-3 [&_ul]:list-disc [&_ul]:space-y-1 [&_ul]:pl-5`,g),children:e}),(0,Q.jsx)(We,{initial:!1,children:N?(0,Q.jsxs)(K.div,{initial:v?{opacity:0}:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0},transition:{duration:v?.12:.22,ease:Ne},className:`mt-3`,children:[(0,Q.jsxs)(`div`,{className:q(`flex items-center gap-0.5`,_),children:[j?(0,Q.jsx)(Gl,{label:b?`Copied`:`Copy response`,onClick:I,children:b?(0,Q.jsx)(Zn,{className:`size-3.5`}):(0,Q.jsx)(gr,{className:`size-3.5`})}):null,i?(0,Q.jsx)(Gl,{label:`Retry response`,onClick:i,children:(0,Q.jsx)(zr,{className:`size-3.5`})}):null,A?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Gl,{label:`Helpful`,active:D===`up`,onClick:()=>L(`up`),children:(0,Q.jsx)(ho,{className:`size-3.5`})}),(0,Q.jsx)(Gl,{label:`Not helpful`,active:D===`down`,onClick:()=>L(`down`),children:(0,Q.jsx)(mo,{className:`size-3.5`})})]}):null,M?(0,Q.jsxs)(`button`,{type:`button`,"aria-expanded":O,"aria-controls":P,onClick:()=>R(!O),className:`group ml-1 inline-flex min-h-7 items-center gap-2 rounded-md px-1.5 text-xs text-muted-foreground outline-none transition-colors hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring`,children:[(0,Q.jsx)(Wn,{citations:a}),(0,Q.jsxs)(`span`,{className:`tabular-nums`,children:[a.length,` `,a.length===1?`source`:`sources`]}),(0,Q.jsx)(K.span,{"aria-hidden":`true`,animate:{rotate:O?180:0},transition:v?{duration:0}:Fe,className:`text-muted-foreground/50 group-hover:text-muted-foreground`,children:(0,Q.jsx)(Qn,{className:`size-3`})})]}):null]}),M?(0,Q.jsx)(Yr,{id:P,open:O,children:(0,Q.jsx)(qn,{citations:a,idPrefix:F,className:`mt-2 rounded-xl bg-muted p-2`})}):null]}):null})]})}var ql=[{id:`top-left`,delay:0},{id:`top-center`,delay:.14},{id:`top-right`,delay:.28},{id:`middle-left`,delay:.42},{id:`middle-center`,delay:.56},{id:`middle-right`,delay:.7},{id:`bottom-left`,delay:.84},{id:`bottom-center`,delay:.98},{id:`bottom-right`,delay:1.12}];function Jl(e){let t=Math.max(0,e),n=Math.floor(t/60),r=(t%60).toFixed(1);return n>0?`${n}m ${r}s`:`${r}s`}function Yl({label:e=`Churning`,elapsedSeconds:t,initialSeconds:n=0,running:r=!0,className:i}){let a=Ge()??!1,[o,s]=(0,Z.useState)(n);(0,Z.useEffect)(()=>{if(t!==void 0||!r)return;let e=performance.now()-n*1e3,i=window.setInterval(()=>{s((performance.now()-e)/1e3)},100);return()=>window.clearInterval(i)},[t,n,r]);let c=t??o;return(0,Q.jsxs)(`span`,{role:`status`,"aria-label":`${e}, in progress`,className:q(`inline-flex items-center gap-3 font-mono text-sm text-muted-foreground`,i),children:[(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`grid size-5 shrink-0 grid-cols-3 gap-[2px]`,children:ql.map(({id:e,delay:t})=>(0,Q.jsx)(K.span,{className:`rounded-[1px] bg-current`,animate:a?{opacity:[.35,.8,.35]}:{opacity:[.28,1,.28],scale:[.72,1,.72]},transition:{duration:1.55,ease:Ae,repeat:1/0,delay:t}},e))}),(0,Q.jsx)(`span`,{className:`font-sans font-medium`,children:e}),(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`tabular-nums text-muted-foreground/70`,children:Jl(c)})]})}function Xl({label:e,className:t}){let n=Ge();if(!e?.trim())return null;let{kind:r,title:i,detail:a}=Zl(e),o=Ql(r),s=r===`queue`||r===`retry`||r===`compaction`;return(0,Q.jsxs)(K.div,{initial:!n&&{opacity:0,y:-4},animate:{opacity:1,y:0},exit:n?void 0:{opacity:0,y:-4},transition:{duration:n?0:.16},role:r===`recovery`?`status`:void 0,"aria-live":r===`recovery`?`polite`:`off`,className:q(`flex items-start gap-2 rounded-lg border border-border/60 bg-muted/45 px-3 py-2 text-xs text-muted-foreground`,t),children:[s?(0,Q.jsx)(Yl,{label:i,running:!0,className:`min-w-0 text-xs`}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(o,{className:q(`mt-0.5 size-3.5 shrink-0`,r===`recovery`&&`text-amber-600 dark:text-amber-400`)}),(0,Q.jsx)(`strong`,{className:`font-medium text-foreground/90`,children:i})]}),a?(0,Q.jsx)(`span`,{className:`min-w-0 leading-relaxed`,children:a}):null]})}function Zl(e){let t=e.trim(),n=t.toLowerCase();return n.includes(`queued`)||n.includes(`steered`)?{kind:`queue`,title:`Queued work`,detail:t}:n.includes(`retry`)?{kind:`retry`,title:`Retrying safely`,detail:t}:n.includes(`compact`)?{kind:`compaction`,title:`Managing context`,detail:t}:n.includes(`reset`)||n.includes(`recover`)||n.includes(`sign in`)?{kind:`recovery`,title:`Run needs attention`,detail:t}:{kind:`notice`,title:`Run update`,detail:t}}function Ql(e){switch(e){case`queue`:return oo;case`retry`:return zr;case`compaction`:return Fr;case`recovery`:return pr;default:return eo}}function $l(e){if(e.length===1){let t=e[0];if(t?.type===`search`)return`Checking a source…`;if(t?.type===`tool`)return`Working with ${t.action}…`}return e.length>1?`Coordinating ${e.length} active actions…`:`Working through the run…`}function eu(e){return e.length===1?`Completed 1 tracked action`:`Completed ${e.length} tracked actions`}var tu=[{id:`welcome-explore-codebase`,label:`Explore codebase`,value:`Explore this codebase and explain its architecture, important modules, and main entry points.`},{id:`welcome-review-changes`,label:`Review changes`,value:`Review my current changes for bugs, regressions, architecture issues, and code quality problems.`},{id:`welcome-fix-issue`,label:`Fix an issue`,value:`Help me investigate and fix an issue in this project.`},{id:`welcome-plan-feature`,label:`Plan a feature`,value:`Explore the relevant code and create an implementation plan for a new feature before making changes.`}];function nu({disabled:e,onSelect:t,composer:n}){return(0,Q.jsxs)(`section`,{"aria-labelledby":`fleet-welcome-title`,className:`flex w-full max-w-an flex-col items-center text-center`,children:[(0,Q.jsx)(`h1`,{id:`fleet-welcome-title`,className:`text-2xl font-normal tracking-tight text-foreground sm:text-3xl`,children:`What should Fleet Prime Agent work on?`}),(0,Q.jsx)(`div`,{className:`mt-6 w-full`,children:n}),(0,Q.jsx)(`div`,{"aria-label":`Suggested prompts`,className:`mt-4 flex w-full flex-wrap justify-center gap-2`,children:tu.map(n=>(0,Q.jsx)(V,{type:`button`,variant:`outline`,size:`sm`,disabled:e||n.disabled,onClick:()=>t(n),className:`min-h-8 rounded-full border-border/70 bg-background/70 px-4 py-1.5 text-center text-sm font-normal text-foreground/80 shadow-sm hover:border-primary/40 hover:bg-primary/5 hover:text-foreground motion-reduce:transition-none`,children:n.label},n.id))})]})}var ru=[`·`,`•`,`●`,`•`];function iu({label:e,isActive:t,className:n}){let[r,i]=(0,Z.useState)(0),[a,o]=(0,Z.useState)(0);return(0,Z.useEffect)(()=>{if(!t){i(0),o(0);return}let e=Date.now(),n=window.setInterval(()=>{i(Math.max(0,Math.floor((Date.now()-e)/1e3))),o(e=>e+1)},500);return()=>window.clearInterval(n)},[t]),!t||!e?null:(0,Q.jsxs)(`div`,{className:q(`flex items-center gap-2 px-an-context-padding py-1 text-xs text-foreground/70`,n),children:[(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`font-mono text-an-primary-color`,children:ru[a%ru.length]}),(0,Q.jsx)(`span`,{className:`sr-only`,"aria-live":`polite`,children:e}),(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`truncate`,children:e}),(0,Q.jsxs)(`span`,{"aria-hidden":`true`,className:`tabular-nums text-foreground/50`,children:[r,`s`]})]})}var au=`M5 13l4 4L19 7`,ou=`M6 12h12`;function su({checked:e,onCheckedChange:t,disabled:n,indeterminate:r,label:i,className:a,id:o,"aria-label":s,"aria-describedby":c}){let l=(0,Z.useId)(),u=o??l,d=Ge(),f=e||r,p=r?ou:au;return(0,Q.jsxs)(`label`,{htmlFor:u,className:q(`inline-flex items-center gap-3`,n?`cursor-not-allowed`:`cursor-pointer`,a),children:[(0,Q.jsx)(K.button,{id:u,type:`button`,role:`checkbox`,"aria-checked":r?`mixed`:e,"aria-label":s,"aria-describedby":c,disabled:n,onClick:()=>!n&&t(!e),whileTap:d||n?void 0:{scale:.92},transition:Oe,"data-state":e?`checked`:r?`indeterminate`:`unchecked`,className:q(`inline-flex h-5 w-5 shrink-0 items-center justify-center rounded-md border-2 outline-none transition-colors duration-200`,`focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background`,`disabled:cursor-not-allowed disabled:opacity-60`,f?`border-primary bg-primary text-primary-foreground`:`border-muted-foreground/50 bg-background hover:border-muted-foreground`),children:(0,Q.jsx)(We,{initial:!1,children:f?(0,Q.jsxs)(K.svg,{width:`12`,height:`12`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:3,strokeLinecap:`round`,strokeLinejoin:`round`,initial:d?{opacity:1}:{opacity:0,scale:.5},animate:d?{opacity:1}:{opacity:1,scale:1},exit:d?{opacity:0}:{opacity:0,scale:.5,filter:`blur(4px)`},transition:d?{duration:0}:{duration:.16,ease:Ne},"aria-hidden":!0,children:[(0,Q.jsx)(`title`,{children:r?`Partially selected`:`Selected`}),(0,Q.jsx)(K.path,{d:p,initial:d?{pathLength:1}:{pathLength:0},animate:{pathLength:1},transition:d?{duration:0}:{duration:r?.2:.3,ease:Ne,delay:.04}})]},r?`indeterminate`:`checked`):null})}),i?(0,Q.jsx)(`span`,{className:q(`select-none text-sm text-foreground`,n&&`opacity-60`),children:i}):null]})}var cu=(0,Z.forwardRef)(function({label:e,value:t,defaultValue:n,onChange:r,onFocus:i,onBlur:a,error:o,success:s,leftIcon:c,rightIcon:l,className:u,classNames:d,disabled:f,id:p,type:m,...h},g){let _=(0,Z.useId)(),v=p??_,y=Ge(),b=t!==void 0,[x,S]=(0,Z.useState)(n??``),C=b?t??``:x,[w,T]=(0,Z.useState)(!1),E=(0,Z.useRef)(null),D=!!o,O=typeof o==`string`?o:null,k=s?null:l;(0,Z.useEffect)(()=>{!E.current||y||!D||Ja(E.current,{x:[0,-6,6,-4,4,-2,0]},{duration:.45})},[D,y]);let A=e=>{b||S(e),r?.(e)};return(0,Q.jsxs)(`div`,{className:q(`flex flex-col gap-1.5`,u,d?.root),children:[e?(0,Q.jsx)(`label`,{htmlFor:v,className:q(`px-1 text-sm font-medium text-foreground`,d?.label),children:e}):null,(0,Q.jsxs)(`div`,{ref:E,"data-state":D?`error`:s?`success`:w?`focused`:`idle`,className:q(`relative h-11 overflow-hidden rounded-full border transition-colors duration-200`,`border-border`,w&&!D&&`border-foreground/40 ring-2 ring-ring/40`,D&&`border-destructive ring-2 ring-destructive/25`,f&&`opacity-60`,d?.field),children:[c?(0,Q.jsx)(`span`,{className:q(`pointer-events-none absolute left-3 top-1/2 flex -translate-y-1/2 items-center text-muted-foreground [&_svg]:h-4 [&_svg]:w-4`,d?.leftIcon),children:c}):null,(0,Q.jsx)(`input`,{ref:g,id:v,type:m,value:C,disabled:f,"aria-invalid":D||void 0,"aria-describedby":O?`${v}-error`:void 0,...h,onChange:e=>A(e.target.value),onFocus:e=>{T(!0),i?.(e)},onBlur:e=>{T(!1),a?.(e)},className:q(`peer h-full w-full bg-transparent text-base leading-6 text-foreground caret-foreground outline-none`,`placeholder:text-muted-foreground/60`,c?`pl-10`:`pl-3.5`,k||s?`pr-10`:`pr-3.5`,f&&`cursor-not-allowed`,d?.input)}),s?(0,Q.jsx)(K.svg,{viewBox:`0 0 24 24`,fill:`none`,className:q(`absolute right-3.5 top-1/2 h-5 w-5 -translate-y-1/2 text-(--color-success)`,d?.successIcon),children:(0,Q.jsx)(K.path,{d:`M5 12.5l4.5 4.5L19 7.5`,stroke:`currentColor`,strokeWidth:2.5,strokeLinecap:`round`,strokeLinejoin:`round`,initial:y?{pathLength:1}:{pathLength:0},animate:{pathLength:1},transition:{duration:.35,ease:`easeOut`}})}):k?(0,Q.jsx)(`span`,{className:q(`absolute right-0 top-0 flex h-full items-center text-muted-foreground [&_button]:grid [&_button]:size-11 [&_button]:place-items-center [&_svg]:h-4 [&_svg]:w-4`,d?.rightIcon),children:k}):null]}),(0,Q.jsx)(We,{initial:!1,children:O?(0,Q.jsx)(K.p,{id:`${v}-error`,role:`alert`,initial:y?{opacity:0}:{opacity:0,y:-4,filter:`blur(4px)`},animate:{opacity:1,y:0,filter:`blur(0px)`},exit:y?{opacity:0}:{opacity:0,y:-4,filter:`blur(4px)`},transition:{duration:.2},className:q(`px-1 text-xs text-destructive`,d?.errorMessage),children:O}):null})]})}),lu=(0,Z.createContext)(null);function uu(){let e=(0,Z.useContext)(lu);if(!e)throw Error(`RadioGroupItem must be used inside <RadioGroup>`);return e}function du({value:e,defaultValue:t=``,onValueChange:n,children:r,className:i,orientation:a=`vertical`}){let[o,s]=(0,Z.useState)(t),c=(0,Z.useId)(),l=Ge(),u=e!==void 0,d=u?e:o,f=(0,Z.useCallback)(e=>{u||s(e),n?.(e)},[u,n]),p=(0,Z.useMemo)(()=>({value:d,setValue:f,layoutId:c}),[d,c,f]);return(0,Q.jsx)(Ca,{transition:l?{duration:0}:je,children:(0,Q.jsx)(lu.Provider,{value:p,children:(0,Q.jsx)(`div`,{role:`radiogroup`,className:q(`flex gap-3`,a===`vertical`?`flex-col`:`flex-row flex-wrap`,i),children:r})})})}function fu({value:e,label:t,disabled:n,className:r,id:i}){let{value:a,setValue:o,layoutId:s}=uu(),c=(0,Z.useId)(),l=i??c,u=Ge(),d=a===e;return(0,Q.jsxs)(`label`,{htmlFor:l,className:q(`inline-flex items-center gap-3`,n?`cursor-not-allowed`:`cursor-pointer`,r),children:[(0,Q.jsx)(K.button,{id:l,type:`button`,role:`radio`,"aria-checked":d,disabled:n,onClick:()=>!n&&o(e),whileTap:u||n?void 0:{scale:.92},transition:Oe,"data-state":d?`checked`:`unchecked`,className:q(`relative inline-flex h-5 w-5 shrink-0 items-center justify-center rounded-full border-2 outline-none transition-colors duration-200`,`focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background`,`disabled:cursor-not-allowed disabled:opacity-60`,d?`border-primary`:`border-muted-foreground/50 hover:border-muted-foreground`),children:d?(0,Q.jsx)(K.span,{layoutId:s,className:`absolute inset-1 rounded-full bg-primary`,transition:u?{duration:0}:je}):null}),t?(0,Q.jsx)(`span`,{className:q(`select-none text-sm text-foreground`,n&&`opacity-60`),children:t}):null]})}var pu={selected:[],custom:``};function mu(e){return e===`submitting`?`Submitting`:e===`approved`?`Approved`:e===`rejected`?`Rejected`:e===`changes-requested`?`Changes requested`:e===`answered`?`Response submitted`:`Input required`}function hu(e){return e===`approved`||e===`answered`?`text-emerald-600 dark:text-emerald-400`:e===`rejected`?`text-rose-600 dark:text-rose-400`:e===`changes-requested`?`text-amber-600 dark:text-amber-400`:`text-muted-foreground`}function gu(e){return e===`pending`||e===`changes-requested`?`border-amber-500/30 bg-amber-500/10 text-amber-600 dark:text-amber-400`:e===`submitting`?`border-blue-500/30 bg-blue-500/10 text-blue-600 dark:text-blue-400`:e===`approved`||e===`answered`?`border-emerald-500/30 bg-emerald-500/10 text-emerald-600 dark:text-emerald-400`:`border-rose-500/30 bg-rose-500/10 text-rose-600 dark:text-rose-400`}function _u(e){return e.selected.length>0||!!e.custom?.trim()}function vu({question:e,answer:t,disabled:n,onChange:r,onSingleSelect:i}){let a=t.custom??``,o=new Set(t.selected);return(0,Q.jsxs)(`div`,{className:`mt-3`,children:[e.options?.length?e.multiple?(0,Q.jsx)(`div`,{className:`grid gap-0.5`,children:e.options.map(e=>(0,Q.jsx)(su,{checked:o.has(e.value),disabled:n||e.disabled,label:e.label,onCheckedChange:n=>r({...t,selected:n?[...t.selected,e.value]:t.selected.filter(t=>t!==e.value)}),className:`min-h-9 rounded-lg px-1.5 py-1`},e.value))}):(0,Q.jsx)(du,{value:t.selected[0]??``,onValueChange:e=>{r({selected:[e],custom:``}),i?.()},className:`gap-0.5`,children:e.options.map(e=>(0,Q.jsx)(fu,{value:e.value,label:e.label,disabled:n||e.disabled,className:`min-h-9 rounded-lg px-1.5 py-1`},e.value))}):null,e.allowCustom?(0,Q.jsx)(cu,{value:a,disabled:n,placeholder:e.customPlaceholder??`Add another response…`,onChange:n=>r({selected:e.multiple?t.selected:[],custom:n}),className:q(`p-0.5`,e.options?.length&&`mt-1.5`),classNames:{field:`h-10 rounded-xl border-0 bg-background/70 focus-within:bg-background`,input:`px-3 text-sm`}}):null]})}function yu({current:e,ids:t}){return(0,Q.jsxs)(`span`,{className:`flex gap-1.5`,children:[(0,Q.jsxs)(`span`,{className:`sr-only`,children:[`Question `,e+1,` of `,t.length]}),t.map((t,n)=>(0,Q.jsx)(K.span,{"aria-hidden":`true`,initial:{scale:n===e?1:.75,opacity:n<=e?1:.35},animate:{scale:n===e?1:.75,opacity:n<=e?1:.35},transition:Fe,className:`size-1.5 rounded-full bg-foreground`},t))]})}function bu({title:e=`Approval required`,description:t,children:n,questions:r=[],status:i=`pending`,answers:a,defaultAnswers:o={},onAnswersChange:s,step:c,defaultStep:l=0,onStepChange:u,onSubmit:d,onApprove:f,onReject:p,onRequestChanges:m,onDismiss:h,approveLabel:g=`Approve`,submitLabel:_=`Submit response`,result:v,className:y}){let b=Ge()??!1,[x,S]=(0,Z.useState)(o),[C,w]=(0,Z.useState)(l),T=(0,Z.useRef)(void 0),E=a??x,D=Math.min(Math.max(0,c??C),Math.max(0,r.length-1)),O=r[D],k=r.length>0,A=i===`pending`,j=i===`submitting`,M=A||j,N=O?E[O.id]??pu:pu,P=O?.title??e,F=O?.id??String(i),I=mu(i),L=(0,Z.useCallback)(()=>{T.current!==void 0&&(window.clearTimeout(T.current),T.current=void 0)},[]);(0,Z.useEffect)(()=>L,[L]);let R=(0,Z.useCallback)(e=>{a===void 0&&S(e),s?.(e)},[a,s]),z=e=>{L(),c===void 0&&w(e),u?.(e)};return(0,Q.jsx)(`div`,{"data-state":i,"aria-busy":j,className:q(`w-full overflow-hidden rounded-2xl bg-muted p-4 text-sm`,y),children:(0,Q.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:q(`grid size-5 shrink-0 place-items-center text-muted-foreground`,hu(i)),children:j?(0,Q.jsx)(mr,{className:q(`size-4`,!b&&`animate-spin`)}):M?k?(0,Q.jsx)(Qa,{className:`size-4`}):(0,Q.jsx)(co,{className:`size-4`}):i===`rejected`?(0,Q.jsx)(Wr,{className:`size-4`}):(0,Q.jsx)(Zn,{className:`size-4`})}),(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,Q.jsx)(`h3`,{className:`min-w-0 flex-1 text-base font-medium leading-5 text-foreground`,children:(0,Q.jsx)(_r,{value:F,children:P})}),k&&M?(0,Q.jsxs)(`span`,{className:`shrink-0 text-xs tabular-nums text-muted-foreground/65`,children:[D+1,`/`,r.length]}):(0,Q.jsx)(`span`,{className:q(`shrink-0 rounded-full border px-2 py-0.5 text-[11px] font-medium transition-colors`,gu(i)),children:I}),h?(0,Q.jsx)(`button`,{type:`button`,"aria-label":`Dismiss`,onClick:h,className:`grid size-5 shrink-0 place-items-center rounded-full text-muted-foreground outline-none transition-colors hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring`,children:(0,Q.jsx)(Wr,{className:`size-4`})}):null]}),(0,Q.jsxs)(Yr,{open:M,children:[(0,Q.jsx)(We,{initial:!1,mode:`wait`,children:k&&O?(0,Q.jsxs)(K.div,{initial:b?{opacity:1}:{opacity:0,x:8},animate:{opacity:1,x:0},exit:b?{opacity:0}:{opacity:0,x:-6},transition:{duration:b?0:.2,ease:Ne},children:[O.description?(0,Q.jsx)(`p`,{className:`mt-1 leading-5 text-muted-foreground`,children:O.description}):null,(0,Q.jsx)(vu,{question:O,answer:N,disabled:j,onChange:e=>{O&&R({...E,[O.id]:e})},onSingleSelect:()=>{!O||O.multiple||O.autoAdvance===!1||D>=r.length-1||j||(L(),T.current=window.setTimeout(()=>{z(D+1)},240))}})]},O.id):(0,Q.jsxs)(K.div,{initial:!1,children:[t?(0,Q.jsx)(`p`,{className:`mt-1 leading-5 text-muted-foreground`,children:t}):null,n?(0,Q.jsx)(`div`,{className:`mt-3`,children:n}):null]},`description`)}),k?(0,Q.jsxs)(`div`,{className:`mt-4 flex items-center gap-3`,children:[(0,Q.jsx)(He,{variant:`ghost`,size:`icon`,"aria-label":`Previous question`,disabled:j||D===0,onClick:()=>z(D-1),className:`rounded-full`,children:(0,Q.jsx)(bn,{className:`size-4`})}),(0,Q.jsx)(yu,{current:D,ids:r.map(e=>e.id)}),(0,Q.jsx)(He,{size:D===r.length-1?`sm`:`icon`,"aria-label":D===r.length-1?`Submit response`:`Next question`,disabled:j||!_u(N),onClick:()=>{if(D<r.length-1){z(D+1);return}d?.(E)},className:`ml-auto rounded-full`,children:j?(0,Q.jsx)(mr,{className:q(`size-4`,!b&&`animate-spin`)}):D===r.length-1?(0,Q.jsxs)(Q.Fragment,{children:[_,(0,Q.jsx)(Ya,{className:`size-3.5`})]}):(0,Q.jsx)(Ya,{className:`size-4`})})]}):(0,Q.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center gap-2`,children:[(0,Q.jsx)(He,{size:`sm`,disabled:j,onClick:f,className:`rounded-full`,children:g}),m?(0,Q.jsx)(He,{variant:`secondary`,size:`sm`,disabled:j,onClick:m,className:`rounded-full`,children:`Request changes`}):null,p?(0,Q.jsx)(He,{variant:`ghost`,size:`sm`,disabled:j,onClick:p,className:`rounded-full text-muted-foreground hover:text-rose-600 dark:hover:text-rose-400`,children:`Reject`}):null]})]}),M?null:(0,Q.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:v??I})]})]})})}function xu({questionBar:e,navigation:t,roundedTop:n,onDismiss:r}){let{totalQuestions:i,clampedQuestionIndex:a,activeQuestion:o,showQuestionNavigation:s,canGoPrev:c,canGoNext:l,goToPreviousQuestion:u,goToNextQuestion:d,advanceQuestionIndex:f}=t;if(!o)return null;let p={id:o.id??`question-${a}`,title:o.title,description:o.description,multiple:o.kind===`multi`,allowCustom:o.kind===`text`||o.allowCustom,customPlaceholder:o.customPlaceholder??o.placeholder,options:o.options?.map(e=>({value:e.id??e.value??e.label,label:e.label}))};return(0,Q.jsxs)(`div`,{className:q(`mx-auto w-full max-w-[calc(100%-24px)] border-x border-t border-border`,n?`rounded-t-an-input-border-radius`:null),children:[(0,Q.jsxs)(`div`,{className:`flex h-7 items-center justify-between border-b border-border px-3 text-xs text-an-tool-color-muted`,children:[(0,Q.jsxs)(`div`,{className:`inline-flex items-center gap-1.5`,children:[(0,Q.jsx)(Kn,{className:`h-3.5 w-3.5`}),`Question`]}),s&&(0,Q.jsxs)(`div`,{className:`inline-flex items-center gap-1`,children:[(0,Q.jsx)(`button`,{type:`button`,onClick:u,disabled:!c,className:`relative inline-flex size-5 items-center justify-center rounded-[4px] transition-[background-color,transform] duration-150 after:absolute after:inset-x-0 after:-top-2.5 after:-bottom-2.5 hover:bg-an-background-secondary active:scale-[0.96] disabled:opacity-40 disabled:active:scale-100`,"aria-label":`Previous question`,children:(0,Q.jsx)(fr,{className:`h-3.5 w-3.5`})}),(0,Q.jsxs)(`span`,{className:`tabular-nums`,children:[a,` of `,i]}),(0,Q.jsx)(`button`,{type:`button`,onClick:d,disabled:!l,className:`relative inline-flex size-5 items-center justify-center rounded-[4px] transition-[background-color,transform] duration-150 after:absolute after:inset-x-0 after:-top-2.5 after:-bottom-2.5 hover:bg-an-background-secondary active:scale-[0.96] disabled:opacity-40 disabled:active:scale-100`,"aria-label":`Next question`,children:(0,Q.jsx)(Qn,{className:`h-3.5 w-3.5`})})]})]}),(0,Q.jsx)(bu,{title:`Fleet Prime question`,questions:[p],submitLabel:e.submitLabel??`Continue`,status:`pending`,onSubmit:t=>{let n=t[p.id];if(!n)return;let s=n.custom?.trim()||void 0,c=n.selected.filter(e=>e!==`__custom__`),l=o.kind===`text`?{kind:`text`,questionId:o.id,text:s}:{kind:o.kind,questionId:o.id,selectedIds:c,text:s};e.onSubmit(l),a>=i?r(e.id):f()},className:`rounded-none bg-background p-0`},`${a}-${o.title}`),e.allowSkip?(0,Q.jsx)(`div`,{className:`border-t border-border bg-background px-3 py-2`,children:(0,Q.jsx)(`button`,{type:`button`,onClick:()=>{e.onSkip?.(),e.onSubmit({kind:`skip`,questionId:o.id}),r(e.id)},className:`text-xs text-muted-foreground underline-offset-2 hover:text-foreground hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,children:e.skipLabel??`Skip`})}):null]})}var Su=(0,Z.memo)(function({modes:e,value:t,defaultValue:n,onChange:r,className:i}){let a=t!==void 0,[o,s]=(0,Z.useState)(n),c=a?t:o,l=e.find(e=>e.id===c)??e[0],[u,d]=(0,Z.useState)(!1),f=(0,Z.useCallback)(e=>{a||s(e),r?.(e),d(!1)},[a,r]);if(e.length===0)return null;let p=l?.icon,m=e.length>1,h=(0,Q.jsxs)(`button`,{type:`button`,className:q(`relative inline-flex h-7 cursor-pointer items-center gap-1.5 rounded-full px-2 text-[12px] leading-4 text-foreground/40 transition-[background-color,transform] duration-150 after:absolute after:inset-x-0 after:-top-1.5 after:-bottom-1.5 hover:bg-foreground/6 active:scale-[0.96]`,!m&&`pointer-events-none`,i),"aria-label":`Select mode`,children:[p&&(0,Q.jsx)(p,{className:`size-3.5 shrink-0`}),(0,Q.jsx)(`span`,{className:`font-medium`,children:l?.label}),m&&(0,Q.jsx)(Qn,{className:`size-3 text-foreground/40`})]});return m?(0,Q.jsx)(Bc,{open:u,onOpenChange:d,side:`top`,align:`start`,trigger:h,children:e.map(e=>{let t=e.id===l?.id,n=e.icon;return(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>f(e.id),className:q(`flex w-full cursor-pointer items-start gap-2 rounded-[6px] px-2 py-2 text-left text-[12px] leading-4 text-foreground transition-[background-color,transform] duration-150 hover:bg-foreground/6 active:scale-[0.96]`,t&&`bg-foreground/6`),children:[n&&(0,Q.jsx)(n,{className:`mt-0.5 size-3.5 shrink-0`}),(0,Q.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(`span`,{className:`block truncate font-medium`,children:e.label}),e.description&&(0,Q.jsx)(`span`,{className:`block truncate text-foreground/40`,children:e.description})]}),t&&(0,Q.jsx)(Zn,{className:`mt-0.5 size-3.5 shrink-0 text-foreground/60`})]},e.id)})}):h});Array.from({length:14},(e,t)=>t);function Cu(e,t){return(0,Z.useMemo)(()=>{if(!t||!e.startsWith(`/`))return[];let n=e.slice(1).toLowerCase();return t.filter(e=>e.name.startsWith(n))},[t,e])}function wu(e,t){return(0,Z.useMemo)(()=>{if(!t)return[];let n=/(?:^|\s)@([^\s@]*)$/.exec(e);if(!n)return[];let r=n[1]?.toLowerCase()??``;return t.filter(e=>[e.name,e.id,e.path,e.description].filter(Boolean).join(` `).toLowerCase().includes(r))},[t,e])}function Tu({open:e,align:t=`start`,className:n,...r}){return(0,Q.jsx)(`div`,{"data-slot":`composer-menu`,"data-open":e||void 0,className:q(Xr,`absolute bottom-full z-10 mb-2 flex w-72 flex-col gap-0.5 rounded-2xl p-1.5`,t===`start`?`start-0 origin-bottom-left`:`end-0 origin-bottom-right`,`transition-[opacity,scale] duration-200 ease-[cubic-bezier(0.23,1,0.32,1)] motion-reduce:transition-none`,e?`scale-100 opacity-100`:`pointer-events-none scale-[0.97] opacity-0`,n),...r})}function Eu({active:e=!1,className:t,...n}){return(0,Q.jsx)(`button`,{type:`button`,"data-slot":`composer-menu-item`,"data-active":e||void 0,className:q(`flex w-full items-center gap-2.5 rounded-[10px] px-2.5 py-2 text-[13.5px] transition-colors`,e?Zr:`hover:bg-foreground/[0.04]`,t),...n})}function Du(e,t){return t.icon?t.icon:e===`mention`?t.metadata?.kind===`folder`?(0,Q.jsx)(Pr,{"aria-hidden":`true`,className:`size-4`}):(0,Q.jsx)(Nr,{"aria-hidden":`true`,className:`size-4`}):(0,Q.jsx)(to,{"aria-hidden":`true`,className:`size-4`})}function Ou(e,t){return e&&e.length>0?e.flatMap(e=>e.items):t?[...t]:[]}var ku=(0,Z.memo)(function({open:e,kind:t,query:n,items:r,groups:i,activeIndex:a=0,onActiveIndexChange:o,onSelect:s,onClose:c,onBack:l,className:u,emptyLabel:d=`No matching items`,title:f,listId:p=`fleet-composer-trigger-list`}){let m=(0,Z.useMemo)(()=>Ou(i,r),[i,r]);if(!e)return null;let h=!!(i&&i.length>0),g=m[a],_=(e,n)=>{let r=n===a,i=`${p}-${e.id.replace(/[^a-zA-Z0-9_-]/g,`-`)}`;return(0,Q.jsxs)(Eu,{id:i,disabled:e.disabled,role:`option`,"aria-selected":r,"data-active":r?`true`:void 0,active:r,onMouseDown:e=>e.preventDefault(),onMouseEnter:()=>o?.(n),onClick:()=>{e.disabled||s(e)},className:q(`flex min-h-10 cursor-pointer items-start gap-2 rounded-lg px-3 py-2 text-left`,r&&`bg-accent text-accent-foreground`),children:[(0,Q.jsx)(`span`,{className:`mt-0.5 shrink-0 text-muted-foreground`,children:Du(t,e)}),(0,Q.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(`span`,{className:`block truncate text-sm font-medium`,children:e.label}),e.description?(0,Q.jsx)(`span`,{className:`mt-0.5 block truncate text-xs text-muted-foreground`,children:e.description}):null]}),r?(0,Q.jsx)(dr,{"aria-hidden":`true`,className:`mt-1 size-3.5 shrink-0 text-muted-foreground`}):null]},e.id)};return e?(0,Q.jsxs)(Tu,{open:!0,id:p,role:`listbox`,"aria-label":f??`Suggestions`,"aria-activedescendant":g?`${p}-${g.id.replace(/[^a-zA-Z0-9_-]/g,`-`)}`:void 0,"data-slot":`composer-trigger-popover`,"data-kind":t,"data-state":`open`,className:q(`inset-x-0 z-50 mb-2 w-auto overflow-hidden rounded-xl border bg-popover text-popover-foreground shadow-xl`,u),children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 border-b px-3 py-2 text-xs text-muted-foreground`,children:[l?(0,Q.jsx)(`button`,{type:`button`,"aria-label":`Back`,onClick:l,className:`grid size-6 place-items-center rounded-md hover:bg-muted focus-visible:ring-2 focus-visible:ring-ring`,children:(0,Q.jsx)(nr,{"aria-hidden":`true`,className:`size-3.5`})}):null,(0,Q.jsx)(Hr,{"aria-hidden":`true`,className:`size-3.5`}),(0,Q.jsx)(`span`,{className:`font-medium`,children:f??(t===`slash`?`Commands`:`Workspace`)}),n?(0,Q.jsx)(`span`,{className:`ml-auto max-w-[50%] truncate font-mono text-[11px]`,children:n}):null,c?(0,Q.jsx)(`button`,{type:`button`,"aria-label":`Close suggestions`,onClick:c,className:`sr-only`,children:`Close suggestions`}):null]}),(0,Q.jsxs)(`div`,{className:`max-h-[min(42vh,360px)] overflow-y-auto p-1.5`,children:[m.length===0?(0,Q.jsx)(`div`,{className:`px-3 py-6 text-center text-sm text-muted-foreground`,children:d}):null,h?i?.map(e=>{let t=0;for(let n of i){if(n.id===e.id)break;t+=n.items.length}return(0,Q.jsxs)(`div`,{role:`group`,"aria-label":e.label,children:[(0,Q.jsx)(`div`,{className:`px-3 pb-1 pt-2 text-[10px] font-medium uppercase tracking-wide text-muted-foreground`,children:e.label}),e.items.map((e,n)=>_(e,t+n))]},e.id)}):m.map(_)]})]}):null}),Au=(0,Z.lazy)(()=>Gr(async()=>{let{ModelSelectorList:e}=await import(`./model-selector-list-CJY9pyt2.js`);return{ModelSelectorList:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21])).then(({ModelSelectorList:e})=>({default:e})));function ju(e){return(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(`div`,{className:`h-24 animate-pulse rounded-md bg-muted/40 p-1.5`,"aria-label":`Loading models`,role:`status`}),children:(0,Q.jsx)(Au,{...e})})}var Mu=(0,Z.memo)(function({models:e,value:t,effort:n,open:r,onOpenChange:i,onModelChange:a,onEffortChange:o,placeholder:s=`Model`,effortLabel:c=`Reasoning effort`,className:l,contentClassName:u}){let[d,f]=(0,Z.useState)(!1),p=(0,Z.useId)(),m=r??d,h=e=>{r===void 0&&f(e),i?.(e)},g=e.find(e=>e.id===t)??e[0],_=g?.efforts?.find(e=>e.id===n)??g?.efforts?.[0],v=(0,Q.jsxs)(`button`,{type:`button`,role:`combobox`,"aria-expanded":m,"aria-controls":p,"aria-haspopup":`dialog`,"aria-label":`Select model and reasoning effort`,className:q(`relative inline-flex h-8 max-w-[18rem] min-w-0 items-center gap-1.5 rounded-lg px-2 text-xs text-muted-foreground outline-none transition-colors hover:bg-muted hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring`,l),children:[g?.icon?(0,Q.jsx)(`span`,{className:`shrink-0`,children:g.icon}):null,(0,Q.jsx)(`span`,{className:`min-w-0 truncate font-medium`,children:g?.name??s}),_&&g?.reasoning?(0,Q.jsxs)(`span`,{className:`hidden shrink-0 text-muted-foreground/70 xl:inline`,children:[`· `,_.name]}):null,(0,Q.jsx)(Qn,{"aria-hidden":`true`,className:`size-3.5 shrink-0`})]});return(0,Q.jsx)(Bc,{contentId:p,open:m,onOpenChange:h,side:`top`,align:`start`,className:q(`w-[min(24rem,calc(100vw-2rem))] max-h-[min(55vh,28rem)] overflow-hidden p-0`,u),trigger:v,children:(0,Q.jsx)(ju,{models:e,selectedModel:g,selectedEffort:_,effortLabel:c,onModelChange:a,onEffortChange:o})})});function Nu(e){let[t,n]=(0,Z.useState)(1),r=e?.questions??[],i=r.length>0,a=i?r.length:1,o=e?.totalQuestions??a,s=e?.onPreviousQuestion||e?.onNextQuestion?e?.questionIndex??1:t,c=Math.max(1,Math.min(s,o)),l=i?r[c-1]:void 0,u=o>1,d=c>1,f=c<o;return{questionSet:r,totalQuestions:o,clampedQuestionIndex:c,activeQuestion:l,showQuestionNavigation:u,canGoPrev:d,canGoNext:f,goToPreviousQuestion:(0,Z.useCallback)(()=>{if(d){if(e?.onPreviousQuestion){e.onPreviousQuestion();return}n(e=>Math.max(1,e-1))}},[d,e]),goToNextQuestion:(0,Z.useCallback)(()=>{if(f){if(e?.onNextQuestion){e.onNextQuestion();return}n(e=>Math.min(o,e+1))}},[f,e,o]),advanceQuestionIndex:(0,Z.useCallback)(()=>{n(e=>Math.min(o,e+1))},[o])}}var Pu=[];function Fu(e){return e?Array.isArray(e)?e:e.items:[]}function Iu(e){return(e.value??e.id).trim().replace(/^\/+/,``).split(/\s+/,1)[0]??e.id}function Lu(e){return(e.value?.trim()??``).match(/^\/\S+\s+(.+)$/)?.[1]}function Ru({models:e,status:t,thinkingLevel:n,onModelChange:r,onThinkingLevelChange:i,onSend:a,onSlashCommandSelect:o,onLocalSlashSubmit:s,modelPickerOpen:c,onModelPickerOpenChange:l,effortPickerOpen:u,onEffortPickerOpenChange:d,workspaceReferences:f=Pu,workspaceSuggestions:p,onWorkspaceReferenceSelect:m,onRemoveWorkspaceReference:h,controlled:g,disabled:_,questionBar:v,attachments:y,slashCommands:b}){let[x,S]=(0,Z.useState)(``),[C,w]=(0,Z.useState)(null),T=g?.value??x,E=g?.onChange??S,D=t===`streaming`||t===`submitted`,O=Nu(v),k=Fu(b),A=Fu(p),j=(0,Z.useMemo)(()=>k.map(e=>({name:Iu(e),description:[e.description,Lu(e)].filter(Boolean).join(` `),icon:Hr})),[k]),M=(0,Z.useMemo)(()=>A.map(e=>({id:e.id,name:e.label,path:e.value??e.label,kind:e.metadata?.kind===`folder`?`folder`:`file`,description:e.description,role:`human`})),[A]),N=T.match(/^\/([^\s/]*)$/),P=T.match(/(?:^|\s)@([^\s@]*)$/),F=N?.[1]?.toLowerCase(),I=P?.[1]?.toLowerCase(),L=F===void 0?I===void 0?void 0:`mention`:`slash`,R=Cu(T,j),z=wu(T,M),B=(0,Z.useMemo)(()=>{let e=new Set(R.map(e=>e.name));return k.filter(t=>e.has(Iu(t)))},[k,R]),V=(0,Z.useMemo)(()=>{let e=new Set(z.map(e=>e.id).filter(e=>!!e));return A.filter(t=>e.has(t.id))},[z,A]),H=L===`slash`?B:V,[U,W]=(0,Z.useState)(0);(0,Z.useEffect)(()=>{W(0)},[L,F,I,H.length]);let G=(0,Z.useCallback)((e,t=!1)=>{if(s?.(e)===!0){E(``);return}a({role:`user`,content:e,altKey:t}),E(``)},[s,a,E]),ee=(0,Z.useCallback)(e=>{if(o?.(e)===!0){E(``);return}E(e.value??e.label)},[o,E]),te=(0,Z.useCallback)(e=>{if(!e)return T;let t=e[0].length-e[0].trimStart().length,n=T.length-e[0].length+t;return T.slice(0,n)},[T]),ne=(0,Z.useCallback)(e=>{m?.(e),E(te(P))},[m,te,E,P]),re=(0,Z.useCallback)(e=>{let t=!D&&!_&&L!==void 0;if(e.key===`Backspace`&&T.length===0&&f.length>0){let t=f[f.length-1];if(t){e.preventDefault(),h?.(t.relativePath);return}}if(t&&e.key===`Escape`){e.preventDefault(),E(te(L===`slash`?N:P));return}if(t&&H.length>0){if(e.key===`ArrowDown`){e.preventDefault(),W(e=>(e+1)%H.length);return}if(e.key===`ArrowUp`){e.preventDefault(),W(e=>(e-1+H.length)%H.length);return}if(e.key===`Enter`||e.key===`Tab`){e.preventDefault();let t=H[U];t&&(L===`slash`?ee(t):ne(t));return}}if(e.key===`Enter`&&e.altKey&&!e.shiftKey){e.preventDefault();let t=T.trim();t&&!_&&G(t,!0)}},[U,_,D,h,te,ee,ne,G,E,N,H,L,T,P,f]),ie=v&&v.id!==C,ae=y?.files??[],oe=y?.images??[],se=!!(L&&!D&&!_),ce=(0,Z.useMemo)(()=>{if(L!==`slash`)return[];let e=new Map;for(let t of B){let n=t.category??`builtin`,r=e.get(n)??[];r.push(t),e.set(n,r)}let t={builtin:`Built-in`,extension:`Extensions`,prompt:`Prompts`,skill:`Skills`};return[...e.entries()].map(([e,n])=>({id:e,label:t[e]??e,items:n.map(e=>({...e,description:[e.description,Lu(e)].filter(Boolean).join(` · `)}))}))},[B,L]),le=(0,Z.useMemo)(()=>e.map(e=>({id:e.id,name:e.name,provider:e.provider,providerLabel:Nn(e.provider),modelId:e.modelId,icon:(0,Q.jsx)(kn,{provider:e.provider,className:`size-4`}),disabled:e.available===!1,reasoning:e.reasoning,keywords:[e.provider,e.modelId,e.id],efforts:wr(e).map(e=>({id:e,name:Tr(e)}))})),[e]);return{activeTriggerIndex:U,combinedPickerOpen:c===!0||u===!0,commandGroups:ce,files:ae,handleCombinedPickerOpenChange:(0,Z.useCallback)(e=>{l?.(e),d?.(e)},[d,l]),handlePromptKeyDown:re,handleSelectorModelChange:(0,Z.useCallback)(t=>{let a=e.find(e=>e.id===t);r(t),a&&i?.(yr(n,wr(a)))},[e,r,i,n]),images:oe,isStreaming:D,navigation:O,selectorModels:le,selectCommand:ee,selectWorkspaceReference:ne,removeTriggerToken:te,send:G,setActiveTriggerIndex:W,setDismissedQuestionId:w,setValue:E,showQuestion:ie,triggerItems:H,triggerKind:L,triggerOpen:se,slashMatch:N,slashQuery:F,workspaceMentionMatch:P,workspaceQuery:I,filteredCommands:B,filteredWorkspaceItems:V,value:T}}var zu=[{id:`agent`,label:`Agent`,icon:Xn,description:`Default coding agent`},{id:`plan`,label:`Plan`,icon:Un,description:`Plan before executing`},{id:`harness`,label:`Harness`,icon:fo,description:`Harness-aware turn`}],Bu=[];function Vu(e){return(0,Q.jsx)(Hu,{...e})}function Hu({modelKey:e,models:t,status:n,infoDescription:r,chatMode:i=`agent`,onChatModeChange:a,onModelChange:o,thinkingLevel:s,onThinkingLevelChange:c,onStop:l,onSend:u,onSlashCommandSelect:d,onLocalSlashSubmit:f,modelPickerOpen:p,onModelPickerOpenChange:m,effortPickerOpen:h,onEffortPickerOpenChange:g,workspaceReferences:_=Bu,workspaceSuggestions:v,onWorkspaceReferenceSelect:y,onRemoveWorkspaceReference:b,controlled:x,disabled:S,autoFocus:C,placeholder:w,attachments:T,questionBar:E,slashCommands:D,className:O}){let{activeTriggerIndex:k,combinedPickerOpen:A,commandGroups:j,files:M,handleCombinedPickerOpenChange:N,handlePromptKeyDown:P,handleSelectorModelChange:F,images:I,isStreaming:L,navigation:R,filteredWorkspaceItems:z,removeTriggerToken:B,selectCommand:H,selectWorkspaceReference:U,selectorModels:W,send:G,setActiveTriggerIndex:ee,setDismissedQuestionId:te,setValue:ne,showQuestion:re,slashMatch:ie,slashQuery:ae,triggerItems:oe,triggerKind:se,triggerOpen:ce,value:le,workspaceMentionMatch:ue,workspaceQuery:de}=Ru({models:t,status:n,thinkingLevel:s,onModelChange:o,onThinkingLevelChange:c,onSend:u,onSlashCommandSelect:d,onLocalSlashSubmit:f,modelPickerOpen:p,onModelPickerOpenChange:m,effortPickerOpen:h,onEffortPickerOpenChange:g,workspaceReferences:_,workspaceSuggestions:v,onWorkspaceReferenceSelect:y,onRemoveWorkspaceReference:b,controlled:x,disabled:S,questionBar:E,attachments:T,slashCommands:D});return(0,Q.jsx)(`div`,{className:q(`shrink-0 px-3 pb-3`,O),children:(0,Q.jsxs)(`div`,{className:`relative mx-auto w-full max-w-an`,children:[(0,Q.jsx)(iu,{label:r??void 0,isActive:L}),re?(0,Q.jsx)(xu,{questionBar:E,navigation:R,roundedTop:!0,onDismiss:te}):null,(0,Q.jsx)(ku,{open:ce,kind:se??`slash`,query:se===`slash`?ae:de,items:se===`mention`?z:void 0,groups:se===`slash`?j:void 0,activeIndex:k,onActiveIndexChange:ee,onSelect:e=>{se===`slash`?H(e):U(e)},onClose:()=>ne(B(se===`slash`?ie:ue)),title:se===`slash`?`Commands`:`Workspace references`,listId:`fleet-composer-trigger-list`}),I.length>0||M.length>0?(0,Q.jsxs)(`div`,{className:`mb-2 flex flex-wrap gap-2 rounded-xl border bg-muted/40 p-2`,children:[I.map(e=>(0,Q.jsxs)(`div`,{className:`group relative`,children:[(0,Q.jsx)(`img`,{src:e.url,alt:e.filename,width:64,height:64,loading:`lazy`,className:`size-16 rounded-lg border object-cover`}),(0,Q.jsx)(V,{type:`button`,variant:`outline`,size:`icon-xs`,"aria-label":`Remove ${e.filename}`,onClick:()=>T?.onRemoveImage?.(e.id),className:`absolute -right-1 -top-1 size-5 rounded-full bg-background opacity-0 shadow-sm transition-opacity group-hover:opacity-100 group-focus-within:opacity-100 focus-visible:opacity-100 [@media(hover:none)]:opacity-100`,children:(0,Q.jsx)(Wr,{"data-icon":`inline-start`,className:`size-3`})})]},e.id)),M.map(e=>(0,Q.jsx)(or,{id:e.id,filename:e.filename,size:e.size,onRemove:T?.onRemoveFile?()=>T.onRemoveFile?.(e.id):void 0},e.id))]}):null,_.length>0?(0,Q.jsx)(`div`,{className:`mb-2 flex flex-wrap gap-1.5 rounded-xl border bg-muted/40 p-2`,children:_.map(e=>(0,Q.jsxs)(`div`,{className:`inline-flex max-w-full items-center gap-1.5 rounded-lg border bg-background px-2 py-1 text-xs text-foreground/75`,children:[(0,Q.jsx)(hr,{className:`size-3.5 shrink-0 text-muted-foreground`}),(0,Q.jsxs)(`span`,{className:`max-w-[min(28rem,70vw)] truncate`,children:[`@`,e.relativePath]}),(0,Q.jsx)(`button`,{type:`button`,"aria-label":`Remove workspace reference ${e.relativePath}`,onClick:()=>b?.(e.relativePath),className:`grid size-5 shrink-0 place-items-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring`,children:(0,Q.jsx)(Wr,{className:`size-3`})})]},e.relativePath))}):null,(0,Q.jsx)(Ue,{id:`fleet-composer-prompt`,name:`prompt`,value:le,onValueChange:ne,onSubmit:e=>G(e),loading:L,submitWhileLoading:!0,onStop:l,disabled:S,autoFocus:C,placeholder:w??`Send a message…`,onPaste:T?.onPaste,"aria-controls":ce?`fleet-composer-trigger-list`:void 0,"aria-expanded":ce,"aria-haspopup":`listbox`,"aria-activedescendant":ce&&oe[k]?`fleet-composer-trigger-list-${oe[k].id.replace(/[^a-zA-Z0-9_-]/g,`-`)}`:void 0,actions:T?.onAttach?[{value:`attach`,label:`Attach file`,description:`Add a file or image to this turn`,icon:(0,Q.jsx)(ro,{})}]:[],onAction:e=>{e===`attach`&&T?.onAttach?.()},onKeyDown:P,leadingAction:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Su,{modes:[...zu],value:i,onChange:e=>a?.(e)}),(0,Q.jsx)(Mu,{models:W,value:e,effort:s,onModelChange:F,onEffortChange:e=>c?.(e),open:A,onOpenChange:N,placeholder:`Model`,className:`rounded-full`})]})})]})})}var Uu=`Fleet Prime is not connected to the Prime Agent runtime. Start or reconnect the runtime, then try again.`;function Wu(e){return e.code===`NETWORK_DISCONNECTED`||/Cannot send daemon command/i.test(e.message)||/Prime Agent daemon is not connected/i.test(e.message)||/not connected to the Prime Agent runtime/i.test(e.message)?{title:`Agent unavailable`,message:Uu}:{title:`Request failed`,message:e.message.replace(/\s+(?:Socket|Daemon log):\s*[^\n]*(?:\s+(?:Socket|Daemon log):\s*[^\n]*)*/gi,``)}}var Gu=(0,Z.lazy)(()=>Gr(async()=>{let{FleetPiToolRenderer:e}=await import(`./fleet-pi-tool-renderer-DMjrKLi2.js`).then(e=>e.n);return{FleetPiToolRenderer:e}},__vite__mapDeps([22,1,2,3,4,5,23,6,8,24,7,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,17,45,46,16,47,48,49,50,51,14,12,15,21,52,53])).then(({FleetPiToolRenderer:e})=>({default:e})));function Ku(e){return(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(`div`,{className:`h-7 animate-pulse rounded-md bg-muted/40`,"aria-label":`Loading tool`}),children:(0,Q.jsx)(Gu,{...e})})}var qu=(0,Z.lazy)(()=>Gr(async()=>{let{AgentActivity:e}=await import(`./agent-activity-CDcDNVC6.js`);return{AgentActivity:e}},__vite__mapDeps([54,1,2,3,4,5,23,6,8,7,25,35,44,55,56,17,45,30,31,33,37])).then(({AgentActivity:e})=>({default:e})));function Ju(e){return(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(`div`,{className:`mt-2 h-8 animate-pulse rounded-md bg-muted/40`,"aria-label":`Loading activity`}),children:(0,Q.jsx)(qu,{...e})})}var Yu=(0,Z.lazy)(()=>Gr(async()=>{let{FleetReasoningPanel:e}=await import(`./fleet-reasoning-panel-MtbSdoCv.js`);return{FleetReasoningPanel:e}},__vite__mapDeps([57,1,2,3,6,25,8,51,14,12,15,21,52,53])).then(({FleetReasoningPanel:e})=>({default:e})));function Xu(e){return(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(`div`,{className:`mb-2 h-6 animate-pulse rounded-md bg-muted/40`,"aria-label":`Loading reasoning`}),children:(0,Q.jsx)(Yu,{...e})})}var Zu=(0,Z.lazy)(()=>Gr(async()=>{let{FleetToolTimeline:e}=await import(`./fleet-tool-timeline-COzPrwr8.js`).then(e=>e.n);return{FleetToolTimeline:e}},__vite__mapDeps([58,1,2,3,6,8,25,46,31])).then(({FleetToolTimeline:e})=>({default:e})));function Qu(e){return(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(`div`,{className:`h-6 animate-pulse rounded-md bg-muted/40`,"aria-label":`Loading timeline`}),children:(0,Q.jsx)(Zu,{...e})})}var $u=(0,Z.lazy)(()=>Gr(async()=>{let{FleetSubagentList:e}=await import(`./fleet-subagent-list-BnRnrWKS.js`).then(e=>e.n);return{FleetSubagentList:e}},__vite__mapDeps([59,1,2,3,6,25,8,26,60,40,27])).then(({FleetSubagentList:e})=>({default:e})));function ed(e){return(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(`div`,{className:`h-6 animate-pulse rounded-md bg-muted/40`,"aria-label":`Loading subagents`}),children:(0,Q.jsx)($u,{...e})})}var td=(0,Z.lazy)(()=>Gr(async()=>{let{PromptSuggestions:e}=await import(`./prompt-suggestions-CXM6knMK.js`);return{PromptSuggestions:e}},__vite__mapDeps([61,3,1,6,2,52])).then(({PromptSuggestions:e})=>({default:e})));function nd(e){return(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(`div`,{className:`h-8 animate-pulse rounded-full bg-muted/40`,"aria-label":`Loading suggestions`}),children:(0,Q.jsx)(td,{...e})})}var rd=(0,Z.lazy)(()=>Gr(async()=>{let{FleetMessageQueue:e}=await import(`./fleet-message-queue-DPBMIZSU.js`);return{FleetMessageQueue:e}},__vite__mapDeps([62,3,1,6,2,16,8,63,64,12,13,14,26,65])).then(({FleetMessageQueue:e})=>({default:e})));function id(e){return(0,Q.jsx)(Z.Suspense,{fallback:null,children:(0,Q.jsx)(rd,{...e})})}function ad(e){return(e.parts??[]).flatMap(e=>typeof e==`object`&&e&&`type`in e&&e.type===`text`&&`text`in e&&typeof e.text==`string`?[e.text]:[]).join(`
|
|
2
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t}from"./bundle-mjs-DKHVkVWu.js";import{t as n}from"./react-dom-Bwxum3ti.js";import{t as r}from"./jsx-runtime-NZYk81nU.js";import{D as i,E as a,F as o,M as s,O as c,P as l,d as u,g as d,h as f,j as p,k as m,l as h,m as g,o as _,p as v,s as y,v as b,w as x,x as S}from"./analytics-stub-Cas1He0w.js";import{A as C,B as w,D as T,E,Q as D,S as O,T as k,V as A,b as j,c as M,et as N,f as P,k as F,m as I,n as L,nt as R,p as z,r as B,t as V,v as H,x as U,z as W}from"./button-BV9NafmI.js";import{$ as G,C as ee,I as te,K as ne,L as re,M as ie,N as ae,P as oe,U as se,V as ce,W as le,X as ue,Y as de,Z as fe,at as pe,ct as me,et as he,h as ge,it as _e,j as ve,m as ye,nt as be,ot as xe,q as Se,rt as Ce,tt as we,y as Te,z as Ee}from"./layout-gyLzPvVv.js";import{d as K,h as De,l as Oe,m as ke,n as Ae,o as je,p as Me,r as Ne,t as Pe,u as Fe}from"./ease-u56MhKYS.js";import{a as Ie,c as Le,i as Re,n as ze,o as Be,r as Ve,s as He,t as Ue}from"./prompt-input-BpuTiX7Z.js";import{n as We,t as Ge}from"./use-reduced-motion-eORd7fqW.js";import{C as Ke,K as qe,O as Je,b as Ye,c as Xe,d as Ze,et as Qe,f as $e,h as et,i as tt,j as nt,nt as rt,o as it,ot as at,rt as ot,s as st,st as ct,t as lt,v as ut,w as dt,x as ft}from"./createBaseUIEventDetails-DV0dQrBX.js";import{$ as pt,A as mt,B as ht,C as gt,D as _t,E as vt,F as yt,G as bt,H as xt,I as St,J as Ct,K as wt,L as Tt,M as Et,N as Dt,O as Ot,P as kt,Q as At,R as jt,S as Mt,U as Nt,V as Pt,W as Ft,X as It,Z as Lt,_ as Rt,a as zt,b as Bt,et as Vt,g as Ht,h as Ut,i as Wt,j as Gt,n as Kt,o as qt,q as Jt,r as Yt,t as Xt,w as Zt,x as Qt,y as $t}from"./dialog-Dh7WpGIu.js";import{_ as en,b as tn,c as nn,f as rn,g as an,j as on,m as sn,s as cn,u as ln,v as un,x as dn,y as fn}from"./provider-catalog-CO1GxLYe.js";import{t as pn}from"./useBaseUiId-CHqXB2UQ.js";import{A as mn,C as hn,D as gn,E as _n,O as vn,S as yn,T as bn,a as xn,c as Sn,d as Cn,f as wn,h as Tn,i as En,l as Dn,m as On,n as kn,o as An,p as jn,s as Mn,t as Nn,u as Pn,x as Fn,y as In}from"./provider-label-B0E-wWFV.js";import{t as q}from"./utils-Eg7xtNmV.js";import{t as Ln}from"./createLucideIcon-DwxZHm0M.js";import{n as Rn,r as zn,t as Bn}from"./right-panel-registry-DOyEvIMD.js";import{c as Vn,i as Hn,l as Un,n as Wn,o as Gn,s as Kn,t as qn,u as Jn}from"./citations-BQ_pr_9_.js";import{r as Yn}from"./resource-helpers-Q2T0YCMO.js";import{t as Xn}from"./bot-Bs7QWJ2q.js";import{t as Zn}from"./check-JjHKAZas.js";import{t as Qn}from"./chevron-down-BEVGmnSb.js";import{a as $n,c as er,d as tr,f as nr,i as rr,l as ir,n as ar,o as or,r as sr,s as cr,t as lr,u as ur}from"./generative-text-renderer-CzwNIs3b.js";import{t as dr}from"./chevron-right-DrJxToLs.js";import{t as fr}from"./chevron-up-CnSvySGH.js";import{t as pr}from"./circle-alert-CONlFReH.js";import{t as mr}from"./loader-circle-DjfHXUPB.js";import{n as hr,r as gr,t as _r}from"./action-swap-roll-BB8DFMuf.js";import{t as vr}from"./file-text-T-NcAlZs.js";import{a as yr,c as br,d as xr,f as Sr,h as Cr,i as wr,l as Tr,m as Er,n as Dr,r as Or,s as kr,t as Ar,u as jr,v as Mr,y as Nr}from"./horizontal-resize-Bl3AyBJg.js";import{t as Pr}from"./folder-BC5p7qK7.js";import{t as Fr}from"./gauge-DNpstbBn.js";import{t as Ir}from"./package-CdcJFPf2.js";import{t as Lr}from"./plus-DXN1Bg_z.js";import{t as Rr}from"./refresh-cw-IThTJ3j-.js";import{t as zr}from"./rotate-ccw-WNFNkKQD.js";import{t as Br}from"./subagent-utils-DDH5qm9Z.js";import{t as Vr}from"./search-eWVnAJsb.js";import{t as Hr}from"./sparkles-DuclzqlE.js";import{t as Ur}from"./triangle-alert-CU-gd7ui.js";import{t as Wr}from"./x-CsRC_tCI.js";import{t as Gr}from"./preload-helper-Czpn1I53.js";import"./cn-C8c0S2mI.js";import{t as Kr}from"./notify-BnNaNaBU.js";import{n as qr}from"./workspace-path-nav-C0AQNZyy.js";import{t as Jr}from"./useControlled-CJJ9BOQB.js";import{t as Yr}from"./agent-disclosure-B8SnhQXL.js";import{a as Xr,i as Zr,o as Qr,s as $r}from"./surfaces-cW-gp56p.js";import{t as ei}from"./prime-agent-artifacts-C-g1VPiW.js";import{A as ti,C as ni,D as ri,E as ii,F as ai,I as oi,J as si,L as ci,M as li,O as ui,P as J,R as di,S as fi,T as pi,V as Y,_ as mi,a as hi,c as gi,d as _i,f as vi,g as yi,h as bi,i as xi,j as Si,l as Ci,m as wi,n as Ti,o as Ei,p as Di,q as Oi,r as ki,s as Ai,t as ji,u as Mi,v as Ni,w as Pi,y as Fi,z as X}from"./chat-DdPRGn-U.js";import{i as Ii,n as Li,t as Ri}from"./right-panel-context-DHlNWJsF.js";import{t as zi}from"./input-Bol3TP4v.js";import{t as Bi}from"./artifacts-utils-N_kUFbz2.js";var Vi=class extends f{#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p=new Set;constructor(e,t){super(),this.options=t,this.#e=e,this.#o=null,this.bindMethods(),this.setOptions(t)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),Ui(this.#t,this.options)?this.#m():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Wi(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Wi(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof i(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!c(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&Gi(this.#t,n,this.options,t)&&this.#m(),this.updateResult(),r&&(this.#t!==n||i(this.options.enabled,this.#t)!==i(t.enabled,this.#t)||i(this.options.staleTime,this.#t)!==i(t.staleTime,this.#t))&&this.#g();let a=this.#_();r&&(this.#t!==n||i(this.options.enabled,this.#t)!==i(t.enabled,this.#t)||a!==this.#f)&&this.#v(a)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return c(this.getCurrentResult(),n)||(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),Reflect.get(e,n))})}trackProp(e){this.#p.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t),r=()=>{},i,a=new Promise(e=>{i=e,r=this.#e.getQueryCache().subscribe(i=>{i.type===`updated`&&i.query.queryHash===n.queryHash&&n.state.data!==void 0&&(r(),e(this.createResult(n,t)))})});return Promise.race([n.fetch().then(()=>{let e=this.createResult(n,t);return i?.(e),e}).finally(()=>{r()}),a])}fetch(e){return this.#m({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#m(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(x)),t}#h(e){return!d()&&i(this.options.enabled,this.#t)!==!1&&S(e)}#g(){this.#b();let e=i(this.options.staleTime,this.#t);if(this.#r.isStale||!this.#h(e))return;let t=p(this.#r.dataUpdatedAt,e)+1;this.#u=s.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return(typeof this.options.refetchInterval==`function`?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#x(),this.#f=e,!(this.#f===0||!this.#h(this.#f))&&(this.#d=s.setInterval(()=>{(this.options.refetchIntervalInBackground||g.isFocused())&&this.#m()},this.#f))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#u!==void 0&&(s.clearTimeout(this.#u),this.#u=void 0)}#x(){this.#d!==void 0&&(s.clearInterval(this.#d),this.#d=void 0)}createResult(e,t){let n=this.#t,r=this.options,o=this.#r,s=this.#i,c=this.#a,l=e===n?this.#n:e.state,{state:d}=e,f={...d},p=!1,m;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&Ui(e,t),o=i&&Gi(e,n,t,r);(a||o)&&(f={...f,...u(d.data,e.options)}),t._optimisticResults===`isRestoring`&&(f.fetchStatus=`idle`)}let{error:h,errorUpdatedAt:g,status:_}=f;m=f.data;let v=!1;if(t.placeholderData!==void 0&&m===void 0&&_===`pending`){let e;o?.isPlaceholderData&&t.placeholderData===c?.placeholderData?(e=o.data,v=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#l?.state.data,this.#l):t.placeholderData,e!==void 0&&(_=`success`,m=a(o?.data,e,t),p=!0)}if(t.select&&m!==void 0&&!v){if(o&&m===s?.data&&t.select===this.#s)m=this.#c;else try{this.#s=t.select,m=t.select(m),m=a(o?.data,m,t),this.#c=m,this.#o=null}catch(e){this.#o=e}}else m===void 0&&(this.#o=null);this.#o&&(h=this.#o,m=this.#c,g=Date.now(),_=`error`,p=!1);let y=f.fetchStatus===`fetching`,b=_===`pending`,x=_===`error`,S=b&&y,C=m!==void 0;return{status:_,fetchStatus:f.fetchStatus,isPending:b,isSuccess:_===`success`,isError:x,isInitialLoading:S,isLoading:S,data:m,dataUpdatedAt:f.dataUpdatedAt,error:h,errorUpdatedAt:g,failureCount:f.fetchFailureCount,failureReason:f.fetchFailureReason,errorUpdateCount:f.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:f.dataUpdateCount>l.dataUpdateCount||f.errorUpdateCount>l.errorUpdateCount,isFetching:y,isRefetching:y&&!b,isLoadingError:x&&!C,isPaused:f.fetchStatus===`paused`,isPlaceholderData:p,isRefetchError:x&&C,isStale:Ki(e,t),refetch:this.refetch,isEnabled:i(t.enabled,e)!==!1}}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);if(this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#l=this.#t),c(t,e))return;this.#r=t;let n=(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#p.size)return!0;let r=new Set(n??this.#p);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})();v.batch(()=>{n&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}};function Hi(e,t){return i(t.enabled,e)!==!1&&e.state.data===void 0&&(e.state.status!==`error`||i(t.retryOnMount,e)!==!1)}function Ui(e,t){return Hi(e,t)||e.state.data!==void 0&&Wi(e,t,t.refetchOnMount)}function Wi(e,t,n){if(i(t.enabled,e)!==!1&&i(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&Ki(e,t)}return!1}function Gi(e,t,n,r){return(e!==t||i(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&Ki(e,n)}function Ki(e,t){return i(t.enabled,e)!==!1&&e.isStaleByTime(i(t.staleTime,e))}var qi=class extends f{#e;#t=void 0;#n;#r;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),c(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&b(t.mutationKey)!==b(this.options.mutationKey)?this.reset():this.#n?.state.status===`pending`&&this.#n.setOptions(this.options)}onSubscribe(){this.listeners.size===1&&this.#n&&(this.#n.addObserver(this),this.#i())}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#a(e)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#a()}mutate(e,t){return this.#r=t,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(e)}#i(){let e=this.#n?.state??h();this.#t={...e,isPending:e.status===`pending`,isSuccess:e.status===`success`,isError:e.status===`error`,isIdle:e.status===`idle`,mutate:this.mutate,reset:this.reset}}#a(e){v.batch(()=>{if(this.#r&&this.hasListeners()){let t=this.#t.variables,n=this.#t.context,r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type===`success`){try{this.#r.onSuccess?.(e.data,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(e.data,null,t,n,r)}catch(e){Promise.reject(e)}}else if(e?.type===`error`){try{this.#r.onError?.(e.error,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(void 0,e.error,t,n,r)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}},Z=e(t(),1),Ji=Z.createContext(!1),Yi=()=>Z.useContext(Ji);Ji.Provider;var Q=r();function Xi(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Zi=Z.createContext(Xi()),Qi=()=>Z.useContext(Zi),$i=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?m(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||r)&&(t.isReset()||(e.retryOnMount=!1))},ea=e=>{Z.useEffect(()=>{e.clearReset()},[e])},ta=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||m(n,[e.error,r])),na=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},ra=(e,t)=>e?.suspense&&t.isPending,ia=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function aa(e,t,n){let r=Yi(),i=Qi(),a=l(n),o=a.defaultQueryOptions(e),s=a.getQueryCache().get(o.queryHash),c=e.subscribed!==!1;o._optimisticResults=r?`isRestoring`:c?`optimistic`:void 0,na(o),$i(o,i,s),ea(i);let[u]=Z.useState(()=>new t(a,o)),d=u.getOptimisticResult(o),f=!r&&c;if(Z.useSyncExternalStore(Z.useCallback(e=>{let t=f?u.subscribe(v.batchCalls(e)):x;return u.updateResult(),t},[u,f]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),Z.useEffect(()=>{u.setOptions(o)},[o,u]),ra(o,d))throw ia(o,u,i);if(ta({result:d,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw d.error;return o.notifyOnChangeProps?d:u.trackResult(d)}function oa(e,t){return aa(e,Vi,t)}function sa(e,t){let n=l(t),[r]=Z.useState(()=>new qi(n,e));Z.useEffect(()=>{r.setOptions(e)},[r,e]);let i=Z.useSyncExternalStore(Z.useCallback(e=>r.subscribe(v.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=Z.useCallback((...e)=>{r.mutate(e[0],e[1]).catch(x)},[r]);if(i.error&&m(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}var ca=(e,t,n)=>{let r=t-e;return((n-e)%r+r)%r+e};function la(e,t){return he(e)?e[ca(0,e.length,t)]:e}var ua=class{constructor(e){this.stop=()=>this.runAll(`stop`),this.animations=e.filter(Boolean)}get finished(){return Promise.all(this.animations.map(e=>e.finished))}getAll(e){return this.animations[0][e]}setAll(e,t){for(let n=0;n<this.animations.length;n++)this.animations[n][e]=t}attachTimeline(e){let t=this.animations.map(t=>t.attachTimeline(e));return()=>{t.forEach((e,t)=>{e&&e(),this.animations[t].stop()})}}get time(){return this.getAll(`time`)}set time(e){this.setAll(`time`,e)}get speed(){return this.getAll(`speed`)}set speed(e){this.setAll(`speed`,e)}get state(){return this.getAll(`state`)}get startTime(){return this.getAll(`startTime`)}get duration(){return da(this.animations,`duration`)}get iterationDuration(){return da(this.animations,`iterationDuration`)}runAll(e){this.animations.forEach(t=>t[e]())}play(){this.runAll(`play`)}pause(){this.runAll(`pause`)}cancel(){this.runAll(`cancel`)}complete(){this.runAll(`complete`)}};function da(e,t){let n=0;for(let r=0;r<e.length;r++){let i=e[r][t];i!==null&&i>n&&(n=i)}return n}var fa=class extends ua{then(e,t){return this.finished.finally(e).then(()=>{})}};function pa(e,t){return e in t}var ma=class extends ee{constructor(){super(...arguments),this.type=`object`}readValueFromInstance(e,t){if(pa(t,e)){let n=e[t];if(typeof n==`string`||typeof n==`number`)return n}}getBaseTargetFromProps(){}removeValueFromRenderState(e,t){delete t.output[e]}measureInstanceViewportBox(){return ie()}build(e,t){Object.assign(e.output,t)}renderInstance(e,{output:t}){Object.assign(e,t)}sortInstanceNodePosition(){return 0}},ha=e=>!e.isLayoutDirty&&e.willUpdate(!1);function ga(){let e=new Set,t=new WeakMap,n=()=>e.forEach(ha);return{add:r=>{e.add(r),t.set(r,r.addEventListener(`willUpdate`,n))},remove:r=>{e.delete(r);let i=t.get(r);i&&(i(),t.delete(r)),n()},dirty:n}}var _a=(0,Z.createContext)(null);function va(){let e=(0,Z.useRef)(!1);return ke(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function ya(){let e=va(),[t,n]=(0,Z.useState)(0),r=(0,Z.useCallback)(()=>{e.current&&n(t+1)},[t]);return[(0,Z.useCallback)(()=>G.postRender(r),[r]),t]}var ba=e=>e===!0,xa=e=>ba(e===!0)||e===`id`,Sa=({children:e,id:t,inherit:n=!0})=>{let r=(0,Z.useContext)(me),i=(0,Z.useContext)(_a),[a,o]=ya(),s=(0,Z.useRef)(null),c=r.id||i;s.current===null&&(xa(n)&&c&&(t=t?c+`-`+t:c),s.current={id:t,group:ba(n)&&r.group||ga()});let l=(0,Z.useMemo)(()=>({...s.current,forceRender:a}),[o]);return(0,Q.jsx)(me.Provider,{value:l,children:e})};function Ca({children:e,...t}){let n=(0,Z.useContext)(Me);t={...n,...t},t.transition=ce(t.transition,n.transition),t.isStatic=De(()=>t.isStatic);let r=(0,Z.useMemo)(()=>t,[JSON.stringify(t.transition),t.transformPagePoint,t.reducedMotion,t.skipAnimations,t.isValidProp]);return(0,Q.jsx)(Me.Provider,{value:r,children:e})}function wa(e){return typeof e==`object`&&!Array.isArray(e)}function Ta(e,t,n,r){return e==null?[]:typeof e==`string`&&wa(t)?te(e,n,r):e instanceof NodeList?Array.from(e):Array.isArray(e)?e.filter(e=>e!=null):[e]}function Ea(e,t,n){return e*(t+1)+n*t}function Da(e,t,n,r){return typeof t==`number`?t:t.startsWith(`-`)||t.startsWith(`+`)?Math.max(0,e+parseFloat(t)):t===`<`?n:t.startsWith(`<`)?Math.max(0,n+parseFloat(t.slice(1))):r.get(t)??e}function Oa(e,t,n){for(let r=0;r<e.length;r++){let i=e[r];i.at>t&&i.at<n&&(xe(e,i),r--)}}function ka(e,t,n,r,i,a){Oa(e,i,a);for(let o=0;o<t.length;o++)e.push({value:t[o],at:fe(i,a,r[o]),easing:la(n,o)})}function Aa(e,t,n=0){let r=t+1+t*n;for(let t=0;t<e.length;t++)e[t]=e[t]/r}function ja(e,t){return e.at===t.at?e.value===null?1:t.value===null?-1:0:e.at-t.at}var Ma=`easeInOut`,Na=20;function Pa(e,{defaultTransition:t={},...n}={},r,i){let a=t.duration||.3,o=new Map,s=new Map,c={},l=new Map,u=0,d=0,f=0;for(let n=0;n<e.length;n++){let o=e[n];if(typeof o==`string`){l.set(o,d);continue}if(!Array.isArray(o)){l.set(o.name,Da(d,o.at,u,l));continue}let[p,m,h={}]=o;h.at!==void 0&&(d=Da(d,h.at,u,l));let g=0,_=(e,n,r,o=0,s=0)=>{let c=La(e),{delay:l=0,times:u=ne(c),type:p=t.type||`keyframes`,repeat:m,repeatType:h,repeatDelay:_=0,...v}=n,{ease:y=t.ease||`easeOut`,duration:b}=n,x=typeof l==`function`?l(o,s):l,S=c.length,C=le(p)?p:i?.[p||`keyframes`];if(S<=2&&C){let e=100;if(S===2&&Ba(c)){let t=c[1]-c[0];e=Math.abs(t)}let n={...t,...v};b!==void 0&&(n.duration=be(b));let r=ue(n,e,C);y=r.ease,b=r.duration}b??=a;let w=d+x;u.length===1&&u[0]===0&&(u[1]=1);let T=u.length-c.length;if(T>0&&Se(u,T),c.length===1&&c.unshift(null),m&&pe(m<Na,`Sequence segments can't repeat ${m} times — ignoring repeat option. Use a value below ${Na} or apply repeat at the sequence level instead.`),m&&m<Na){let e=b>0?_/b:0;b=Ea(b,m,_);let t=[...c],n=[...u];y=Array.isArray(y)?[...y]:[y];let r=[...y],i=h===`reverse`||h===`mirror`,a=t,o=r;i&&(a=[...t].reverse(),h===`reverse`&&(o=[...r].reverse().map(e=>typeof e==`function`?we(e):e)));for(let s=0;s<m;s++){let l=i&&s%2==0,d=l?a:t,f=l?o:r,p=(s+1)*(1+e);e>0&&(c.push(c[c.length-1]),u.push(p),y.push(`linear`)),c.push(...d);for(let e=0;e<d.length;e++)u.push(n[e]+p),y.push(e===0?`linear`:la(f,e-1))}Aa(u,m,e)}let E=w+b;ka(r,c,y,u,w,E),g=Math.max(x+b,g),f=Math.max(E,f)};if(Ee(p)){let e=Fa(p,s);_(m,h,Ia(`default`,e))}else{let e=Ta(p,m,r,c),t=e.length;for(let n=0;n<t;n++){m=m,h=h;let r=e[n],i=Fa(r,s);for(let e in m)_(m[e],Ra(h,e),Ia(e,i),n,t)}}u=d,d+=g}return s.forEach((e,r)=>{for(let i in e){let a=e[i];a.sort(ja);let s=[],c=[],l=[];for(let e=0;e<a.length;e++){let{at:t,value:n,easing:r}=a[e];s.push(n),c.push(Ce(0,f,t)),l.push(r||`easeOut`)}c[0]!==0&&(c.unshift(0),s.unshift(s[0]),l.unshift(Ma)),c[c.length-1]!==1&&(c.push(1),s.push(null)),o.has(r)||o.set(r,{keyframes:{},transition:{}});let u=o.get(r);u.keyframes[i]=s;let{type:d,...p}=t;u.transition[i]={...p,duration:f,ease:l,times:c,...n}}}),o}function Fa(e,t){return!t.has(e)&&t.set(e,{}),t.get(e)}function Ia(e,t){return t[e]||(t[e]=[]),t[e]}function La(e){return Array.isArray(e)?e:[e]}function Ra(e,t){return e&&e[t]?{...e,...e[t]}:{...e}}var za=e=>typeof e==`number`,Ba=e=>e.every(za);function Va(e){let t={presenceContext:null,props:{},visualState:{renderState:{transform:{},transformOrigin:{},style:{},vars:{},attrs:{}},latestValues:{}}},n=oe(e)&&!ae(e)?new ge(t):new Te(t);n.mount(e),ve.set(e,n)}function Ha(e){let t=new ma({presenceContext:null,props:{},visualState:{renderState:{output:{}},latestValues:{}}});t.mount(e),ve.set(e,t)}function Ua(e,t){return Ee(e)||typeof e==`number`||typeof e==`string`&&!wa(t)}function Wa(e,t,n,r){let i=[];if(Ua(e,t))i.push(ye(e,wa(t)&&t.default||t,n&&(n.default||n)));else{if(e==null)return i;let a=Ta(e,t,r),o=a.length;_e(!!o,`No valid elements provided.`,`no-valid-elements`);for(let e=0;e<o;e++){let r=a[e],s=r instanceof Element?Va:Ha;ve.has(r)||s(r);let c=ve.get(r),l={...n};`delay`in l&&typeof l.delay==`function`&&(l.delay=l.delay(e,o)),i.push(...re(c,{...t,transition:l},{}))}}return i}function Ga(e,t,n){let r=[];return Pa(e.map(e=>{if(Array.isArray(e)&&typeof e[0]==`function`){let t=e[0],n=se(0);return n.on(`change`,t),e.length===1?[n,[0,1]]:e.length===2?[n,[0,1],e[1]]:[n,e[1],e[2]]}return e}),t,n,{spring:de}).forEach(({keyframes:e,transition:t},n)=>{r.push(...Wa(n,e,t))}),r}function Ka(e){return Array.isArray(e)&&e.some(Array.isArray)}function qa(e={}){let{scope:t,reduceMotion:n,skipAnimations:r}=e;function i(e,i,a){let o=[],s,c={};if(n!==void 0&&(c.reduceMotion=n),r!==void 0&&(c.skipAnimations=r),Ka(e)){let{onComplete:n,...r}=i||{};typeof n==`function`&&(s=n),o=Ga(e,{...c,...r},t)}else{let{onComplete:n,...r}=a||{};typeof n==`function`&&(s=n),o=Wa(e,i,{...c,...r},t)}let l=new fa(o);return s&&l.finished.then(s),t&&(t.animations.push(l),l.finished.then(()=>{xe(t.animations,l)})),l}return i}var Ja=qa(),Ya=Ln(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),Xa=Ln(`bookmark`,[[`path`,{d:`M17 3a2 2 0 0 1 2 2v15a1 1 0 0 1-1.496.868l-4.512-2.578a2 2 0 0 0-1.984 0l-4.512 2.578A1 1 0 0 1 5 20V5a2 2 0 0 1 2-2z`,key:`oz39mx`}]]),Za=Ln(`chevrons-up-down`,[[`path`,{d:`m7 15 5 5 5-5`,key:`1hf1tw`}],[`path`,{d:`m7 9 5-5 5 5`,key:`sgt6xg`}]]),Qa=Ln(`circle-question-mark`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),$a=Ln(`circle-stop`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`rect`,{x:`9`,y:`9`,width:`6`,height:`6`,rx:`1`,key:`1ssd4o`}]]),eo=Ln(`clock-3`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6h4`,key:`135r8i`}]]),to=Ln(`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`}]]),no=Ln(`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`}]]),ro=Ln(`file-plus-corner`,[[`path`,{d:`M11.35 22H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v5.35`,key:`17jvcc`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M14 19h6`,key:`bvotb8`}],[`path`,{d:`M17 16v6`,key:`18yu1i`}]]),io=Ln(`folder-plus`,[[`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`}]]),ao=Ln(`folder-tree`,[[`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`}]]),oo=Ln(`list-restart`,[[`path`,{d:`M21 5H3`,key:`1fi0y6`}],[`path`,{d:`M7 12H3`,key:`13ou7f`}],[`path`,{d:`M7 19H3`,key:`wbqt3n`}],[`path`,{d:`M12 18a5 5 0 0 0 9-3 4.5 4.5 0 0 0-4.5-4.5c-1.33 0-2.54.54-3.41 1.41L11 14`,key:`qth677`}],[`path`,{d:`M11 10v4h4`,key:`172dkj`}]]),so=Ln(`message-square-plus`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}],[`path`,{d:`M12 8v6`,key:`1ib9pf`}],[`path`,{d:`M9 11h6`,key:`1fldmi`}]]),co=Ln(`message-square-text`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}],[`path`,{d:`M7 11h10`,key:`1twpyw`}],[`path`,{d:`M7 15h6`,key:`d9of3u`}],[`path`,{d:`M7 7h8`,key:`af5zfr`}]]),lo=Ln(`panel-right`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}]]),uo=Ln(`pin`,[[`path`,{d:`M12 17v5`,key:`bb1du9`}],[`path`,{d:`M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z`,key:`1nkz8b`}]]),fo=Ln(`settings-2`,[[`path`,{d:`M14 17H5`,key:`gfn3mx`}],[`path`,{d:`M19 7h-9`,key:`6i9tg`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}],[`circle`,{cx:`7`,cy:`7`,r:`3`,key:`dfmy0x`}]]),po=Ln(`square-pen`,[[`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`}]]),mo=Ln(`thumbs-down`,[[`path`,{d:`M9 18.12 10 14H4.17a2 2 0 0 1-1.92-2.56l2.33-8A2 2 0 0 1 6.5 2H20a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2.76a2 2 0 0 0-1.79 1.11L12 22a3.13 3.13 0 0 1-3-3.88Z`,key:`m61m77`}],[`path`,{d:`M17 14V2`,key:`8ymqnk`}]]),ho=Ln(`thumbs-up`,[[`path`,{d:`M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z`,key:`emmmcr`}],[`path`,{d:`M7 10v12`,key:`1qc93n`}]]),go=Ln(`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`}]]);function _o(e){return`agent-tab-${encodeURIComponent(e)}`}function vo(e){return`agent-tab-panel-${encodeURIComponent(e)}`}function yo(e){switch(e){case`queued`:return`queued`;case`running`:case`recovering`:return`streaming`;case`error`:case`failed`:return`error`;case`cancelled`:return`cancelled`;case`done`:return`complete`;default:return`ready`}}function bo(e){switch(e){case`running`:case`recovering`:return`bg-emerald-400 motion-safe:animate-pulse`;case`error`:case`failed`:return`bg-destructive`;case`queued`:return`bg-amber-300`;case`cancelled`:return`bg-foreground/35`;default:return`bg-foreground/35`}}function xo({tabs:e,value:t,onValueChange:n,onClose:r,onNewSession:i}){let a=(0,Z.useRef)(new Map),o=(0,Z.useCallback)((e,t)=>{t?a.current.set(e,t):a.current.delete(e)},[]);(0,Z.useEffect)(()=>{for(let t of a.current.keys())e.some(e=>e.id===t)||a.current.delete(t)},[e]);let s=(0,Z.useCallback)(t=>{let r=e[t];r&&(a.current.get(r.id)?.focus(),n(r.id))},[n,e]),c=(0,Z.useCallback)((t,n)=>{let r=e.findIndex(e=>e.id===n);if(r<0)return;let i;t.key===`ArrowRight`&&(i=(r+1)%e.length),t.key===`ArrowLeft`&&(i=(r-1+e.length)%e.length),t.key===`Home`&&(i=0),t.key===`End`&&(i=e.length-1),i!==void 0&&(t.preventDefault(),s(i))},[s,e]);return(0,Q.jsxs)(`div`,{className:`flex min-w-0 max-w-full items-center gap-1`,"data-testid":`agent-tab-bar`,children:[(0,Q.jsx)(`div`,{"aria-label":`Agent conversations`,className:`flex min-w-0 flex-1 items-center gap-1 overflow-x-auto overscroll-contain [scrollbar-width:none] [&::-webkit-scrollbar]:hidden`,role:`tablist`,children:e.map(e=>{let i=e.id===t,a=yo(e.status);return(0,Q.jsxs)(`div`,{className:`group/tab relative min-w-0 shrink-0 basis-[164px] sm:max-w-[164px]`,"data-tab-id":e.id,children:[(0,Q.jsxs)(V,{ref:t=>o(e.id,t),"aria-controls":vo(e.id),"aria-selected":i,"aria-label":`${e.label}, ${a}`,className:q(`h-7 w-full min-w-0 justify-start gap-1.5 rounded-[7px] border border-transparent px-2 text-[12px] font-medium leading-none transition-colors motion-reduce:transition-none`,i?`bg-[#2c2c2c] text-foreground shadow-none`:`bg-transparent text-foreground/45 hover:bg-foreground/5 hover:text-foreground/75`,e.kind===`subagent`&&`pr-7`),"data-state":i?`active`:`inactive`,id:_o(e.id),onClick:()=>n(e.id),onKeyDown:t=>c(t,e.id),role:`tab`,size:`sm`,tabIndex:i?0:-1,type:`button`,variant:`ghost`,children:[e.kind===`main`?(0,Q.jsx)(Xn,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}):(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:q(`size-1.5 shrink-0 rounded-full`,bo(e.status))}),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.label})]}),e.kind===`subagent`&&r?(0,Q.jsx)(V,{"aria-label":`Close ${e.label} tab`,className:`absolute top-1/2 right-1 size-5 -translate-y-1/2 rounded-[5px] p-0 text-foreground/35 opacity-0 transition-opacity motion-reduce:transition-none hover:bg-foreground/10 hover:text-foreground/75 focus-visible:opacity-100 group-hover/tab:opacity-100`,onClick:t=>{t.stopPropagation(),r(e.id)},size:`icon-xs`,title:`Close ${e.label} tab`,type:`button`,variant:`ghost`,children:(0,Q.jsx)(Wr,{"aria-hidden":`true`,className:`size-3`})}):null]},e.id)})}),i?(0,Q.jsx)(V,{"aria-label":`New chat`,className:`size-7 shrink-0 rounded-[7px] text-foreground/50 hover:bg-foreground/7 hover:text-foreground/85`,"data-testid":`new-chat-tab`,onClick:i,size:`icon-sm`,title:`New chat`,type:`button`,variant:`ghost`,children:(0,Q.jsx)(Lr,{"aria-hidden":`true`,className:`size-3.5`})}):null]})}function So({children:e,dataTestid:t,headerLeading:n,loading:r,onClose:i,onRefresh:a,onResizeStart:o,open:s,headerActions:c,title:l,titleIcon:u,width:d}){let f=Ge(),p=(0,Z.useRef)(null);return(0,Z.useEffect)(()=>{s&&p.current?.focus({preventScroll:!0})},[s]),(0,Q.jsx)(y,{features:_,children:(0,Q.jsx)(We,{children:s&&(0,Q.jsxs)(K.aside,{ref:p,initial:!f&&{x:d,opacity:.8},animate:{x:0,opacity:1},exit:f?{opacity:0}:{x:d,opacity:.8},transition:f?{duration:0}:{duration:.2,ease:`easeInOut`},className:`relative h-full shrink-0 border-l border-border/70 bg-background/95 outline-none hidden min-[960px]:flex`,"data-fleet-panel-focus":!0,"data-testid":t,style:{width:d},tabIndex:-1,role:`dialog`,"aria-label":l,onKeyDown:e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),i())},children:[(0,Q.jsx)(`button`,{type:`button`,"aria-label":`Resize ${l} panel`,className:`absolute top-0 bottom-0 left-0 z-10 w-2 -translate-x-1 cursor-col-resize touch-none bg-transparent transition-colors outline-none hover:bg-foreground/10 focus-visible:bg-foreground/10`,"data-testid":`pi-resources-resize-handle`,onPointerDown:o}),(0,Q.jsxs)(`div`,{className:`flex h-full min-w-0 flex-1 flex-col overflow-hidden`,children:[(0,Q.jsxs)(`div`,{className:`flex h-[60px] min-w-0 shrink-0 items-center justify-between gap-2 border-b border-border/60 px-3 py-1`,children:[(0,Q.jsx)(`div`,{className:`min-w-0 flex-1`,children:n??(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 text-[13px] font-medium text-foreground/80`,children:[(0,Q.jsx)(u,{className:`size-3.5 shrink-0`}),(0,Q.jsx)(`span`,{children:l})]})}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[c,(0,Q.jsx)(V,{type:`button`,onClick:a,disabled:!a,variant:`ghost`,size:`icon-sm`,className:`relative after:absolute after:inset-x-0 after:-top-1.5 after:-bottom-1.5 text-foreground/40 hover:text-foreground/70 disabled:cursor-not-allowed disabled:opacity-35`,"aria-label":`Refresh ${l}`,title:`Refresh ${l}`,children:(0,Q.jsx)(Rr,{"data-icon":`inline-start`,className:`size-3.5 ${r?`animate-spin`:``}`})}),(0,Q.jsx)(V,{type:`button`,onClick:i,variant:`ghost`,size:`icon-sm`,className:`relative after:absolute after:inset-x-0 after:-top-1.5 after:-bottom-1.5 text-foreground/40 hover:text-foreground/70`,"aria-label":`Close panel`,title:`Close panel`,children:(0,Q.jsx)(Wr,{"data-icon":`inline-start`,className:`size-3.5`})})]})]}),(0,Q.jsx)(`div`,{className:`flex-1 overflow-y-auto px-3 py-2`,children:e})]})]})})})}var Co=Z.createContext(void 0);function wo(){let e=Z.useContext(Co);if(e===void 0)throw Error(rt(64));return e}var To={tabActivationDirection:e=>({"data-activation-direction":e})},Eo=Z.forwardRef(function(e,t){let{className:n,defaultValue:r=0,onValueChange:i,orientation:a=`horizontal`,render:o,value:s,style:c,...l}=e,u=e.defaultValue!==void 0,d=Z.useRef([]),[f,p]=Z.useState(()=>new Map),[m,h]=Jr({controlled:s,default:r,name:`Tabs`,state:`value`}),g=s!==void 0,[_,v]=Z.useState(()=>new Map),y=Z.useRef(void 0),b=Z.useCallback(e=>Do(_,e),[_]),[x,S]=Z.useState(()=>({previousValue:m,tabActivationDirection:`none`})),{previousValue:C,tabActivationDirection:w}=x,T=w,E=!1;C!==m&&(T=Oo(C,m,a,_),E=C!=null&&m!=null&&b(m)==null);let D=E?C:m,O=C!==D||w!==T;ot(()=>{O&&S({previousValue:D,tabActivationDirection:T})},[D,O,T]);let k=Qe((e,t)=>{t.activationDirection=Oo(m,e,a,_),i?.(e,t),!t.isCanceled&&h(e)}),A=Qe((e,t)=>{i?.(e,lt(t,void 0,void 0,{activationDirection:`none`}))}),j=Qe((e,t)=>(p(n=>{let r=new Map(n);return r.set(e,t),r}),()=>{p(n=>{if(n.get(e)!==t)return n;let r=new Map(n);return r.delete(e),r})})),M=Z.useCallback(e=>f.get(e),[f]),N=Z.useCallback(e=>{for(let t of _.values())if(e===t.value)return t.id},[_]),P=Z.useMemo(()=>({getTabElementBySelectedValue:b,getTabIdByPanelValue:N,getTabPanelIdByValue:M,onValueChange:k,orientation:a,registerMountedTabPanel:j,setTabMap:v,tabActivationDirection:T,value:m}),[b,N,M,k,a,j,v,T,m]),F=Z.useMemo(()=>{for(let e of _.values())if(e.value===m)return e},[_,m]),I=Z.useMemo(()=>{for(let e of _.values())if(!e.disabled)return e.value},[_]),L=Z.useRef(!u),R=Z.useRef(r),z=Z.useRef(u),B=Z.useRef(!1);ot(()=>{if(g)return;function e(e,t){h(e),S({previousValue:e,tabActivationDirection:`none`}),A(e,t),L.current=!1}if(_.size===0){B.current&&m!==null&&!y.current?.isConnected&&e(null,Ze);return}B.current=!0,y.current=_.keys().next().value;let t=F?.disabled,n=F==null&&m!==null;if(!t&&m===R.current&&(z.current=!1),z.current&&t&&m===R.current)return;let r=L.current;if(t||n){let n=I??null;if(m===n){L.current=!1;return}let i=Ze;r?i=Xe:t&&(i=tt),e(n,i);return}r&&F!=null&&(A(m,Xe),L.current=!1)},[I,g,A,F,h,_,m]);let V=Je(`div`,e,{state:{orientation:a,tabActivationDirection:T},ref:t,props:l,stateAttributesMapping:To});return(0,Q.jsx)(Co.Provider,{value:P,children:(0,Q.jsx)(en,{elementsRef:d,children:V})})});function Do(e,t){for(let[n,r]of e.entries())if(t===r.value)return n;return null}function Oo(e,t,n,r){if(e==null||t==null)return`none`;let[i,a,o]=n===`horizontal`?[`left`,`left`,`right`]:[`top`,`up`,`down`],s=Do(r,e),c=Do(r,t);if(s==null||c==null)return s!==c&&(typeof e==`number`||typeof e==`string`)&&typeof e==typeof t?t>e?o:a:`none`;let l=s.getBoundingClientRect()[i],u=c.getBoundingClientRect()[i];return u<l?a:u>l?o:`none`}var ko=`data-composite-item-active`;function Ao(e={}){let{highlightItemOnHover:t,highlightedIndex:n,onHighlightedIndexChange:r}=ft(),{ref:i,index:a}=an(e),o=n===a,s=Z.useRef(null),c=nt(i,s);return{compositeProps:{tabIndex:o?0:-1,onFocus(){r(a)},onMouseMove(){let e=s.current;if(!t||!e)return;let n=e.hasAttribute(`disabled`)||e.ariaDisabled===`true`;!o&&!n&&e.focus()}},compositeRef:c,index:a}}var jo=Z.createContext(void 0);function Mo(){let e=Z.useContext(jo);if(e===void 0)throw Error(rt(65));return e}var No=Z.forwardRef(function(e,t){let{className:n,disabled:r=!1,render:i,value:a,id:o,nativeButton:s=!0,style:c,...l}=e,{value:u,getTabPanelIdByValue:d,onValueChange:f,orientation:p,tabActivationDirection:m}=wo(),{activateOnFocus:h,registerTabResizeObserverElement:g,tabsListElement:_}=Mo(),{highlightedIndex:v,onHighlightedIndexChange:y}=ft(),b=pn(o),{compositeProps:x,compositeRef:S,index:C}=Ao({metadata:Z.useMemo(()=>({disabled:r,id:b,value:a}),[r,b,a])}),T=a===u,E=Z.useRef(!1),D=Z.useRef(null),O=Qe(e=>{D.current?.(),D.current=e?g(e):null});ot(()=>{if(E.current){E.current=!1;return}if(!(T&&C>-1&&v!==C))return;let e=_;if(e!=null){let t=W(N(e));if(t&&w(e,t))return}r||y(C)},[T,C,v,y,r,_]);let{getButtonProps:k,buttonRef:A}=ut({disabled:r,native:s,focusableWhenDisabled:!0}),j=d(a),M=Z.useRef(!1),P=Z.useRef(!1);function F(e){f(a,lt($e,e.nativeEvent,void 0,{activationDirection:`none`}))}function I(e){T||r||F(e)}function L(e){T||r||h&&(!M.current||P.current)&&F(e)}function R(e){if(T||r)return;M.current=!0,P.current=e.button===0;let t=N(e.currentTarget);function n(){M.current=!1,P.current=!1,t.removeEventListener(`pointerup`,n),t.removeEventListener(`pointercancel`,n)}t.addEventListener(`pointerup`,n),t.addEventListener(`pointercancel`,n)}return Je(`button`,e,{state:{disabled:r,active:T,orientation:p,tabActivationDirection:m},ref:[t,A,S,O],props:[x,{role:`tab`,"aria-controls":j,"aria-selected":T,id:b,onClick:I,onFocus:L,onPointerDown:R,[ko]:T?``:void 0,onKeyDownCapture(){E.current=!0}},l,k],stateAttributesMapping:To})}),Po=[];function Fo(e){let{loopFocus:t=!0,orientation:n=`both`,grid:r,onLoop:i,direction:a,highlightedIndex:o,onHighlightedIndexChange:s,rootRef:c,enableHomeAndEndKeys:l=!1,stopEventPropagation:u,disabledIndices:d,modifierKeys:f=Po}=e,[p,m]=Z.useState(0),h=r!=null,g=Z.useRef(null),_=nt(g,c),v=Z.useRef([]),y=Z.useRef(!1),b=o??p,x=Qe((e,t=!1)=>{if((s??m)(e),t){let t=v.current[e];Ot(g.current,t,a,n)}}),S=Qe(e=>{if(e.size===0||y.current)return;y.current=!0;let t=Array.from(e.keys()),r=t.find(e=>e?.hasAttribute(`data-composite-item-active`))??null,i=r?e.get(r)?.index??-1:-1;if(i!==-1)x(i);else if(C(t,b,d)){let e=k(t,{disabledIndices:d});F(t,e)||x(e)}Ot(g.current,r,a,n)});ot(()=>{if(d==null||o!=null||!y.current)return;let e=v.current;if(C(e,b,d)){let t=k(e,{disabledIndices:d});F(e,t)||x(t)}},[d,o,b,v,x]);let w=Qe((e,t,n)=>i?i(e,t,n,v):n),D=Qe(e=>{let o=e.key===`Home`||e.key===`End`;if(!Zt.has(e.key)||!l&&o||Io(e,f)||!g.current)return;let s=a===`rtl`,c=s?Qt:Mt,p=s?Mt:Qt,m=n===`vertical`?Bt:c,_=n===`vertical`?gt:p,y=A(e.nativeEvent);if(y!=null&&_t(y)&&!sn(y)){let t=y.selectionStart,n=y.selectionEnd,r=y.value;if(t==null||e.shiftKey||t!==n||e.key!==_&&t<r.length||e.key!==m&&t>0)return}let S=b,C=T(v,d),D=E(v,d);r!=null&&(S=r({disabledIndices:d,elementsRef:v,event:e,highlightedIndex:b,loopFocus:t,maxIndex:D,minIndex:C,onLoop:w,orientation:n,rtl:s}));let O=n!==`vertical`&&e.key===c||n!==`horizontal`&&e.key===`ArrowDown`,j=n!==`vertical`&&e.key===p||n!==`horizontal`&&e.key===`ArrowUp`;l&&(e.key===`Home`?S=C:e.key===`End`&&(S=D)),S===b&&(O||j)&&(t&&S===D&&O?(S=C,i&&(S=i(e,b,S,v))):t&&S===C&&j?(S=D,i&&(S=i(e,b,S,v))):S=k(v.current,{startingIndex:S,decrement:j,disabledIndices:d})),S!==b&&!F(v.current,S)&&(u&&e.stopPropagation(),(h||o||O||j)&&e.preventDefault(),x(S,!0),queueMicrotask(()=>{v.current[S]?.focus()}))});return{props:{ref:_,onFocus(e){let t=g.current,n=A(e.nativeEvent);!t||n==null||!_t(n)||n.setSelectionRange(0,n.value.length)},onKeyDown:D},highlightedIndex:b,onHighlightedIndexChange:x,elementsRef:v,onMapChange:S,relayKeyboardEvent:D}}function Io(e,t){for(let n of vt)if(!t.includes(n)&&e.getModifierState(n))return!0;return!1}function Lo(e){let{render:t,className:n,style:r,refs:i=at,props:a=at,state:o=ct,stateAttributesMapping:s,highlightedIndex:c,onHighlightedIndexChange:l,orientation:u,grid:d,loopFocus:f,onLoop:p,enableHomeAndEndKeys:m,onMapChange:h,stopEventPropagation:g=!0,rootRef:_,disabledIndices:v,modifierKeys:y,highlightItemOnHover:b=!1,tag:x=`div`,...S}=e,{props:C,highlightedIndex:w,onHighlightedIndexChange:T,elementsRef:E,onMapChange:D,relayKeyboardEvent:O}=Fo({grid:d,loopFocus:f,onLoop:p,orientation:u,highlightedIndex:c,onHighlightedIndexChange:l,rootRef:_,stopEventPropagation:g,enableHomeAndEndKeys:m,direction:dn(),disabledIndices:v,modifierKeys:y}),k=Je(x,e,{state:o,ref:i,props:[C,...a,S],stateAttributesMapping:s}),A=Z.useMemo(()=>({highlightedIndex:w,onHighlightedIndexChange:T,highlightItemOnHover:b,relayKeyboardEvent:O}),[w,T,b,O]);return(0,Q.jsx)(Ye.Provider,{value:A,children:(0,Q.jsx)(en,{elementsRef:E,onMapChange:e=>{h?.(e),D(e)},children:k})})}var Ro=Z.forwardRef(function(e,t){let{activateOnFocus:n=!1,className:r,loopFocus:i=!0,render:a,style:o,...s}=e,{orientation:c,setTabMap:l,tabActivationDirection:u}=wo(),[d,f]=Z.useState(0),[p,m]=Z.useState(null),h=Z.useRef(new Set),g=Z.useRef(new Set),_=Z.useRef(null);ot(()=>{if(typeof ResizeObserver>`u`)return;let e=new ResizeObserver(()=>{h.current.forEach(e=>{e()})});return _.current=e,p&&e.observe(p),g.current.forEach(t=>{e.observe(t)}),()=>{e.disconnect(),_.current=null}},[p]);let v=Qe(e=>(h.current.add(e),()=>{h.current.delete(e)})),y=Qe(e=>(g.current.add(e),_.current?.observe(e),()=>{g.current.delete(e),_.current?.unobserve(e)})),b={orientation:c,tabActivationDirection:u},x={"aria-orientation":c===`vertical`?`vertical`:void 0,role:`tablist`},S=Z.useMemo(()=>({activateOnFocus:n,registerIndicatorUpdateListener:v,registerTabResizeObserverElement:y,tabsListElement:p}),[n,v,y,p]);return(0,Q.jsx)(jo.Provider,{value:S,children:(0,Q.jsx)(Lo,{render:a,className:r,style:o,state:b,refs:[t,m],props:[x,s],stateAttributesMapping:To,highlightedIndex:d,enableHomeAndEndKeys:!0,loopFocus:i,orientation:c,onHighlightedIndexChange:f,onMapChange:l,disabledIndices:at})})});function zo({className:e,orientation:t=`horizontal`,...n}){return(0,Q.jsx)(Eo,{"data-slot":`tabs`,"data-orientation":t,className:q(`group/tabs flex gap-2 data-horizontal:flex-col`,e),...n})}var Bo=L(`group/tabs-list inline-flex w-fit items-center justify-center rounded-lg p-[3px] text-muted-foreground group-data-horizontal/tabs:h-8 group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col data-[variant=line]:rounded-none`,{variants:{variant:{default:`bg-muted`,line:`gap-1 bg-transparent`}},defaultVariants:{variant:`default`}});function Vo({className:e,variant:t=`default`,...n}){return(0,Q.jsx)(Ro,{"data-slot":`tabs-list`,"data-variant":t,className:q(Bo({variant:t}),e),...n})}function Ho({className:e,...t}){return(0,Q.jsx)(No,{"data-slot":`tabs-trigger`,className:q(`relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-sm font-medium whitespace-nowrap text-foreground/60 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 aria-disabled:pointer-events-none aria-disabled:opacity-50 dark:text-muted-foreground dark:hover:text-foreground group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,`group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent`,`data-active:bg-background data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 dark:data-active:text-foreground`,`after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-right-1 group-data-vertical/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100`,e),...t})}function Uo(e,t={}){let{axis:n=`y`}=t,r=(0,Z.useRef)(new Map),i=(0,Z.useRef)(new Map),[a,o]=(0,Z.useState)(null),[s,c]=(0,Z.useState)([]),l=(0,Z.useRef)([]),u=(0,Z.useRef)(null),d=(0,Z.useRef)(null),f=(0,Z.useCallback)(()=>{if(!e.current)return;let t=[];r.current.forEach((e,n)=>{t[n]={top:e.offsetTop,height:e.offsetHeight,left:e.offsetLeft,width:e.offsetWidth}});let n=l.current,i=n.length!==t.length;for(let e=0;!i&&e<t.length;e++){let r=n[e],a=t[e];r!==a&&(i=!r||!a||r.top!==a.top||r.left!==a.left||r.width!==a.width||r.height!==a.height)}i&&(l.current=t,c(t))},[e]),p=(0,Z.useCallback)(()=>{d.current!==null&&cancelAnimationFrame(d.current),d.current=requestAnimationFrame(()=>{d.current=null,f()})},[f]),m=(0,Z.useCallback)((e,t)=>{let n=i.current.get(e);if(n&&(n.disconnect(),i.current.delete(e)),t){if(r.current.set(e,t),typeof ResizeObserver<`u`){let n=new ResizeObserver(()=>p());n.observe(t),i.current.set(e,n)}}else r.current.delete(e);p()},[p]),h=(0,Z.useCallback)(t=>{let r=t.clientX,i=t.clientY;u.current!==null&&cancelAnimationFrame(u.current),u.current=requestAnimationFrame(()=>{u.current=null;let t=e.current;if(!t)return;let a=t.getBoundingClientRect(),s=n===`x`?r:i,c=null,d=1/0,f=null,p=l.current,m=n===`x`?t.scrollLeft:t.scrollTop,h=n===`x`?t.clientLeft:t.clientTop,g=n===`x`?a.left:a.top,_=n===`x`?t.offsetWidth:t.offsetHeight,v=n===`x`?a.width:a.height,y=_>0?v/_:1;for(let e=0;e<p.length;e++){let t=p[e];if(!t)continue;let r=g+(h+(n===`x`?t.left:t.top)-m)*y,i=(n===`x`?t.width:t.height)*y,a=r+i;s>=r&&s<=a&&(f=e);let o=r+i/2,l=Math.abs(s-o);l<d&&(d=l,c=e)}o(f??c)})},[n,e]),g=(0,Z.useCallback)(()=>{u.current!==null&&(cancelAnimationFrame(u.current),u.current=null),o(null)},[]);return(0,Z.useEffect)(()=>{let t=e.current;if(!t||typeof ResizeObserver>`u`)return;let n=new ResizeObserver(()=>p());return n.observe(t),()=>n.disconnect()},[e,p]),(0,Z.useEffect)(()=>()=>{u.current!==null&&cancelAnimationFrame(u.current),d.current!==null&&cancelAnimationFrame(d.current),i.current.forEach(e=>{e.disconnect()}),i.current.clear()},[]),{activeIndex:a,setActiveIndex:o,itemRects:s,onMouseMove:h,onMouseLeave:g,registerItem:m,measureItems:f}}var Wo={normal:`'wght' 400, 'opsz' 14`,medium:`'wght' 450, 'opsz' 15`,semibold:`'wght' 550, 'opsz' 20`,bold:`'wght' 700, 'opsz' 25`},Go={fast:{enter:{type:`spring`,duration:.08,bounce:0},exit:{duration:.06}},moderate:{enter:{type:`spring`,duration:.16,bounce:0},exit:{duration:.12}},slow:{enter:{type:`spring`,duration:.24,bounce:.12},exit:{duration:.16}}},Ko=`bg-background shadow-sm`,qo=`rounded-full border border-border/70 bg-sidebar p-0.5 shadow-sm backdrop-blur`,Jo=`rounded-full`;function Yo(e,t){return t?e?`text-foreground/75`:`text-foreground`:e?`text-foreground/55`:`text-muted-foreground`}var Xo=(0,Z.createContext)(null);function Zo(){let e=(0,Z.useContext)(Xo);if(!e)throw Error(`useTabsSubtle must be used within a TabsSubtle`);return e}function Qo({selectedRect:e,hoverRect:t,focusRect:n,isHovering:r,isHoveringSelected:i}){let a=Ge()?{duration:0}:void 0;return(0,Q.jsxs)(y,{features:_,children:[e?(0,Q.jsx)(K.div,{className:q(`pointer-events-none absolute`,Ko,Jo),layout:!0,initial:!1,style:{left:e.left,top:e.top,width:e.width,height:e.height},animate:{opacity:r?.8:1},transition:a??{...Go.moderate.enter,opacity:{duration:.08}}}):null,(0,Q.jsx)(We,{children:t&&!i?(0,Q.jsx)(K.div,{className:q(`pointer-events-none absolute`,Ko,Jo),layout:!0,style:{left:t.left,top:t.top,width:t.width,height:t.height},initial:{opacity:0},animate:{opacity:.4},exit:{opacity:0,transition:a??Go.fast.exit},transition:a??{...Go.fast.enter,opacity:{duration:.08}}}):null}),(0,Q.jsx)(We,{children:n?(0,Q.jsx)(K.div,{className:q(`pointer-events-none absolute z-20 border border-ring`,Jo),layout:!0,initial:!1,style:{left:n.left-2,top:n.top-2,width:n.width+4,height:n.height+4},exit:{opacity:0,transition:a??Go.fast.exit},transition:a??{...Go.fast.enter,opacity:{duration:.08}}}):null})]})}var $o=(0,Z.forwardRef)(({children:e,selectedIndex:t,onSelect:n,idPrefix:r,activeLabel:i=!1,variant:a=`default`,className:o,...s},c)=>{let l=(0,Z.useRef)(null),u=(0,Z.useRef)(!1),d=a===`pill`,{activeIndex:f,setActiveIndex:p,itemRects:m,onMouseMove:h,onMouseLeave:g,registerItem:_}=Uo(l,{axis:`x`}),v=(0,Z.useCallback)((e,t)=>{_(e,t)},[_]),y=(0,Z.useCallback)(e=>{u.current=!0,h(e)},[h]),b=(0,Z.useCallback)(()=>{u.current=!1,g()},[g]),[x,S]=(0,Z.useState)(null),C=t>=0?m[t]:void 0,w=f===null?null:m[f],T=x===null?null:m[x],E=f===t,D=f!==null&&!E,O=(0,Z.useMemo)(()=>({registerTab:v,hoveredIndex:f,selectedIndex:t,idPrefix:r,activeLabel:i,variant:a,onSelect:n}),[v,f,t,r,i,a,n]);return(0,Q.jsx)(Xo.Provider,{value:O,children:(0,Q.jsx)(zo,{className:`data-horizontal:!flex-row !gap-0.5`,value:t>=0?t:null,onValueChange:e=>{let t=typeof e==`number`?e:Number(e);Number.isInteger(t)&&n(t)},render:(0,Q.jsxs)(Vo,{activateOnFocus:!1,variant:`line`,ref:e=>{l.current=e,typeof c==`function`?c(e):c&&(c.current=e)},onMouseMove:y,onMouseLeave:b,onFocus:e=>{let t=e.target.closest(`[data-proximity-index]`)?.getAttribute(`data-proximity-index`);if(t!=null){let n=Number(t);p(n),S(e.target.matches(`:focus-visible`)?n:null)}},onBlur:e=>{l.current?.contains(e.relatedTarget)||(S(null),!u.current&&p(null))},className:q(`relative flex max-w-full [scrollbar-width:none] items-center gap-0.5 overflow-x-auto select-none [-ms-overflow-style:none] [&::-webkit-scrollbar]:hidden`,d?qo:`-mx-1 -my-1 px-1 py-1`,o),...s,children:[(0,Q.jsx)(Qo,{selectedRect:C,hoverRect:w,focusRect:T,isHovering:D,isHoveringSelected:E}),e]})})})});$o.displayName=`TabsSubtle`;var es=(0,Z.forwardRef)(({icon:e,label:t,index:n,badge:r,className:i,"aria-label":a,onClick:o,...s},c)=>{let l=(0,Z.useRef)(null),{registerTab:u,hoveredIndex:d,selectedIndex:f,idPrefix:p,activeLabel:m,variant:h,onSelect:g}=Zo();(0,Z.useEffect)(()=>(u(n,l.current),()=>u(n,null)),[n,u]);let v=f===n,b=d===n||v,x=m&&!!e,S=!x||v,C=h===`pill`,w=Yo(C,b),T=a??(x&&!S?t:void 0),E=(0,Q.jsxs)(`span`,{className:q(`inline-grid whitespace-nowrap`,C?`text-[12px] font-medium`:`text-[13px]`),children:[(0,Q.jsx)(`span`,{className:`invisible col-start-1 row-start-1 [text-box:trim-both_cap_alphabetic]`,style:{fontVariationSettings:Wo.semibold},"aria-hidden":`true`,children:t}),(0,Q.jsx)(`span`,{className:q(`col-start-1 row-start-1 transition-[color,font-variation-settings] duration-80 [text-box:trim-both_cap_alphabetic]`,w),style:{fontVariationSettings:v?Wo.semibold:Wo.normal},children:t})]});return(0,Q.jsxs)(Ho,{ref:e=>{let t=e;l.current=t,typeof c==`function`?c(t):c&&(c.current=t)},value:n,"data-proximity-index":n,id:p?`${p}-tab-${n}`:void 0,"aria-controls":p?`${p}-panel-${n}`:void 0,"aria-label":T,className:q(`relative z-10 flex flex-none cursor-pointer items-center border-none !bg-transparent !shadow-none outline-none after:hidden`,C?`h-8 px-2.5`:x?`h-8 px-3`:`h-9 gap-2 px-3`,Jo,i),...s,onClick:e=>{o?.(e),v&&g(n)},children:[e?(0,Q.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1`,children:[(0,Q.jsx)(e,{"data-icon":`inline-start`,size:C?14:16,strokeWidth:b?2:1.5,className:q(`shrink-0 transition-[color,stroke-width] duration-80`,w)}),r===void 0?null:(0,Q.jsx)(`span`,{className:q(`text-[11px] tabular-nums transition-colors duration-80`,w),children:r})]}):null,x?null:E,(0,Q.jsx)(y,{features:_,children:(0,Q.jsx)(We,{initial:!1,children:x&&S?(0,Q.jsx)(K.span,{className:`ml-2 overflow-hidden`,initial:{clipPath:`inset(0 100% 0 0)`,opacity:0},animate:{clipPath:`inset(0 0% 0 0)`,opacity:1},exit:{clipPath:`inset(0 100% 0 0)`,opacity:0},transition:{...Go.fast.enter,opacity:{duration:.06}},children:E},`label`):null})})]})});es.displayName=`TabsSubtleItem`;var ts=(0,Z.forwardRef)(({index:e,selectedIndex:t,idPrefix:n,children:r,className:i,...a},o)=>{let s=t===e;return(0,Q.jsx)(`div`,{ref:o,id:`${n}-panel-${e}`,role:`tabpanel`,"aria-labelledby":`${n}-tab-${e}`,hidden:!s,tabIndex:-1,className:q(`outline-none`,i),...a,children:s?r:null})});ts.displayName=`TabsSubtlePanel`;function ns({active:e=!1,ariaLabel:t,className:n,title:r,...i}){return(0,Q.jsx)(V,{...i,type:`button`,variant:`ghost`,size:`sm`,className:q(On,e?jn:Tn,n),"aria-label":t,title:r??t})}var rs=`[&_[data-proximity-index]]:!h-7 [&_[data-proximity-index]]:!px-2 [&_[data-proximity-index]]:!text-[11px]`;function is({compact:e=!1}={}){let{reopenRightPanel:t,rightPanel:n}=Li();return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`min-[960px]:hidden`,children:(0,Q.jsx)(as,{compact:e,idPrefix:`right-panel-mobile`})}),(0,Q.jsx)(`div`,{className:`hidden min-[960px]:block`,children:n===null?(0,Q.jsx)(os,{compact:e,onOpen:t}):null})]})}function as({compact:e=!1,idPrefix:t=`right-panel`}){let{artifactRuns:n,messages:r,rightPanel:i,setRightPanel:a,resources:o}=Li(),{workspaceTree:s}=Ii();return(0,Q.jsx)(ss,{activePanel:i,onPanelChange:a,resources:o,replRuns:n.flatMap(e=>e.artifacts).filter(e=>e.kind===`ipython`).length,sessionBlocks:Bi(r).length,openUIArtifacts:n.flatMap(e=>e.artifacts).filter(e=>e.kind===`openui-html`).length,workspace:s,idPrefix:t,compact:e})}function os({compact:e=!1,onOpen:t}){return(0,Q.jsx)(ns,{ariaLabel:`Open side panel`,className:e?`!size-7 !rounded-[7px] !px-0`:`size-9 justify-center px-0`,onClick:t,children:(0,Q.jsx)(lo,{className:`size-4`})})}function ss({activePanel:e,onPanelChange:t,resources:n,replRuns:r=0,sessionBlocks:i=0,openUIArtifacts:a=0,workspace:o,idPrefix:s=`right-panel`,compact:c=!1}){let l=Yn(n,o).reduce((e,t)=>e+t.items.length,0),u=(0,Z.useMemo)(()=>{let e=i+a;return e>0?e:void 0},[a,i]),d=(0,Z.useMemo)(()=>Bn.map(e=>({...e,badge:e.badgeSource===`resources`?l||void 0:e.badgeSource===`artifacts`?u:e.badgeSource===`repl`&&r||void 0})),[r,u,l]),f=d.findIndex(t=>t.id===e),p=(0,Z.useMemo)(()=>d.map(e=>({value:e.id,label:e.title,icon:e.icon})),[d]);return(0,Q.jsx)(cs,{"data-testid":`right-panel-inline-launcher`,"data-active-panel":e??`closed`,activePanel:e,options:p,panelOptions:d,idPrefix:s,selectedIndex:f,onSelect:n=>{let r=d.at(n)?.id;r&&t(r===e?null:r)},compact:c})}function cs({activePanel:e,className:t,compact:n=!1,idPrefix:r,onSelect:i,options:a,panelOptions:o,selectedIndex:s,...c}){let l=(0,Z.useRef)(null),u=(0,Z.useRef)(null),[d,f]=(0,Z.useState)(!1),p=(0,Z.useCallback)(()=>{let e=l.current,t=u.current;if(!e||!t)return;let n=e.parentElement?.clientWidth??e.clientWidth,r=t.getBoundingClientRect().width;f(r>n+1)},[]);(0,Z.useLayoutEffect)(()=>{p();let e=l.current,t=u.current;if(!e||!t||typeof ResizeObserver>`u`)return;let n=new ResizeObserver(p);return e.parentElement&&n.observe(e.parentElement),n.observe(e),n.observe(t),()=>n.disconnect()},[p,o,s]);let m=(0,Z.useCallback)(e=>{let t=o.findIndex(t=>t.id===e);t>=0&&i(t)},[i,o]);return(0,Q.jsxs)(`div`,{ref:l,className:`relative ${d?`w-full`:`w-fit`} min-w-0 max-w-full overflow-hidden ${t??``}`,"data-panel-launcher-mode":d?`dropdown`:`tabs`,...c,children:[d?(0,Q.jsx)(cn,{"aria-label":`Select panel`,className:`w-full min-w-0 max-w-full rounded-full border-border/70 bg-sidebar ${n?`h-7`:``}`,onValueChange:m,options:a,placeholder:`Open panel`,value:e}):(0,Q.jsx)($o,{activeLabel:!0,className:`w-fit max-w-full ${n?rs:``}`,idPrefix:r,selectedIndex:s,onSelect:i,children:o.map((e,t)=>(0,Q.jsx)(es,{index:t,icon:e.icon,label:e.title,badge:e.badge,"aria-label":e.ariaLabel},e.id))}),(0,Q.jsx)(`div`,{ref:u,"aria-hidden":`true`,className:`pointer-events-none invisible absolute top-0 left-0 -z-10 h-0 w-max max-w-none overflow-hidden`,"data-panel-launcher-measurement":!0,inert:!0,children:(0,Q.jsx)($o,{activeLabel:!0,className:`w-max max-w-none ${n?rs:``}`,idPrefix:`${r}-measurement`,selectedIndex:s,onSelect:()=>void 0,children:o.map((e,t)=>(0,Q.jsx)(es,{index:t,icon:e.icon,label:e.title,badge:e.badge,"aria-label":e.ariaLabel},e.id))})})]})}function ls({children:e,dataTestid:t,headerActions:n,icon:r,onClose:i,open:a,title:o}){let s=(0,Z.useRef)(null),c=(0,Z.useId)(),l=(0,Z.useRef)(!1),u=(0,Z.useEffectEvent)(e=>{s.current&&e.target===s.current&&i?.()});return(0,Z.useEffect)(()=>{if(!a)return;let e=s.current;if(!e)return;let t=e=>u(e);return e.addEventListener(`click`,t),()=>e.removeEventListener(`click`,t)},[a]),(0,Z.useEffect)(()=>{let e=s.current;if(!e)return;if(!a){e.open&&(l.current=!0,e.close(),l.current=!1);return}let t=window.matchMedia(`(min-width: 960px)`),n=()=>{if(t.matches){e.open&&(l.current=!0,e.close());return}e.open||(e.showModal(),e.focus())};return n(),t.addEventListener(`change`,n),()=>t.removeEventListener(`change`,n)},[a]),a?(0,Q.jsx)(`dialog`,{ref:s,"data-testid":t,className:`fixed top-[var(--chat-chrome-top)] right-3 bottom-3 m-0 ${In} backdrop:bg-black/20 ${Er}`,"aria-labelledby":c,onClose:()=>{if(l.current){l.current=!1;return}i?.()},children:(0,Q.jsxs)(`div`,{className:`flex h-full min-h-0 min-w-0 flex-col overflow-hidden`,children:[(0,Q.jsx)(`span`,{id:c,className:`sr-only`,children:o??`Panel`}),o&&(0,Q.jsxs)(`div`,{className:`flex h-10 shrink-0 items-center justify-between gap-2 border-b border-border/60 px-3`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 text-[13px] font-medium text-foreground/80`,children:[r&&(0,Q.jsx)(r,{className:`size-3.5 shrink-0`}),(0,Q.jsx)(`span`,{className:`truncate`,children:o})]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[n,i&&(0,Q.jsx)(V,{type:`button`,onClick:i,variant:`ghost`,size:`icon-sm`,className:`relative after:absolute after:top-1/2 after:left-1/2 after:size-10 after:-translate-x-1/2 after:-translate-y-1/2 text-foreground/40 hover:text-foreground/70`,"aria-label":`Close panel`,title:`Close panel`,children:(0,Q.jsx)(Wr,{"data-icon":`inline-start`,className:`size-3.5`})})]})]}),(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain px-3 py-2`,children:e})]})}):null}function us({handleResourceCanvasResizeStart:e,onClose:t,resourceCanvasWidth:n}){let r=Li(),i=Ii(),{rightPanel:a}=r,o=a!==null,s=a?Rn(a):null,c=s?.component,l=s?.loadingSource===`resources`?r.resourcesLoading:s?.loadingSource===`workspace`&&i.workspaceLoading,u=s?.refreshSource===`resources`?r.refreshResources:s?.refreshSource===`workspace`?i.refreshWorkspace:void 0;return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(ls,{dataTestid:s?.mobileDataTestid,icon:s?.icon,onClose:t,open:o,title:s?.title??``,children:c?(0,Q.jsx)(c,{}):null}),(0,Q.jsx)(So,{dataTestid:s?.dataTestid,headerLeading:(0,Q.jsx)(as,{idPrefix:`right-panel-desktop`}),loading:l,onClose:t,onRefresh:u,onResizeStart:e,open:o,title:s?.title??``,titleIcon:s?.icon??zn,width:n,children:c?(0,Q.jsx)(c,{}):null})]})}var ds={"--chat-chrome-top":`52px`,"--chat-header-height":`44px`,"--chat-header-top":`0px`};function fs({children:e,headerCenter:t,headerLeft:n,headerRight:r,panel:i}){return(0,Q.jsxs)(`div`,{className:`flex h-svh min-w-0 overflow-hidden`,"data-testid":`chat-shell`,style:ds,children:[(0,Q.jsxs)(`div`,{className:`relative flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden`,"data-testid":`chat-column`,children:[(0,Q.jsxs)(`header`,{className:q(wn,`grid h-[var(--chat-header-height)] min-h-[var(--chat-header-height)] shrink-0 grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-1 border-b border-[#2e3033] px-2 py-2`),"data-testid":`chat-header`,children:[(0,Q.jsx)(`div`,{className:`min-w-0 justify-self-start`,children:n}),(0,Q.jsx)(`div`,{className:`flex min-w-0 items-center justify-start gap-1 overflow-hidden justify-self-stretch`,children:t}),(0,Q.jsx)(`div`,{className:`min-w-0 justify-self-end`,children:r})]}),(0,Q.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden`,children:e})]}),i]})}var ps=e(n(),1),ms=`(max-width: 767px)`,hs=`b`,gs={duration:.36,ease:Pe},_s={type:`spring`,stiffness:380,damping:35,mass:.75},vs={duration:.18,ease:Ne},ys={closed:{opacity:0,clipPath:`inset(0 0 100% 0 round 8px)`,transition:{duration:.14,ease:Ne,staggerChildren:.025,staggerDirection:-1}},open:{opacity:1,clipPath:`inset(0 0 0% 0 round 8px)`,transition:{duration:.2,delayChildren:.035,ease:Ne,staggerChildren:.045}}},bs={closed:{opacity:0,y:-6,filter:`blur(3px)`},open:{opacity:1,y:0,filter:`blur(0px)`,transition:vs}},xs={duration:.16,ease:Ne},Ss=[`a[href]`,`button:not([disabled])`,`input:not([disabled])`,`select:not([disabled])`,`textarea:not([disabled])`,`[tabindex]:not([tabindex='-1'])`].join(`,`);function Cs(e){let t=window.matchMedia(ms);return t.addEventListener(`change`,e),()=>t.removeEventListener(`change`,e)}function ws(){return window.matchMedia(ms).matches}function Ts(){return!1}function Es(){return(0,Z.useSyncExternalStore)(Cs,ws,Ts)}var Ds=(0,Z.createContext)(null),Os=(0,Z.createContext)(null);function ks(){let e=(0,Z.useContext)(Ds);if(!e)throw Error(`useAnimatedSidebar must be used inside AnimatedSidebarProvider.`);return e}function As(){let e=(0,Z.useContext)(Os);if(!e)throw Error(`Animated Sidebar parts must be used inside AnimatedSidebar.`);return e}function js({children:e,open:t,defaultOpen:n=!0,onOpenChange:r,openMobile:i,defaultOpenMobile:a=!1,onOpenMobileChange:o,className:s,style:c,...l}){let[u,d]=(0,Z.useState)(n),[f,p]=(0,Z.useState)(a),m=Es(),h=Ge()??!1,g=(0,Z.useId)(),_=(0,Z.useRef)(null),v=t??u,y=i??f,b=(0,Z.useCallback)(e=>{t===void 0&&d(e),r?.(e)},[r,t]),x=(0,Z.useCallback)(e=>{i===void 0&&p(e),o?.(e)},[o,i]),S=(0,Z.useCallback)(()=>{m?x(!y):b(!v)},[v,m,y,b,x]),C=(0,Z.useMemo)(()=>({isMobile:m,layoutId:`${g}-active`,open:v,openMobile:y,reduce:h,setOpen:b,setOpenMobile:x,state:v?`expanded`:`collapsed`,toggleSidebar:S,triggerRef:_}),[v,g,m,y,h,b,x,S]);return(0,Z.useEffect)(()=>{let e=e=>{e.key.toLowerCase()===hs&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),S())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[S]),(0,Q.jsx)(Ds.Provider,{value:C,children:(0,Q.jsx)(`div`,{...l,"data-slot":`sidebar-wrapper`,"data-state":v?`expanded`:`collapsed`,style:{"--sidebar-width":`16rem`,"--sidebar-width-icon":`4.25rem`,"--sidebar-width-mobile":`18rem`,...c},className:q(`group/sidebar-wrapper flex min-h-svh w-full min-w-0`,s),children:e})})}function Ms({ariaLabel:e,children:t,className:n,side:r}){let i=ks(),a=(0,Z.useRef)(null),[o,s]=(0,Z.useState)(!1),c=(0,Z.useMemo)(()=>({collapsed:!1,collapsible:`none`,side:r}),[r]);return(0,Z.useEffect)(()=>s(!0),[]),(0,Z.useEffect)(()=>{if(!i.openMobile)return;let e=a.current;if(!e)return;let t=i.triggerRef.current,n=document.body,r=window.scrollY,o={left:n.style.left,overflow:n.style.overflow,position:n.style.position,right:n.style.right,top:n.style.top};n.style.position=`fixed`,n.style.top=`-${r}px`,n.style.left=`0`,n.style.right=`0`,n.style.overflow=`hidden`;let s=requestAnimationFrame(()=>{(e.querySelector(Ss)??e).focus({preventScroll:!0})});return()=>{cancelAnimationFrame(s),n.style.position=o.position,n.style.top=o.top,n.style.left=o.left,n.style.right=o.right,n.style.overflow=o.overflow,window.scrollTo(0,r),t?.focus({preventScroll:!0})}},[i.openMobile,i.triggerRef,o]),o?(0,ps.createPortal)((0,Q.jsxs)(`div`,{className:q(`pointer-events-none fixed inset-0 z-50 md:hidden`,i.openMobile?`visible`:`invisible`),children:[(0,Q.jsx)(K.button,{type:`button`,"aria-label":`Close sidebar`,tabIndex:i.openMobile?0:-1,initial:!1,animate:{opacity:+!!i.openMobile},transition:i.reduce?xs:gs,onClick:()=>i.setOpenMobile(!1),className:q(`absolute inset-0 bg-black/40`,i.openMobile?`pointer-events-auto`:`pointer-events-none`)}),(0,Q.jsx)(K.div,{ref:a,role:`dialog`,"aria-modal":`true`,"aria-label":e,"aria-hidden":!i.openMobile,inert:!i.openMobile,tabIndex:-1,"data-mobile":`true`,"data-state":i.openMobile?`expanded`:`collapsed`,"data-side":r,initial:!1,animate:{opacity:i.reduce?+!!i.openMobile:1,x:i.reduce?0:i.openMobile?`0%`:r===`left`?`-100%`:`100%`},transition:i.reduce?xs:gs,onKeyDown:e=>{if(e.key===`Escape`){e.preventDefault(),i.setOpenMobile(!1);return}if(e.key!==`Tab`)return;let t=a.current?Array.from(a.current.querySelectorAll(Ss)):[];if(t.length===0){e.preventDefault(),a.current?.focus();return}let n=t[0],r=t[t.length-1];e.shiftKey&&document.activeElement===n?(e.preventDefault(),r.focus()):!e.shiftKey&&document.activeElement===r&&(e.preventDefault(),n.focus())},className:q(`pointer-events-auto absolute inset-y-0 flex h-dvh w-(--sidebar-width-mobile) max-w-[88vw] flex-col overflow-hidden`,`border-border bg-background shadow-2xl will-change-transform`,r===`left`?`left-0 border-r`:`right-0 border-l`,!i.openMobile&&`pointer-events-none`,n),children:(0,Q.jsx)(Os.Provider,{value:c,children:t})})]}),document.body):null}var Ns=(0,Z.forwardRef)(function({side:e=`left`,variant:t=`sidebar`,collapsible:n=`icon`,ariaLabel:r=`Sidebar`,children:i,className:a,panelClassName:o,style:s,...c},l){let u=ks(),d=n!==`none`&&!u.open,f=d&&n===`offcanvas`,p=t===`floating`||t===`inset`,m=f?`0px`:d?p?`calc(var(--sidebar-width-icon) + 1rem)`:`var(--sidebar-width-icon)`:p?`calc(var(--sidebar-width) + 1rem)`:`var(--sidebar-width)`,h=(0,Z.useMemo)(()=>({collapsed:d,collapsible:n,side:e}),[d,n,e]);return u.isMobile?(0,Q.jsx)(Ms,{ariaLabel:r,className:a,side:e,children:i}):(0,Q.jsx)(K.aside,{...c,ref:l,initial:!1,"aria-label":r,"data-slot":`sidebar`,"data-state":d?`collapsed`:`expanded`,"data-collapsible":n,"data-variant":t,"data-side":e,transition:u.reduce?{duration:0}:_s,layout:`size`,style:{...s,width:m},className:q(`group/sidebar relative hidden h-auto shrink-0 md:block will-change-transform`,`peer`,e===`right`&&`order-last`,a),children:(0,Q.jsx)(K.div,{initial:!1,animate:{opacity:+!f,x:f?e===`left`?`-120%`:`120%`:`0%`},transition:u.reduce?xs:gs,className:q(`sticky top-0 flex h-svh w-full flex-col overflow-hidden`,p&&(d?`w-[var(--sidebar-width-icon)]`:`w-[var(--sidebar-width)]`),n===`offcanvas`&&`w-[var(--sidebar-width)]`,t===`sidebar`&&(e===`left`?`border-border border-r bg-background`:`border-border border-l bg-background`),t===`floating`&&`m-2 h-[calc(100svh-1rem)] rounded-2xl bg-sidebar shadow-surface-3`,t===`inset`&&`m-2 h-[calc(100svh-1rem)] rounded-2xl bg-background`,o),children:(0,Q.jsx)(Os.Provider,{value:h,children:i})})})}),Ps=(0,Z.forwardRef)(function({className:e,onClick:t,type:n=`button`,...r},i){let a=ks(),o=a.isMobile?a.openMobile:a.open;return(0,Q.jsx)(V,{...r,ref:e=>{a.triggerRef.current=e,typeof i==`function`?i(e):i&&(i.current=e)},type:n,variant:`ghost`,size:`icon-lg`,"aria-label":r[`aria-label`]??`Toggle sidebar`,"aria-expanded":o,"data-slot":`sidebar-trigger`,"data-state":o?`expanded`:`collapsed`,onClick:e=>{t?.(e),e.defaultPrevented||a.toggleSidebar()},className:q(`focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background`,e)})});(0,Z.forwardRef)(function({className:e,onClick:t,type:n=`button`,...r},i){let a=ks();return(0,Q.jsx)(V,{...r,ref:i,type:n,variant:`ghost`,size:`icon-lg`,"aria-label":r[`aria-label`]??`Close sidebar`,onClick:e=>{t?.(e),!e.defaultPrevented&&(a.isMobile?a.setOpenMobile(!1):a.setOpen(!1))},className:q(`focus-visible:ring-2 focus-visible:ring-ring`,e)})});var Fs=(0,Z.forwardRef)(function({className:e,onClick:t,type:n=`button`,...r},i){let a=ks(),o=As();return(0,Q.jsx)(`button`,{...r,ref:i,type:n,"data-side":o.side,"aria-label":r[`aria-label`]??`Toggle sidebar`,title:`Toggle sidebar`,tabIndex:-1,onClick:e=>{t?.(e),e.defaultPrevented||a.toggleSidebar()},className:q(`absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 outline-none md:block`,`after:absolute after:inset-y-0 after:left-1/2 after:w-px after:bg-transparent after:transition-colors hover:after:bg-border`,`data-[side=right]:right-0 data-[side=right]:translate-x-1/2 data-[side=left]:left-full`,e)})}),Is=(0,Z.forwardRef)(function({className:e,...t},n){return(0,Q.jsx)(K.main,{...t,ref:n,"data-slot":`sidebar-inset`,className:q(`relative flex min-h-svh min-w-0 flex-1 flex-col bg-background`,`md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-2xl md:peer-data-[variant=inset]:shadow-sm`,e)})}),Ls=(0,Z.forwardRef)(function({className:e,...t},n){return(0,Q.jsx)(`div`,{...t,ref:n,"data-slot":`sidebar-header`,className:q(`flex shrink-0 flex-col gap-2 p-3`,e)})}),Rs=(0,Z.forwardRef)(function({className:e,...t},n){return(0,Q.jsx)(`div`,{...t,ref:n,"data-slot":`sidebar-content`,className:q(`flex min-h-0 flex-1 flex-col gap-2 overflow-y-auto overflow-x-hidden overscroll-contain px-2 py-2`,e)})}),zs=(0,Z.forwardRef)(function({className:e,...t},n){return(0,Q.jsx)(`div`,{...t,ref:n,"data-slot":`sidebar-footer`,className:q(`flex shrink-0 flex-col gap-2 border-border border-t p-3 pb-[max(0.75rem,env(safe-area-inset-bottom))]`,e)})}),Bs=(0,Z.forwardRef)(function({className:e,...t},n){return(0,Q.jsx)(`div`,{...t,ref:n,"data-slot":`sidebar-group`,className:q(`flex w-full min-w-0 flex-col px-1 py-1.5`,e)})}),Vs=(0,Z.forwardRef)(function({children:e,className:t,...n},r){let{collapsed:i}=As();return(0,Q.jsx)(`div`,{...n,ref:r,"aria-hidden":i,"data-slot":`sidebar-group-label`,className:q(`mb-1 h-7 overflow-hidden px-2 text-[10px] font-medium uppercase tracking-[0.14em] text-muted-foreground transition-opacity`,i?`opacity-0`:`opacity-100`,t),children:e})}),Hs=(0,Z.forwardRef)(function({className:e,...t},n){return(0,Q.jsx)(`div`,{...t,ref:n,"data-slot":`sidebar-group-content`,className:q(`w-full min-w-0`,e)})});(0,Z.forwardRef)(function({children:e,className:t,...n},r){return(0,Q.jsx)(Sr,{...n,ref:r,as:`ul`,inset:0,pillClassName:`rounded-xl bg-muted/70`,pillContainerClassName:`inset-y-auto top-0 h-9`,"data-slot":`sidebar-menu`,className:q(`flex w-full min-w-0 list-none flex-col gap-0.5`,t),children:e})}),(0,Z.forwardRef)(function({className:e,...t},n){return(0,Q.jsx)(K.li,{...t,ref:n,layout:`position`,transition:je,"data-slot":`sidebar-menu-item`,className:q(`relative`,e)})}),(0,Z.forwardRef)(function({open:e,children:t,className:n,...r},i){let a=ks(),o=As();return(0,Q.jsx)(We,{initial:!1,mode:`popLayout`,children:e&&!o.collapsed?(0,Z.createElement)(K.ul,{...r,ref:i,key:`sidebar-submenu`,variants:a.reduce?void 0:ys,initial:!a.reduce&&`closed`,animate:a.reduce?{opacity:1}:`open`,exit:a.reduce?{opacity:0}:`closed`,transition:a.reduce?{duration:.12}:void 0,"data-slot":`sidebar-menu-sub`,className:q(`relative mt-1 ml-5 flex min-w-0 flex-col gap-0.5 border-border border-l pl-3`,n)},t):null})}),(0,Z.forwardRef)(function({className:e,...t},n){return(0,Q.jsx)(K.li,{...t,ref:n,variants:bs,"data-slot":`sidebar-menu-sub-item`,className:q(`relative min-w-0`,e)})});function Us({children:e,className:t,sidebarWidth:n=`17rem`,style:r,...i}){return(0,Q.jsx)(js,{...i,style:{...r,"--sidebar-width":n},className:q(`min-h-0 w-full overflow-hidden rounded-2xl border border-border bg-background`,t),children:e})}var Ws=`https://docs.qredence.ai`,Gs=`fleet-prime:v1:sidebar-expanded-projects`,Ks=[],qs=`new-session:`,Js=`project:`,Ys=`session:`;function Xs(e){return`${Js}${e}`}function Zs(e){return`${Ys}${e}`}function Qs(e){return`${qs}${e}`}function $s(e,t){return e.startsWith(t)?e.slice(t.length):null}function ec(e){return kr(e.title||e.firstMessage||e.sessionId.slice(0,8))}function tc(e,t){return`${e.projectId?t.get(e.projectId)?.name??`Unassigned`:`Unassigned`} · ${e.status===`idle`?`Ready`:e.status} · ${`${String(e.messageCount)} ${e.messageCount===1?`message`:`messages`}`}`}function nc(e){let t=Date.parse(e);if(!Number.isFinite(t))return`Earlier`;let n=new Date,r=new Date(n.getFullYear(),n.getMonth(),n.getDate()).getTime(),i=Math.floor((r-new Date(t).setHours(0,0,0,0))/864e5);return i<=0?`Today`:i===1?`Yesterday`:`Earlier`}function rc(e){return e.hasChildren?`${e.name}/`:e.name}function ic(e,t){return e instanceof Error&&e.message.trim()?e.message:t}function ac(e){if(typeof window>`u`)return e?[Xs(e)]:[];let t=window.localStorage.getItem(Gs);if(!t)return e?[Xs(e)]:[];try{let e=JSON.parse(t);return Array.isArray(e)?e.filter(e=>typeof e==`string`):[]}catch{return e?[Xs(e)]:[]}}function oc(e,t){return t.type===`update`?t.update(e):{...e,[t.field.key]:t.field.value}}function sc(e){let[t,n]=(0,Z.useReducer)(oc,e,e=>({brandMenuOpen:!1,projectActionsOpen:!1,searchOpen:!1,query:``,expandedProjectIds:ac(e),revealedProjectIds:new Set,renameTarget:null,renameTitle:``,renameProjectTarget:null,renameProjectName:``,deleteTarget:null,unregisterTarget:null,createOpen:!1,createPath:``,createName:``,directoryToken:void 0,directoryBrowser:null,directoryBrowseLoading:!1,directoryBrowseError:null,createSubmitting:!1,createSubmitError:null,forkTarget:null,forkProjectId:void 0})),r=(0,Z.useCallback)(function(e,t){n({type:`set`,field:{key:e,value:t}})},[]),i=(0,Z.useCallback)(function(e,t){n({type:`update`,update:n=>({...n,[e]:t(n[e])})})},[]),a=(0,Z.useCallback)(e=>r(`brandMenuOpen`,e),[r]),o=(0,Z.useCallback)(e=>r(`projectActionsOpen`,e),[r]),s=(0,Z.useCallback)(e=>r(`searchOpen`,e),[r]),c=(0,Z.useCallback)(e=>r(`query`,e),[r]),l=(0,Z.useCallback)(e=>typeof e==`function`?i(`expandedProjectIds`,e):r(`expandedProjectIds`,e),[r,i]),u=(0,Z.useCallback)(e=>typeof e==`function`?i(`revealedProjectIds`,e):r(`revealedProjectIds`,e),[r,i]),d=(0,Z.useCallback)(e=>r(`renameTarget`,e),[r]),f=(0,Z.useCallback)(e=>r(`renameTitle`,e),[r]),p=(0,Z.useCallback)(e=>r(`renameProjectTarget`,e),[r]),m=(0,Z.useCallback)(e=>r(`renameProjectName`,e),[r]),h=(0,Z.useCallback)(e=>r(`deleteTarget`,e),[r]),g=(0,Z.useCallback)(e=>r(`unregisterTarget`,e),[r]),_=(0,Z.useCallback)(e=>r(`createOpen`,e),[r]),v=(0,Z.useCallback)(e=>r(`createPath`,e),[r]),y=(0,Z.useCallback)(e=>r(`createName`,e),[r]),b=(0,Z.useCallback)(e=>r(`directoryToken`,e),[r]),x=(0,Z.useCallback)(e=>r(`directoryBrowser`,e),[r]),S=(0,Z.useCallback)(e=>r(`directoryBrowseLoading`,e),[r]),C=(0,Z.useCallback)(e=>r(`directoryBrowseError`,e),[r]),w=(0,Z.useCallback)(e=>r(`createSubmitting`,e),[r]),T=(0,Z.useCallback)(e=>r(`createSubmitError`,e),[r]),E=(0,Z.useCallback)(e=>r(`forkTarget`,e),[r]),D=(0,Z.useCallback)(e=>r(`forkProjectId`,e),[r]);return{...t,setBrandMenuOpen:a,setProjectActionsOpen:o,setSearchOpen:s,setQuery:c,setExpandedProjectIds:l,setRevealedProjectIds:u,setRenameTarget:d,setRenameTitle:f,setRenameProjectTarget:p,setRenameProjectName:m,setDeleteTarget:h,setUnregisterTarget:g,setCreateOpen:_,setCreatePath:v,setCreateName:y,setDirectoryToken:b,setDirectoryBrowser:x,setDirectoryBrowseLoading:S,setDirectoryBrowseError:C,setCreateSubmitting:w,setCreateSubmitError:T,setForkTarget:E,setForkProjectId:D}}function cc(e,t){return e.filter(e=>e.messageCount>0||e.sessionId===t)}function lc(e){return e.toSorted((e,t)=>Date.parse(t.updatedAt)-Date.parse(e.updatedAt))}function uc(e,t,n){let r=lc(e);if(n||r.length<=5)return r;let i=r.slice(0,5),a=r.find(e=>e.sessionId===t);return a&&!i.some(e=>e.sessionId===a.sessionId)&&(i[4]=a),i}function dc(e,t){let n=new Map(e.map((e,t)=>[e.projectId,t])),r=new Map;for(let e of t){if(!e.projectId)continue;let t=Date.parse(e.updatedAt);r.set(e.projectId,Math.max(r.get(e.projectId)??0,t))}return e.toSorted((e,t)=>{let i=r.get(e.projectId)??0,a=r.get(t.projectId)??0;return i===a?(n.get(e.projectId)??0)-(n.get(t.projectId)??0):a-i})}var fc=[[`resources`,`Open Resources`,zn],[`workspace`,`Open Workspace`,Pr],[`artifacts`,`Open Artifacts`,Ir]];function pc({icon:e,label:t,destructive:n=!1,onClick:r}){return(0,Q.jsxs)(`button`,{type:`button`,onClick:r,className:n?`flex h-8 w-full items-center gap-2 rounded-lg px-2.5 text-left text-xs text-destructive hover:bg-destructive/10`:`flex h-8 w-full items-center gap-2 rounded-lg px-2.5 text-left text-xs hover:bg-muted`,children:[(0,Q.jsx)(e,{className:`size-3.5`}),t]})}function mc({sessions:e,projects:t=Ks,projectSessions:n=e,activeProjectId:r,activeSessionId:i,onNewSession:a,onNewSessionInProject:o,onProjectSelect:s,onResumeSession:c,onCreateProject:l,onForkSessionIntoProject:u,onOpenPanelAction:d,onBrowseDirectories:f,createOpen:p,expandedProjectIds:m,revealedProjectIds:h,setExpandedProjectIds:g,setRevealedProjectIds:_,setSearchOpen:v,setDirectoryBrowser:y,setDirectoryBrowseLoading:b,setDirectoryBrowseError:x,setDirectoryToken:S,setCreatePath:C,setRenameTarget:w,setRenameTitle:T,setForkTarget:E,setForkProjectId:D,setDeleteTarget:O,setRenameProjectTarget:k,setRenameProjectName:A,setUnregisterTarget:j,createPath:M,directoryToken:N,createName:P,setCreateName:F,setCreateOpen:I,setCreateSubmitError:L,setCreateSubmitting:R}){let z=(0,Z.useRef)(!1),B=(0,Z.useCallback)(async e=>{if(!f)return!1;b(!0),x(null);try{let t=await f(e);return y(t),S(t.directoryToken),C(t.pathLabel),!0}catch(e){return x(ic(e,`Could not browse this directory.`)),!1}finally{b(!1)}},[f,C,x,b,y,S]);(0,Z.useEffect)(()=>{let e=p&&!z.current;z.current=p,!(!e||!f)&&B({})},[p,B,f]);let V=(0,Z.useMemo)(()=>new Map(t.map(e=>[e.projectId,e])),[t]),H=(0,Z.useMemo)(()=>dc(t,n),[n,t]);(0,Z.useEffect)(()=>{if(!r)return;let e=Xs(r);g(t=>t.includes(e)?t:[...t,e])},[r,g]),(0,Z.useEffect)(()=>{window.localStorage.setItem(Gs,JSON.stringify(m))},[m]);let U=(0,Z.useMemo)(()=>{let e=H.map(e=>{let t=cc(n.filter(t=>t.projectId===e.projectId),i),r=h.has(e.projectId),a=uc(t,i,r).map(e=>({id:Zs(e.sessionId),label:ec(e),kind:`file`,...e.isSubagent?{indent:1}:{}}));return t.length===0?a.push({id:Qs(e.projectId),label:`Start first chat`,kind:`action`}):t.length>5&&a.push({id:`toggle:${e.projectId}`,label:r?`Show less`:`Show more`,kind:`action`}),{id:Xs(e.projectId),label:e.name,kind:`project`,children:a}}),t=lc(cc(n.filter(e=>!e.projectId),i));if(t.length>0){let n=uc(t,i,h.has(`unassigned`)).map(e=>({id:Zs(e.sessionId),label:ec(e),kind:`file`,...e.isSubagent?{indent:1}:{}}));t.length>5&&n.push({id:`toggle:unassigned`,label:h.has(`unassigned`)?`Show less`:`Show more`,kind:`action`}),e.push({id:`project:unassigned`,label:`Unassigned`,kind:`folder`,children:n})}return e},[i,n,h,H]),W=(0,Z.useCallback)(e=>{o?o(e):(s?.(e),a())},[a,o,s]);return{loadDirectories:B,projectById:V,sortedProjects:H,sidebarItems:U,resumeResource:(0,Z.useCallback)(e=>{let t=$s(e,`toggle:`);if(t){_(e=>{let n=new Set(e);return n.has(t)?n.delete(t):n.add(t),n});return}let r=$s(e,qs);if(r){W(r);return}let i=$s(e,Ys);if(!i)return;let a=n.find(e=>e.sessionId===i);a&&c(a)},[W,c,n,_]),toggleProjectResource:(0,Z.useCallback)(e=>{g(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},[g]),selectSearchResult:(0,Z.useCallback)(e=>{let t=$s(e,`search-project:`);if(t){let e=Xs(t);g(t=>t.includes(e)?t:[...t,e]),s?.(t),v(!1);return}let r=$s(e,`search-session:`),i=r?n.find(e=>e.sessionId===r):void 0;if(i){if(i.projectId){let e=Xs(i.projectId);g(t=>t.includes(e)?t:[...t,e])}c(i),v(!1)}},[s,c,n,g,v]),renderMenu:(0,Z.useCallback)((e,r)=>{let i=$s(e.id,Ys),a=$s(e.id,`project:`);if(i){let e=n.find(e=>e.sessionId===i);if(!e)return null;let a=e.projectId??void 0;return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(pc,{icon:hn,label:`Rename`,onClick:()=>{r.close(),w(e),T(ec(e))}}),u&&t.length>1?(0,Q.jsx)(pc,{icon:ao,label:`Fork into project`,onClick:()=>{r.close(),E(e),D(t.find(t=>t.projectId!==e.projectId)?.projectId)}}):null,d&&a?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`my-1 border-t`}),fc.map(([e,t,n])=>(0,Q.jsx)(pc,{icon:n,label:t,onClick:()=>{r.close(),d({panel:e,projectId:a,focus:!0})}},e))]}):null,(0,Q.jsx)(pc,{icon:Fn,label:`Delete`,destructive:!0,onClick:()=>{r.close(),O(e)}})]})}if(a&&a!==`unassigned`){let e=V.get(a);return e?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(pc,{icon:hn,label:`Rename project`,onClick:()=>{r.close(),k(e),A(e.name)}}),(0,Q.jsx)(pc,{icon:go,label:`Unregister project`,destructive:!0,onClick:()=>{r.close(),j(e)}}),d?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`my-1 border-t`}),fc.map(([e,t,n])=>(0,Q.jsx)(pc,{icon:n,label:t,onClick:()=>{r.close(),d({panel:e,projectId:a,focus:!0})}},e))]}):null]}):null}return null},[u,d,V,n,t,O,D,E,A,k,w,T,j]),submitCreate:async()=>{let e=M.trim();if(!(!l||!e&&!N)){R(!0),L(null);try{await l({path:N?void 0:e,directoryToken:N,name:P.trim()||void 0}),I(!1),C(``),F(``),S(void 0),y(null),x(null)}catch(e){L(ic(e,`Could not add this project.`))}finally{R(!1)}}}}}var hc=Z.createContext(void 0);function gc(e){let t=Z.useContext(hc);if(t===void 0&&!e)throw Error(rt(47));return t}var _c={...yt,disabled:e=>e.disabled,instantType:e=>e.instantType,openMethod:e=>e.openMethod,openChangeReason:e=>e.openChangeReason,modal:e=>e.modal,focusManagerModal:e=>e.focusManagerModal,stickIfOpen:e=>e.stickIfOpen,titleElementId:e=>e.titleElementId,descriptionElementId:e=>e.descriptionElementId,openOnHover:e=>e.openOnHover,closeDelay:e=>e.closeDelay,adaptiveOrigin:e=>e.adaptiveOrigin},vc=class extends R{constructor(e,t,n){let r=new St;super(yc(e,r,t,n),bc(r),_c)}setOpen=(e,t)=>{let n=t.reason===et,r=t.reason===`trigger-press`&&t.event.detail===0,i=!e&&(t.reason===`escape-key`||t.reason==null),a=ht(t),o=this.select(`activeTriggerId`);if(!e&&t.reason===`close-press`&&t.trigger==null&&o!=null&&(t.trigger=this.context.triggerElements.getById(o)??this.select(`activeTriggerElement`)??void 0),this.context.onOpenChange?.(e,t),t.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(e,t);let s=()=>{let n={open:e,openChangeReason:t.reason};xt(n,e,t.trigger,a()),this.update(n)};n?(this.set(`stickIfOpen`,!0),this.context.stickIfOpenTimeout.start(500,()=>{this.set(`stickIfOpen`,!1)}),ps.flushSync(s)):s();let c;r?c=`click`:i?c=`dismiss`:t.reason===`focus-out`&&(c=`focus`),this.set(`instantType`,c)}};function yc(e,t,n,r=!1){let i={...Dt(),disabled:!1,modal:!1,focusManagerModal:!1,instantType:void 0,openMethod:null,openChangeReason:null,titleElementId:void 0,descriptionElementId:void 0,stickIfOpen:!0,openOnHover:!1,closeDelay:0,adaptiveOrigin:void 0,...e};return i.open&&e?.mounted===void 0&&(i.mounted=!0),i.floatingRootContext=kt(t,n,r),i}function bc(e){return{popupRef:Z.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:Z.createRef(),beforeContentFocusGuardRef:Z.createRef(),stickIfOpenTimeout:new D,triggerElements:e}}function xc({props:e}){let{children:t,open:n,defaultOpen:r=!1,onOpenChange:i,onOpenChangeComplete:a,modal:o=!1,handle:s,triggerId:c,defaultTriggerId:l=null}=e,u=Cc(s,{modal:o,open:r,openProp:n,activeTriggerId:l,triggerIdProp:c});u.useControlledProp(`openProp`,n),u.useControlledProp(`triggerIdProp`,c);let d=u.useState(`open`),f=u.useState(`mounted`),p=u.useState(`payload`);u.useContextCallback(`onOpenChange`,i),u.useContextCallback(`onOpenChangeComplete`,a),Jt(u,d),Nt(u);let{forceUnmount:m}=Ft(d,u,()=>{u.update({stickIfOpen:!0,openChangeReason:null})});u.useSyncedValues({modal:o}),Z.useEffect(()=>{d||u.context.stickIfOpenTimeout.clear()},[u,d]),Z.useImperativeHandle(e.actionsRef,()=>({unmount:m,close:()=>u.setOpen(!1,lt(st))}),[m,u]);let h=d||f;return(0,Q.jsxs)(hc.Provider,{value:u,children:[s&&(0,Q.jsx)(jt,{handle:s,store:u}),h&&(0,Q.jsx)(wc,{store:u,modal:o}),typeof t==`function`?t({payload:p}):t]})}function Sc(e){return gc(!0)?(0,Q.jsx)(xc,{props:e}):(0,Q.jsx)(pt,{children:(0,Q.jsx)(xc,{props:e})})}function Cc(e,t){let n=wt((e,n)=>new vc(t,e,n));return Z.useEffect(()=>n.context.stickIfOpenTimeout.disposeEffect(),[n]),n}function wc({store:e,modal:t}){let n=e.useState(`floatingRootContext`),r=It(n,{outsidePressEvent:{mouse:t===`trap-focus`?`sloppy`:`intentional`,touch:`sloppy`}}),i=r.reference,a=r.floating;return bt(e,{activeTriggerProps:i,inactiveTriggerProps:i,popupProps:a}),null}function Tc(e,t){let n=Z.useRef(null);function r(t){ps.flushSync(()=>{e.setOpen(!1,lt(it,t.nativeEvent,t.currentTarget))}),U(n.current)?.focus()}function i(n){let r=e.select(`positionerElement`);if(r&&O(n,r))e.context.beforeContentFocusGuardRef.current?.focus();else{ps.flushSync(()=>{e.setOpen(!1,lt(it,n.nativeEvent,n.currentTarget))});let i=j(e.context.triggerFocusTargetRef.current||t.current);for(;i!==null&&w(r,i);){let e=i;if(i=H(i),i===e)break}i?.focus()}}return{preFocusGuardRef:n,handlePreFocusGuardFocus:r,handleFocusTargetFocus:i}}var Ec=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:o=!0,handle:s,payload:c,openOnHover:l=!1,delay:u=300,closeDelay:d=0,id:f,...p}=e,m=gc(!0),h=mn(s)??m;if(!h)throw Error(rt(74));let g=pn(f),_=h.useState(`isTriggerActive`,g),v=h.useState(`floatingRootContext`),y=h.useState(`isOpenedByTrigger`,g),b=h.useState(`triggerPopupId`,g),x=Z.useRef(null),{registerTrigger:S,isMountedByThisTrigger:C}=Ct(g,x,h,{payload:c,disabled:a,openOnHover:l,closeDelay:d}),w=h.useState(`openChangeReason`),T=h.useState(`stickIfOpen`),E=h.useState(`openMethod`),D=h.useState(`focusManagerModal`),O=gn(v,{enabled:!a&&l&&(E!==`touch`||w!==`trigger-press`),mouseOnly:!0,move:!1,handleClose:_n(),restMs:u,delay:{close:d},triggerElementRef:x,isActiveTrigger:_,isClosing:()=>h.select(`transitionStatus`)===`ending`}),k=on(v,{stickIfOpen:T}),A=rn(()=>h.select(`open`),e=>{h.set(`openMethod`,e)}),j=h.useState(`triggerProps`,C),{getButtonProps:N,buttonRef:P}=ut({disabled:a,native:o}),F={open(e){return e&&w===`trigger-press`?Gt.open(e):Et.open(e)}},{preFocusGuardRef:L,handlePreFocusGuardFocus:R,handleFocusTargetFocus:z}=Tc(h,x),B=Je(`button`,e,{state:{disabled:a,open:y},ref:[P,t,S,x],props:[k.reference,O,j,A,{[M]:``,id:g,"aria-haspopup":`dialog`,"aria-expanded":y,"aria-controls":b},p,N],stateAttributesMapping:F}),V=(0,Q.jsx)(Z.Fragment,{children:B},g);return C&&!D?(0,Q.jsxs)(Z.Fragment,{children:[(0,Q.jsx)(I,{ref:L,onFocus:R}),V,(0,Q.jsx)(I,{ref:h.context.triggerFocusTargetRef,onFocus:z})]}):V}),Dc=Z.createContext(void 0);function Oc(){let e=Z.useContext(Dc);if(e===void 0)throw Error(rt(45));return e}var kc=Z.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e;return gc().useState(`mounted`)||n?(0,Q.jsx)(Dc.Provider,{value:n,children:(0,Q.jsx)(B,{ref:t,...r})}):null}),Ac=Z.createContext(void 0);function jc(){let e=Z.useContext(Ac);if(!e)throw Error(rt(46));return e}var Mc=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,anchor:a,positionMethod:o,side:s,align:c,sideOffset:l,alignOffset:u,collisionBoundary:d=`clipping-ancestors`,collisionPadding:f,arrowPadding:p,sticky:m,disableAnchorTracking:h=!1,collisionAvoidance:g=P,..._}=e,v=gc(),y=Oc(),b=Vt(),x=v.useState(`floatingRootContext`),S=v.useState(`mounted`),C=v.useState(`open`),w=v.useState(`openChangeReason`),T=v.useState(`activeTriggerElement`),E=v.useState(`modal`),D=v.useState(`openMethod`),O=v.useState(`positionerElement`),k=v.useState(`instantType`),A=v.useState(`transitionStatus`),j=v.useState(`adaptiveOrigin`),M=Z.useRef(null),N=dt(O),F=tn({anchor:a,floatingRootContext:x,positionMethod:o,mounted:S,side:s,sideOffset:l,align:c,alignOffset:u,arrowPadding:p,collisionBoundary:d,collisionPadding:f,sticky:m,disableAnchorTracking:h,keepMounted:y,nodeId:b,collisionAvoidance:g,adaptiveOrigin:j}),I=x.useState(`domReferenceElement`);ot(()=>{let e=I,t=M.current;if(e&&(M.current=e),t&&e&&e!==t){v.set(`instantType`,void 0);let e=new AbortController;return N(()=>{v.set(`instantType`,`trigger-change`)},e.signal),()=>{e.abort()}}},[I,N,v]);let L=E===!0&&w!==`trigger-hover`;ln(C&&L,D===`touch`,O,T);let R=v.useStateSetter(`positionerElement`),B={open:C,side:F.side,align:F.align,anchorHidden:F.anchorHidden,instant:k},V=un(e,B,{styles:F.positionerStyles,transitionStatus:A,props:_,refs:[t,R],hidden:!S,inert:!C});return(0,Q.jsxs)(Ac.Provider,{value:F,children:[S&&L&&(0,Q.jsx)($t,{inert:z(!C),cutout:T}),(0,Q.jsx)(At,{id:b,children:V})]})}),Nc=Z.createContext(void 0);function Pc(){let[e,t]=Z.useState(0),n=Qe(()=>(t(e=>e+1),()=>{t(e=>Math.max(0,e-1))}));return{context:Z.useMemo(()=>({register:n}),[n]),hasClosePart:e>0}}var Fc=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,initialFocus:a,finalFocus:o,...s}=e,c=gc(),l=jc(),u=nn(!0)!=null,{context:d,hasClosePart:f}=Pc(),p=c.useState(`open`),m=c.useState(`openMethod`),h=c.useState(`instantType`),g=c.useState(`transitionStatus`),_=c.useState(`popupProps`),v=c.useState(`titleElementId`),y=c.useState(`descriptionElementId`),b=c.useState(`modal`),x=c.useState(`mounted`),S=c.useState(`openChangeReason`),C=c.useState(`activeTriggerElement`),w=c.useState(`floatingRootContext`),T=w.useState(`floatingId`),E=c.useState(`disabled`),D=c.useState(`openOnHover`),O=c.useState(`closeDelay`);Ke({open:p,ref:c.context.popupRef,onComplete(){p&&c.context.onOpenChangeComplete?.(!0)}}),vn(w,{enabled:D&&!E,closeDelay:O});let k=a===void 0?Pt(c.context.popupRef):a,A=b!==!1&&f;c.useSyncedValue(`focusManagerModal`,A);let j=c.useStateSetter(`popupElement`),M={open:p,side:l.side,align:l.align,instant:h,transitionStatus:g},N=Je(`div`,e,{state:M,ref:[t,c.context.popupRef,j],props:[_,{id:T,role:`dialog`,...Tt,"aria-labelledby":v,"aria-describedby":y,onKeyDown(e){u&&Zt.has(e.key)&&e.stopPropagation()}},fn(g),s],stateAttributesMapping:mt});return(0,Q.jsx)(Lt,{context:w,openInteractionType:m,modal:A,disabled:!x||S===`trigger-hover`,initialFocus:k,returnFocus:o,restoreFocus:`popup`,previousFocusableElement:qe(C)?C:void 0,nextFocusableElement:c.context.triggerFocusTargetRef,beforeContentFocusGuardRef:c.context.beforeContentFocusGuardRef,children:(0,Q.jsx)(Nc.Provider,{value:d,children:N})})}),Ic=2;function Lc({...e}){return(0,Q.jsx)(Sc,{"data-slot":`popover`,...e})}function Rc({...e}){return(0,Q.jsx)(Ec,{"data-slot":`popover-trigger`,...e})}function zc({className:e,children:t,align:n=`center`,alignOffset:r=0,side:i=`bottom`,sideOffset:a=4,...o}){let s=Ht(),c=Math.min(s+Ic,8);return(0,Q.jsx)(kc,{children:(0,Q.jsx)(Mc,{align:n,alignOffset:r,side:i,sideOffset:a,className:`isolate z-50`,children:(0,Q.jsx)(Fc,{"data-slot":`popover-content`,className:q(`z-50 flex w-72 origin-(--transform-origin) flex-col gap-2.5 rounded-lg p-2.5 text-sm text-popover-foreground outline-hidden duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-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 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,Rt(c,3),e),...o,children:(0,Q.jsx)(Ut,{value:c,children:t})})})})}function Bc({trigger:e,children:t,contentId:n,open:r,defaultOpen:i,onOpenChange:a,side:o=`top`,align:s=`start`,sideOffset:c=6,className:l,overlay:u=!1}){let d=(0,Z.useId)(),f=n??d,[p,m]=(0,Z.useState)(i??!1),h=r??p;return(0,Q.jsxs)(Lc,{open:h,onOpenChange:e=>{r===void 0&&m(e),a?.(e)},children:[(0,Z.isValidElement)(e)?(0,Q.jsx)(Rc,{render:e,"aria-controls":f,className:`inline-flex`}):(0,Q.jsx)(Rc,{render:(0,Q.jsx)(V,{type:`button`,variant:`ghost`,children:e}),"aria-controls":f,className:`inline-flex`}),u&&h?(0,Q.jsx)(`div`,{className:`fixed inset-0 z-40 bg-black/20`,"aria-hidden":`true`}):null,(0,Q.jsx)(zc,{id:f,side:o,align:s,sideOffset:c,className:q(`max-h-[min(320px,var(--available-height,320px))] max-w-[calc(100vw-16px)] min-w-[180px] overflow-y-auto overscroll-contain p-1`,l),children:t})]})}function Vc({threads:e,query:t,activeId:n,onQueryChange:r,onSelect:i,className:a,...o}){let s=e.filter(e=>`${e.title} ${e.preview} ${(e.keywords??[]).join(` `)}`.toLowerCase().includes(t.toLowerCase())),c=s.filter(e=>e.pinned),l=[...new Set(s.flatMap(e=>e.pinned?[]:[e.group]))],u=[...c,...l.flatMap(e=>s.filter(t=>!t.pinned&&t.group===e))],[d,f]=(0,Z.useState)(null),p=e=>{if(u.length===0)return;let t=u.findIndex(e=>e.id===d),n=u[((t===-1?e>0?-1:0:t)+e+u.length)%u.length];f(n?n.id:null)},m=e=>{e.nativeEvent.isComposing||(e.key===`ArrowDown`?(e.preventDefault(),p(1)):e.key===`ArrowUp`?(e.preventDefault(),p(-1)):e.key===`Enter`&&d&&(e.preventDefault(),i?.(d)))},h=e=>(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>{f(e.id),i?.(e.id)},className:q(`flex flex-col gap-0.5 rounded-xl px-2 py-1 text-start transition-colors`,e.id===d?`bg-foreground/[0.05]`:e.id===n?`bg-foreground/[0.02] hover:bg-foreground/[0.03]`:`hover:bg-foreground/[0.03]`),children:[(0,Q.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[e.pinned&&(0,Q.jsx)(uo,{className:`text-foreground/30 size-2.5 shrink-0`}),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[13px]`,children:e.title})]}),(0,Q.jsx)(`span`,{className:`text-foreground/35 truncate text-xs`,children:e.preview})]},e.id);return(0,Q.jsxs)(`div`,{"data-slot":`thread-search`,className:q($r,`flex w-full max-w-sm flex-col gap-1.5 rounded-2xl p-3`,a),...o,children:[(0,Q.jsxs)(`div`,{className:q(Zr,`flex items-center gap-2 rounded-xl px-2.5 py-1.5`),children:[(0,Q.jsx)(Vr,{className:`text-foreground/30 size-3.5 shrink-0`}),(0,Q.jsx)(`input`,{value:t,onChange:e=>{f(null),r?.(e.target.value)},onKeyDown:m,placeholder:`Search threads`,"aria-label":`Search threads`,className:`text-foreground/85 placeholder:text-foreground/30 min-w-0 flex-1 bg-transparent text-base outline-none md:text-[13px]`})]}),c.length>0&&(0,Q.jsxs)(`div`,{className:`flex flex-col`,children:[(0,Q.jsx)(`span`,{className:q(`font-mono text-[11px] tracking-tight`,`text-foreground/25 px-2 pb-1`),children:`pinned`}),c.map(h)]}),l.map(e=>(0,Q.jsxs)(`div`,{className:`flex flex-col`,children:[(0,Q.jsx)(`span`,{className:q(Qr,`text-foreground/25 px-2 pb-1`),children:e}),s.flatMap(t=>!t.pinned&&t.group===e?[h(t)]:[])]},e)),s.length===0&&(0,Q.jsxs)(`span`,{className:`text-foreground/30 px-2 py-4 text-center text-xs`,children:[`No thread matches “`,t,`”`]})]})}function Hc(){try{return`0.5.9`}catch{return`dev`}}function Uc(){let e=Hc();return(0,Q.jsxs)(Oi,{variant:`secondary`,title:`Fleet ${e}`,"aria-label":`Fleet version ${e}`,className:`shrink-0 font-mono text-[10px] font-normal text-muted-foreground`,children:[`v`,e]})}var Wc={duration:.16,ease:Ne},Gc=[],Kc=[];function qc(e){return e.kind===`folder`||e.kind===`project`}function Jc(e,t,n=0,r=null){return e.flatMap(e=>{let i={item:e,depth:n,parentId:r};return!e.children?.length||!t.has(e.id)?[i]:[i,...Jc(e.children,t,n+1,e.id)]})}function Yc(e,t){for(let n of e){if(n.id===t)return n;let e=n.children?Yc(n.children,t):void 0;if(e)return e}}function Xc(e,t){return e.id===t||e.children?.some(e=>Xc(e,t))===!0}function Zc(e,t){let n,r=[];for(let i of e){if(i.id===t){n=i;continue}if(i.children?.length){let e=Zc(i.children,t);if(e.removed){n=e.removed,r.push({...i,children:e.items});continue}}r.push(i)}return{items:r,removed:n}}function Qc(e,t,n,r){if(n===null)return[...e,t];let i=[];for(let a of e){if(a.id===n){r===`before`?i.push(t,a):r===`after`?i.push(a,t):i.push({...a,children:[...a.children??[],t]});continue}a.children?.length?i.push({...a,children:Qc(a.children,t,n,r)}):i.push(a)}return i}function $c(e,t){let n=Yc(e,t.itemId);if(!n||n.disabled||t.targetId&&Xc(n,t.targetId))return null;let r=t.targetId?Yc(e,t.targetId):void 0;if(t.position===`inside`&&(!r||r.disabled||!qc(r)))return null;let i=Zc(e,t.itemId);return i.removed?Qc(i.items,i.removed,t.targetId,t.position):null}function el(e,t,n){return e.map(e=>({...e,label:e.id===t?n:e.label,children:e.children?el(e.children,t,n):void 0}))}function tl(e,t){if(e.kind===`action`)return null;let n=e.kind===`folder`||e.kind===`project`?t?Mr:Pr:e.kind===`bookmark`?Xa:vr;return(0,Q.jsx)(n,{className:`size-4`})}function nl({active:e,children:t}){let n=Ge()??!1,r=(0,Z.useRef)(null),i=(0,Z.useRef)(null),[a,o]=(0,Z.useState)(0);(0,Z.useEffect)(()=>{let e=()=>{let e=r.current,t=i.current;!e||!t||o(t.scrollWidth>e.clientWidth?t.scrollWidth+24:0)};e();let t=new ResizeObserver(e);return r.current&&t.observe(r.current),i.current&&t.observe(i.current),()=>t.disconnect()},[]);let s=e&&a>0&&!n;return(0,Q.jsx)(`span`,{ref:r,className:`block min-w-0 flex-1 overflow-hidden`,children:(0,Q.jsxs)(K.span,{className:`flex w-max items-center gap-6 whitespace-nowrap`,animate:{x:s?[0,-a]:0},transition:s?{duration:Math.max(2.4,a/34),ease:`linear`,repeat:1/0,repeatDelay:2}:Wc,children:[(0,Q.jsx)(`span`,{ref:i,children:t}),s?(0,Q.jsx)(`span`,{"aria-hidden":`true`,children:t}):null]})})}function rl({label:e,onCommit:t,onCancel:n}){let[r,i]=(0,Z.useState)(e),a=(0,Z.useRef)(null),o=(0,Z.useRef)(!1);return(0,Z.useEffect)(()=>{o.current=!1,i(e),requestAnimationFrame(()=>{a.current?.focus(),a.current?.select()})},[e]),(0,Q.jsx)(`input`,{ref:a,value:r,"aria-label":`Rename ${e}`,onChange:e=>i(e.target.value),draggable:!1,onClick:e=>e.stopPropagation(),onDoubleClick:e=>e.stopPropagation(),onBlur:()=>{o.current||t(r)},onKeyDown:e=>{e.stopPropagation(),e.key===`Enter`&&(o.current=!0,t(r)),e.key===`Escape`&&(o.current=!0,n())},className:`mx-1 h-7 min-w-0 flex-1 rounded-md border border-border bg-background px-2 text-base text-foreground outline-none focus-visible:ring-2 focus-visible:ring-ring md:text-sm`})}function il({item:e,menuOpen:t,onMenuOpenChange:n,onRenameStart:r,renderMenu:i}){let a=i?.(e,{close:()=>n(!1),rename:()=>{n(!1),r()}})??(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>{n(!1),r()},className:`flex h-8 w-full items-center gap-2 rounded-lg px-2.5 text-left text-xs text-foreground outline-none transition-colors hover:bg-muted focus-visible:bg-muted focus-visible:ring-2 focus-visible:ring-ring`,children:[(0,Q.jsx)(hn,{"aria-hidden":`true`,className:`size-3.5`}),`Rename`]});return(0,Q.jsxs)(ze,{open:t,onOpenChange:n,children:[(0,Q.jsx)(Re,{children:(0,Q.jsx)(`button`,{type:`button`,draggable:!1,tabIndex:-1,"aria-label":`Actions for ${e.label}`,onClick:e=>e.stopPropagation(),className:`grid size-7 shrink-0 place-items-center rounded-lg opacity-0 outline-none transition-opacity hover:bg-foreground/5 focus-visible:opacity-100 focus-visible:ring-2 focus-visible:ring-ring group-hover/resource:opacity-100 group-data-[menu-open=true]/resource:opacity-100`,children:(0,Q.jsx)(no,{"aria-hidden":`true`,className:`size-4`})})}),(0,Q.jsx)(Ve,{side:`bottom`,align:`end`,sideOffset:8,radius:12,className:`w-40 p-1.5`,children:(0,Q.jsx)(`div`,{"data-sidebar-resource-menu":e.id,children:a})})]})}function al(e,t,n,r,i){return q(`group/resource relative flex min-h-8 min-w-0 cursor-pointer items-center gap-2 rounded-lg pr-2 text-[13px] outline-none`,`text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`,`focus-visible:bg-muted/70 focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset`,`data-[menu-open=true]:bg-muted data-[menu-open=true]:text-foreground`,`data-[dragging=true]:opacity-40`,`data-[drop=inside]:bg-primary/10 data-[drop=inside]:ring-1 data-[drop=inside]:ring-primary/45`,`data-[drop=before]:before:absolute data-[drop=before]:before:-top-0.5 data-[drop=before]:before:right-2 data-[drop=before]:before:left-2 data-[drop=before]:before:h-0.5 data-[drop=before]:before:rounded-full data-[drop=before]:before:bg-primary`,`data-[drop=after]:after:absolute data-[drop=after]:after:-bottom-0.5 data-[drop=after]:after:right-2 data-[drop=after]:after:left-2 data-[drop=after]:after:h-0.5 data-[drop=after]:after:rounded-full data-[drop=after]:after:bg-primary`,!e&&t&&`bg-muted text-foreground`,e&&n&&`bg-muted/55 text-foreground ring-1 ring-border/70`,r===`action`&&`text-xs text-muted-foreground`,i&&`cursor-not-allowed opacity-45`)}function ol({acceptsChildren:e,allowMove:t,disabled:n,kind:r,onContainerSelect:i,onDragEnd:a,onDragOver:o,onDragStart:s,onDrop:c,onRenameStart:l,onSelect:u,renaming:d,row:f}){let p=(0,Z.useRef)(!1);return{handleClick:t=>{t.defaultPrevented||p.current||d||n||(e?i():u())},handleDoubleClick:t=>{e||r===`action`||n||(t.preventDefault(),l())},handleDragStartCapture:e=>{t&&(p.current=!0,s(e,f.item.id))},handleDragEndCapture:()=>{a(),requestAnimationFrame(()=>{p.current=!1})},handleDragOver:e=>{t&&o(e,f)},handleDrop:e=>{t&&c(e)}}}function sl({icon:e,renaming:t,label:n,onCommit:r,onCancel:i,activeLabel:a,item:o,secondaryAction:s,menuOpen:c,onMenuOpenChange:l,onRenameStart:u,renderMenu:d}){return t?(0,Q.jsxs)(Q.Fragment,{children:[e!==null&&(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`grid size-4 shrink-0 place-items-center`,children:e}),(0,Q.jsx)(rl,{label:n,onCommit:r,onCancel:i})]}):(0,Q.jsxs)(Q.Fragment,{children:[e!==null&&(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`grid size-4 shrink-0 place-items-center`,children:e}),(0,Q.jsx)(nl,{active:a,children:n}),s,!o.disabled&&o.kind!==`action`&&(0,Q.jsx)(il,{item:o,menuOpen:c,onMenuOpenChange:l,onRenameStart:u,renderMenu:d})]})}function cl(e,t,n,r,i,a,o,s,c,l){return{"aria-level":e.depth+1,"aria-selected":t?void 0:n,"aria-expanded":t?r:void 0,"aria-disabled":e.item.disabled||void 0,tabIndex:i?0:-1,draggable:a&&!e.item.disabled&&!o,"data-menu-open":s||void 0,"data-kind":e.item.kind,"data-drop":c??void 0,"data-dragging":l||void 0}}function ll(e){let t=Ge()??!1,[n,r]=(0,Z.useState)(!1),i=qc(e.row.item),a=e.renderIcon?.(e.row.item),o=a===void 0?tl(e.row.item,e.expanded):a,s=e.draggingId===e.row.item.id,c=e.dropTarget?.id===e.row.item.id?e.dropTarget.position:null,l=ol({acceptsChildren:i,allowMove:e.allowMove,disabled:e.row.item.disabled,kind:e.row.item.kind,onContainerSelect:e.onContainerSelect,onDragEnd:e.onDragEnd,onDragOver:e.onDragOver,onDragStart:e.onDragStart,onDrop:e.onDrop,onRenameStart:e.onRenameStart,onSelect:e.onSelect,renaming:e.renaming,row:e.row}),u=cl(e.row,i,e.active,e.expanded,e.focused,e.allowMove,e.renaming,e.menuOpen,c,s);return(0,Q.jsx)(K.div,{ref:e.setRef,layout:`position`,transition:t?{duration:0}:je,role:`treeitem`,...u,onFocus:e.onFocus,onKeyDown:e.onKeyDown,onClick:l.handleClick,onDoubleClick:l.handleDoubleClick,onMouseEnter:()=>r(!0),onMouseLeave:()=>r(!1),onDragStartCapture:l.handleDragStartCapture,onDragEndCapture:l.handleDragEndCapture,onDragOver:l.handleDragOver,onDrop:l.handleDrop,className:al(i,e.active,e.containerActive,e.row.item.kind,e.row.item.disabled),style:{paddingLeft:`${8+(e.row.depth+(e.row.item.indent??0))*14}px`},children:(0,Q.jsx)(sl,{icon:o,renaming:e.renaming,label:e.row.item.label,onCommit:e.onRenameCommit,onCancel:e.onRenameCancel,activeLabel:n||e.menuOpen,item:e.row.item,secondaryAction:e.renaming?null:e.renderSecondaryAction?.(e.row.item),menuOpen:e.menuOpen,onMenuOpenChange:e.onMenuOpenChange,onRenameStart:e.onRenameStart,renderMenu:e.renderMenu})})}function ul({flat:e,selectedId:t,activeContainerId:n,expandedIds:r,focusedId:i,draggingId:a,dropTarget:o,menuOpenId:s,renamingId:c,allowMove:l,announcement:u,ariaLabel:d,className:f,renderIcon:p,renderSecondaryAction:m,renderMenu:h,onFocus:g,onSelect:_,onContainerSelect:v,onKeyDown:y,onRenameStart:b,onRenameCancel:x,onRenameCommit:S,onMenuOpenChange:C,onDragStart:w,onDragEnd:T,onDragOver:E,onRootDragOver:D,onDrop:O,setRef:k}){return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{role:`tree`,"aria-label":d,"aria-multiselectable":`false`,onDragOver:D,onDrop:O,className:q(`relative flex min-w-0 flex-col gap-0.5 [overflow-anchor:none] group-data-[state=collapsed]/sidebar:hidden`,a&&`select-none pb-9`,f),children:[(0,Q.jsx)(We,{initial:!1,children:e.map(e=>(0,Q.jsx)(ll,{row:e,active:t===e.item.id,containerActive:n===e.item.id,expanded:r.has(e.item.id),focused:i===e.item.id,draggingId:a,dropTarget:o,menuOpen:s===e.item.id,renaming:c===e.item.id,onFocus:()=>g(e.item.id),onSelect:()=>_(e.item.id),onContainerSelect:()=>v(e.item.id),allowMove:l,onKeyDown:t=>y(t,e),onRenameStart:()=>b(e.item.id),onRenameCancel:x,onRenameCommit:t=>S(e,t),onMenuOpenChange:t=>C(e.item.id,t),onDragStart:w,onDragEnd:T,onDragOver:(e,t)=>E(e,t),onDrop:O,renderIcon:p,renderSecondaryAction:m,renderMenu:h,setRef:t=>k(e.item.id,t)},e.item.id))}),a?(0,Q.jsx)(`div`,{"aria-hidden":`true`,"data-active":o?.id===null||void 0,className:`absolute inset-x-1 bottom-0 flex h-8 items-center justify-center rounded-lg border border-dashed border-border text-[10px] text-muted-foreground data-[active=true]:border-primary/50 data-[active=true]:bg-primary/10 data-[active=true]:text-foreground`,children:`Move to top level`}):null]}),(0,Q.jsx)(`span`,{className:`sr-only`,"aria-live":`polite`,children:u})]})}function dl({expandedIds:e,flat:t,focusRow:n,onContainerSelect:r,performMove:i,select:a,setMenuOpenId:o,setRenamingId:s,toggle:c,updateExpandedIds:l}){return(0,Z.useCallback)((u,d)=>{let f=t.findIndex(({item:e})=>e.id===d.item.id),p=t[f-1],m=t[f+1],h=u.altKey&&u.shiftKey;if(u.key===`ArrowDown`&&!h&&m){u.preventDefault(),n(m.item.id);return}if(u.key===`ArrowUp`&&!h&&p){u.preventDefault(),n(p.item.id);return}if(u.key===`Home`&&t[0]){u.preventDefault(),n(t[0].item.id);return}if(u.key===`End`&&t.at(-1)){u.preventDefault(),n(t.at(-1)?.item.id??d.item.id);return}if(d.item.disabled){u.key===`ArrowLeft`&&d.parentId?(u.preventDefault(),n(d.parentId)):(h||[`ArrowRight`,`Enter`,` `,`F2`,`ContextMenu`].includes(u.key)||u.shiftKey&&u.key===`F10`)&&u.preventDefault();return}if(h&&u.key===`ArrowUp`&&p){u.preventDefault(),i({itemId:d.item.id,targetId:p.item.id,position:`before`});return}if(h&&u.key===`ArrowDown`&&m){u.preventDefault(),i({itemId:d.item.id,targetId:m.item.id,position:`after`});return}if(h&&u.key===`ArrowRight`&&p&&qc(p.item)){u.preventDefault(),l(e=>new Set(e).add(p.item.id)),i({itemId:d.item.id,targetId:p.item.id,position:`inside`});return}if(h&&u.key===`ArrowLeft`&&d.parentId){u.preventDefault(),i({itemId:d.item.id,targetId:d.parentId,position:`after`});return}u.key===`ArrowRight`&&qc(d.item)?(u.preventDefault(),e.has(d.item.id)?m?.parentId===d.item.id&&n(m.item.id):c(d.item.id)):u.key===`ArrowLeft`?(u.preventDefault(),e.has(d.item.id)?c(d.item.id):d.parentId&&n(d.parentId)):u.key===`Enter`||u.key===` `?(u.preventDefault(),qc(d.item)?r?r(d.item.id):c(d.item.id):a(d.item.id)):u.key===`F2`&&d.item.kind!==`action`?(u.preventDefault(),s(d.item.id)):(u.key===`ContextMenu`||u.shiftKey&&u.key===`F10`)&&(u.preventDefault(),o(d.item.id))},[e,t,n,r,i,a,o,s,c,l])}function fl({items:e,defaultItems:t=Gc,onItemsChange:n,onMove:r,onMoveError:i,allowMove:a=!0,onRename:o,activeId:s,activeContainerId:c,defaultActiveId:l=null,onActiveChange:u,onContainerSelect:d,expandedIds:f,defaultExpandedIds:p=Kc,onExpandedIdsChange:m,renderIcon:h,renderSecondaryAction:g,renderMenu:_,ariaLabel:v=`Resources`,className:y}){let[b,x]=(0,Z.useState)(e??t),[S,C]=(0,Z.useState)(l),[w,T]=(0,Z.useState)(()=>new Set(p)),[E,D]=(0,Z.useState)(s??l),[O,k]=(0,Z.useState)(null),[A,j]=(0,Z.useState)(null),[M,N]=(0,Z.useState)(null),[P,F]=(0,Z.useState)(null),[I,L]=(0,Z.useState)(``),R=(0,Z.useRef)(new Map),z=(0,Z.useRef)(!1),B=b,V=s??S,H=(0,Z.useMemo)(()=>f===void 0?w:new Set(f),[f,w]);(0,Z.useEffect)(()=>{e&&x(e)},[e]),(0,Z.useEffect)(()=>{f===void 0&&p.length!==0&&T(e=>{let t=new Set(e),n=!1;for(let e of p)t.has(e)||(t.add(e),n=!0);return n?t:e})},[f,p]);let U=(0,Z.useMemo)(()=>Jc(B,H),[H,B]);(0,Z.useEffect)(()=>{E&&U.some(e=>e.item.id===E)||D(U[0]?.item.id??null)},[U,E]),(0,Z.useEffect)(()=>{if(!M)return;let e=requestAnimationFrame(()=>{Array.from(document.querySelectorAll(`[data-sidebar-resource-menu]`)).find(e=>e.dataset.sidebarResourceMenu===M)?.querySelector(`button, a[href]`)?.focus()});return()=>cancelAnimationFrame(e)},[M]);let W=(0,Z.useCallback)(e=>{x(e),n?.(e)},[n]),G=(0,Z.useCallback)(async e=>{if(z.current){L(`Wait for the current move to finish.`);return}let t=B,n=$c(t,e);if(!n||n===t)return;z.current=!0,W(n),j(null),k(null);let a=Yc(t,e.itemId),o=e.targetId?Yc(t,e.targetId):null;L(o?`Moved ${a?.label??`item`} ${e.position} ${o.label}.`:`Moved ${a?.label??`item`} to the top level.`);try{await r?.(e)}catch(n){W(t),L(`Move failed. ${a?.label??`Item`} was restored.`),i?.(n,e)}finally{z.current=!1}},[r,i,B,W]),ee=(0,Z.useCallback)(e=>{D(e),requestAnimationFrame(()=>R.current.get(e)?.focus())},[]),te=(0,Z.useCallback)(e=>{s===void 0&&C(e),u?.(e)},[s,u]),ne=(0,Z.useCallback)(e=>{let t=e(new Set(H));f===void 0&&T(t),m?.([...t])},[f,H,m]),re=(0,Z.useCallback)(e=>{ne(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[ne]),ie=dl({expandedIds:H,flat:U,focusRow:ee,onContainerSelect:d,performMove:G,select:te,setMenuOpenId:N,setRenamingId:F,toggle:re,updateExpandedIds:ne});return(0,Q.jsx)(ul,{flat:U,selectedId:V,activeContainerId:c,expandedIds:H,focusedId:E,draggingId:O,dropTarget:A,menuOpenId:M,renamingId:P,allowMove:a,announcement:I,ariaLabel:v,className:y,renderIcon:h,renderSecondaryAction:g,renderMenu:_,onFocus:D,onSelect:te,onContainerSelect:e=>{d?d(e):re(e)},onKeyDown:ie,onRenameStart:F,onRenameCancel:()=>F(null),onRenameCommit:(e,t)=>{let n=t.trim();if(F(null),!n||n===e.item.label)return;let r=B;W(el(r,e.item.id,n)),Promise.resolve(o?.(e.item,n)).catch(()=>{W(r),L(`Rename failed. ${e.item.label} was restored.`)})},onMenuOpenChange:(e,t)=>{N(t?e:null),t||ee(e)},onDragStart:(e,t)=>{k(t),e.dataTransfer.effectAllowed=`move`,e.dataTransfer.setData(`text/plain`,t)},onDragEnd:()=>{k(null),j(null)},onDragOver:(e,t)=>{if(!O||O===t.item.id)return;let n=Yc(B,O);if(n&&Xc(n,t.item.id))return;e.preventDefault(),e.stopPropagation();let r=e.currentTarget.getBoundingClientRect(),i=(e.clientY-r.top)/r.height,a=!t.item.disabled&&qc(t.item)&&i>=.25&&i<=.75?`inside`:i<.5?`before`:`after`;j({id:t.item.id,position:a})},onRootDragOver:e=>{!O||e.target!==e.currentTarget||(e.preventDefault(),j({id:null,position:`after`}))},onDrop:e=>{e.preventDefault(),e.stopPropagation(),O&&A&&G({itemId:O,targetId:A.id,position:A.position})},setRef:(e,t)=>{t?R.current.set(e,t):R.current.delete(e)}})}var pl=5,ml=[`a[href]`,`button:not([disabled])`,`input:not([disabled])`,`select:not([disabled])`,`textarea:not([disabled])`,`[tabindex]:not([tabindex="-1"])`].join(`,`);function hl(e,t){let n=e-(t-1)/2,r=Math.abs(n),i=Math.max(0,2-r)*8;return{x:n*44,y:8-i,rotate:n*6,scale:r===0?1.04:r===1?.95:.88,opacity:r===0?1:r===1?.78:.58,zIndex:10-r}}function gl({title:e,countText:t,dialogTitleId:n,previewItems:r,isExpanded:i,isClosing:a,reduce:o,transition:s,dialogRef:c,closeButtonRef:l,closeOverlay:u}){return!i&&!a?null:(0,Q.jsxs)(`div`,{ref:c,role:`dialog`,"aria-modal":`true`,"aria-labelledby":n,"aria-hidden":i?void 0:`true`,className:q(`fixed inset-0 z-50 flex items-start justify-center overflow-y-auto sm:items-center`,a&&`pointer-events-none`),children:[(0,Q.jsx)(We,{initial:!1,children:i?(0,Q.jsx)(K.button,{type:`button`,tabIndex:-1,"aria-label":`Close file overlay`,onClick:u,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:o?{duration:0}:{duration:.18},className:`absolute inset-0 cursor-default bg-background/80 backdrop-blur-xl`},`project-files-backdrop`):null}),(0,Q.jsxs)(`div`,{className:`relative z-10 w-full max-w-5xl px-6 py-8`,children:[(0,Q.jsx)(We,{initial:!1,children:i?(0,Q.jsxs)(K.div,{initial:{opacity:0,y:o?0:8},animate:{opacity:1,y:0},exit:{opacity:0,y:o?0:-8},transition:o?{duration:0}:{duration:.18},className:`mb-6 flex items-center justify-between gap-4`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h2`,{id:n,className:`text-xl font-medium text-foreground`,children:e}),(0,Q.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:t})]}),(0,Q.jsx)(`button`,{ref:l,type:`button`,onClick:u,"aria-label":`Close ${e}`,className:`flex size-10 items-center justify-center rounded-full border border-foreground/10 bg-background/50 text-muted-foreground backdrop-blur-xl transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,children:(0,Q.jsx)(Wr,{className:`size-4`,"aria-hidden":`true`})})]},`project-files-header`):null}),(0,Q.jsx)(`div`,{className:`grid grid-cols-2 place-items-center gap-3 sm:grid-cols-3 lg:grid-cols-5`,children:i?r.map(e=>(0,Q.jsx)(K.div,{layoutId:`file-${e.id}`,transition:s,className:`aspect-[3/4] w-full max-w-40 overflow-hidden rounded-xl border border-foreground/10 bg-background/50 backdrop-blur-xl`,children:e.content},e.id)):null})]})]})}function _l({title:e,description:t=`Updated recently`,previews:n=[],count:r=n.length,itemLabel:i=`file`,open:a,defaultOpen:o=!1,onOpenChange:s,expanded:c,defaultExpanded:l=!1,onExpandedChange:u,onClick:d,disabled:f=!1,ariaLabel:p,className:m}){let h=Ge(),g=Gn(),_=(0,Z.useId)(),v=`${_}-title`,y=(0,Z.useRef)(!1),b=(0,Z.useRef)(!1),x=(0,Z.useRef)(!1),S=(0,Z.useRef)(null),C=(0,Z.useRef)(null),w=(0,Z.useRef)(null),T=Ie(),[E,D]=(0,Z.useState)(o),[O,k]=(0,Z.useState)(l),[A,j]=(0,Z.useState)(!1),M=a!==void 0,N=c!==void 0,P=c??O,F=(a??E)||P,I=n.slice(0,pl),L=h?{duration:0}:je,R=`${r} ${i}${r===1?``:`s`}`,z=(0,Z.useCallback)(e=>{f||(M||D(e),s?.(e))},[f,s,M]),B=(0,Z.useCallback)(e=>{f||I.length===0||(N||k(e),u?.(e))},[f,N,u,I.length]),V=(0,Z.useCallback)(()=>{j(!1),x.current=!0,requestAnimationFrame(()=>S.current?.focus())},[]),H=(0,Z.useCallback)(()=>{j(!0),z(!1),B(!1)},[B,z]),U=(0,Z.useEffectEvent)(H);(0,Z.useEffect)(()=>{h&&A&&V()},[V,A,h]),(0,Z.useEffect)(()=>{if(!P)return;let e=document.body.style.overflow,t=requestAnimationFrame(()=>C.current?.focus());document.body.style.overflow=`hidden`;let n=e=>{if(e.key===`Escape`){e.preventDefault(),U();return}if(e.key!==`Tab`||!w.current)return;let t=Array.from(w.current.querySelectorAll(ml)).filter(e=>e.tabIndex>=0),n=t[0],r=t.at(-1);!n||!r||(e.shiftKey&&document.activeElement===n?(e.preventDefault(),r.focus()):!e.shiftKey&&document.activeElement===r&&(e.preventDefault(),n.focus()))};return document.addEventListener(`keydown`,n),()=>{cancelAnimationFrame(t),document.body.style.overflow=e,document.removeEventListener(`keydown`,n)}},[P]);let W=()=>{j(!1),B(!0),z(!0),d?.()},G=(0,Q.jsx)(gl,{title:e,countText:R,dialogTitleId:v,previewItems:I,isExpanded:P,isClosing:A,reduce:h??!1,transition:L,dialogRef:w,closeButtonRef:C,closeOverlay:H});return(0,Q.jsxs)(Sa,{id:_,children:[(0,Q.jsxs)(K.button,{ref:S,type:`button`,disabled:f,"aria-label":p,"aria-haspopup":`dialog`,"aria-expanded":P,"data-open":F?`true`:`false`,"data-expanded":P?`true`:`false`,tabIndex:P?-1:void 0,onPointerEnter:()=>{g&&(y.current=!0,z(!0))},onPointerLeave:()=>{g&&(y.current=!1,!P&&!A&&z(b.current))},onFocus:()=>{if(x.current){x.current=!1,b.current=!1;return}b.current=!0,z(!0)},onBlur:()=>{b.current=!1,!P&&!A&&z(y.current)},onClick:W,whileTap:h||f?void 0:{scale:.98},transition:h?{duration:0}:Oe,className:q(`relative block h-56 w-72 select-none rounded-2xl text-left outline-none [perspective:1200px] focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-4 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50`,m),children:[(0,Q.jsx)(K.span,{"aria-hidden":`true`,animate:{rotateX:F&&!h?15:0},transition:L,className:`absolute inset-0 rounded-2xl border border-foreground/10 bg-background/25 backdrop-blur-xl [transform-origin:center_bottom]`}),(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`pointer-events-none absolute inset-0`,children:(0,Q.jsx)(`span`,{className:`absolute left-1/2 top-0 block h-0 w-0`,children:(0,Q.jsx)(We,{initial:!1,children:P?null:I.map((e,t)=>{let n=hl(t,I.length);return(0,Q.jsx)(K.span,{layoutId:`file-${e.id}`,initial:!1,animate:F&&!h?{x:n.x*1.4,y:n.y-8,rotate:n.rotate*1.3,scale:n.scale*1.02,opacity:Math.min(1,n.opacity+.18)}:{x:n.x,y:n.y,rotate:n.rotate,scale:n.scale,opacity:n.opacity},transition:L,onLayoutAnimationComplete:()=>{A&&t===0&&V()},className:`absolute left-0 top-0 -ml-12 block h-40 w-24 overflow-hidden rounded-lg border border-foreground/10 bg-background/45 backdrop-blur-lg`,style:{zIndex:n.zIndex},children:e.content},e.id)})})})}),(0,Q.jsxs)(K.span,{initial:!1,animate:{rotateX:F&&!h?-25:0},transition:L,className:`absolute inset-x-0 bottom-0 z-20 overflow-hidden rounded-2xl border border-foreground/10 bg-background/60 backdrop-blur-2xl [backface-visibility:hidden] [transform-origin:center_bottom]`,children:[(0,Q.jsx)(`span`,{className:`flex h-16 items-center px-4`,children:(0,Q.jsx)(`span`,{className:`line-clamp-2 text-xl font-medium leading-tight text-foreground`,children:e})}),(0,Q.jsxs)(`span`,{className:`flex h-12 items-center justify-between gap-3 border-t border-foreground/10 px-4`,children:[(0,Q.jsx)(`span`,{className:`shrink-0 text-sm font-medium text-foreground/70`,children:R}),(0,Q.jsx)(`span`,{className:`truncate text-sm text-muted-foreground`,children:t})]})]})]}),T?(0,ps.createPortal)(G,document.body):null]})}function vl(e){return e?.status===`running`?(0,Q.jsx)(mr,{className:`size-3.5 animate-spin`}):e?.status===`failed`?(0,Q.jsx)(Ur,{className:`size-3.5 text-destructive`}):e?.status===`interrupted`?(0,Q.jsx)($a,{className:`size-3.5 text-muted-foreground`}):null}function yl({projectActionsOpen:e,setProjectActionsOpen:t,expandedProjectIds:n,setExpandedProjectIds:r,setCreateOpen:i,projects:a,projectSessions:o,sidebarItems:s,activeProjectId:c,activeSessionId:l,onNewSession:u,onNewSessionInProject:d,onProjectSelect:f,onRenameSession:p,onCreateProject:m,resumeResource:h,toggleProjectResource:g,renderMenu:_}){return(0,Q.jsx)(Rs,{className:`gap-0 px-2 pb-1 pt-2`,children:(0,Q.jsxs)(Bs,{className:`p-0`,children:[(0,Q.jsxs)(`div`,{className:`relative mb-1 h-8`,children:[(0,Q.jsx)(Vs,{className:`mb-0 h-8 pr-16 text-xs font-normal normal-case tracking-normal text-muted-foreground`,children:`Projects`}),(0,Q.jsxs)(`div`,{className:`absolute inset-y-0 right-1 flex items-center gap-0.5`,children:[(0,Q.jsxs)(Bc,{open:e,onOpenChange:t,side:`bottom`,align:`end`,className:`w-44 p-1`,trigger:(0,Q.jsx)(`button`,{type:`button`,"aria-label":`Project actions`,title:`Project actions`,className:`grid size-6 place-items-center rounded-md text-muted-foreground outline-none transition-colors hover:bg-muted hover:text-foreground focus-visible:ring-2 focus-visible:ring-sidebar-ring`,children:(0,Q.jsx)(no,{"aria-hidden":`true`,className:`size-3.5`})}),children:[m?(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>{t(!1),i(!0)},className:`flex h-8 w-full items-center gap-2 rounded-md px-2 text-xs outline-none hover:bg-muted focus-visible:bg-muted`,children:[(0,Q.jsx)(io,{"aria-hidden":`true`,className:`size-3.5`}),`Add project`]}):null,(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>{t(!1),r([])},className:`flex h-8 w-full items-center gap-2 rounded-md px-2 text-xs outline-none hover:bg-muted focus-visible:bg-muted`,children:[(0,Q.jsx)(Qn,{"aria-hidden":`true`,className:`size-3.5`}),`Collapse all`]})]}),m?(0,Q.jsx)(`button`,{type:`button`,"aria-label":`Add project`,title:`Add project`,onClick:()=>i(!0),className:`grid size-6 place-items-center rounded-md text-muted-foreground outline-none transition-colors hover:bg-muted hover:text-foreground focus-visible:ring-2 focus-visible:ring-sidebar-ring`,children:(0,Q.jsx)(Lr,{"aria-hidden":`true`,className:`size-3.5`})}):null]})]}),(0,Q.jsx)(Hs,{children:a.length===0?(0,Q.jsx)(`div`,{className:`px-2 py-4`,children:(0,Q.jsx)(_l,{title:`Add a project`,description:`Choose a local directory for Fleet Prime.`,count:0,itemLabel:`session`,previews:[{id:`empty-project`,content:(0,Q.jsx)(io,{className:`size-5 text-muted-foreground`})}],onClick:()=>i(!0),ariaLabel:`Add a project`,className:`w-full`})}):(0,Q.jsx)(fl,{items:s,activeId:l?Zs(l):null,activeContainerId:c?Xs(c):null,expandedIds:n,onExpandedIdsChange:r,onActiveChange:h,onContainerSelect:g,onRename:(e,t)=>{let n=$s(e.id,Ys);n&&p(n,t)},renderMenu:_,renderIcon:e=>{if($s(e.id,`project:`))return(0,Q.jsx)(Pr,{className:`size-4`});if(e.kind===`action`)return null;let t=$s(e.id,Ys);return vl(o.find(e=>e.sessionId===t))},renderSecondaryAction:e=>{let t=$s(e.id,Js);return!t||t===`unassigned`?null:(0,Q.jsx)(V,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":`New chat in ${e.label}`,title:`New chat in ${e.label}`,onClick:e=>{e.stopPropagation(),d?d(t):(f?.(t),u())},className:`size-7 shrink-0 opacity-0 group-hover/resource:opacity-100 group-focus-within/resource:opacity-100 focus-visible:opacity-100 [@media(hover:none)]:opacity-100`,children:(0,Q.jsx)(so,{"data-icon":`inline-start`,className:`size-3.5`})})},allowMove:!1,ariaLabel:`Projects and sessions`,className:`px-0`})})]})})}var bl=`flex h-8 w-full items-center gap-2 rounded-md px-2 text-xs outline-none transition-colors hover:bg-muted focus-visible:bg-muted`;function xl({icon:e,label:t,onClick:n,href:r}){return r?(0,Q.jsxs)(`a`,{href:r,target:`_blank`,rel:`noreferrer`,className:bl,children:[(0,Q.jsx)(e,{className:`size-3.5`}),t]}):(0,Q.jsxs)(`button`,{type:`button`,onClick:n,className:bl,children:[(0,Q.jsx)(e,{className:`size-3.5`}),t]})}function Sl({children:e}){return(0,Q.jsx)(`kbd`,{className:`rounded border border-border/60 bg-muted/60 px-1 font-mono text-[10px] leading-4 text-muted-foreground`,children:e})}function Cl({brandMenuOpen:e,setBrandMenuOpen:t,searchOpen:n,setSearchOpen:r,query:i,setQuery:a,projectActionsOpen:o,setProjectActionsOpen:s,expandedProjectIds:c,setExpandedProjectIds:l,setCreateOpen:u,projects:d,projectSessions:f,sidebarItems:p,sortedProjects:m,projectById:h,activeProjectId:g,activeSessionId:_,onNewSession:v,onNewSessionInProject:y,onProjectSelect:b,onRenameSession:x,onCreateProject:S,onOpenSettings:C,accountMenu:w,resumeResource:T,toggleProjectResource:E,selectSearchResult:D,renderMenu:O}){let k=(0,Z.useMemo)(()=>lc(f).map(e=>({id:e.sessionId,title:ec(e),preview:tc(e,h),group:nc(e.updatedAt),keywords:e.firstMessage?[kr(e.firstMessage)]:[]})),[h,f]),A=(0,Z.useMemo)(()=>{let e=i.trim().toLowerCase();return e?m.filter(t=>`${t.name} ${t.pathLabel}`.toLowerCase().includes(e)):m},[i,m]);return(0,Q.jsx)(Ns,{ariaLabel:`Fleet projects and sessions`,collapsible:`offcanvas`,variant:`floating`,className:`text-sidebar-foreground`,children:(0,Q.jsxs)(Ut,{value:2,children:[(0,Q.jsxs)(Ls,{className:`gap-2 border-0 px-2.5 pb-2 pt-2.5`,children:[(0,Q.jsxs)(`div`,{className:`relative flex h-9 min-w-0 items-center justify-between gap-1`,children:[(0,Q.jsxs)(Bc,{open:e,onOpenChange:t,side:`bottom`,align:`start`,trigger:(0,Q.jsxs)(`button`,{type:`button`,className:`flex h-8 w-fit shrink-0 items-center gap-1 rounded-lg px-2 text-left text-sm font-medium outline-none transition-colors hover:bg-sidebar-accent focus-visible:ring-2 focus-visible:ring-sidebar-ring`,children:[(0,Q.jsx)(`span`,{className:`truncate`,children:`Qredence Fleet`}),(0,Q.jsx)(Qn,{className:`size-3.5 text-muted-foreground`})]}),className:`w-52 p-1`,children:[S?(0,Q.jsx)(xl,{icon:io,label:`Add project`,onClick:()=>{t(!1),u(!0)}}):null,(0,Q.jsx)(xl,{icon:yn,label:`Settings`,onClick:()=>{t(!1),C?.()}}),(0,Q.jsx)(xl,{icon:Jn,label:`Documentation`,href:Ws})]}),(0,Q.jsx)(Bc,{open:n,onOpenChange:r,side:`bottom`,align:`end`,className:`w-64 p-0`,trigger:(0,Q.jsx)(V,{type:`button`,variant:`ghost`,size:`icon`,"aria-label":`Search projects and sessions`,title:`Search projects and sessions`,className:`shrink-0 text-muted-foreground hover:bg-sidebar-accent`,children:(0,Q.jsx)(Vr,{"data-icon":`inline-start`,className:`size-4`})}),children:(0,Q.jsxs)(`div`,{className:`max-h-[min(32rem,calc(100vh-5rem))] overflow-y-auto`,children:[(0,Q.jsx)(Vc,{threads:k,query:i,activeId:_??``,onQueryChange:a,onSelect:e=>D(`search-session:${e}`),className:`max-w-none rounded-none border-0 bg-transparent p-2 shadow-none`}),(0,Q.jsxs)(`div`,{className:`border-t border-border/60 px-2 pb-2 pt-1.5`,children:[(0,Q.jsx)(`span`,{className:`px-2 pb-1 font-mono text-[10px] uppercase tracking-[0.14em] text-muted-foreground/60`,children:`Projects`}),(0,Q.jsxs)(`div`,{className:`mt-1 flex flex-col gap-0.5`,children:[A.map(e=>(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>D(`search-project:${e.projectId}`),className:`flex w-full min-w-0 items-center gap-2 rounded-xl px-2 py-1.5 text-left text-xs outline-none transition-colors hover:bg-foreground/[0.03] focus-visible:ring-2 focus-visible:ring-ring`,children:[(0,Q.jsx)(Pr,{className:`size-3.5 shrink-0 text-muted-foreground/60`}),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.name}),(0,Q.jsx)(`span`,{className:`max-w-24 truncate text-[10px] text-muted-foreground/55`,children:e.pathLabel})]},e.projectId)),A.length===0?(0,Q.jsxs)(`span`,{className:`px-2 py-2 text-center text-[11px] text-muted-foreground/60`,children:[`No project matches “`,i,`”`]}):null]})]}),(0,Q.jsxs)(`div`,{className:`flex items-center justify-end gap-3 border-t border-border/60 px-3 py-2 text-[10px] text-muted-foreground/70`,children:[(0,Q.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,Q.jsx)(Sl,{children:`↑`}),(0,Q.jsx)(Sl,{children:`↓`}),`navigate`]}),(0,Q.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,Q.jsx)(Sl,{children:`↵`}),`open`]}),(0,Q.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,Q.jsx)(Sl,{children:`esc`}),`close`]})]})]})})]}),(0,Q.jsxs)(`button`,{type:`button`,onClick:v,className:`flex h-8 w-full items-center justify-start gap-2 rounded-lg px-2 text-[13px] font-normal text-sidebar-foreground outline-none transition-colors hover:bg-sidebar-accent focus-visible:bg-sidebar-accent focus-visible:ring-2 focus-visible:ring-sidebar-ring`,children:[(0,Q.jsx)(po,{className:`size-4 shrink-0 text-muted-foreground`}),`New chat`]})]}),(0,Q.jsx)(yl,{projectActionsOpen:o,setProjectActionsOpen:s,expandedProjectIds:c,setExpandedProjectIds:l,setCreateOpen:u,projects:d,projectSessions:f,sidebarItems:p,activeProjectId:g,activeSessionId:_,onNewSession:v,onNewSessionInProject:y,onProjectSelect:b,onRenameSession:x,onCreateProject:S,resumeResource:T,toggleProjectResource:E,renderMenu:O}),(0,Q.jsxs)(zs,{className:`flex-row items-center gap-1 border-sidebar-border px-2.5 py-2 pb-[max(0.5rem,env(safe-area-inset-bottom))]`,children:[(0,Q.jsx)(`div`,{className:`min-w-0 flex-1`,children:w??(0,Q.jsx)(`span`,{className:`flex h-8 items-center px-2 text-[13px]`,children:`Qredence`})}),(0,Q.jsx)(Uc,{}),(0,Q.jsx)(`a`,{href:Ws,target:`_blank`,rel:`noreferrer`,"aria-label":`Open Qredence documentation`,title:`Help`,className:`grid size-8 shrink-0 place-items-center rounded-lg text-muted-foreground outline-none transition-colors hover:bg-sidebar-accent hover:text-foreground focus-visible:ring-2 focus-visible:ring-sidebar-ring`,children:(0,Q.jsx)(Qa,{className:`size-4`})})]}),(0,Q.jsx)(Fs,{})]})})}var wl=(e,t,n)=>{let r=t.trim().toLocaleLowerCase();if(!r)return!0;let i=[e,...n].join(` `).toLocaleLowerCase(),a=0;for(let e of i)if(e===r[a]&&(a+=1),a===r.length)return!0;return!1},Tl=(0,Z.createContext)(null),El=(0,Z.createContext)(null);function Dl(e){let t=(0,Z.useContext)(Tl);if(!t)throw Error(`${e} must be used within <Combobox>`);return t}function Ol(...e){return t=>{for(let n of e)typeof n==`function`?n(t):n&&typeof n==`object`&&(n.current=t)}}function kl({children:e,value:t,defaultValue:n,onValueChange:r,open:i,defaultOpen:a=!1,onOpenChange:o,query:s,defaultQuery:c=``,onQueryChange:l,filter:u=wl,disabled:d=!1,className:f}){let p=Ge()??!1,m=(0,Z.useId)(),h=(0,Z.useRef)(null),g=(0,Z.useRef)(null),_=(0,Z.useRef)(null),v=(0,Z.useRef)(null),[y,b]=(0,Z.useState)(n),[x,S]=(0,Z.useState)(a),[C,w]=(0,Z.useState)(c),[T,E]=(0,Z.useState)(null),[D,O]=(0,Z.useState)(new Map),k=t!==void 0,A=i!==void 0,j=s!==void 0,M=k?t:y,N=A?i:x,P=j?s:C,F=(0,Z.useCallback)(e=>{j||w(e),l?.(e)},[l,j]),I=(0,Z.useCallback)((e,t=!1)=>{d&&e||(A||S(e),o?.(e),e||F(``),t&&requestAnimationFrame(()=>v.current?.focus({preventScroll:!0})))},[d,o,A,F]),L=(0,Z.useEffectEvent)(I),R=(0,Z.useCallback)(e=>{O(t=>{let n=t.get(e.value);if(n?.label===e.label&&n.disabled===e.disabled&&n.id===e.id&&n.ref===e.ref&&n.groupId===e.groupId&&n.keywords.join(`\0`)===e.keywords.join(`\0`))return t;let r=new Map(t);return r.set(e.value,e),r})},[]),z=(0,Z.useCallback)(e=>{O(t=>{if(!t.has(e))return t;let n=new Map(t);return n.delete(e),n})},[]),B=(0,Z.useMemo)(()=>Array.from(D.values()).filter(e=>u(e.value,P,[e.label,...e.keywords])),[u,D,P]),V=(0,Z.useMemo)(()=>B.filter(e=>!e.disabled),[B]),H=(0,Z.useMemo)(()=>new Set(B.map(e=>e.value)),[B]),U=(0,Z.useMemo)(()=>new Set(B.map(e=>e.groupId)),[B]),W=(0,Z.useCallback)(e=>{D.get(e)?.disabled||(k||b(e),r?.(e),I(!1,!0))},[D,r,I,k]),G=(0,Z.useCallback)(e=>{if(!V.length){E(null);return}if(e===`first`){E(V[0].value);return}if(e===`last`){E(V.at(-1)?.value??null);return}let t=V.findIndex(e=>e.value===T),n=t<0?e===1?0:V.length-1:(t+e+V.length)%V.length;E(V[n].value)},[T,V]),ee=(0,Z.useCallback)(()=>{T&&W(T)},[T,W]);(0,Z.useEffect)(()=>{if(!N)return;let e=M&&H.has(M)?M:null,t=T&&H.has(T)?T:null;E(t??e??V[0]?.value??null)},[T,V,N,M,H]),(0,Z.useEffect)(()=>{N&&requestAnimationFrame(()=>v.current?.focus({preventScroll:!0}))},[N]),(0,Z.useEffect)(()=>{if(!T||!N)return;let e=D.get(T)?.ref.current,t=e?.closest(`[role='listbox']`);if(!e||!t)return;let n=e.getBoundingClientRect(),r=t.getBoundingClientRect();n.top<r.top?t.scrollTop-=r.top-n.top:n.bottom>r.bottom&&(t.scrollTop+=n.bottom-r.bottom)},[T,D,N]),(0,Z.useEffect)(()=>{if(!N)return;let e=e=>h.current?.contains(e)||_.current?.contains(e),t=t=>{e(t.target)||L(!1)},n=t=>{e(t.target)||L(!1)},r=e=>{e.key===`Escape`&&(e.preventDefault(),L(!1,!0))};return window.addEventListener(`pointerdown`,t),window.addEventListener(`focusin`,n),window.addEventListener(`keydown`,r),()=>{window.removeEventListener(`pointerdown`,t),window.removeEventListener(`focusin`,n),window.removeEventListener(`keydown`,r)}},[N]);let te=T?D.get(T):void 0,ne=(0,Z.useMemo)(()=>({open:N,setOpen:I,value:M,select:W,query:P,setQuery:F,activeValue:T,setActiveValue:E,moveActive:G,selectActive:ee,registerItem:R,unregisterItem:z,labelFor:e=>e===void 0?void 0:D.get(e)?.label,isVisible:e=>!P.trim()||H.has(e),hasVisibleItems:e=>U.has(e),visibleCount:B.length,activeItemId:te?.id,triggerId:`${m}-trigger`,listId:`${m}-list`,inputId:`${m}-input`,disabled:d,reduce:p,triggerRef:g,contentRef:_,inputRef:v,activeLayoutId:`${m}-active`}),[te?.id,T,m,d,D,G,N,P,p,R,W,ee,z,I,F,M,B.length,U,H]);return(0,Q.jsx)(Tl.Provider,{value:ne,children:(0,Q.jsx)(`div`,{ref:h,className:q(`relative w-full`,f),children:e})})}var Al={type:`spring`,duration:.5,bounce:.22},jl=8;function Ml({children:e,side:t=`bottom`,align:n=`start`,sideOffset:r=6,avoidCollisions:i=!0,className:a}){let o=Dl(`ComboboxContent`),s=(0,Z.useRef)(null),c=Ie(),[l,u]=(0,Z.useState)(t),[d,f]=(0,Z.useState)(!1),p=Ht(),m=Math.min(p+2,8),h=Be(o.triggerRef,s,c);if((0,Z.useLayoutEffect)(()=>{if(!c)return;let e=requestAnimationFrame(()=>f(!0));return()=>cancelAnimationFrame(e)},[c]),(0,Z.useLayoutEffect)(()=>{if(!o.open||!h)return;if(!i){u(t);return}let e=window.innerHeight-(h.trigger.top+h.trigger.height),n=h.trigger.top;t===`bottom`&&e<h.content.height+r&&n>e?u(`top`):t===`top`&&n<h.content.height+r&&e>n?u(`bottom`):u(t)},[i,o.open,h,t,r]),!c)return null;let g=h?.trigger.left??0,_=h?.trigger.width??0,v=h?.content.width??_,y=n===`end`?g+_-v:n===`center`?g+(_-v)/2:g,b=Math.max(jl,window.innerWidth-v-jl),x=Math.min(Math.max(y,jl),b),S=h?.content.height??0;return(0,ps.createPortal)((0,Q.jsx)(K.div,{ref:o.contentRef,"data-combobox-content":``,"data-side":l,"aria-hidden":!o.open,inert:!o.open,initial:!1,animate:{opacity:+!!o.open,y:o.open?l===`bottom`?r:-r:0},transition:o.reduce||!d?{duration:0}:Al,layout:`size`,style:{height:o.open?S:0,left:x,top:l===`bottom`&&h?h.trigger.top+h.trigger.height:void 0,bottom:l===`top`&&h?window.innerHeight-h.trigger.top:void 0,minWidth:_,pointerEvents:o.open?`auto`:`none`,transformOrigin:l===`bottom`?`top`:`bottom`,visibility:h?`visible`:`hidden`,"--combobox-trigger-width":`${_}px`},className:q(`fixed z-[9999] w-(--combobox-trigger-width) overflow-hidden rounded-xl text-popover-foreground outline-none will-change-[height,transform]`,Rt(m,3),a),children:(0,Q.jsx)(Ut,{value:m,children:(0,Q.jsx)(K.div,{ref:s,initial:!1,animate:{opacity:+!!o.open},transition:o.reduce||!d?{duration:0}:Al,children:e})})}),document.body)}function Nl({children:e,ariaLabel:t=`Options`,className:n}){let r=Dl(`ComboboxList`);return(0,Q.jsx)(`div`,{id:r.listId,role:`listbox`,"aria-label":t,className:q(`relative isolate max-h-64 overflow-y-auto overscroll-contain p-1.5 [-ms-overflow-style:none] scrollbar-none [&::-webkit-scrollbar]:hidden`,n),children:e})}function Pl({children:e,className:t}){let n=Dl(`ComboboxGroup`),r=(0,Z.useId)();return(0,Q.jsx)(El.Provider,{value:r,children:(0,Q.jsx)(`fieldset`,{hidden:!n.hasVisibleItems(r),className:q(`m-0 min-w-0 border-0 p-0 py-0.5`,t),children:e})})}function Fl({children:e,className:t}){let n=(0,Z.useContext)(El),r=q(`w-full px-2 py-1.5 text-[0.68rem] font-medium uppercase tracking-[0.12em] text-muted-foreground`,t);return n?(0,Q.jsx)(`legend`,{className:r,children:e}):(0,Q.jsx)(`div`,{className:r,children:e})}function Il({value:e,children:t,textValue:n,keywords:r=[],disabled:i=!1,onSelect:a,className:o}){let s=Dl(`ComboboxItem`),c=(0,Z.useContext)(El),l=(0,Z.useId)(),u=(0,Z.useRef)(null),d=n??(typeof t==`string`?t:e),f=s.isVisible(e),p=s.activeValue===e,m=s.value===e,h=r.join(`\0`),g=(0,Z.useMemo)(()=>h?h.split(`\0`):[],[h]),{registerItem:_,unregisterItem:v}=s;return(0,Z.useLayoutEffect)(()=>(_({value:e,label:d,keywords:g,disabled:i,groupId:c,id:l,ref:u}),()=>v(e)),[i,c,l,d,g,_,v,e]),f?(0,Q.jsxs)(`button`,{ref:u,id:l,type:`button`,role:`option`,"aria-selected":m,disabled:i,tabIndex:-1,"data-combobox-item":``,"data-active":p||void 0,"data-selected":m||void 0,onPointerMove:()=>{i||s.setActiveValue(e)},onPointerDown:e=>e.preventDefault(),onClick:()=>{i||(a?.(e),s.select(e))},className:q(`relative flex w-full items-center gap-2 rounded-lg px-2 py-2 text-left text-sm outline-none transition-colors duration-150`,p?`text-foreground`:`text-muted-foreground`,`disabled:pointer-events-none disabled:opacity-45`,o),children:[p?(0,Q.jsx)(K.span,{"aria-hidden":!0,layoutId:s.activeLayoutId,className:`absolute inset-0 -z-10 rounded-lg bg-muted`,transition:s.reduce?{duration:0}:je}):null,(0,Q.jsx)(`span`,{className:`min-w-0 flex-1`,children:t}),(0,Q.jsx)(K.span,{"aria-hidden":!0,initial:!1,animate:{opacity:+!!m,transform:m?`scale(1)`:`scale(0.82)`},transition:s.reduce?{duration:0}:{duration:.14,ease:Ne},className:`grid size-5 shrink-0 place-items-center text-foreground`,children:(0,Q.jsx)(Zn,{className:`size-4`})})]}):null}function Ll({children:e=`No options found.`,className:t}){return Dl(`ComboboxEmpty`).visibleCount>0?null:(0,Q.jsx)(`div`,{role:`status`,className:q(`px-3 py-8 text-center text-sm text-muted-foreground`,t),children:e})}function Rl({children:e,className:t,showIndicator:n=!0}){let r=Dl(`ComboboxTrigger`);return(0,Q.jsxs)(`div`,{ref:r.triggerRef,id:r.triggerId,"data-state":r.open?`open`:`closed`,onPointerDown:e=>{r.disabled||e.target===r.inputRef.current||(e.preventDefault(),r.inputRef.current?.focus({preventScroll:!0}),r.setOpen(!0))},className:q(`relative z-20 flex h-10 w-full min-w-52 cursor-text items-center justify-between gap-3 rounded-xl border border-border bg-transparent px-3 text-sm text-foreground transition-[border-color] hover:border-(--color-border-strong)`,`focus-within:ring-2 focus-within:ring-foreground/20`,r.disabled&&`pointer-events-none opacity-50`,t),children:[(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 text-left`,children:e}),n?(0,Q.jsx)(`span`,{"aria-hidden":!0,className:`shrink-0 text-muted-foreground`,children:(0,Q.jsx)(Za,{className:`size-4`})}):null]})}function zl({ref:e,className:t,wrapperClassName:n,"aria-label":r=`Search options`,onChange:i,onClick:a,onFocus:o,onKeyDown:s,onPointerDown:c,placeholder:l=`Search…`,...u}){let d=Dl(`ComboboxInput`),f=d.labelFor(d.value),p=e=>{s?.(e),!e.defaultPrevented&&(e.key===`ArrowDown`?(e.preventDefault(),d.setOpen(!0),d.moveActive(1)):e.key===`ArrowUp`?(e.preventDefault(),d.setOpen(!0),d.moveActive(-1)):e.key===`Home`&&d.open?(e.preventDefault(),d.moveActive(`first`)):e.key===`End`&&d.open?(e.preventDefault(),d.moveActive(`last`)):e.key===`Enter`?(e.preventDefault(),d.open?d.selectActive():d.setOpen(!0)):e.key===`Escape`&&d.open&&(e.preventDefault(),d.setOpen(!1,!0)))};return(0,Q.jsxs)(`div`,{className:q(`flex min-w-0 flex-1 items-center gap-2`,n),children:[(0,Q.jsx)(Vr,{"aria-hidden":!0,className:`size-4 shrink-0 text-muted-foreground`}),(0,Q.jsx)(`input`,{...u,ref:Ol(e,d.inputRef),id:d.inputId,role:`combobox`,"aria-label":r,"aria-autocomplete":`list`,"aria-expanded":d.open,"aria-controls":d.listId,"aria-activedescendant":d.open?d.activeItemId:void 0,autoComplete:`off`,disabled:d.disabled,value:d.open?d.query:f??``,placeholder:l,onPointerDown:e=>{c?.(e),!(e.defaultPrevented||d.open)&&(e.preventDefault(),d.inputRef.current?.focus({preventScroll:!0}),d.setOpen(!0))},onFocus:e=>{d.setOpen(!0),o?.(e)},onClick:e=>{d.setOpen(!0),a?.(e)},onChange:e=>{d.setOpen(!0),d.setQuery(e.target.value),i?.(e)},onKeyDown:p,className:q(`h-10 min-w-0 flex-1 bg-transparent text-sm text-foreground outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed`,t)})]})}function Bl({createOpen:e,setCreateOpen:t,directoryBrowser:n,setDirectoryBrowser:r,directoryBrowseLoading:i,directoryBrowseError:a,setDirectoryBrowseError:o,onBrowseDirectories:s,directoryToken:c,setDirectoryToken:l,createName:u,setCreateName:d,createPath:f,setCreatePath:p,loadDirectories:m,createSubmitting:h,createSubmitError:g,setCreateSubmitError:_,submitCreate:v}){let y=(0,Z.useId)(),b=(0,Z.useId)(),x=(0,Z.useId)(),S=n?.pathLabel??f,C=!!(c||f.trim().startsWith(`/`)),w=()=>{r(null),l(void 0),p(``),o(null)},T=()=>{h||(w(),d(``),_(null),t(!1))};return(0,Q.jsx)(Xt,{open:e,onOpenChange:e=>{e?t(!0):T()},children:(0,Q.jsxs)(Kt,{className:`sm:max-w-xl`,children:[(0,Q.jsxs)(zt,{children:[(0,Q.jsx)(qt,{children:`Add project`}),(0,Q.jsx)(Yt,{children:`Choose the local directory that owns this project's sessions. Browse the server filesystem or paste an absolute path.`})]}),(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Q.jsx)(`label`,{className:`text-sm font-medium`,htmlFor:y,children:`Project name`}),(0,Q.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Optional`})]}),(0,Q.jsx)(zi,{id:y,value:u,onChange:e=>d(e.target.value),placeholder:`e.g. Fleet Prime`,"aria-label":`Project name`})]}),(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Q.jsx)(`label`,{className:`text-sm font-medium`,htmlFor:b,children:`Local directory`}),(0,Q.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Required`})]}),(0,Q.jsx)(zi,{id:b,value:f,onChange:e=>{p(e.target.value),l(void 0),r(null),o(null),_(null)},placeholder:`/absolute/path/to/project`,"aria-label":`Project directory`,"aria-describedby":x,spellCheck:!1,autoCapitalize:`off`,autoCorrect:`off`,className:`h-10 font-mono text-xs`}),(0,Q.jsx)(`p`,{id:x,className:`text-xs text-muted-foreground`,children:`Browse to select a directory, or paste an absolute path. The server validates the final choice before registering it.`})]}),i&&!n?(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 rounded-xl border border-dashed px-3 py-4 text-sm text-muted-foreground`,role:`status`,"aria-live":`polite`,children:[(0,Q.jsx)(Cn,{className:`size-4`}),`Loading directories…`]}):null,n?(0,Q.jsxs)(`div`,{className:`overflow-hidden rounded-xl border bg-muted/20`,"data-testid":`project-directory-browser`,children:[(0,Q.jsxs)(`div`,{className:`flex items-start gap-3 p-3`,children:[(0,Q.jsx)(`div`,{className:`grid size-9 shrink-0 place-items-center rounded-lg bg-primary/10 text-primary`,children:(0,Q.jsx)(Mr,{className:`size-4`})}),(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-[0.12em] text-muted-foreground`,children:`Selected directory`}),(0,Q.jsx)(`p`,{className:`mt-1 break-all font-mono text-xs text-foreground`,title:S,children:S})]}),(0,Q.jsx)(`span`,{className:`shrink-0 rounded-full bg-primary/10 px-2 py-1 text-[11px] font-medium text-primary`,children:`Selected`})]}),(0,Q.jsxs)(`div`,{className:`space-y-2 border-t px-3 py-3`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`text-sm font-medium`,children:`Browse child directories`}),(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Open a folder to make it the selected directory.`})]}),n.parentToken?(0,Q.jsxs)(V,{type:`button`,size:`sm`,variant:`outline`,disabled:i,onClick:()=>void m({token:n.parentToken??void 0}),"aria-label":`Go up one directory`,title:`Go up one directory`,children:[(0,Q.jsx)(Le,{className:`size-3.5`}),`Up`]}):null]}),i?(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg border border-dashed px-3 py-4 text-sm text-muted-foreground`,role:`status`,"aria-live":`polite`,children:[(0,Q.jsx)(Cn,{className:`size-4`}),`Loading directories…`]}):n.entries.length===0?(0,Q.jsx)(`p`,{className:`rounded-lg border border-dashed px-3 py-4 text-center text-sm text-muted-foreground`,children:`No child directories here.`}):(0,Q.jsxs)(kl,{value:c,onValueChange:e=>{n.entries.find(t=>t.directoryToken===e)&&m({token:e})},children:[(0,Q.jsx)(Rl,{className:`h-10 bg-background`,children:(0,Q.jsx)(zl,{"aria-label":`Search child directories`,placeholder:`Choose a child directory…`,className:`text-xs`})}),(0,Q.jsx)(Ml,{className:`w-[min(32rem,calc(100vw-3rem))]`,children:(0,Q.jsxs)(Nl,{ariaLabel:`Child directories`,children:[(0,Q.jsxs)(Pl,{children:[(0,Q.jsx)(Fl,{children:`Child directories`}),n.entries.map(e=>(0,Q.jsx)(Il,{value:e.directoryToken,textValue:`${e.name} ${e.pathLabel}`,keywords:[e.pathLabel],children:(0,Q.jsxs)(`span`,{className:`flex min-w-0 items-start gap-2`,children:[(0,Q.jsx)(ao,{className:`mt-0.5 size-4 shrink-0`}),(0,Q.jsxs)(`span`,{className:`min-w-0`,children:[(0,Q.jsx)(`span`,{className:`block truncate font-medium text-foreground`,children:rc(e)}),(0,Q.jsx)(`span`,{className:`block truncate text-[11px] text-muted-foreground`,title:e.pathLabel,children:e.pathLabel})]})]})},e.directoryToken))]}),(0,Q.jsx)(Ll,{children:`No matching directories.`})]})})]})]})]}):s?(0,Q.jsxs)(V,{type:`button`,variant:`outline`,disabled:i,onClick:()=>void m({}),className:`w-full justify-start`,children:[(0,Q.jsx)(Mr,{className:`size-4`}),`Browse directories`]}):null,a?(0,Q.jsxs)(`div`,{className:`flex items-start gap-2 rounded-lg border border-destructive/30 bg-destructive/5 px-3 py-2 text-sm text-destructive`,role:`alert`,children:[(0,Q.jsx)(Ur,{className:`mt-0.5 size-4 shrink-0`}),(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(`p`,{children:a}),(0,Q.jsx)(V,{type:`button`,variant:`link`,size:`xs`,className:`mt-1 h-auto p-0 text-destructive`,onClick:()=>void m(n?{token:n.directoryToken}:{}),children:`Try again`})]})]}):null,g?(0,Q.jsx)(`p`,{className:`text-sm text-destructive`,role:`alert`,children:g}):null]}),(0,Q.jsxs)(Wt,{children:[(0,Q.jsx)(V,{type:`button`,variant:`outline`,disabled:h,onClick:T,children:`Cancel`}),(0,Q.jsx)(V,{type:`button`,disabled:!C||h,onClick:()=>void v(),children:h?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Cn,{className:`size-3.5`}),`Adding project…`]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(io,{className:`size-3.5`}),`Add project`]})})]})]})})}function Vl({projects:e,onRenameSession:t,onDeleteSession:n,onRenameProject:r,onUnregisterProject:i,onForkSessionIntoProject:a,renameTarget:o,setRenameTarget:s,renameTitle:c,setRenameTitle:l,renameProjectTarget:u,setRenameProjectTarget:d,renameProjectName:f,setRenameProjectName:p,deleteTarget:m,setDeleteTarget:h,unregisterTarget:g,setUnregisterTarget:_,forkTarget:v,setForkTarget:y,forkProjectId:b,setForkProjectId:x}){let S=(0,Z.useMemo)(()=>e.flatMap(e=>e.projectId===v?.projectId?[]:[{value:e.projectId,label:`${e.name} — ${e.pathLabel}`,icon:Pr}]),[v?.projectId,e]);return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(En,{open:o!==null,onOpenChange:e=>!e&&s(null),children:(0,Q.jsxs)(Mn,{children:[(0,Q.jsx)(Pn,{children:`Rename session`}),(0,Q.jsx)(Sn,{children:`Choose a local display title for this Fleet Prime session.`}),(0,Q.jsx)(zi,{value:c,onChange:e=>l(e.target.value),"aria-label":`Session title`,autoFocus:!0}),(0,Q.jsxs)(Dn,{children:[(0,Q.jsx)(An,{children:`Cancel`}),(0,Q.jsx)(xn,{disabled:!c.trim(),onClick:()=>{o&&c.trim()&&(t(o.sessionId,c.trim()),s(null))},children:`Rename`})]})]})}),(0,Q.jsx)(En,{open:u!==null,onOpenChange:e=>!e&&d(null),children:(0,Q.jsxs)(Mn,{children:[(0,Q.jsx)(Pn,{children:`Rename project`}),(0,Q.jsx)(Sn,{children:`This changes the display name only. The registered directory stays the same.`}),(0,Q.jsx)(zi,{value:f,onChange:e=>p(e.target.value),"aria-label":`Project name`,autoFocus:!0}),(0,Q.jsxs)(Dn,{children:[(0,Q.jsx)(An,{children:`Cancel`}),(0,Q.jsx)(xn,{disabled:!f.trim()||!r,onClick:()=>{u&&f.trim()&&(r?.(u.projectId,f.trim()),d(null))},children:`Rename`})]})]})}),(0,Q.jsx)(En,{open:m!==null,onOpenChange:e=>!e&&h(null),children:(0,Q.jsxs)(Mn,{children:[(0,Q.jsx)(Pn,{children:`Delete session?`}),(0,Q.jsx)(Sn,{children:`This removes the Fleet Prime session and its managed session artifacts. This cannot be undone.`}),(0,Q.jsxs)(Dn,{children:[(0,Q.jsx)(An,{children:`Cancel`}),(0,Q.jsx)(xn,{className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,onClick:()=>{m&&n(m.sessionId),h(null)},children:`Delete`})]})]})}),(0,Q.jsx)(En,{open:g!==null,onOpenChange:e=>!e&&_(null),children:(0,Q.jsxs)(Mn,{children:[(0,Q.jsx)(Pn,{children:`Unregister project?`}),(0,Q.jsx)(Sn,{children:`The directory and its sessions remain intact. Existing sessions will move to Unassigned until the directory is registered again.`}),(0,Q.jsxs)(Dn,{children:[(0,Q.jsx)(An,{children:`Cancel`}),(0,Q.jsx)(xn,{className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,onClick:()=>{g&&i?.(g.projectId),_(null)},children:`Unregister`})]})]})}),(0,Q.jsx)(Xt,{open:v!==null,onOpenChange:e=>!e&&y(null),children:(0,Q.jsxs)(Kt,{className:`sm:max-w-md`,children:[(0,Q.jsxs)(zt,{children:[(0,Q.jsx)(qt,{children:`Fork session into project`}),(0,Q.jsx)(Yt,{children:`Create a new Fleet Prime session in another registered project.`})]}),(0,Q.jsx)(`div`,{className:`py-2`,children:(0,Q.jsx)(cn,{value:b??null,onValueChange:e=>x(e),options:S,placeholder:`Select a project…`,"aria-label":`Target project`})}),(0,Q.jsxs)(Wt,{children:[(0,Q.jsx)(V,{type:`button`,variant:`outline`,onClick:()=>y(null),children:`Cancel`}),(0,Q.jsx)(V,{type:`button`,disabled:!v||!b||!a,onClick:()=>{!v||!b||(a?.(v.sessionId,b),y(null))},children:`Fork session`})]})]})})]})}function Hl(e){return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Bl,{...e}),(0,Q.jsx)(Vl,{...e})]})}function Ul({data:e,sessionActions:t,projectActions:n={},navigationActions:r={},slots:i={}}){let{sessions:a,projects:o=Ks,projectSessions:s=a,activeProjectId:c,activeSessionId:l}=e,{onNewSession:u,onNewSessionInProject:d,onResumeSession:f,onRenameSession:p,onDeleteSession:m}=t,{onProjectSelect:h,onCreateProject:g,onRenameProject:_,onUnregisterProject:v,onForkSessionIntoProject:y}=n,{onOpenPanelAction:b,onBrowseDirectories:x,onOpenSettings:S}=r,{accountMenu:C}=i,w=sc(c),{loadDirectories:T,projectById:E,sortedProjects:D,sidebarItems:O,resumeResource:k,toggleProjectResource:A,selectSearchResult:j,renderMenu:M,submitCreate:N}=mc({sessions:a,projects:o,projectSessions:s,activeProjectId:c,activeSessionId:l,onNewSession:u,onNewSessionInProject:d,onProjectSelect:h,onResumeSession:f,onCreateProject:g,onForkSessionIntoProject:y,onOpenPanelAction:b,onBrowseDirectories:x,createOpen:w.createOpen,expandedProjectIds:w.expandedProjectIds,revealedProjectIds:w.revealedProjectIds,setExpandedProjectIds:w.setExpandedProjectIds,setRevealedProjectIds:w.setRevealedProjectIds,setSearchOpen:w.setSearchOpen,setDirectoryBrowser:w.setDirectoryBrowser,setDirectoryBrowseLoading:w.setDirectoryBrowseLoading,setDirectoryBrowseError:w.setDirectoryBrowseError,setDirectoryToken:w.setDirectoryToken,setCreatePath:w.setCreatePath,setRenameTarget:w.setRenameTarget,setRenameTitle:w.setRenameTitle,setForkTarget:w.setForkTarget,setForkProjectId:w.setForkProjectId,setDeleteTarget:w.setDeleteTarget,setRenameProjectTarget:w.setRenameProjectTarget,setRenameProjectName:w.setRenameProjectName,setUnregisterTarget:w.setUnregisterTarget,createPath:w.createPath,directoryToken:w.directoryToken,createName:w.createName,setCreateName:w.setCreateName,setCreateOpen:w.setCreateOpen,setCreateSubmitError:w.setCreateSubmitError,setCreateSubmitting:w.setCreateSubmitting});return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Cl,{brandMenuOpen:w.brandMenuOpen,setBrandMenuOpen:w.setBrandMenuOpen,searchOpen:w.searchOpen,setSearchOpen:w.setSearchOpen,query:w.query,setQuery:w.setQuery,projectActionsOpen:w.projectActionsOpen,setProjectActionsOpen:w.setProjectActionsOpen,expandedProjectIds:w.expandedProjectIds,setExpandedProjectIds:w.setExpandedProjectIds,setCreateOpen:w.setCreateOpen,projects:o,projectSessions:s,sidebarItems:O,sortedProjects:D,projectById:E,activeProjectId:c,activeSessionId:l,onNewSession:u,onNewSessionInProject:d,onProjectSelect:h,onRenameSession:p,onCreateProject:g,onOpenSettings:S,accountMenu:C,resumeResource:k,toggleProjectResource:A,selectSearchResult:j,renderMenu:M}),(0,Q.jsx)(Hl,{projects:o,onRenameSession:p,onDeleteSession:m,onRenameProject:_,onUnregisterProject:v,onForkSessionIntoProject:y,onBrowseDirectories:x,createOpen:w.createOpen,setCreateOpen:w.setCreateOpen,directoryBrowser:w.directoryBrowser,setDirectoryBrowser:w.setDirectoryBrowser,directoryBrowseLoading:w.directoryBrowseLoading,directoryBrowseError:w.directoryBrowseError,setDirectoryBrowseError:w.setDirectoryBrowseError,directoryToken:w.directoryToken,setDirectoryToken:w.setDirectoryToken,createName:w.createName,setCreateName:w.setCreateName,createPath:w.createPath,setCreatePath:w.setCreatePath,renameTarget:w.renameTarget,setRenameTarget:w.setRenameTarget,renameTitle:w.renameTitle,setRenameTitle:w.setRenameTitle,renameProjectTarget:w.renameProjectTarget,setRenameProjectTarget:w.setRenameProjectTarget,renameProjectName:w.renameProjectName,setRenameProjectName:w.setRenameProjectName,deleteTarget:w.deleteTarget,setDeleteTarget:w.setDeleteTarget,unregisterTarget:w.unregisterTarget,setUnregisterTarget:w.setUnregisterTarget,forkTarget:w.forkTarget,setForkTarget:w.setForkTarget,forkProjectId:w.forkProjectId,setForkProjectId:w.setForkProjectId,createSubmitting:w.createSubmitting,createSubmitError:w.createSubmitError,setCreateSubmitError:w.setCreateSubmitError,loadDirectories:T,submitCreate:N})]})}var Wl=[];function Gl({label:e,active:t=!1,onClick:n,children:r}){let i=Ge()??!1;return(0,Q.jsx)(K.button,{type:`button`,"aria-label":e,title:e,"aria-pressed":e===`Helpful`||e===`Not helpful`?t:void 0,onClick:n,whileTap:i?void 0:{scale:.9},transition:Oe,className:q(`grid size-7 place-items-center rounded-md text-muted-foreground outline-none transition-colors hover:bg-muted hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring`,t&&`bg-muted text-foreground`),children:r})}function Kl({children:e,status:t=`streaming`,copyText:n,onCopy:r,onRetry:i,sources:a=Wl,sourcesOpen:o,defaultSourcesOpen:s=!1,onSourcesOpenChange:c,sourceIdPrefix:l,feedback:u,defaultFeedback:d=null,onFeedbackChange:f,announce:p=!0,showActions:m=!0,className:h,contentClassName:g,actionsClassName:_}){let v=Ge()??!1,y=(0,Z.useId)(),[b,x]=(0,Z.useState)(!1),[S,C]=(0,Z.useState)(d),[w,T]=(0,Z.useState)(s),E=(0,Z.useRef)(void 0),D=u??S,O=o??w,k=t===`streaming`,A=t===`complete`,j=!!(n||r),M=a.length>0,N=m&&!k&&(j||i||A||M),P=`${y}-sources`,F=l??`response-source-${y.replace(/:/g,``)}`;(0,Z.useEffect)(()=>()=>{E.current&&window.clearTimeout(E.current)},[]);let I=(0,Z.useCallback)(async()=>{r?await r():n&&await navigator.clipboard?.writeText(n),x(!0),E.current&&window.clearTimeout(E.current),E.current=window.setTimeout(()=>x(!1),1600)},[n,r]),L=e=>{let t=D===e?null:e;u===void 0&&C(t),f?.(t)},R=(0,Z.useCallback)(e=>{o===void 0&&T(e),c?.(e)},[c,o]);return(0,Q.jsxs)(`div`,{"data-state":t,"aria-busy":k,className:q(`w-full`,h),children:[(0,Q.jsx)(`div`,{"aria-live":p?`polite`:`off`,className:q(`text-sm leading-6 text-foreground/90 [&_a]:font-medium [&_a]:underline [&_a]:underline-offset-4 [&_code]:rounded [&_code]:bg-muted [&_code]:px-1 [&_code]:py-0.5 [&_code]:font-mono [&_code]:text-[0.9em] [&_ol]:my-3 [&_ol]:list-decimal [&_ol]:space-y-1 [&_ol]:pl-5 [&_p+p]:mt-3 [&_pre]:my-3 [&_pre]:overflow-x-auto [&_pre]:rounded-xl [&_pre]:border [&_pre]:border-border [&_pre]:bg-muted/45 [&_pre]:p-3 [&_pre_code]:bg-transparent [&_pre_code]:p-0 [&_ul]:my-3 [&_ul]:list-disc [&_ul]:space-y-1 [&_ul]:pl-5`,g),children:e}),(0,Q.jsx)(We,{initial:!1,children:N?(0,Q.jsxs)(K.div,{initial:v?{opacity:0}:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0},transition:{duration:v?.12:.22,ease:Ne},className:`mt-3`,children:[(0,Q.jsxs)(`div`,{className:q(`flex items-center gap-0.5`,_),children:[j?(0,Q.jsx)(Gl,{label:b?`Copied`:`Copy response`,onClick:I,children:b?(0,Q.jsx)(Zn,{className:`size-3.5`}):(0,Q.jsx)(gr,{className:`size-3.5`})}):null,i?(0,Q.jsx)(Gl,{label:`Retry response`,onClick:i,children:(0,Q.jsx)(zr,{className:`size-3.5`})}):null,A?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Gl,{label:`Helpful`,active:D===`up`,onClick:()=>L(`up`),children:(0,Q.jsx)(ho,{className:`size-3.5`})}),(0,Q.jsx)(Gl,{label:`Not helpful`,active:D===`down`,onClick:()=>L(`down`),children:(0,Q.jsx)(mo,{className:`size-3.5`})})]}):null,M?(0,Q.jsxs)(`button`,{type:`button`,"aria-expanded":O,"aria-controls":P,onClick:()=>R(!O),className:`group ml-1 inline-flex min-h-7 items-center gap-2 rounded-md px-1.5 text-xs text-muted-foreground outline-none transition-colors hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring`,children:[(0,Q.jsx)(Wn,{citations:a}),(0,Q.jsxs)(`span`,{className:`tabular-nums`,children:[a.length,` `,a.length===1?`source`:`sources`]}),(0,Q.jsx)(K.span,{"aria-hidden":`true`,animate:{rotate:O?180:0},transition:v?{duration:0}:Fe,className:`text-muted-foreground/50 group-hover:text-muted-foreground`,children:(0,Q.jsx)(Qn,{className:`size-3`})})]}):null]}),M?(0,Q.jsx)(Yr,{id:P,open:O,children:(0,Q.jsx)(qn,{citations:a,idPrefix:F,className:`mt-2 rounded-xl bg-muted p-2`})}):null]}):null})]})}var ql=[{id:`top-left`,delay:0},{id:`top-center`,delay:.14},{id:`top-right`,delay:.28},{id:`middle-left`,delay:.42},{id:`middle-center`,delay:.56},{id:`middle-right`,delay:.7},{id:`bottom-left`,delay:.84},{id:`bottom-center`,delay:.98},{id:`bottom-right`,delay:1.12}];function Jl(e){let t=Math.max(0,e),n=Math.floor(t/60),r=(t%60).toFixed(1);return n>0?`${n}m ${r}s`:`${r}s`}function Yl({label:e=`Churning`,elapsedSeconds:t,initialSeconds:n=0,running:r=!0,className:i}){let a=Ge()??!1,[o,s]=(0,Z.useState)(n);(0,Z.useEffect)(()=>{if(t!==void 0||!r)return;let e=performance.now()-n*1e3,i=window.setInterval(()=>{s((performance.now()-e)/1e3)},100);return()=>window.clearInterval(i)},[t,n,r]);let c=t??o;return(0,Q.jsxs)(`span`,{role:`status`,"aria-label":`${e}, in progress`,className:q(`inline-flex items-center gap-3 font-mono text-sm text-muted-foreground`,i),children:[(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`grid size-5 shrink-0 grid-cols-3 gap-[2px]`,children:ql.map(({id:e,delay:t})=>(0,Q.jsx)(K.span,{className:`rounded-[1px] bg-current`,animate:a?{opacity:[.35,.8,.35]}:{opacity:[.28,1,.28],scale:[.72,1,.72]},transition:{duration:1.55,ease:Ae,repeat:1/0,delay:t}},e))}),(0,Q.jsx)(`span`,{className:`font-sans font-medium`,children:e}),(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`tabular-nums text-muted-foreground/70`,children:Jl(c)})]})}function Xl({label:e,className:t}){let n=Ge();if(!e?.trim())return null;let{kind:r,title:i,detail:a}=Zl(e),o=Ql(r),s=r===`queue`||r===`retry`||r===`compaction`;return(0,Q.jsxs)(K.div,{initial:!n&&{opacity:0,y:-4},animate:{opacity:1,y:0},exit:n?void 0:{opacity:0,y:-4},transition:{duration:n?0:.16},role:r===`recovery`?`status`:void 0,"aria-live":r===`recovery`?`polite`:`off`,className:q(`flex items-start gap-2 rounded-lg border border-border/60 bg-muted/45 px-3 py-2 text-xs text-muted-foreground`,t),children:[s?(0,Q.jsx)(Yl,{label:i,running:!0,className:`min-w-0 text-xs`}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(o,{className:q(`mt-0.5 size-3.5 shrink-0`,r===`recovery`&&`text-amber-600 dark:text-amber-400`)}),(0,Q.jsx)(`strong`,{className:`font-medium text-foreground/90`,children:i})]}),a?(0,Q.jsx)(`span`,{className:`min-w-0 leading-relaxed`,children:a}):null]})}function Zl(e){let t=e.trim(),n=t.toLowerCase();return n.includes(`queued`)||n.includes(`steered`)?{kind:`queue`,title:`Queued work`,detail:t}:n.includes(`retry`)?{kind:`retry`,title:`Retrying safely`,detail:t}:n.includes(`compact`)?{kind:`compaction`,title:`Managing context`,detail:t}:n.includes(`reset`)||n.includes(`recover`)||n.includes(`sign in`)?{kind:`recovery`,title:`Run needs attention`,detail:t}:{kind:`notice`,title:`Run update`,detail:t}}function Ql(e){switch(e){case`queue`:return oo;case`retry`:return zr;case`compaction`:return Fr;case`recovery`:return pr;default:return eo}}function $l(e){if(e.length===1){let t=e[0];if(t?.type===`search`)return`Checking a source…`;if(t?.type===`tool`)return`Working with ${t.action}…`}return e.length>1?`Coordinating ${e.length} active actions…`:`Working through the run…`}function eu(e){return e.length===1?`Completed 1 tracked action`:`Completed ${e.length} tracked actions`}var tu=[{id:`welcome-explore-codebase`,label:`Explore codebase`,value:`Explore this codebase and explain its architecture, important modules, and main entry points.`},{id:`welcome-review-changes`,label:`Review changes`,value:`Review my current changes for bugs, regressions, architecture issues, and code quality problems.`},{id:`welcome-fix-issue`,label:`Fix an issue`,value:`Help me investigate and fix an issue in this project.`},{id:`welcome-plan-feature`,label:`Plan a feature`,value:`Explore the relevant code and create an implementation plan for a new feature before making changes.`}];function nu({disabled:e,onSelect:t,composer:n}){return(0,Q.jsxs)(`section`,{"aria-labelledby":`fleet-welcome-title`,className:`flex w-full max-w-an flex-col items-center text-center`,children:[(0,Q.jsx)(`h1`,{id:`fleet-welcome-title`,className:`text-2xl font-normal tracking-tight text-foreground sm:text-3xl`,children:`What should Fleet Prime Agent work on?`}),(0,Q.jsx)(`div`,{className:`mt-6 w-full`,children:n}),(0,Q.jsx)(`div`,{"aria-label":`Suggested prompts`,className:`mt-4 flex w-full flex-wrap justify-center gap-2`,children:tu.map(n=>(0,Q.jsx)(V,{type:`button`,variant:`outline`,size:`sm`,disabled:e||n.disabled,onClick:()=>t(n),className:`min-h-8 rounded-full border-border/70 bg-background/70 px-4 py-1.5 text-center text-sm font-normal text-foreground/80 shadow-sm hover:border-primary/40 hover:bg-primary/5 hover:text-foreground motion-reduce:transition-none`,children:n.label},n.id))})]})}var ru=[`·`,`•`,`●`,`•`];function iu({label:e,isActive:t,className:n}){let[r,i]=(0,Z.useState)(0),[a,o]=(0,Z.useState)(0);return(0,Z.useEffect)(()=>{if(!t){i(0),o(0);return}let e=Date.now(),n=window.setInterval(()=>{i(Math.max(0,Math.floor((Date.now()-e)/1e3))),o(e=>e+1)},500);return()=>window.clearInterval(n)},[t]),!t||!e?null:(0,Q.jsxs)(`div`,{className:q(`flex items-center gap-2 px-an-context-padding py-1 text-xs text-foreground/70`,n),children:[(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`font-mono text-an-primary-color`,children:ru[a%ru.length]}),(0,Q.jsx)(`span`,{className:`sr-only`,"aria-live":`polite`,children:e}),(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`truncate`,children:e}),(0,Q.jsxs)(`span`,{"aria-hidden":`true`,className:`tabular-nums text-foreground/50`,children:[r,`s`]})]})}var au=`M5 13l4 4L19 7`,ou=`M6 12h12`;function su({checked:e,onCheckedChange:t,disabled:n,indeterminate:r,label:i,className:a,id:o,"aria-label":s,"aria-describedby":c}){let l=(0,Z.useId)(),u=o??l,d=Ge(),f=e||r,p=r?ou:au;return(0,Q.jsxs)(`label`,{htmlFor:u,className:q(`inline-flex items-center gap-3`,n?`cursor-not-allowed`:`cursor-pointer`,a),children:[(0,Q.jsx)(K.button,{id:u,type:`button`,role:`checkbox`,"aria-checked":r?`mixed`:e,"aria-label":s,"aria-describedby":c,disabled:n,onClick:()=>!n&&t(!e),whileTap:d||n?void 0:{scale:.92},transition:Oe,"data-state":e?`checked`:r?`indeterminate`:`unchecked`,className:q(`inline-flex h-5 w-5 shrink-0 items-center justify-center rounded-md border-2 outline-none transition-colors duration-200`,`focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background`,`disabled:cursor-not-allowed disabled:opacity-60`,f?`border-primary bg-primary text-primary-foreground`:`border-muted-foreground/50 bg-background hover:border-muted-foreground`),children:(0,Q.jsx)(We,{initial:!1,children:f?(0,Q.jsxs)(K.svg,{width:`12`,height:`12`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:3,strokeLinecap:`round`,strokeLinejoin:`round`,initial:d?{opacity:1}:{opacity:0,scale:.5},animate:d?{opacity:1}:{opacity:1,scale:1},exit:d?{opacity:0}:{opacity:0,scale:.5,filter:`blur(4px)`},transition:d?{duration:0}:{duration:.16,ease:Ne},"aria-hidden":!0,children:[(0,Q.jsx)(`title`,{children:r?`Partially selected`:`Selected`}),(0,Q.jsx)(K.path,{d:p,initial:d?{pathLength:1}:{pathLength:0},animate:{pathLength:1},transition:d?{duration:0}:{duration:r?.2:.3,ease:Ne,delay:.04}})]},r?`indeterminate`:`checked`):null})}),i?(0,Q.jsx)(`span`,{className:q(`select-none text-sm text-foreground`,n&&`opacity-60`),children:i}):null]})}var cu=(0,Z.forwardRef)(function({label:e,value:t,defaultValue:n,onChange:r,onFocus:i,onBlur:a,error:o,success:s,leftIcon:c,rightIcon:l,className:u,classNames:d,disabled:f,id:p,type:m,...h},g){let _=(0,Z.useId)(),v=p??_,y=Ge(),b=t!==void 0,[x,S]=(0,Z.useState)(n??``),C=b?t??``:x,[w,T]=(0,Z.useState)(!1),E=(0,Z.useRef)(null),D=!!o,O=typeof o==`string`?o:null,k=s?null:l;(0,Z.useEffect)(()=>{!E.current||y||!D||Ja(E.current,{x:[0,-6,6,-4,4,-2,0]},{duration:.45})},[D,y]);let A=e=>{b||S(e),r?.(e)};return(0,Q.jsxs)(`div`,{className:q(`flex flex-col gap-1.5`,u,d?.root),children:[e?(0,Q.jsx)(`label`,{htmlFor:v,className:q(`px-1 text-sm font-medium text-foreground`,d?.label),children:e}):null,(0,Q.jsxs)(`div`,{ref:E,"data-state":D?`error`:s?`success`:w?`focused`:`idle`,className:q(`relative h-11 overflow-hidden rounded-full border transition-colors duration-200`,`border-border`,w&&!D&&`border-foreground/40 ring-2 ring-ring/40`,D&&`border-destructive ring-2 ring-destructive/25`,f&&`opacity-60`,d?.field),children:[c?(0,Q.jsx)(`span`,{className:q(`pointer-events-none absolute left-3 top-1/2 flex -translate-y-1/2 items-center text-muted-foreground [&_svg]:h-4 [&_svg]:w-4`,d?.leftIcon),children:c}):null,(0,Q.jsx)(`input`,{ref:g,id:v,type:m,value:C,disabled:f,"aria-invalid":D||void 0,"aria-describedby":O?`${v}-error`:void 0,...h,onChange:e=>A(e.target.value),onFocus:e=>{T(!0),i?.(e)},onBlur:e=>{T(!1),a?.(e)},className:q(`peer h-full w-full bg-transparent text-base leading-6 text-foreground caret-foreground outline-none`,`placeholder:text-muted-foreground/60`,c?`pl-10`:`pl-3.5`,k||s?`pr-10`:`pr-3.5`,f&&`cursor-not-allowed`,d?.input)}),s?(0,Q.jsx)(K.svg,{viewBox:`0 0 24 24`,fill:`none`,className:q(`absolute right-3.5 top-1/2 h-5 w-5 -translate-y-1/2 text-(--color-success)`,d?.successIcon),children:(0,Q.jsx)(K.path,{d:`M5 12.5l4.5 4.5L19 7.5`,stroke:`currentColor`,strokeWidth:2.5,strokeLinecap:`round`,strokeLinejoin:`round`,initial:y?{pathLength:1}:{pathLength:0},animate:{pathLength:1},transition:{duration:.35,ease:`easeOut`}})}):k?(0,Q.jsx)(`span`,{className:q(`absolute right-0 top-0 flex h-full items-center text-muted-foreground [&_button]:grid [&_button]:size-11 [&_button]:place-items-center [&_svg]:h-4 [&_svg]:w-4`,d?.rightIcon),children:k}):null]}),(0,Q.jsx)(We,{initial:!1,children:O?(0,Q.jsx)(K.p,{id:`${v}-error`,role:`alert`,initial:y?{opacity:0}:{opacity:0,y:-4,filter:`blur(4px)`},animate:{opacity:1,y:0,filter:`blur(0px)`},exit:y?{opacity:0}:{opacity:0,y:-4,filter:`blur(4px)`},transition:{duration:.2},className:q(`px-1 text-xs text-destructive`,d?.errorMessage),children:O}):null})]})}),lu=(0,Z.createContext)(null);function uu(){let e=(0,Z.useContext)(lu);if(!e)throw Error(`RadioGroupItem must be used inside <RadioGroup>`);return e}function du({value:e,defaultValue:t=``,onValueChange:n,children:r,className:i,orientation:a=`vertical`}){let[o,s]=(0,Z.useState)(t),c=(0,Z.useId)(),l=Ge(),u=e!==void 0,d=u?e:o,f=(0,Z.useCallback)(e=>{u||s(e),n?.(e)},[u,n]),p=(0,Z.useMemo)(()=>({value:d,setValue:f,layoutId:c}),[d,c,f]);return(0,Q.jsx)(Ca,{transition:l?{duration:0}:je,children:(0,Q.jsx)(lu.Provider,{value:p,children:(0,Q.jsx)(`div`,{role:`radiogroup`,className:q(`flex gap-3`,a===`vertical`?`flex-col`:`flex-row flex-wrap`,i),children:r})})})}function fu({value:e,label:t,disabled:n,className:r,id:i}){let{value:a,setValue:o,layoutId:s}=uu(),c=(0,Z.useId)(),l=i??c,u=Ge(),d=a===e;return(0,Q.jsxs)(`label`,{htmlFor:l,className:q(`inline-flex items-center gap-3`,n?`cursor-not-allowed`:`cursor-pointer`,r),children:[(0,Q.jsx)(K.button,{id:l,type:`button`,role:`radio`,"aria-checked":d,disabled:n,onClick:()=>!n&&o(e),whileTap:u||n?void 0:{scale:.92},transition:Oe,"data-state":d?`checked`:`unchecked`,className:q(`relative inline-flex h-5 w-5 shrink-0 items-center justify-center rounded-full border-2 outline-none transition-colors duration-200`,`focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background`,`disabled:cursor-not-allowed disabled:opacity-60`,d?`border-primary`:`border-muted-foreground/50 hover:border-muted-foreground`),children:d?(0,Q.jsx)(K.span,{layoutId:s,className:`absolute inset-1 rounded-full bg-primary`,transition:u?{duration:0}:je}):null}),t?(0,Q.jsx)(`span`,{className:q(`select-none text-sm text-foreground`,n&&`opacity-60`),children:t}):null]})}var pu={selected:[],custom:``};function mu(e){return e===`submitting`?`Submitting`:e===`approved`?`Approved`:e===`rejected`?`Rejected`:e===`changes-requested`?`Changes requested`:e===`answered`?`Response submitted`:`Input required`}function hu(e){return e===`approved`||e===`answered`?`text-emerald-600 dark:text-emerald-400`:e===`rejected`?`text-rose-600 dark:text-rose-400`:e===`changes-requested`?`text-amber-600 dark:text-amber-400`:`text-muted-foreground`}function gu(e){return e===`pending`||e===`changes-requested`?`border-amber-500/30 bg-amber-500/10 text-amber-600 dark:text-amber-400`:e===`submitting`?`border-blue-500/30 bg-blue-500/10 text-blue-600 dark:text-blue-400`:e===`approved`||e===`answered`?`border-emerald-500/30 bg-emerald-500/10 text-emerald-600 dark:text-emerald-400`:`border-rose-500/30 bg-rose-500/10 text-rose-600 dark:text-rose-400`}function _u(e){return e.selected.length>0||!!e.custom?.trim()}function vu({question:e,answer:t,disabled:n,onChange:r,onSingleSelect:i}){let a=t.custom??``,o=new Set(t.selected);return(0,Q.jsxs)(`div`,{className:`mt-3`,children:[e.options?.length?e.multiple?(0,Q.jsx)(`div`,{className:`grid gap-0.5`,children:e.options.map(e=>(0,Q.jsx)(su,{checked:o.has(e.value),disabled:n||e.disabled,label:e.label,onCheckedChange:n=>r({...t,selected:n?[...t.selected,e.value]:t.selected.filter(t=>t!==e.value)}),className:`min-h-9 rounded-lg px-1.5 py-1`},e.value))}):(0,Q.jsx)(du,{value:t.selected[0]??``,onValueChange:e=>{r({selected:[e],custom:``}),i?.()},className:`gap-0.5`,children:e.options.map(e=>(0,Q.jsx)(fu,{value:e.value,label:e.label,disabled:n||e.disabled,className:`min-h-9 rounded-lg px-1.5 py-1`},e.value))}):null,e.allowCustom?(0,Q.jsx)(cu,{value:a,disabled:n,placeholder:e.customPlaceholder??`Add another response…`,onChange:n=>r({selected:e.multiple?t.selected:[],custom:n}),className:q(`p-0.5`,e.options?.length&&`mt-1.5`),classNames:{field:`h-10 rounded-xl border-0 bg-background/70 focus-within:bg-background`,input:`px-3 text-sm`}}):null]})}function yu({current:e,ids:t}){return(0,Q.jsxs)(`span`,{className:`flex gap-1.5`,children:[(0,Q.jsxs)(`span`,{className:`sr-only`,children:[`Question `,e+1,` of `,t.length]}),t.map((t,n)=>(0,Q.jsx)(K.span,{"aria-hidden":`true`,initial:{scale:n===e?1:.75,opacity:n<=e?1:.35},animate:{scale:n===e?1:.75,opacity:n<=e?1:.35},transition:Fe,className:`size-1.5 rounded-full bg-foreground`},t))]})}function bu({title:e=`Approval required`,description:t,children:n,questions:r=[],status:i=`pending`,answers:a,defaultAnswers:o={},onAnswersChange:s,step:c,defaultStep:l=0,onStepChange:u,onSubmit:d,onApprove:f,onReject:p,onRequestChanges:m,onDismiss:h,approveLabel:g=`Approve`,submitLabel:_=`Submit response`,result:v,className:y}){let b=Ge()??!1,[x,S]=(0,Z.useState)(o),[C,w]=(0,Z.useState)(l),T=(0,Z.useRef)(void 0),E=a??x,D=Math.min(Math.max(0,c??C),Math.max(0,r.length-1)),O=r[D],k=r.length>0,A=i===`pending`,j=i===`submitting`,M=A||j,N=O?E[O.id]??pu:pu,P=O?.title??e,F=O?.id??String(i),I=mu(i),L=(0,Z.useCallback)(()=>{T.current!==void 0&&(window.clearTimeout(T.current),T.current=void 0)},[]);(0,Z.useEffect)(()=>L,[L]);let R=(0,Z.useCallback)(e=>{a===void 0&&S(e),s?.(e)},[a,s]),z=e=>{L(),c===void 0&&w(e),u?.(e)};return(0,Q.jsx)(`div`,{"data-state":i,"aria-busy":j,className:q(`w-full overflow-hidden rounded-2xl bg-muted p-4 text-sm`,y),children:(0,Q.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:q(`grid size-5 shrink-0 place-items-center text-muted-foreground`,hu(i)),children:j?(0,Q.jsx)(mr,{className:q(`size-4`,!b&&`animate-spin`)}):M?k?(0,Q.jsx)(Qa,{className:`size-4`}):(0,Q.jsx)(co,{className:`size-4`}):i===`rejected`?(0,Q.jsx)(Wr,{className:`size-4`}):(0,Q.jsx)(Zn,{className:`size-4`})}),(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,Q.jsx)(`h3`,{className:`min-w-0 flex-1 text-base font-medium leading-5 text-foreground`,children:(0,Q.jsx)(_r,{value:F,children:P})}),k&&M?(0,Q.jsxs)(`span`,{className:`shrink-0 text-xs tabular-nums text-muted-foreground/65`,children:[D+1,`/`,r.length]}):(0,Q.jsx)(`span`,{className:q(`shrink-0 rounded-full border px-2 py-0.5 text-[11px] font-medium transition-colors`,gu(i)),children:I}),h?(0,Q.jsx)(`button`,{type:`button`,"aria-label":`Dismiss`,onClick:h,className:`grid size-5 shrink-0 place-items-center rounded-full text-muted-foreground outline-none transition-colors hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring`,children:(0,Q.jsx)(Wr,{className:`size-4`})}):null]}),(0,Q.jsxs)(Yr,{open:M,children:[(0,Q.jsx)(We,{initial:!1,mode:`wait`,children:k&&O?(0,Q.jsxs)(K.div,{initial:b?{opacity:1}:{opacity:0,x:8},animate:{opacity:1,x:0},exit:b?{opacity:0}:{opacity:0,x:-6},transition:{duration:b?0:.2,ease:Ne},children:[O.description?(0,Q.jsx)(`p`,{className:`mt-1 leading-5 text-muted-foreground`,children:O.description}):null,(0,Q.jsx)(vu,{question:O,answer:N,disabled:j,onChange:e=>{O&&R({...E,[O.id]:e})},onSingleSelect:()=>{!O||O.multiple||O.autoAdvance===!1||D>=r.length-1||j||(L(),T.current=window.setTimeout(()=>{z(D+1)},240))}})]},O.id):(0,Q.jsxs)(K.div,{initial:!1,children:[t?(0,Q.jsx)(`p`,{className:`mt-1 leading-5 text-muted-foreground`,children:t}):null,n?(0,Q.jsx)(`div`,{className:`mt-3`,children:n}):null]},`description`)}),k?(0,Q.jsxs)(`div`,{className:`mt-4 flex items-center gap-3`,children:[(0,Q.jsx)(He,{variant:`ghost`,size:`icon`,"aria-label":`Previous question`,disabled:j||D===0,onClick:()=>z(D-1),className:`rounded-full`,children:(0,Q.jsx)(bn,{className:`size-4`})}),(0,Q.jsx)(yu,{current:D,ids:r.map(e=>e.id)}),(0,Q.jsx)(He,{size:D===r.length-1?`sm`:`icon`,"aria-label":D===r.length-1?`Submit response`:`Next question`,disabled:j||!_u(N),onClick:()=>{if(D<r.length-1){z(D+1);return}d?.(E)},className:`ml-auto rounded-full`,children:j?(0,Q.jsx)(mr,{className:q(`size-4`,!b&&`animate-spin`)}):D===r.length-1?(0,Q.jsxs)(Q.Fragment,{children:[_,(0,Q.jsx)(Ya,{className:`size-3.5`})]}):(0,Q.jsx)(Ya,{className:`size-4`})})]}):(0,Q.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center gap-2`,children:[(0,Q.jsx)(He,{size:`sm`,disabled:j,onClick:f,className:`rounded-full`,children:g}),m?(0,Q.jsx)(He,{variant:`secondary`,size:`sm`,disabled:j,onClick:m,className:`rounded-full`,children:`Request changes`}):null,p?(0,Q.jsx)(He,{variant:`ghost`,size:`sm`,disabled:j,onClick:p,className:`rounded-full text-muted-foreground hover:text-rose-600 dark:hover:text-rose-400`,children:`Reject`}):null]})]}),M?null:(0,Q.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:v??I})]})]})})}function xu({questionBar:e,navigation:t,roundedTop:n,onDismiss:r}){let{totalQuestions:i,clampedQuestionIndex:a,activeQuestion:o,showQuestionNavigation:s,canGoPrev:c,canGoNext:l,goToPreviousQuestion:u,goToNextQuestion:d,advanceQuestionIndex:f}=t;if(!o)return null;let p={id:o.id??`question-${a}`,title:o.title,description:o.description,multiple:o.kind===`multi`,allowCustom:o.kind===`text`||o.allowCustom,customPlaceholder:o.customPlaceholder??o.placeholder,options:o.options?.map(e=>({value:e.id??e.value??e.label,label:e.label}))};return(0,Q.jsxs)(`div`,{className:q(`mx-auto w-full max-w-[calc(100%-24px)] border-x border-t border-border`,n?`rounded-t-an-input-border-radius`:null),children:[(0,Q.jsxs)(`div`,{className:`flex h-7 items-center justify-between border-b border-border px-3 text-xs text-an-tool-color-muted`,children:[(0,Q.jsxs)(`div`,{className:`inline-flex items-center gap-1.5`,children:[(0,Q.jsx)(Kn,{className:`h-3.5 w-3.5`}),`Question`]}),s&&(0,Q.jsxs)(`div`,{className:`inline-flex items-center gap-1`,children:[(0,Q.jsx)(`button`,{type:`button`,onClick:u,disabled:!c,className:`relative inline-flex size-5 items-center justify-center rounded-[4px] transition-[background-color,transform] duration-150 after:absolute after:inset-x-0 after:-top-2.5 after:-bottom-2.5 hover:bg-an-background-secondary active:scale-[0.96] disabled:opacity-40 disabled:active:scale-100`,"aria-label":`Previous question`,children:(0,Q.jsx)(fr,{className:`h-3.5 w-3.5`})}),(0,Q.jsxs)(`span`,{className:`tabular-nums`,children:[a,` of `,i]}),(0,Q.jsx)(`button`,{type:`button`,onClick:d,disabled:!l,className:`relative inline-flex size-5 items-center justify-center rounded-[4px] transition-[background-color,transform] duration-150 after:absolute after:inset-x-0 after:-top-2.5 after:-bottom-2.5 hover:bg-an-background-secondary active:scale-[0.96] disabled:opacity-40 disabled:active:scale-100`,"aria-label":`Next question`,children:(0,Q.jsx)(Qn,{className:`h-3.5 w-3.5`})})]})]}),(0,Q.jsx)(bu,{title:`Fleet Prime question`,questions:[p],submitLabel:e.submitLabel??`Continue`,status:`pending`,onSubmit:t=>{let n=t[p.id];if(!n)return;let s=n.custom?.trim()||void 0,c=n.selected.filter(e=>e!==`__custom__`),l=o.kind===`text`?{kind:`text`,questionId:o.id,text:s}:{kind:o.kind,questionId:o.id,selectedIds:c,text:s};e.onSubmit(l),a>=i?r(e.id):f()},className:`rounded-none bg-background p-0`},`${a}-${o.title}`),e.allowSkip?(0,Q.jsx)(`div`,{className:`border-t border-border bg-background px-3 py-2`,children:(0,Q.jsx)(`button`,{type:`button`,onClick:()=>{e.onSkip?.(),e.onSubmit({kind:`skip`,questionId:o.id}),r(e.id)},className:`text-xs text-muted-foreground underline-offset-2 hover:text-foreground hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,children:e.skipLabel??`Skip`})}):null]})}var Su=(0,Z.memo)(function({modes:e,value:t,defaultValue:n,onChange:r,className:i}){let a=t!==void 0,[o,s]=(0,Z.useState)(n),c=a?t:o,l=e.find(e=>e.id===c)??e[0],[u,d]=(0,Z.useState)(!1),f=(0,Z.useCallback)(e=>{a||s(e),r?.(e),d(!1)},[a,r]);if(e.length===0)return null;let p=l?.icon,m=e.length>1,h=(0,Q.jsxs)(`button`,{type:`button`,className:q(`relative inline-flex h-7 cursor-pointer items-center gap-1.5 rounded-full px-2 text-[12px] leading-4 text-foreground/40 transition-[background-color,transform] duration-150 after:absolute after:inset-x-0 after:-top-1.5 after:-bottom-1.5 hover:bg-foreground/6 active:scale-[0.96]`,!m&&`pointer-events-none`,i),"aria-label":`Select mode`,children:[p&&(0,Q.jsx)(p,{className:`size-3.5 shrink-0`}),(0,Q.jsx)(`span`,{className:`font-medium`,children:l?.label}),m&&(0,Q.jsx)(Qn,{className:`size-3 text-foreground/40`})]});return m?(0,Q.jsx)(Bc,{open:u,onOpenChange:d,side:`top`,align:`start`,trigger:h,children:e.map(e=>{let t=e.id===l?.id,n=e.icon;return(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>f(e.id),className:q(`flex w-full cursor-pointer items-start gap-2 rounded-[6px] px-2 py-2 text-left text-[12px] leading-4 text-foreground transition-[background-color,transform] duration-150 hover:bg-foreground/6 active:scale-[0.96]`,t&&`bg-foreground/6`),children:[n&&(0,Q.jsx)(n,{className:`mt-0.5 size-3.5 shrink-0`}),(0,Q.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(`span`,{className:`block truncate font-medium`,children:e.label}),e.description&&(0,Q.jsx)(`span`,{className:`block truncate text-foreground/40`,children:e.description})]}),t&&(0,Q.jsx)(Zn,{className:`mt-0.5 size-3.5 shrink-0 text-foreground/60`})]},e.id)})}):h});Array.from({length:14},(e,t)=>t);function Cu(e,t){return(0,Z.useMemo)(()=>{if(!t||!e.startsWith(`/`))return[];let n=e.slice(1).toLowerCase();return t.filter(e=>e.name.startsWith(n))},[t,e])}function wu(e,t){return(0,Z.useMemo)(()=>{if(!t)return[];let n=/(?:^|\s)@([^\s@]*)$/.exec(e);if(!n)return[];let r=n[1]?.toLowerCase()??``;return t.filter(e=>[e.name,e.id,e.path,e.description].filter(Boolean).join(` `).toLowerCase().includes(r))},[t,e])}function Tu({open:e,align:t=`start`,className:n,...r}){return(0,Q.jsx)(`div`,{"data-slot":`composer-menu`,"data-open":e||void 0,className:q(Xr,`absolute bottom-full z-10 mb-2 flex w-72 flex-col gap-0.5 rounded-2xl p-1.5`,t===`start`?`start-0 origin-bottom-left`:`end-0 origin-bottom-right`,`transition-[opacity,scale] duration-200 ease-[cubic-bezier(0.23,1,0.32,1)] motion-reduce:transition-none`,e?`scale-100 opacity-100`:`pointer-events-none scale-[0.97] opacity-0`,n),...r})}function Eu({active:e=!1,className:t,...n}){return(0,Q.jsx)(`button`,{type:`button`,"data-slot":`composer-menu-item`,"data-active":e||void 0,className:q(`flex w-full items-center gap-2.5 rounded-[10px] px-2.5 py-2 text-[13.5px] transition-colors`,e?Zr:`hover:bg-foreground/[0.04]`,t),...n})}function Du(e,t){return t.icon?t.icon:e===`mention`?t.metadata?.kind===`folder`?(0,Q.jsx)(Pr,{"aria-hidden":`true`,className:`size-4`}):(0,Q.jsx)(Nr,{"aria-hidden":`true`,className:`size-4`}):(0,Q.jsx)(to,{"aria-hidden":`true`,className:`size-4`})}function Ou(e,t){return e&&e.length>0?e.flatMap(e=>e.items):t?[...t]:[]}var ku=(0,Z.memo)(function({open:e,kind:t,query:n,items:r,groups:i,activeIndex:a=0,onActiveIndexChange:o,onSelect:s,onClose:c,onBack:l,className:u,emptyLabel:d=`No matching items`,title:f,listId:p=`fleet-composer-trigger-list`}){let m=(0,Z.useMemo)(()=>Ou(i,r),[i,r]);if(!e)return null;let h=!!(i&&i.length>0),g=m[a],_=(e,n)=>{let r=n===a,i=`${p}-${e.id.replace(/[^a-zA-Z0-9_-]/g,`-`)}`;return(0,Q.jsxs)(Eu,{id:i,disabled:e.disabled,role:`option`,"aria-selected":r,"data-active":r?`true`:void 0,active:r,onMouseDown:e=>e.preventDefault(),onMouseEnter:()=>o?.(n),onClick:()=>{e.disabled||s(e)},className:q(`flex min-h-10 cursor-pointer items-start gap-2 rounded-lg px-3 py-2 text-left`,r&&`bg-accent text-accent-foreground`),children:[(0,Q.jsx)(`span`,{className:`mt-0.5 shrink-0 text-muted-foreground`,children:Du(t,e)}),(0,Q.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(`span`,{className:`block truncate text-sm font-medium`,children:e.label}),e.description?(0,Q.jsx)(`span`,{className:`mt-0.5 block truncate text-xs text-muted-foreground`,children:e.description}):null]}),r?(0,Q.jsx)(dr,{"aria-hidden":`true`,className:`mt-1 size-3.5 shrink-0 text-muted-foreground`}):null]},e.id)};return e?(0,Q.jsxs)(Tu,{open:!0,id:p,role:`listbox`,"aria-label":f??`Suggestions`,"aria-activedescendant":g?`${p}-${g.id.replace(/[^a-zA-Z0-9_-]/g,`-`)}`:void 0,"data-slot":`composer-trigger-popover`,"data-kind":t,"data-state":`open`,className:q(`inset-x-0 z-50 mb-2 w-auto overflow-hidden rounded-xl border bg-popover text-popover-foreground shadow-xl`,u),children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 border-b px-3 py-2 text-xs text-muted-foreground`,children:[l?(0,Q.jsx)(`button`,{type:`button`,"aria-label":`Back`,onClick:l,className:`grid size-6 place-items-center rounded-md hover:bg-muted focus-visible:ring-2 focus-visible:ring-ring`,children:(0,Q.jsx)(nr,{"aria-hidden":`true`,className:`size-3.5`})}):null,(0,Q.jsx)(Hr,{"aria-hidden":`true`,className:`size-3.5`}),(0,Q.jsx)(`span`,{className:`font-medium`,children:f??(t===`slash`?`Commands`:`Workspace`)}),n?(0,Q.jsx)(`span`,{className:`ml-auto max-w-[50%] truncate font-mono text-[11px]`,children:n}):null,c?(0,Q.jsx)(`button`,{type:`button`,"aria-label":`Close suggestions`,onClick:c,className:`sr-only`,children:`Close suggestions`}):null]}),(0,Q.jsxs)(`div`,{className:`max-h-[min(42vh,360px)] overflow-y-auto p-1.5`,children:[m.length===0?(0,Q.jsx)(`div`,{className:`px-3 py-6 text-center text-sm text-muted-foreground`,children:d}):null,h?i?.map(e=>{let t=0;for(let n of i){if(n.id===e.id)break;t+=n.items.length}return(0,Q.jsxs)(`div`,{role:`group`,"aria-label":e.label,children:[(0,Q.jsx)(`div`,{className:`px-3 pb-1 pt-2 text-[10px] font-medium uppercase tracking-wide text-muted-foreground`,children:e.label}),e.items.map((e,n)=>_(e,t+n))]},e.id)}):m.map(_)]})]}):null}),Au=(0,Z.lazy)(()=>Gr(async()=>{let{ModelSelectorList:e}=await import(`./model-selector-list-CJY9pyt2.js`);return{ModelSelectorList:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21])).then(({ModelSelectorList:e})=>({default:e})));function ju(e){return(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(`div`,{className:`h-24 animate-pulse rounded-md bg-muted/40 p-1.5`,"aria-label":`Loading models`,role:`status`}),children:(0,Q.jsx)(Au,{...e})})}var Mu=(0,Z.memo)(function({models:e,value:t,effort:n,open:r,onOpenChange:i,onModelChange:a,onEffortChange:o,placeholder:s=`Model`,effortLabel:c=`Reasoning effort`,className:l,contentClassName:u}){let[d,f]=(0,Z.useState)(!1),p=(0,Z.useId)(),m=r??d,h=e=>{r===void 0&&f(e),i?.(e)},g=e.find(e=>e.id===t)??e[0],_=g?.efforts?.find(e=>e.id===n)??g?.efforts?.[0],v=(0,Q.jsxs)(`button`,{type:`button`,role:`combobox`,"aria-expanded":m,"aria-controls":p,"aria-haspopup":`dialog`,"aria-label":`Select model and reasoning effort`,className:q(`relative inline-flex h-8 max-w-[18rem] min-w-0 items-center gap-1.5 rounded-lg px-2 text-xs text-muted-foreground outline-none transition-colors hover:bg-muted hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring`,l),children:[g?.icon?(0,Q.jsx)(`span`,{className:`shrink-0`,children:g.icon}):null,(0,Q.jsx)(`span`,{className:`min-w-0 truncate font-medium`,children:g?.name??s}),_&&g?.reasoning?(0,Q.jsxs)(`span`,{className:`hidden shrink-0 text-muted-foreground/70 xl:inline`,children:[`· `,_.name]}):null,(0,Q.jsx)(Qn,{"aria-hidden":`true`,className:`size-3.5 shrink-0`})]});return(0,Q.jsx)(Bc,{contentId:p,open:m,onOpenChange:h,side:`top`,align:`start`,className:q(`w-[min(24rem,calc(100vw-2rem))] max-h-[min(55vh,28rem)] overflow-hidden p-0`,u),trigger:v,children:(0,Q.jsx)(ju,{models:e,selectedModel:g,selectedEffort:_,effortLabel:c,onModelChange:a,onEffortChange:o})})});function Nu(e){let[t,n]=(0,Z.useState)(1),r=e?.questions??[],i=r.length>0,a=i?r.length:1,o=e?.totalQuestions??a,s=e?.onPreviousQuestion||e?.onNextQuestion?e?.questionIndex??1:t,c=Math.max(1,Math.min(s,o)),l=i?r[c-1]:void 0,u=o>1,d=c>1,f=c<o;return{questionSet:r,totalQuestions:o,clampedQuestionIndex:c,activeQuestion:l,showQuestionNavigation:u,canGoPrev:d,canGoNext:f,goToPreviousQuestion:(0,Z.useCallback)(()=>{if(d){if(e?.onPreviousQuestion){e.onPreviousQuestion();return}n(e=>Math.max(1,e-1))}},[d,e]),goToNextQuestion:(0,Z.useCallback)(()=>{if(f){if(e?.onNextQuestion){e.onNextQuestion();return}n(e=>Math.min(o,e+1))}},[f,e,o]),advanceQuestionIndex:(0,Z.useCallback)(()=>{n(e=>Math.min(o,e+1))},[o])}}var Pu=[];function Fu(e){return e?Array.isArray(e)?e:e.items:[]}function Iu(e){return(e.value??e.id).trim().replace(/^\/+/,``).split(/\s+/,1)[0]??e.id}function Lu(e){return(e.value?.trim()??``).match(/^\/\S+\s+(.+)$/)?.[1]}function Ru({models:e,status:t,thinkingLevel:n,onModelChange:r,onThinkingLevelChange:i,onSend:a,onSlashCommandSelect:o,onLocalSlashSubmit:s,modelPickerOpen:c,onModelPickerOpenChange:l,effortPickerOpen:u,onEffortPickerOpenChange:d,workspaceReferences:f=Pu,workspaceSuggestions:p,onWorkspaceReferenceSelect:m,onRemoveWorkspaceReference:h,controlled:g,disabled:_,questionBar:v,attachments:y,slashCommands:b}){let[x,S]=(0,Z.useState)(``),[C,w]=(0,Z.useState)(null),T=g?.value??x,E=g?.onChange??S,D=t===`streaming`||t===`submitted`,O=Nu(v),k=Fu(b),A=Fu(p),j=(0,Z.useMemo)(()=>k.map(e=>({name:Iu(e),description:[e.description,Lu(e)].filter(Boolean).join(` `),icon:Hr})),[k]),M=(0,Z.useMemo)(()=>A.map(e=>({id:e.id,name:e.label,path:e.value??e.label,kind:e.metadata?.kind===`folder`?`folder`:`file`,description:e.description,role:`human`})),[A]),N=T.match(/^\/([^\s/]*)$/),P=T.match(/(?:^|\s)@([^\s@]*)$/),F=N?.[1]?.toLowerCase(),I=P?.[1]?.toLowerCase(),L=F===void 0?I===void 0?void 0:`mention`:`slash`,R=Cu(T,j),z=wu(T,M),B=(0,Z.useMemo)(()=>{let e=new Set(R.map(e=>e.name));return k.filter(t=>e.has(Iu(t)))},[k,R]),V=(0,Z.useMemo)(()=>{let e=new Set(z.map(e=>e.id).filter(e=>!!e));return A.filter(t=>e.has(t.id))},[z,A]),H=L===`slash`?B:V,[U,W]=(0,Z.useState)(0);(0,Z.useEffect)(()=>{W(0)},[L,F,I,H.length]);let G=(0,Z.useCallback)((e,t=!1)=>{if(s?.(e)===!0){E(``);return}a({role:`user`,content:e,altKey:t}),E(``)},[s,a,E]),ee=(0,Z.useCallback)(e=>{if(o?.(e)===!0){E(``);return}E(e.value??e.label)},[o,E]),te=(0,Z.useCallback)(e=>{if(!e)return T;let t=e[0].length-e[0].trimStart().length,n=T.length-e[0].length+t;return T.slice(0,n)},[T]),ne=(0,Z.useCallback)(e=>{m?.(e),E(te(P))},[m,te,E,P]),re=(0,Z.useCallback)(e=>{let t=!D&&!_&&L!==void 0;if(e.key===`Backspace`&&T.length===0&&f.length>0){let t=f[f.length-1];if(t){e.preventDefault(),h?.(t.relativePath);return}}if(t&&e.key===`Escape`){e.preventDefault(),E(te(L===`slash`?N:P));return}if(t&&H.length>0){if(e.key===`ArrowDown`){e.preventDefault(),W(e=>(e+1)%H.length);return}if(e.key===`ArrowUp`){e.preventDefault(),W(e=>(e-1+H.length)%H.length);return}if(e.key===`Enter`||e.key===`Tab`){e.preventDefault();let t=H[U];t&&(L===`slash`?ee(t):ne(t));return}}if(e.key===`Enter`&&e.altKey&&!e.shiftKey){e.preventDefault();let t=T.trim();t&&!_&&G(t,!0)}},[U,_,D,h,te,ee,ne,G,E,N,H,L,T,P,f]),ie=v&&v.id!==C,ae=y?.files??[],oe=y?.images??[],se=!!(L&&!D&&!_),ce=(0,Z.useMemo)(()=>{if(L!==`slash`)return[];let e=new Map;for(let t of B){let n=t.category??`builtin`,r=e.get(n)??[];r.push(t),e.set(n,r)}let t={builtin:`Built-in`,extension:`Extensions`,prompt:`Prompts`,skill:`Skills`};return[...e.entries()].map(([e,n])=>({id:e,label:t[e]??e,items:n.map(e=>({...e,description:[e.description,Lu(e)].filter(Boolean).join(` · `)}))}))},[B,L]),le=(0,Z.useMemo)(()=>e.map(e=>({id:e.id,name:e.name,provider:e.provider,providerLabel:Nn(e.provider),modelId:e.modelId,icon:(0,Q.jsx)(kn,{provider:e.provider,className:`size-4`}),disabled:e.available===!1,reasoning:e.reasoning,keywords:[e.provider,e.modelId,e.id],efforts:wr(e).map(e=>({id:e,name:Tr(e)}))})),[e]);return{activeTriggerIndex:U,combinedPickerOpen:c===!0||u===!0,commandGroups:ce,files:ae,handleCombinedPickerOpenChange:(0,Z.useCallback)(e=>{l?.(e),d?.(e)},[d,l]),handlePromptKeyDown:re,handleSelectorModelChange:(0,Z.useCallback)(t=>{let a=e.find(e=>e.id===t);r(t),a&&i?.(yr(n,wr(a)))},[e,r,i,n]),images:oe,isStreaming:D,navigation:O,selectorModels:le,selectCommand:ee,selectWorkspaceReference:ne,removeTriggerToken:te,send:G,setActiveTriggerIndex:W,setDismissedQuestionId:w,setValue:E,showQuestion:ie,triggerItems:H,triggerKind:L,triggerOpen:se,slashMatch:N,slashQuery:F,workspaceMentionMatch:P,workspaceQuery:I,filteredCommands:B,filteredWorkspaceItems:V,value:T}}var zu=[{id:`agent`,label:`Agent`,icon:Xn,description:`Default coding agent`},{id:`plan`,label:`Plan`,icon:Un,description:`Plan before executing`},{id:`harness`,label:`Harness`,icon:fo,description:`Harness-aware turn`}],Bu=[];function Vu(e){return(0,Q.jsx)(Hu,{...e})}function Hu({modelKey:e,models:t,status:n,infoDescription:r,chatMode:i=`agent`,onChatModeChange:a,onModelChange:o,thinkingLevel:s,onThinkingLevelChange:c,onStop:l,onSend:u,onSlashCommandSelect:d,onLocalSlashSubmit:f,modelPickerOpen:p,onModelPickerOpenChange:m,effortPickerOpen:h,onEffortPickerOpenChange:g,workspaceReferences:_=Bu,workspaceSuggestions:v,onWorkspaceReferenceSelect:y,onRemoveWorkspaceReference:b,controlled:x,disabled:S,autoFocus:C,placeholder:w,attachments:T,questionBar:E,slashCommands:D,className:O}){let{activeTriggerIndex:k,combinedPickerOpen:A,commandGroups:j,files:M,handleCombinedPickerOpenChange:N,handlePromptKeyDown:P,handleSelectorModelChange:F,images:I,isStreaming:L,navigation:R,filteredWorkspaceItems:z,removeTriggerToken:B,selectCommand:H,selectWorkspaceReference:U,selectorModels:W,send:G,setActiveTriggerIndex:ee,setDismissedQuestionId:te,setValue:ne,showQuestion:re,slashMatch:ie,slashQuery:ae,triggerItems:oe,triggerKind:se,triggerOpen:ce,value:le,workspaceMentionMatch:ue,workspaceQuery:de}=Ru({models:t,status:n,thinkingLevel:s,onModelChange:o,onThinkingLevelChange:c,onSend:u,onSlashCommandSelect:d,onLocalSlashSubmit:f,modelPickerOpen:p,onModelPickerOpenChange:m,effortPickerOpen:h,onEffortPickerOpenChange:g,workspaceReferences:_,workspaceSuggestions:v,onWorkspaceReferenceSelect:y,onRemoveWorkspaceReference:b,controlled:x,disabled:S,questionBar:E,attachments:T,slashCommands:D});return(0,Q.jsx)(`div`,{className:q(`shrink-0 px-3 pb-3`,O),children:(0,Q.jsxs)(`div`,{className:`relative mx-auto w-full max-w-an`,children:[(0,Q.jsx)(iu,{label:r??void 0,isActive:L}),re?(0,Q.jsx)(xu,{questionBar:E,navigation:R,roundedTop:!0,onDismiss:te}):null,(0,Q.jsx)(ku,{open:ce,kind:se??`slash`,query:se===`slash`?ae:de,items:se===`mention`?z:void 0,groups:se===`slash`?j:void 0,activeIndex:k,onActiveIndexChange:ee,onSelect:e=>{se===`slash`?H(e):U(e)},onClose:()=>ne(B(se===`slash`?ie:ue)),title:se===`slash`?`Commands`:`Workspace references`,listId:`fleet-composer-trigger-list`}),I.length>0||M.length>0?(0,Q.jsxs)(`div`,{className:`mb-2 flex flex-wrap gap-2 rounded-xl border bg-muted/40 p-2`,children:[I.map(e=>(0,Q.jsxs)(`div`,{className:`group relative`,children:[(0,Q.jsx)(`img`,{src:e.url,alt:e.filename,width:64,height:64,loading:`lazy`,className:`size-16 rounded-lg border object-cover`}),(0,Q.jsx)(V,{type:`button`,variant:`outline`,size:`icon-xs`,"aria-label":`Remove ${e.filename}`,onClick:()=>T?.onRemoveImage?.(e.id),className:`absolute -right-1 -top-1 size-5 rounded-full bg-background opacity-0 shadow-sm transition-opacity group-hover:opacity-100 group-focus-within:opacity-100 focus-visible:opacity-100 [@media(hover:none)]:opacity-100`,children:(0,Q.jsx)(Wr,{"data-icon":`inline-start`,className:`size-3`})})]},e.id)),M.map(e=>(0,Q.jsx)(or,{id:e.id,filename:e.filename,size:e.size,onRemove:T?.onRemoveFile?()=>T.onRemoveFile?.(e.id):void 0},e.id))]}):null,_.length>0?(0,Q.jsx)(`div`,{className:`mb-2 flex flex-wrap gap-1.5 rounded-xl border bg-muted/40 p-2`,children:_.map(e=>(0,Q.jsxs)(`div`,{className:`inline-flex max-w-full items-center gap-1.5 rounded-lg border bg-background px-2 py-1 text-xs text-foreground/75`,children:[(0,Q.jsx)(hr,{className:`size-3.5 shrink-0 text-muted-foreground`}),(0,Q.jsxs)(`span`,{className:`max-w-[min(28rem,70vw)] truncate`,children:[`@`,e.relativePath]}),(0,Q.jsx)(`button`,{type:`button`,"aria-label":`Remove workspace reference ${e.relativePath}`,onClick:()=>b?.(e.relativePath),className:`grid size-5 shrink-0 place-items-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring`,children:(0,Q.jsx)(Wr,{className:`size-3`})})]},e.relativePath))}):null,(0,Q.jsx)(Ue,{id:`fleet-composer-prompt`,name:`prompt`,value:le,onValueChange:ne,onSubmit:e=>G(e),loading:L,submitWhileLoading:!0,onStop:l,disabled:S,autoFocus:C,placeholder:w??`Send a message…`,onPaste:T?.onPaste,"aria-controls":ce?`fleet-composer-trigger-list`:void 0,"aria-expanded":ce,"aria-haspopup":`listbox`,"aria-activedescendant":ce&&oe[k]?`fleet-composer-trigger-list-${oe[k].id.replace(/[^a-zA-Z0-9_-]/g,`-`)}`:void 0,actions:T?.onAttach?[{value:`attach`,label:`Attach file`,description:`Add a file or image to this turn`,icon:(0,Q.jsx)(ro,{})}]:[],onAction:e=>{e===`attach`&&T?.onAttach?.()},onKeyDown:P,leadingAction:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Su,{modes:[...zu],value:i,onChange:e=>a?.(e)}),(0,Q.jsx)(Mu,{models:W,value:e,effort:s,onModelChange:F,onEffortChange:e=>c?.(e),open:A,onOpenChange:N,placeholder:`Model`,className:`rounded-full`})]})})]})})}var Uu=`Fleet Prime is not connected to the Prime Agent runtime. Start or reconnect the runtime, then try again.`;function Wu(e){return e.code===`NETWORK_DISCONNECTED`||/Cannot send daemon command/i.test(e.message)||/Prime Agent daemon is not connected/i.test(e.message)||/not connected to the Prime Agent runtime/i.test(e.message)?{title:`Agent unavailable`,message:Uu}:{title:`Request failed`,message:e.message.replace(/\s+(?:Socket|Daemon log):\s*[^\n]*(?:\s+(?:Socket|Daemon log):\s*[^\n]*)*/gi,``)}}var Gu=(0,Z.lazy)(()=>Gr(async()=>{let{FleetPiToolRenderer:e}=await import(`./fleet-pi-tool-renderer-DMjrKLi2.js`).then(e=>e.n);return{FleetPiToolRenderer:e}},__vite__mapDeps([22,1,2,3,4,5,23,6,8,24,7,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,17,45,46,16,47,48,49,50,51,14,12,15,21,52,53])).then(({FleetPiToolRenderer:e})=>({default:e})));function Ku(e){return(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(`div`,{className:`h-7 animate-pulse rounded-md bg-muted/40`,"aria-label":`Loading tool`}),children:(0,Q.jsx)(Gu,{...e})})}var qu=(0,Z.lazy)(()=>Gr(async()=>{let{AgentActivity:e}=await import(`./agent-activity-CDcDNVC6.js`);return{AgentActivity:e}},__vite__mapDeps([54,1,2,3,4,5,23,6,8,7,25,35,44,55,56,17,45,30,31,33,37])).then(({AgentActivity:e})=>({default:e})));function Ju(e){return(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(`div`,{className:`mt-2 h-8 animate-pulse rounded-md bg-muted/40`,"aria-label":`Loading activity`}),children:(0,Q.jsx)(qu,{...e})})}var Yu=(0,Z.lazy)(()=>Gr(async()=>{let{FleetReasoningPanel:e}=await import(`./fleet-reasoning-panel-MtbSdoCv.js`);return{FleetReasoningPanel:e}},__vite__mapDeps([57,1,2,3,6,25,8,51,14,12,15,21,52,53])).then(({FleetReasoningPanel:e})=>({default:e})));function Xu(e){return(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(`div`,{className:`mb-2 h-6 animate-pulse rounded-md bg-muted/40`,"aria-label":`Loading reasoning`}),children:(0,Q.jsx)(Yu,{...e})})}var Zu=(0,Z.lazy)(()=>Gr(async()=>{let{FleetToolTimeline:e}=await import(`./fleet-tool-timeline-COzPrwr8.js`).then(e=>e.n);return{FleetToolTimeline:e}},__vite__mapDeps([58,1,2,3,6,8,25,46,31])).then(({FleetToolTimeline:e})=>({default:e})));function Qu(e){return(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(`div`,{className:`h-6 animate-pulse rounded-md bg-muted/40`,"aria-label":`Loading timeline`}),children:(0,Q.jsx)(Zu,{...e})})}var $u=(0,Z.lazy)(()=>Gr(async()=>{let{FleetSubagentList:e}=await import(`./fleet-subagent-list-BnRnrWKS.js`).then(e=>e.n);return{FleetSubagentList:e}},__vite__mapDeps([59,1,2,3,6,25,8,26,60,40,27])).then(({FleetSubagentList:e})=>({default:e})));function ed(e){return(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(`div`,{className:`h-6 animate-pulse rounded-md bg-muted/40`,"aria-label":`Loading subagents`}),children:(0,Q.jsx)($u,{...e})})}var td=(0,Z.lazy)(()=>Gr(async()=>{let{PromptSuggestions:e}=await import(`./prompt-suggestions-CXM6knMK.js`);return{PromptSuggestions:e}},__vite__mapDeps([61,3,1,6,2,52])).then(({PromptSuggestions:e})=>({default:e})));function nd(e){return(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(`div`,{className:`h-8 animate-pulse rounded-full bg-muted/40`,"aria-label":`Loading suggestions`}),children:(0,Q.jsx)(td,{...e})})}var rd=(0,Z.lazy)(()=>Gr(async()=>{let{FleetMessageQueue:e}=await import(`./fleet-message-queue-DPBMIZSU.js`);return{FleetMessageQueue:e}},__vite__mapDeps([62,3,1,6,2,16,8,63,64,12,13,14,26,65])).then(({FleetMessageQueue:e})=>({default:e})));function id(e){return(0,Q.jsx)(Z.Suspense,{fallback:null,children:(0,Q.jsx)(rd,{...e})})}function ad(e){return(e.parts??[]).flatMap(e=>typeof e==`object`&&e&&`type`in e&&e.type===`text`&&`text`in e&&typeof e.text==`string`?[e.text]:[]).join(`
|
|
3
3
|
|
|
4
4
|
`)}function od(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:void 0}function sd(e,...t){let n=od(e);for(let e of t){let t=n?.[e];if(typeof t==`string`&&t.trim())return t}}function cd(e){for(let t of[...e].reverse())for(let e of[...t.parts??[]].reverse()){let t=od(e);if(t?.type!==`tool-FleetReasoning`)continue;let n=od(t.input);if(!(typeof n?.runId!=`string`||typeof n.phase!=`string`||!Array.isArray(n.steps)||typeof n.visibleSteps!=`number`||typeof n.streaming!=`boolean`||typeof n.startedAt!=`number`||typeof n.restingLabel!=`string`))return n}}function ld(e){return/^(.*)-a\d+$/.exec(e)?.[1]}function ud(e,t){if(!e||t.length===0)return[];let n=new Set(t.map(e=>e.id)),r=new Set(t.flatMap(e=>(e.parts??[]).flatMap(e=>{let t=od(e);return typeof t?.toolCallId==`string`&&t.toolCallId?[t.toolCallId]:[]}))),i=new Set(t.flatMap(e=>{let t=ld(e.id);return t?[e.id,t]:[e.id]}));return e.flatMap(e=>e.artifacts).filter(e=>e.sourceMessageId?n.has(e.sourceMessageId):e.sourceToolCallId&&r.has(e.sourceToolCallId)||i.has(e.runId))}function dd(e,t,n=[],r){let i=new Map,a=n.flatMap(e=>e.artifacts),o=e=>{let t=a.findIndex(t=>t.sourceToolCallId===e),n=t>=0?a[t]:void 0,i=n?.kind===`ipython`?`repl`:n?`artifacts`:void 0;if(!(!n||!i||!r))return{label:i===`repl`?`Open in REPL`:`Open in Artifacts`,ariaLabel:`Open ${n.title||`tool result`} artifact ${t+1}`,onClick:()=>r(n.id,i)}};for(let t of e)for(let[e,n]of(t.parts??[]).entries()){let r=od(n),a=r?.type;if(typeof a!=`string`||!a.startsWith(`tool-`))continue;let s=r??{},c=a.slice(5),l=c.toLowerCase();if(l===`fleetreasoning`||l===`thinking`||l===`taskoutput`)continue;let u=String(s.toolCallId??s.id??`${t.id}-${l}-${e}`),d=od(s.input)??od(s.args);if(l===`websearch`||l===`grep`||l===`glob`){i.set(u,{id:u,type:`search`,query:sd(d,`query`,`pattern`,`path`)??c});continue}let f=l.includes(`edit`)||l.includes(`write`)?`edit`:l.includes(`read`)?`read`:`run`;i.set(u,{id:u,type:`tool`,action:f,target:sd(d,`path`,`filePath`,`command`,`cmd`,`code`)??c,openAction:o(u)})}let s=[];for(let e of t?.userBash??[])e.status===`running`&&s.push({id:e.id,type:`trace`,kind:`run`,label:`Bash`,detail:e.command||`User command`,action:o(e.runId)});for(let e of t?.rlmChildren??[])(e.status===`queued`||e.status===`running`)&&s.push({id:`rlm-${e.id}`,type:`trace`,kind:`run`,label:`RLM · ${e.label}`,detail:e.answerPreview||e.status,action:o(e.id)});return t?.goal?.active&&t.goal.status===`active`&&t.goal.objective&&s.push({id:`goal-${t.goal.goalId??`current`}`,type:`step`,label:t.goal.objective,status:t.goal.status===`active`?`active`:`complete`,meta:t.goal.status}),[...s,...Array.from(i.values())]}function fd({messages:e,isLast:t,isStreaming:n,suppressQuestionTool:r,toolRenderers:i,onOpenUIAction:a,activityLabel:o,presentation:s,artifactRuns:c,onOpenArtifact:l,onOpenUIArtifactReady:u}){let d=t&&n,f=(0,Z.useMemo)(()=>e.flatMap((n,o)=>sr(rr((n.parts??[]).filter(e=>e.type!==`tool-FleetReasoning`&&e.type!==`tool-Thinking`)),{messageId:n.id,isLast:t&&o===e.length-1,isStreaming:d,suppressQuestionTool:r,suppressTextWhenPlanWrite:!0,ToolRendererComponent:Ku,TextRendererComponent:lr,toolRenderers:i,onOpenUIAction:a,onOpenUIArtifactReady:u,onOpenArtifact:l})),[t,d,e,l,a,u,r,i]),p=e.flatMap(e=>{let t=ad(e);return t?[t]:[]}).join(`
|
|
5
5
|
|