xedoc-cli 0.1.14 → 0.1.16
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/build/client/assets/api-Bq1vju8d.js +1 -0
- package/build/client/assets/app-layout-DcqaA3vs.js +1 -0
- package/build/client/assets/chat-DssIBrTY.js +1 -0
- package/build/client/assets/composer-controls-C-i2mGP0.js +2 -0
- package/build/client/assets/connect-BpTBAcLO.js +1 -0
- package/build/client/assets/document-title-CVCGo83t.js +1 -0
- package/build/client/assets/folder-open-BGVSSdnS.js +1 -0
- package/build/client/assets/{ghostty-web-D7W7ut0G.js → ghostty-web-C4aYPktj.js} +1 -1
- package/build/client/assets/header-menu-BZ8Qg4Vi.js +1 -0
- package/build/client/assets/home-bVxFnHUg.js +1 -0
- package/build/client/assets/input-DmJ6N0Sh.js +1 -0
- package/build/client/assets/label-PRFnRUMj.js +1 -0
- package/build/client/assets/manifest-62799e7e.js +1 -0
- package/build/client/assets/popover-DTbjnDSA.js +1 -0
- package/build/client/assets/root-BU4hb_em.js +1 -0
- package/build/client/assets/root-C6Tru0U5.css +2 -0
- package/build/client/assets/session-provider-Bxa1AL3n.js +1 -0
- package/build/client/assets/triangle-alert-CX-fS3B2.js +1 -0
- package/build/client/assets/usePositioner-DoPOYGgd.js +1 -0
- package/build/server/index.js +1 -1
- package/package.json +1 -2
- package/build/client/assets/app-layout-lHxV3BNh.js +0 -1
- package/build/client/assets/app-shell-Bo8pv11U.js +0 -2
- package/build/client/assets/chat-C2zq74m2.js +0 -1
- package/build/client/assets/connect-tAEbMlde.js +0 -1
- package/build/client/assets/document-title-CHO2Odju.js +0 -1
- package/build/client/assets/home-wk_AHvg3.js +0 -1
- package/build/client/assets/label-DCuf6YnR.js +0 -1
- package/build/client/assets/manifest-ed43c94b.js +0 -1
- package/build/client/assets/root-BRJo5KR5.css +0 -2
- package/build/client/assets/root-CEanGH3t.js +0 -1
- package/build/client/assets/session-provider-Bm2PmtNc.js +0 -1
- /package/build/client/assets/{__vite-browser-external-2447137e-Bol1bTns.js → __vite-browser-external-2447137e-BGy5hUdF.js} +0 -0
- /package/build/client/assets/{app-shell-DdKuH37F.css → header-menu-DdKuH37F.css} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{F as e,L as t,R as n,t as r}from"./jsx-runtime-BD6xVgfN.js";import{t as s}from"./react-dom-Cmetac4J.js";import{$ as o,A as i,At as a,B as c,Bt as u,C as l,Ct as d,D as h,Dt as f,E as p,F as g,Ft as m,G as v,H as y,I as b,It as w,J as x,Jt as R,K as k,Kt as E,L as S,Lt as O,M as C,Mt as T,N as _,Nt as M,O as I,Ot as A,P,Pt as N,Q as F,Qt as j,R as D,Rt as B,S as L,St as U,T as q,Tt as H,U as Y,V as W,W as z,Wt as X,X as Q,Xt as $,Y as V,Z as K,Zt as G,_ as J,_n as Z,_t as ee,a as te,an as ne,at as re,b as se,c as oe,ct as ie,d as ae,dn as ce,dt as ue,en as le,et as de,f as he,fn as fe,ft as pe,g as ge,gn as me,gt as ve,h as ye,hn as be,ht as we,i as xe,it as Re,j as ke,jt as Ee,k as Se,kt as Oe,l as Ce,ln as Te,lt as _e,m as Me,mn as Ie,mt as Ae,n as Pe,nn as Ne,nt as Fe,ot as je,p as De,pt as Be,q as Le,r as Ue,rt as qe,sn as He,st as Ye,t as We,tt as ze,u as Xe,un as Qe,ut as $e,v as Ve,vt as Ke,w as Ge,wt as Je,x as Ze,xt as et,y as tt,zt as nt}from"./usePositioner-DoPOYGgd.js";import{$ as rt,At as st,Bt as ot,Ct as it,Dt as at,Et as ct,Ft as ut,G as lt,Ht as dt,It as ht,J as ft,K as pt,Lt as gt,Mt as mt,Nt as vt,Ot as yt,Pt as bt,Q as wt,Rt as xt,St as Rt,U as kt,Vt as Et,Wt as St,X as Ot,Y as Ct,Z as Tt,_t,dt as Mt,et as It,ht as At,kt as Pt,mt as Nt,n as Ft,nt as jt,st as Dt,t as Bt,tt as Lt,ut as Ut,vt as qt,zt as Ht}from"./api-Bq1vju8d.js";import{d as Yt,l as Wt,r as zt,u as Xt}from"./input-DmJ6N0Sh.js";var Qt=class extends Z{constructor(e,t){super(),this.options=t,this.#e=e,this.#t=null,this.#n=G(),this.bindMethods(),this.setOptions(t)}#e;#r=void 0;#s=void 0;#o=void 0;#i;#a;#n;#t;#c;#u;#l;#d;#h;#f;#p=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){1===this.listeners.size&&(this.#r.addObserver(this),$t(this.#r,this.options)?this.#g():this.updateResult(),this.#m())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Vt(this.#r,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Vt(this.#r,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#v(),this.#y(),this.#r.removeObserver(this)}setOptions(e){const t=this.options,n=this.#r;if(this.options=this.#e.defaultQueryOptions(e),void 0!==this.options.enabled&&"boolean"!=typeof this.options.enabled&&"function"!=typeof this.options.enabled&&"boolean"!=typeof Te(this.options.enabled,this.#r))throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#b(),this.#r.setOptions(this.options),t._defaulted&&!ce(this.options,t)&&this.#e.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#r,observer:this});const r=this.hasListeners();r&&Kt(this.#r,n,this.options,t)&&this.#g(),this.updateResult(),!r||this.#r===n&&Te(this.options.enabled,this.#r)===Te(t.enabled,this.#r)&&Qe(this.options.staleTime,this.#r)===Qe(t.staleTime,this.#r)||this.#w();const s=this.#x();!r||this.#r===n&&Te(this.options.enabled,this.#r)===Te(t.enabled,this.#r)&&s===this.#f||this.#R(s)}getOptimisticResult(e){const t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);var r;return r=n,ce(this.getCurrentResult(),r)||(this.#o=n,this.#a=this.options,this.#i=this.#r.state),n}getCurrentResult(){return this.#o}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),"promise"===n&&(this.trackProp("data"),this.options.experimental_prefetchInRender||"pending"!==this.#n.status||this.#n.reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(e,n))})}trackProp(e){this.#p.add(e)}getCurrentQuery(){return this.#r}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return this.#g({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#o))}#g(e){this.#b();let t=this.#r.fetch(this.options,e);return e?.throwOnError||(t=t.catch(ne)),t}#w(){this.#v();const e=Qe(this.options.staleTime,this.#r);if(j.isServer()||this.#o.isStale||!Ne(e))return;const t=Ie(this.#o.dataUpdatedAt,e)+1;this.#d=be.setTimeout(()=>{this.#o.isStale||this.updateResult()},t)}#x(){return("function"==typeof this.options.refetchInterval?this.options.refetchInterval(this.#r):this.options.refetchInterval)??!1}#R(e){this.#y(),this.#f=e,!j.isServer()&&!1!==Te(this.options.enabled,this.#r)&&Ne(this.#f)&&0!==this.#f&&(this.#h=be.setInterval(()=>{(this.options.refetchIntervalInBackground||me.isFocused())&&this.#g()},this.#f))}#m(){this.#w(),this.#R(this.#x())}#v(){void 0!==this.#d&&(be.clearTimeout(this.#d),this.#d=void 0)}#y(){void 0!==this.#h&&(be.clearInterval(this.#h),this.#h=void 0)}createResult(e,t){const n=this.#r,r=this.options,s=this.#o,o=this.#i,i=this.#a,a=e!==n?e.state:this.#s,{state:c}=e;let u,l={...c},d=!1;if(t._optimisticResults){const s=this.hasListeners(),o=!s&&$t(e,t),i=s&&Kt(e,n,t,r);(o||i)&&(l={...l,...R(c.data,e.options)}),"isRestoring"===t._optimisticResults&&(l.fetchStatus="idle")}let{error:h,errorUpdatedAt:f,status:p}=l;u=l.data;let g=!1;if(void 0!==t.placeholderData&&void 0===u&&"pending"===p){let e;s?.isPlaceholderData&&t.placeholderData===i?.placeholderData?(e=s.data,g=!0):e="function"==typeof t.placeholderData?t.placeholderData(this.#l?.state.data,this.#l):t.placeholderData,void 0!==e&&(p="success",u=He(s?.data,e,t),d=!0)}if(t.select&&void 0!==u&&!g)if(s&&u===o?.data&&t.select===this.#c)u=this.#u;else try{this.#c=t.select,u=t.select(u),u=He(s?.data,u,t),this.#u=u,this.#t=null}catch(k){this.#t=k}this.#t&&(h=this.#t,u=this.#u,f=Date.now(),p="error");const m="fetching"===l.fetchStatus,v="pending"===p,y="error"===p,b=v&&m,w=void 0!==u,x={status:p,fetchStatus:l.fetchStatus,isPending:v,isSuccess:"success"===p,isError:y,isInitialLoading:b,isLoading:b,data:u,dataUpdatedAt:l.dataUpdatedAt,error:h,errorUpdatedAt:f,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>a.dataUpdateCount||l.errorUpdateCount>a.errorUpdateCount,isFetching:m,isRefetching:m&&!v,isLoadingError:y&&!w,isPaused:"paused"===l.fetchStatus,isPlaceholderData:d,isRefetchError:y&&w,isStale:Gt(e,t),refetch:this.refetch,promise:this.#n,isEnabled:!1!==Te(t.enabled,e)};if(this.options.experimental_prefetchInRender){const t=void 0!==x.data,r="error"===x.status&&!t,s=e=>{r?e.reject(x.error):t&&e.resolve(x.data)},o=()=>{s(this.#n=x.promise=G())},i=this.#n;switch(i.status){case"pending":e.queryHash===n.queryHash&&s(i);break;case"fulfilled":(r||x.data!==i.value)&&o();break;case"rejected":r&&x.error===i.reason||o()}}return x}updateResult(){const e=this.#o,t=this.createResult(this.#r,this.options);if(this.#i=this.#r.state,this.#a=this.options,void 0!==this.#i.data&&(this.#l=this.#r),ce(t,e))return;this.#o=t;this.#k({listeners:(()=>{if(!e)return!0;const{notifyOnChangeProps:t}=this.options,n="function"==typeof t?t():t;if("all"===n||!n&&!this.#p.size)return!0;const r=new Set(n??this.#p);return this.options.throwOnError&&r.add("error"),Object.keys(this.#o).some(t=>{const n=t;return this.#o[n]!==e[n]&&r.has(n)})})()})}#b(){const e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#r)return;const t=this.#r;this.#r=e,this.#s=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#m()}#k(e){$.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#o)}),this.#e.getQueryCache().notify({query:this.#r,type:"observerResultsUpdated"})})}};function $t(e,t){return function(e,t){return!1!==Te(t.enabled,e)&&void 0===e.state.data&&!("error"===e.state.status&&!1===Te(t.retryOnMount,e))}(e,t)||void 0!==e.state.data&&Vt(e,t,t.refetchOnMount)}function Vt(e,t,n){if(!1!==Te(t.enabled,e)&&"static"!==Qe(t.staleTime,e)){const r="function"==typeof n?n(e):n;return"always"===r||!1!==r&&Gt(e,t)}return!1}function Kt(e,t,n,r){return(e!==t||!1===Te(r.enabled,e))&&(!n.suspense||"error"!==e.state.status)&&Gt(e,n)}function Gt(e,t){return!1!==Te(t.enabled,e)&&e.isStaleByTime(Qe(t.staleTime,e))}var Jt=class extends Z{#e;#o=void 0;#E;#S;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#O()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){const t=this.options;this.options=this.#e.defaultMutationOptions(e),ce(this.options,t)||this.#e.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#E,observer:this}),t?.mutationKey&&this.options.mutationKey&&le(t.mutationKey)!==le(this.options.mutationKey)?this.reset():"pending"===this.#E?.state.status&&this.#E.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#E?.removeObserver(this)}onMutationUpdate(e){this.#O(),this.#k(e)}getCurrentResult(){return this.#o}reset(){this.#E?.removeObserver(this),this.#E=void 0,this.#O(),this.#k()}mutate(e,t){return this.#S=t,this.#E?.removeObserver(this),this.#E=this.#e.getMutationCache().build(this.#e,this.options),this.#E.addObserver(this),this.#E.execute(e)}#O(){const e=this.#E?.state??E();this.#o={...e,isPending:"pending"===e.status,isSuccess:"success"===e.status,isError:"error"===e.status,isIdle:"idle"===e.status,mutate:this.mutate,reset:this.reset}}#k(e){$.batch(()=>{if(this.#S&&this.hasListeners()){const n=this.#o.variables,r=this.#o.context,s={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if("success"===e?.type){try{this.#S.onSuccess?.(e.data,n,r,s)}catch(t){Promise.reject(t)}try{this.#S.onSettled?.(e.data,null,n,r,s)}catch(t){Promise.reject(t)}}else if("error"===e?.type){try{this.#S.onError?.(e.error,n,r,s)}catch(t){Promise.reject(t)}try{this.#S.onSettled?.(void 0,e.error,n,r,s)}catch(t){Promise.reject(t)}}}this.listeners.forEach(e=>{e(this.#o)})})}},Zt=r(),en=n(e(),1),tn=en.createContext(!1),nn=()=>en.useContext(tn);tn.Provider;var rn=en.createContext(function(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}()),sn=()=>en.useContext(rn),on=(e,t,n)=>{const r=n?.state.error&&"function"==typeof e.throwOnError?fe(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},an=e=>{en.useEffect(()=>{e.clearReset()},[e])},cn=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:s})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(s&&void 0===e.data||fe(n,[e.error,r])),un=e=>{if(e.suspense){const t=1e3,n=e=>"static"===e?e:Math.max(e??t,t),r=e.staleTime;e.staleTime="function"==typeof r?(...e)=>n(r(...e)):n(r),"number"==typeof e.gcTime&&(e.gcTime=Math.max(e.gcTime,t))}},ln=(e,t)=>e?.suspense&&t.isPending,dn=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function hn(e,t){return function(e,t,n){const r=nn(),s=sn(),o=X(n),i=o.defaultQueryOptions(e);o.getDefaultOptions().queries?._experimental_beforeQuery?.(i);const a=o.getQueryCache().get(i.queryHash);i._optimisticResults=r?"isRestoring":"optimistic",un(i),on(i,s,a),an(s);const c=!o.getQueryCache().get(i.queryHash),[u]=en.useState(()=>new t(o,i)),l=u.getOptimisticResult(i),d=!r&&!1!==e.subscribed;if(en.useSyncExternalStore(en.useCallback(e=>{const t=d?u.subscribe($.batchCalls(e)):ne;return u.updateResult(),t},[u,d]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),en.useEffect(()=>{u.setOptions(i)},[i,u]),ln(i,l))throw dn(i,u,s);if(cn({result:l,errorResetBoundary:s,throwOnError:i.throwOnError,query:a,suspense:i.suspense}))throw l.error;return o.getDefaultOptions().queries?._experimental_afterQuery?.(i,l),i.experimental_prefetchInRender&&!j.isServer()&&((e,t)=>e.isLoading&&e.isFetching&&!t)(l,r)&&(c?dn(i,u,s):a?.promise)?.catch(ne).finally(()=>{u.updateResult()}),i.notifyOnChangeProps?l:u.trackResult(l)}(e,Qt,t)}function fn(e,t){const n=X(t),[r]=en.useState(()=>new Jt(n,e));en.useEffect(()=>{r.setOptions(e)},[r,e]);const s=en.useSyncExternalStore(en.useCallback(e=>r.subscribe($.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),o=en.useCallback((e,t)=>{r.mutate(e,t).catch(ne)},[r]);if(s.error&&fe(r.options.throwOnError,[s.error]))throw s.error;return{...s,mutate:o,mutateAsync:s.mutate}}var pn=St("brain",[["path",{d:"M12 18V5",key:"adv99a"}],["path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4",key:"1e3is1"}],["path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5",key:"1gqd8o"}],["path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77",key:"iwvgf7"}],["path",{d:"M18 18a4 4 0 0 0 2-7.464",key:"efp6ie"}],["path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517",key:"1gq6am"}],["path",{d:"M6 18a4 4 0 0 1-2-7.464",key:"k1g0md"}],["path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77",key:"q97ue3"}]]),gn=St("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]),mn=St("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]),vn=St("clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6l4 2",key:"mmk7yg"}]]),yn=St("file",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}]]),bn=St("list-checks",[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}]]),wn=St("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]),xn=St("refresh-cw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]),Rn=St("terminal",[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]]),kn=St("user-round",[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]]),En=St("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),Sn=0;function On(e,t={}){const{preventScroll:n=!1,cancelPrevious:r=!0,sync:s=!1}=t;r&&cancelAnimationFrame(Sn);const o=()=>e?.focus({preventScroll:n});if(s)return o(),Ht;const i=requestAnimationFrame(o);return Sn=i,()=>{Sn===i&&(cancelAnimationFrame(i),Sn=0)}}var Cn={inert:new WeakMap,"aria-hidden":new WeakMap},Tn="data-base-ui-inert",_n={inert:new WeakSet,"aria-hidden":new WeakSet},Mn=new WeakMap,In=0;function An(e){return e?qt(e)?e.host:An(e.parentNode):null}var Pn=(e,t)=>t.map(t=>{if(e.contains(t))return t;const n=An(t);return e.contains(n)?n:null}).filter(e=>null!=e),Nn=e=>{const t=new Set;return e.forEach(e=>{let n=e;for(;n&&!t.has(n);)t.add(n),n=n.parentNode}),t},Fn=(e,t,n)=>{const r=[],s=e=>{e&&!n.has(e)&&Array.from(e.children).forEach(e=>{"script"!==Dt(e)&&(t.has(e)?s(e):r.push(e))})};return s(e),r};function jn(e,t,n,r,{mark:s=!0,markerIgnoreElements:o=[]}){const i=r?"inert":n?"aria-hidden":null;let a=null,c=null;const u=Pn(t,e),l=s?Pn(t,o):[],d=new Set(l),h=s?Fn(t,Nn(u),new Set(u)).filter(e=>!d.has(e)):[],f=[],p=[];if(i){const e=Cn[i],n=function(e){return _n[e]}(i);c=n,a=e;const r=Pn(t,Array.from(t.querySelectorAll("[aria-live]"))),s=u.concat(r);Fn(t,Nn(s),new Set(s)).forEach(t=>{const r=t.getAttribute(i),s=null!==r&&"false"!==r,o=(e.get(t)||0)+1;e.set(t,o),f.push(t),1===o&&s&&n.add(t),s||t.setAttribute(i,"inert"===i?"":"true")})}return s&&h.forEach(e=>{const t=(Mn.get(e)||0)+1;Mn.set(e,t),p.push(e),1===t&&e.setAttribute(Tn,"")}),In+=1,()=>{a&&f.forEach(e=>{const t=(a.get(e)||0)-1;a.set(e,t),t||(!c?.has(e)&&i&&e.removeAttribute(i),c?.delete(e))}),s&&p.forEach(e=>{const t=(Mn.get(e)||0)-1;Mn.set(e,t),t||e.removeAttribute(Tn)}),(In-=1)||(Cn.inert=new WeakMap,Cn["aria-hidden"]=new WeakMap,_n.inert=new WeakSet,_n["aria-hidden"]=new WeakSet,Mn=new WeakMap)}}function Dn(e,t={}){const{ariaHidden:n=!1,inert:r=!1,mark:s=!0,markerIgnoreElements:o=[]}=t;return jn(e,It(e[0]).body,n,r,{mark:s,markerIgnoreElements:o})}var Bn=[];function Ln(){Bn=Bn.filter(e=>e.deref()?.isConnected)}function Un(){return Ln(),Bn[Bn.length-1]?.deref()}function qn(e,t){if(e.hasAttribute("tabindex")&&!e.hasAttribute("data-tabindex"))return;if(!t.current.includes("floating")&&!e.getAttribute("role")?.includes("dialog"))return;const n=Le(e).filter(e=>{const t=e.getAttribute("data-tabindex")||"";return o(e)||e.hasAttribute("data-tabindex")&&!t.startsWith("-")}),r=e.getAttribute("tabindex");t.current.includes("floating")||0===n.length?"0"!==r&&e.setAttribute("tabindex","0"):("-1"!==r||e.hasAttribute("data-tabindex")&&"-1"!==e.getAttribute("data-tabindex"))&&(e.setAttribute("tabindex","-1"),e.setAttribute("data-tabindex","-1"))}function Hn(e){const{context:t,children:n,disabled:r=!1,initialFocus:s=!0,returnFocus:i=!0,restoreFocus:u=!1,modal:l=!0,closeOnFocusOut:h=!0,openInteractionType:f="",nextFocusableElement:p,previousFocusableElement:g,beforeContentFocusGuardRef:m,externalTree:y,getInsideElements:R}=e,E="rootStore"in t?t.rootStore:t,S=E.useState("open"),O=E.useState("domReferenceElement"),C=E.useState("floatingElement"),{events:T,dataRef:_}=E.context,M=Lt(()=>_.current.floatingContext?.nodeId),I=!1===s,A=pe(O)&&I,P=en.useRef(["content"]),j=d(s),D=d(i),B=d(f),L=b(y),q=c(),Y=en.useRef(!1),W=en.useRef(!1),X=en.useRef(!1),Q=en.useRef(null),$=en.useRef(""),K=en.useRef(""),G=en.useRef(null),J=en.useRef(null),Z=jt(G,m,q?.beforeInsideRef),ee=jt(J,q?.afterInsideRef),te=w(),ne=w(),re=U(),se=null!=q,oe=ue(C),ae=Lt((e=oe)=>e?de(e):[]),ce=Lt(()=>R?.().filter(e=>null!=e)??[]);en.useEffect(()=>{if(!r&&l)return H(It(oe),"keydown",function(e){"Tab"===e.key&&wt(oe,Tt(It(oe)))&&0===ae().length&&!A&&Ee(e)})},[r,O,oe,l,P,A,ae]),en.useEffect(()=>{if(r||!S)return;const e=It(oe);function t(){X.current=!1}return Je(H(e,"pointerdown",function(e){const t=rt(e),n=ce();X.current=!(wt(C,t)||wt(O,t)||wt(q?.portalNode,t)||n.some(e=>e===t||wt(e,t))),K.current=e.pointerType||"keyboard",t?.closest("[data-base-ui-click-trigger]")&&(W.current=!0)},!0),H(e,"pointerup",t,!0),H(e,"pointercancel",t,!0),H(e,"keydown",function(){K.current="keyboard"},!0))},[r,C,O,oe,S,q,ce]),en.useEffect(()=>{if(r||!h)return;const e=It(oe);function t(t){const n=t.relatedTarget,r=t.currentTarget,s=rt(t);queueMicrotask(()=>{const o=M(),i=E.context.triggerElements,a=ce(),c=n?.hasAttribute(z("focus-guard"))&&[G.current,J.current,q?.beforeInsideRef.current,q?.afterInsideRef.current,q?.beforeOutsideRef.current,q?.afterOutsideRef.current,ke(g),ke(p)].includes(n),d=!(wt(O,n)||wt(C,n)||wt(n,C)||wt(q?.portalNode,n)||a.some(e=>e===n||wt(e,n))||null!=n&&i.hasElement(n)||i.hasMatchingElement(e=>wt(e,n))||c||L&&(k(L.nodesRef.current,o).find(e=>wt(e.context?.elements.floating,n)||wt(e.context?.elements.domReference,n))||v(L.nodesRef.current,o).find(e=>[e.context?.elements.floating,ue(e.context?.elements.floating)].includes(n)||e.context?.elements.domReference===n)));if(r===O&&oe&&qn(oe,P),u&&r!==O&&!ie(s)&&Tt(e)===e.body){if(Nt(oe)&&(oe.focus(),"popup"===u))return void re.request(()=>{oe.focus()});const e=ae(),t=Q.current,n=(t&&e.includes(t)?t:null)||e[e.length-1]||oe;Nt(n)&&n.focus()}_.current.insideReactTree?_.current.insideReactTree=!1:!A&&l||!n||!d||W.current||!A&&n===Un()||(Y.current=!0,E.setOpen(!1,Rt(at,t)))})}const n=Nt(O)?O:null;return C||n?Je(n&&H(n,"focusout",t),n&&H(n,"pointerdown",function(){W.current=!0,ne.start(0,()=>{W.current=!1})}),C&&H(C,"focusin",function(e){const t=rt(e);o(t)&&(Q.current=t)}),C&&H(C,"focusout",t),C&&q&&H(C,"focusout",function(){X.current||(_.current.insideReactTree=!0,te.start(0,()=>{_.current.insideReactTree=!1}))},!0)):void 0},[r,O,C,oe,l,L,q,E,h,u,ae,A,M,P,_,te,ne,re,p,g,ce]),en.useEffect(()=>{if(r||!C||!S)return;const e=Array.from(q?.portalNode?.querySelectorAll(`[${z("portal")}]`)||[]),t=(L?v(L.nodesRef.current,M()):[]).find(e=>pe(e.context?.elements.domReference||null))?.context?.elements.domReference,n=Dn([C,...e,G.current,J.current,q?.beforeOutsideRef.current,q?.afterOutsideRef.current,...ce(),t,ke(g),ke(p),A?O:null].filter(e=>null!=e),{ariaHidden:l||A,mark:!1}),s=Dn([C,...e].filter(e=>null!=e));return()=>{s(),n()}},[S,r,O,C,l,P,q,A,L,M,p,g,ce]),Et(()=>{if(!S||r||!Nt(oe))return;const e=Tt(It(oe));queueMicrotask(()=>{const t=j.current,n="function"==typeof t?t(B.current||""):t;if(void 0===n||!1===n)return;if(wt(oe,e))return;let r=null;const s=()=>(null==r&&(r=ae(oe)),r[0]||oe);let o;o=!0===n||null===n?s():ke(n),o=o||s(),On(o,{preventScroll:o===oe})})},[r,S,oe,I,ae,j,B]),Et(()=>{if(r||!oe)return;const e=It(oe);var t;function n(e){if(e.open||($.current=function(e,t){const n=Mt(rt(e));return e instanceof n.KeyboardEvent?"keyboard":e instanceof n.FocusEvent?t||"keyboard":"pointerType"in e?e.pointerType||"keyboard":"touches"in e?"touch":e instanceof n.MouseEvent?t||(0===e.detail?"keyboard":"mouse"):""}(e.nativeEvent,K.current)),"trigger-hover"===e.reason&&"mouseleave"===e.nativeEvent.type&&(Y.current=!0),"outside-press"===e.reason)if(e.nested)Y.current=!1;else if(Oe(e.nativeEvent)||a(e.nativeEvent))Y.current=!1;else{let e=!1;It(oe).createElement("div").focus({get preventScroll(){return e=!0,!1}}),Y.current=!e}}return t=Tt(e),Ln(),t&&"body"!==Dt(t)&&(Bn.push(new WeakRef(t)),Bn.length>20&&(Bn=Bn.slice(-20))),T.on("openchange",n),()=>{T.off("openchange",n);const t=Tt(e),r=ce(),s=wt(C,t)||r.some(e=>e===t||wt(e,t))||L&&k(L.nodesRef.current,M(),!1).some(e=>wt(e.context?.elements.floating,t)),i=D.current,a=function(){const e=D.current;let t="function"==typeof e?e($.current):e;if(void 0===t||!1===t)return null;if(null===t&&(t=!0),"boolean"==typeof t){const e=O||Un();return e&&e.isConnected?e:null}const n=O||Un();return ke(t)||n||null}();queueMicrotask(()=>{const n=(r=a)?o(r)?r:de(r)[0]||r:null;var r;const c="boolean"!=typeof i;i&&!Y.current&&Nt(n)&&(c||n===t||t===e.body||s)&&n.focus({preventScroll:!0}),Y.current=!1})}},[r,C,oe,D,_,T,L,O,M,ce]),Et(()=>{if(!N||S||!C)return;const e=Tt(It(C));Nt(e)&&Be(e)&&wt(C,e)&&e.blur()},[S,C]),Et(()=>{if(!r&&q)return q.setFocusManagerState({modal:l,closeOnFocusOut:h,open:S,onOpenChange:E.setOpen,domReference:O}),()=>{q.setFocusManagerState(null)}},[r,q,l,S,E,h,O]),Et(()=>{if(!r&&oe)return qn(oe,P),()=>{queueMicrotask(Ln)}},[r,oe,P]);const le=!r&&(!l||!A)&&(se||l);return(0,Zt.jsxs)(en.Fragment,{children:[le&&(0,Zt.jsx)(Ke,{"data-type":"inside",ref:Z,onFocus:e=>{if(l){const e=ae();On(e[e.length-1])}else q?.portalNode&&(Y.current=!1,F(e,q.portalNode)?x(O)?.focus():ke(g??q.beforeOutsideRef)?.focus())}}),n,le&&(0,Zt.jsx)(Ke,{"data-type":"inside",ref:ee,onFocus:e=>{l?On(ae()[0]):q?.portalNode&&(h&&(Y.current=!0),F(e,q.portalNode)?V(O)?.focus():ke(p??q.afterOutsideRef)?.focus())}})]})}function Yn(e,t={}){const n="rootStore"in e?e.rootStore:e,r=n.context.dataRef,{enabled:s=!0,event:o="click",toggle:i=!0,ignoreMouse:a=!1,stickIfOpen:c=!0,touchOpenDelay:u=0,reason:l=ht}=t,d=en.useRef(void 0),h=U(),p=w(),g=en.useMemo(()=>({onPointerDown(e){d.current=e.pointerType},onMouseDown(e){const t=d.current,s=e.nativeEvent,f=n.select("open");if(0!==e.button||"click"===o||A(t,!0)&&a)return;const g=r.current.openEvent,m=g?.type,v=n.select("domReferenceElement")!==e.currentTarget,y=f&&v||!(f&&i&&(!g||!c||("click"===m||"mousedown"===m))),b=rt(s);if(Be(b)){const e=Rt(l,s,b);return void(y&&"touch"===t&&u>0?p.start(u,()=>{n.setOpen(!0,e)}):n.setOpen(y,e))}const w=e.currentTarget;h.request(()=>{const e=Rt(l,s,w);y&&"touch"===t&&u>0?p.start(u,()=>{n.setOpen(!0,e)}):n.setOpen(y,e)})},onClick(e){if("mousedown-only"===o)return;const t=d.current;if("mousedown"===o&&t)return void(d.current=void 0);if(A(t,!0)&&a)return;const s=n.select("open"),h=r.current.openEvent,g=n.select("domReferenceElement")!==e.currentTarget,m=s&&g||!(s&&i&&(!h||!c||f(h))),v=Rt(l,e.nativeEvent,e.currentTarget);m&&"touch"===t&&u>0?p.start(u,()=>{n.setOpen(!0,v)}):n.setOpen(m,v)},onKeyDown(){d.current=void 0}}),[r,o,a,n,c,i,h,p,u,l]);return en.useMemo(()=>s?{reference:g}:xt,[s,g])}function Wn(e,t,n){switch(e){case"vertical":return t;case"horizontal":return n;default:return t||n}}function zn(e,t){return Wn(t,"ArrowUp"===e||"ArrowDown"===e,"ArrowLeft"===e||"ArrowRight"===e)}function Xn(e,t,n){return Wn(t,"ArrowDown"===e,n?"ArrowLeft"===e:"ArrowRight"===e)||"Enter"===e||" "===e||""===e}function Qn(e,t){const n="rootStore"in e?e.rootStore:e,r=n.useState("open"),s=n.useState("floatingElement"),o=n.useState("domReferenceElement"),i=n.context.dataRef,{listRef:c,activeIndex:u,onNavigate:l=()=>{},enabled:h=!0,selectedIndex:f=null,allowEscape:p=!1,loopFocus:m=!1,nested:v=!1,rtl:y=!1,virtual:w=!1,focusItemOnOpen:x="auto",focusItemOnHover:R=!0,openOnArrowKeyDown:k=!0,disabledIndices:E,orientation:S="vertical",parentOrientation:O,cols:C=1,id:T,resetOnPointerLeave:_=!0,externalTree:M}=t,I=d(ue(s)),A=g(),P=b(M);Et(()=>{i.current.orientation=S},[i,S]);const N=pe(o),F=en.useRef(x),j=en.useRef(f??-1),D=en.useRef(null),B=en.useRef(!0),L=Lt(e=>{l(-1===j.current?null:j.current,e)}),U=en.useRef(L),q=en.useRef(!!s),H=en.useRef(r),Y=en.useRef(!1),W=en.useRef(!1),z=en.useRef(null),X=d(E),Q=d(r),$=d(f),V=d(_),K=Lt(()=>{function e(e){w?P?.events.emit("virtualfocus",e):z.current=On(e,{sync:Y.current,preventScroll:!0})}const t=c.current[j.current],n=W.current;t&&e(t),(Y.current?e=>e():requestAnimationFrame)(()=>{const r=c.current[j.current]||t;r&&(t||e(r),!Z||!n&&B.current||r.scrollIntoView?.({block:"nearest",inline:"nearest"}))})});Et(()=>{h&&(r&&s?(j.current=f??-1,F.current&&null!=f&&(W.current=!0,L())):q.current&&(j.current=-1,U.current()))},[h,r,s,f,L]),Et(()=>{if(h)if(r){if(s)if(null==u){if(Y.current=!1,null!=$.current)return;if(q.current&&(j.current=-1,K()),(!H.current||!q.current)&&F.current&&(null!=D.current||!0===F.current&&null==D.current)){let e=0;const t=()=>{null==c.current[0]?(e<2&&(e?requestAnimationFrame:queueMicrotask)(t),e+=1):(j.current=null==D.current||Xn(D.current,S,y)||v?Ye(c):je(c),D.current=null,L())};t()}}else _e(c.current,u)||(j.current=u,K(),W.current=!1)}else Y.current=!1},[h,r,s,u,$,v,c,S,y,L,K,X]),Et(()=>{if(!h||s||!P||w||!q.current)return;const e=P.nodesRef.current,t=e.find(e=>e.id===A)?.context?.elements.floating,n=Tt(It(s)),r=e.some(e=>e.context&&wt(e.context.elements.floating,n));t&&!r&&B.current&&t.focus({preventScroll:!0})},[h,s,P,A,w]),Et(()=>{U.current=L,H.current=r,q.current=!!s}),Et(()=>{r||(D.current=null,F.current=x)},[r,x]);const G=null!=u,J=Lt(e=>{if(!Q.current)return;const t=c.current.indexOf(e.currentTarget);-1===t||j.current===t&&u===t||(j.current=t,L(e))}),Z=en.useMemo(()=>({onFocus(e){Y.current=!0,J(e)},onClick:({currentTarget:e})=>e.focus({preventScroll:!0}),onMouseMove(e){Y.current=!0,W.current=!1,R&&J(e)},onPointerLeave(e){if(!Q.current||!B.current||"touch"===e.pointerType)return;Y.current=!0;const t=e.relatedTarget;if(R&&!c.current.includes(t)&&V.current&&(z.current?.(),z.current=null,j.current=-1,L(e),!w)){const e=I.current,t=Tt(It(e));e&&wt(e,t)&&e.focus({preventScroll:!0})}}}),[J,Q,I,R,c,L,V,w]),te=en.useCallback(()=>O??P?.nodesRef.current.find(e=>e.id===A)?.context?.dataRef?.current.orientation,[A,P,O]),ne=Lt(e=>{if(B.current=!1,Y.current=!0,229===e.which)return;if(!Q.current&&e.currentTarget===I.current)return;if(v&&function(e,t,n,r){return"both"===t||"horizontal"===t&&r&&r>1?"Escape"===e:Wn(t,n?e===ve:e===we,e===ee)}(e.key,S,y,C))return zn(e.key,te())||Ee(e),n.setOpen(!1,Rt(st,e.nativeEvent)),void(Nt(o)&&(w?P?.events.emit("virtualfocus",o):o.focus()));const t=j.current,s=Ye(c,E),i=je(c,E);if(N||("Home"===e.key&&(Ee(e),j.current=s,L(e)),"End"===e.key&&(Ee(e),j.current=i,L(e))),C>1){const t=Array.from({length:c.current.length},()=>({width:1,height:1})),n=ze(t,C,!1),r=n.findIndex(e=>null!=e&&!$e(c.current,e,E)),o=n.reduce((e,t,n)=>null==t||$e(c.current,t,E)?e:n,-1),a=n[re(n.map(e=>null!=e?c.current[e]:null),{event:e,orientation:S,loopFocus:m,rtl:y,cols:C,disabledIndices:Re([...("function"!=typeof E?E:null)||c.current.map((e,t)=>$e(c.current,t,E)?t:void 0),void 0],n),minIndex:r,maxIndex:o,prevIndex:qe(j.current>i?s:j.current,t,n,C,"ArrowDown"===e.key?"bl":e.key===(y?"ArrowLeft":"ArrowRight")?"tr":"tl"),stopEvent:!0})];if(null!=a&&(j.current=a,L(e)),"both"===S)return}if(zn(e.key,S)){if(Ee(e),r&&!w&&Tt(e.currentTarget.ownerDocument)===e.currentTarget)return j.current=Xn(e.key,S,y)?s:i,void L(e);Xn(e.key,S,y)?m?t>=i?p&&t!==c.current.length?j.current=-1:(Y.current=!1,j.current=s):j.current=Fe(c.current,{startingIndex:t,disabledIndices:E}):j.current=Math.min(i,Fe(c.current,{startingIndex:t,disabledIndices:E})):m?t<=s?p&&-1!==t?j.current=c.current.length:(Y.current=!1,j.current=i):j.current=Fe(c.current,{startingIndex:t,decrement:!0,disabledIndices:E}):j.current=Math.max(s,Fe(c.current,{startingIndex:t,decrement:!0,disabledIndices:E})),_e(c.current,j.current)&&(j.current=-1),L(e)}}),se=en.useMemo(()=>w&&r&&G&&{"aria-activedescendant":`${T}-${u}`},[w,r,G,T,u]),oe=en.useMemo(()=>({"aria-orientation":"both"===S?void 0:S,...N?{}:se,onKeyDown(e){if("Tab"===e.key&&e.shiftKey&&r&&!w){const t=rt(e.nativeEvent);if(t&&!wt(I.current,t))return;return Ee(e),n.setOpen(!1,Rt(at,e.nativeEvent)),void(Nt(o)&&o.focus())}ne(e)},onPointerMove(){B.current=!0}}),[se,ne,I,S,N,n,r,w,o]),ie=en.useMemo(()=>{function e(e){"auto"===x&&Oe(e.nativeEvent)&&(F.current=!w)}function t(e){F.current=x,"auto"===x&&a(e.nativeEvent)&&(F.current=!0)}return{onKeyDown(e){const t=n.select("open");B.current=!1;const r=e.key.startsWith("Arrow"),s=function(e,t,n){return Wn(t,n?e===we:e===ve,e===Ae)}(e.key,te(),y),o=zn(e.key,S),i=(v?s:o)||"Enter"===e.key||""===e.key.trim();if(w&&t)return ne(e);if(t||k||!r){if(i){const t=zn(e.key,te());D.current=v&&t?null:e.key}v?s&&(Ee(e),t?(j.current=Ye(c,X.current),L(e)):n.setOpen(!0,Rt(st,e.nativeEvent,e.currentTarget))):o&&(null!=$.current&&(j.current=$.current),Ee(e),!t&&k?n.setOpen(!0,Rt(st,e.nativeEvent,e.currentTarget)):ne(e),t&&L(e))}},onFocus(e){n.select("open")&&!w&&(j.current=-1,L(e))},onPointerDown:t,onPointerEnter:t,onMouseDown:e,onClick:e}},[ne,X,x,c,v,L,n,k,S,te,y,$,w]),ae=en.useMemo(()=>({...se,...ie}),[se,ie]);return en.useMemo(()=>h?{reference:ae,floating:oe,item:Z,trigger:ie}:{},[h,ae,oe,ie,Z])}var $n=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function Vn(e,t={}){const n="rootStore"in e?e.rootStore:e,r=n.useState("open"),s=n.useState("floatingId"),o=n.useState("domReferenceElement"),i=n.useState("floatingElement"),{role:a="dialog"}=t,c=Ot(),u=o?.id||c,l=en.useMemo(()=>ue(i)?.id||s,[i,s]),d=$n.get(a)??a,h=null!=g(),f=en.useMemo(()=>"tooltip"===d||"label"===a?xt:{"aria-haspopup":"alertdialog"===d?"dialog":d,"aria-expanded":"false",..."listbox"===d&&{role:"combobox"},..."menu"===d&&h&&{role:"menuitem"},..."select"===a&&{"aria-autocomplete":"none"},..."combobox"===a&&{"aria-autocomplete":"list"}},[d,h,a]),p=en.useMemo(()=>"tooltip"===d||"label"===a?{["aria-"+("label"===a?"labelledby":"describedby")]:r?l:void 0}:{...f,"aria-expanded":r?"true":"false","aria-controls":r?l:void 0,..."menu"===d&&{id:u}},[d,l,r,u,a,f]),m=en.useMemo(()=>{const e={id:l,...d&&{role:d}};return"tooltip"===d||"label"===a?e:{...e,..."menu"===d&&{"aria-labelledby":u}}},[d,l,u,a]),v=en.useCallback(({active:e,selected:t})=>{const n={role:"option",...e&&{id:`${l}-fui-option`}};switch(a){case"select":case"combobox":return{...n,"aria-selected":t}}return{}},[l,a]);return en.useMemo(()=>({reference:p,floating:m,item:v,trigger:f}),[p,m,f,v])}function Kn(e,t){const n="rootStore"in e?e.rootStore:e,r=n.context.dataRef,s=n.useState("open"),{listRef:o,elementsRef:i,activeIndex:a,onMatch:c,onTypingChange:u,enabled:l=!0,resetMs:d=750,selectedIndex:h=null}=t,f=w(),p=en.useRef(""),g=en.useRef(h??a??-1),m=en.useRef(null);Et(()=>{(s||null===h)&&(f.clear(),m.current=null,""!==p.current&&(p.current=""))},[s,h,f]),Et(()=>{s&&""===p.current&&(g.current=h??a??-1)},[s,h,a]);const v=Lt(e=>{e?r.current.typing||(r.current.typing=e,u?.(e)):r.current.typing&&(r.current.typing=e,u?.(e))}),y=Lt(e=>{function t(e){const t=i?.current[e];return!t||ie(t)}function n(e,n,r=0){if(0===e.length)return-1;const s=(r%e.length+e.length)%e.length,o=n.toLocaleLowerCase();for(let i=0;i<e.length;i+=1){const n=(s+i)%e.length;if(e[n]?.toLocaleLowerCase().startsWith(o)&&t(n))return n}return-1}const r=o.current;if(p.current.length>0&&" "===e.key&&(Ee(e),v(!0)),p.current.length>0&&" "!==p.current[0]&&-1===n(r,p.current)&&" "!==e.key&&v(!1),null==r||1!==e.key.length||e.ctrlKey||e.metaKey||e.altKey)return;s&&" "!==e.key&&(Ee(e),v(!0));const u=""===p.current;u&&(g.current=h??a??-1),r.every(e=>!e||e[0]?.toLocaleLowerCase()!==e[1]?.toLocaleLowerCase())&&p.current===e.key&&(p.current="",g.current=m.current),p.current+=e.key,f.start(d,()=>{p.current="",g.current=m.current,v(!1)});const l=((u?h??a??-1:g.current)??0)+1,y=n(r,p.current,l);-1!==y?(c?.(y),m.current=y):" "!==e.key&&(p.current="",v(!1))}),b=Lt(e=>{const t=e.relatedTarget,r=n.select("domReferenceElement"),s=n.select("floatingElement"),o=wt(r,t),i=wt(s,t);o||i||(f.clear(),p.current="",g.current=m.current,v(!1))}),x=en.useMemo(()=>({onKeyDown:y,onBlur:b}),[y,b]),R=en.useMemo(()=>({onKeyDown:y,onBlur:b}),[y,b]);return en.useMemo(()=>l?{reference:x,floating:R}:{},[l,x,R])}function Gn(e){return Ct(19)?e:e?"true":void 0}var Jn={},Zn={},er="";function tr(e){const t=It(e),n=t.documentElement,r=t.body,s=Mt(n);let o=0,i=0,a=!1;const c=et.create();if(N&&1!==(s.visualViewport?.scale??1))return()=>{};function u(){const t=s.getComputedStyle(n),c=s.getComputedStyle(r),u=(t.scrollbarGutter||"").includes("both-edges")?"stable both-edges":"stable";o=n.scrollTop,i=n.scrollLeft,Jn={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},er=n.style.scrollBehavior,Zn={position:r.style.position,height:r.style.height,width:r.style.width,boxSizing:r.style.boxSizing,overflowY:r.style.overflowY,overflowX:r.style.overflowX,scrollBehavior:r.style.scrollBehavior};const l=n.scrollHeight>n.clientHeight,d=n.scrollWidth>n.clientWidth,h="scroll"===t.overflowY||"scroll"===c.overflowY,f="scroll"===t.overflowX||"scroll"===c.overflowX,p=Math.max(0,s.innerWidth-r.clientWidth),g=Math.max(0,s.innerHeight-r.clientHeight),m=parseFloat(c.marginTop)+parseFloat(c.marginBottom),v=parseFloat(c.marginLeft)+parseFloat(c.marginRight),y=_t(n)?n:r;if(a=function(e){if("undefined"==typeof CSS||!CSS.supports||!CSS.supports("scrollbar-gutter","stable")||"undefined"==typeof document)return!1;const t=It(e),n=t.documentElement,r=t.body,s=_t(n)?n:r,o=s.style.overflowY,i=n.style.scrollbarGutter;n.style.scrollbarGutter="stable",s.style.overflowY="scroll";const a=s.offsetWidth;s.style.overflowY="hidden";const c=s.offsetWidth;return s.style.overflowY=o,n.style.scrollbarGutter=i,a===c}(e),a)return n.style.scrollbarGutter=u,y.style.overflowY="hidden",void(y.style.overflowX="hidden");Object.assign(n.style,{scrollbarGutter:u,overflowY:"hidden",overflowX:"hidden"}),(l||h)&&(n.style.overflowY="scroll"),(d||f)&&(n.style.overflowX="scroll"),Object.assign(r.style,{position:"relative",height:m||g?`calc(100dvh - ${m+g}px)`:"100dvh",width:v||p?`calc(100vw - ${v+p}px)`:"100vw",boxSizing:"border-box",overflow:"hidden",scrollBehavior:"unset"}),r.scrollTop=o,r.scrollLeft=i,n.setAttribute("data-base-ui-scroll-locked",""),n.style.scrollBehavior="unset"}function l(){Object.assign(n.style,Jn),Object.assign(r.style,Zn),a||(n.scrollTop=o,n.scrollLeft=i,n.removeAttribute("data-base-ui-scroll-locked"),n.style.scrollBehavior=er)}u();const d=H(s,"resize",function(){l(),c.request(u)});return()=>{c.cancel(),l(),"function"==typeof s.removeEventListener&&d()}}var nr=new class{lockCount=0;restore=null;timeoutLock=m.create();timeoutUnlock=m.create();acquire(e){return this.lockCount+=1,1===this.lockCount&&null===this.restore&&this.timeoutLock.start(0,()=>this.lock(e)),this.release}release=()=>{this.lockCount-=1,0===this.lockCount&&this.restore&&this.timeoutUnlock.start(0,this.unlock)};unlock=()=>{0===this.lockCount&&this.restore&&(this.restore?.(),this.restore=null)};lock(e){if(0===this.lockCount||null!==this.restore)return;const t=It(e).documentElement,n=Mt(t).getComputedStyle(t).overflowY;if("hidden"===n||"clip"===n)return void(this.restore=Ht);const r=T||!function(e){if("undefined"==typeof document)return!1;const t=It(e);return Mt(t).innerWidth-t.documentElement.clientWidth>0}(e);this.restore=r?function(e){const t=It(e),n=t.documentElement,r=t.body,s=_t(n)?n:r,o={overflowY:s.style.overflowY,overflowX:s.style.overflowX};return Object.assign(s.style,{overflowY:"hidden",overflowX:"hidden"}),()=>{Object.assign(s.style,o)}}(e):tr(e)}};function rr(e=!0,t=null){Et(()=>{if(e)return nr.acquire(t)},[e,t])}function sr(e,t){const n=en.useRef(e),r=Lt(t);Et(()=>{n.current!==e&&r(n.current)},[e,r]),Et(()=>{n.current=e},[e])}function or(e){const[t,n]=en.useState(null),r=Lt((t,r)=>{e||n(r||(T?"touch":""))});sr(e,t=>{t&&!e&&n(null)});const{onClick:s,onPointerDown:o}=function(e){const t=en.useRef(""),n=en.useCallback(n=>{n.defaultPrevented||(t.current=n.pointerType,e(n,n.pointerType))},[e]);return{onClick:en.useCallback(n=>{0!==n.detail?(e(n,"pointerType"in n?n.pointerType:t.current),t.current=""):e(n,"keyboard")},[e]),onPointerDown:n}}(r);return en.useMemo(()=>({openMethod:t,triggerProps:{onClick:s,onPointerDown:o}}),[t,s,o])}var ir="ArrowUp",ar="ArrowDown",cr="ArrowLeft",ur="ArrowRight",lr="Home",dr=new Set([cr,ur]),hr=new Set([ir,ar]),fr=new Set([...dr,...hr]),pr=(new Set([...fr,lr,"End"]),new Set([ir,ar,cr,ur,lr,"End"])),gr=en.forwardRef(function(e,t){const{cutout:n,...r}=e;let s;if(n){const e=n.getBoundingClientRect();s=`polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${e.left}px ${e.top}px,${e.left}px ${e.bottom}px,${e.right}px ${e.bottom}px,${e.right}px ${e.top}px,${e.left}px ${e.top}px)`}return(0,Zt.jsx)("div",{ref:t,role:"presentation","data-base-ui-inert":"",...r,style:{position:"fixed",inset:0,userSelect:"none",WebkitUserSelect:"none",clipPath:s}})}),mr=en.createContext(void 0);function vr(e){const t=en.useContext(mr);if(void 0===t&&!e)throw new Error(ot(33));return t}var yr=en.createContext(void 0);function br(e){const t=en.useContext(yr);if(void 0===t&&!e)throw new Error(ot(36));return t}var wr=en.createContext(void 0);function xr(e=!0){const t=en.useContext(wr);if(void 0===t&&!e)throw new Error(ot(25));return t}var Rr={type:"regular-item"};function kr(e){const{closeOnClick:t,disabled:n=!1,highlighted:r,id:s,store:o,typingRef:i=o.context.typingRef,nativeButton:a,itemMetadata:c,nodeId:u}=e,l=en.useRef(null),{getButtonProps:d,buttonRef:h}=Xt({disabled:n,focusableWhenDisabled:!0,native:a,composite:!0}),f=function(e){const{closeOnClick:t,highlighted:n,id:r,nodeId:s,store:o,typingRef:i,itemRef:a,itemMetadata:c}=e,{events:u}=o.useState("floatingTreeRoot"),l=xr(!0),d=void 0!==l;return en.useMemo(()=>({id:r,role:"menuitem",tabIndex:n?0:-1,onKeyDown(e){" "===e.key&&i?.current&&e.preventDefault()},onMouseMove(e){s&&u.emit("itemhover",{nodeId:s,target:e.currentTarget})},onClick(e){t&&u.emit("close",{domEvent:e,reason:Pt})},onMouseUp(e){if(l){const t=l.initialCursorPointRef.current;if(l.initialCursorPointRef.current=null,d&&t&&Math.abs(e.clientX-t.x)<=1&&Math.abs(e.clientY-t.y)<=1)return;if(d&&!M&&2===e.button)return}!a.current||!o.context.allowMouseUpTriggerRef.current||d&&2!==e.button||c&&"regular-item"!==c.type||a.current.click()}}),[t,n,r,u,s,o,i,a,l,d,c])}({closeOnClick:t,highlighted:r,id:s,nodeId:u,store:o,typingRef:i,itemRef:l,itemMetadata:c}),p=en.useCallback(e=>ft(f,{onMouseEnter(){"submenu-trigger"===c.type&&c.setActive()}},e,d),[f,d,c]),g=jt(l,h);return en.useMemo(()=>({getItemProps:p,itemRef:g}),[p,g])}var Er=en.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},elementsRef:{current:[]},nextIndexRef:{current:0}});var Sr=function(e){return e[e.None=0]="None",e[e.GuessFromOrder=1]="GuessFromOrder",e}({});function Or(e={}){const{label:t,metadata:n,textRef:r,indexGuessBehavior:s,index:o}=e,{register:i,unregister:a,subscribeMapChange:c,elementsRef:u,labelsRef:l,nextIndexRef:d}=en.useContext(Er),h=en.useRef(-1),[f,p]=en.useState(o??(s===Sr.GuessFromOrder?()=>{if(-1===h.current){const e=d.current;d.current+=1,h.current=e}return h.current}:-1)),g=en.useRef(null),m=en.useCallback(e=>{if(g.current=e,-1!==f&&null!==e&&(u.current[f]=e,l)){const n=void 0!==t;l.current[f]=n?t:r?.current?.textContent??e.textContent}},[f,u,l,t,r]);return Et(()=>{if(null!=o)return;const e=g.current;return e?(i(e,n),()=>{a(e)}):void 0},[o,i,a,n]),Et(()=>{if(null==o)return c(e=>{const t=g.current?e.get(g.current)?.index:null;null!=t&&p(t)})},[o,c,p]),en.useMemo(()=>({ref:m,index:f}),[f,m])}var Cr=function(e){return e.checked="data-checked",e.unchecked="data-unchecked",e.disabled="data-disabled",e.highlighted="data-highlighted",e}({}),Tr={checked:e=>e?{[Cr.checked]:""}:{[Cr.unchecked]:""},...p},_r=en.forwardRef(function(e,t){const{render:n,className:r,id:s,label:o,nativeButton:i=!1,disabled:a=!1,closeOnClick:c=!0,style:u,...l}=e,d=Or({label:o}),h=vr(!0),f=lt(s),{store:p}=br(),g=p.useState("isActive",d.index),m=p.useState("itemProps"),{getItemProps:v,itemRef:y}=kr({closeOnClick:c,disabled:a,highlighted:g,id:f,store:p,nativeButton:i,nodeId:h?.context.nodeId,itemMetadata:Rr});return pt("div",e,{state:{disabled:a,highlighted:g},props:[m,l,v],ref:[y,t,d.ref]})}),Mr=en.createContext(void 0);function Ir(e){const t=en.useContext(Mr);if(void 0===t&&!e)throw new Error(ot(69));return t}var Ar={...oe,...p},Pr=en.forwardRef(function(e,t){const{render:n,className:r,style:s,finalFocus:o,...i}=e,{store:a}=br(),{side:c,align:u}=vr(),l=null!=Ir(!0),d=a.useState("open"),h=a.useState("transitionStatus"),f=a.useState("popupProps"),p=a.useState("mounted"),g=a.useState("instantType"),m=a.useState("activeTriggerElement"),v=a.useState("parent"),y=a.useState("lastOpenChangeReason"),b=a.useState("rootId"),w=a.useState("floatingRootContext"),x=a.useState("floatingTreeRoot"),R=a.useState("closeDelay"),k=a.useState("activeTriggerElement"),E="context-menu"===v.type;Ge({open:d,ref:a.context.popupRef,onComplete(){d&&a.context.onOpenChangeComplete?.(!0)}}),en.useEffect(()=>{function e(e){a.setOpen(!1,Rt(e.reason,e.domEvent))}return x.events.on("close",e),()=>{x.events.off("close",e)}},[x.events,a]);const S=a.useState("hoverEnabled"),O=a.useState("disabled");Me(w,{enabled:S&&!O&&!E&&"menubar"!==v.type,closeDelay:R});const C={transitionStatus:h,side:c,align:u,open:d,nested:"menu"===v.type,instant:g},T=en.useCallback(e=>{a.set("popupElement",e)},[a]),_=pt("div",e,{state:C,ref:[t,a.context.popupRef,T],stateAttributesMapping:Ar,props:[f,{onKeyDown(e){l&&pr.has(e.key)&&e.stopPropagation()}},Pe(h),i,{"data-rootownerid":b}]});let M=void 0===v.type||E;return(m||"menubar"===v.type&&"outside-press"!==y)&&(M=!0),(0,Zt.jsx)(Hn,{context:w,modal:E,disabled:!p,returnFocus:void 0===o?M:o,initialFocus:"menu"!==v.type,restoreFocus:!0,externalTree:"menubar"!==v.type?x:void 0,previousFocusableElement:k,nextFocusableElement:void 0===v.type?a.context.triggerFocusTargetRef:void 0,beforeContentFocusGuardRef:void 0===v.type?a.context.beforeContentFocusGuardRef:void 0,children:_})}),Nr=en.createContext(void 0);var Fr=en.forwardRef(function(e,t){const{keepMounted:n=!1,...r}=e,{store:s}=br();return s.useState("mounted")||n?(0,Zt.jsx)(Nr.Provider,{value:n,children:(0,Zt.jsx)(D,{ref:t,...r})}):null});function jr(e){const{children:t,elementsRef:n,labelsRef:r,onMapChange:s}=e,o=Lt(s),i=en.useRef(0),a=dt(Br).current,c=dt(Dr).current,[u,l]=en.useState(0),d=en.useRef(u),h=Lt((e,t)=>{c.set(e,t??null),d.current+=1,l(d.current)}),f=Lt(e=>{c.delete(e),d.current+=1,l(d.current)}),p=en.useMemo(()=>{const e=new Map;return Array.from(c.keys()).filter(e=>e.isConnected).sort(Lr).forEach((t,n)=>{const r=c.get(t)??{};e.set(t,{...r,index:n})}),e},[c,u]);Et(()=>{if("function"!=typeof MutationObserver||0===p.size)return;const e=new MutationObserver(e=>{const t=new Set,n=e=>t.has(e)?t.delete(e):t.add(e);e.forEach(e=>{e.removedNodes.forEach(n),e.addedNodes.forEach(n)}),0===t.size&&(d.current+=1,l(d.current))});return p.forEach((t,n)=>{n.parentElement&&e.observe(n.parentElement,{childList:!0})}),()=>{e.disconnect()}},[p]),Et(()=>{d.current===u&&(n.current.length!==p.size&&(n.current.length=p.size),r&&r.current.length!==p.size&&(r.current.length=p.size),i.current=p.size),o(p)},[o,p,n,r,u]),Et(()=>()=>{n.current=[]},[n]),Et(()=>()=>{r&&(r.current=[])},[r]);const g=Lt(e=>(a.add(e),()=>{a.delete(e)}));Et(()=>{a.forEach(e=>e(p))},[a,p]);const m=en.useMemo(()=>({register:h,unregister:f,subscribeMapChange:g,elementsRef:n,labelsRef:r,nextIndexRef:i}),[h,f,g,n,r,i]);return(0,Zt.jsx)(Er.Provider,{value:m,children:t})}function Dr(){return new Map}function Br(){return new Set}function Lr(e,t){const n=e.compareDocumentPosition(t);return n&Node.DOCUMENT_POSITION_FOLLOWING||n&Node.DOCUMENT_POSITION_CONTAINED_BY?-1:n&Node.DOCUMENT_POSITION_PRECEDING||n&Node.DOCUMENT_POSITION_CONTAINS?1:0}function Ur(e,t,n,r){const[s,o]=en.useState(!1);Et(()=>{if(!e||!t||null==n)return void o(!1);const r=It(n).documentElement.clientWidth,s=n.offsetWidth;o(r>0&&s>0&&s>=r-20)},[e,t,n]),rr(e&&(!t||s),r)}var qr=en.forwardRef(function(e,t){const{anchor:n,positionMethod:r="absolute",className:s,render:o,side:i,align:a,sideOffset:c=0,alignOffset:u=0,collisionBoundary:l="clipping-ancestors",collisionPadding:d=5,arrowPadding:h=5,sticky:f=!1,disableAnchorTracking:p=!1,collisionAvoidance:g=y,style:m,...v}=e,{store:b}=br(),x=function(){const e=en.useContext(Nr);if(void 0===e)throw new Error(ot(32));return e}(),R=xr(!0),k=b.useState("parent"),E=b.useState("floatingRootContext"),S=b.useState("floatingTreeRoot"),O=b.useState("mounted"),T=b.useState("open"),_=b.useState("modal"),M=b.useState("openMethod"),I=b.useState("activeTriggerElement"),A=b.useState("transitionStatus"),P=b.useState("positionerElement"),N=b.useState("instantType"),F=b.useState("hasViewport"),j=b.useState("lastOpenChangeReason"),D=b.useState("floatingNodeId"),B=b.useState("floatingParentNodeId"),L=E.useState("domReferenceElement"),U=en.useRef(null),H=q(P,!1,!1);let W=n,z=c,X=u,Q=a,$=g;"context-menu"===k.type&&(W=n??k.context?.anchor,Q=Q??"start",i||"center"===Q||(X=e.alignOffset??2,z=e.sideOffset??-5));let V=i,K=Q;"menu"===k.type?(V=V??"inline-end",K=K??"start",$=e.collisionAvoidance??Y):"menubar"===k.type&&(V=V??"bottom",K=K??"start");const G="context-menu"===k.type,J=Ue({anchor:W,floatingRootContext:E,positionMethod:R?"fixed":r,mounted:O,side:V,sideOffset:z,align:K,alignOffset:X,arrowPadding:G?0:h,collisionBoundary:l,collisionPadding:d,sticky:f,nodeId:D,keepMounted:x,disableAnchorTracking:p,collisionAvoidance:$,shiftCrossAxis:G&&!("side"in $&&"flip"===$.side),externalTree:S,adaptiveOrigin:F?xe:void 0});en.useEffect(()=>{function e(e){e.open&&(e.parentNodeId===D&&b.set("hoverEnabled",!1),e.nodeId!==D&&e.parentNodeId===b.select("floatingParentNodeId")&&b.setOpen(!1,Rt(vt)))}return S.events.on("menuopenchange",e),()=>{S.events.off("menuopenchange",e)}},[b,S.events,D]),en.useEffect(()=>{if(null!=b.select("floatingParentNodeId"))return S.events.on("menuopenchange",e),()=>{S.events.off("menuopenchange",e)};function e(e){if(e.open||e.nodeId!==b.select("floatingParentNodeId"))return;const t=e.reason??"sibling-open";b.setOpen(!1,Rt(t))}},[S.events,b]);const Z=w();en.useEffect(()=>{T||Z.clear()},[T,Z]),en.useEffect(()=>{function e(e){if(T&&e.nodeId===b.select("floatingParentNodeId"))if(e.target&&I&&I!==e.target){const e=b.select("closeDelay");e>0?Z.isStarted()||Z.start(e,()=>{b.setOpen(!1,Rt(vt))}):b.setOpen(!1,Rt(vt))}else Z.clear()}return S.events.on("itemhover",e),()=>{S.events.off("itemhover",e)}},[S.events,T,I,b,Z]),en.useEffect(()=>{const e={open:T,nodeId:D,parentNodeId:B,reason:b.select("lastOpenChangeReason")};S.events.emit("menuopenchange",e)},[S.events,T,b,D,B]),Et(()=>{const e=L,t=U.current;if(e&&(U.current=e),t&&e&&e!==t){b.set("instantType",void 0);const e=new AbortController;return H(()=>{b.set("instantType","trigger-change")},e.signal),()=>{e.abort()}}},[L,H,b]);const ee={open:T,side:J.side,align:J.align,anchorHidden:J.anchorHidden,nested:"menu"===k.type,instant:N},te="menubar"===k.type&&k.context.modal;Ur(T&&(te||_&&"trigger-hover"!==j),"touch"===M,P,I);const ne=We(e,ee,{styles:J.positionerStyles,transitionStatus:A,props:v,refs:[t,b.useStateSetter("positionerElement")],hidden:!O,inert:!T}),re=O&&"menu"!==k.type&&("menubar"!==k.type&&_&&"trigger-hover"!==j||"menubar"===k.type&&k.context.modal);let se=null;return"menubar"===k.type?se=k.context.contentElement:void 0===k.type&&(se=I),(0,Zt.jsxs)(mr.Provider,{value:J,children:[re&&(0,Zt.jsx)(gr,{ref:"context-menu"===k.type||"nested-context-menu"===k.type?k.context.internalBackdropRef:null,inert:Gn(!T),cutout:se}),(0,Zt.jsx)(C,{id:D,children:(0,Zt.jsx)(jr,{elementsRef:b.context.itemDomElements,labelsRef:b.context.itemLabels,children:ne})})]})}),Hr=en.createContext(void 0);var Yr=en.memo(en.forwardRef(function(e,t){const{render:n,className:r,value:s,defaultValue:o,onValueChange:i,disabled:a=!1,style:c,...u}=e,[l,d]=zt({controlled:s,default:o,name:"MenuRadioGroup"}),h=Lt(i),f=Lt((e,t)=>{h?.(e,t),t.isCanceled||d(e)}),p=pt("div",e,{state:{disabled:a},ref:t,props:{role:"group","aria-disabled":a||void 0,...u}}),g=en.useMemo(()=>({value:l,setValue:f,disabled:a}),[l,f,a]);return(0,Zt.jsx)(Hr.Provider,{value:g,children:p})})),Wr=en.createContext(void 0);var zr=en.forwardRef(function(e,t){const{render:n,className:r,id:s,label:o,nativeButton:i=!1,disabled:a=!1,closeOnClick:c=!1,value:u,style:l,...d}=e,h=Or({label:o}),f=vr(!0),p=lt(s),{store:g}=br(),m=g.useState("isActive",h.index),v=g.useState("itemProps"),{value:y,setValue:b,disabled:w}=function(){const e=en.useContext(Hr);if(void 0===e)throw new Error(ot(34));return e}(),x=w||a,R=y===u,{getItemProps:k,itemRef:E}=kr({closeOnClick:c,disabled:x,highlighted:m,id:p,store:g,nativeButton:i,nodeId:f?.context.nodeId,itemMetadata:Rr}),S=en.useMemo(()=>({disabled:x,highlighted:m,checked:R}),[x,m,R]),O=pt("div",e,{state:S,stateAttributesMapping:Tr,props:[v,{role:"menuitemradio","aria-checked":R,onClick:Lt(e=>{b(u,{...Rt(Pt,e.nativeEvent),preventUnmountOnClose:()=>{}})})},d,k],ref:[E,t,h.ref]});return(0,Zt.jsx)(Wr.Provider,{value:S,children:O})}),Xr=en.forwardRef(function(e,t){const{render:n,className:r,style:s,keepMounted:o=!1,...i}=e,a=function(){const e=en.useContext(Wr);if(void 0===e)throw new Error(ot(35));return e}(),c=en.useRef(null),{transitionStatus:u,setMounted:l}=h(a.checked);return Ge({open:a.checked,ref:c,onComplete(){a.checked||l(!1)}}),pt("span",e,{state:{checked:a.checked,disabled:a.disabled,highlighted:a.highlighted,transitionStatus:u},stateAttributesMapping:Tr,ref:[t,c],props:{"aria-hidden":!0,...i},enabled:o||a.checked})}),Qr=en.createContext(null);function $r(e){const t=en.useContext(Qr);if(null===t&&!e)throw new Error(ot(5));return t}var Vr={...Ve,disabled:Se(e=>"menubar"===e.parent.type&&e.parent.context.disabled||e.disabled),modal:Se(e=>(void 0===e.parent.type||"context-menu"===e.parent.type)&&(e.modal??!0)),openMethod:Se(e=>e.openMethod),allowMouseEnter:Se(e=>e.allowMouseEnter),stickIfOpen:Se(e=>e.stickIfOpen),parent:Se(e=>e.parent),rootId:Se(e=>"menu"===e.parent.type?e.parent.store.select("rootId"):void 0!==e.parent.type?e.parent.context.rootId:e.rootId),activeIndex:Se(e=>e.activeIndex),isActive:Se((e,t)=>e.activeIndex===t),hoverEnabled:Se(e=>e.hoverEnabled),instantType:Se(e=>e.instantType),lastOpenChangeReason:Se(e=>e.openChangeReason),floatingTreeRoot:Se(e=>"menu"===e.parent.type?e.parent.store.select("floatingTreeRoot"):e.floatingTreeRoot),floatingNodeId:Se(e=>e.floatingNodeId),floatingParentNodeId:Se(e=>e.floatingParentNodeId),itemProps:Se(e=>e.itemProps),closeDelay:Se(e=>e.closeDelay),hasViewport:Se(e=>e.hasViewport),keyboardEventRelay:Se(e=>e.keyboardEventRelay?e.keyboardEventRelay:"menu"===e.parent.type?e.parent.store.select("keyboardEventRelay"):void 0)},Kr=class e extends I{constructor(e){super({...{...J(),disabled:!1,modal:!0,openMethod:null,allowMouseEnter:!1,stickIfOpen:!0,parent:{type:void 0},rootId:void 0,activeIndex:null,hoverEnabled:!0,instantType:void 0,openChangeReason:null,floatingTreeRoot:new S,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:xt,keyboardEventRelay:void 0,closeDelay:0,hasViewport:!1},...e},{positionerRef:en.createRef(),popupRef:en.createRef(),typingRef:{current:!1},itemDomElements:{current:[]},itemLabels:{current:[]},allowMouseUpTriggerRef:{current:!1},triggerFocusTargetRef:en.createRef(),beforeContentFocusGuardRef:en.createRef(),onOpenChangeComplete:void 0,triggerElements:new tt},Vr),this.unsubscribeParentListener=this.observe("parent",e=>{if(this.unsubscribeParentListener?.(),"menu"===e.type){let t=e.store.select("rootId"),n=e.store.select("floatingTreeRoot"),r=e.store.select("keyboardEventRelay");return this.unsubscribeParentListener=e.store.subscribe(()=>{const s=e.store.select("rootId"),o=e.store.select("floatingTreeRoot"),i=e.store.select("keyboardEventRelay");t===s&&n===o&&r===i||(t=s,n=o,r=i,this.notifyAll())}),void(this.context.allowMouseUpTriggerRef=e.store.context.allowMouseUpTriggerRef)}void 0!==e.type&&(this.context.allowMouseUpTriggerRef=e.context.allowMouseUpTriggerRef),this.unsubscribeParentListener=null})}setOpen(e,t){this.state.floatingRootContext.context.events.emit("setOpen",{open:e,eventDetails:t})}static useStore(t,n){const r=dt(()=>new e(n)).current;return t??r}unsubscribeParentListener=null};var Gr=en.createContext(void 0);function Jr(){return en.useContext(Gr)}var Zr=nt(function(e){const{children:t,open:n,onOpenChange:r,onOpenChangeComplete:s,defaultOpen:o=!1,disabled:a=!1,modal:c,loopFocus:u=!0,orientation:l="vertical",actionsRef:d,closeParentOnEsc:h=!1,handle:f,triggerId:p,defaultTriggerId:m=null,highlightItemOnHover:v=!0}=e,y=xr(!0),b=br(!0),x=$r(!0),R=Jr(),k=en.useMemo(()=>R&&b?{type:"menu",store:b.store}:x?{type:"menubar",context:x}:y&&!b?{type:"context-menu",context:y}:{type:void 0},[y,b,x,R]),E=Kr.useStore(f?.store,{open:o,openProp:n,activeTriggerId:m,triggerIdProp:p,parent:k});B(()=>{void 0===n&&!1===E.state.open&&!0===o&&E.update({open:!0,activeTriggerId:m})}),E.useControlledProp("openProp",n),E.useControlledProp("triggerIdProp",p),E.useContextCallback("onOpenChangeComplete",s);const S=E.useState("floatingTreeRoot"),O=P(S),C=g();Et(()=>{y&&!b?E.update({parent:{type:"context-menu",context:y},floatingNodeId:O,floatingParentNodeId:C}):b&&E.update({floatingNodeId:O,floatingParentNodeId:C})},[y,b,O,C,E]);const T=E.useState("open"),M=E.useState("activeTriggerElement"),I=E.useState("positionerElement"),A=E.useState("hoverEnabled"),N=E.useState("disabled"),F=E.useState("lastOpenChangeReason"),j=E.useState("parent"),D=E.useState("activeIndex"),L=E.useState("payload"),U=E.useState("floatingParentNodeId"),q=en.useRef(null),H=null!=U,{openMethod:Y,triggerProps:W}=or(T);E.useSyncedValues({disabled:a,modal:void 0===j.type?c:void 0,openMethod:Y,rootId:Ot()}),se(E);const{forceUnmount:z}=Ze(T,E,()=>{E.update({allowMouseEnter:!1,stickIfOpen:!0})}),X=en.useRef("context-menu"!==j.type),Q=w();en.useEffect(()=>{if(T||(q.current=null),"context-menu"===j.type)return T?void Q.start(500,()=>{X.current=!0}):(Q.clear(),void(X.current=!1))},[Q,T,j.type]),Et(()=>{T||A||E.set("hoverEnabled",!0)},[T,A,E]);const $=en.useRef(!0),V=w(),K=Lt((e,t)=>{const n=t.reason;if(T===e&&t.trigger===M&&F===n)return;if(t.preventUnmountOnClose=()=>{E.set("preventUnmountingOnClose",!0)},e||null!=t.trigger||(t.trigger=M??void 0),r?.(e,t),t.isCanceled)return;E.state.floatingRootContext.dispatchOpenChange(e,t);const s=t.event;if(!1===e&&"click"===s?.type&&"touch"===s.pointerType&&!$.current)return;if(!e&&null!==D){const e=E.context.itemDomElements.current[D];queueMicrotask(()=>{e?.setAttribute("tabindex","-1")})}e&&"trigger-focus"===n?($.current=!1,V.start(300,()=>{$.current=!0})):($.current=!0,V.clear());const o=("trigger-press"===n||"item-press"===n)&&0===s.detail&&s?.isTrusted,i=!e&&("escape-key"===n||null==n),a={open:e,openChangeReason:n};q.current=t.event??null;const c=t.trigger?.id??null;(c||e)&&(a.activeTriggerId=c,a.activeTriggerElement=t.trigger??null),E.update(a),"menubar"!==j.type||"trigger-focus"!==n&&"focus-out"!==n&&"trigger-hover"!==n&&"list-navigation"!==n&&"sibling-open"!==n?o||i?E.set("instantType",o?"click":"dismiss"):E.set("instantType",void 0):E.set("instantType","group")}),G=en.useCallback(()=>{E.setOpen(!1,Rt(yt))},[E]);let J;en.useImperativeHandle(d,()=>({unmount:z,close:G}),[z,G]),"context-menu"===j.type&&(J=j.context),en.useImperativeHandle(J?.positionerRef,()=>I,[I]),en.useImperativeHandle(J?.actionsRef,()=>({setOpen:K}),[K]);const Z=ge({popupStore:E,onOpenChange:K}),ee=Z.context.events;en.useEffect(()=>{const e=({open:e,eventDetails:t})=>K(e,t);return ee.on("setOpen",e),()=>{ee?.off("setOpen",e)}},[ee,K]);const ne=i(Z,{enabled:!N,bubbles:{escapeKey:h&&"menu"===j.type},outsidePress:()=>"context-menu"!==j.type||"contextmenu"===q.current?.type||X.current,externalTree:H?S:void 0}),re=Vn(Z,{role:"menu"}),oe=te(),ie=en.useCallback(e=>{E.select("activeIndex")!==e&&E.set("activeIndex",e)},[E]),ae=Qn(Z,{enabled:!N,listRef:E.context.itemDomElements,activeIndex:D,nested:void 0!==j.type,loopFocus:u,orientation:l,parentOrientation:"menubar"===j.type?j.context.orientation:void 0,rtl:"rtl"===oe,disabledIndices:gt,onNavigate:ie,openOnArrowKeyDown:"context-menu"!==j.type,externalTree:H?S:void 0,focusItemOnHover:v}),ce=en.useCallback(e=>{E.context.typingRef.current=e},[E]),{getReferenceProps:ue,getFloatingProps:le,getItemProps:de,getTriggerProps:fe}=he([ne,re,ae,Kn(Z,{listRef:E.context.itemLabels,elementsRef:E.context.itemDomElements,activeIndex:D,resetMs:500,onMatch:e=>{T&&e!==D&&E.set("activeIndex",e)},onTypingChange:ce})]),pe=en.useMemo(()=>{const e=ft(ue(),{onMouseMove(){E.set("allowMouseEnter",!0)}},W);return delete e.role,e},[ue,E,W]),me=en.useMemo(()=>{const e=fe();if(!e)return e;const t=ft(e,W);return delete t.role,delete t["aria-controls"],t},[fe,W]),ve=en.useMemo(()=>le({onMouseMove(){E.set("allowMouseEnter",!0),"menu"===j.type&&E.set("hoverEnabled",!1)},onClick(){E.select("hoverEnabled")&&E.set("hoverEnabled",!1)},onKeyDown(e){const t=E.select("keyboardEventRelay");t&&!e.isPropagationStopped()&&t(e)}}),[le,j.type,E]),ye=en.useMemo(()=>de(),[de]);E.useSyncedValues({floatingRootContext:Z,activeTriggerProps:pe,inactiveTriggerProps:me,popupProps:ve,itemProps:ye});const be=en.useMemo(()=>({store:E,parent:k}),[E,k]),we=(0,Zt.jsx)(yr.Provider,{value:be,children:"function"==typeof t?t({payload:L}):t});return void 0===j.type||"context-menu"===j.type?(0,Zt.jsx)(_,{externalTree:S,children:we}):we});function es(e){const t=br().store,n=en.useMemo(()=>({parentMenu:t}),[t]);return(0,Zt.jsx)(Gr.Provider,{value:n,children:(0,Zt.jsx)(Zr,{...e})})}function ts(e){const{render:t,className:n,style:r,state:s=xt,props:o=gt,refs:i=gt,metadata:a,stateAttributesMapping:c,tag:u="div",...l}=e,{compositeProps:d,compositeRef:h}=function(e={}){const{highlightItemOnHover:t,highlightedIndex:n,onHighlightedIndexChange:r}=Yt(),{ref:s,index:o}=Or(e),i=n===o,a=en.useRef(null),c=jt(s,a);return{compositeProps:en.useMemo(()=>({tabIndex:i?0:-1,onFocus(){r(o)},onMouseMove(){const e=a.current;if(!t||!e)return;const n=e.hasAttribute("disabled")||"true"===e.ariaDisabled;i||n||e.focus()}}),[i,r,o,t]),compositeRef:c,index:o}}({metadata:a});return pt(u,e,{state:s,ref:[...i,h],props:[d,...o,l],stateAttributesMapping:c})}function ns(e){return Nt(e)&&e.hasAttribute("data-rootownerid")?e.getAttribute("data-rootownerid")??void 0:At(e)?void 0:ns(Ut(e))}var rs=n(s());function ss(e,t){const n=en.useRef(null);return{preFocusGuardRef:n,handlePreFocusGuardFocus:Lt(t=>{rs.flushSync(()=>{e.setOpen(!1,Rt(at,t.nativeEvent,t.currentTarget))}),K(n.current)?.focus()}),handleFocusTargetFocus:Lt(n=>{const r=e.select("positionerElement");if(r&&F(n,r))e.context.beforeContentFocusGuardRef.current?.focus();else{rs.flushSync(()=>{e.setOpen(!1,Rt(at,n.nativeEvent,n.currentTarget))});let s=Q(e.context.triggerFocusTargetRef.current||t.current);for(;null!==s&&wt(r,s);){const e=s;if(s=x(s),s===e)break}s?.focus()}})}}var os=u(function(e,t){const{render:n,className:r,disabled:s=!1,nativeButton:o=!0,id:i,openOnHover:a,delay:c=100,closeDelay:u=0,handle:l,payload:d,style:h,...f}=e,p=br(!0),m=l?.store??p?.store;if(!m)throw new Error(ot(85));const v=lt(i),y=m.useState("isTriggerActive",v),x=m.useState("floatingRootContext"),R=m.useState("isOpenedByTrigger",v),k=en.useRef(null),E=function(){const e=xr(!0),t=br(!0),n=$r(!0);return en.useMemo(()=>n?{type:"menubar",context:n}:e&&!t?{type:"context-menu",context:e}:{type:void 0},[e,t,n])}(),O=Yt(!0),C=b(),T=en.useMemo(()=>C??new S,[C]),{registerTrigger:_,isMountedByThisTrigger:M}=L(v,k,m,{payload:d,closeDelay:u,parent:E,floatingTreeRoot:T,floatingNodeId:P(T),floatingParentNodeId:g(),keyboardEventRelay:O?.relayKeyboardEvent}),I="menubar"===E.type,A=m.useState("disabled"),N=s||A||I&&E.context.disabled,{getButtonProps:F,buttonRef:j}=Xt({disabled:N,native:o});en.useEffect(()=>{R||void 0!==E.type||(m.context.allowMouseUpTriggerRef.current=!1)},[m,R,E.type]);const D=en.useRef(null),B=w(),U=Lt(e=>{if(!D.current)return;B.clear(),m.context.allowMouseUpTriggerRef.current=!1;const t=e.target;if(wt(D.current,t)||wt(m.select("positionerElement"),t)||t===D.current)return;if(null!=t&&ns(t)===m.select("rootId"))return;const n=function(e){const t=e.getBoundingClientRect(),n=Mt(e),r=n.getComputedStyle(e,"::before"),s=n.getComputedStyle(e,"::after");if("none"===r.content&&"none"===s.content)return t;const o=parseFloat(r.width)||0,i=parseFloat(r.height)||0,a=parseFloat(s.width)||0,c=parseFloat(s.height)||0,u=Math.max(t.width,o,a),l=Math.max(t.height,i,c),d=u-t.width,h=l-t.height;return{left:t.left-d/2,right:t.right+d/2,top:t.top-h/2,bottom:t.bottom+h/2}}(D.current);e.clientX>=n.left-2&&e.clientX<=n.right+2&&e.clientY>=n.top-2&&e.clientY<=n.bottom+2||T.events.emit("close",{domEvent:e,reason:it})});en.useEffect(()=>{R&&"trigger-hover"===m.select("lastOpenChangeReason")&&It(D.current).addEventListener("mouseup",U,{once:!0})},[R,U,m]);const q=I&&E.context.hasSubmenuOpen,H=De(x,{enabled:(a??q)&&!N&&"context-menu"!==E.type&&(!I||q&&!M),handleClose:ae({blockPointerEvents:!I}),mouseOnly:!0,move:!1,restMs:void 0===E.type?c:void 0,delay:{close:u},triggerElementRef:k,externalTree:T,isActiveTrigger:y,isClosing:()=>"ending"===m.select("transitionStatus")}),Y=function(e,t){const n=w(),[r,s]=en.useState(!1);return Et(()=>{e&&"trigger-hover"===t?(s(!0),n.start(500,()=>{s(!1)})):e||(n.clear(),s(!1))},[e,t,n]),r}(R,m.select("lastOpenChangeReason")),W=Yn(x,{enabled:!N&&"context-menu"!==E.type,event:R&&I?"click":"mousedown",toggle:!0,ignoreMouse:!1,stickIfOpen:void 0===E.type&&Y}),z=ye(x,{enabled:!N&&q}),X=function(e){const{enabled:t=!0,mouseDownAction:n,open:r}=e,s=en.useRef(!1);return en.useMemo(()=>t?{onMouseDown:e=>{("open"===n&&!r||"close"===n&&r)&&(s.current=!0,It(e.currentTarget).addEventListener("click",()=>{s.current=!1},{once:!0}))},onClick:e=>{s.current&&(s.current=!1,e.preventBaseUIHandler())}}:xt,[t,n,r])}({open:R,enabled:I,mouseDownAction:"open"}),Q=he([W,z]),$={disabled:N,open:R},V=m.useState("triggerProps",M),K=[D,t,j,_,k],G=[Q.getReferenceProps(),H??xt,V,{"aria-haspopup":"menu",id:v,onMouseDown:e=>{m.select("open")||(B.start(200,()=>{m.context.allowMouseUpTriggerRef.current=!0}),It(e.currentTarget).addEventListener("mouseup",U,{once:!0}))}},I?{role:"menuitem"}:{},X,f,F],{preFocusGuardRef:J,handlePreFocusGuardFocus:Z,handleFocusTargetFocus:ee}=ss(m,k),te=pt("button",e,{enabled:!I,stateAttributesMapping:Ce,state:$,ref:K,props:G});return I?(0,Zt.jsx)(ts,{tag:"button",render:n,className:r,style:h,state:$,refs:K,props:G,stateAttributesMapping:Ce}):R?(0,Zt.jsxs)(en.Fragment,{children:[(0,Zt.jsx)(Ke,{ref:J,onFocus:Z},`${v}-pre-focus-guard`),(0,Zt.jsx)(en.Fragment,{children:te},v),(0,Zt.jsx)(Ke,{ref:m.context.triggerFocusTargetRef,onFocus:ee},`${v}-post-focus-guard`)]}):(0,Zt.jsx)(en.Fragment,{children:te},v)});var is=en.forwardRef(function(e,t){const{className:n,render:r,orientation:s="horizontal",style:o,...i}=e;return pt("div",e,{state:{orientation:s},ref:t,props:[{role:"separator","aria-orientation":s},i]})}),as=en.forwardRef(function(e,t){const{render:n,className:r,label:s,id:o,nativeButton:i=!1,openOnHover:a=!0,delay:c=100,closeDelay:u=0,disabled:d=!1,style:h,...f}=e,p=Or(),g=vr(),{store:m}=br(),v=lt(o),y=m.useState("open"),b=m.useState("floatingRootContext"),w=m.useState("floatingTreeRoot"),x=l(v,m),R=en.useCallback(e=>{const t=x(e);return null!==e&&m.select("open")&&null==m.select("activeTriggerId")&&m.update({activeTriggerId:v,activeTriggerElement:e,closeDelay:u}),t},[x,u,m,v]),k=en.useRef(null),E=en.useCallback(e=>{k.current=e,m.set("activeTriggerElement",e)},[m]),S=Jr();if(!S?.parentMenu)throw new Error(ot(37));m.useSyncedValue("closeDelay",u);const O=S.parentMenu,C=O.useState("itemProps"),T=O.useState("isActive",p.index),_=en.useMemo(()=>({type:"submenu-trigger",setActive(){O.set("activeIndex",p.index)}}),[O,p.index]),M=m.useState("disabled"),I=d||M,{getItemProps:A,itemRef:P}=kr({closeOnClick:!1,disabled:I,highlighted:T,id:v,store:m,typingRef:O.context.typingRef,nativeButton:i,itemMetadata:_,nodeId:g?.context.nodeId}),N=m.useState("hoverEnabled"),F=O.useState("allowMouseEnter"),j=De(b,{enabled:N&&a&&!I,handleClose:ae({blockPointerEvents:!0}),mouseOnly:!0,move:!0,restMs:c,delay:F?{open:c,close:u}:0,triggerElementRef:k,externalTree:w,isClosing:()=>"ending"===m.select("transitionStatus")}),D=he([Yn(b,{enabled:!I,event:"mousedown",toggle:!a,ignoreMouse:a,stickIfOpen:!1})]),B=m.useState("triggerProps",!0);return delete B.id,pt("div",e,{state:{disabled:I,highlighted:T,open:y},stateAttributesMapping:Xe,props:[D.getReferenceProps(),j,B,C,{tabIndex:y||T?0:-1,onBlur(){T&&O.set("activeIndex",null)}},f,A],ref:[t,p.ref,P,R,E]})});function cs({...e}){return(0,Zt.jsx)(Zr,{"data-slot":"dropdown-menu",...e})}function us({...e}){return(0,Zt.jsx)(os,{"data-slot":"dropdown-menu-trigger",...e})}function ls({align:e="start",alignOffset:t=0,side:n="bottom",sideOffset:r=4,className:s,...o}){return(0,Zt.jsx)(Fr,{children:(0,Zt.jsx)(qr,{className:"isolate z-50 outline-none",align:e,alignOffset:t,side:n,sideOffset:r,children:(0,Zt.jsx)(Pr,{"data-slot":"dropdown-menu-content",className:kt("z-50 max-h-(--available-height) w-(--anchor-width) min-w-32 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 outline-none 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:overflow-hidden data-closed:fade-out-0 data-closed:zoom-out-95",s),...o})})})}function ds({className:e,inset:t,variant:n="default",...r}){return(0,Zt.jsx)(_r,{"data-slot":"dropdown-menu-item","data-inset":t,"data-variant":n,className:kt("group/dropdown-menu-item relative flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-[variant=destructive]:*:[svg]:text-destructive",e),...r})}function hs({...e}){return(0,Zt.jsx)(es,{"data-slot":"dropdown-menu-sub",...e})}function fs({className:e,inset:t,children:n,...r}){return(0,Zt.jsxs)(as,{"data-slot":"dropdown-menu-sub-trigger","data-inset":t,className:kt("flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-popup-open:bg-accent data-popup-open:text-accent-foreground data-open:bg-accent data-open:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...r,children:[n,(0,Zt.jsx)(mn,{className:"ml-auto"})]})}function ps({align:e="start",alignOffset:t=-3,side:n="right",sideOffset:r=0,className:s,...o}){return(0,Zt.jsx)(ls,{"data-slot":"dropdown-menu-sub-content",className:kt("w-auto min-w-[96px] rounded-lg bg-popover p-1 text-popover-foreground shadow-lg ring-1 ring-foreground/10 duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 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",s),align:e,alignOffset:t,side:n,sideOffset:r,...o})}function gs({...e}){return(0,Zt.jsx)(Yr,{"data-slot":"dropdown-menu-radio-group",...e})}function ms({className:e,children:t,inset:n,...r}){return(0,Zt.jsxs)(zr,{"data-slot":"dropdown-menu-radio-item","data-inset":n,className:kt("relative flex cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...r,children:[(0,Zt.jsx)("span",{className:"pointer-events-none absolute right-2 flex items-center justify-center","data-slot":"dropdown-menu-radio-item-indicator",children:(0,Zt.jsx)(Xr,{children:(0,Zt.jsx)(gn,{})})}),t]})}function vs({className:e,...t}){return(0,Zt.jsx)(is,{"data-slot":"dropdown-menu-separator",className:kt("-mx-1 my-1 h-px bg-border",e),...t})}function ys({className:e,...t}){return(0,Zt.jsx)("textarea",{"data-slot":"textarea",className:kt("flex field-sizing-content min-h-16 w-full rounded-lg border border-input bg-transparent px-2.5 py-2 text-base transition-colors outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",e),...t})}function bs(e){return pt(e.defaultTagName??"div",e,e)}var ws=Wt("group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!",{variants:{variant:{default:"bg-primary text-primary-foreground [a]:hover:bg-primary/80",secondary:"bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",destructive:"bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20",outline:"border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground",ghost:"hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",link:"text-primary underline-offset-4 hover:underline"}},defaultVariants:{variant:"default"}});function xs({className:e,variant:t="default",render:n,...r}){return bs({defaultTagName:"span",props:ft({className:kt(ws({variant:t}),e)},r),render:n,state:{slot:"badge",variant:t}})}function Rs(e){const t=Is(e);return function(e){const t=Is(e);if(!t)return;return{credits:_s(t.credits),limitId:As(t.limitId)??As(t.limit_id),limitName:As(t.limitName)??As(t.limit_name),planType:As(t.planType)??As(t.plan_type),primary:Ts(t.primary),rateLimitReachedType:As(t.rateLimitReachedType)??As(t.rate_limit_reached_type),secondary:Ts(t.secondary)}}(Ms(e)?.codex??Object.values(Ms(e)??{}).find(Boolean)??t?.rateLimits??t?.rate_limits??(function(e){return!(!e||!("primary"in e||"secondary"in e||"limitId"in e||"limit_id"in e))}(t)?t:void 0))}function ks(e){return e?e.credits?.unlimited?"Unlimited":e.rateLimitReachedType?"Limit reached":[Cs(e.primary,"5h"),Cs(e.secondary,"W")].filter(Boolean).join(" · ")||"Usage n/a":"Usage unavailable"}function Es(e){return e?Ss(e.secondary)?"weekly":Ss(e.primary)?"fiveHour":null:null}function Ss(e){return Os(e?.usedPercent??0)>=100}function Os(e){return Math.max(0,Math.min(100,Number.isFinite(e)?e:0))}function Cs(e,t){if(!e)return null;const n=Math.max(0,Math.round(100-Os(e.usedPercent)));return`${function(e,t){const n=e?.windowDurationMins;return n?n>=10080?"W":300===n?"5h":n%60==0?n/60+"h":`${n}m`:t}(e,t)} ${n}%`}function Ts(e){if(null===e)return null;const t=Is(e);return t?{resetsAt:Ps(t.resetsAt)??Ps(t.resets_at),usedPercent:Ps(t.usedPercent)??Ps(t.used_percent)??0,windowDurationMins:Ps(t.windowDurationMins)??Ps(t.window_duration_mins)??Ps(t.window_minutes)}:void 0}function _s(e){if(null===e)return null;const t=Is(e);return t?{balance:As(t.balance)??null,hasCredits:Ns(t.hasCredits)??Ns(t.has_credits)??!1,unlimited:Ns(t.unlimited)??!1}:void 0}function Ms(e){const t=Is(e);return Is(t?.rateLimitsByLimitId)??Is(t?.rate_limits_by_limit_id)}function Is(e){if(e&&"object"==typeof e&&!Array.isArray(e))return e}function As(e){return"string"==typeof e&&e.trim()?e.trim():void 0}function Ps(e){return"number"==typeof e&&Number.isFinite(e)?e:void 0}function Ns(e){return"boolean"==typeof e?e:void 0}var Fs=en.createContext(void 0);function js(){const e=en.useContext(Fs);if(void 0===e)throw new Error(ot(53));return e}var Ds=function(e){return e.scrollAreaCornerHeight="--scroll-area-corner-height",e.scrollAreaCornerWidth="--scroll-area-corner-width",e}({});function Bs(e,t,n){if(!e)return 0;const r=getComputedStyle(e),s="x"===n?"Inline":"Block";return"x"===n&&"margin"===t?2*parseFloat(r[`${t}InlineStart`]):parseFloat(r[`${t}${s}Start`])+parseFloat(r[`${t}${s}End`])}var Ls=function(e){return e.orientation="data-orientation",e.hovering="data-hovering",e.scrolling="data-scrolling",e.hasOverflowX="data-has-overflow-x",e.hasOverflowY="data-has-overflow-y",e.overflowXStart="data-overflow-x-start",e.overflowXEnd="data-overflow-x-end",e.overflowYStart="data-overflow-y-start",e.overflowYEnd="data-overflow-y-end",e}({}),Us="base-ui-disable-scrollbar",qs={className:Us,getElement:e=>(0,Zt.jsx)("style",{nonce:e,href:Us,precedence:"base-ui:low",children:`.${Us}{scrollbar-width:none}.${Us}::-webkit-scrollbar{display:none}`})},Hs=function(e){return e.scrolling="data-scrolling",e.hasOverflowX="data-has-overflow-x",e.hasOverflowY="data-has-overflow-y",e.overflowXStart="data-overflow-x-start",e.overflowXEnd="data-overflow-x-end",e.overflowYStart="data-overflow-y-start",e.overflowYEnd="data-overflow-y-end",e}({}),Ys={hasOverflowX:e=>e?{[Hs.hasOverflowX]:""}:null,hasOverflowY:e=>e?{[Hs.hasOverflowY]:""}:null,overflowXStart:e=>e?{[Hs.overflowXStart]:""}:null,overflowXEnd:e=>e?{[Hs.overflowXEnd]:""}:null,overflowYStart:e=>e?{[Hs.overflowYStart]:""}:null,overflowYEnd:e=>e?{[Hs.overflowYEnd]:""}:null,cornerHidden:()=>null},Ws=en.createContext(void 0),zs={disableStyleElements:!1};var Xs={x:0,y:0},Qs={width:0,height:0},$s={xStart:!1,xEnd:!1,yStart:!1,yEnd:!1},Vs={x:!0,y:!0,corner:!0},Ks=en.forwardRef(function(e,t){const{render:n,className:r,overflowEdgeThreshold:s,style:o,...i}=e,a=function(e){if("number"==typeof e){const t=Math.max(0,e);return{xStart:t,xEnd:t,yStart:t,yEnd:t}}return{xStart:Math.max(0,e?.xStart||0),xEnd:Math.max(0,e?.xEnd||0),yStart:Math.max(0,e?.yStart||0),yEnd:Math.max(0,e?.yEnd||0)}}(s),c=lt(),u=w(),l=w(),{nonce:d,disableStyleElements:h}=en.useContext(Ws)??zs,[f,p]=en.useState(!1),[g,m]=en.useState(!1),[v,y]=en.useState(!1),[b,x]=en.useState(!1),[R,k]=en.useState(!1),[E,S]=en.useState(Qs),[O,C]=en.useState(Qs),[T,_]=en.useState($s),[M,I]=en.useState(Vs),A=en.useRef(null),P=en.useRef(null),N=en.useRef(null),F=en.useRef(null),j=en.useRef(null),D=en.useRef(null),B=en.useRef(null),L=en.useRef(!1),U=en.useRef(0),q=en.useRef(0),H=en.useRef(0),Y=en.useRef(0),W=en.useRef("vertical"),z=en.useRef(Xs),X=Lt(e=>{const t=e.x-z.current.x,n=e.y-z.current.y;z.current=e,0!==n&&(y(!0),u.start(500,()=>{y(!1)})),0!==t&&(m(!0),l.start(500,()=>{m(!1)}))}),Q=Lt(e=>{0===e.button&&(L.current=!0,U.current=e.clientY,q.current=e.clientX,W.current=e.currentTarget.getAttribute(Ls.orientation),P.current&&(H.current=P.current.scrollTop,Y.current=P.current.scrollLeft),j.current&&"vertical"===W.current&&j.current.setPointerCapture(e.pointerId),D.current&&"horizontal"===W.current&&D.current.setPointerCapture(e.pointerId))}),$=Lt(e=>{if(!L.current)return;const t=e.clientY-U.current,n=e.clientX-q.current;if(P.current){const r=P.current.scrollHeight,s=P.current.clientHeight,o=P.current.scrollWidth,i=P.current.clientWidth;if(j.current&&N.current&&"vertical"===W.current){const n=Bs(N.current,"padding","y"),o=Bs(j.current,"margin","y"),i=j.current.offsetHeight,a=t/(N.current.offsetHeight-i-n-o);P.current.scrollTop=H.current+a*(r-s),e.preventDefault(),y(!0),u.start(500,()=>{y(!1)})}if(D.current&&F.current&&"horizontal"===W.current){const t=Bs(F.current,"padding","x"),r=Bs(D.current,"margin","x"),s=D.current.offsetWidth,a=n/(F.current.offsetWidth-s-t-r);P.current.scrollLeft=Y.current+a*(o-i),e.preventDefault(),m(!0),l.start(500,()=>{m(!1)})}}}),V=Lt(e=>{L.current=!1,j.current&&"vertical"===W.current&&j.current.releasePointerCapture(e.pointerId),D.current&&"horizontal"===W.current&&D.current.releasePointerCapture(e.pointerId)});function K(e){x("touch"===e.pointerType)}function G(e){K(e),"touch"!==e.pointerType&&p(wt(A.current,e.target))}const J=en.useMemo(()=>({scrolling:g||v,hasOverflowX:!M.x,hasOverflowY:!M.y,overflowXStart:T.xStart,overflowXEnd:T.xEnd,overflowYStart:T.yStart,overflowYEnd:T.yEnd,cornerHidden:M.corner}),[g,v,M.x,M.y,M.corner,T]),Z={role:"presentation",onPointerEnter:G,onPointerMove:G,onPointerDown:K,onPointerLeave(){p(!1)},style:{position:"relative",[Ds.scrollAreaCornerHeight]:`${E.height}px`,[Ds.scrollAreaCornerWidth]:`${E.width}px`}},ee=pt("div",e,{state:J,ref:[t,A],props:[Z,i],stateAttributesMapping:Ys}),te=en.useMemo(()=>({handlePointerDown:Q,handlePointerMove:$,handlePointerUp:V,handleScroll:X,cornerSize:E,setCornerSize:S,thumbSize:O,setThumbSize:C,hasMeasuredScrollbar:R,setHasMeasuredScrollbar:k,touchModality:b,cornerRef:B,scrollingX:g,setScrollingX:m,scrollingY:v,setScrollingY:y,hovering:f,setHovering:p,viewportRef:P,rootRef:A,scrollbarYRef:N,scrollbarXRef:F,thumbYRef:j,thumbXRef:D,rootId:c,hiddenState:M,setHiddenState:I,overflowEdges:T,setOverflowEdges:_,viewportState:J,overflowEdgeThreshold:a}),[Q,$,V,X,E,O,R,b,g,m,v,y,f,p,c,M,T,J,a]);return(0,Zt.jsxs)(Fs.Provider,{value:te,children:[!h&&qs.getElement(d),ee]})});var Gs=en.createContext(void 0);function Js(e,t=Number.MIN_SAFE_INTEGER,n=Number.MAX_SAFE_INTEGER){return Math.max(t,Math.min(e,n))}var Zs=function(e){return e.scrollAreaOverflowXStart="--scroll-area-overflow-x-start",e.scrollAreaOverflowXEnd="--scroll-area-overflow-x-end",e.scrollAreaOverflowYStart="--scroll-area-overflow-y-start",e.scrollAreaOverflowYEnd="--scroll-area-overflow-y-end",e}({});function eo(e,t){if(t<=0)return 0;const n=Js(e,0,t),r=t-n,s=n<=1,o=r<=1;return s&&o?n<=r?0:t:s?0:o?t:n}var to=!1;var no=en.forwardRef(function(e,t){const{render:n,className:r,style:s,...o}=e,{viewportRef:i,scrollbarYRef:a,scrollbarXRef:c,thumbYRef:u,thumbXRef:l,cornerRef:d,cornerSize:h,setCornerSize:f,setThumbSize:p,rootId:g,setHiddenState:m,hiddenState:v,setHasMeasuredScrollbar:y,handleScroll:b,setHovering:x,setOverflowEdges:R,overflowEdges:k,overflowEdgeThreshold:E,scrollingX:S,scrollingY:O}=js(),C=te(),T=en.useRef(!0),_=en.useRef([NaN,NaN,NaN,NaN]),M=w(),I=w(),A=Lt(()=>{const e=i.current,t=a.current,n=c.current,r=u.current,s=l.current,o=d.current;if(!e)return;const g=e.scrollHeight,v=e.scrollWidth,b=e.clientHeight,w=e.clientWidth,x=e.scrollTop,k=e.scrollLeft,S=_.current,O=Number.isNaN(S[0]);if(S[0]=b,S[1]=g,S[2]=w,S[3]=v,O&&y(!0),0===g||0===v)return;const T=function(e){const t=e.clientHeight>=e.scrollHeight,n=e.clientWidth>=e.scrollWidth;return{y:t,x:n,corner:t||n}}(e),M=T.y,I=T.x,A=w/v,P=b/g,N=Math.max(0,v-w),F=Math.max(0,g-b);let j=0,D=0;if(!I){let e=0;e=Js("rtl"===C?-k:k,0,N),j=eo(e,N),D=N-j}const B=M?0:Js(x,0,F),L=M?0:eo(B,F),U=M?0:F-L,q=I?0:w,H=M?0:b;let Y=0,W=0;I||M||(Y=t?.offsetWidth||0,W=n?.offsetHeight||0);const z=0===h.width&&0===h.height,X=z?Y:0,Q=z?W:0,$=Bs(n,"padding","x"),V=Bs(t,"padding","y"),K=Bs(s,"margin","x"),G=Bs(r,"margin","y"),J=q-$-K,Z=H-V-G,ee=n?Math.min(n.offsetWidth-X,J):J,te=t?Math.min(t.offsetHeight-Q,Z):Z,ne=Math.max(16,ee*A),re=Math.max(16,te*P);if(p(e=>e.height===re&&e.width===ne?e:{width:ne,height:re}),t&&r){const e=t.offsetHeight-re-V-G,n=g-b,s=0===n?0:x/n,o=Math.min(e,Math.max(0,s*e));r.style.transform=`translate3d(0,${o}px,0)`}if(n&&s){const e=n.offsetWidth-ne-$-K,t=v-w,r=0===t?0:k/t,o="rtl"===C?Js(r*e,-e,0):Js(r*e,0,e);s.style.transform=`translate3d(${o}px,0,0)`}const se=[[Zs.scrollAreaOverflowXStart,j],[Zs.scrollAreaOverflowXEnd,D],[Zs.scrollAreaOverflowYStart,L],[Zs.scrollAreaOverflowYEnd,U]];for(const[i,a]of se)e.style.setProperty(i,`${a}px`);o&&(I||M?f({width:0,height:0}):I||M||f({width:Y,height:W})),m(e=>function(e,t){return e.y===t.y&&e.x===t.x&&e.corner===t.corner?e:t}(e,T));const oe={xStart:!I&&j>E.xStart,xEnd:!I&&D>E.xEnd,yStart:!M&&L>E.yStart,yEnd:!M&&U>E.yEnd};R(e=>e.xStart===oe.xStart&&e.xEnd===oe.xEnd&&e.yStart===oe.yStart&&e.yEnd===oe.yEnd?e:oe)});function P(){T.current=!1}Et(()=>{i.current&&(to||N||("undefined"!=typeof CSS&&"registerProperty"in CSS&&[Zs.scrollAreaOverflowXStart,Zs.scrollAreaOverflowXEnd,Zs.scrollAreaOverflowYStart,Zs.scrollAreaOverflowYEnd].forEach(e=>{try{CSS.registerProperty({name:e,syntax:"<length>",inherits:!1,initialValue:"0px"})}catch{}}),to=!0))},[i]),Et(()=>{queueMicrotask(A)},[A,v,C]),Et(()=>{i.current?.matches(":hover")&&x(!0)},[i,x]),en.useEffect(()=>{const e=i.current;if("undefined"==typeof ResizeObserver||!e)return;let t=!1;const n=new ResizeObserver(()=>{if(!t){t=!0;const n=_.current;if(n[0]===e.clientHeight&&n[1]===e.scrollHeight&&n[2]===e.clientWidth&&n[3]===e.scrollWidth)return}A()});return n.observe(e),I.start(0,()=>{const t=e.getAnimations({subtree:!0});0!==t.length&&Promise.allSettled(t.map(e=>e.finished)).then(A).catch(()=>{})}),()=>{n.disconnect(),I.clear()}},[A,i,I]);const F={role:"presentation",...g&&{"data-id":`${g}-viewport`},tabIndex:v.x&&v.y?-1:0,className:qs.className,style:{overflow:"scroll"},onScroll(){i.current&&(A(),T.current||b({x:i.current.scrollLeft,y:i.current.scrollTop}),M.start(100,()=>{T.current=!0}))},onWheel:P,onTouchMove:P,onPointerMove:P,onPointerEnter:P,onKeyDown:P},j=en.useMemo(()=>({scrolling:S||O,hasOverflowX:!v.x,hasOverflowY:!v.y,overflowXStart:k.xStart,overflowXEnd:k.xEnd,overflowYStart:k.yStart,overflowYEnd:k.yEnd,cornerHidden:v.corner}),[S,O,v.x,v.y,v.corner,k]),D=pt("div",e,{ref:[t,i],state:j,props:[F,o],stateAttributesMapping:Ys}),B=en.useMemo(()=>({computeThumbPosition:A}),[A]);return(0,Zt.jsx)(Gs.Provider,{value:B,children:D})});var ro=en.createContext(void 0);var so=function(e){return e.scrollAreaThumbHeight="--scroll-area-thumb-height",e.scrollAreaThumbWidth="--scroll-area-thumb-width",e}({}),oo=en.forwardRef(function(e,t){const{render:n,className:r,orientation:s="vertical",keepMounted:o=!1,style:i,...a}=e,{hovering:c,scrollingX:u,scrollingY:l,hiddenState:d,overflowEdges:h,scrollbarYRef:f,scrollbarXRef:p,viewportRef:g,thumbYRef:m,thumbXRef:v,handlePointerDown:y,handlePointerUp:b,rootId:w,thumbSize:x,hasMeasuredScrollbar:R}=js(),k={hovering:c,scrolling:{horizontal:u,vertical:l}[s],orientation:s,hasOverflowX:!d.x,hasOverflowY:!d.y,overflowXStart:h.xStart,overflowXEnd:h.xEnd,overflowYStart:h.yStart,overflowYEnd:h.yEnd,cornerHidden:d.corner},E=te(),S=!R&&!o;en.useEffect(()=>{const e=g.current,t="vertical"===s?f.current:p.current;if(t)return H(t,"wheel",function(n){if(e&&t&&!n.ctrlKey){if(n.preventDefault(),"vertical"===s){if(0===e.scrollTop&&n.deltaY<0)return}else if(0===e.scrollLeft&&n.deltaX<0)return;if("vertical"===s){if(e.scrollTop===e.scrollHeight-e.clientHeight&&n.deltaY>0)return}else if(e.scrollLeft===e.scrollWidth-e.clientWidth&&n.deltaX>0)return;"vertical"===s?e.scrollTop+=n.deltaY:e.scrollLeft+=n.deltaX}},{passive:!1})},[s,p,f,g]);const O={...w&&{"data-id":`${w}-scrollbar`},onPointerDown(e){if(0!==e.button)return;const t=rt(e.nativeEvent),n="vertical"===s?m.current:v.current;if((!n||!wt(n,t))&&g.current){if(m.current&&f.current&&"vertical"===s){const t=Bs(m.current,"margin","y"),n=Bs(f.current,"padding","y"),r=m.current.offsetHeight,s=f.current.getBoundingClientRect(),o=e.clientY-s.top-r/2-n+t/2,i=g.current.scrollHeight,a=g.current.clientHeight,c=o/(f.current.offsetHeight-r-n-t)*(i-a);g.current.scrollTop=c}if(v.current&&p.current&&"horizontal"===s){const t=Bs(v.current,"margin","x"),n=Bs(p.current,"padding","x"),r=v.current.offsetWidth,s=p.current.getBoundingClientRect(),o=e.clientX-s.left-r/2-n+t/2,i=g.current.scrollWidth,a=g.current.clientWidth,c=o/(p.current.offsetWidth-r-n-t);let u;"rtl"===E?(u=(1-c)*(i-a),g.current.scrollLeft<=0&&(u=-u)):u=c*(i-a),g.current.scrollLeft=u}y(e)}},onPointerUp:b,style:{position:"absolute",touchAction:"none",WebkitUserSelect:"none",userSelect:"none",visibility:S?"hidden":void 0,..."vertical"===s&&{top:0,bottom:`var(${Ds.scrollAreaCornerHeight})`,insetInlineEnd:0,[so.scrollAreaThumbHeight]:`${x.height}px`},..."horizontal"===s&&{insetInlineStart:0,insetInlineEnd:`var(${Ds.scrollAreaCornerWidth})`,bottom:0,[so.scrollAreaThumbWidth]:`${x.width}px`}}},C=pt("div",e,{ref:[t,"vertical"===s?f:p],state:k,props:[O,a],stateAttributesMapping:Ys}),T=en.useMemo(()=>({orientation:s}),[s]),_="vertical"===s?d.y:d.x;return!o&&_?null:(0,Zt.jsx)(ro.Provider,{value:T,children:C})}),io=en.forwardRef(function(e,t){const{render:n,className:r,style:s,...o}=e,{thumbYRef:i,thumbXRef:a,handlePointerDown:c,handlePointerMove:u,handlePointerUp:l,setScrollingX:d,setScrollingY:h,hasMeasuredScrollbar:f}=js(),{orientation:p}=function(){const e=en.useContext(ro);if(void 0===e)throw new Error(ot(54));return e}();return pt("div",e,{ref:[t,"vertical"===p?i:a],state:{orientation:p},props:[{onPointerDown:c,onPointerMove:u,onPointerUp(e){"vertical"===p&&h(!1),"horizontal"===p&&d(!1),l(e)},style:{visibility:f?void 0:"hidden",..."vertical"===p&&{height:`var(${so.scrollAreaThumbHeight})`},..."horizontal"===p&&{width:`var(${so.scrollAreaThumbWidth})`}}},o]})}),ao=en.forwardRef(function(e,t){const{render:n,className:r,style:s,...o}=e,{cornerRef:i,cornerSize:a,hiddenState:c}=js(),u=pt("div",e,{ref:[t,i],props:[{style:{position:"absolute",bottom:0,insetInlineEnd:0,width:a.width,height:a.height}},o]});return c.corner?null:u});function co({className:e,children:t,viewportProps:n,viewportRef:r,...s}){return(0,Zt.jsxs)(Ks,{"data-slot":"scroll-area",className:kt("relative",e),...s,children:[(0,Zt.jsx)(no,{...n,ref:r,"data-slot":"scroll-area-viewport",className:kt("size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1",n?.className),children:t}),(0,Zt.jsx)(uo,{}),(0,Zt.jsx)(ao,{})]})}function uo({className:e,orientation:t="vertical",...n}){return(0,Zt.jsx)(oo,{"data-slot":"scroll-area-scrollbar","data-orientation":t,orientation:t,className:kt("flex touch-none p-px transition-colors select-none data-horizontal:h-2.5 data-horizontal:flex-col data-horizontal:border-t data-horizontal:border-t-transparent data-vertical:h-full data-vertical:w-2.5 data-vertical:border-l data-vertical:border-l-transparent",e),...n,children:(0,Zt.jsx)(io,{"data-slot":"scroll-area-thumb",className:"relative flex-1 rounded-full bg-border"})})}var lo=Object.create(null);lo.open="0",lo.close="1",lo.ping="2",lo.pong="3",lo.message="4",lo.upgrade="5",lo.noop="6";var ho=Object.create(null);Object.keys(lo).forEach(e=>{ho[lo[e]]=e});var fo,po={type:"error",data:"parser error"},go="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===Object.prototype.toString.call(Blob),mo="function"==typeof ArrayBuffer,vo=e=>"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,yo=({type:e,data:t},n,r)=>go&&t instanceof Blob?n?r(t):bo(t,r):mo&&(t instanceof ArrayBuffer||vo(t))?n?r(t):bo(new Blob([t]),r):r(lo[e]+(t||"")),bo=(e,t)=>{const n=new FileReader;return n.onload=function(){const e=n.result.split(",")[1];t("b"+(e||""))},n.readAsDataURL(e)};function wo(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}var xo="undefined"==typeof Uint8Array?[]:new Uint8Array(256);for(let Fa=0;Fa<64;Fa++)xo["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charCodeAt(Fa)]=Fa;var Ro,ko="function"==typeof ArrayBuffer,Eo=(e,t)=>{if("string"!=typeof e)return{type:"message",data:Oo(e,t)};const n=e.charAt(0);return"b"===n?{type:"message",data:So(e.substring(1),t)}:ho[n]?e.length>1?{type:ho[n],data:e.substring(1)}:{type:ho[n]}:po},So=(e,t)=>ko?Oo((e=>{let t,n,r,s,o,i=.75*e.length,a=e.length,c=0;"="===e[e.length-1]&&(i--,"="===e[e.length-2]&&i--);const u=new ArrayBuffer(i),l=new Uint8Array(u);for(t=0;t<a;t+=4)n=xo[e.charCodeAt(t)],r=xo[e.charCodeAt(t+1)],s=xo[e.charCodeAt(t+2)],o=xo[e.charCodeAt(t+3)],l[c++]=n<<2|r>>4,l[c++]=(15&r)<<4|s>>2,l[c++]=(3&s)<<6|63&o;return u})(e),t):{base64:!0,data:e},Oo=(e,t)=>"blob"===t?e instanceof Blob?e:new Blob([e]):e instanceof ArrayBuffer?e:e.buffer,Co=String.fromCharCode(30);function To(){return new TransformStream({transform(e,t){!function(e,t){go&&e.data instanceof Blob?e.data.arrayBuffer().then(wo).then(t):mo&&(e.data instanceof ArrayBuffer||vo(e.data))?t(wo(e.data)):yo(e,!1,e=>{fo||(fo=new TextEncoder),t(fo.encode(e))})}(e,n=>{const r=n.length;let s;if(r<126)s=new Uint8Array(1),new DataView(s.buffer).setUint8(0,r);else if(r<65536){s=new Uint8Array(3);const e=new DataView(s.buffer);e.setUint8(0,126),e.setUint16(1,r)}else{s=new Uint8Array(9);const e=new DataView(s.buffer);e.setUint8(0,127),e.setBigUint64(1,BigInt(r))}e.data&&"string"!=typeof e.data&&(s[0]|=128),t.enqueue(s),t.enqueue(n)})}})}function _o(e){return e.reduce((e,t)=>e+t.length,0)}function Mo(e,t){if(e[0].length===t)return e.shift();const n=new Uint8Array(t);let r=0;for(let s=0;s<t;s++)n[s]=e[0][r++],r===e[0].length&&(e.shift(),r=0);return e.length&&r<e[0].length&&(e[0]=e[0].slice(r)),n}function Io(e){if(e)return function(e){for(var t in Io.prototype)e[t]=Io.prototype[t];return e}(e)}Io.prototype.on=Io.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},Io.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this},Io.prototype.off=Io.prototype.removeListener=Io.prototype.removeAllListeners=Io.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n,r=this._callbacks["$"+e];if(!r)return this;if(1==arguments.length)return delete this._callbacks["$"+e],this;for(var s=0;s<r.length;s++)if((n=r[s])===t||n.fn===t){r.splice(s,1);break}return 0===r.length&&delete this._callbacks["$"+e],this},Io.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),n=this._callbacks["$"+e],r=1;r<arguments.length;r++)t[r-1]=arguments[r];if(n){r=0;for(var s=(n=n.slice(0)).length;r<s;++r)n[r].apply(this,t)}return this},Io.prototype.emitReserved=Io.prototype.emit,Io.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]},Io.prototype.hasListeners=function(e){return!!this.listeners(e).length};var Ao="function"==typeof Promise&&"function"==typeof Promise.resolve?e=>Promise.resolve().then(e):(e,t)=>t(e,0),Po="undefined"!=typeof self?self:"undefined"!=typeof window?window:Function("return this")();function No(e,...t){return t.reduce((t,n)=>(e.hasOwnProperty(n)&&(t[n]=e[n]),t),{})}var Fo=Po.setTimeout,jo=Po.clearTimeout;function Do(e,t){t.useNativeTimers?(e.setTimeoutFn=Fo.bind(Po),e.clearTimeoutFn=jo.bind(Po)):(e.setTimeoutFn=Po.setTimeout.bind(Po),e.clearTimeoutFn=Po.clearTimeout.bind(Po))}function Bo(e){return"string"==typeof e?function(e){let t=0,n=0;for(let r=0,s=e.length;r<s;r++)t=e.charCodeAt(r),t<128?n+=1:t<2048?n+=2:t<55296||t>=57344?n+=3:(r++,n+=4);return n}(e):Math.ceil(1.33*(e.byteLength||e.size))}function Lo(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}var Uo=class extends Error{constructor(e,t,n){super(e),this.description=t,this.context=n,this.type="TransportError"}},qo=class extends Io{constructor(e){super(),this.writable=!1,Do(this,e),this.opts=e,this.query=e.query,this.socket=e.socket,this.supportsBinary=!e.forceBase64}onError(e,t,n){return super.emitReserved("error",new Uo(e,t,n)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return"opening"!==this.readyState&&"open"!==this.readyState||(this.doClose(),this.onClose()),this}send(e){"open"===this.readyState&&this.write(e)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){const t=Eo(e,this.socket.binaryType);this.onPacket(t)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e,t={}){return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(t)}_hostname(){const e=this.opts.hostname;return-1===e.indexOf(":")?e:"["+e+"]"}_port(){return this.opts.port&&(this.opts.secure&&443!==Number(this.opts.port)||!this.opts.secure&&80!==Number(this.opts.port))?":"+this.opts.port:""}_query(e){const t=function(e){let t="";for(let n in e)e.hasOwnProperty(n)&&(t.length&&(t+="&"),t+=encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t}(e);return t.length?"?"+t:""}},Ho=class extends qo{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(e){this.readyState="pausing";const t=()=>{this.readyState="paused",e()};if(this._polling||!this.writable){let e=0;this._polling&&(e++,this.once("pollComplete",function(){--e||t()})),this.writable||(e++,this.once("drain",function(){--e||t()}))}else t()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){((e,t)=>{const n=e.split(Co),r=[];for(let s=0;s<n.length;s++){const e=Eo(n[s],t);if(r.push(e),"error"===e.type)break}return r})(e,this.socket.binaryType).forEach(e=>{if("opening"===this.readyState&&"open"===e.type&&this.onOpen(),"close"===e.type)return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(e)}),"closed"!==this.readyState&&(this._polling=!1,this.emitReserved("pollComplete"),"open"===this.readyState&&this._poll())}doClose(){const e=()=>{this.write([{type:"close"}])};"open"===this.readyState?e():this.once("open",e)}write(e){this.writable=!1,((e,t)=>{const n=e.length,r=new Array(n);let s=0;e.forEach((e,o)=>{yo(e,!1,e=>{r[o]=e,++s===n&&t(r.join(Co))})})})(e,e=>{this.doWrite(e,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const e=this.opts.secure?"https":"http",t=this.query||{};return!1!==this.opts.timestampRequests&&(t[this.opts.timestampParam]=Lo()),this.supportsBinary||t.sid||(t.b64=1),this.createUri(e,t)}},Yo=!1;try{Yo="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest}catch(Na){}var Wo=Yo;function zo(){}var Xo=class extends Ho{constructor(e){if(super(e),"undefined"!=typeof location){const t="https:"===location.protocol;let n=location.port;n||(n=t?"443":"80"),this.xd="undefined"!=typeof location&&e.hostname!==location.hostname||n!==e.port}}doWrite(e,t){const n=this.request({method:"POST",data:e});n.on("success",t),n.on("error",(e,t)=>{this.onError("xhr post error",e,t)})}doPoll(){const e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(e,t)=>{this.onError("xhr poll error",e,t)}),this.pollXhr=e}},Qo=class e extends Io{constructor(e,t,n){super(),this.createRequest=e,Do(this,n),this._opts=n,this._method=n.method||"GET",this._uri=t,this._data=void 0!==n.data?n.data:null,this._create()}_create(){var t;const n=No(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");n.xdomain=!!this._opts.xd;const r=this._xhr=this.createRequest(n);try{r.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){r.setDisableHeaderCheck&&r.setDisableHeaderCheck(!0);for(let e in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(e)&&r.setRequestHeader(e,this._opts.extraHeaders[e])}}catch(s){}if("POST"===this._method)try{r.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(s){}try{r.setRequestHeader("Accept","*/*")}catch(s){}null===(t=this._opts.cookieJar)||void 0===t||t.addCookies(r),"withCredentials"in r&&(r.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(r.timeout=this._opts.requestTimeout),r.onreadystatechange=()=>{var e;3===r.readyState&&(null===(e=this._opts.cookieJar)||void 0===e||e.parseCookies(r.getResponseHeader("set-cookie"))),4===r.readyState&&(200===r.status||1223===r.status?this._onLoad():this.setTimeoutFn(()=>{this._onError("number"==typeof r.status?r.status:0)},0))},r.send(this._data)}catch(s){return void this.setTimeoutFn(()=>{this._onError(s)},0)}"undefined"!=typeof document&&(this._index=e.requestsCount++,e.requests[this._index]=this)}_onError(e){this.emitReserved("error",e,this._xhr),this._cleanup(!0)}_cleanup(t){if(void 0!==this._xhr&&null!==this._xhr){if(this._xhr.onreadystatechange=zo,t)try{this._xhr.abort()}catch(n){}"undefined"!=typeof document&&delete e.requests[this._index],this._xhr=null}}_onLoad(){const e=this._xhr.responseText;null!==e&&(this.emitReserved("data",e),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}};if(Qo.requestsCount=0,Qo.requests={},"undefined"!=typeof document)if("function"==typeof attachEvent)attachEvent("onunload",$o);else if("function"==typeof addEventListener){addEventListener("onpagehide"in Po?"pagehide":"unload",$o,!1)}function $o(){for(let e in Qo.requests)Qo.requests.hasOwnProperty(e)&&Qo.requests[e].abort()}var Vo=function(){const e=Ko({xdomain:!1});return e&&null!==e.responseType}();function Ko(e){const t=e.xdomain;try{if("undefined"!=typeof XMLHttpRequest&&(!t||Wo))return new XMLHttpRequest}catch(n){}if(!t)try{return new(Po[["Active"].concat("Object").join("X")])("Microsoft.XMLHTTP")}catch(n){}}var Go="undefined"!=typeof navigator&&"string"==typeof navigator.product&&"reactnative"===navigator.product.toLowerCase(),Jo=class extends qo{get name(){return"websocket"}doOpen(){const e=this.uri(),t=this.opts.protocols,n=Go?{}:No(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(n.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(e,t,n)}catch(Na){return this.emitReserved("error",Na)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let t=0;t<e.length;t++){const n=e[t],r=t===e.length-1;yo(n,this.supportsBinary,e=>{try{this.doWrite(n,e)}catch(t){}r&&Ao(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){void 0!==this.ws&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const e=this.opts.secure?"wss":"ws",t=this.query||{};return this.opts.timestampRequests&&(t[this.opts.timestampParam]=Lo()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}},Zo=Po.WebSocket||Po.MozWebSocket,ei={websocket:class extends Jo{createSocket(e,t,n){return Go?new Zo(e,t,n):t?new Zo(e,t):new Zo(e)}doWrite(e,t){this.ws.send(t)}},webtransport:class extends qo{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(Na){return this.emitReserved("error",Na)}this._transport.closed.then(()=>{this.onClose()}).catch(e=>{this.onError("webtransport error",e)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(e=>{const t=function(e,t){Ro||(Ro=new TextDecoder);const n=[];let r=0,s=-1,o=!1;return new TransformStream({transform(i,a){for(n.push(i);;){if(0===r){if(_o(n)<1)break;const e=Mo(n,1);o=!(128&~e[0]),s=127&e[0],r=s<126?3:126===s?1:2}else if(1===r){if(_o(n)<2)break;const e=Mo(n,2);s=new DataView(e.buffer,e.byteOffset,e.length).getUint16(0),r=3}else if(2===r){if(_o(n)<8)break;const e=Mo(n,8),t=new DataView(e.buffer,e.byteOffset,e.length),o=t.getUint32(0);if(o>Math.pow(2,21)-1){a.enqueue(po);break}s=o*Math.pow(2,32)+t.getUint32(4),r=3}else{if(_o(n)<s)break;const e=Mo(n,s);a.enqueue(Eo(o?e:Ro.decode(e),t)),r=0}if(0===s||s>e){a.enqueue(po);break}}}})}(Number.MAX_SAFE_INTEGER,this.socket.binaryType),n=e.readable.pipeThrough(t).getReader(),r=To();r.readable.pipeTo(e.writable),this._writer=r.writable.getWriter();const s=()=>{n.read().then(({done:e,value:t})=>{e||(this.onPacket(t),s())}).catch(e=>{})};s();const o={type:"open"};this.query.sid&&(o.data=`{"sid":"${this.query.sid}"}`),this._writer.write(o).then(()=>this.onOpen())})})}write(e){this.writable=!1;for(let t=0;t<e.length;t++){const n=e[t],r=t===e.length-1;this._writer.write(n).then(()=>{r&&Ao(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;null===(e=this._transport)||void 0===e||e.close()}},polling:class extends Xo{constructor(e){super(e);const t=e&&e.forceBase64;this.supportsBinary=Vo&&!t}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new Qo(Ko,this.uri(),e)}}},ti=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,ni=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function ri(e){if(e.length>8e3)throw"URI too long";const t=e,n=e.indexOf("["),r=e.indexOf("]");-1!=n&&-1!=r&&(e=e.substring(0,n)+e.substring(n,r).replace(/:/g,";")+e.substring(r,e.length));let s=ti.exec(e||""),o={},i=14;for(;i--;)o[ni[i]]=s[i]||"";return-1!=n&&-1!=r&&(o.source=t,o.host=o.host.substring(1,o.host.length-1).replace(/;/g,":"),o.authority=o.authority.replace("[","").replace("]","").replace(/;/g,":"),o.ipv6uri=!0),o.pathNames=function(e,t){const n=t.replace(/\/{2,9}/g,"/").split("/");"/"!=t.slice(0,1)&&0!==t.length||n.splice(0,1);"/"==t.slice(-1)&&n.splice(n.length-1,1);return n}(0,o.path),o.queryKey=function(e,t){const n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(e,t,r){t&&(n[t]=r)}),n}(0,o.query),o}var si="function"==typeof addEventListener&&"function"==typeof removeEventListener,oi=[];si&&addEventListener("offline",()=>{oi.forEach(e=>e())},!1);var ii=class e extends Io{constructor(e,t){if(super(),this.binaryType="arraybuffer",this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,e&&"object"==typeof e&&(t=e,e=null),e){const n=ri(e);t.hostname=n.host,t.secure="https"===n.protocol||"wss"===n.protocol,t.port=n.port,n.query&&(t.query=n.query)}else t.host&&(t.hostname=ri(t.host).host);Do(this,t),this.secure=null!=t.secure?t.secure:"undefined"!=typeof location&&"https:"===location.protocol,t.hostname&&!t.port&&(t.port=this.secure?"443":"80"),this.hostname=t.hostname||("undefined"!=typeof location?location.hostname:"localhost"),this.port=t.port||("undefined"!=typeof location&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},t.transports.forEach(e=>{const t=e.prototype.name;this.transports.push(t),this._transportsByName[t]=e}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},t),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),"string"==typeof this.opts.query&&(this.opts.query=function(e){let t={},n=e.split("&");for(let r=0,s=n.length;r<s;r++){let e=n[r].split("=");t[decodeURIComponent(e[0])]=decodeURIComponent(e[1])}return t}(this.opts.query)),si&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),"localhost"!==this.hostname&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},oi.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(e){const t=Object.assign({},this.opts.query);t.EIO=4,t.transport=e,this.id&&(t.sid=this.id);const n=Object.assign({},this.opts,{query:t,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return new this._transportsByName[e](n)}_open(){if(0===this.transports.length)return void this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);const t=this.opts.rememberUpgrade&&e.priorWebsocketSuccess&&-1!==this.transports.indexOf("websocket")?"websocket":this.transports[0];this.readyState="opening";const n=this.createTransport(t);n.open(),this.setTransport(n)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",e=>this._onClose("transport close",e))}onOpen(){this.readyState="open",e.priorWebsocketSuccess="websocket"===this.transport.name,this.emitReserved("open"),this.flush()}_onPacket(e){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState)switch(this.emitReserved("packet",e),this.emitReserved("heartbeat"),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const t=new Error("server error");t.code=e.data,this._onError(t);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data)}}onHandshake(e){this.emitReserved("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this._pingInterval=e.pingInterval,this._pingTimeout=e.pingTimeout,this._maxPayload=e.maxPayload,this.onOpen(),"closed"!==this.readyState&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const e=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+e,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},e),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,0===this.writeBuffer.length?this.emitReserved("drain"):this.flush()}flush(){if("closed"!==this.readyState&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const e=this._getWritablePackets();this.transport.send(e),this._prevBufferLen=e.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&"polling"===this.transport.name&&this.writeBuffer.length>1))return this.writeBuffer;let e=1;for(let t=0;t<this.writeBuffer.length;t++){const n=this.writeBuffer[t].data;if(n&&(e+=Bo(n)),t>0&&e>this._maxPayload)return this.writeBuffer.slice(0,t);e+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const e=Date.now()>this._pingTimeoutTime;return e&&(this._pingTimeoutTime=0,Ao(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),e}write(e,t,n){return this._sendPacket("message",e,t,n),this}send(e,t,n){return this._sendPacket("message",e,t,n),this}_sendPacket(e,t,n,r){if("function"==typeof t&&(r=t,t=void 0),"function"==typeof n&&(r=n,n=null),"closing"===this.readyState||"closed"===this.readyState)return;(n=n||{}).compress=!1!==n.compress;const s={type:e,data:t,options:n};this.emitReserved("packetCreate",s),this.writeBuffer.push(s),r&&this.once("flush",r),this.flush()}close(){const e=()=>{this._onClose("forced close"),this.transport.close()},t=()=>{this.off("upgrade",t),this.off("upgradeError",t),e()},n=()=>{this.once("upgrade",t),this.once("upgradeError",t)};return"opening"!==this.readyState&&"open"!==this.readyState||(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?n():e()}):this.upgrading?n():e()),this}_onError(t){if(e.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&"opening"===this.readyState)return this.transports.shift(),this._open();this.emitReserved("error",t),this._onClose("transport error",t)}_onClose(e,t){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),si&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const e=oi.indexOf(this._offlineEventListener);-1!==e&&oi.splice(e,1)}this.readyState="closed",this.id=null,this.emitReserved("close",e,t),this.writeBuffer=[],this._prevBufferLen=0}}};ii.protocol=4;var ai=class extends ii{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),"open"===this.readyState&&this.opts.upgrade)for(let e=0;e<this._upgrades.length;e++)this._probe(this._upgrades[e])}_probe(e){let t=this.createTransport(e),n=!1;ii.priorWebsocketSuccess=!1;const r=()=>{n||(t.send([{type:"ping",data:"probe"}]),t.once("packet",e=>{if(!n)if("pong"===e.type&&"probe"===e.data){if(this.upgrading=!0,this.emitReserved("upgrading",t),!t)return;ii.priorWebsocketSuccess="websocket"===t.name,this.transport.pause(()=>{n||"closed"!==this.readyState&&(u(),this.setTransport(t),t.send([{type:"upgrade"}]),this.emitReserved("upgrade",t),t=null,this.upgrading=!1,this.flush())})}else{const e=new Error("probe error");e.transport=t.name,this.emitReserved("upgradeError",e)}}))};function s(){n||(n=!0,u(),t.close(),t=null)}const o=e=>{const n=new Error("probe error: "+e);n.transport=t.name,s(),this.emitReserved("upgradeError",n)};function i(){o("transport closed")}function a(){o("socket closed")}function c(e){t&&e.name!==t.name&&s()}const u=()=>{t.removeListener("open",r),t.removeListener("error",o),t.removeListener("close",i),this.off("close",a),this.off("upgrading",c)};t.once("open",r),t.once("error",o),t.once("close",i),this.once("close",a),this.once("upgrading",c),-1!==this._upgrades.indexOf("webtransport")&&"webtransport"!==e?this.setTimeoutFn(()=>{n||t.open()},200):t.open()}onHandshake(e){this._upgrades=this._filterUpgrades(e.upgrades),super.onHandshake(e)}_filterUpgrades(e){const t=[];for(let n=0;n<e.length;n++)~this.transports.indexOf(e[n])&&t.push(e[n]);return t}},ci=class extends ai{constructor(e,t={}){const n="object"==typeof e?e:t;(!n.transports||n.transports&&"string"==typeof n.transports[0])&&(n.transports=(n.transports||["polling","websocket","webtransport"]).map(e=>ei[e]).filter(e=>!!e)),super(e,n)}};var ui="function"==typeof ArrayBuffer,li=Object.prototype.toString,di="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===li.call(Blob),hi="function"==typeof File||"undefined"!=typeof File&&"[object FileConstructor]"===li.call(File);function fi(e){return ui&&(e instanceof ArrayBuffer||(e=>"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer)(e))||di&&e instanceof Blob||hi&&e instanceof File}function pi(e,t){if(!e||"object"!=typeof e)return!1;if(Array.isArray(e)){for(let t=0,n=e.length;t<n;t++)if(pi(e[t]))return!0;return!1}if(fi(e))return!0;if(e.toJSON&&"function"==typeof e.toJSON&&1===arguments.length)return pi(e.toJSON(),!0);for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&pi(e[n]))return!0;return!1}function gi(e){const t=[],n=e.data,r=e;return r.data=mi(n,t),r.attachments=t.length,{packet:r,buffers:t}}function mi(e,t){if(!e)return e;if(fi(e)){const n={_placeholder:!0,num:t.length};return t.push(e),n}if(Array.isArray(e)){const n=new Array(e.length);for(let r=0;r<e.length;r++)n[r]=mi(e[r],t);return n}if("object"==typeof e&&!(e instanceof Date)){const n={};for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=mi(e[r],t));return n}return e}function vi(e,t){return e.data=yi(e.data,t),delete e.attachments,e}function yi(e,t){if(!e)return e;if(e&&!0===e._placeholder){if("number"==typeof e.num&&e.num>=0&&e.num<t.length)return t[e.num];throw new Error("illegal attachments")}if(Array.isArray(e))for(let n=0;n<e.length;n++)e[n]=yi(e[n],t);else if("object"==typeof e)for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(e[n]=yi(e[n],t));return e}var bi,wi=t({Decoder:()=>ki,Encoder:()=>Ri,PacketType:()=>bi,isPacketValid:()=>Ci,protocol:()=>5}),xi=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];!function(e){e[e.CONNECT=0]="CONNECT",e[e.DISCONNECT=1]="DISCONNECT",e[e.EVENT=2]="EVENT",e[e.ACK=3]="ACK",e[e.CONNECT_ERROR=4]="CONNECT_ERROR",e[e.BINARY_EVENT=5]="BINARY_EVENT",e[e.BINARY_ACK=6]="BINARY_ACK"}(bi||(bi={}));var Ri=class{constructor(e){this.replacer=e}encode(e){return e.type!==bi.EVENT&&e.type!==bi.ACK||!pi(e)?[this.encodeAsString(e)]:this.encodeAsBinary({type:e.type===bi.EVENT?bi.BINARY_EVENT:bi.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id})}encodeAsString(e){let t=""+e.type;return e.type!==bi.BINARY_EVENT&&e.type!==bi.BINARY_ACK||(t+=e.attachments+"-"),e.nsp&&"/"!==e.nsp&&(t+=e.nsp+","),null!=e.id&&(t+=e.id),null!=e.data&&(t+=JSON.stringify(e.data,this.replacer)),t}encodeAsBinary(e){const t=gi(e),n=this.encodeAsString(t.packet),r=t.buffers;return r.unshift(n),r}},ki=class e extends Io{constructor(e){super(),this.opts=Object.assign({reviver:void 0,maxAttachments:10},"function"==typeof e?{reviver:e}:e)}add(e){let t;if("string"==typeof e){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");t=this.decodeString(e);const n=t.type===bi.BINARY_EVENT;n||t.type===bi.BINARY_ACK?(t.type=n?bi.EVENT:bi.ACK,this.reconstructor=new Ei(t),0===t.attachments&&super.emitReserved("decoded",t)):super.emitReserved("decoded",t)}else{if(!fi(e)&&!e.base64)throw new Error("Unknown type: "+e);if(!this.reconstructor)throw new Error("got binary data when not reconstructing a packet");t=this.reconstructor.takeBinaryData(e),t&&(this.reconstructor=null,super.emitReserved("decoded",t))}}decodeString(t){let n=0;const r={type:Number(t.charAt(0))};if(void 0===bi[r.type])throw new Error("unknown packet type "+r.type);if(r.type===bi.BINARY_EVENT||r.type===bi.BINARY_ACK){const e=n+1;for(;"-"!==t.charAt(++n)&&n!=t.length;);const s=t.substring(e,n);if(s!=Number(s)||"-"!==t.charAt(n))throw new Error("Illegal attachments");const o=Number(s);if(!Si(o)||o<0)throw new Error("Illegal attachments");if(o>this.opts.maxAttachments)throw new Error("too many attachments");r.attachments=o}if("/"===t.charAt(n+1)){const e=n+1;for(;++n&&","!==t.charAt(n)&&n!==t.length;);r.nsp=t.substring(e,n)}else r.nsp="/";const s=t.charAt(n+1);if(""!==s&&Number(s)==s){const e=n+1;for(;++n;){const e=t.charAt(n);if(null==e||Number(e)!=e){--n;break}if(n===t.length)break}r.id=Number(t.substring(e,n+1))}if(t.charAt(++n)){const s=this.tryParse(t.substr(n));if(!e.isPayloadValid(r.type,s))throw new Error("invalid payload");r.data=s}return r}tryParse(e){try{return JSON.parse(e,this.opts.reviver)}catch(t){return!1}}static isPayloadValid(e,t){switch(e){case bi.CONNECT:return Oi(t);case bi.DISCONNECT:return void 0===t;case bi.CONNECT_ERROR:return"string"==typeof t||Oi(t);case bi.EVENT:case bi.BINARY_EVENT:return Array.isArray(t)&&("number"==typeof t[0]||"string"==typeof t[0]&&-1===xi.indexOf(t[0]));case bi.ACK:case bi.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}},Ei=class{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){const e=vi(this.reconPack,this.buffers);return this.finishedReconstruction(),e}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}};var Si=Number.isInteger||function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e};function Oi(e){return"[object Object]"===Object.prototype.toString.call(e)}function Ci(e){return"string"==typeof e.nsp&&(void 0===(t=e.id)||Si(t))&&function(e,t){switch(e){case bi.CONNECT:return void 0===t||Oi(t);case bi.DISCONNECT:return void 0===t;case bi.EVENT:return Array.isArray(t)&&("number"==typeof t[0]||"string"==typeof t[0]&&-1===xi.indexOf(t[0]));case bi.ACK:return Array.isArray(t);case bi.CONNECT_ERROR:return"string"==typeof t||Oi(t);default:return!1}}(e.type,e.data);var t}function Ti(e,t,n){return e.on(t,n),function(){e.off(t,n)}}var _i=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1}),Mi=class extends Io{constructor(e,t,n){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=t,n&&n.auth&&(this.auth=n.auth),this._opts=Object.assign({},n),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const e=this.io;this.subs=[Ti(e,"open",this.onopen.bind(this)),Ti(e,"packet",this.onpacket.bind(this)),Ti(e,"error",this.onerror.bind(this)),Ti(e,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected||(this.subEvents(),this.io._reconnecting||this.io.open(),"open"===this.io._readyState&&this.onopen()),this}open(){return this.connect()}send(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...t){var n,r,s;if(_i.hasOwnProperty(e))throw new Error('"'+e.toString()+'" is a reserved event name');if(t.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(t),this;const o={type:bi.EVENT,data:t,options:{}};if(o.options.compress=!1!==this.flags.compress,"function"==typeof t[t.length-1]){const e=this.ids++,n=t.pop();this._registerAckCallback(e,n),o.id=e}const i=null===(r=null===(n=this.io.engine)||void 0===n?void 0:n.transport)||void 0===r?void 0:r.writable,a=this.connected&&!(null===(s=this.io.engine)||void 0===s?void 0:s._hasPingExpired());return this.flags.volatile&&!i||(a?(this.notifyOutgoingListeners(o),this.packet(o)):this.sendBuffer.push(o)),this.flags={},this}_registerAckCallback(e,t){var n;const r=null!==(n=this.flags.timeout)&&void 0!==n?n:this._opts.ackTimeout;if(void 0===r)return void(this.acks[e]=t);const s=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let t=0;t<this.sendBuffer.length;t++)this.sendBuffer[t].id===e&&this.sendBuffer.splice(t,1);t.call(this,new Error("operation has timed out"))},r),o=(...e)=>{this.io.clearTimeoutFn(s),t.apply(this,e)};o.withError=!0,this.acks[e]=o}emitWithAck(e,...t){return new Promise((n,r)=>{const s=(e,t)=>e?r(e):n(t);s.withError=!0,t.push(s),this.emit(e,...t)})}_addToQueue(e){let t;"function"==typeof e[e.length-1]&&(t=e.pop());const n={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((e,...r)=>(this._queue[0],null!==e?n.tryCount>this._opts.retries&&(this._queue.shift(),t&&t(e)):(this._queue.shift(),t&&t(null,...r)),n.pending=!1,this._drainQueue())),this._queue.push(n),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||0===this._queue.length)return;const t=this._queue[0];t.pending&&!e||(t.pending=!0,t.tryCount++,this.flags=t.flags,this.emit.apply(this,t.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){"function"==typeof this.auth?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:bi.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,t){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,t),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(e=>{if(!this.sendBuffer.some(t=>String(t.id)===e)){const t=this.acks[e];delete this.acks[e],t.withError&&t.call(this,new Error("socket has been disconnected"))}})}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case bi.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case bi.EVENT:case bi.BINARY_EVENT:this.onevent(e);break;case bi.ACK:case bi.BINARY_ACK:this.onack(e);break;case bi.DISCONNECT:this.ondisconnect();break;case bi.CONNECT_ERROR:this.destroy();const t=new Error(e.data.message);t.data=e.data.data,this.emitReserved("connect_error",t)}}onevent(e){const t=e.data||[];null!=e.id&&t.push(this.ack(e.id)),this.connected?this.emitEvent(t):this.receiveBuffer.push(Object.freeze(t))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){const t=this._anyListeners.slice();for(const n of t)n.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&"string"==typeof e[e.length-1]&&(this._lastOffset=e[e.length-1])}ack(e){const t=this;let n=!1;return function(...r){n||(n=!0,t.packet({type:bi.ACK,id:e,data:r}))}}onack(e){const t=this.acks[e.id];"function"==typeof t&&(delete this.acks[e.id],t.withError&&e.data.unshift(null),t.apply(this,e.data))}onconnect(e,t){this.id=e,this.recovered=t&&this._pid===t,this._pid=t,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(e=>e()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:bi.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){const t=this._anyListeners;for(let n=0;n<t.length;n++)if(e===t[n])return t.splice(n,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){const t=this._anyOutgoingListeners;for(let n=0;n<t.length;n++)if(e===t[n])return t.splice(n,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const t=this._anyOutgoingListeners.slice();for(const n of t)n.apply(this,e.data)}}};function Ii(e){e=e||{},this.ms=e.min||100,this.max=e.max||1e4,this.factor=e.factor||2,this.jitter=e.jitter>0&&e.jitter<=1?e.jitter:0,this.attempts=0}Ii.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),n=Math.floor(t*this.jitter*e);e=1&Math.floor(10*t)?e+n:e-n}return 0|Math.min(e,this.max)},Ii.prototype.reset=function(){this.attempts=0},Ii.prototype.setMin=function(e){this.ms=e},Ii.prototype.setMax=function(e){this.max=e},Ii.prototype.setJitter=function(e){this.jitter=e};var Ai=class extends Io{constructor(e,t){var n;super(),this.nsps={},this.subs=[],e&&"object"==typeof e&&(t=e,e=void 0),(t=t||{}).path=t.path||"/socket.io",this.opts=t,Do(this,t),this.reconnection(!1!==t.reconnection),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor(null!==(n=t.randomizationFactor)&&void 0!==n?n:.5),this.backoff=new Ii({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(null==t.timeout?2e4:t.timeout),this._readyState="closed",this.uri=e;const r=t.parser||wi;this.encoder=new r.Encoder,this.decoder=new r.Decoder,this._autoConnect=!1!==t.autoConnect,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,e||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(e){return void 0===e?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var t;return void 0===e?this._reconnectionDelay:(this._reconnectionDelay=e,null===(t=this.backoff)||void 0===t||t.setMin(e),this)}randomizationFactor(e){var t;return void 0===e?this._randomizationFactor:(this._randomizationFactor=e,null===(t=this.backoff)||void 0===t||t.setJitter(e),this)}reconnectionDelayMax(e){var t;return void 0===e?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,null===(t=this.backoff)||void 0===t||t.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&0===this.backoff.attempts&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new ci(this.uri,this.opts);const t=this.engine,n=this;this._readyState="opening",this.skipReconnect=!1;const r=Ti(t,"open",function(){n.onopen(),e&&e()}),s=t=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",t),e?e(t):this.maybeReconnectOnOpen()},o=Ti(t,"error",s);if(!1!==this._timeout){const e=this._timeout,n=this.setTimeoutFn(()=>{r(),s(new Error("timeout")),t.close()},e);this.opts.autoUnref&&n.unref(),this.subs.push(()=>{this.clearTimeoutFn(n)})}return this.subs.push(r),this.subs.push(o),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const e=this.engine;this.subs.push(Ti(e,"ping",this.onping.bind(this)),Ti(e,"data",this.ondata.bind(this)),Ti(e,"error",this.onerror.bind(this)),Ti(e,"close",this.onclose.bind(this)),Ti(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(t){this.onclose("parse error",t)}}ondecoded(e){Ao(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,t){let n=this.nsps[e];return n?this._autoConnect&&!n.active&&n.connect():(n=new Mi(this,e,t),this.nsps[e]=n),n}_destroy(e){const t=Object.keys(this.nsps);for(const n of t)if(this.nsps[n].active)return;this._close()}_packet(e){const t=this.encoder.encode(e);for(let n=0;n<t.length;n++)this.engine.write(t[n],e.options)}cleanup(){this.subs.forEach(e=>e()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(e,t){var n;this.cleanup(),null===(n=this.engine)||void 0===n||n.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,t),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const t=this.backoff.duration();this._reconnecting=!0;const n=this.setTimeoutFn(()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),e.skipReconnect||e.open(t=>{t?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",t)):e.onreconnect()}))},t);this.opts.autoUnref&&n.unref(),this.subs.push(()=>{this.clearTimeoutFn(n)})}}onreconnect(){const e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}},Pi={};function Ni(e,t){"object"==typeof e&&(t=e,e=void 0);const n=function(e,t="",n){let r=e;n=n||"undefined"!=typeof location&&location,null==e&&(e=n.protocol+"//"+n.host),"string"==typeof e&&("/"===e.charAt(0)&&(e="/"===e.charAt(1)?n.protocol+e:n.host+e),/^(https?|wss?):\/\//.test(e)||(e=void 0!==n?n.protocol+"//"+e:"https://"+e),r=ri(e)),r.port||(/^(http|ws)$/.test(r.protocol)?r.port="80":/^(http|ws)s$/.test(r.protocol)&&(r.port="443")),r.path=r.path||"/";const s=-1!==r.host.indexOf(":")?"["+r.host+"]":r.host;return r.id=r.protocol+"://"+s+":"+r.port+t,r.href=r.protocol+"://"+s+(n&&n.port===r.port?"":":"+r.port),r}(e,(t=t||{}).path||"/socket.io"),r=n.source,s=n.id,o=n.path,i=Pi[s]&&o in Pi[s].nsps;let a;return t.forceNew||t["force new connection"]||!1===t.multiplex||i?a=new Ai(r,t):(Pi[s]||(Pi[s]=new Ai(r,t)),a=Pi[s]),n.query&&!t.query&&(t.query=n.queryKey),a.socket(n.path,t)}function Fi(e,t){let n=!1;const r=Ni(e.serverUrl||window.location.origin,{auth:{token:e.token},path:"/socket.io",reconnection:!0,transports:["websocket"]});return r.on("connect",()=>{n||t.onOpen?.()}),r.on("disconnect",()=>{n||t.onClose?.()}),r.on("connect_error",e=>{n||t.onError?.(e)}),r.on("terminal:count",e=>{n||t.onCount?.(e)}),r.on("terminal:project",e=>{n||t.onProject?.(e)}),r.on("terminal:output",e=>{n||t.onOutput?.(e)}),r.on("terminal:exit",e=>{n||t.onExit?.(e)}),{disconnect:()=>{n=!0,r.disconnect()},socket:r}}function ji(e,t,n){return e?new Promise((r,s)=>{e.timeout(15e3).emit(t,n,(e,t)=>{if(e)return void s(e);if(!t?.ok)return void s(new Error(t?.message??"Terminal request failed."));const n={...t};delete n.ok,r(n)})}):Promise.reject(new Error("Terminal socket is not connected."))}function Di(e,t,n,r){return e?.autoRotateAccount&&"RUNNING"!==e.status&&n&&n.id!==e.accountId?Ui(r[n.id])<0?null:!t||"CONNECTED"!==t.status||Ui(r[t.id])<0?n:null:null}function Bi(e,t){return t?e.find(e=>e.model===t||e.id===t):e.find(e=>e.isDefault)??e[0]}function Li(e,t){return e.map((e,n)=>({account:e,index:n,score:Ui(t[e.id])})).sort((e,t)=>t.score-e.score||e.index-t.index).at(0)?.account}function Ui(e){if(!e)return 0;if(e.rateLimitReachedType||Es(e))return-1;if(e.credits&&!e.credits.unlimited&&!e.credits.hasCredits)return-1;if(e.credits?.unlimited)return 101;const t=[e.primary,e.secondary].filter(e=>!!e).map(e=>100-Os(e.usedPercent));return t.length?Math.min(...t):0}function qi(e,t){const n=e?.windowDurationMins;return n?n>=10080?"Weekly limit":300===n?"5-hour limit":n%60==0?n/60+"-hour limit":`${n}-minute limit`:t}function Hi(e){return e>=10080?`${Math.round(e/10080)} week window`:e%60==0?e/60+" hour window":`${e} minute window`}function Yi(e){const t=e<1e12?1e3*e:e;return new Intl.DateTimeFormat(void 0,{day:"numeric",hour:"numeric",minute:"2-digit",month:"short"}).format(new Date(t))}function Wi(e){const t=new Date(e),n=Math.max(0,Date.now()-t.getTime()),r=6e4,s=36e5,o=864e5;if(n<12e4)return"just now";if(n<s)return`${Math.floor(n/r)}m ago`;if(n<o)return`${Math.floor(n/s)}h ago`;if(n<2*o)return"yesterday";if(n<=3*o)return`${Math.floor(n/o)} days ago`;const i=new Date,a=t.getFullYear()===i.getFullYear();return new Intl.DateTimeFormat(void 0,{day:"numeric",month:"short",...a?{}:{year:"numeric"}}).format(t)}function zi(e){const t=e?.trim();if(!t)return"No folder";const n=t.replace(/[\\/]+$/,"");return n?n.split(/[\\/]/).filter(Boolean).at(-1)??n:t}function Xi(e){const t=e?.trim();return t?t.replace(/[\\/]+$/,"")||t:"No folder"}function Qi(e){return Xi(e)}function $i(e){return!!e.trim()&&"No folder"!==e}function Vi(e){return e.replace(/[\\/]+$/,"").split(/[\\/]/).filter(Boolean).at(-1)||e}function Ki(e){return e>=1e6?`${Gi(e/1e6)}M`:e>=1e3?`${Gi(e/1e3)}k`:String(Math.max(0,Math.round(e)))}function Gi(e){return Number.isInteger(e)?String(e):e.toFixed(1)}function Ji(e){return e.split("_").filter(Boolean).map(e=>e.slice(0,1).toUpperCase()+e.slice(1)).join(" ")}function Zi(e){return Ji(e)}function ea({effort:e,model:t,modelValue:n,serviceTier:r}){return[(t?.displayName??n)||"Model",e?ta(e):null,r?na(r):null].filter(Boolean).join(" ")}function ta(e){return e?"xhigh"===e?"Extra High":e.slice(0,1).toUpperCase()+e.slice(1):"Default"}function na(e){return e?e.slice(0,1).toUpperCase()+e.slice(1):"Default"}function ra(e){return"fullAccess"===e?"Full access":"Default"}function sa(e,t){let n=e;for(const r of t)n=Ft(n,r);return n??{data:[],nextCursor:null}}function oa(e){return[e.message,e.assistantMessage].filter(e=>!!e)}function ia(e,t){const n=e??[];return n.some(e=>e.id===t.id)?n.map(e=>e.id===t.id?t:e):[...n,t]}function aa(e,t,n,r=[]){return(!!e.trim()||r.length>0)&&!!t.trim()&&!!n}function ca(e){if(!e||"object"!=typeof e||Array.isArray(e))return"";const t=e.workingDirectory;return"string"==typeof t?t.trim():""}function ua(e){if(!e)return!1;const t=e instanceof Error?e.message:String(e);return e instanceof Bt&&401===e.status||/token_invalidated|authentication token .*invalidated|re-authenticate this account/i.test(t)}function la(e){return e instanceof Error?e.message:"Request failed."}Object.assign(Ni,{Manager:Ai,Socket:Mi,io:Ni,connect:Ni});var da=en.createContext(void 0);function ha(e){const t=en.useContext(da);if(void 0===t&&!e)throw new Error(ot(47));return t}var fa={...Ve,disabled:Se(e=>e.disabled),instantType:Se(e=>e.instantType),openMethod:Se(e=>e.openMethod),openChangeReason:Se(e=>e.openChangeReason),modal:Se(e=>e.modal),focusManagerModal:Se(e=>e.focusManagerModal),stickIfOpen:Se(e=>e.stickIfOpen),titleElementId:Se(e=>e.titleElementId),descriptionElementId:Se(e=>e.descriptionElementId),openOnHover:Se(e=>e.openOnHover),closeDelay:Se(e=>e.closeDelay),hasViewport:Se(e=>e.hasViewport)},pa=class e extends I{constructor(e){const t={...{...J(),disabled:!1,modal:!1,focusManagerModal:!1,instantType:void 0,openMethod:null,openChangeReason:null,titleElementId:void 0,descriptionElementId:void 0,stickIfOpen:!0,nested:!1,openOnHover:!1,closeDelay:0,hasViewport:!1},...e};t.open&&void 0===e?.mounted&&(t.mounted=!0),super(t,{popupRef:en.createRef(),backdropRef:en.createRef(),internalBackdropRef:en.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:en.createRef(),beforeContentFocusGuardRef:en.createRef(),stickIfOpenTimeout:new m,triggerElements:new tt},fa)}setOpen=(e,t)=>{const n=t.reason===ut,r="trigger-press"===t.reason&&0===t.event.detail,s=!e&&("escape-key"===t.reason||null==t.reason);if(t.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},this.context.onOpenChange?.(e,t),t.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(e,t);const o=()=>{const n={open:e,openChangeReason:t.reason},r=t.trigger?.id??null;(r||e)&&(n.activeTriggerId=r,n.activeTriggerElement=t.trigger??null),this.update(n)};n?(this.set("stickIfOpen",!0),this.context.stickIfOpenTimeout.start(500,()=>{this.set("stickIfOpen",!1)}),rs.flushSync(o)):o(),r||s?this.set("instantType",r?"click":"dismiss"):"focus-out"===t.reason?this.set("instantType","focus"):this.set("instantType",void 0)};static useStore(t,n){const r=dt(()=>new e(n)).current,s=t??r;return O(r.disposeEffect),s}disposeEffect=()=>this.context.stickIfOpenTimeout.disposeEffect()};function ga({props:e}){const{children:t,open:n,defaultOpen:r=!1,onOpenChange:s,onOpenChangeComplete:o,modal:a=!1,handle:c,triggerId:u,defaultTriggerId:l=null}=e,d=pa.useStore(c?.store,{modal:a,open:r,openProp:n,activeTriggerId:l,triggerIdProp:u});B(()=>{void 0===n&&!1===d.state.open&&!0===r&&d.update({open:!0,activeTriggerId:l})}),d.useControlledProp("openProp",n),d.useControlledProp("triggerIdProp",u);const h=d.useState("open"),f=d.useState("payload");d.useContextCallback("onOpenChange",s),d.useContextCallback("onOpenChangeComplete",o);const{openMethod:p,triggerProps:m}=or(h);se(d);const{forceUnmount:v}=Ze(h,d,()=>{d.update({stickIfOpen:!0,openChangeReason:null})});en.useEffect(()=>{h||d.context.stickIfOpenTimeout.clear()},[d,h]);const y=en.useCallback(()=>{d.setOpen(!1,Rt(yt))},[d]);en.useImperativeHandle(e.actionsRef,()=>({unmount:v,close:y}),[v,y]);const b=ge({popupStore:d,onOpenChange:d.setOpen}),{getReferenceProps:w,getFloatingProps:x,getTriggerProps:R}=he([i(b,{outsidePressEvent:{mouse:"trap-focus"===a?"sloppy":"intentional",touch:"sloppy"}}),Vn(b)]),k=en.useMemo(()=>w(m),[w,m]),E=en.useMemo(()=>R(m),[R,m]),S=en.useMemo(()=>x(),[x]);d.useSyncedValues({modal:a,openMethod:p,activeTriggerProps:k,inactiveTriggerProps:E,popupProps:S,floatingRootContext:b,nested:null!=g()});const O=en.useMemo(()=>({store:d}),[d]);return(0,Zt.jsx)(da.Provider,{value:O,children:"function"==typeof t?t({payload:f}):t})}function ma(e){return ha(!0)?(0,Zt.jsx)(ga,{props:e}):(0,Zt.jsx)(_,{children:(0,Zt.jsx)(ga,{props:e})})}var va=en.forwardRef(function(e,t){const{render:n,className:r,disabled:s=!1,nativeButton:o=!0,handle:i,payload:a,openOnHover:c=!1,delay:u=300,closeDelay:l=0,id:d,style:h,...f}=e,p=ha(!0),g=i?.store??p?.store;if(!g)throw new Error(ot(74));const m=lt(d),v=g.useState("isTriggerActive",m),y=g.useState("floatingRootContext"),b=g.useState("isOpenedByTrigger",m),w=en.useRef(null),{registerTrigger:x,isMountedByThisTrigger:R}=L(m,w,g,{payload:a,disabled:s,openOnHover:c,closeDelay:l}),k=g.useState("openChangeReason"),E=g.useState("stickIfOpen"),S=g.useState("openMethod"),O=g.useState("focusManagerModal"),C=De(y,{enabled:null!=y&&c&&("touch"!==S||"trigger-press"!==k),mouseOnly:!0,move:!1,handleClose:ae(),restMs:u,delay:{close:l},triggerElementRef:w,isActiveTrigger:v,isClosing:()=>"ending"===g.select("transitionStatus")}),T=he([Yn(y,{enabled:null!=y,stickIfOpen:E})]),_=g.useState("triggerProps",R),M={disabled:s,open:b},{getButtonProps:I,buttonRef:A}=Xt({disabled:s,native:o}),P=en.useMemo(()=>({open:e=>e&&"trigger-press"===k?Ce.open(e):Xe.open(e)}),[k]),N=pt("button",e,{state:M,ref:[A,t,x,w],props:[T.getReferenceProps(),C,_,{[W]:"",id:m},f,I],stateAttributesMapping:P}),{preFocusGuardRef:F,handlePreFocusGuardFocus:j,handleFocusTargetFocus:D}=ss(g,w);return v&&!O?(0,Zt.jsxs)(en.Fragment,{children:[(0,Zt.jsx)(Ke,{ref:F,onFocus:j}),(0,Zt.jsx)(en.Fragment,{children:N},m),(0,Zt.jsx)(Ke,{ref:g.context.triggerFocusTargetRef,onFocus:D})]}):(0,Zt.jsx)(en.Fragment,{children:N},m)}),ya=en.createContext(void 0);var ba=en.forwardRef(function(e,t){const{keepMounted:n=!1,...r}=e,{store:s}=ha();return s.useState("mounted")||n?(0,Zt.jsx)(ya.Provider,{value:n,children:(0,Zt.jsx)(D,{ref:t,...r})}):null}),wa=en.createContext(void 0);var xa=en.forwardRef(function(e,t){const{render:n,className:r,anchor:s,positionMethod:o="absolute",side:i="bottom",align:a="center",sideOffset:c=0,alignOffset:u=0,collisionBoundary:l="clipping-ancestors",collisionPadding:d=5,arrowPadding:h=5,sticky:f=!1,disableAnchorTracking:p=!1,collisionAvoidance:g=Y,style:m,...v}=e,{store:y}=ha(),b=function(){const e=en.useContext(ya);if(void 0===e)throw new Error(ot(45));return e}(),w=P(),x=y.useState("floatingRootContext"),R=y.useState("mounted"),k=y.useState("open"),E=y.useState("openChangeReason"),S=y.useState("activeTriggerElement"),O=y.useState("modal"),T=y.useState("openMethod"),_=y.useState("positionerElement"),M=y.useState("instantType"),I=y.useState("transitionStatus"),A=y.useState("hasViewport"),N=en.useRef(null),F=q(_,!1,!1),j=Ue({anchor:s,floatingRootContext:x,positionMethod:o,mounted:R,side:i,sideOffset:c,align:a,alignOffset:u,arrowPadding:h,collisionBoundary:l,collisionPadding:d,sticky:f,disableAnchorTracking:p,keepMounted:b,nodeId:w,collisionAvoidance:g,adaptiveOrigin:A?xe:void 0}),D=x.useState("domReferenceElement");Et(()=>{const e=D,t=N.current;if(e&&(N.current=e),t&&e&&e!==t){y.set("instantType",void 0);const e=new AbortController;return F(()=>{y.set("instantType","trigger-change")},e.signal),()=>{e.abort()}}},[D,F,y]);const B={open:k,side:j.side,align:j.align,anchorHidden:j.anchorHidden,instant:M};Ur(k&&!0===O&&"trigger-hover"!==E,"touch"===T,_,S);const L=en.useCallback(e=>{y.set("positionerElement",e)},[y]),U=We(e,B,{styles:j.positionerStyles,transitionStatus:I,props:v,refs:[t,L],hidden:!R,inert:!k});return(0,Zt.jsxs)(wa.Provider,{value:j,children:[R&&!0===O&&"trigger-hover"!==E&&(0,Zt.jsx)(gr,{ref:y.context.internalBackdropRef,inert:Gn(!k),cutout:S}),(0,Zt.jsx)(C,{id:w,children:U})]})}),Ra=en.createContext(void 0);function ka(e){const{value:t,children:n}=e;return(0,Zt.jsx)(Ra.Provider,{value:t,children:n})}var Ea={...oe,...p},Sa=en.forwardRef(function(e,t){const{className:n,render:r,initialFocus:s,finalFocus:o,style:i,...a}=e,{store:c}=ha(),u=function(){const e=en.useContext(wa);if(!e)throw new Error(ot(46));return e}(),l=null!=Ir(!0),{context:d,hasClosePart:h}=function(){const[e,t]=en.useState(0),n=Lt(()=>(t(e=>e+1),()=>{t(e=>Math.max(0,e-1))}));return{context:en.useMemo(()=>({register:n}),[n]),hasClosePart:e>0}}(),f=c.useState("open"),p=c.useState("openMethod"),g=c.useState("instantType"),m=c.useState("transitionStatus"),v=c.useState("popupProps"),y=c.useState("titleElementId"),b=c.useState("descriptionElementId"),w=c.useState("modal"),x=c.useState("mounted"),R=c.useState("openChangeReason"),k=c.useState("activeTriggerElement"),E=c.useState("floatingRootContext");Ge({open:f,ref:c.context.popupRef,onComplete(){f&&c.context.onOpenChangeComplete?.(!0)}});const S=c.useState("disabled"),O=c.useState("openOnHover"),C=c.useState("closeDelay");Me(E,{enabled:O&&!S,closeDelay:C});const T=void 0===s?function(e){return"touch"!==e||c.context.popupRef.current}:s,_={open:f,side:u.side,align:u.align,instant:g,transitionStatus:m},M=!1!==w&&h;c.useSyncedValue("focusManagerModal",M);const I=en.useCallback(e=>{c.set("popupElement",e)},[c]),A=pt("div",e,{state:_,ref:[t,c.context.popupRef,I],props:[v,{"aria-labelledby":y,"aria-describedby":b,onKeyDown(e){l&&pr.has(e.key)&&e.stopPropagation()}},Pe(m),a],stateAttributesMapping:Ea});return(0,Zt.jsx)(Hn,{context:E,openInteractionType:p,modal:M,disabled:!x||"trigger-hover"===R,initialFocus:T,returnFocus:o,restoreFocus:"popup",previousFocusableElement:Nt(k)?k:void 0,nextFocusableElement:c.context.triggerFocusTargetRef,beforeContentFocusGuardRef:c.context.beforeContentFocusGuardRef,children:(0,Zt.jsx)(ka,{value:d,children:A})})}),Oa=en.forwardRef(function(e,t){const{render:n,className:r,style:s,...o}=e,{store:i}=ha(),a=lt(o.id);return Et(()=>(i.set("titleElementId",a),()=>{i.set("titleElementId",void 0)}),[i,a]),pt("h2",e,{ref:t,props:[{id:a},o]})}),Ca=en.forwardRef(function(e,t){const{render:n,className:r,style:s,...o}=e,{store:i}=ha(),a=lt(o.id);return Et(()=>(i.set("descriptionElementId",a),()=>{i.set("descriptionElementId",void 0)}),[i,a]),pt("p",e,{ref:t,props:[{id:a},o]})});function Ta({...e}){return(0,Zt.jsx)(ma,{"data-slot":"popover",...e})}function _a({...e}){return(0,Zt.jsx)(va,{"data-slot":"popover-trigger",...e})}function Ma({className:e,align:t="center",alignOffset:n=0,side:r="bottom",sideOffset:s=4,...o}){return(0,Zt.jsx)(ba,{children:(0,Zt.jsx)(xa,{align:t,alignOffset:n,side:r,sideOffset:s,className:"isolate z-50",children:(0,Zt.jsx)(Sa,{"data-slot":"popover-content",className:kt("z-50 flex w-72 origin-(--transform-origin) flex-col gap-2.5 rounded-lg bg-popover p-2.5 text-sm text-popover-foreground shadow-md ring-1 ring-foreground/10 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",e),...o})})})}function Ia({className:e,...t}){return(0,Zt.jsx)("div",{"data-slot":"popover-header",className:kt("flex flex-col gap-0.5 text-sm",e),...t})}function Aa({className:e,...t}){return(0,Zt.jsx)(Oa,{"data-slot":"popover-title",className:kt("font-medium",e),...t})}function Pa({className:e,...t}){return(0,Zt.jsx)(Ca,{"data-slot":"popover-description",className:kt("text-muted-foreground",e),...t})}export{ps as $,ea as A,an as At,Rs as B,Hi as C,fn as Ct,ra as D,ln as Dt,$i as E,dn as Et,ji as F,ys as G,Es as H,Ni as I,ds as J,cs as K,co as L,Bi as M,nn as Mt,ia as N,Qt as Nt,la as O,on as Ot,Fi as P,hs as Q,Os as R,Ki as S,pn as St,ua as T,un as Tt,xs as U,ks as V,bs as W,ms as X,gs as Y,vs as Z,ta as _,bn as _t,Aa as a,or as at,Yi as b,mn as bt,sa as c,Gn as ct,Qi as d,Hn as dt,fs as et,zi as f,En as ft,Wi as g,wn as gt,oa as h,xn as ht,Ia as i,pr as it,Li as j,sn as jt,ca as k,cn as kt,Di as l,Vn as lt,Vi as m,Rn as mt,Ma as n,is as nt,_a as o,sr as ot,Xi as p,kn as pt,ls as q,Pa as r,gr as rt,Ui as s,rr as st,Ta as t,us as tt,aa as u,Yn as ut,Ji as v,yn as vt,qi as w,hn as wt,na as x,gn as xt,Zi as y,vn as yt,Ss as z};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{C as e,F as t,M as s,N as i,R as a,a as r,c as n,d as u,f as o,i as h,t as c}from"./jsx-runtime-BD6xVgfN.js";import{$t as l,Gt as d,Ut as f,Vt as y,Xt as m,Yt as p,_n as g,an as q,en as b,gn as v,in as x,on as O,pn as C,qt as Q,rn as j,tn as w,un as D}from"./usePositioner-DoPOYGgd.js";import{a as A,c as M,l as P,s as E,t as K,u as H}from"./document-title-CVCGo83t.js";import{Ut as N,Wt as F}from"./api-Bq1vju8d.js";import{t as S}from"./triangle-alert-CX-fS3B2.js";import{t as k}from"./session-provider-Bxa1AL3n.js";var z=class extends g{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#s=0}#e;#t;#s;build(e,t,s){const i=new d({client:e,mutationCache:this,mutationId:++this.#s,options:e.defaultMutationOptions(t),state:s});return this.add(i),i}add(e){this.#e.add(e);const t=I(e);if("string"==typeof t){const s=this.#t.get(t);s?s.push(e):this.#t.set(t,[e])}this.notify({type:"added",mutation:e})}remove(e){if(this.#e.delete(e)){const t=I(e);if("string"==typeof t){const s=this.#t.get(t);if(s)if(s.length>1){const t=s.indexOf(e);-1!==t&&s.splice(t,1)}else s[0]===e&&this.#t.delete(t)}}this.notify({type:"removed",mutation:e})}canRun(e){const t=I(e);if("string"==typeof t){const s=this.#t.get(t)?.find(e=>"pending"===e.state.status);return!s||s===e}return!0}runNext(e){const t=I(e);return"string"==typeof t?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){m.batch(()=>{this.#e.forEach(e=>{this.notify({type:"removed",mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){const t={exact:!0,...e};return this.getAll().find(e=>j(t,e))}findAll(e={}){return this.getAll().filter(t=>j(e,t))}notify(e){m.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){const e=this.getAll().filter(e=>e.state.isPaused);return m.batch(()=>Promise.all(e.map(e=>e.continue().catch(q))))}};function I(e){return e.options.scope?.id}var T=class extends g{constructor(e={}){super(),this.config=e,this.#i=new Map}#i;build(e,t,s){const i=t.queryKey,a=t.queryHash??w(i,t);let r=this.get(a);return r||(r=new Q({client:e,queryKey:i,queryHash:a,options:e.defaultQueryOptions(t),state:s,defaultOptions:e.getQueryDefaults(i)}),this.add(r)),r}add(e){this.#i.has(e.queryHash)||(this.#i.set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const t=this.#i.get(e.queryHash);t&&(e.destroy(),t===e&&this.#i.delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){m.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#i.get(e)}getAll(){return[...this.#i.values()]}find(e){const t={exact:!0,...e};return this.getAll().find(e=>x(t,e))}findAll(e={}){const t=this.getAll();return Object.keys(e).length>0?t.filter(t=>x(e,t)):t}notify(e){m.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){m.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){m.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},_=class{#a;#r;#n;#u;#o;#h;#c;#l;constructor(e={}){this.#a=e.queryCache||new T,this.#r=e.mutationCache||new z,this.#n=e.defaultOptions||{},this.#u=new Map,this.#o=new Map,this.#h=0}mount(){this.#h++,1===this.#h&&(this.#c=v.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#a.onFocus())}),this.#l=p.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#a.onOnline())}))}unmount(){this.#h--,0===this.#h&&(this.#c?.(),this.#c=void 0,this.#l?.(),this.#l=void 0)}isFetching(e){return this.#a.findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return this.#r.findAll({...e,status:"pending"}).length}getQueryData(e){const t=this.defaultQueryOptions({queryKey:e});return this.#a.get(t.queryHash)?.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),s=this.#a.build(this,t),i=s.state.data;return void 0===i?this.fetchQuery(e):(e.revalidateIfStale&&s.isStaleByTime(D(t.staleTime,s))&&this.prefetchQuery(t),Promise.resolve(i))}getQueriesData(e){return this.#a.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,s){const i=this.defaultQueryOptions({queryKey:e}),a=this.#a.get(i.queryHash)?.state.data,r=l(t,a);if(void 0!==r)return this.#a.build(this,i).setData(r,{...s,manual:!0})}setQueriesData(e,t,s){return m.batch(()=>this.#a.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,s)]))}getQueryState(e){const t=this.defaultQueryOptions({queryKey:e});return this.#a.get(t.queryHash)?.state}removeQueries(e){const t=this.#a;m.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){const s=this.#a;return m.batch(()=>(s.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const s={revert:!0,...t},i=m.batch(()=>this.#a.findAll(e).map(e=>e.cancel(s)));return Promise.all(i).then(q).catch(q)}invalidateQueries(e,t={}){return m.batch(()=>(this.#a.findAll(e).forEach(e=>{e.invalidate()}),"none"===e?.refetchType?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??"active"},t)))}refetchQueries(e,t={}){const s={...t,cancelRefetch:t.cancelRefetch??!0},i=m.batch(()=>this.#a.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,s);return s.throwOnError||(t=t.catch(q)),"paused"===e.state.fetchStatus?Promise.resolve():t}));return Promise.all(i).then(q)}fetchQuery(e){const t=this.defaultQueryOptions(e);void 0===t.retry&&(t.retry=!1);const s=this.#a.build(this,t);return s.isStaleByTime(D(t.staleTime,s))?s.fetch(t):Promise.resolve(s.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(q).catch(q)}fetchInfiniteQuery(e){return e._type="infinite",this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(q).catch(q)}ensureInfiniteQueryData(e){return e._type="infinite",this.ensureQueryData(e)}resumePausedMutations(){return p.isOnline()?this.#r.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#a}getMutationCache(){return this.#r}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#u.set(b(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...this.#u.values()],s={};return t.forEach(t=>{O(e,t.queryKey)&&Object.assign(s,t.defaultOptions)}),s}setMutationDefaults(e,t){this.#o.set(b(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...this.#o.values()],s={};return t.forEach(t=>{O(e,t.mutationKey)&&Object.assign(s,t.defaultOptions)}),s}defaultQueryOptions(e){if(e._defaulted)return e;const t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=w(t.queryKey,t)),void 0===t.refetchOnReconnect&&(t.refetchOnReconnect="always"!==t.networkMode),void 0===t.throwOnError&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===C&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#a.clear(),this.#r.clear()}},R=F("octagon-x",[["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z",key:"2d38gg"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]),B=a(t(),1),U=c(),W=({...e})=>{const{theme:t="system"}=H();return(0,U.jsx)(y,{theme:t,className:"toaster group",icons:{success:(0,U.jsx)(M,{className:"size-4"}),info:(0,U.jsx)(E,{className:"size-4"}),warning:(0,U.jsx)(S,{className:"size-4"}),error:(0,U.jsx)(R,{className:"size-4"}),loading:(0,U.jsx)(N,{className:"size-4 animate-spin"})},style:{"--normal-bg":"var(--popover)","--normal-text":"var(--popover-foreground)","--normal-border":"var(--border)","--border-radius":"var(--radius)"},toastOptions:{classNames:{toast:"cn-toast"}},...e})};function $(){return[{title:K}]}function V(){return[{rel:"icon",href:"/favicon.svg",type:"image/svg+xml"}]}function G({children:e}){return(0,U.jsxs)("html",{lang:"en",suppressHydrationWarning:!0,children:[(0,U.jsxs)("head",{children:[(0,U.jsx)("meta",{charSet:"utf-8"}),(0,U.jsx)("meta",{name:"viewport",content:"width=device-width, initial-scale=1"}),(0,U.jsx)(r,{}),(0,U.jsx)(h,{})]}),(0,U.jsxs)("body",{children:[e,(0,U.jsx)(o,{}),(0,U.jsx)(u,{})]})]})}var J=s(function(){const[e]=(0,B.useState)(()=>new _({defaultOptions:{queries:{refetchOnWindowFocus:!1,retry:1}}}));return(0,U.jsx)(P,{attribute:"class",defaultTheme:"dark",enableSystem:!0,children:(0,U.jsx)(f,{client:e,children:(0,U.jsxs)(A,{children:[(0,U.jsx)(k,{children:(0,U.jsx)(n,{})}),(0,U.jsx)(W,{richColors:!0})]})})})}),X=i(function({error:t}){const s=e(t)?`${t.status} ${t.statusText}`:t instanceof Error?t.message:"Unexpected application error.";return(0,U.jsx)("main",{className:"flex min-h-svh items-center justify-center bg-background p-6",children:(0,U.jsxs)("section",{className:"max-w-md rounded-xl border bg-background p-5 shadow-sm",children:[(0,U.jsx)("h1",{className:"text-lg font-semibold",children:"xedoc"}),(0,U.jsx)("p",{className:"mt-2 whitespace-pre-wrap text-sm text-muted-foreground",children:s})]})})});export{X as ErrorBoundary,G as Layout,J as default,V as links,$ as meta};
|