@llmindset/hf-mcp-server 0.1.17 → 0.1.19

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.
@@ -1,115 +0,0 @@
1
- import{r as Gi,a as h,R as Se,j as a,b as Er,u as te,P as X,c as Ve,d as Z,C as Te,e as Ie,f as De,g as tt,h as $e,i as _r,S as zi,k as Bn,l as jr,m as Bi,n as Ui,o as Pr,B as dt,p as Qe,q as Wi,s as Ki,t as qi}from"./button-DOWMQOme.js";var xn={exports:{}},wn={};/**
2
- * @license React
3
- * use-sync-external-store-shim.production.js
4
- *
5
- * Copyright (c) Meta Platforms, Inc. and affiliates.
6
- *
7
- * This source code is licensed under the MIT license found in the
8
- * LICENSE file in the root directory of this source tree.
9
- */var Bo;function Xi(){if(Bo)return wn;Bo=1;var e=Gi();function n(m,d){return m===d&&(m!==0||1/m===1/d)||m!==m&&d!==d}var t=typeof Object.is=="function"?Object.is:n,o=e.useState,r=e.useEffect,s=e.useLayoutEffect,i=e.useDebugValue;function l(m,d){var c=d(),v=o({inst:{value:c,getSnapshot:d}}),p=v[0].inst,w=v[1];return s(function(){p.value=c,p.getSnapshot=d,u(p)&&w({inst:p})},[m,c,d]),r(function(){return u(p)&&w({inst:p}),m(function(){u(p)&&w({inst:p})})},[m]),i(c),c}function u(m){var d=m.getSnapshot;m=m.value;try{var c=d();return!t(m,c)}catch{return!0}}function f(m,d){return d()}var g=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?f:l;return wn.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:g,wn}var Uo;function Yi(){return Uo||(Uo=1,xn.exports=Xi()),xn.exports}var Ji=Yi();const Nr=0,Ar=1,Fr=2,Wo=3;var Ko=Object.prototype.hasOwnProperty;function Un(e,n){var t,o;if(e===n)return!0;if(e&&n&&(t=e.constructor)===n.constructor){if(t===Date)return e.getTime()===n.getTime();if(t===RegExp)return e.toString()===n.toString();if(t===Array){if((o=e.length)===n.length)for(;o--&&Un(e[o],n[o]););return o===-1}if(!t||typeof e=="object"){o=0;for(t in e)if(Ko.call(e,t)&&++o&&!Ko.call(n,t)||!(t in n)||!Un(e[t],n[t]))return!1;return Object.keys(n).length===o}}return e!==e&&n!==n}const Fe=new WeakMap,ze=()=>{},oe=ze(),Wn=Object,H=e=>e===oe,Ce=e=>typeof e=="function",We=(e,n)=>({...e,...n}),Tr=e=>Ce(e.then),Sn={},Ft={},go="undefined",_t=typeof window!=go,Kn=typeof document!=go,Zi=_t&&"Deno"in window,Qi=()=>_t&&typeof window.requestAnimationFrame!=go,Ir=(e,n)=>{const t=Fe.get(e);return[()=>!H(n)&&e.get(n)||Sn,o=>{if(!H(n)){const r=e.get(n);n in Ft||(Ft[n]=r),t[5](n,We(r,o),r||Sn)}},t[6],()=>!H(n)&&n in Ft?Ft[n]:!H(n)&&e.get(n)||Sn]};let qn=!0;const ea=()=>qn,[Xn,Yn]=_t&&window.addEventListener?[window.addEventListener.bind(window),window.removeEventListener.bind(window)]:[ze,ze],ta=()=>{const e=Kn&&document.visibilityState;return H(e)||e!=="hidden"},na=e=>(Kn&&document.addEventListener("visibilitychange",e),Xn("focus",e),()=>{Kn&&document.removeEventListener("visibilitychange",e),Yn("focus",e)}),oa=e=>{const n=()=>{qn=!0,e()},t=()=>{qn=!1};return Xn("online",n),Xn("offline",t),()=>{Yn("online",n),Yn("offline",t)}},ra={isOnline:ea,isVisible:ta},sa={initFocus:na,initReconnect:oa},qo=!Se.useId,yt=!_t||Zi,ia=e=>Qi()?window.requestAnimationFrame(e):setTimeout(e,1),Cn=yt?h.useEffect:h.useLayoutEffect,yn=typeof navigator<"u"&&navigator.connection,Xo=!yt&&yn&&(["slow-2g","2g"].includes(yn.effectiveType)||yn.saveData),Tt=new WeakMap,Rn=(e,n)=>Wn.prototype.toString.call(e)===`[object ${n}]`;let aa=0;const Jn=e=>{const n=typeof e,t=Rn(e,"Date"),o=Rn(e,"RegExp"),r=Rn(e,"Object");let s,i;if(Wn(e)===e&&!t&&!o){if(s=Tt.get(e),s)return s;if(s=++aa+"~",Tt.set(e,s),Array.isArray(e)){for(s="@",i=0;i<e.length;i++)s+=Jn(e[i])+",";Tt.set(e,s)}if(r){s="#";const l=Wn.keys(e).sort();for(;!H(i=l.pop());)H(e[i])||(s+=i+":"+Jn(e[i])+",");Tt.set(e,s)}}else s=t?e.toJSON():n=="symbol"?e.toString():n=="string"?JSON.stringify(e):""+e;return s},mo=e=>{if(Ce(e))try{e=e()}catch{e=""}const n=e;return e=typeof e=="string"?e:(Array.isArray(e)?e.length:e)?Jn(e):"",[e,n]};let la=0;const Zn=()=>++la;async function Dr(...e){const[n,t,o,r]=e,s=We({populateCache:!0,throwOnError:!0},typeof r=="boolean"?{revalidate:r}:r||{});let i=s.populateCache;const l=s.rollbackOnError;let u=s.optimisticData;const f=d=>typeof l=="function"?l(d):l!==!1,g=s.throwOnError;if(Ce(t)){const d=t,c=[],v=n.keys();for(const p of v)!/^\$(inf|sub)\$/.test(p)&&d(n.get(p)._k)&&c.push(p);return Promise.all(c.map(m))}return m(t);async function m(d){const[c]=mo(d);if(!c)return;const[v,p]=Ir(n,c),[w,x,S,C]=Fe.get(n),y=()=>{const O=w[c];return(Ce(s.revalidate)?s.revalidate(v().data,d):s.revalidate!==!1)&&(delete S[c],delete C[c],O&&O[0])?O[0](Fr).then(()=>v().data):v().data};if(e.length<3)return y();let R=o,M;const b=Zn();x[c]=[b,0];const E=!H(u),$=v(),I=$.data,V=$._c,G=H(V)?I:V;if(E&&(u=Ce(u)?u(G,I):u,p({data:u,_c:G})),Ce(R))try{R=R(G)}catch(O){M=O}if(R&&Tr(R))if(R=await R.catch(O=>{M=O}),b!==x[c][0]){if(M)throw M;return R}else M&&E&&f(M)&&(i=!0,p({data:G,_c:oe}));if(i&&!M)if(Ce(i)){const O=i(R,G);p({data:O,error:oe,_c:oe})}else p({data:R,error:oe,_c:oe});if(x[c][1]=Zn(),Promise.resolve(y()).then(()=>{p({_c:oe})}),M){if(g)throw M;return}return R}}const Yo=(e,n)=>{for(const t in e)e[t][0]&&e[t][0](n)},ca=(e,n)=>{if(!Fe.has(e)){const t=We(sa,n),o=Object.create(null),r=Dr.bind(oe,e);let s=ze;const i=Object.create(null),l=(g,m)=>{const d=i[g]||[];return i[g]=d,d.push(m),()=>d.splice(d.indexOf(m),1)},u=(g,m,d)=>{e.set(g,m);const c=i[g];if(c)for(const v of c)v(m,d)},f=()=>{if(!Fe.has(e)&&(Fe.set(e,[o,Object.create(null),Object.create(null),Object.create(null),r,u,l]),!yt)){const g=t.initFocus(setTimeout.bind(oe,Yo.bind(oe,o,Nr))),m=t.initReconnect(setTimeout.bind(oe,Yo.bind(oe,o,Ar)));s=()=>{g&&g(),m&&m(),Fe.delete(e)}}};return f(),[e,r,f,s]}return[e,Fe.get(e)[4]]},ua=(e,n,t,o,r)=>{const s=t.errorRetryCount,i=r.retryCount,l=~~((Math.random()+.5)*(1<<(i<8?i:8)))*t.errorRetryInterval;!H(s)&&i>s||setTimeout(o,l,r)},da=Un,[$r,Bt]=ca(new Map),fa=We({onLoadingSlow:ze,onSuccess:ze,onError:ze,onErrorRetry:ua,onDiscarded:ze,revalidateOnFocus:!0,revalidateOnReconnect:!0,revalidateIfStale:!0,shouldRetryOnError:!0,errorRetryInterval:Xo?1e4:5e3,focusThrottleInterval:5*1e3,dedupingInterval:2*1e3,loadingTimeout:Xo?5e3:3e3,compare:da,isPaused:()=>!1,cache:$r,mutate:Bt,fallback:{}},ra),ga=(e,n)=>{const t=We(e,n);if(n){const{use:o,fallback:r}=e,{use:s,fallback:i}=n;o&&s&&(t.use=o.concat(s)),r&&i&&(t.fallback=We(r,i))}return t},ma=h.createContext({}),pa="$inf$",Or=_t&&window.__SWR_DEVTOOLS_USE__,ha=Or?window.__SWR_DEVTOOLS_USE__:[],va=()=>{Or&&(window.__SWR_DEVTOOLS_REACT__=Se)},xa=e=>Ce(e[1])?[e[0],e[1],e[2]||{}]:[e[0],null,(e[1]===null?e[2]:e[1])||{}],wa=()=>We(fa,h.useContext(ma)),Sa=e=>(n,t,o)=>e(n,t&&((...s)=>{const[i]=mo(n),[,,,l]=Fe.get($r);if(i.startsWith(pa))return t(...s);const u=l[i];return H(u)?t(...s):(delete l[i],u)}),o),Ca=ha.concat(Sa),ya=e=>function(...t){const o=wa(),[r,s,i]=xa(t),l=ga(o,i);let u=e;const{use:f}=l,g=(f||[]).concat(Ca);for(let m=g.length;m--;)u=g[m](u);return u(r,s||l.fetcher||null,l)},Ra=(e,n,t)=>{const o=n[e]||(n[e]=[]);return o.push(t),()=>{const r=o.indexOf(t);r>=0&&(o[r]=o[o.length-1],o.pop())}};va();const bn=Se.use||(e=>{switch(e.status){case"pending":throw e;case"fulfilled":return e.value;case"rejected":throw e.reason;default:throw e.status="pending",e.then(n=>{e.status="fulfilled",e.value=n},n=>{e.status="rejected",e.reason=n}),e}}),Mn={dedupe:!0},ba=(e,n,t)=>{const{cache:o,compare:r,suspense:s,fallbackData:i,revalidateOnMount:l,revalidateIfStale:u,refreshInterval:f,refreshWhenHidden:g,refreshWhenOffline:m,keepPreviousData:d}=t,[c,v,p,w]=Fe.get(o),[x,S]=mo(e),C=h.useRef(!1),y=h.useRef(!1),R=h.useRef(x),M=h.useRef(n),b=h.useRef(t),E=()=>b.current,$=()=>E().isVisible()&&E().isOnline(),[I,V,G,O]=Ir(o,x),L=h.useRef({}).current,D=H(i)?H(t.fallback)?oe:t.fallback[x]:i,P=(z,B)=>{for(const Q in L){const K=Q;if(K==="data"){if(!r(z[K],B[K])&&(!H(z[K])||!r(je,B[K])))return!1}else if(B[K]!==z[K])return!1}return!0},T=h.useMemo(()=>{const z=!x||!n?!1:H(l)?E().isPaused()||s?!1:u!==!1:l,B=ne=>{const Pe=We(ne);return delete Pe._k,z?{isValidating:!0,isLoading:!0,...Pe}:Pe},Q=I(),K=O(),ae=B(Q),He=Q===K?ae:B(K);let J=ae;return[()=>{const ne=B(I());return P(ne,J)?(J.data=ne.data,J.isLoading=ne.isLoading,J.isValidating=ne.isValidating,J.error=ne.error,J):(J=ne,ne)},()=>He]},[o,x]),j=Ji.useSyncExternalStore(h.useCallback(z=>G(x,(B,Q)=>{P(Q,B)||z()}),[o,x]),T[0],T[1]),_=!C.current,U=c[x]&&c[x].length>0,W=j.data,Y=H(W)?D&&Tr(D)?bn(D):D:W,xe=j.error,_e=h.useRef(Y),je=d?H(W)?H(_e.current)?Y:_e.current:W:Y,we=U&&!H(xe)?!1:_&&!H(l)?l:E().isPaused()?!1:s?H(Y)?!1:u:H(Y)||u,de=!!(x&&n&&_&&we),Je=H(j.isValidating)?de:j.isValidating,ie=H(j.isLoading)?de:j.isLoading,me=h.useCallback(async z=>{const B=M.current;if(!x||!B||y.current||E().isPaused())return!1;let Q,K,ae=!0;const He=z||{},J=!p[x]||!He.dedupe,ne=()=>qo?!y.current&&x===R.current&&C.current:x===R.current,Pe={isValidating:!1,isLoading:!1},Ho=()=>{V(Pe)},Go=()=>{const fe=p[x];fe&&fe[1]===K&&delete p[x]},zo={isValidating:!0};H(I().data)&&(zo.isLoading=!0);try{if(J&&(V(zo),t.loadingTimeout&&H(I().data)&&setTimeout(()=>{ae&&ne()&&E().onLoadingSlow(x,t)},t.loadingTimeout),p[x]=[B(S),Zn()]),[Q,K]=p[x],Q=await Q,J&&setTimeout(Go,t.dedupingInterval),!p[x]||p[x][1]!==K)return J&&ne()&&E().onDiscarded(x),!1;Pe.error=oe;const fe=v[x];if(!H(fe)&&(K<=fe[0]||K<=fe[1]||fe[1]===0))return Ho(),J&&ne()&&E().onDiscarded(x),!1;const Ne=I().data;Pe.data=r(Ne,Q)?Ne:Q,J&&ne()&&E().onSuccess(Q,x,t)}catch(fe){Go();const Ne=E(),{shouldRetryOnError:hn}=Ne;Ne.isPaused()||(Pe.error=fe,J&&ne()&&(Ne.onError(fe,x,Ne),(hn===!0||Ce(hn)&&hn(fe))&&(!E().revalidateOnFocus||!E().revalidateOnReconnect||$())&&Ne.onErrorRetry(fe,x,Ne,Hi=>{const vn=c[x];vn&&vn[0]&&vn[0](Wo,Hi)},{retryCount:(He.retryCount||0)+1,dedupe:!0})))}return ae=!1,Ho(),!0},[x,o]),vt=h.useCallback((...z)=>Dr(o,R.current,...z),[]);if(Cn(()=>{M.current=n,b.current=t,H(W)||(_e.current=W)}),Cn(()=>{if(!x)return;const z=me.bind(oe,Mn);let B=0;E().revalidateOnFocus&&(B=Date.now()+E().focusThrottleInterval);const K=Ra(x,c,(ae,He={})=>{if(ae==Nr){const J=Date.now();E().revalidateOnFocus&&J>B&&$()&&(B=J+E().focusThrottleInterval,z())}else if(ae==Ar)E().revalidateOnReconnect&&$()&&z();else{if(ae==Fr)return me();if(ae==Wo)return me(He)}});return y.current=!1,R.current=x,C.current=!0,V({_k:S}),we&&(H(Y)||yt?z():ia(z)),()=>{y.current=!0,K()}},[x]),Cn(()=>{let z;function B(){const K=Ce(f)?f(I().data):f;K&&z!==-1&&(z=setTimeout(Q,K))}function Q(){!I().error&&(g||E().isVisible())&&(m||E().isOnline())?me(Mn).then(B):B()}return B(),()=>{z&&(clearTimeout(z),z=-1)}},[f,g,m,x]),h.useDebugValue(je),s&&H(Y)&&x){if(!qo&&yt)throw new Error("Fallback data is required when using Suspense in SSR.");M.current=n,b.current=t,y.current=!1;const z=w[x];if(!H(z)){const B=vt(z);bn(B)}if(H(xe)){const B=me(Mn);H(je)||(B.status="fulfilled",B.value=!0),bn(B)}else throw xe}return{mutate:vt,get data(){return L.data=!0,je},get error(){return L.error=!0,xe},get isValidating(){return L.isValidating=!0,Je},get isLoading(){return L.isLoading=!0,ie}}},St=ya(ba);function nt(e,n=[]){let t=[];function o(s,i){const l=h.createContext(i),u=t.length;t=[...t,i];const f=m=>{var x;const{scope:d,children:c,...v}=m,p=((x=d==null?void 0:d[e])==null?void 0:x[u])||l,w=h.useMemo(()=>v,Object.values(v));return a.jsx(p.Provider,{value:w,children:c})};f.displayName=s+"Provider";function g(m,d){var p;const c=((p=d==null?void 0:d[e])==null?void 0:p[u])||l,v=h.useContext(c);if(v)return v;if(i!==void 0)return i;throw new Error(`\`${m}\` must be used within \`${s}\``)}return[f,g]}const r=()=>{const s=t.map(i=>h.createContext(i));return function(l){const u=(l==null?void 0:l[e])||s;return h.useMemo(()=>({[`__scope${e}`]:{...l,[e]:u}}),[l,u])}};return r.scopeName=e,[o,Ma(r,...n)]}function Ma(...e){const n=e[0];if(e.length===1)return n;const t=()=>{const o=e.map(r=>({useScope:r(),scopeName:r.scopeName}));return function(s){const i=o.reduce((l,{useScope:u,scopeName:f})=>{const m=u(s)[`__scope${f}`];return{...l,...m}},{});return h.useMemo(()=>({[`__scope${n.scopeName}`]:i}),[i])}};return t.scopeName=n.scopeName,t}function k(e,n,{checkForDefaultPrevented:t=!0}={}){return function(r){if(e==null||e(r),t===!1||!r.defaultPrevented)return n==null?void 0:n(r)}}var Ke=globalThis!=null&&globalThis.document?h.useLayoutEffect:()=>{},Ea=Er[" useInsertionEffect ".trim().toString()]||Ke;function tn({prop:e,defaultProp:n,onChange:t=()=>{},caller:o}){const[r,s,i]=_a({defaultProp:n,onChange:t}),l=e!==void 0,u=l?e:r;{const g=h.useRef(e!==void 0);h.useEffect(()=>{const m=g.current;m!==l&&console.warn(`${o} is changing from ${m?"controlled":"uncontrolled"} to ${l?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),g.current=l},[l,o])}const f=h.useCallback(g=>{var m;if(l){const d=ja(g)?g(e):g;d!==e&&((m=i.current)==null||m.call(i,d))}else s(g)},[l,e,s,i]);return[u,f]}function _a({defaultProp:e,onChange:n}){const[t,o]=h.useState(e),r=h.useRef(t),s=h.useRef(n);return Ea(()=>{s.current=n},[n]),h.useEffect(()=>{var i;r.current!==t&&((i=s.current)==null||i.call(s,t),r.current=t)},[t,r]),[t,o,s]}function ja(e){return typeof e=="function"}function Pa(e){const n=h.useRef({value:e,previous:e});return h.useMemo(()=>(n.current.value!==e&&(n.current.previous=n.current.value,n.current.value=e),n.current.previous),[e])}function kr(e){const[n,t]=h.useState(void 0);return Ke(()=>{if(e){t({width:e.offsetWidth,height:e.offsetHeight});const o=new ResizeObserver(r=>{if(!Array.isArray(r)||!r.length)return;const s=r[0];let i,l;if("borderBoxSize"in s){const u=s.borderBoxSize,f=Array.isArray(u)?u[0]:u;i=f.inlineSize,l=f.blockSize}else i=e.offsetWidth,l=e.offsetHeight;t({width:i,height:l})});return o.observe(e,{box:"border-box"}),()=>o.unobserve(e)}else t(void 0)},[e]),n}function Na(e,n){return h.useReducer((t,o)=>n[t][o]??t,e)}var ot=e=>{const{present:n,children:t}=e,o=Aa(n),r=typeof t=="function"?t({present:o.isPresent}):h.Children.only(t),s=te(o.ref,Fa(r));return typeof t=="function"||o.isPresent?h.cloneElement(r,{ref:s}):null};ot.displayName="Presence";function Aa(e){const[n,t]=h.useState(),o=h.useRef(null),r=h.useRef(e),s=h.useRef("none"),i=e?"mounted":"unmounted",[l,u]=Na(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return h.useEffect(()=>{const f=It(o.current);s.current=l==="mounted"?f:"none"},[l]),Ke(()=>{const f=o.current,g=r.current;if(g!==e){const d=s.current,c=It(f);e?u("MOUNT"):c==="none"||(f==null?void 0:f.display)==="none"?u("UNMOUNT"):u(g&&d!==c?"ANIMATION_OUT":"UNMOUNT"),r.current=e}},[e,u]),Ke(()=>{if(n){let f;const g=n.ownerDocument.defaultView??window,m=c=>{const p=It(o.current).includes(c.animationName);if(c.target===n&&p&&(u("ANIMATION_END"),!r.current)){const w=n.style.animationFillMode;n.style.animationFillMode="forwards",f=g.setTimeout(()=>{n.style.animationFillMode==="forwards"&&(n.style.animationFillMode=w)})}},d=c=>{c.target===n&&(s.current=It(o.current))};return n.addEventListener("animationstart",d),n.addEventListener("animationcancel",m),n.addEventListener("animationend",m),()=>{g.clearTimeout(f),n.removeEventListener("animationstart",d),n.removeEventListener("animationcancel",m),n.removeEventListener("animationend",m)}}else u("ANIMATION_END")},[n,u]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:h.useCallback(f=>{o.current=f?getComputedStyle(f):null,t(f)},[])}}function It(e){return(e==null?void 0:e.animationName)||"none"}function Fa(e){var o,r;let n=(o=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:o.get,t=n&&"isReactWarning"in n&&n.isReactWarning;return t?e.ref:(n=(r=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:r.get,t=n&&"isReactWarning"in n&&n.isReactWarning,t?e.props.ref:e.props.ref||e.ref)}var nn="Checkbox",[Ta,Pg]=nt(nn),[Ia,po]=Ta(nn);function Da(e){const{__scopeCheckbox:n,checked:t,children:o,defaultChecked:r,disabled:s,form:i,name:l,onCheckedChange:u,required:f,value:g="on",internal_do_not_use_render:m}=e,[d,c]=tn({prop:t,defaultProp:r??!1,onChange:u,caller:nn}),[v,p]=h.useState(null),[w,x]=h.useState(null),S=h.useRef(!1),C=v?!!i||!!v.closest("form"):!0,y={checked:d,disabled:s,setChecked:c,control:v,setControl:p,name:l,form:i,value:g,hasConsumerStoppedPropagationRef:S,required:f,defaultChecked:Ue(r)?!1:r,isFormControl:C,bubbleInput:w,setBubbleInput:x};return a.jsx(Ia,{scope:n,...y,children:$a(m)?m(y):o})}var Lr="CheckboxTrigger",Vr=h.forwardRef(({__scopeCheckbox:e,onKeyDown:n,onClick:t,...o},r)=>{const{control:s,value:i,disabled:l,checked:u,required:f,setControl:g,setChecked:m,hasConsumerStoppedPropagationRef:d,isFormControl:c,bubbleInput:v}=po(Lr,e),p=te(r,g),w=h.useRef(u);return h.useEffect(()=>{const x=s==null?void 0:s.form;if(x){const S=()=>m(w.current);return x.addEventListener("reset",S),()=>x.removeEventListener("reset",S)}},[s,m]),a.jsx(X.button,{type:"button",role:"checkbox","aria-checked":Ue(u)?"mixed":u,"aria-required":f,"data-state":Wr(u),"data-disabled":l?"":void 0,disabled:l,value:i,...o,ref:p,onKeyDown:k(n,x=>{x.key==="Enter"&&x.preventDefault()}),onClick:k(t,x=>{m(S=>Ue(S)?!0:!S),v&&c&&(d.current=x.isPropagationStopped(),d.current||x.stopPropagation())})})});Vr.displayName=Lr;var Hr=h.forwardRef((e,n)=>{const{__scopeCheckbox:t,name:o,checked:r,defaultChecked:s,required:i,disabled:l,value:u,onCheckedChange:f,form:g,...m}=e;return a.jsx(Da,{__scopeCheckbox:t,checked:r,defaultChecked:s,disabled:l,required:i,onCheckedChange:f,name:o,form:g,value:u,internal_do_not_use_render:({isFormControl:d})=>a.jsxs(a.Fragment,{children:[a.jsx(Vr,{...m,ref:n,__scopeCheckbox:t}),d&&a.jsx(Ur,{__scopeCheckbox:t})]})})});Hr.displayName=nn;var Gr="CheckboxIndicator",zr=h.forwardRef((e,n)=>{const{__scopeCheckbox:t,forceMount:o,...r}=e,s=po(Gr,t);return a.jsx(ot,{present:o||Ue(s.checked)||s.checked===!0,children:a.jsx(X.span,{"data-state":Wr(s.checked),"data-disabled":s.disabled?"":void 0,...r,ref:n,style:{pointerEvents:"none",...e.style}})})});zr.displayName=Gr;var Br="CheckboxBubbleInput",Ur=h.forwardRef(({__scopeCheckbox:e,...n},t)=>{const{control:o,hasConsumerStoppedPropagationRef:r,checked:s,defaultChecked:i,required:l,disabled:u,name:f,value:g,form:m,bubbleInput:d,setBubbleInput:c}=po(Br,e),v=te(t,c),p=Pa(s),w=kr(o);h.useEffect(()=>{const S=d;if(!S)return;const C=window.HTMLInputElement.prototype,R=Object.getOwnPropertyDescriptor(C,"checked").set,M=!r.current;if(p!==s&&R){const b=new Event("click",{bubbles:M});S.indeterminate=Ue(s),R.call(S,Ue(s)?!1:s),S.dispatchEvent(b)}},[d,p,s,r]);const x=h.useRef(Ue(s)?!1:s);return a.jsx(X.input,{type:"checkbox","aria-hidden":!0,defaultChecked:i??x.current,required:l,disabled:u,name:f,value:g,form:m,...n,tabIndex:-1,ref:v,style:{...n.style,...w,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});Ur.displayName=Br;function $a(e){return typeof e=="function"}function Ue(e){return e==="indeterminate"}function Wr(e){return Ue(e)?"indeterminate":e?"checked":"unchecked"}/**
10
- * @license lucide-react v0.507.0 - ISC
11
- *
12
- * This source code is licensed under the ISC license.
13
- * See the LICENSE file in the root directory of this source tree.
14
- */const Oa=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],ka=Ve("activity",Oa);/**
15
- * @license lucide-react v0.507.0 - ISC
16
- *
17
- * This source code is licensed under the ISC license.
18
- * See the LICENSE file in the root directory of this source tree.
19
- */const La=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Kr=Ve("check",La);/**
20
- * @license lucide-react v0.507.0 - ISC
21
- *
22
- * This source code is licensed under the ISC license.
23
- * See the LICENSE file in the root directory of this source tree.
24
- */const Va=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],qr=Ve("chevron-down",Va);/**
25
- * @license lucide-react v0.507.0 - ISC
26
- *
27
- * This source code is licensed under the ISC license.
28
- * See the LICENSE file in the root directory of this source tree.
29
- */const Ha=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],Ga=Ve("chevron-up",Ha);/**
30
- * @license lucide-react v0.507.0 - ISC
31
- *
32
- * This source code is licensed under the ISC license.
33
- * See the LICENSE file in the root directory of this source tree.
34
- */const za=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]],Ba=Ve("clock",za);/**
35
- * @license lucide-react v0.507.0 - ISC
36
- *
37
- * This source code is licensed under the ISC license.
38
- * See the LICENSE file in the root directory of this source tree.
39
- */const Ua=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],Wa=Ve("globe",Ua);/**
40
- * @license lucide-react v0.507.0 - ISC
41
- *
42
- * This source code is licensed under the ISC license.
43
- * See the LICENSE file in the root directory of this source tree.
44
- */const Ka=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],Xr=Ve("triangle-alert",Ka);/**
45
- * @license lucide-react v0.507.0 - ISC
46
- *
47
- * This source code is licensed under the ISC license.
48
- * See the LICENSE file in the root directory of this source tree.
49
- */const qa=[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],Yr=Ve("wifi-off",qa);/**
50
- * @license lucide-react v0.507.0 - ISC
51
- *
52
- * This source code is licensed under the ISC license.
53
- * See the LICENSE file in the root directory of this source tree.
54
- */const Xa=[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]],Jr=Ve("wifi",Xa);function ho({className:e,...n}){return a.jsx(Hr,{"data-slot":"checkbox",className:Z("peer border-input dark:bg-input/30 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-[4px] border shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",e),...n,children:a.jsx(zr,{"data-slot":"checkbox-indicator",className:"flex items-center justify-center text-current transition-none",children:a.jsx(Kr,{className:"size-3.5"})})})}function Ya({id:e,label:n,description:t,isEnabled:o,onToggle:r}){return a.jsx("div",{children:a.jsxs("div",{className:"items-top flex space-x-2",children:[a.jsx(ho,{id:e,checked:o,onCheckedChange:s=>r(s===!0)}),a.jsxs("div",{className:"grid gap-1.5 leading-none",children:[a.jsx("label",{htmlFor:e,className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:n}),a.jsx("p",{className:"text-sm text-muted-foreground",children:t})]})]})})}function Jo({title:e,description:n,tools:t,onToolToggle:o}){return a.jsxs(Te,{className:"w-full",children:[a.jsxs(Ie,{children:[a.jsx(De,{children:e}),a.jsx(tt,{children:n})]}),a.jsx($e,{children:a.jsx("div",{className:"grid grid-cols-2 gap-6 mb-6",children:Object.entries(t).map(([r,s])=>a.jsx(Ya,{id:s.id,label:s.label,description:s.description,isEnabled:s.settings.enabled,onToggle:i=>{o(r,i)}},r))})})]})}function Qn({className:e,type:n,...t}){return a.jsx("input",{type:n,"data-slot":"input",className:Z("file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input flex h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm","focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",e),...t})}var Ja="Label",Zr=h.forwardRef((e,n)=>a.jsx(X.label,{...e,ref:n,onMouseDown:t=>{var r;t.target.closest("button, input, select, textarea")||((r=e.onMouseDown)==null||r.call(e,t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));Zr.displayName=Ja;var Za=Zr;function Qa({className:e,...n}){return a.jsx(Za,{"data-slot":"label",className:Z("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",e),...n})}function el({spaceNames:e,spaceSubdomains:n,enabledSpaces:t,onSpaceToolToggle:o,onSpaceToolNameChange:r,onSpaceToolSubdomainChange:s}){const i=[0,1,2];return a.jsxs(Te,{className:"w-full",children:[a.jsxs(Ie,{children:[a.jsx(De,{children:"🚀 Gradio Spaces"}),a.jsxs(tt,{children:["Configure up to 3 Gradio spaces for remote tool access. Edit the name and subdomain fields.",a.jsx("span",{className:"font-semibold",children:" Note: Changes may require reconnecting your MCP client."})]})]}),a.jsx($e,{children:a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center space-x-3 pb-2 border-b",children:[a.jsx("div",{className:"w-6"})," ",a.jsx("div",{className:"text-sm font-medium min-w-[80px]",children:"Space"}),a.jsx("div",{className:"flex-1 text-sm font-medium",children:"Name"}),a.jsx("div",{className:"flex-1 text-sm font-medium",children:"Subdomain"})]}),i.map(l=>a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx(ho,{id:`space-tool-${l}`,checked:t[l]||!1,onCheckedChange:u=>o(l,u===!0)}),a.jsx(Qa,{htmlFor:`space-tool-${l}`,className:"text-sm font-medium min-w-[80px]",children:l+1}),a.jsx(Qn,{placeholder:"username/space-name",value:e[l]||"",onChange:u=>r(l,u.target.value),className:"flex-1 text-sm"}),a.jsx(Qn,{placeholder:"username-space-name",value:n[l]||"",onChange:u=>s(l,u.target.value),className:"flex-1 text-sm"})]},l))]})})]})}const tl=_r("relative w-full rounded-lg border px-4 py-3 text-sm grid has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] grid-cols-[0_1fr] has-[>svg]:gap-x-3 gap-y-0.5 items-start [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current",{variants:{variant:{default:"bg-card text-card-foreground",destructive:"text-destructive bg-card [&>svg]:text-current *:data-[slot=alert-description]:text-destructive/90"}},defaultVariants:{variant:"default"}});function nl({className:e,variant:n,...t}){return a.jsx("div",{"data-slot":"alert",role:"alert",className:Z(tl({variant:n}),e),...t})}function ol({className:e,...n}){return a.jsx("div",{"data-slot":"alert-title",className:Z("col-start-2 line-clamp-1 min-h-4 font-medium tracking-tight",e),...n})}function rl({className:e,...n}){return a.jsx("div",{"data-slot":"alert-description",className:Z("text-muted-foreground col-start-2 grid justify-items-start gap-1 text-sm [&_p]:leading-relaxed",e),...n})}const sl=_r("inline-flex items-center justify-center rounded-md border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",secondary:"border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",destructive:"border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground",success:"border-transparent bg-green-100 text-green-800 [a&]:hover:bg-green-100/90"}},defaultVariants:{variant:"default"}});function Ze({className:e,variant:n,asChild:t=!1,...o}){const r=t?zi:"span";return a.jsx(r,{"data-slot":"badge",className:Z(sl({variant:n}),e),...o})}/**
55
- * table-core
56
- *
57
- * Copyright (c) TanStack
58
- *
59
- * This source code is licensed under the MIT license found in the
60
- * LICENSE.md file in the root directory of this source tree.
61
- *
62
- * @license MIT
63
- */function Be(e,n){return typeof e=="function"?e(n):e}function ue(e,n){return t=>{n.setState(o=>({...o,[e]:Be(t,o[e])}))}}function on(e){return e instanceof Function}function il(e){return Array.isArray(e)&&e.every(n=>typeof n=="number")}function al(e,n){const t=[],o=r=>{r.forEach(s=>{t.push(s);const i=n(s);i!=null&&i.length&&o(i)})};return o(e),t}function A(e,n,t){let o=[],r;return s=>{let i;t.key&&t.debug&&(i=Date.now());const l=e(s);if(!(l.length!==o.length||l.some((g,m)=>o[m]!==g)))return r;o=l;let f;if(t.key&&t.debug&&(f=Date.now()),r=n(...l),t==null||t.onChange==null||t.onChange(r),t.key&&t.debug&&t!=null&&t.debug()){const g=Math.round((Date.now()-i)*100)/100,m=Math.round((Date.now()-f)*100)/100,d=m/16,c=(v,p)=>{for(v=String(v);v.length<p;)v=" "+v;return v};console.info(`%c⏱ ${c(m,5)} /${c(g,5)} ms`,`
64
- font-size: .6rem;
65
- font-weight: bold;
66
- color: hsl(${Math.max(0,Math.min(120-120*d,120))}deg 100% 31%);`,t==null?void 0:t.key)}return r}}function F(e,n,t,o){return{debug:()=>{var r;return(r=e==null?void 0:e.debugAll)!=null?r:e[n]},key:!1,onChange:o}}function ll(e,n,t,o){const r=()=>{var i;return(i=s.getValue())!=null?i:e.options.renderFallbackValue},s={id:`${n.id}_${t.id}`,row:n,column:t,getValue:()=>n.getValue(o),renderValue:r,getContext:A(()=>[e,t,n,s],(i,l,u,f)=>({table:i,column:l,row:u,cell:f,getValue:f.getValue,renderValue:f.renderValue}),F(e.options,"debugCells"))};return e._features.forEach(i=>{i.createCell==null||i.createCell(s,t,n,e)},{}),s}function cl(e,n,t,o){var r,s;const l={...e._getDefaultColumnDef(),...n},u=l.accessorKey;let f=(r=(s=l.id)!=null?s:u?typeof String.prototype.replaceAll=="function"?u.replaceAll(".","_"):u.replace(/\./g,"_"):void 0)!=null?r:typeof l.header=="string"?l.header:void 0,g;if(l.accessorFn?g=l.accessorFn:u&&(u.includes(".")?g=d=>{let c=d;for(const p of u.split(".")){var v;c=(v=c)==null?void 0:v[p]}return c}:g=d=>d[l.accessorKey]),!f)throw new Error;let m={id:`${String(f)}`,accessorFn:g,parent:o,depth:t,columnDef:l,columns:[],getFlatColumns:A(()=>[!0],()=>{var d;return[m,...(d=m.columns)==null?void 0:d.flatMap(c=>c.getFlatColumns())]},F(e.options,"debugColumns")),getLeafColumns:A(()=>[e._getOrderColumnsFn()],d=>{var c;if((c=m.columns)!=null&&c.length){let v=m.columns.flatMap(p=>p.getLeafColumns());return d(v)}return[m]},F(e.options,"debugColumns"))};for(const d of e._features)d.createColumn==null||d.createColumn(m,e);return m}const ee="debugHeaders";function Zo(e,n,t){var o;let s={id:(o=t.id)!=null?o:n.id,column:n,index:t.index,isPlaceholder:!!t.isPlaceholder,placeholderId:t.placeholderId,depth:t.depth,subHeaders:[],colSpan:0,rowSpan:0,headerGroup:null,getLeafHeaders:()=>{const i=[],l=u=>{u.subHeaders&&u.subHeaders.length&&u.subHeaders.map(l),i.push(u)};return l(s),i},getContext:()=>({table:e,header:s,column:n})};return e._features.forEach(i=>{i.createHeader==null||i.createHeader(s,e)}),s}const ul={createTable:e=>{e.getHeaderGroups=A(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(n,t,o,r)=>{var s,i;const l=(s=o==null?void 0:o.map(m=>t.find(d=>d.id===m)).filter(Boolean))!=null?s:[],u=(i=r==null?void 0:r.map(m=>t.find(d=>d.id===m)).filter(Boolean))!=null?i:[],f=t.filter(m=>!(o!=null&&o.includes(m.id))&&!(r!=null&&r.includes(m.id)));return Dt(n,[...l,...f,...u],e)},F(e.options,ee)),e.getCenterHeaderGroups=A(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(n,t,o,r)=>(t=t.filter(s=>!(o!=null&&o.includes(s.id))&&!(r!=null&&r.includes(s.id))),Dt(n,t,e,"center")),F(e.options,ee)),e.getLeftHeaderGroups=A(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left],(n,t,o)=>{var r;const s=(r=o==null?void 0:o.map(i=>t.find(l=>l.id===i)).filter(Boolean))!=null?r:[];return Dt(n,s,e,"left")},F(e.options,ee)),e.getRightHeaderGroups=A(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.right],(n,t,o)=>{var r;const s=(r=o==null?void 0:o.map(i=>t.find(l=>l.id===i)).filter(Boolean))!=null?r:[];return Dt(n,s,e,"right")},F(e.options,ee)),e.getFooterGroups=A(()=>[e.getHeaderGroups()],n=>[...n].reverse(),F(e.options,ee)),e.getLeftFooterGroups=A(()=>[e.getLeftHeaderGroups()],n=>[...n].reverse(),F(e.options,ee)),e.getCenterFooterGroups=A(()=>[e.getCenterHeaderGroups()],n=>[...n].reverse(),F(e.options,ee)),e.getRightFooterGroups=A(()=>[e.getRightHeaderGroups()],n=>[...n].reverse(),F(e.options,ee)),e.getFlatHeaders=A(()=>[e.getHeaderGroups()],n=>n.map(t=>t.headers).flat(),F(e.options,ee)),e.getLeftFlatHeaders=A(()=>[e.getLeftHeaderGroups()],n=>n.map(t=>t.headers).flat(),F(e.options,ee)),e.getCenterFlatHeaders=A(()=>[e.getCenterHeaderGroups()],n=>n.map(t=>t.headers).flat(),F(e.options,ee)),e.getRightFlatHeaders=A(()=>[e.getRightHeaderGroups()],n=>n.map(t=>t.headers).flat(),F(e.options,ee)),e.getCenterLeafHeaders=A(()=>[e.getCenterFlatHeaders()],n=>n.filter(t=>{var o;return!((o=t.subHeaders)!=null&&o.length)}),F(e.options,ee)),e.getLeftLeafHeaders=A(()=>[e.getLeftFlatHeaders()],n=>n.filter(t=>{var o;return!((o=t.subHeaders)!=null&&o.length)}),F(e.options,ee)),e.getRightLeafHeaders=A(()=>[e.getRightFlatHeaders()],n=>n.filter(t=>{var o;return!((o=t.subHeaders)!=null&&o.length)}),F(e.options,ee)),e.getLeafHeaders=A(()=>[e.getLeftHeaderGroups(),e.getCenterHeaderGroups(),e.getRightHeaderGroups()],(n,t,o)=>{var r,s,i,l,u,f;return[...(r=(s=n[0])==null?void 0:s.headers)!=null?r:[],...(i=(l=t[0])==null?void 0:l.headers)!=null?i:[],...(u=(f=o[0])==null?void 0:f.headers)!=null?u:[]].map(g=>g.getLeafHeaders()).flat()},F(e.options,ee))}};function Dt(e,n,t,o){var r,s;let i=0;const l=function(d,c){c===void 0&&(c=1),i=Math.max(i,c),d.filter(v=>v.getIsVisible()).forEach(v=>{var p;(p=v.columns)!=null&&p.length&&l(v.columns,c+1)},0)};l(e);let u=[];const f=(d,c)=>{const v={depth:c,id:[o,`${c}`].filter(Boolean).join("_"),headers:[]},p=[];d.forEach(w=>{const x=[...p].reverse()[0],S=w.column.depth===v.depth;let C,y=!1;if(S&&w.column.parent?C=w.column.parent:(C=w.column,y=!0),x&&(x==null?void 0:x.column)===C)x.subHeaders.push(w);else{const R=Zo(t,C,{id:[o,c,C.id,w==null?void 0:w.id].filter(Boolean).join("_"),isPlaceholder:y,placeholderId:y?`${p.filter(M=>M.column===C).length}`:void 0,depth:c,index:p.length});R.subHeaders.push(w),p.push(R)}v.headers.push(w),w.headerGroup=v}),u.push(v),c>0&&f(p,c-1)},g=n.map((d,c)=>Zo(t,d,{depth:i,index:c}));f(g,i-1),u.reverse();const m=d=>d.filter(v=>v.column.getIsVisible()).map(v=>{let p=0,w=0,x=[0];v.subHeaders&&v.subHeaders.length?(x=[],m(v.subHeaders).forEach(C=>{let{colSpan:y,rowSpan:R}=C;p+=y,x.push(R)})):p=1;const S=Math.min(...x);return w=w+S,v.colSpan=p,v.rowSpan=w,{colSpan:p,rowSpan:w}});return m((r=(s=u[0])==null?void 0:s.headers)!=null?r:[]),u}const vo=(e,n,t,o,r,s,i)=>{let l={id:n,index:o,original:t,depth:r,parentId:i,_valuesCache:{},_uniqueValuesCache:{},getValue:u=>{if(l._valuesCache.hasOwnProperty(u))return l._valuesCache[u];const f=e.getColumn(u);if(f!=null&&f.accessorFn)return l._valuesCache[u]=f.accessorFn(l.original,o),l._valuesCache[u]},getUniqueValues:u=>{if(l._uniqueValuesCache.hasOwnProperty(u))return l._uniqueValuesCache[u];const f=e.getColumn(u);if(f!=null&&f.accessorFn)return f.columnDef.getUniqueValues?(l._uniqueValuesCache[u]=f.columnDef.getUniqueValues(l.original,o),l._uniqueValuesCache[u]):(l._uniqueValuesCache[u]=[l.getValue(u)],l._uniqueValuesCache[u])},renderValue:u=>{var f;return(f=l.getValue(u))!=null?f:e.options.renderFallbackValue},subRows:[],getLeafRows:()=>al(l.subRows,u=>u.subRows),getParentRow:()=>l.parentId?e.getRow(l.parentId,!0):void 0,getParentRows:()=>{let u=[],f=l;for(;;){const g=f.getParentRow();if(!g)break;u.push(g),f=g}return u.reverse()},getAllCells:A(()=>[e.getAllLeafColumns()],u=>u.map(f=>ll(e,l,f,f.id)),F(e.options,"debugRows")),_getAllCellsByColumnId:A(()=>[l.getAllCells()],u=>u.reduce((f,g)=>(f[g.column.id]=g,f),{}),F(e.options,"debugRows"))};for(let u=0;u<e._features.length;u++){const f=e._features[u];f==null||f.createRow==null||f.createRow(l,e)}return l},dl={createColumn:(e,n)=>{e._getFacetedRowModel=n.options.getFacetedRowModel&&n.options.getFacetedRowModel(n,e.id),e.getFacetedRowModel=()=>e._getFacetedRowModel?e._getFacetedRowModel():n.getPreFilteredRowModel(),e._getFacetedUniqueValues=n.options.getFacetedUniqueValues&&n.options.getFacetedUniqueValues(n,e.id),e.getFacetedUniqueValues=()=>e._getFacetedUniqueValues?e._getFacetedUniqueValues():new Map,e._getFacetedMinMaxValues=n.options.getFacetedMinMaxValues&&n.options.getFacetedMinMaxValues(n,e.id),e.getFacetedMinMaxValues=()=>{if(e._getFacetedMinMaxValues)return e._getFacetedMinMaxValues()}}},Qr=(e,n,t)=>{var o,r;const s=t==null||(o=t.toString())==null?void 0:o.toLowerCase();return!!(!((r=e.getValue(n))==null||(r=r.toString())==null||(r=r.toLowerCase())==null)&&r.includes(s))};Qr.autoRemove=e=>pe(e);const es=(e,n,t)=>{var o;return!!(!((o=e.getValue(n))==null||(o=o.toString())==null)&&o.includes(t))};es.autoRemove=e=>pe(e);const ts=(e,n,t)=>{var o;return((o=e.getValue(n))==null||(o=o.toString())==null?void 0:o.toLowerCase())===(t==null?void 0:t.toLowerCase())};ts.autoRemove=e=>pe(e);const ns=(e,n,t)=>{var o;return(o=e.getValue(n))==null?void 0:o.includes(t)};ns.autoRemove=e=>pe(e);const os=(e,n,t)=>!t.some(o=>{var r;return!((r=e.getValue(n))!=null&&r.includes(o))});os.autoRemove=e=>pe(e)||!(e!=null&&e.length);const rs=(e,n,t)=>t.some(o=>{var r;return(r=e.getValue(n))==null?void 0:r.includes(o)});rs.autoRemove=e=>pe(e)||!(e!=null&&e.length);const ss=(e,n,t)=>e.getValue(n)===t;ss.autoRemove=e=>pe(e);const is=(e,n,t)=>e.getValue(n)==t;is.autoRemove=e=>pe(e);const xo=(e,n,t)=>{let[o,r]=t;const s=e.getValue(n);return s>=o&&s<=r};xo.resolveFilterValue=e=>{let[n,t]=e,o=typeof n!="number"?parseFloat(n):n,r=typeof t!="number"?parseFloat(t):t,s=n===null||Number.isNaN(o)?-1/0:o,i=t===null||Number.isNaN(r)?1/0:r;if(s>i){const l=s;s=i,i=l}return[s,i]};xo.autoRemove=e=>pe(e)||pe(e[0])&&pe(e[1]);const Ae={includesString:Qr,includesStringSensitive:es,equalsString:ts,arrIncludes:ns,arrIncludesAll:os,arrIncludesSome:rs,equals:ss,weakEquals:is,inNumberRange:xo};function pe(e){return e==null||e===""}const fl={getDefaultColumnDef:()=>({filterFn:"auto"}),getInitialState:e=>({columnFilters:[],...e}),getDefaultOptions:e=>({onColumnFiltersChange:ue("columnFilters",e),filterFromLeafRows:!1,maxLeafRowFilterDepth:100}),createColumn:(e,n)=>{e.getAutoFilterFn=()=>{const t=n.getCoreRowModel().flatRows[0],o=t==null?void 0:t.getValue(e.id);return typeof o=="string"?Ae.includesString:typeof o=="number"?Ae.inNumberRange:typeof o=="boolean"||o!==null&&typeof o=="object"?Ae.equals:Array.isArray(o)?Ae.arrIncludes:Ae.weakEquals},e.getFilterFn=()=>{var t,o;return on(e.columnDef.filterFn)?e.columnDef.filterFn:e.columnDef.filterFn==="auto"?e.getAutoFilterFn():(t=(o=n.options.filterFns)==null?void 0:o[e.columnDef.filterFn])!=null?t:Ae[e.columnDef.filterFn]},e.getCanFilter=()=>{var t,o,r;return((t=e.columnDef.enableColumnFilter)!=null?t:!0)&&((o=n.options.enableColumnFilters)!=null?o:!0)&&((r=n.options.enableFilters)!=null?r:!0)&&!!e.accessorFn},e.getIsFiltered=()=>e.getFilterIndex()>-1,e.getFilterValue=()=>{var t;return(t=n.getState().columnFilters)==null||(t=t.find(o=>o.id===e.id))==null?void 0:t.value},e.getFilterIndex=()=>{var t,o;return(t=(o=n.getState().columnFilters)==null?void 0:o.findIndex(r=>r.id===e.id))!=null?t:-1},e.setFilterValue=t=>{n.setColumnFilters(o=>{const r=e.getFilterFn(),s=o==null?void 0:o.find(g=>g.id===e.id),i=Be(t,s?s.value:void 0);if(Qo(r,i,e)){var l;return(l=o==null?void 0:o.filter(g=>g.id!==e.id))!=null?l:[]}const u={id:e.id,value:i};if(s){var f;return(f=o==null?void 0:o.map(g=>g.id===e.id?u:g))!=null?f:[]}return o!=null&&o.length?[...o,u]:[u]})}},createRow:(e,n)=>{e.columnFilters={},e.columnFiltersMeta={}},createTable:e=>{e.setColumnFilters=n=>{const t=e.getAllLeafColumns(),o=r=>{var s;return(s=Be(n,r))==null?void 0:s.filter(i=>{const l=t.find(u=>u.id===i.id);if(l){const u=l.getFilterFn();if(Qo(u,i.value,l))return!1}return!0})};e.options.onColumnFiltersChange==null||e.options.onColumnFiltersChange(o)},e.resetColumnFilters=n=>{var t,o;e.setColumnFilters(n?[]:(t=(o=e.initialState)==null?void 0:o.columnFilters)!=null?t:[])},e.getPreFilteredRowModel=()=>e.getCoreRowModel(),e.getFilteredRowModel=()=>(!e._getFilteredRowModel&&e.options.getFilteredRowModel&&(e._getFilteredRowModel=e.options.getFilteredRowModel(e)),e.options.manualFiltering||!e._getFilteredRowModel?e.getPreFilteredRowModel():e._getFilteredRowModel())}};function Qo(e,n,t){return(e&&e.autoRemove?e.autoRemove(n,t):!1)||typeof n>"u"||typeof n=="string"&&!n}const gl=(e,n,t)=>t.reduce((o,r)=>{const s=r.getValue(e);return o+(typeof s=="number"?s:0)},0),ml=(e,n,t)=>{let o;return t.forEach(r=>{const s=r.getValue(e);s!=null&&(o>s||o===void 0&&s>=s)&&(o=s)}),o},pl=(e,n,t)=>{let o;return t.forEach(r=>{const s=r.getValue(e);s!=null&&(o<s||o===void 0&&s>=s)&&(o=s)}),o},hl=(e,n,t)=>{let o,r;return t.forEach(s=>{const i=s.getValue(e);i!=null&&(o===void 0?i>=i&&(o=r=i):(o>i&&(o=i),r<i&&(r=i)))}),[o,r]},vl=(e,n)=>{let t=0,o=0;if(n.forEach(r=>{let s=r.getValue(e);s!=null&&(s=+s)>=s&&(++t,o+=s)}),t)return o/t},xl=(e,n)=>{if(!n.length)return;const t=n.map(s=>s.getValue(e));if(!il(t))return;if(t.length===1)return t[0];const o=Math.floor(t.length/2),r=t.sort((s,i)=>s-i);return t.length%2!==0?r[o]:(r[o-1]+r[o])/2},wl=(e,n)=>Array.from(new Set(n.map(t=>t.getValue(e))).values()),Sl=(e,n)=>new Set(n.map(t=>t.getValue(e))).size,Cl=(e,n)=>n.length,En={sum:gl,min:ml,max:pl,extent:hl,mean:vl,median:xl,unique:wl,uniqueCount:Sl,count:Cl},yl={getDefaultColumnDef:()=>({aggregatedCell:e=>{var n,t;return(n=(t=e.getValue())==null||t.toString==null?void 0:t.toString())!=null?n:null},aggregationFn:"auto"}),getInitialState:e=>({grouping:[],...e}),getDefaultOptions:e=>({onGroupingChange:ue("grouping",e),groupedColumnMode:"reorder"}),createColumn:(e,n)=>{e.toggleGrouping=()=>{n.setGrouping(t=>t!=null&&t.includes(e.id)?t.filter(o=>o!==e.id):[...t??[],e.id])},e.getCanGroup=()=>{var t,o;return((t=e.columnDef.enableGrouping)!=null?t:!0)&&((o=n.options.enableGrouping)!=null?o:!0)&&(!!e.accessorFn||!!e.columnDef.getGroupingValue)},e.getIsGrouped=()=>{var t;return(t=n.getState().grouping)==null?void 0:t.includes(e.id)},e.getGroupedIndex=()=>{var t;return(t=n.getState().grouping)==null?void 0:t.indexOf(e.id)},e.getToggleGroupingHandler=()=>{const t=e.getCanGroup();return()=>{t&&e.toggleGrouping()}},e.getAutoAggregationFn=()=>{const t=n.getCoreRowModel().flatRows[0],o=t==null?void 0:t.getValue(e.id);if(typeof o=="number")return En.sum;if(Object.prototype.toString.call(o)==="[object Date]")return En.extent},e.getAggregationFn=()=>{var t,o;if(!e)throw new Error;return on(e.columnDef.aggregationFn)?e.columnDef.aggregationFn:e.columnDef.aggregationFn==="auto"?e.getAutoAggregationFn():(t=(o=n.options.aggregationFns)==null?void 0:o[e.columnDef.aggregationFn])!=null?t:En[e.columnDef.aggregationFn]}},createTable:e=>{e.setGrouping=n=>e.options.onGroupingChange==null?void 0:e.options.onGroupingChange(n),e.resetGrouping=n=>{var t,o;e.setGrouping(n?[]:(t=(o=e.initialState)==null?void 0:o.grouping)!=null?t:[])},e.getPreGroupedRowModel=()=>e.getFilteredRowModel(),e.getGroupedRowModel=()=>(!e._getGroupedRowModel&&e.options.getGroupedRowModel&&(e._getGroupedRowModel=e.options.getGroupedRowModel(e)),e.options.manualGrouping||!e._getGroupedRowModel?e.getPreGroupedRowModel():e._getGroupedRowModel())},createRow:(e,n)=>{e.getIsGrouped=()=>!!e.groupingColumnId,e.getGroupingValue=t=>{if(e._groupingValuesCache.hasOwnProperty(t))return e._groupingValuesCache[t];const o=n.getColumn(t);return o!=null&&o.columnDef.getGroupingValue?(e._groupingValuesCache[t]=o.columnDef.getGroupingValue(e.original),e._groupingValuesCache[t]):e.getValue(t)},e._groupingValuesCache={}},createCell:(e,n,t,o)=>{e.getIsGrouped=()=>n.getIsGrouped()&&n.id===t.groupingColumnId,e.getIsPlaceholder=()=>!e.getIsGrouped()&&n.getIsGrouped(),e.getIsAggregated=()=>{var r;return!e.getIsGrouped()&&!e.getIsPlaceholder()&&!!((r=t.subRows)!=null&&r.length)}}};function Rl(e,n,t){if(!(n!=null&&n.length)||!t)return e;const o=e.filter(s=>!n.includes(s.id));return t==="remove"?o:[...n.map(s=>e.find(i=>i.id===s)).filter(Boolean),...o]}const bl={getInitialState:e=>({columnOrder:[],...e}),getDefaultOptions:e=>({onColumnOrderChange:ue("columnOrder",e)}),createColumn:(e,n)=>{e.getIndex=A(t=>[Ct(n,t)],t=>t.findIndex(o=>o.id===e.id),F(n.options,"debugColumns")),e.getIsFirstColumn=t=>{var o;return((o=Ct(n,t)[0])==null?void 0:o.id)===e.id},e.getIsLastColumn=t=>{var o;const r=Ct(n,t);return((o=r[r.length-1])==null?void 0:o.id)===e.id}},createTable:e=>{e.setColumnOrder=n=>e.options.onColumnOrderChange==null?void 0:e.options.onColumnOrderChange(n),e.resetColumnOrder=n=>{var t;e.setColumnOrder(n?[]:(t=e.initialState.columnOrder)!=null?t:[])},e._getOrderColumnsFn=A(()=>[e.getState().columnOrder,e.getState().grouping,e.options.groupedColumnMode],(n,t,o)=>r=>{let s=[];if(!(n!=null&&n.length))s=r;else{const i=[...n],l=[...r];for(;l.length&&i.length;){const u=i.shift(),f=l.findIndex(g=>g.id===u);f>-1&&s.push(l.splice(f,1)[0])}s=[...s,...l]}return Rl(s,t,o)},F(e.options,"debugTable"))}},_n=()=>({left:[],right:[]}),Ml={getInitialState:e=>({columnPinning:_n(),...e}),getDefaultOptions:e=>({onColumnPinningChange:ue("columnPinning",e)}),createColumn:(e,n)=>{e.pin=t=>{const o=e.getLeafColumns().map(r=>r.id).filter(Boolean);n.setColumnPinning(r=>{var s,i;if(t==="right"){var l,u;return{left:((l=r==null?void 0:r.left)!=null?l:[]).filter(m=>!(o!=null&&o.includes(m))),right:[...((u=r==null?void 0:r.right)!=null?u:[]).filter(m=>!(o!=null&&o.includes(m))),...o]}}if(t==="left"){var f,g;return{left:[...((f=r==null?void 0:r.left)!=null?f:[]).filter(m=>!(o!=null&&o.includes(m))),...o],right:((g=r==null?void 0:r.right)!=null?g:[]).filter(m=>!(o!=null&&o.includes(m)))}}return{left:((s=r==null?void 0:r.left)!=null?s:[]).filter(m=>!(o!=null&&o.includes(m))),right:((i=r==null?void 0:r.right)!=null?i:[]).filter(m=>!(o!=null&&o.includes(m)))}})},e.getCanPin=()=>e.getLeafColumns().some(o=>{var r,s,i;return((r=o.columnDef.enablePinning)!=null?r:!0)&&((s=(i=n.options.enableColumnPinning)!=null?i:n.options.enablePinning)!=null?s:!0)}),e.getIsPinned=()=>{const t=e.getLeafColumns().map(l=>l.id),{left:o,right:r}=n.getState().columnPinning,s=t.some(l=>o==null?void 0:o.includes(l)),i=t.some(l=>r==null?void 0:r.includes(l));return s?"left":i?"right":!1},e.getPinnedIndex=()=>{var t,o;const r=e.getIsPinned();return r?(t=(o=n.getState().columnPinning)==null||(o=o[r])==null?void 0:o.indexOf(e.id))!=null?t:-1:0}},createRow:(e,n)=>{e.getCenterVisibleCells=A(()=>[e._getAllVisibleCells(),n.getState().columnPinning.left,n.getState().columnPinning.right],(t,o,r)=>{const s=[...o??[],...r??[]];return t.filter(i=>!s.includes(i.column.id))},F(n.options,"debugRows")),e.getLeftVisibleCells=A(()=>[e._getAllVisibleCells(),n.getState().columnPinning.left],(t,o)=>(o??[]).map(s=>t.find(i=>i.column.id===s)).filter(Boolean).map(s=>({...s,position:"left"})),F(n.options,"debugRows")),e.getRightVisibleCells=A(()=>[e._getAllVisibleCells(),n.getState().columnPinning.right],(t,o)=>(o??[]).map(s=>t.find(i=>i.column.id===s)).filter(Boolean).map(s=>({...s,position:"right"})),F(n.options,"debugRows"))},createTable:e=>{e.setColumnPinning=n=>e.options.onColumnPinningChange==null?void 0:e.options.onColumnPinningChange(n),e.resetColumnPinning=n=>{var t,o;return e.setColumnPinning(n?_n():(t=(o=e.initialState)==null?void 0:o.columnPinning)!=null?t:_n())},e.getIsSomeColumnsPinned=n=>{var t;const o=e.getState().columnPinning;if(!n){var r,s;return!!((r=o.left)!=null&&r.length||(s=o.right)!=null&&s.length)}return!!((t=o[n])!=null&&t.length)},e.getLeftLeafColumns=A(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left],(n,t)=>(t??[]).map(o=>n.find(r=>r.id===o)).filter(Boolean),F(e.options,"debugColumns")),e.getRightLeafColumns=A(()=>[e.getAllLeafColumns(),e.getState().columnPinning.right],(n,t)=>(t??[]).map(o=>n.find(r=>r.id===o)).filter(Boolean),F(e.options,"debugColumns")),e.getCenterLeafColumns=A(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(n,t,o)=>{const r=[...t??[],...o??[]];return n.filter(s=>!r.includes(s.id))},F(e.options,"debugColumns"))}};function El(e){return e||(typeof document<"u"?document:null)}const $t={size:150,minSize:20,maxSize:Number.MAX_SAFE_INTEGER},jn=()=>({startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}),_l={getDefaultColumnDef:()=>$t,getInitialState:e=>({columnSizing:{},columnSizingInfo:jn(),...e}),getDefaultOptions:e=>({columnResizeMode:"onEnd",columnResizeDirection:"ltr",onColumnSizingChange:ue("columnSizing",e),onColumnSizingInfoChange:ue("columnSizingInfo",e)}),createColumn:(e,n)=>{e.getSize=()=>{var t,o,r;const s=n.getState().columnSizing[e.id];return Math.min(Math.max((t=e.columnDef.minSize)!=null?t:$t.minSize,(o=s??e.columnDef.size)!=null?o:$t.size),(r=e.columnDef.maxSize)!=null?r:$t.maxSize)},e.getStart=A(t=>[t,Ct(n,t),n.getState().columnSizing],(t,o)=>o.slice(0,e.getIndex(t)).reduce((r,s)=>r+s.getSize(),0),F(n.options,"debugColumns")),e.getAfter=A(t=>[t,Ct(n,t),n.getState().columnSizing],(t,o)=>o.slice(e.getIndex(t)+1).reduce((r,s)=>r+s.getSize(),0),F(n.options,"debugColumns")),e.resetSize=()=>{n.setColumnSizing(t=>{let{[e.id]:o,...r}=t;return r})},e.getCanResize=()=>{var t,o;return((t=e.columnDef.enableResizing)!=null?t:!0)&&((o=n.options.enableColumnResizing)!=null?o:!0)},e.getIsResizing=()=>n.getState().columnSizingInfo.isResizingColumn===e.id},createHeader:(e,n)=>{e.getSize=()=>{let t=0;const o=r=>{if(r.subHeaders.length)r.subHeaders.forEach(o);else{var s;t+=(s=r.column.getSize())!=null?s:0}};return o(e),t},e.getStart=()=>{if(e.index>0){const t=e.headerGroup.headers[e.index-1];return t.getStart()+t.getSize()}return 0},e.getResizeHandler=t=>{const o=n.getColumn(e.column.id),r=o==null?void 0:o.getCanResize();return s=>{if(!o||!r||(s.persist==null||s.persist(),Pn(s)&&s.touches&&s.touches.length>1))return;const i=e.getSize(),l=e?e.getLeafHeaders().map(x=>[x.column.id,x.column.getSize()]):[[o.id,o.getSize()]],u=Pn(s)?Math.round(s.touches[0].clientX):s.clientX,f={},g=(x,S)=>{typeof S=="number"&&(n.setColumnSizingInfo(C=>{var y,R;const M=n.options.columnResizeDirection==="rtl"?-1:1,b=(S-((y=C==null?void 0:C.startOffset)!=null?y:0))*M,E=Math.max(b/((R=C==null?void 0:C.startSize)!=null?R:0),-.999999);return C.columnSizingStart.forEach($=>{let[I,V]=$;f[I]=Math.round(Math.max(V+V*E,0)*100)/100}),{...C,deltaOffset:b,deltaPercentage:E}}),(n.options.columnResizeMode==="onChange"||x==="end")&&n.setColumnSizing(C=>({...C,...f})))},m=x=>g("move",x),d=x=>{g("end",x),n.setColumnSizingInfo(S=>({...S,isResizingColumn:!1,startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,columnSizingStart:[]}))},c=El(t),v={moveHandler:x=>m(x.clientX),upHandler:x=>{c==null||c.removeEventListener("mousemove",v.moveHandler),c==null||c.removeEventListener("mouseup",v.upHandler),d(x.clientX)}},p={moveHandler:x=>(x.cancelable&&(x.preventDefault(),x.stopPropagation()),m(x.touches[0].clientX),!1),upHandler:x=>{var S;c==null||c.removeEventListener("touchmove",p.moveHandler),c==null||c.removeEventListener("touchend",p.upHandler),x.cancelable&&(x.preventDefault(),x.stopPropagation()),d((S=x.touches[0])==null?void 0:S.clientX)}},w=jl()?{passive:!1}:!1;Pn(s)?(c==null||c.addEventListener("touchmove",p.moveHandler,w),c==null||c.addEventListener("touchend",p.upHandler,w)):(c==null||c.addEventListener("mousemove",v.moveHandler,w),c==null||c.addEventListener("mouseup",v.upHandler,w)),n.setColumnSizingInfo(x=>({...x,startOffset:u,startSize:i,deltaOffset:0,deltaPercentage:0,columnSizingStart:l,isResizingColumn:o.id}))}}},createTable:e=>{e.setColumnSizing=n=>e.options.onColumnSizingChange==null?void 0:e.options.onColumnSizingChange(n),e.setColumnSizingInfo=n=>e.options.onColumnSizingInfoChange==null?void 0:e.options.onColumnSizingInfoChange(n),e.resetColumnSizing=n=>{var t;e.setColumnSizing(n?{}:(t=e.initialState.columnSizing)!=null?t:{})},e.resetHeaderSizeInfo=n=>{var t;e.setColumnSizingInfo(n?jn():(t=e.initialState.columnSizingInfo)!=null?t:jn())},e.getTotalSize=()=>{var n,t;return(n=(t=e.getHeaderGroups()[0])==null?void 0:t.headers.reduce((o,r)=>o+r.getSize(),0))!=null?n:0},e.getLeftTotalSize=()=>{var n,t;return(n=(t=e.getLeftHeaderGroups()[0])==null?void 0:t.headers.reduce((o,r)=>o+r.getSize(),0))!=null?n:0},e.getCenterTotalSize=()=>{var n,t;return(n=(t=e.getCenterHeaderGroups()[0])==null?void 0:t.headers.reduce((o,r)=>o+r.getSize(),0))!=null?n:0},e.getRightTotalSize=()=>{var n,t;return(n=(t=e.getRightHeaderGroups()[0])==null?void 0:t.headers.reduce((o,r)=>o+r.getSize(),0))!=null?n:0}}};let Ot=null;function jl(){if(typeof Ot=="boolean")return Ot;let e=!1;try{const n={get passive(){return e=!0,!1}},t=()=>{};window.addEventListener("test",t,n),window.removeEventListener("test",t)}catch{e=!1}return Ot=e,Ot}function Pn(e){return e.type==="touchstart"}const Pl={getInitialState:e=>({columnVisibility:{},...e}),getDefaultOptions:e=>({onColumnVisibilityChange:ue("columnVisibility",e)}),createColumn:(e,n)=>{e.toggleVisibility=t=>{e.getCanHide()&&n.setColumnVisibility(o=>({...o,[e.id]:t??!e.getIsVisible()}))},e.getIsVisible=()=>{var t,o;const r=e.columns;return(t=r.length?r.some(s=>s.getIsVisible()):(o=n.getState().columnVisibility)==null?void 0:o[e.id])!=null?t:!0},e.getCanHide=()=>{var t,o;return((t=e.columnDef.enableHiding)!=null?t:!0)&&((o=n.options.enableHiding)!=null?o:!0)},e.getToggleVisibilityHandler=()=>t=>{e.toggleVisibility==null||e.toggleVisibility(t.target.checked)}},createRow:(e,n)=>{e._getAllVisibleCells=A(()=>[e.getAllCells(),n.getState().columnVisibility],t=>t.filter(o=>o.column.getIsVisible()),F(n.options,"debugRows")),e.getVisibleCells=A(()=>[e.getLeftVisibleCells(),e.getCenterVisibleCells(),e.getRightVisibleCells()],(t,o,r)=>[...t,...o,...r],F(n.options,"debugRows"))},createTable:e=>{const n=(t,o)=>A(()=>[o(),o().filter(r=>r.getIsVisible()).map(r=>r.id).join("_")],r=>r.filter(s=>s.getIsVisible==null?void 0:s.getIsVisible()),F(e.options,"debugColumns"));e.getVisibleFlatColumns=n("getVisibleFlatColumns",()=>e.getAllFlatColumns()),e.getVisibleLeafColumns=n("getVisibleLeafColumns",()=>e.getAllLeafColumns()),e.getLeftVisibleLeafColumns=n("getLeftVisibleLeafColumns",()=>e.getLeftLeafColumns()),e.getRightVisibleLeafColumns=n("getRightVisibleLeafColumns",()=>e.getRightLeafColumns()),e.getCenterVisibleLeafColumns=n("getCenterVisibleLeafColumns",()=>e.getCenterLeafColumns()),e.setColumnVisibility=t=>e.options.onColumnVisibilityChange==null?void 0:e.options.onColumnVisibilityChange(t),e.resetColumnVisibility=t=>{var o;e.setColumnVisibility(t?{}:(o=e.initialState.columnVisibility)!=null?o:{})},e.toggleAllColumnsVisible=t=>{var o;t=(o=t)!=null?o:!e.getIsAllColumnsVisible(),e.setColumnVisibility(e.getAllLeafColumns().reduce((r,s)=>({...r,[s.id]:t||!(s.getCanHide!=null&&s.getCanHide())}),{}))},e.getIsAllColumnsVisible=()=>!e.getAllLeafColumns().some(t=>!(t.getIsVisible!=null&&t.getIsVisible())),e.getIsSomeColumnsVisible=()=>e.getAllLeafColumns().some(t=>t.getIsVisible==null?void 0:t.getIsVisible()),e.getToggleAllColumnsVisibilityHandler=()=>t=>{var o;e.toggleAllColumnsVisible((o=t.target)==null?void 0:o.checked)}}};function Ct(e,n){return n?n==="center"?e.getCenterVisibleLeafColumns():n==="left"?e.getLeftVisibleLeafColumns():e.getRightVisibleLeafColumns():e.getVisibleLeafColumns()}const Nl={createTable:e=>{e._getGlobalFacetedRowModel=e.options.getFacetedRowModel&&e.options.getFacetedRowModel(e,"__global__"),e.getGlobalFacetedRowModel=()=>e.options.manualFiltering||!e._getGlobalFacetedRowModel?e.getPreFilteredRowModel():e._getGlobalFacetedRowModel(),e._getGlobalFacetedUniqueValues=e.options.getFacetedUniqueValues&&e.options.getFacetedUniqueValues(e,"__global__"),e.getGlobalFacetedUniqueValues=()=>e._getGlobalFacetedUniqueValues?e._getGlobalFacetedUniqueValues():new Map,e._getGlobalFacetedMinMaxValues=e.options.getFacetedMinMaxValues&&e.options.getFacetedMinMaxValues(e,"__global__"),e.getGlobalFacetedMinMaxValues=()=>{if(e._getGlobalFacetedMinMaxValues)return e._getGlobalFacetedMinMaxValues()}}},Al={getInitialState:e=>({globalFilter:void 0,...e}),getDefaultOptions:e=>({onGlobalFilterChange:ue("globalFilter",e),globalFilterFn:"auto",getColumnCanGlobalFilter:n=>{var t;const o=(t=e.getCoreRowModel().flatRows[0])==null||(t=t._getAllCellsByColumnId()[n.id])==null?void 0:t.getValue();return typeof o=="string"||typeof o=="number"}}),createColumn:(e,n)=>{e.getCanGlobalFilter=()=>{var t,o,r,s;return((t=e.columnDef.enableGlobalFilter)!=null?t:!0)&&((o=n.options.enableGlobalFilter)!=null?o:!0)&&((r=n.options.enableFilters)!=null?r:!0)&&((s=n.options.getColumnCanGlobalFilter==null?void 0:n.options.getColumnCanGlobalFilter(e))!=null?s:!0)&&!!e.accessorFn}},createTable:e=>{e.getGlobalAutoFilterFn=()=>Ae.includesString,e.getGlobalFilterFn=()=>{var n,t;const{globalFilterFn:o}=e.options;return on(o)?o:o==="auto"?e.getGlobalAutoFilterFn():(n=(t=e.options.filterFns)==null?void 0:t[o])!=null?n:Ae[o]},e.setGlobalFilter=n=>{e.options.onGlobalFilterChange==null||e.options.onGlobalFilterChange(n)},e.resetGlobalFilter=n=>{e.setGlobalFilter(n?void 0:e.initialState.globalFilter)}}},Fl={getInitialState:e=>({expanded:{},...e}),getDefaultOptions:e=>({onExpandedChange:ue("expanded",e),paginateExpandedRows:!0}),createTable:e=>{let n=!1,t=!1;e._autoResetExpanded=()=>{var o,r;if(!n){e._queue(()=>{n=!0});return}if((o=(r=e.options.autoResetAll)!=null?r:e.options.autoResetExpanded)!=null?o:!e.options.manualExpanding){if(t)return;t=!0,e._queue(()=>{e.resetExpanded(),t=!1})}},e.setExpanded=o=>e.options.onExpandedChange==null?void 0:e.options.onExpandedChange(o),e.toggleAllRowsExpanded=o=>{o??!e.getIsAllRowsExpanded()?e.setExpanded(!0):e.setExpanded({})},e.resetExpanded=o=>{var r,s;e.setExpanded(o?{}:(r=(s=e.initialState)==null?void 0:s.expanded)!=null?r:{})},e.getCanSomeRowsExpand=()=>e.getPrePaginationRowModel().flatRows.some(o=>o.getCanExpand()),e.getToggleAllRowsExpandedHandler=()=>o=>{o.persist==null||o.persist(),e.toggleAllRowsExpanded()},e.getIsSomeRowsExpanded=()=>{const o=e.getState().expanded;return o===!0||Object.values(o).some(Boolean)},e.getIsAllRowsExpanded=()=>{const o=e.getState().expanded;return typeof o=="boolean"?o===!0:!(!Object.keys(o).length||e.getRowModel().flatRows.some(r=>!r.getIsExpanded()))},e.getExpandedDepth=()=>{let o=0;return(e.getState().expanded===!0?Object.keys(e.getRowModel().rowsById):Object.keys(e.getState().expanded)).forEach(s=>{const i=s.split(".");o=Math.max(o,i.length)}),o},e.getPreExpandedRowModel=()=>e.getSortedRowModel(),e.getExpandedRowModel=()=>(!e._getExpandedRowModel&&e.options.getExpandedRowModel&&(e._getExpandedRowModel=e.options.getExpandedRowModel(e)),e.options.manualExpanding||!e._getExpandedRowModel?e.getPreExpandedRowModel():e._getExpandedRowModel())},createRow:(e,n)=>{e.toggleExpanded=t=>{n.setExpanded(o=>{var r;const s=o===!0?!0:!!(o!=null&&o[e.id]);let i={};if(o===!0?Object.keys(n.getRowModel().rowsById).forEach(l=>{i[l]=!0}):i=o,t=(r=t)!=null?r:!s,!s&&t)return{...i,[e.id]:!0};if(s&&!t){const{[e.id]:l,...u}=i;return u}return o})},e.getIsExpanded=()=>{var t;const o=n.getState().expanded;return!!((t=n.options.getIsRowExpanded==null?void 0:n.options.getIsRowExpanded(e))!=null?t:o===!0||o!=null&&o[e.id])},e.getCanExpand=()=>{var t,o,r;return(t=n.options.getRowCanExpand==null?void 0:n.options.getRowCanExpand(e))!=null?t:((o=n.options.enableExpanding)!=null?o:!0)&&!!((r=e.subRows)!=null&&r.length)},e.getIsAllParentsExpanded=()=>{let t=!0,o=e;for(;t&&o.parentId;)o=n.getRow(o.parentId,!0),t=o.getIsExpanded();return t},e.getToggleExpandedHandler=()=>{const t=e.getCanExpand();return()=>{t&&e.toggleExpanded()}}}},eo=0,to=10,Nn=()=>({pageIndex:eo,pageSize:to}),Tl={getInitialState:e=>({...e,pagination:{...Nn(),...e==null?void 0:e.pagination}}),getDefaultOptions:e=>({onPaginationChange:ue("pagination",e)}),createTable:e=>{let n=!1,t=!1;e._autoResetPageIndex=()=>{var o,r;if(!n){e._queue(()=>{n=!0});return}if((o=(r=e.options.autoResetAll)!=null?r:e.options.autoResetPageIndex)!=null?o:!e.options.manualPagination){if(t)return;t=!0,e._queue(()=>{e.resetPageIndex(),t=!1})}},e.setPagination=o=>{const r=s=>Be(o,s);return e.options.onPaginationChange==null?void 0:e.options.onPaginationChange(r)},e.resetPagination=o=>{var r;e.setPagination(o?Nn():(r=e.initialState.pagination)!=null?r:Nn())},e.setPageIndex=o=>{e.setPagination(r=>{let s=Be(o,r.pageIndex);const i=typeof e.options.pageCount>"u"||e.options.pageCount===-1?Number.MAX_SAFE_INTEGER:e.options.pageCount-1;return s=Math.max(0,Math.min(s,i)),{...r,pageIndex:s}})},e.resetPageIndex=o=>{var r,s;e.setPageIndex(o?eo:(r=(s=e.initialState)==null||(s=s.pagination)==null?void 0:s.pageIndex)!=null?r:eo)},e.resetPageSize=o=>{var r,s;e.setPageSize(o?to:(r=(s=e.initialState)==null||(s=s.pagination)==null?void 0:s.pageSize)!=null?r:to)},e.setPageSize=o=>{e.setPagination(r=>{const s=Math.max(1,Be(o,r.pageSize)),i=r.pageSize*r.pageIndex,l=Math.floor(i/s);return{...r,pageIndex:l,pageSize:s}})},e.setPageCount=o=>e.setPagination(r=>{var s;let i=Be(o,(s=e.options.pageCount)!=null?s:-1);return typeof i=="number"&&(i=Math.max(-1,i)),{...r,pageCount:i}}),e.getPageOptions=A(()=>[e.getPageCount()],o=>{let r=[];return o&&o>0&&(r=[...new Array(o)].fill(null).map((s,i)=>i)),r},F(e.options,"debugTable")),e.getCanPreviousPage=()=>e.getState().pagination.pageIndex>0,e.getCanNextPage=()=>{const{pageIndex:o}=e.getState().pagination,r=e.getPageCount();return r===-1?!0:r===0?!1:o<r-1},e.previousPage=()=>e.setPageIndex(o=>o-1),e.nextPage=()=>e.setPageIndex(o=>o+1),e.firstPage=()=>e.setPageIndex(0),e.lastPage=()=>e.setPageIndex(e.getPageCount()-1),e.getPrePaginationRowModel=()=>e.getExpandedRowModel(),e.getPaginationRowModel=()=>(!e._getPaginationRowModel&&e.options.getPaginationRowModel&&(e._getPaginationRowModel=e.options.getPaginationRowModel(e)),e.options.manualPagination||!e._getPaginationRowModel?e.getPrePaginationRowModel():e._getPaginationRowModel()),e.getPageCount=()=>{var o;return(o=e.options.pageCount)!=null?o:Math.ceil(e.getRowCount()/e.getState().pagination.pageSize)},e.getRowCount=()=>{var o;return(o=e.options.rowCount)!=null?o:e.getPrePaginationRowModel().rows.length}}},An=()=>({top:[],bottom:[]}),Il={getInitialState:e=>({rowPinning:An(),...e}),getDefaultOptions:e=>({onRowPinningChange:ue("rowPinning",e)}),createRow:(e,n)=>{e.pin=(t,o,r)=>{const s=o?e.getLeafRows().map(u=>{let{id:f}=u;return f}):[],i=r?e.getParentRows().map(u=>{let{id:f}=u;return f}):[],l=new Set([...i,e.id,...s]);n.setRowPinning(u=>{var f,g;if(t==="bottom"){var m,d;return{top:((m=u==null?void 0:u.top)!=null?m:[]).filter(p=>!(l!=null&&l.has(p))),bottom:[...((d=u==null?void 0:u.bottom)!=null?d:[]).filter(p=>!(l!=null&&l.has(p))),...Array.from(l)]}}if(t==="top"){var c,v;return{top:[...((c=u==null?void 0:u.top)!=null?c:[]).filter(p=>!(l!=null&&l.has(p))),...Array.from(l)],bottom:((v=u==null?void 0:u.bottom)!=null?v:[]).filter(p=>!(l!=null&&l.has(p)))}}return{top:((f=u==null?void 0:u.top)!=null?f:[]).filter(p=>!(l!=null&&l.has(p))),bottom:((g=u==null?void 0:u.bottom)!=null?g:[]).filter(p=>!(l!=null&&l.has(p)))}})},e.getCanPin=()=>{var t;const{enableRowPinning:o,enablePinning:r}=n.options;return typeof o=="function"?o(e):(t=o??r)!=null?t:!0},e.getIsPinned=()=>{const t=[e.id],{top:o,bottom:r}=n.getState().rowPinning,s=t.some(l=>o==null?void 0:o.includes(l)),i=t.some(l=>r==null?void 0:r.includes(l));return s?"top":i?"bottom":!1},e.getPinnedIndex=()=>{var t,o;const r=e.getIsPinned();if(!r)return-1;const s=(t=r==="top"?n.getTopRows():n.getBottomRows())==null?void 0:t.map(i=>{let{id:l}=i;return l});return(o=s==null?void 0:s.indexOf(e.id))!=null?o:-1}},createTable:e=>{e.setRowPinning=n=>e.options.onRowPinningChange==null?void 0:e.options.onRowPinningChange(n),e.resetRowPinning=n=>{var t,o;return e.setRowPinning(n?An():(t=(o=e.initialState)==null?void 0:o.rowPinning)!=null?t:An())},e.getIsSomeRowsPinned=n=>{var t;const o=e.getState().rowPinning;if(!n){var r,s;return!!((r=o.top)!=null&&r.length||(s=o.bottom)!=null&&s.length)}return!!((t=o[n])!=null&&t.length)},e._getPinnedRows=(n,t,o)=>{var r;return((r=e.options.keepPinnedRows)==null||r?(t??[]).map(i=>{const l=e.getRow(i,!0);return l.getIsAllParentsExpanded()?l:null}):(t??[]).map(i=>n.find(l=>l.id===i))).filter(Boolean).map(i=>({...i,position:o}))},e.getTopRows=A(()=>[e.getRowModel().rows,e.getState().rowPinning.top],(n,t)=>e._getPinnedRows(n,t,"top"),F(e.options,"debugRows")),e.getBottomRows=A(()=>[e.getRowModel().rows,e.getState().rowPinning.bottom],(n,t)=>e._getPinnedRows(n,t,"bottom"),F(e.options,"debugRows")),e.getCenterRows=A(()=>[e.getRowModel().rows,e.getState().rowPinning.top,e.getState().rowPinning.bottom],(n,t,o)=>{const r=new Set([...t??[],...o??[]]);return n.filter(s=>!r.has(s.id))},F(e.options,"debugRows"))}},Dl={getInitialState:e=>({rowSelection:{},...e}),getDefaultOptions:e=>({onRowSelectionChange:ue("rowSelection",e),enableRowSelection:!0,enableMultiRowSelection:!0,enableSubRowSelection:!0}),createTable:e=>{e.setRowSelection=n=>e.options.onRowSelectionChange==null?void 0:e.options.onRowSelectionChange(n),e.resetRowSelection=n=>{var t;return e.setRowSelection(n?{}:(t=e.initialState.rowSelection)!=null?t:{})},e.toggleAllRowsSelected=n=>{e.setRowSelection(t=>{n=typeof n<"u"?n:!e.getIsAllRowsSelected();const o={...t},r=e.getPreGroupedRowModel().flatRows;return n?r.forEach(s=>{s.getCanSelect()&&(o[s.id]=!0)}):r.forEach(s=>{delete o[s.id]}),o})},e.toggleAllPageRowsSelected=n=>e.setRowSelection(t=>{const o=typeof n<"u"?n:!e.getIsAllPageRowsSelected(),r={...t};return e.getRowModel().rows.forEach(s=>{no(r,s.id,o,!0,e)}),r}),e.getPreSelectedRowModel=()=>e.getCoreRowModel(),e.getSelectedRowModel=A(()=>[e.getState().rowSelection,e.getCoreRowModel()],(n,t)=>Object.keys(n).length?Fn(e,t):{rows:[],flatRows:[],rowsById:{}},F(e.options,"debugTable")),e.getFilteredSelectedRowModel=A(()=>[e.getState().rowSelection,e.getFilteredRowModel()],(n,t)=>Object.keys(n).length?Fn(e,t):{rows:[],flatRows:[],rowsById:{}},F(e.options,"debugTable")),e.getGroupedSelectedRowModel=A(()=>[e.getState().rowSelection,e.getSortedRowModel()],(n,t)=>Object.keys(n).length?Fn(e,t):{rows:[],flatRows:[],rowsById:{}},F(e.options,"debugTable")),e.getIsAllRowsSelected=()=>{const n=e.getFilteredRowModel().flatRows,{rowSelection:t}=e.getState();let o=!!(n.length&&Object.keys(t).length);return o&&n.some(r=>r.getCanSelect()&&!t[r.id])&&(o=!1),o},e.getIsAllPageRowsSelected=()=>{const n=e.getPaginationRowModel().flatRows.filter(r=>r.getCanSelect()),{rowSelection:t}=e.getState();let o=!!n.length;return o&&n.some(r=>!t[r.id])&&(o=!1),o},e.getIsSomeRowsSelected=()=>{var n;const t=Object.keys((n=e.getState().rowSelection)!=null?n:{}).length;return t>0&&t<e.getFilteredRowModel().flatRows.length},e.getIsSomePageRowsSelected=()=>{const n=e.getPaginationRowModel().flatRows;return e.getIsAllPageRowsSelected()?!1:n.filter(t=>t.getCanSelect()).some(t=>t.getIsSelected()||t.getIsSomeSelected())},e.getToggleAllRowsSelectedHandler=()=>n=>{e.toggleAllRowsSelected(n.target.checked)},e.getToggleAllPageRowsSelectedHandler=()=>n=>{e.toggleAllPageRowsSelected(n.target.checked)}},createRow:(e,n)=>{e.toggleSelected=(t,o)=>{const r=e.getIsSelected();n.setRowSelection(s=>{var i;if(t=typeof t<"u"?t:!r,e.getCanSelect()&&r===t)return s;const l={...s};return no(l,e.id,t,(i=o==null?void 0:o.selectChildren)!=null?i:!0,n),l})},e.getIsSelected=()=>{const{rowSelection:t}=n.getState();return wo(e,t)},e.getIsSomeSelected=()=>{const{rowSelection:t}=n.getState();return oo(e,t)==="some"},e.getIsAllSubRowsSelected=()=>{const{rowSelection:t}=n.getState();return oo(e,t)==="all"},e.getCanSelect=()=>{var t;return typeof n.options.enableRowSelection=="function"?n.options.enableRowSelection(e):(t=n.options.enableRowSelection)!=null?t:!0},e.getCanSelectSubRows=()=>{var t;return typeof n.options.enableSubRowSelection=="function"?n.options.enableSubRowSelection(e):(t=n.options.enableSubRowSelection)!=null?t:!0},e.getCanMultiSelect=()=>{var t;return typeof n.options.enableMultiRowSelection=="function"?n.options.enableMultiRowSelection(e):(t=n.options.enableMultiRowSelection)!=null?t:!0},e.getToggleSelectedHandler=()=>{const t=e.getCanSelect();return o=>{var r;t&&e.toggleSelected((r=o.target)==null?void 0:r.checked)}}}},no=(e,n,t,o,r)=>{var s;const i=r.getRow(n,!0);t?(i.getCanMultiSelect()||Object.keys(e).forEach(l=>delete e[l]),i.getCanSelect()&&(e[n]=!0)):delete e[n],o&&(s=i.subRows)!=null&&s.length&&i.getCanSelectSubRows()&&i.subRows.forEach(l=>no(e,l.id,t,o,r))};function Fn(e,n){const t=e.getState().rowSelection,o=[],r={},s=function(i,l){return i.map(u=>{var f;const g=wo(u,t);if(g&&(o.push(u),r[u.id]=u),(f=u.subRows)!=null&&f.length&&(u={...u,subRows:s(u.subRows)}),g)return u}).filter(Boolean)};return{rows:s(n.rows),flatRows:o,rowsById:r}}function wo(e,n){var t;return(t=n[e.id])!=null?t:!1}function oo(e,n,t){var o;if(!((o=e.subRows)!=null&&o.length))return!1;let r=!0,s=!1;return e.subRows.forEach(i=>{if(!(s&&!r)&&(i.getCanSelect()&&(wo(i,n)?s=!0:r=!1),i.subRows&&i.subRows.length)){const l=oo(i,n);l==="all"?s=!0:(l==="some"&&(s=!0),r=!1)}}),r?"all":s?"some":!1}const ro=/([0-9]+)/gm,$l=(e,n,t)=>as(qe(e.getValue(t)).toLowerCase(),qe(n.getValue(t)).toLowerCase()),Ol=(e,n,t)=>as(qe(e.getValue(t)),qe(n.getValue(t))),kl=(e,n,t)=>So(qe(e.getValue(t)).toLowerCase(),qe(n.getValue(t)).toLowerCase()),Ll=(e,n,t)=>So(qe(e.getValue(t)),qe(n.getValue(t))),Vl=(e,n,t)=>{const o=e.getValue(t),r=n.getValue(t);return o>r?1:o<r?-1:0},Hl=(e,n,t)=>So(e.getValue(t),n.getValue(t));function So(e,n){return e===n?0:e>n?1:-1}function qe(e){return typeof e=="number"?isNaN(e)||e===1/0||e===-1/0?"":String(e):typeof e=="string"?e:""}function as(e,n){const t=e.split(ro).filter(Boolean),o=n.split(ro).filter(Boolean);for(;t.length&&o.length;){const r=t.shift(),s=o.shift(),i=parseInt(r,10),l=parseInt(s,10),u=[i,l].sort();if(isNaN(u[0])){if(r>s)return 1;if(s>r)return-1;continue}if(isNaN(u[1]))return isNaN(i)?-1:1;if(i>l)return 1;if(l>i)return-1}return t.length-o.length}const xt={alphanumeric:$l,alphanumericCaseSensitive:Ol,text:kl,textCaseSensitive:Ll,datetime:Vl,basic:Hl},Gl={getInitialState:e=>({sorting:[],...e}),getDefaultColumnDef:()=>({sortingFn:"auto",sortUndefined:1}),getDefaultOptions:e=>({onSortingChange:ue("sorting",e),isMultiSortEvent:n=>n.shiftKey}),createColumn:(e,n)=>{e.getAutoSortingFn=()=>{const t=n.getFilteredRowModel().flatRows.slice(10);let o=!1;for(const r of t){const s=r==null?void 0:r.getValue(e.id);if(Object.prototype.toString.call(s)==="[object Date]")return xt.datetime;if(typeof s=="string"&&(o=!0,s.split(ro).length>1))return xt.alphanumeric}return o?xt.text:xt.basic},e.getAutoSortDir=()=>{const t=n.getFilteredRowModel().flatRows[0];return typeof(t==null?void 0:t.getValue(e.id))=="string"?"asc":"desc"},e.getSortingFn=()=>{var t,o;if(!e)throw new Error;return on(e.columnDef.sortingFn)?e.columnDef.sortingFn:e.columnDef.sortingFn==="auto"?e.getAutoSortingFn():(t=(o=n.options.sortingFns)==null?void 0:o[e.columnDef.sortingFn])!=null?t:xt[e.columnDef.sortingFn]},e.toggleSorting=(t,o)=>{const r=e.getNextSortingOrder(),s=typeof t<"u"&&t!==null;n.setSorting(i=>{const l=i==null?void 0:i.find(c=>c.id===e.id),u=i==null?void 0:i.findIndex(c=>c.id===e.id);let f=[],g,m=s?t:r==="desc";if(i!=null&&i.length&&e.getCanMultiSort()&&o?l?g="toggle":g="add":i!=null&&i.length&&u!==i.length-1?g="replace":l?g="toggle":g="replace",g==="toggle"&&(s||r||(g="remove")),g==="add"){var d;f=[...i,{id:e.id,desc:m}],f.splice(0,f.length-((d=n.options.maxMultiSortColCount)!=null?d:Number.MAX_SAFE_INTEGER))}else g==="toggle"?f=i.map(c=>c.id===e.id?{...c,desc:m}:c):g==="remove"?f=i.filter(c=>c.id!==e.id):f=[{id:e.id,desc:m}];return f})},e.getFirstSortDir=()=>{var t,o;return((t=(o=e.columnDef.sortDescFirst)!=null?o:n.options.sortDescFirst)!=null?t:e.getAutoSortDir()==="desc")?"desc":"asc"},e.getNextSortingOrder=t=>{var o,r;const s=e.getFirstSortDir(),i=e.getIsSorted();return i?i!==s&&((o=n.options.enableSortingRemoval)==null||o)&&(!(t&&(r=n.options.enableMultiRemove)!=null)||r)?!1:i==="desc"?"asc":"desc":s},e.getCanSort=()=>{var t,o;return((t=e.columnDef.enableSorting)!=null?t:!0)&&((o=n.options.enableSorting)!=null?o:!0)&&!!e.accessorFn},e.getCanMultiSort=()=>{var t,o;return(t=(o=e.columnDef.enableMultiSort)!=null?o:n.options.enableMultiSort)!=null?t:!!e.accessorFn},e.getIsSorted=()=>{var t;const o=(t=n.getState().sorting)==null?void 0:t.find(r=>r.id===e.id);return o?o.desc?"desc":"asc":!1},e.getSortIndex=()=>{var t,o;return(t=(o=n.getState().sorting)==null?void 0:o.findIndex(r=>r.id===e.id))!=null?t:-1},e.clearSorting=()=>{n.setSorting(t=>t!=null&&t.length?t.filter(o=>o.id!==e.id):[])},e.getToggleSortingHandler=()=>{const t=e.getCanSort();return o=>{t&&(o.persist==null||o.persist(),e.toggleSorting==null||e.toggleSorting(void 0,e.getCanMultiSort()?n.options.isMultiSortEvent==null?void 0:n.options.isMultiSortEvent(o):!1))}}},createTable:e=>{e.setSorting=n=>e.options.onSortingChange==null?void 0:e.options.onSortingChange(n),e.resetSorting=n=>{var t,o;e.setSorting(n?[]:(t=(o=e.initialState)==null?void 0:o.sorting)!=null?t:[])},e.getPreSortedRowModel=()=>e.getGroupedRowModel(),e.getSortedRowModel=()=>(!e._getSortedRowModel&&e.options.getSortedRowModel&&(e._getSortedRowModel=e.options.getSortedRowModel(e)),e.options.manualSorting||!e._getSortedRowModel?e.getPreSortedRowModel():e._getSortedRowModel())}},zl=[ul,Pl,bl,Ml,dl,fl,Nl,Al,Gl,yl,Fl,Tl,Il,Dl,_l];function Bl(e){var n,t;const o=[...zl,...(n=e._features)!=null?n:[]];let r={_features:o};const s=r._features.reduce((d,c)=>Object.assign(d,c.getDefaultOptions==null?void 0:c.getDefaultOptions(r)),{}),i=d=>r.options.mergeOptions?r.options.mergeOptions(s,d):{...s,...d};let u={...{},...(t=e.initialState)!=null?t:{}};r._features.forEach(d=>{var c;u=(c=d.getInitialState==null?void 0:d.getInitialState(u))!=null?c:u});const f=[];let g=!1;const m={_features:o,options:{...s,...e},initialState:u,_queue:d=>{f.push(d),g||(g=!0,Promise.resolve().then(()=>{for(;f.length;)f.shift()();g=!1}).catch(c=>setTimeout(()=>{throw c})))},reset:()=>{r.setState(r.initialState)},setOptions:d=>{const c=Be(d,r.options);r.options=i(c)},getState:()=>r.options.state,setState:d=>{r.options.onStateChange==null||r.options.onStateChange(d)},_getRowId:(d,c,v)=>{var p;return(p=r.options.getRowId==null?void 0:r.options.getRowId(d,c,v))!=null?p:`${v?[v.id,c].join("."):c}`},getCoreRowModel:()=>(r._getCoreRowModel||(r._getCoreRowModel=r.options.getCoreRowModel(r)),r._getCoreRowModel()),getRowModel:()=>r.getPaginationRowModel(),getRow:(d,c)=>{let v=(c?r.getPrePaginationRowModel():r.getRowModel()).rowsById[d];if(!v&&(v=r.getCoreRowModel().rowsById[d],!v))throw new Error;return v},_getDefaultColumnDef:A(()=>[r.options.defaultColumn],d=>{var c;return d=(c=d)!=null?c:{},{header:v=>{const p=v.header.column.columnDef;return p.accessorKey?p.accessorKey:p.accessorFn?p.id:null},cell:v=>{var p,w;return(p=(w=v.renderValue())==null||w.toString==null?void 0:w.toString())!=null?p:null},...r._features.reduce((v,p)=>Object.assign(v,p.getDefaultColumnDef==null?void 0:p.getDefaultColumnDef()),{}),...d}},F(e,"debugColumns")),_getColumnDefs:()=>r.options.columns,getAllColumns:A(()=>[r._getColumnDefs()],d=>{const c=function(v,p,w){return w===void 0&&(w=0),v.map(x=>{const S=cl(r,x,w,p),C=x;return S.columns=C.columns?c(C.columns,S,w+1):[],S})};return c(d)},F(e,"debugColumns")),getAllFlatColumns:A(()=>[r.getAllColumns()],d=>d.flatMap(c=>c.getFlatColumns()),F(e,"debugColumns")),_getAllFlatColumnsById:A(()=>[r.getAllFlatColumns()],d=>d.reduce((c,v)=>(c[v.id]=v,c),{}),F(e,"debugColumns")),getAllLeafColumns:A(()=>[r.getAllColumns(),r._getOrderColumnsFn()],(d,c)=>{let v=d.flatMap(p=>p.getLeafColumns());return c(v)},F(e,"debugColumns")),getColumn:d=>r._getAllFlatColumnsById()[d]};Object.assign(r,m);for(let d=0;d<r._features.length;d++){const c=r._features[d];c==null||c.createTable==null||c.createTable(r)}return r}function Ul(){return e=>A(()=>[e.options.data],n=>{const t={rows:[],flatRows:[],rowsById:{}},o=function(r,s,i){s===void 0&&(s=0);const l=[];for(let f=0;f<r.length;f++){const g=vo(e,e._getRowId(r[f],f,i),r[f],f,s,void 0,i==null?void 0:i.id);if(t.flatRows.push(g),t.rowsById[g.id]=g,l.push(g),e.options.getSubRows){var u;g.originalSubRows=e.options.getSubRows(r[f],f),(u=g.originalSubRows)!=null&&u.length&&(g.subRows=o(g.originalSubRows,s+1,g))}}return l};return t.rows=o(n),t},F(e.options,"debugTable","getRowModel",()=>e._autoResetPageIndex()))}function Wl(e){const n=[],t=o=>{var r;n.push(o),(r=o.subRows)!=null&&r.length&&o.getIsExpanded()&&o.subRows.forEach(t)};return e.rows.forEach(t),{rows:n,flatRows:e.flatRows,rowsById:e.rowsById}}function Kl(e,n,t){return t.options.filterFromLeafRows?ql(e,n,t):Xl(e,n,t)}function ql(e,n,t){var o;const r=[],s={},i=(o=t.options.maxLeafRowFilterDepth)!=null?o:100,l=function(u,f){f===void 0&&(f=0);const g=[];for(let d=0;d<u.length;d++){var m;let c=u[d];const v=vo(t,c.id,c.original,c.index,c.depth,void 0,c.parentId);if(v.columnFilters=c.columnFilters,(m=c.subRows)!=null&&m.length&&f<i){if(v.subRows=l(c.subRows,f+1),c=v,n(c)&&!v.subRows.length){g.push(c),s[c.id]=c,r.push(c);continue}if(n(c)||v.subRows.length){g.push(c),s[c.id]=c,r.push(c);continue}}else c=v,n(c)&&(g.push(c),s[c.id]=c,r.push(c))}return g};return{rows:l(e),flatRows:r,rowsById:s}}function Xl(e,n,t){var o;const r=[],s={},i=(o=t.options.maxLeafRowFilterDepth)!=null?o:100,l=function(u,f){f===void 0&&(f=0);const g=[];for(let d=0;d<u.length;d++){let c=u[d];if(n(c)){var m;if((m=c.subRows)!=null&&m.length&&f<i){const p=vo(t,c.id,c.original,c.index,c.depth,void 0,c.parentId);p.subRows=l(c.subRows,f+1),c=p}g.push(c),r.push(c),s[c.id]=c}}return g};return{rows:l(e),flatRows:r,rowsById:s}}function Yl(){return e=>A(()=>[e.getPreFilteredRowModel(),e.getState().columnFilters,e.getState().globalFilter],(n,t,o)=>{if(!n.rows.length||!(t!=null&&t.length)&&!o){for(let d=0;d<n.flatRows.length;d++)n.flatRows[d].columnFilters={},n.flatRows[d].columnFiltersMeta={};return n}const r=[],s=[];(t??[]).forEach(d=>{var c;const v=e.getColumn(d.id);if(!v)return;const p=v.getFilterFn();p&&r.push({id:d.id,filterFn:p,resolvedValue:(c=p.resolveFilterValue==null?void 0:p.resolveFilterValue(d.value))!=null?c:d.value})});const i=(t??[]).map(d=>d.id),l=e.getGlobalFilterFn(),u=e.getAllLeafColumns().filter(d=>d.getCanGlobalFilter());o&&l&&u.length&&(i.push("__global__"),u.forEach(d=>{var c;s.push({id:d.id,filterFn:l,resolvedValue:(c=l.resolveFilterValue==null?void 0:l.resolveFilterValue(o))!=null?c:o})}));let f,g;for(let d=0;d<n.flatRows.length;d++){const c=n.flatRows[d];if(c.columnFilters={},r.length)for(let v=0;v<r.length;v++){f=r[v];const p=f.id;c.columnFilters[p]=f.filterFn(c,p,f.resolvedValue,w=>{c.columnFiltersMeta[p]=w})}if(s.length){for(let v=0;v<s.length;v++){g=s[v];const p=g.id;if(g.filterFn(c,p,g.resolvedValue,w=>{c.columnFiltersMeta[p]=w})){c.columnFilters.__global__=!0;break}}c.columnFilters.__global__!==!0&&(c.columnFilters.__global__=!1)}}const m=d=>{for(let c=0;c<i.length;c++)if(d.columnFilters[i[c]]===!1)return!1;return!0};return Kl(n.rows,m,e)},F(e.options,"debugTable","getFilteredRowModel",()=>e._autoResetPageIndex()))}function Jl(e){return n=>A(()=>[n.getState().pagination,n.getPrePaginationRowModel(),n.options.paginateExpandedRows?void 0:n.getState().expanded],(t,o)=>{if(!o.rows.length)return o;const{pageSize:r,pageIndex:s}=t;let{rows:i,flatRows:l,rowsById:u}=o;const f=r*s,g=f+r;i=i.slice(f,g);let m;n.options.paginateExpandedRows?m={rows:i,flatRows:l,rowsById:u}:m=Wl({rows:i,flatRows:l,rowsById:u}),m.flatRows=[];const d=c=>{m.flatRows.push(c),c.subRows.length&&c.subRows.forEach(d)};return m.rows.forEach(d),m},F(n.options,"debugTable"))}function Zl(){return e=>A(()=>[e.getState().sorting,e.getPreSortedRowModel()],(n,t)=>{if(!t.rows.length||!(n!=null&&n.length))return t;const o=e.getState().sorting,r=[],s=o.filter(u=>{var f;return(f=e.getColumn(u.id))==null?void 0:f.getCanSort()}),i={};s.forEach(u=>{const f=e.getColumn(u.id);f&&(i[u.id]={sortUndefined:f.columnDef.sortUndefined,invertSorting:f.columnDef.invertSorting,sortingFn:f.getSortingFn()})});const l=u=>{const f=u.map(g=>({...g}));return f.sort((g,m)=>{for(let c=0;c<s.length;c+=1){var d;const v=s[c],p=i[v.id],w=p.sortUndefined,x=(d=v==null?void 0:v.desc)!=null?d:!1;let S=0;if(w){const C=g.getValue(v.id),y=m.getValue(v.id),R=C===void 0,M=y===void 0;if(R||M){if(w==="first")return R?-1:1;if(w==="last")return R?1:-1;S=R&&M?0:R?w:-w}}if(S===0&&(S=p.sortingFn(g,m,v.id)),S!==0)return x&&(S*=-1),p.invertSorting&&(S*=-1),S}return g.index-m.index}),f.forEach(g=>{var m;r.push(g),(m=g.subRows)!=null&&m.length&&(g.subRows=l(g.subRows))}),f};return{rows:l(t.rows),flatRows:r,rowsById:t.rowsById}},F(e.options,"debugTable","getSortedRowModel",()=>e._autoResetPageIndex()))}/**
67
- * react-table
68
- *
69
- * Copyright (c) TanStack
70
- *
71
- * This source code is licensed under the MIT license found in the
72
- * LICENSE.md file in the root directory of this source tree.
73
- *
74
- * @license MIT
75
- */function er(e,n){return e?Ql(e)?h.createElement(e,n):e:null}function Ql(e){return ec(e)||typeof e=="function"||tc(e)}function ec(e){return typeof e=="function"&&(()=>{const n=Object.getPrototypeOf(e);return n.prototype&&n.prototype.isReactComponent})()}function tc(e){return typeof e=="object"&&typeof e.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(e.$$typeof.description)}function nc(e){const n={state:{},onStateChange:()=>{},renderFallbackValue:null,...e},[t]=h.useState(()=>({current:Bl(n)})),[o,r]=h.useState(()=>t.current.initialState);return t.current.setOptions(s=>({...s,...e,state:{...o,...e.state},onStateChange:i=>{r(i),e.onStateChange==null||e.onStateChange(i)}})),t.current}function ls(e){const n=e+"CollectionProvider",[t,o]=nt(n),[r,s]=t(n,{collectionRef:{current:null},itemMap:new Map}),i=p=>{const{scope:w,children:x}=p,S=Se.useRef(null),C=Se.useRef(new Map).current;return a.jsx(r,{scope:w,itemMap:C,collectionRef:S,children:x})};i.displayName=n;const l=e+"CollectionSlot",u=Bn(l),f=Se.forwardRef((p,w)=>{const{scope:x,children:S}=p,C=s(l,x),y=te(w,C.collectionRef);return a.jsx(u,{ref:y,children:S})});f.displayName=l;const g=e+"CollectionItemSlot",m="data-radix-collection-item",d=Bn(g),c=Se.forwardRef((p,w)=>{const{scope:x,children:S,...C}=p,y=Se.useRef(null),R=te(w,y),M=s(g,x);return Se.useEffect(()=>(M.itemMap.set(y,{ref:y,...C}),()=>void M.itemMap.delete(y))),a.jsx(d,{[m]:"",ref:R,children:S})});c.displayName=g;function v(p){const w=s(e+"CollectionConsumer",p);return Se.useCallback(()=>{const S=w.collectionRef.current;if(!S)return[];const C=Array.from(S.querySelectorAll(`[${m}]`));return Array.from(w.itemMap.values()).sort((M,b)=>C.indexOf(M.ref.current)-C.indexOf(b.ref.current))},[w.collectionRef,w.itemMap])}return[{Provider:i,Slot:f,ItemSlot:c},v,o]}var oc=h.createContext(void 0);function Co(e){const n=h.useContext(oc);return e||n||"ltr"}function Oe(e){const n=h.useRef(e);return h.useEffect(()=>{n.current=e}),h.useMemo(()=>(...t)=>{var o;return(o=n.current)==null?void 0:o.call(n,...t)},[])}function rc(e,n=globalThis==null?void 0:globalThis.document){const t=Oe(e);h.useEffect(()=>{const o=r=>{r.key==="Escape"&&t(r)};return n.addEventListener("keydown",o,{capture:!0}),()=>n.removeEventListener("keydown",o,{capture:!0})},[t,n])}var sc="DismissableLayer",so="dismissableLayer.update",ic="dismissableLayer.pointerDownOutside",ac="dismissableLayer.focusOutside",tr,cs=h.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),us=h.forwardRef((e,n)=>{const{disableOutsidePointerEvents:t=!1,onEscapeKeyDown:o,onPointerDownOutside:r,onFocusOutside:s,onInteractOutside:i,onDismiss:l,...u}=e,f=h.useContext(cs),[g,m]=h.useState(null),d=(g==null?void 0:g.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,c]=h.useState({}),v=te(n,b=>m(b)),p=Array.from(f.layers),[w]=[...f.layersWithOutsidePointerEventsDisabled].slice(-1),x=p.indexOf(w),S=g?p.indexOf(g):-1,C=f.layersWithOutsidePointerEventsDisabled.size>0,y=S>=x,R=uc(b=>{const E=b.target,$=[...f.branches].some(I=>I.contains(E));!y||$||(r==null||r(b),i==null||i(b),b.defaultPrevented||l==null||l())},d),M=dc(b=>{const E=b.target;[...f.branches].some(I=>I.contains(E))||(s==null||s(b),i==null||i(b),b.defaultPrevented||l==null||l())},d);return rc(b=>{S===f.layers.size-1&&(o==null||o(b),!b.defaultPrevented&&l&&(b.preventDefault(),l()))},d),h.useEffect(()=>{if(g)return t&&(f.layersWithOutsidePointerEventsDisabled.size===0&&(tr=d.body.style.pointerEvents,d.body.style.pointerEvents="none"),f.layersWithOutsidePointerEventsDisabled.add(g)),f.layers.add(g),nr(),()=>{t&&f.layersWithOutsidePointerEventsDisabled.size===1&&(d.body.style.pointerEvents=tr)}},[g,d,t,f]),h.useEffect(()=>()=>{g&&(f.layers.delete(g),f.layersWithOutsidePointerEventsDisabled.delete(g),nr())},[g,f]),h.useEffect(()=>{const b=()=>c({});return document.addEventListener(so,b),()=>document.removeEventListener(so,b)},[]),a.jsx(X.div,{...u,ref:v,style:{pointerEvents:C?y?"auto":"none":void 0,...e.style},onFocusCapture:k(e.onFocusCapture,M.onFocusCapture),onBlurCapture:k(e.onBlurCapture,M.onBlurCapture),onPointerDownCapture:k(e.onPointerDownCapture,R.onPointerDownCapture)})});us.displayName=sc;var lc="DismissableLayerBranch",cc=h.forwardRef((e,n)=>{const t=h.useContext(cs),o=h.useRef(null),r=te(n,o);return h.useEffect(()=>{const s=o.current;if(s)return t.branches.add(s),()=>{t.branches.delete(s)}},[t.branches]),a.jsx(X.div,{...e,ref:r})});cc.displayName=lc;function uc(e,n=globalThis==null?void 0:globalThis.document){const t=Oe(e),o=h.useRef(!1),r=h.useRef(()=>{});return h.useEffect(()=>{const s=l=>{if(l.target&&!o.current){let u=function(){ds(ic,t,f,{discrete:!0})};const f={originalEvent:l};l.pointerType==="touch"?(n.removeEventListener("click",r.current),r.current=u,n.addEventListener("click",r.current,{once:!0})):u()}else n.removeEventListener("click",r.current);o.current=!1},i=window.setTimeout(()=>{n.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(i),n.removeEventListener("pointerdown",s),n.removeEventListener("click",r.current)}},[n,t]),{onPointerDownCapture:()=>o.current=!0}}function dc(e,n=globalThis==null?void 0:globalThis.document){const t=Oe(e),o=h.useRef(!1);return h.useEffect(()=>{const r=s=>{s.target&&!o.current&&ds(ac,t,{originalEvent:s},{discrete:!1})};return n.addEventListener("focusin",r),()=>n.removeEventListener("focusin",r)},[n,t]),{onFocusCapture:()=>o.current=!0,onBlurCapture:()=>o.current=!1}}function nr(){const e=new CustomEvent(so);document.dispatchEvent(e)}function ds(e,n,t,{discrete:o}){const r=t.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:t});n&&r.addEventListener(e,n,{once:!0}),o?jr(r,s):r.dispatchEvent(s)}var Tn=0;function fc(){h.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??or()),document.body.insertAdjacentElement("beforeend",e[1]??or()),Tn++,()=>{Tn===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(n=>n.remove()),Tn--}},[])}function or(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var In="focusScope.autoFocusOnMount",Dn="focusScope.autoFocusOnUnmount",rr={bubbles:!1,cancelable:!0},gc="FocusScope",fs=h.forwardRef((e,n)=>{const{loop:t=!1,trapped:o=!1,onMountAutoFocus:r,onUnmountAutoFocus:s,...i}=e,[l,u]=h.useState(null),f=Oe(r),g=Oe(s),m=h.useRef(null),d=te(n,p=>u(p)),c=h.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;h.useEffect(()=>{if(o){let p=function(C){if(c.paused||!l)return;const y=C.target;l.contains(y)?m.current=y:Ge(m.current,{select:!0})},w=function(C){if(c.paused||!l)return;const y=C.relatedTarget;y!==null&&(l.contains(y)||Ge(m.current,{select:!0}))},x=function(C){if(document.activeElement===document.body)for(const R of C)R.removedNodes.length>0&&Ge(l)};document.addEventListener("focusin",p),document.addEventListener("focusout",w);const S=new MutationObserver(x);return l&&S.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",p),document.removeEventListener("focusout",w),S.disconnect()}}},[o,l,c.paused]),h.useEffect(()=>{if(l){ir.add(c);const p=document.activeElement;if(!l.contains(p)){const x=new CustomEvent(In,rr);l.addEventListener(In,f),l.dispatchEvent(x),x.defaultPrevented||(mc(wc(gs(l)),{select:!0}),document.activeElement===p&&Ge(l))}return()=>{l.removeEventListener(In,f),setTimeout(()=>{const x=new CustomEvent(Dn,rr);l.addEventListener(Dn,g),l.dispatchEvent(x),x.defaultPrevented||Ge(p??document.body,{select:!0}),l.removeEventListener(Dn,g),ir.remove(c)},0)}}},[l,f,g,c]);const v=h.useCallback(p=>{if(!t&&!o||c.paused)return;const w=p.key==="Tab"&&!p.altKey&&!p.ctrlKey&&!p.metaKey,x=document.activeElement;if(w&&x){const S=p.currentTarget,[C,y]=pc(S);C&&y?!p.shiftKey&&x===y?(p.preventDefault(),t&&Ge(C,{select:!0})):p.shiftKey&&x===C&&(p.preventDefault(),t&&Ge(y,{select:!0})):x===S&&p.preventDefault()}},[t,o,c.paused]);return a.jsx(X.div,{tabIndex:-1,...i,ref:d,onKeyDown:v})});fs.displayName=gc;function mc(e,{select:n=!1}={}){const t=document.activeElement;for(const o of e)if(Ge(o,{select:n}),document.activeElement!==t)return}function pc(e){const n=gs(e),t=sr(n,e),o=sr(n.reverse(),e);return[t,o]}function gs(e){const n=[],t=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:o=>{const r=o.tagName==="INPUT"&&o.type==="hidden";return o.disabled||o.hidden||r?NodeFilter.FILTER_SKIP:o.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;t.nextNode();)n.push(t.currentNode);return n}function sr(e,n){for(const t of e)if(!hc(t,{upTo:n}))return t}function hc(e,{upTo:n}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(n!==void 0&&e===n)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function vc(e){return e instanceof HTMLInputElement&&"select"in e}function Ge(e,{select:n=!1}={}){if(e&&e.focus){const t=document.activeElement;e.focus({preventScroll:!0}),e!==t&&vc(e)&&n&&e.select()}}var ir=xc();function xc(){let e=[];return{add(n){const t=e[0];n!==t&&(t==null||t.pause()),e=ar(e,n),e.unshift(n)},remove(n){var t;e=ar(e,n),(t=e[0])==null||t.resume()}}}function ar(e,n){const t=[...e],o=t.indexOf(n);return o!==-1&&t.splice(o,1),t}function wc(e){return e.filter(n=>n.tagName!=="A")}var Sc=Er[" useId ".trim().toString()]||(()=>{}),Cc=0;function qt(e){const[n,t]=h.useState(Sc());return Ke(()=>{t(o=>o??String(Cc++))},[e]),e||(n?`radix-${n}`:"")}const yc=["top","right","bottom","left"],Xe=Math.min,le=Math.max,Xt=Math.round,kt=Math.floor,be=e=>({x:e,y:e}),Rc={left:"right",right:"left",bottom:"top",top:"bottom"},bc={start:"end",end:"start"};function io(e,n,t){return le(e,Xe(n,t))}function ke(e,n){return typeof e=="function"?e(n):e}function Le(e){return e.split("-")[0]}function pt(e){return e.split("-")[1]}function yo(e){return e==="x"?"y":"x"}function Ro(e){return e==="y"?"height":"width"}function Re(e){return["top","bottom"].includes(Le(e))?"y":"x"}function bo(e){return yo(Re(e))}function Mc(e,n,t){t===void 0&&(t=!1);const o=pt(e),r=bo(e),s=Ro(r);let i=r==="x"?o===(t?"end":"start")?"right":"left":o==="start"?"bottom":"top";return n.reference[s]>n.floating[s]&&(i=Yt(i)),[i,Yt(i)]}function Ec(e){const n=Yt(e);return[ao(e),n,ao(n)]}function ao(e){return e.replace(/start|end/g,n=>bc[n])}function _c(e,n,t){const o=["left","right"],r=["right","left"],s=["top","bottom"],i=["bottom","top"];switch(e){case"top":case"bottom":return t?n?r:o:n?o:r;case"left":case"right":return n?s:i;default:return[]}}function jc(e,n,t,o){const r=pt(e);let s=_c(Le(e),t==="start",o);return r&&(s=s.map(i=>i+"-"+r),n&&(s=s.concat(s.map(ao)))),s}function Yt(e){return e.replace(/left|right|bottom|top/g,n=>Rc[n])}function Pc(e){return{top:0,right:0,bottom:0,left:0,...e}}function ms(e){return typeof e!="number"?Pc(e):{top:e,right:e,bottom:e,left:e}}function Jt(e){const{x:n,y:t,width:o,height:r}=e;return{width:o,height:r,top:t,left:n,right:n+o,bottom:t+r,x:n,y:t}}function lr(e,n,t){let{reference:o,floating:r}=e;const s=Re(n),i=bo(n),l=Ro(i),u=Le(n),f=s==="y",g=o.x+o.width/2-r.width/2,m=o.y+o.height/2-r.height/2,d=o[l]/2-r[l]/2;let c;switch(u){case"top":c={x:g,y:o.y-r.height};break;case"bottom":c={x:g,y:o.y+o.height};break;case"right":c={x:o.x+o.width,y:m};break;case"left":c={x:o.x-r.width,y:m};break;default:c={x:o.x,y:o.y}}switch(pt(n)){case"start":c[i]-=d*(t&&f?-1:1);break;case"end":c[i]+=d*(t&&f?-1:1);break}return c}const Nc=async(e,n,t)=>{const{placement:o="bottom",strategy:r="absolute",middleware:s=[],platform:i}=t,l=s.filter(Boolean),u=await(i.isRTL==null?void 0:i.isRTL(n));let f=await i.getElementRects({reference:e,floating:n,strategy:r}),{x:g,y:m}=lr(f,o,u),d=o,c={},v=0;for(let p=0;p<l.length;p++){const{name:w,fn:x}=l[p],{x:S,y:C,data:y,reset:R}=await x({x:g,y:m,initialPlacement:o,placement:d,strategy:r,middlewareData:c,rects:f,platform:i,elements:{reference:e,floating:n}});g=S??g,m=C??m,c={...c,[w]:{...c[w],...y}},R&&v<=50&&(v++,typeof R=="object"&&(R.placement&&(d=R.placement),R.rects&&(f=R.rects===!0?await i.getElementRects({reference:e,floating:n,strategy:r}):R.rects),{x:g,y:m}=lr(f,d,u)),p=-1)}return{x:g,y:m,placement:d,strategy:r,middlewareData:c}};async function Rt(e,n){var t;n===void 0&&(n={});const{x:o,y:r,platform:s,rects:i,elements:l,strategy:u}=e,{boundary:f="clippingAncestors",rootBoundary:g="viewport",elementContext:m="floating",altBoundary:d=!1,padding:c=0}=ke(n,e),v=ms(c),w=l[d?m==="floating"?"reference":"floating":m],x=Jt(await s.getClippingRect({element:(t=await(s.isElement==null?void 0:s.isElement(w)))==null||t?w:w.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(l.floating)),boundary:f,rootBoundary:g,strategy:u})),S=m==="floating"?{x:o,y:r,width:i.floating.width,height:i.floating.height}:i.reference,C=await(s.getOffsetParent==null?void 0:s.getOffsetParent(l.floating)),y=await(s.isElement==null?void 0:s.isElement(C))?await(s.getScale==null?void 0:s.getScale(C))||{x:1,y:1}:{x:1,y:1},R=Jt(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:S,offsetParent:C,strategy:u}):S);return{top:(x.top-R.top+v.top)/y.y,bottom:(R.bottom-x.bottom+v.bottom)/y.y,left:(x.left-R.left+v.left)/y.x,right:(R.right-x.right+v.right)/y.x}}const Ac=e=>({name:"arrow",options:e,async fn(n){const{x:t,y:o,placement:r,rects:s,platform:i,elements:l,middlewareData:u}=n,{element:f,padding:g=0}=ke(e,n)||{};if(f==null)return{};const m=ms(g),d={x:t,y:o},c=bo(r),v=Ro(c),p=await i.getDimensions(f),w=c==="y",x=w?"top":"left",S=w?"bottom":"right",C=w?"clientHeight":"clientWidth",y=s.reference[v]+s.reference[c]-d[c]-s.floating[v],R=d[c]-s.reference[c],M=await(i.getOffsetParent==null?void 0:i.getOffsetParent(f));let b=M?M[C]:0;(!b||!await(i.isElement==null?void 0:i.isElement(M)))&&(b=l.floating[C]||s.floating[v]);const E=y/2-R/2,$=b/2-p[v]/2-1,I=Xe(m[x],$),V=Xe(m[S],$),G=I,O=b-p[v]-V,L=b/2-p[v]/2+E,D=io(G,L,O),P=!u.arrow&&pt(r)!=null&&L!==D&&s.reference[v]/2-(L<G?I:V)-p[v]/2<0,T=P?L<G?L-G:L-O:0;return{[c]:d[c]+T,data:{[c]:D,centerOffset:L-D-T,...P&&{alignmentOffset:T}},reset:P}}}),Fc=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(n){var t,o;const{placement:r,middlewareData:s,rects:i,initialPlacement:l,platform:u,elements:f}=n,{mainAxis:g=!0,crossAxis:m=!0,fallbackPlacements:d,fallbackStrategy:c="bestFit",fallbackAxisSideDirection:v="none",flipAlignment:p=!0,...w}=ke(e,n);if((t=s.arrow)!=null&&t.alignmentOffset)return{};const x=Le(r),S=Re(l),C=Le(l)===l,y=await(u.isRTL==null?void 0:u.isRTL(f.floating)),R=d||(C||!p?[Yt(l)]:Ec(l)),M=v!=="none";!d&&M&&R.push(...jc(l,p,v,y));const b=[l,...R],E=await Rt(n,w),$=[];let I=((o=s.flip)==null?void 0:o.overflows)||[];if(g&&$.push(E[x]),m){const L=Mc(r,i,y);$.push(E[L[0]],E[L[1]])}if(I=[...I,{placement:r,overflows:$}],!$.every(L=>L<=0)){var V,G;const L=(((V=s.flip)==null?void 0:V.index)||0)+1,D=b[L];if(D&&(!(m==="alignment"?S!==Re(D):!1)||I.every(j=>j.overflows[0]>0&&Re(j.placement)===S)))return{data:{index:L,overflows:I},reset:{placement:D}};let P=(G=I.filter(T=>T.overflows[0]<=0).sort((T,j)=>T.overflows[1]-j.overflows[1])[0])==null?void 0:G.placement;if(!P)switch(c){case"bestFit":{var O;const T=(O=I.filter(j=>{if(M){const _=Re(j.placement);return _===S||_==="y"}return!0}).map(j=>[j.placement,j.overflows.filter(_=>_>0).reduce((_,U)=>_+U,0)]).sort((j,_)=>j[1]-_[1])[0])==null?void 0:O[0];T&&(P=T);break}case"initialPlacement":P=l;break}if(r!==P)return{reset:{placement:P}}}return{}}}};function cr(e,n){return{top:e.top-n.height,right:e.right-n.width,bottom:e.bottom-n.height,left:e.left-n.width}}function ur(e){return yc.some(n=>e[n]>=0)}const Tc=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(n){const{rects:t}=n,{strategy:o="referenceHidden",...r}=ke(e,n);switch(o){case"referenceHidden":{const s=await Rt(n,{...r,elementContext:"reference"}),i=cr(s,t.reference);return{data:{referenceHiddenOffsets:i,referenceHidden:ur(i)}}}case"escaped":{const s=await Rt(n,{...r,altBoundary:!0}),i=cr(s,t.floating);return{data:{escapedOffsets:i,escaped:ur(i)}}}default:return{}}}}};async function Ic(e,n){const{placement:t,platform:o,elements:r}=e,s=await(o.isRTL==null?void 0:o.isRTL(r.floating)),i=Le(t),l=pt(t),u=Re(t)==="y",f=["left","top"].includes(i)?-1:1,g=s&&u?-1:1,m=ke(n,e);let{mainAxis:d,crossAxis:c,alignmentAxis:v}=typeof m=="number"?{mainAxis:m,crossAxis:0,alignmentAxis:null}:{mainAxis:m.mainAxis||0,crossAxis:m.crossAxis||0,alignmentAxis:m.alignmentAxis};return l&&typeof v=="number"&&(c=l==="end"?v*-1:v),u?{x:c*g,y:d*f}:{x:d*f,y:c*g}}const Dc=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(n){var t,o;const{x:r,y:s,placement:i,middlewareData:l}=n,u=await Ic(n,e);return i===((t=l.offset)==null?void 0:t.placement)&&(o=l.arrow)!=null&&o.alignmentOffset?{}:{x:r+u.x,y:s+u.y,data:{...u,placement:i}}}}},$c=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(n){const{x:t,y:o,placement:r}=n,{mainAxis:s=!0,crossAxis:i=!1,limiter:l={fn:w=>{let{x,y:S}=w;return{x,y:S}}},...u}=ke(e,n),f={x:t,y:o},g=await Rt(n,u),m=Re(Le(r)),d=yo(m);let c=f[d],v=f[m];if(s){const w=d==="y"?"top":"left",x=d==="y"?"bottom":"right",S=c+g[w],C=c-g[x];c=io(S,c,C)}if(i){const w=m==="y"?"top":"left",x=m==="y"?"bottom":"right",S=v+g[w],C=v-g[x];v=io(S,v,C)}const p=l.fn({...n,[d]:c,[m]:v});return{...p,data:{x:p.x-t,y:p.y-o,enabled:{[d]:s,[m]:i}}}}}},Oc=function(e){return e===void 0&&(e={}),{options:e,fn(n){const{x:t,y:o,placement:r,rects:s,middlewareData:i}=n,{offset:l=0,mainAxis:u=!0,crossAxis:f=!0}=ke(e,n),g={x:t,y:o},m=Re(r),d=yo(m);let c=g[d],v=g[m];const p=ke(l,n),w=typeof p=="number"?{mainAxis:p,crossAxis:0}:{mainAxis:0,crossAxis:0,...p};if(u){const C=d==="y"?"height":"width",y=s.reference[d]-s.floating[C]+w.mainAxis,R=s.reference[d]+s.reference[C]-w.mainAxis;c<y?c=y:c>R&&(c=R)}if(f){var x,S;const C=d==="y"?"width":"height",y=["top","left"].includes(Le(r)),R=s.reference[m]-s.floating[C]+(y&&((x=i.offset)==null?void 0:x[m])||0)+(y?0:w.crossAxis),M=s.reference[m]+s.reference[C]+(y?0:((S=i.offset)==null?void 0:S[m])||0)-(y?w.crossAxis:0);v<R?v=R:v>M&&(v=M)}return{[d]:c,[m]:v}}}},kc=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(n){var t,o;const{placement:r,rects:s,platform:i,elements:l}=n,{apply:u=()=>{},...f}=ke(e,n),g=await Rt(n,f),m=Le(r),d=pt(r),c=Re(r)==="y",{width:v,height:p}=s.floating;let w,x;m==="top"||m==="bottom"?(w=m,x=d===(await(i.isRTL==null?void 0:i.isRTL(l.floating))?"start":"end")?"left":"right"):(x=m,w=d==="end"?"top":"bottom");const S=p-g.top-g.bottom,C=v-g.left-g.right,y=Xe(p-g[w],S),R=Xe(v-g[x],C),M=!n.middlewareData.shift;let b=y,E=R;if((t=n.middlewareData.shift)!=null&&t.enabled.x&&(E=C),(o=n.middlewareData.shift)!=null&&o.enabled.y&&(b=S),M&&!d){const I=le(g.left,0),V=le(g.right,0),G=le(g.top,0),O=le(g.bottom,0);c?E=v-2*(I!==0||V!==0?I+V:le(g.left,g.right)):b=p-2*(G!==0||O!==0?G+O:le(g.top,g.bottom))}await u({...n,availableWidth:E,availableHeight:b});const $=await i.getDimensions(l.floating);return v!==$.width||p!==$.height?{reset:{rects:!0}}:{}}}};function rn(){return typeof window<"u"}function ht(e){return ps(e)?(e.nodeName||"").toLowerCase():"#document"}function ce(e){var n;return(e==null||(n=e.ownerDocument)==null?void 0:n.defaultView)||window}function Ee(e){var n;return(n=(ps(e)?e.ownerDocument:e.document)||window.document)==null?void 0:n.documentElement}function ps(e){return rn()?e instanceof Node||e instanceof ce(e).Node:!1}function he(e){return rn()?e instanceof Element||e instanceof ce(e).Element:!1}function Me(e){return rn()?e instanceof HTMLElement||e instanceof ce(e).HTMLElement:!1}function dr(e){return!rn()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof ce(e).ShadowRoot}function jt(e){const{overflow:n,overflowX:t,overflowY:o,display:r}=ve(e);return/auto|scroll|overlay|hidden|clip/.test(n+o+t)&&!["inline","contents"].includes(r)}function Lc(e){return["table","td","th"].includes(ht(e))}function sn(e){return[":popover-open",":modal"].some(n=>{try{return e.matches(n)}catch{return!1}})}function Mo(e){const n=Eo(),t=he(e)?ve(e):e;return["transform","translate","scale","rotate","perspective"].some(o=>t[o]?t[o]!=="none":!1)||(t.containerType?t.containerType!=="normal":!1)||!n&&(t.backdropFilter?t.backdropFilter!=="none":!1)||!n&&(t.filter?t.filter!=="none":!1)||["transform","translate","scale","rotate","perspective","filter"].some(o=>(t.willChange||"").includes(o))||["paint","layout","strict","content"].some(o=>(t.contain||"").includes(o))}function Vc(e){let n=Ye(e);for(;Me(n)&&!mt(n);){if(Mo(n))return n;if(sn(n))return null;n=Ye(n)}return null}function Eo(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function mt(e){return["html","body","#document"].includes(ht(e))}function ve(e){return ce(e).getComputedStyle(e)}function an(e){return he(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Ye(e){if(ht(e)==="html")return e;const n=e.assignedSlot||e.parentNode||dr(e)&&e.host||Ee(e);return dr(n)?n.host:n}function hs(e){const n=Ye(e);return mt(n)?e.ownerDocument?e.ownerDocument.body:e.body:Me(n)&&jt(n)?n:hs(n)}function bt(e,n,t){var o;n===void 0&&(n=[]),t===void 0&&(t=!0);const r=hs(e),s=r===((o=e.ownerDocument)==null?void 0:o.body),i=ce(r);if(s){const l=lo(i);return n.concat(i,i.visualViewport||[],jt(r)?r:[],l&&t?bt(l):[])}return n.concat(r,bt(r,[],t))}function lo(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function vs(e){const n=ve(e);let t=parseFloat(n.width)||0,o=parseFloat(n.height)||0;const r=Me(e),s=r?e.offsetWidth:t,i=r?e.offsetHeight:o,l=Xt(t)!==s||Xt(o)!==i;return l&&(t=s,o=i),{width:t,height:o,$:l}}function _o(e){return he(e)?e:e.contextElement}function ft(e){const n=_o(e);if(!Me(n))return be(1);const t=n.getBoundingClientRect(),{width:o,height:r,$:s}=vs(n);let i=(s?Xt(t.width):t.width)/o,l=(s?Xt(t.height):t.height)/r;return(!i||!Number.isFinite(i))&&(i=1),(!l||!Number.isFinite(l))&&(l=1),{x:i,y:l}}const Hc=be(0);function xs(e){const n=ce(e);return!Eo()||!n.visualViewport?Hc:{x:n.visualViewport.offsetLeft,y:n.visualViewport.offsetTop}}function Gc(e,n,t){return n===void 0&&(n=!1),!t||n&&t!==ce(e)?!1:n}function et(e,n,t,o){n===void 0&&(n=!1),t===void 0&&(t=!1);const r=e.getBoundingClientRect(),s=_o(e);let i=be(1);n&&(o?he(o)&&(i=ft(o)):i=ft(e));const l=Gc(s,t,o)?xs(s):be(0);let u=(r.left+l.x)/i.x,f=(r.top+l.y)/i.y,g=r.width/i.x,m=r.height/i.y;if(s){const d=ce(s),c=o&&he(o)?ce(o):o;let v=d,p=lo(v);for(;p&&o&&c!==v;){const w=ft(p),x=p.getBoundingClientRect(),S=ve(p),C=x.left+(p.clientLeft+parseFloat(S.paddingLeft))*w.x,y=x.top+(p.clientTop+parseFloat(S.paddingTop))*w.y;u*=w.x,f*=w.y,g*=w.x,m*=w.y,u+=C,f+=y,v=ce(p),p=lo(v)}}return Jt({width:g,height:m,x:u,y:f})}function jo(e,n){const t=an(e).scrollLeft;return n?n.left+t:et(Ee(e)).left+t}function ws(e,n,t){t===void 0&&(t=!1);const o=e.getBoundingClientRect(),r=o.left+n.scrollLeft-(t?0:jo(e,o)),s=o.top+n.scrollTop;return{x:r,y:s}}function zc(e){let{elements:n,rect:t,offsetParent:o,strategy:r}=e;const s=r==="fixed",i=Ee(o),l=n?sn(n.floating):!1;if(o===i||l&&s)return t;let u={scrollLeft:0,scrollTop:0},f=be(1);const g=be(0),m=Me(o);if((m||!m&&!s)&&((ht(o)!=="body"||jt(i))&&(u=an(o)),Me(o))){const c=et(o);f=ft(o),g.x=c.x+o.clientLeft,g.y=c.y+o.clientTop}const d=i&&!m&&!s?ws(i,u,!0):be(0);return{width:t.width*f.x,height:t.height*f.y,x:t.x*f.x-u.scrollLeft*f.x+g.x+d.x,y:t.y*f.y-u.scrollTop*f.y+g.y+d.y}}function Bc(e){return Array.from(e.getClientRects())}function Uc(e){const n=Ee(e),t=an(e),o=e.ownerDocument.body,r=le(n.scrollWidth,n.clientWidth,o.scrollWidth,o.clientWidth),s=le(n.scrollHeight,n.clientHeight,o.scrollHeight,o.clientHeight);let i=-t.scrollLeft+jo(e);const l=-t.scrollTop;return ve(o).direction==="rtl"&&(i+=le(n.clientWidth,o.clientWidth)-r),{width:r,height:s,x:i,y:l}}function Wc(e,n){const t=ce(e),o=Ee(e),r=t.visualViewport;let s=o.clientWidth,i=o.clientHeight,l=0,u=0;if(r){s=r.width,i=r.height;const f=Eo();(!f||f&&n==="fixed")&&(l=r.offsetLeft,u=r.offsetTop)}return{width:s,height:i,x:l,y:u}}function Kc(e,n){const t=et(e,!0,n==="fixed"),o=t.top+e.clientTop,r=t.left+e.clientLeft,s=Me(e)?ft(e):be(1),i=e.clientWidth*s.x,l=e.clientHeight*s.y,u=r*s.x,f=o*s.y;return{width:i,height:l,x:u,y:f}}function fr(e,n,t){let o;if(n==="viewport")o=Wc(e,t);else if(n==="document")o=Uc(Ee(e));else if(he(n))o=Kc(n,t);else{const r=xs(e);o={x:n.x-r.x,y:n.y-r.y,width:n.width,height:n.height}}return Jt(o)}function Ss(e,n){const t=Ye(e);return t===n||!he(t)||mt(t)?!1:ve(t).position==="fixed"||Ss(t,n)}function qc(e,n){const t=n.get(e);if(t)return t;let o=bt(e,[],!1).filter(l=>he(l)&&ht(l)!=="body"),r=null;const s=ve(e).position==="fixed";let i=s?Ye(e):e;for(;he(i)&&!mt(i);){const l=ve(i),u=Mo(i);!u&&l.position==="fixed"&&(r=null),(s?!u&&!r:!u&&l.position==="static"&&!!r&&["absolute","fixed"].includes(r.position)||jt(i)&&!u&&Ss(e,i))?o=o.filter(g=>g!==i):r=l,i=Ye(i)}return n.set(e,o),o}function Xc(e){let{element:n,boundary:t,rootBoundary:o,strategy:r}=e;const i=[...t==="clippingAncestors"?sn(n)?[]:qc(n,this._c):[].concat(t),o],l=i[0],u=i.reduce((f,g)=>{const m=fr(n,g,r);return f.top=le(m.top,f.top),f.right=Xe(m.right,f.right),f.bottom=Xe(m.bottom,f.bottom),f.left=le(m.left,f.left),f},fr(n,l,r));return{width:u.right-u.left,height:u.bottom-u.top,x:u.left,y:u.top}}function Yc(e){const{width:n,height:t}=vs(e);return{width:n,height:t}}function Jc(e,n,t){const o=Me(n),r=Ee(n),s=t==="fixed",i=et(e,!0,s,n);let l={scrollLeft:0,scrollTop:0};const u=be(0);function f(){u.x=jo(r)}if(o||!o&&!s)if((ht(n)!=="body"||jt(r))&&(l=an(n)),o){const c=et(n,!0,s,n);u.x=c.x+n.clientLeft,u.y=c.y+n.clientTop}else r&&f();s&&!o&&r&&f();const g=r&&!o&&!s?ws(r,l):be(0),m=i.left+l.scrollLeft-u.x-g.x,d=i.top+l.scrollTop-u.y-g.y;return{x:m,y:d,width:i.width,height:i.height}}function $n(e){return ve(e).position==="static"}function gr(e,n){if(!Me(e)||ve(e).position==="fixed")return null;if(n)return n(e);let t=e.offsetParent;return Ee(e)===t&&(t=t.ownerDocument.body),t}function Cs(e,n){const t=ce(e);if(sn(e))return t;if(!Me(e)){let r=Ye(e);for(;r&&!mt(r);){if(he(r)&&!$n(r))return r;r=Ye(r)}return t}let o=gr(e,n);for(;o&&Lc(o)&&$n(o);)o=gr(o,n);return o&&mt(o)&&$n(o)&&!Mo(o)?t:o||Vc(e)||t}const Zc=async function(e){const n=this.getOffsetParent||Cs,t=this.getDimensions,o=await t(e.floating);return{reference:Jc(e.reference,await n(e.floating),e.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function Qc(e){return ve(e).direction==="rtl"}const eu={convertOffsetParentRelativeRectToViewportRelativeRect:zc,getDocumentElement:Ee,getClippingRect:Xc,getOffsetParent:Cs,getElementRects:Zc,getClientRects:Bc,getDimensions:Yc,getScale:ft,isElement:he,isRTL:Qc};function ys(e,n){return e.x===n.x&&e.y===n.y&&e.width===n.width&&e.height===n.height}function tu(e,n){let t=null,o;const r=Ee(e);function s(){var l;clearTimeout(o),(l=t)==null||l.disconnect(),t=null}function i(l,u){l===void 0&&(l=!1),u===void 0&&(u=1),s();const f=e.getBoundingClientRect(),{left:g,top:m,width:d,height:c}=f;if(l||n(),!d||!c)return;const v=kt(m),p=kt(r.clientWidth-(g+d)),w=kt(r.clientHeight-(m+c)),x=kt(g),C={rootMargin:-v+"px "+-p+"px "+-w+"px "+-x+"px",threshold:le(0,Xe(1,u))||1};let y=!0;function R(M){const b=M[0].intersectionRatio;if(b!==u){if(!y)return i();b?i(!1,b):o=setTimeout(()=>{i(!1,1e-7)},1e3)}b===1&&!ys(f,e.getBoundingClientRect())&&i(),y=!1}try{t=new IntersectionObserver(R,{...C,root:r.ownerDocument})}catch{t=new IntersectionObserver(R,C)}t.observe(e)}return i(!0),s}function nu(e,n,t,o){o===void 0&&(o={});const{ancestorScroll:r=!0,ancestorResize:s=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:u=!1}=o,f=_o(e),g=r||s?[...f?bt(f):[],...bt(n)]:[];g.forEach(x=>{r&&x.addEventListener("scroll",t,{passive:!0}),s&&x.addEventListener("resize",t)});const m=f&&l?tu(f,t):null;let d=-1,c=null;i&&(c=new ResizeObserver(x=>{let[S]=x;S&&S.target===f&&c&&(c.unobserve(n),cancelAnimationFrame(d),d=requestAnimationFrame(()=>{var C;(C=c)==null||C.observe(n)})),t()}),f&&!u&&c.observe(f),c.observe(n));let v,p=u?et(e):null;u&&w();function w(){const x=et(e);p&&!ys(p,x)&&t(),p=x,v=requestAnimationFrame(w)}return t(),()=>{var x;g.forEach(S=>{r&&S.removeEventListener("scroll",t),s&&S.removeEventListener("resize",t)}),m==null||m(),(x=c)==null||x.disconnect(),c=null,u&&cancelAnimationFrame(v)}}const ou=Dc,ru=$c,su=Fc,iu=kc,au=Tc,mr=Ac,lu=Oc,cu=(e,n,t)=>{const o=new Map,r={platform:eu,...t},s={...r.platform,_c:o};return Nc(e,n,{...r,platform:s})};var uu=typeof document<"u",du=function(){},Ut=uu?h.useLayoutEffect:du;function Zt(e,n){if(e===n)return!0;if(typeof e!=typeof n)return!1;if(typeof e=="function"&&e.toString()===n.toString())return!0;let t,o,r;if(e&&n&&typeof e=="object"){if(Array.isArray(e)){if(t=e.length,t!==n.length)return!1;for(o=t;o--!==0;)if(!Zt(e[o],n[o]))return!1;return!0}if(r=Object.keys(e),t=r.length,t!==Object.keys(n).length)return!1;for(o=t;o--!==0;)if(!{}.hasOwnProperty.call(n,r[o]))return!1;for(o=t;o--!==0;){const s=r[o];if(!(s==="_owner"&&e.$$typeof)&&!Zt(e[s],n[s]))return!1}return!0}return e!==e&&n!==n}function Rs(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function pr(e,n){const t=Rs(e);return Math.round(n*t)/t}function On(e){const n=h.useRef(e);return Ut(()=>{n.current=e}),n}function fu(e){e===void 0&&(e={});const{placement:n="bottom",strategy:t="absolute",middleware:o=[],platform:r,elements:{reference:s,floating:i}={},transform:l=!0,whileElementsMounted:u,open:f}=e,[g,m]=h.useState({x:0,y:0,strategy:t,placement:n,middlewareData:{},isPositioned:!1}),[d,c]=h.useState(o);Zt(d,o)||c(o);const[v,p]=h.useState(null),[w,x]=h.useState(null),S=h.useCallback(j=>{j!==M.current&&(M.current=j,p(j))},[]),C=h.useCallback(j=>{j!==b.current&&(b.current=j,x(j))},[]),y=s||v,R=i||w,M=h.useRef(null),b=h.useRef(null),E=h.useRef(g),$=u!=null,I=On(u),V=On(r),G=On(f),O=h.useCallback(()=>{if(!M.current||!b.current)return;const j={placement:n,strategy:t,middleware:d};V.current&&(j.platform=V.current),cu(M.current,b.current,j).then(_=>{const U={..._,isPositioned:G.current!==!1};L.current&&!Zt(E.current,U)&&(E.current=U,Bi.flushSync(()=>{m(U)}))})},[d,n,t,V,G]);Ut(()=>{f===!1&&E.current.isPositioned&&(E.current.isPositioned=!1,m(j=>({...j,isPositioned:!1})))},[f]);const L=h.useRef(!1);Ut(()=>(L.current=!0,()=>{L.current=!1}),[]),Ut(()=>{if(y&&(M.current=y),R&&(b.current=R),y&&R){if(I.current)return I.current(y,R,O);O()}},[y,R,O,I,$]);const D=h.useMemo(()=>({reference:M,floating:b,setReference:S,setFloating:C}),[S,C]),P=h.useMemo(()=>({reference:y,floating:R}),[y,R]),T=h.useMemo(()=>{const j={position:t,left:0,top:0};if(!P.floating)return j;const _=pr(P.floating,g.x),U=pr(P.floating,g.y);return l?{...j,transform:"translate("+_+"px, "+U+"px)",...Rs(P.floating)>=1.5&&{willChange:"transform"}}:{position:t,left:_,top:U}},[t,l,P.floating,g.x,g.y]);return h.useMemo(()=>({...g,update:O,refs:D,elements:P,floatingStyles:T}),[g,O,D,P,T])}const gu=e=>{function n(t){return{}.hasOwnProperty.call(t,"current")}return{name:"arrow",options:e,fn(t){const{element:o,padding:r}=typeof e=="function"?e(t):e;return o&&n(o)?o.current!=null?mr({element:o.current,padding:r}).fn(t):{}:o?mr({element:o,padding:r}).fn(t):{}}}},mu=(e,n)=>({...ou(e),options:[e,n]}),pu=(e,n)=>({...ru(e),options:[e,n]}),hu=(e,n)=>({...lu(e),options:[e,n]}),vu=(e,n)=>({...su(e),options:[e,n]}),xu=(e,n)=>({...iu(e),options:[e,n]}),wu=(e,n)=>({...au(e),options:[e,n]}),Su=(e,n)=>({...gu(e),options:[e,n]});var Cu="Arrow",bs=h.forwardRef((e,n)=>{const{children:t,width:o=10,height:r=5,...s}=e;return a.jsx(X.svg,{...s,ref:n,width:o,height:r,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?t:a.jsx("polygon",{points:"0,0 30,0 15,10"})})});bs.displayName=Cu;var yu=bs,Po="Popper",[Ms,Es]=nt(Po),[Ru,_s]=Ms(Po),js=e=>{const{__scopePopper:n,children:t}=e,[o,r]=h.useState(null);return a.jsx(Ru,{scope:n,anchor:o,onAnchorChange:r,children:t})};js.displayName=Po;var Ps="PopperAnchor",Ns=h.forwardRef((e,n)=>{const{__scopePopper:t,virtualRef:o,...r}=e,s=_s(Ps,t),i=h.useRef(null),l=te(n,i);return h.useEffect(()=>{s.onAnchorChange((o==null?void 0:o.current)||i.current)}),o?null:a.jsx(X.div,{...r,ref:l})});Ns.displayName=Ps;var No="PopperContent",[bu,Mu]=Ms(No),As=h.forwardRef((e,n)=>{var de,Je,ie,me,vt,pn;const{__scopePopper:t,side:o="bottom",sideOffset:r=0,align:s="center",alignOffset:i=0,arrowPadding:l=0,avoidCollisions:u=!0,collisionBoundary:f=[],collisionPadding:g=0,sticky:m="partial",hideWhenDetached:d=!1,updatePositionStrategy:c="optimized",onPlaced:v,...p}=e,w=_s(No,t),[x,S]=h.useState(null),C=te(n,z=>S(z)),[y,R]=h.useState(null),M=kr(y),b=(M==null?void 0:M.width)??0,E=(M==null?void 0:M.height)??0,$=o+(s!=="center"?"-"+s:""),I=typeof g=="number"?g:{top:0,right:0,bottom:0,left:0,...g},V=Array.isArray(f)?f:[f],G=V.length>0,O={padding:I,boundary:V.filter(_u),altBoundary:G},{refs:L,floatingStyles:D,placement:P,isPositioned:T,middlewareData:j}=fu({strategy:"fixed",placement:$,whileElementsMounted:(...z)=>nu(...z,{animationFrame:c==="always"}),elements:{reference:w.anchor},middleware:[mu({mainAxis:r+E,alignmentAxis:i}),u&&pu({mainAxis:!0,crossAxis:!1,limiter:m==="partial"?hu():void 0,...O}),u&&vu({...O}),xu({...O,apply:({elements:z,rects:B,availableWidth:Q,availableHeight:K})=>{const{width:ae,height:He}=B.reference,J=z.floating.style;J.setProperty("--radix-popper-available-width",`${Q}px`),J.setProperty("--radix-popper-available-height",`${K}px`),J.setProperty("--radix-popper-anchor-width",`${ae}px`),J.setProperty("--radix-popper-anchor-height",`${He}px`)}}),y&&Su({element:y,padding:l}),ju({arrowWidth:b,arrowHeight:E}),d&&wu({strategy:"referenceHidden",...O})]}),[_,U]=Is(P),W=Oe(v);Ke(()=>{T&&(W==null||W())},[T,W]);const Y=(de=j.arrow)==null?void 0:de.x,xe=(Je=j.arrow)==null?void 0:Je.y,_e=((ie=j.arrow)==null?void 0:ie.centerOffset)!==0,[je,we]=h.useState();return Ke(()=>{x&&we(window.getComputedStyle(x).zIndex)},[x]),a.jsx("div",{ref:L.setFloating,"data-radix-popper-content-wrapper":"",style:{...D,transform:T?D.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:je,"--radix-popper-transform-origin":[(me=j.transformOrigin)==null?void 0:me.x,(vt=j.transformOrigin)==null?void 0:vt.y].join(" "),...((pn=j.hide)==null?void 0:pn.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:a.jsx(bu,{scope:t,placedSide:_,onArrowChange:R,arrowX:Y,arrowY:xe,shouldHideArrow:_e,children:a.jsx(X.div,{"data-side":_,"data-align":U,...p,ref:C,style:{...p.style,animation:T?void 0:"none"}})})})});As.displayName=No;var Fs="PopperArrow",Eu={top:"bottom",right:"left",bottom:"top",left:"right"},Ts=h.forwardRef(function(n,t){const{__scopePopper:o,...r}=n,s=Mu(Fs,o),i=Eu[s.placedSide];return a.jsx("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[i]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0},children:a.jsx(yu,{...r,ref:t,style:{...r.style,display:"block"}})})});Ts.displayName=Fs;function _u(e){return e!==null}var ju=e=>({name:"transformOrigin",options:e,fn(n){var w,x,S;const{placement:t,rects:o,middlewareData:r}=n,i=((w=r.arrow)==null?void 0:w.centerOffset)!==0,l=i?0:e.arrowWidth,u=i?0:e.arrowHeight,[f,g]=Is(t),m={start:"0%",center:"50%",end:"100%"}[g],d=(((x=r.arrow)==null?void 0:x.x)??0)+l/2,c=(((S=r.arrow)==null?void 0:S.y)??0)+u/2;let v="",p="";return f==="bottom"?(v=i?m:`${d}px`,p=`${-u}px`):f==="top"?(v=i?m:`${d}px`,p=`${o.floating.height+u}px`):f==="right"?(v=`${-u}px`,p=i?m:`${c}px`):f==="left"&&(v=`${o.floating.width+u}px`,p=i?m:`${c}px`),{data:{x:v,y:p}}}});function Is(e){const[n,t="center"]=e.split("-");return[n,t]}var Pu=js,Nu=Ns,Au=As,Fu=Ts,Tu="Portal",Ds=h.forwardRef((e,n)=>{var l;const{container:t,...o}=e,[r,s]=h.useState(!1);Ke(()=>s(!0),[]);const i=t||r&&((l=globalThis==null?void 0:globalThis.document)==null?void 0:l.body);return i?Ui.createPortal(a.jsx(X.div,{...o,ref:n}),i):null});Ds.displayName=Tu;var kn="rovingFocusGroup.onEntryFocus",Iu={bubbles:!1,cancelable:!0},Pt="RovingFocusGroup",[co,$s,Du]=ls(Pt),[$u,ln]=nt(Pt,[Du]),[Ou,ku]=$u(Pt),Os=h.forwardRef((e,n)=>a.jsx(co.Provider,{scope:e.__scopeRovingFocusGroup,children:a.jsx(co.Slot,{scope:e.__scopeRovingFocusGroup,children:a.jsx(Lu,{...e,ref:n})})}));Os.displayName=Pt;var Lu=h.forwardRef((e,n)=>{const{__scopeRovingFocusGroup:t,orientation:o,loop:r=!1,dir:s,currentTabStopId:i,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:u,onEntryFocus:f,preventScrollOnEntryFocus:g=!1,...m}=e,d=h.useRef(null),c=te(n,d),v=Co(s),[p,w]=tn({prop:i,defaultProp:l??null,onChange:u,caller:Pt}),[x,S]=h.useState(!1),C=Oe(f),y=$s(t),R=h.useRef(!1),[M,b]=h.useState(0);return h.useEffect(()=>{const E=d.current;if(E)return E.addEventListener(kn,C),()=>E.removeEventListener(kn,C)},[C]),a.jsx(Ou,{scope:t,orientation:o,dir:v,loop:r,currentTabStopId:p,onItemFocus:h.useCallback(E=>w(E),[w]),onItemShiftTab:h.useCallback(()=>S(!0),[]),onFocusableItemAdd:h.useCallback(()=>b(E=>E+1),[]),onFocusableItemRemove:h.useCallback(()=>b(E=>E-1),[]),children:a.jsx(X.div,{tabIndex:x||M===0?-1:0,"data-orientation":o,...m,ref:c,style:{outline:"none",...e.style},onMouseDown:k(e.onMouseDown,()=>{R.current=!0}),onFocus:k(e.onFocus,E=>{const $=!R.current;if(E.target===E.currentTarget&&$&&!x){const I=new CustomEvent(kn,Iu);if(E.currentTarget.dispatchEvent(I),!I.defaultPrevented){const V=y().filter(P=>P.focusable),G=V.find(P=>P.active),O=V.find(P=>P.id===p),D=[G,O,...V].filter(Boolean).map(P=>P.ref.current);Vs(D,g)}}R.current=!1}),onBlur:k(e.onBlur,()=>S(!1))})})}),ks="RovingFocusGroupItem",Ls=h.forwardRef((e,n)=>{const{__scopeRovingFocusGroup:t,focusable:o=!0,active:r=!1,tabStopId:s,children:i,...l}=e,u=qt(),f=s||u,g=ku(ks,t),m=g.currentTabStopId===f,d=$s(t),{onFocusableItemAdd:c,onFocusableItemRemove:v,currentTabStopId:p}=g;return h.useEffect(()=>{if(o)return c(),()=>v()},[o,c,v]),a.jsx(co.ItemSlot,{scope:t,id:f,focusable:o,active:r,children:a.jsx(X.span,{tabIndex:m?0:-1,"data-orientation":g.orientation,...l,ref:n,onMouseDown:k(e.onMouseDown,w=>{o?g.onItemFocus(f):w.preventDefault()}),onFocus:k(e.onFocus,()=>g.onItemFocus(f)),onKeyDown:k(e.onKeyDown,w=>{if(w.key==="Tab"&&w.shiftKey){g.onItemShiftTab();return}if(w.target!==w.currentTarget)return;const x=Gu(w,g.orientation,g.dir);if(x!==void 0){if(w.metaKey||w.ctrlKey||w.altKey||w.shiftKey)return;w.preventDefault();let C=d().filter(y=>y.focusable).map(y=>y.ref.current);if(x==="last")C.reverse();else if(x==="prev"||x==="next"){x==="prev"&&C.reverse();const y=C.indexOf(w.currentTarget);C=g.loop?zu(C,y+1):C.slice(y+1)}setTimeout(()=>Vs(C))}}),children:typeof i=="function"?i({isCurrentTabStop:m,hasTabStop:p!=null}):i})})});Ls.displayName=ks;var Vu={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Hu(e,n){return n!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function Gu(e,n,t){const o=Hu(e.key,t);if(!(n==="vertical"&&["ArrowLeft","ArrowRight"].includes(o))&&!(n==="horizontal"&&["ArrowUp","ArrowDown"].includes(o)))return Vu[o]}function Vs(e,n=!1){const t=document.activeElement;for(const o of e)if(o===t||(o.focus({preventScroll:n}),document.activeElement!==t))return}function zu(e,n){return e.map((t,o)=>e[(n+o)%e.length])}var Hs=Os,Gs=Ls,Bu=function(e){if(typeof document>"u")return null;var n=Array.isArray(e)?e[0]:e;return n.ownerDocument.body},it=new WeakMap,Lt=new WeakMap,Vt={},Ln=0,zs=function(e){return e&&(e.host||zs(e.parentNode))},Uu=function(e,n){return n.map(function(t){if(e.contains(t))return t;var o=zs(t);return o&&e.contains(o)?o:(console.error("aria-hidden",t,"in not contained inside",e,". Doing nothing"),null)}).filter(function(t){return!!t})},Wu=function(e,n,t,o){var r=Uu(n,Array.isArray(e)?e:[e]);Vt[t]||(Vt[t]=new WeakMap);var s=Vt[t],i=[],l=new Set,u=new Set(r),f=function(m){!m||l.has(m)||(l.add(m),f(m.parentNode))};r.forEach(f);var g=function(m){!m||u.has(m)||Array.prototype.forEach.call(m.children,function(d){if(l.has(d))g(d);else try{var c=d.getAttribute(o),v=c!==null&&c!=="false",p=(it.get(d)||0)+1,w=(s.get(d)||0)+1;it.set(d,p),s.set(d,w),i.push(d),p===1&&v&&Lt.set(d,!0),w===1&&d.setAttribute(t,"true"),v||d.setAttribute(o,"true")}catch(x){console.error("aria-hidden: cannot operate on ",d,x)}})};return g(n),l.clear(),Ln++,function(){i.forEach(function(m){var d=it.get(m)-1,c=s.get(m)-1;it.set(m,d),s.set(m,c),d||(Lt.has(m)||m.removeAttribute(o),Lt.delete(m)),c||m.removeAttribute(t)}),Ln--,Ln||(it=new WeakMap,it=new WeakMap,Lt=new WeakMap,Vt={})}},Ku=function(e,n,t){t===void 0&&(t="data-aria-hidden");var o=Array.from(Array.isArray(e)?e:[e]),r=Bu(e);return r?(o.push.apply(o,Array.from(r.querySelectorAll("[aria-live], script"))),Wu(o,r,t,"aria-hidden")):function(){return null}},ye=function(){return ye=Object.assign||function(n){for(var t,o=1,r=arguments.length;o<r;o++){t=arguments[o];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(n[s]=t[s])}return n},ye.apply(this,arguments)};function Bs(e,n){var t={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&n.indexOf(o)<0&&(t[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(e);r<o.length;r++)n.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(t[o[r]]=e[o[r]]);return t}function qu(e,n,t){if(t||arguments.length===2)for(var o=0,r=n.length,s;o<r;o++)(s||!(o in n))&&(s||(s=Array.prototype.slice.call(n,0,o)),s[o]=n[o]);return e.concat(s||Array.prototype.slice.call(n))}var Wt="right-scroll-bar-position",Kt="width-before-scroll-bar",Xu="with-scroll-bars-hidden",Yu="--removed-body-scroll-bar-size";function Vn(e,n){return typeof e=="function"?e(n):e&&(e.current=n),e}function Ju(e,n){var t=h.useState(function(){return{value:e,callback:n,facade:{get current(){return t.value},set current(o){var r=t.value;r!==o&&(t.value=o,t.callback(o,r))}}}})[0];return t.callback=n,t.facade}var Zu=typeof window<"u"?h.useLayoutEffect:h.useEffect,hr=new WeakMap;function Qu(e,n){var t=Ju(null,function(o){return e.forEach(function(r){return Vn(r,o)})});return Zu(function(){var o=hr.get(t);if(o){var r=new Set(o),s=new Set(e),i=t.current;r.forEach(function(l){s.has(l)||Vn(l,null)}),s.forEach(function(l){r.has(l)||Vn(l,i)})}hr.set(t,e)},[e]),t}function ed(e){return e}function td(e,n){n===void 0&&(n=ed);var t=[],o=!1,r={read:function(){if(o)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return t.length?t[t.length-1]:e},useMedium:function(s){var i=n(s,o);return t.push(i),function(){t=t.filter(function(l){return l!==i})}},assignSyncMedium:function(s){for(o=!0;t.length;){var i=t;t=[],i.forEach(s)}t={push:function(l){return s(l)},filter:function(){return t}}},assignMedium:function(s){o=!0;var i=[];if(t.length){var l=t;t=[],l.forEach(s),i=t}var u=function(){var g=i;i=[],g.forEach(s)},f=function(){return Promise.resolve().then(u)};f(),t={push:function(g){i.push(g),f()},filter:function(g){return i=i.filter(g),t}}}};return r}function nd(e){e===void 0&&(e={});var n=td(null);return n.options=ye({async:!0,ssr:!1},e),n}var Us=function(e){var n=e.sideCar,t=Bs(e,["sideCar"]);if(!n)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var o=n.read();if(!o)throw new Error("Sidecar medium not found");return h.createElement(o,ye({},t))};Us.isSideCarExport=!0;function od(e,n){return e.useMedium(n),Us}var Ws=nd(),Hn=function(){},cn=h.forwardRef(function(e,n){var t=h.useRef(null),o=h.useState({onScrollCapture:Hn,onWheelCapture:Hn,onTouchMoveCapture:Hn}),r=o[0],s=o[1],i=e.forwardProps,l=e.children,u=e.className,f=e.removeScrollBar,g=e.enabled,m=e.shards,d=e.sideCar,c=e.noRelative,v=e.noIsolation,p=e.inert,w=e.allowPinchZoom,x=e.as,S=x===void 0?"div":x,C=e.gapMode,y=Bs(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),R=d,M=Qu([t,n]),b=ye(ye({},y),r);return h.createElement(h.Fragment,null,g&&h.createElement(R,{sideCar:Ws,removeScrollBar:f,shards:m,noRelative:c,noIsolation:v,inert:p,setCallbacks:s,allowPinchZoom:!!w,lockRef:t,gapMode:C}),i?h.cloneElement(h.Children.only(l),ye(ye({},b),{ref:M})):h.createElement(S,ye({},b,{className:u,ref:M}),l))});cn.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};cn.classNames={fullWidth:Kt,zeroRight:Wt};var rd=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function sd(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var n=rd();return n&&e.setAttribute("nonce",n),e}function id(e,n){e.styleSheet?e.styleSheet.cssText=n:e.appendChild(document.createTextNode(n))}function ad(e){var n=document.head||document.getElementsByTagName("head")[0];n.appendChild(e)}var ld=function(){var e=0,n=null;return{add:function(t){e==0&&(n=sd())&&(id(n,t),ad(n)),e++},remove:function(){e--,!e&&n&&(n.parentNode&&n.parentNode.removeChild(n),n=null)}}},cd=function(){var e=ld();return function(n,t){h.useEffect(function(){return e.add(n),function(){e.remove()}},[n&&t])}},Ks=function(){var e=cd(),n=function(t){var o=t.styles,r=t.dynamic;return e(o,r),null};return n},ud={left:0,top:0,right:0,gap:0},Gn=function(e){return parseInt(e||"",10)||0},dd=function(e){var n=window.getComputedStyle(document.body),t=n[e==="padding"?"paddingLeft":"marginLeft"],o=n[e==="padding"?"paddingTop":"marginTop"],r=n[e==="padding"?"paddingRight":"marginRight"];return[Gn(t),Gn(o),Gn(r)]},fd=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return ud;var n=dd(e),t=document.documentElement.clientWidth,o=window.innerWidth;return{left:n[0],top:n[1],right:n[2],gap:Math.max(0,o-t+n[2]-n[0])}},gd=Ks(),gt="data-scroll-locked",md=function(e,n,t,o){var r=e.left,s=e.top,i=e.right,l=e.gap;return t===void 0&&(t="margin"),`
76
- .`.concat(Xu,` {
77
- overflow: hidden `).concat(o,`;
78
- padding-right: `).concat(l,"px ").concat(o,`;
79
- }
80
- body[`).concat(gt,`] {
81
- overflow: hidden `).concat(o,`;
82
- overscroll-behavior: contain;
83
- `).concat([n&&"position: relative ".concat(o,";"),t==="margin"&&`
84
- padding-left: `.concat(r,`px;
85
- padding-top: `).concat(s,`px;
86
- padding-right: `).concat(i,`px;
87
- margin-left:0;
88
- margin-top:0;
89
- margin-right: `).concat(l,"px ").concat(o,`;
90
- `),t==="padding"&&"padding-right: ".concat(l,"px ").concat(o,";")].filter(Boolean).join(""),`
91
- }
92
-
93
- .`).concat(Wt,` {
94
- right: `).concat(l,"px ").concat(o,`;
95
- }
96
-
97
- .`).concat(Kt,` {
98
- margin-right: `).concat(l,"px ").concat(o,`;
99
- }
100
-
101
- .`).concat(Wt," .").concat(Wt,` {
102
- right: 0 `).concat(o,`;
103
- }
104
-
105
- .`).concat(Kt," .").concat(Kt,` {
106
- margin-right: 0 `).concat(o,`;
107
- }
108
-
109
- body[`).concat(gt,`] {
110
- `).concat(Yu,": ").concat(l,`px;
111
- }
112
- `)},vr=function(){var e=parseInt(document.body.getAttribute(gt)||"0",10);return isFinite(e)?e:0},pd=function(){h.useEffect(function(){return document.body.setAttribute(gt,(vr()+1).toString()),function(){var e=vr()-1;e<=0?document.body.removeAttribute(gt):document.body.setAttribute(gt,e.toString())}},[])},hd=function(e){var n=e.noRelative,t=e.noImportant,o=e.gapMode,r=o===void 0?"margin":o;pd();var s=h.useMemo(function(){return fd(r)},[r]);return h.createElement(gd,{styles:md(s,!n,r,t?"":"!important")})},uo=!1;if(typeof window<"u")try{var Ht=Object.defineProperty({},"passive",{get:function(){return uo=!0,!0}});window.addEventListener("test",Ht,Ht),window.removeEventListener("test",Ht,Ht)}catch{uo=!1}var at=uo?{passive:!1}:!1,vd=function(e){return e.tagName==="TEXTAREA"},qs=function(e,n){if(!(e instanceof Element))return!1;var t=window.getComputedStyle(e);return t[n]!=="hidden"&&!(t.overflowY===t.overflowX&&!vd(e)&&t[n]==="visible")},xd=function(e){return qs(e,"overflowY")},wd=function(e){return qs(e,"overflowX")},xr=function(e,n){var t=n.ownerDocument,o=n;do{typeof ShadowRoot<"u"&&o instanceof ShadowRoot&&(o=o.host);var r=Xs(e,o);if(r){var s=Ys(e,o),i=s[1],l=s[2];if(i>l)return!0}o=o.parentNode}while(o&&o!==t.body);return!1},Sd=function(e){var n=e.scrollTop,t=e.scrollHeight,o=e.clientHeight;return[n,t,o]},Cd=function(e){var n=e.scrollLeft,t=e.scrollWidth,o=e.clientWidth;return[n,t,o]},Xs=function(e,n){return e==="v"?xd(n):wd(n)},Ys=function(e,n){return e==="v"?Sd(n):Cd(n)},yd=function(e,n){return e==="h"&&n==="rtl"?-1:1},Rd=function(e,n,t,o,r){var s=yd(e,window.getComputedStyle(n).direction),i=s*o,l=t.target,u=n.contains(l),f=!1,g=i>0,m=0,d=0;do{if(!l)break;var c=Ys(e,l),v=c[0],p=c[1],w=c[2],x=p-w-s*v;(v||x)&&Xs(e,l)&&(m+=x,d+=v);var S=l.parentNode;l=S&&S.nodeType===Node.DOCUMENT_FRAGMENT_NODE?S.host:S}while(!u&&l!==document.body||u&&(n.contains(l)||n===l));return(g&&Math.abs(m)<1||!g&&Math.abs(d)<1)&&(f=!0),f},Gt=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},wr=function(e){return[e.deltaX,e.deltaY]},Sr=function(e){return e&&"current"in e?e.current:e},bd=function(e,n){return e[0]===n[0]&&e[1]===n[1]},Md=function(e){return`
113
- .block-interactivity-`.concat(e,` {pointer-events: none;}
114
- .allow-interactivity-`).concat(e,` {pointer-events: all;}
115
- `)},Ed=0,lt=[];function _d(e){var n=h.useRef([]),t=h.useRef([0,0]),o=h.useRef(),r=h.useState(Ed++)[0],s=h.useState(Ks)[0],i=h.useRef(e);h.useEffect(function(){i.current=e},[e]),h.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(r));var p=qu([e.lockRef.current],(e.shards||[]).map(Sr),!0).filter(Boolean);return p.forEach(function(w){return w.classList.add("allow-interactivity-".concat(r))}),function(){document.body.classList.remove("block-interactivity-".concat(r)),p.forEach(function(w){return w.classList.remove("allow-interactivity-".concat(r))})}}},[e.inert,e.lockRef.current,e.shards]);var l=h.useCallback(function(p,w){if("touches"in p&&p.touches.length===2||p.type==="wheel"&&p.ctrlKey)return!i.current.allowPinchZoom;var x=Gt(p),S=t.current,C="deltaX"in p?p.deltaX:S[0]-x[0],y="deltaY"in p?p.deltaY:S[1]-x[1],R,M=p.target,b=Math.abs(C)>Math.abs(y)?"h":"v";if("touches"in p&&b==="h"&&M.type==="range")return!1;var E=xr(b,M);if(!E)return!0;if(E?R=b:(R=b==="v"?"h":"v",E=xr(b,M)),!E)return!1;if(!o.current&&"changedTouches"in p&&(C||y)&&(o.current=R),!R)return!0;var $=o.current||R;return Rd($,w,p,$==="h"?C:y)},[]),u=h.useCallback(function(p){var w=p;if(!(!lt.length||lt[lt.length-1]!==s)){var x="deltaY"in w?wr(w):Gt(w),S=n.current.filter(function(R){return R.name===w.type&&(R.target===w.target||w.target===R.shadowParent)&&bd(R.delta,x)})[0];if(S&&S.should){w.cancelable&&w.preventDefault();return}if(!S){var C=(i.current.shards||[]).map(Sr).filter(Boolean).filter(function(R){return R.contains(w.target)}),y=C.length>0?l(w,C[0]):!i.current.noIsolation;y&&w.cancelable&&w.preventDefault()}}},[]),f=h.useCallback(function(p,w,x,S){var C={name:p,delta:w,target:x,should:S,shadowParent:jd(x)};n.current.push(C),setTimeout(function(){n.current=n.current.filter(function(y){return y!==C})},1)},[]),g=h.useCallback(function(p){t.current=Gt(p),o.current=void 0},[]),m=h.useCallback(function(p){f(p.type,wr(p),p.target,l(p,e.lockRef.current))},[]),d=h.useCallback(function(p){f(p.type,Gt(p),p.target,l(p,e.lockRef.current))},[]);h.useEffect(function(){return lt.push(s),e.setCallbacks({onScrollCapture:m,onWheelCapture:m,onTouchMoveCapture:d}),document.addEventListener("wheel",u,at),document.addEventListener("touchmove",u,at),document.addEventListener("touchstart",g,at),function(){lt=lt.filter(function(p){return p!==s}),document.removeEventListener("wheel",u,at),document.removeEventListener("touchmove",u,at),document.removeEventListener("touchstart",g,at)}},[]);var c=e.removeScrollBar,v=e.inert;return h.createElement(h.Fragment,null,v?h.createElement(s,{styles:Md(r)}):null,c?h.createElement(hd,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function jd(e){for(var n=null;e!==null;)e instanceof ShadowRoot&&(n=e.host,e=e.host),e=e.parentNode;return n}const Pd=od(Ws,_d);var Js=h.forwardRef(function(e,n){return h.createElement(cn,ye({},e,{ref:n,sideCar:Pd}))});Js.classNames=cn.classNames;var fo=["Enter"," "],Nd=["ArrowDown","PageUp","Home"],Zs=["ArrowUp","PageDown","End"],Ad=[...Nd,...Zs],Fd={ltr:[...fo,"ArrowRight"],rtl:[...fo,"ArrowLeft"]},Td={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Nt="Menu",[Mt,Id,Dd]=ls(Nt),[rt,Qs]=nt(Nt,[Dd,Es,ln]),un=Es(),ei=ln(),[$d,st]=rt(Nt),[Od,At]=rt(Nt),ti=e=>{const{__scopeMenu:n,open:t=!1,children:o,dir:r,onOpenChange:s,modal:i=!0}=e,l=un(n),[u,f]=h.useState(null),g=h.useRef(!1),m=Oe(s),d=Co(r);return h.useEffect(()=>{const c=()=>{g.current=!0,document.addEventListener("pointerdown",v,{capture:!0,once:!0}),document.addEventListener("pointermove",v,{capture:!0,once:!0})},v=()=>g.current=!1;return document.addEventListener("keydown",c,{capture:!0}),()=>{document.removeEventListener("keydown",c,{capture:!0}),document.removeEventListener("pointerdown",v,{capture:!0}),document.removeEventListener("pointermove",v,{capture:!0})}},[]),a.jsx(Pu,{...l,children:a.jsx($d,{scope:n,open:t,onOpenChange:m,content:u,onContentChange:f,children:a.jsx(Od,{scope:n,onClose:h.useCallback(()=>m(!1),[m]),isUsingKeyboardRef:g,dir:d,modal:i,children:o})})})};ti.displayName=Nt;var kd="MenuAnchor",Ao=h.forwardRef((e,n)=>{const{__scopeMenu:t,...o}=e,r=un(t);return a.jsx(Nu,{...r,...o,ref:n})});Ao.displayName=kd;var Fo="MenuPortal",[Ld,ni]=rt(Fo,{forceMount:void 0}),oi=e=>{const{__scopeMenu:n,forceMount:t,children:o,container:r}=e,s=st(Fo,n);return a.jsx(Ld,{scope:n,forceMount:t,children:a.jsx(ot,{present:t||s.open,children:a.jsx(Ds,{asChild:!0,container:r,children:o})})})};oi.displayName=Fo;var ge="MenuContent",[Vd,To]=rt(ge),ri=h.forwardRef((e,n)=>{const t=ni(ge,e.__scopeMenu),{forceMount:o=t.forceMount,...r}=e,s=st(ge,e.__scopeMenu),i=At(ge,e.__scopeMenu);return a.jsx(Mt.Provider,{scope:e.__scopeMenu,children:a.jsx(ot,{present:o||s.open,children:a.jsx(Mt.Slot,{scope:e.__scopeMenu,children:i.modal?a.jsx(Hd,{...r,ref:n}):a.jsx(Gd,{...r,ref:n})})})})}),Hd=h.forwardRef((e,n)=>{const t=st(ge,e.__scopeMenu),o=h.useRef(null),r=te(n,o);return h.useEffect(()=>{const s=o.current;if(s)return Ku(s)},[]),a.jsx(Io,{...e,ref:r,trapFocus:t.open,disableOutsidePointerEvents:t.open,disableOutsideScroll:!0,onFocusOutside:k(e.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>t.onOpenChange(!1)})}),Gd=h.forwardRef((e,n)=>{const t=st(ge,e.__scopeMenu);return a.jsx(Io,{...e,ref:n,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>t.onOpenChange(!1)})}),zd=Bn("MenuContent.ScrollLock"),Io=h.forwardRef((e,n)=>{const{__scopeMenu:t,loop:o=!1,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:i,disableOutsidePointerEvents:l,onEntryFocus:u,onEscapeKeyDown:f,onPointerDownOutside:g,onFocusOutside:m,onInteractOutside:d,onDismiss:c,disableOutsideScroll:v,...p}=e,w=st(ge,t),x=At(ge,t),S=un(t),C=ei(t),y=Id(t),[R,M]=h.useState(null),b=h.useRef(null),E=te(n,b,w.onContentChange),$=h.useRef(0),I=h.useRef(""),V=h.useRef(0),G=h.useRef(null),O=h.useRef("right"),L=h.useRef(0),D=v?Js:h.Fragment,P=v?{as:zd,allowPinchZoom:!0}:void 0,T=_=>{var de,Je;const U=I.current+_,W=y().filter(ie=>!ie.disabled),Y=document.activeElement,xe=(de=W.find(ie=>ie.ref.current===Y))==null?void 0:de.textValue,_e=W.map(ie=>ie.textValue),je=tf(_e,U,xe),we=(Je=W.find(ie=>ie.textValue===je))==null?void 0:Je.ref.current;(function ie(me){I.current=me,window.clearTimeout($.current),me!==""&&($.current=window.setTimeout(()=>ie(""),1e3))})(U),we&&setTimeout(()=>we.focus())};h.useEffect(()=>()=>window.clearTimeout($.current),[]),fc();const j=h.useCallback(_=>{var W,Y;return O.current===((W=G.current)==null?void 0:W.side)&&of(_,(Y=G.current)==null?void 0:Y.area)},[]);return a.jsx(Vd,{scope:t,searchRef:I,onItemEnter:h.useCallback(_=>{j(_)&&_.preventDefault()},[j]),onItemLeave:h.useCallback(_=>{var U;j(_)||((U=b.current)==null||U.focus(),M(null))},[j]),onTriggerLeave:h.useCallback(_=>{j(_)&&_.preventDefault()},[j]),pointerGraceTimerRef:V,onPointerGraceIntentChange:h.useCallback(_=>{G.current=_},[]),children:a.jsx(D,{...P,children:a.jsx(fs,{asChild:!0,trapped:r,onMountAutoFocus:k(s,_=>{var U;_.preventDefault(),(U=b.current)==null||U.focus({preventScroll:!0})}),onUnmountAutoFocus:i,children:a.jsx(us,{asChild:!0,disableOutsidePointerEvents:l,onEscapeKeyDown:f,onPointerDownOutside:g,onFocusOutside:m,onInteractOutside:d,onDismiss:c,children:a.jsx(Hs,{asChild:!0,...C,dir:x.dir,orientation:"vertical",loop:o,currentTabStopId:R,onCurrentTabStopIdChange:M,onEntryFocus:k(u,_=>{x.isUsingKeyboardRef.current||_.preventDefault()}),preventScrollOnEntryFocus:!0,children:a.jsx(Au,{role:"menu","aria-orientation":"vertical","data-state":Si(w.open),"data-radix-menu-content":"",dir:x.dir,...S,...p,ref:E,style:{outline:"none",...p.style},onKeyDown:k(p.onKeyDown,_=>{const W=_.target.closest("[data-radix-menu-content]")===_.currentTarget,Y=_.ctrlKey||_.altKey||_.metaKey,xe=_.key.length===1;W&&(_.key==="Tab"&&_.preventDefault(),!Y&&xe&&T(_.key));const _e=b.current;if(_.target!==_e||!Ad.includes(_.key))return;_.preventDefault();const we=y().filter(de=>!de.disabled).map(de=>de.ref.current);Zs.includes(_.key)&&we.reverse(),Qd(we)}),onBlur:k(e.onBlur,_=>{_.currentTarget.contains(_.target)||(window.clearTimeout($.current),I.current="")}),onPointerMove:k(e.onPointerMove,Et(_=>{const U=_.target,W=L.current!==_.clientX;if(_.currentTarget.contains(U)&&W){const Y=_.clientX>L.current?"right":"left";O.current=Y,L.current=_.clientX}}))})})})})})})});ri.displayName=ge;var Bd="MenuGroup",Do=h.forwardRef((e,n)=>{const{__scopeMenu:t,...o}=e;return a.jsx(X.div,{role:"group",...o,ref:n})});Do.displayName=Bd;var Ud="MenuLabel",si=h.forwardRef((e,n)=>{const{__scopeMenu:t,...o}=e;return a.jsx(X.div,{...o,ref:n})});si.displayName=Ud;var Qt="MenuItem",Cr="menu.itemSelect",dn=h.forwardRef((e,n)=>{const{disabled:t=!1,onSelect:o,...r}=e,s=h.useRef(null),i=At(Qt,e.__scopeMenu),l=To(Qt,e.__scopeMenu),u=te(n,s),f=h.useRef(!1),g=()=>{const m=s.current;if(!t&&m){const d=new CustomEvent(Cr,{bubbles:!0,cancelable:!0});m.addEventListener(Cr,c=>o==null?void 0:o(c),{once:!0}),jr(m,d),d.defaultPrevented?f.current=!1:i.onClose()}};return a.jsx(ii,{...r,ref:u,disabled:t,onClick:k(e.onClick,g),onPointerDown:m=>{var d;(d=e.onPointerDown)==null||d.call(e,m),f.current=!0},onPointerUp:k(e.onPointerUp,m=>{var d;f.current||(d=m.currentTarget)==null||d.click()}),onKeyDown:k(e.onKeyDown,m=>{const d=l.searchRef.current!=="";t||d&&m.key===" "||fo.includes(m.key)&&(m.currentTarget.click(),m.preventDefault())})})});dn.displayName=Qt;var ii=h.forwardRef((e,n)=>{const{__scopeMenu:t,disabled:o=!1,textValue:r,...s}=e,i=To(Qt,t),l=ei(t),u=h.useRef(null),f=te(n,u),[g,m]=h.useState(!1),[d,c]=h.useState("");return h.useEffect(()=>{const v=u.current;v&&c((v.textContent??"").trim())},[s.children]),a.jsx(Mt.ItemSlot,{scope:t,disabled:o,textValue:r??d,children:a.jsx(Gs,{asChild:!0,...l,focusable:!o,children:a.jsx(X.div,{role:"menuitem","data-highlighted":g?"":void 0,"aria-disabled":o||void 0,"data-disabled":o?"":void 0,...s,ref:f,onPointerMove:k(e.onPointerMove,Et(v=>{o?i.onItemLeave(v):(i.onItemEnter(v),v.defaultPrevented||v.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:k(e.onPointerLeave,Et(v=>i.onItemLeave(v))),onFocus:k(e.onFocus,()=>m(!0)),onBlur:k(e.onBlur,()=>m(!1))})})})}),Wd="MenuCheckboxItem",ai=h.forwardRef((e,n)=>{const{checked:t=!1,onCheckedChange:o,...r}=e;return a.jsx(fi,{scope:e.__scopeMenu,checked:t,children:a.jsx(dn,{role:"menuitemcheckbox","aria-checked":en(t)?"mixed":t,...r,ref:n,"data-state":Oo(t),onSelect:k(r.onSelect,()=>o==null?void 0:o(en(t)?!0:!t),{checkForDefaultPrevented:!1})})})});ai.displayName=Wd;var li="MenuRadioGroup",[Kd,qd]=rt(li,{value:void 0,onValueChange:()=>{}}),ci=h.forwardRef((e,n)=>{const{value:t,onValueChange:o,...r}=e,s=Oe(o);return a.jsx(Kd,{scope:e.__scopeMenu,value:t,onValueChange:s,children:a.jsx(Do,{...r,ref:n})})});ci.displayName=li;var ui="MenuRadioItem",di=h.forwardRef((e,n)=>{const{value:t,...o}=e,r=qd(ui,e.__scopeMenu),s=t===r.value;return a.jsx(fi,{scope:e.__scopeMenu,checked:s,children:a.jsx(dn,{role:"menuitemradio","aria-checked":s,...o,ref:n,"data-state":Oo(s),onSelect:k(o.onSelect,()=>{var i;return(i=r.onValueChange)==null?void 0:i.call(r,t)},{checkForDefaultPrevented:!1})})})});di.displayName=ui;var $o="MenuItemIndicator",[fi,Xd]=rt($o,{checked:!1}),gi=h.forwardRef((e,n)=>{const{__scopeMenu:t,forceMount:o,...r}=e,s=Xd($o,t);return a.jsx(ot,{present:o||en(s.checked)||s.checked===!0,children:a.jsx(X.span,{...r,ref:n,"data-state":Oo(s.checked)})})});gi.displayName=$o;var Yd="MenuSeparator",mi=h.forwardRef((e,n)=>{const{__scopeMenu:t,...o}=e;return a.jsx(X.div,{role:"separator","aria-orientation":"horizontal",...o,ref:n})});mi.displayName=Yd;var Jd="MenuArrow",pi=h.forwardRef((e,n)=>{const{__scopeMenu:t,...o}=e,r=un(t);return a.jsx(Fu,{...r,...o,ref:n})});pi.displayName=Jd;var Zd="MenuSub",[Ng,hi]=rt(Zd),wt="MenuSubTrigger",vi=h.forwardRef((e,n)=>{const t=st(wt,e.__scopeMenu),o=At(wt,e.__scopeMenu),r=hi(wt,e.__scopeMenu),s=To(wt,e.__scopeMenu),i=h.useRef(null),{pointerGraceTimerRef:l,onPointerGraceIntentChange:u}=s,f={__scopeMenu:e.__scopeMenu},g=h.useCallback(()=>{i.current&&window.clearTimeout(i.current),i.current=null},[]);return h.useEffect(()=>g,[g]),h.useEffect(()=>{const m=l.current;return()=>{window.clearTimeout(m),u(null)}},[l,u]),a.jsx(Ao,{asChild:!0,...f,children:a.jsx(ii,{id:r.triggerId,"aria-haspopup":"menu","aria-expanded":t.open,"aria-controls":r.contentId,"data-state":Si(t.open),...e,ref:Pr(n,r.onTriggerChange),onClick:m=>{var d;(d=e.onClick)==null||d.call(e,m),!(e.disabled||m.defaultPrevented)&&(m.currentTarget.focus(),t.open||t.onOpenChange(!0))},onPointerMove:k(e.onPointerMove,Et(m=>{s.onItemEnter(m),!m.defaultPrevented&&!e.disabled&&!t.open&&!i.current&&(s.onPointerGraceIntentChange(null),i.current=window.setTimeout(()=>{t.onOpenChange(!0),g()},100))})),onPointerLeave:k(e.onPointerLeave,Et(m=>{var c,v;g();const d=(c=t.content)==null?void 0:c.getBoundingClientRect();if(d){const p=(v=t.content)==null?void 0:v.dataset.side,w=p==="right",x=w?-5:5,S=d[w?"left":"right"],C=d[w?"right":"left"];s.onPointerGraceIntentChange({area:[{x:m.clientX+x,y:m.clientY},{x:S,y:d.top},{x:C,y:d.top},{x:C,y:d.bottom},{x:S,y:d.bottom}],side:p}),window.clearTimeout(l.current),l.current=window.setTimeout(()=>s.onPointerGraceIntentChange(null),300)}else{if(s.onTriggerLeave(m),m.defaultPrevented)return;s.onPointerGraceIntentChange(null)}})),onKeyDown:k(e.onKeyDown,m=>{var c;const d=s.searchRef.current!=="";e.disabled||d&&m.key===" "||Fd[o.dir].includes(m.key)&&(t.onOpenChange(!0),(c=t.content)==null||c.focus(),m.preventDefault())})})})});vi.displayName=wt;var xi="MenuSubContent",wi=h.forwardRef((e,n)=>{const t=ni(ge,e.__scopeMenu),{forceMount:o=t.forceMount,...r}=e,s=st(ge,e.__scopeMenu),i=At(ge,e.__scopeMenu),l=hi(xi,e.__scopeMenu),u=h.useRef(null),f=te(n,u);return a.jsx(Mt.Provider,{scope:e.__scopeMenu,children:a.jsx(ot,{present:o||s.open,children:a.jsx(Mt.Slot,{scope:e.__scopeMenu,children:a.jsx(Io,{id:l.contentId,"aria-labelledby":l.triggerId,...r,ref:f,align:"start",side:i.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:g=>{var m;i.isUsingKeyboardRef.current&&((m=u.current)==null||m.focus()),g.preventDefault()},onCloseAutoFocus:g=>g.preventDefault(),onFocusOutside:k(e.onFocusOutside,g=>{g.target!==l.trigger&&s.onOpenChange(!1)}),onEscapeKeyDown:k(e.onEscapeKeyDown,g=>{i.onClose(),g.preventDefault()}),onKeyDown:k(e.onKeyDown,g=>{var c;const m=g.currentTarget.contains(g.target),d=Td[i.dir].includes(g.key);m&&d&&(s.onOpenChange(!1),(c=l.trigger)==null||c.focus(),g.preventDefault())})})})})})});wi.displayName=xi;function Si(e){return e?"open":"closed"}function en(e){return e==="indeterminate"}function Oo(e){return en(e)?"indeterminate":e?"checked":"unchecked"}function Qd(e){const n=document.activeElement;for(const t of e)if(t===n||(t.focus(),document.activeElement!==n))return}function ef(e,n){return e.map((t,o)=>e[(n+o)%e.length])}function tf(e,n,t){const r=n.length>1&&Array.from(n).every(f=>f===n[0])?n[0]:n,s=t?e.indexOf(t):-1;let i=ef(e,Math.max(s,0));r.length===1&&(i=i.filter(f=>f!==t));const u=i.find(f=>f.toLowerCase().startsWith(r.toLowerCase()));return u!==t?u:void 0}function nf(e,n){const{x:t,y:o}=e;let r=!1;for(let s=0,i=n.length-1;s<n.length;i=s++){const l=n[s],u=n[i],f=l.x,g=l.y,m=u.x,d=u.y;g>o!=d>o&&t<(m-f)*(o-g)/(d-g)+f&&(r=!r)}return r}function of(e,n){if(!n)return!1;const t={x:e.clientX,y:e.clientY};return nf(t,n)}function Et(e){return n=>n.pointerType==="mouse"?e(n):void 0}var rf=ti,sf=Ao,af=oi,lf=ri,cf=Do,uf=si,df=dn,ff=ai,gf=ci,mf=di,pf=gi,hf=mi,vf=pi,xf=vi,wf=wi,fn="DropdownMenu",[Sf,Ag]=nt(fn,[Qs]),se=Qs(),[Cf,Ci]=Sf(fn),yi=e=>{const{__scopeDropdownMenu:n,children:t,dir:o,open:r,defaultOpen:s,onOpenChange:i,modal:l=!0}=e,u=se(n),f=h.useRef(null),[g,m]=tn({prop:r,defaultProp:s??!1,onChange:i,caller:fn});return a.jsx(Cf,{scope:n,triggerId:qt(),triggerRef:f,contentId:qt(),open:g,onOpenChange:m,onOpenToggle:h.useCallback(()=>m(d=>!d),[m]),modal:l,children:a.jsx(rf,{...u,open:g,onOpenChange:m,dir:o,modal:l,children:t})})};yi.displayName=fn;var Ri="DropdownMenuTrigger",bi=h.forwardRef((e,n)=>{const{__scopeDropdownMenu:t,disabled:o=!1,...r}=e,s=Ci(Ri,t),i=se(t);return a.jsx(sf,{asChild:!0,...i,children:a.jsx(X.button,{type:"button",id:s.triggerId,"aria-haspopup":"menu","aria-expanded":s.open,"aria-controls":s.open?s.contentId:void 0,"data-state":s.open?"open":"closed","data-disabled":o?"":void 0,disabled:o,...r,ref:Pr(n,s.triggerRef),onPointerDown:k(e.onPointerDown,l=>{!o&&l.button===0&&l.ctrlKey===!1&&(s.onOpenToggle(),s.open||l.preventDefault())}),onKeyDown:k(e.onKeyDown,l=>{o||(["Enter"," "].includes(l.key)&&s.onOpenToggle(),l.key==="ArrowDown"&&s.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(l.key)&&l.preventDefault())})})})});bi.displayName=Ri;var yf="DropdownMenuPortal",Mi=e=>{const{__scopeDropdownMenu:n,...t}=e,o=se(n);return a.jsx(af,{...o,...t})};Mi.displayName=yf;var Ei="DropdownMenuContent",_i=h.forwardRef((e,n)=>{const{__scopeDropdownMenu:t,...o}=e,r=Ci(Ei,t),s=se(t),i=h.useRef(!1);return a.jsx(lf,{id:r.contentId,"aria-labelledby":r.triggerId,...s,...o,ref:n,onCloseAutoFocus:k(e.onCloseAutoFocus,l=>{var u;i.current||(u=r.triggerRef.current)==null||u.focus(),i.current=!1,l.preventDefault()}),onInteractOutside:k(e.onInteractOutside,l=>{const u=l.detail.originalEvent,f=u.button===0&&u.ctrlKey===!0,g=u.button===2||f;(!r.modal||g)&&(i.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});_i.displayName=Ei;var Rf="DropdownMenuGroup",bf=h.forwardRef((e,n)=>{const{__scopeDropdownMenu:t,...o}=e,r=se(t);return a.jsx(cf,{...r,...o,ref:n})});bf.displayName=Rf;var Mf="DropdownMenuLabel",Ef=h.forwardRef((e,n)=>{const{__scopeDropdownMenu:t,...o}=e,r=se(t);return a.jsx(uf,{...r,...o,ref:n})});Ef.displayName=Mf;var _f="DropdownMenuItem",jf=h.forwardRef((e,n)=>{const{__scopeDropdownMenu:t,...o}=e,r=se(t);return a.jsx(df,{...r,...o,ref:n})});jf.displayName=_f;var Pf="DropdownMenuCheckboxItem",ji=h.forwardRef((e,n)=>{const{__scopeDropdownMenu:t,...o}=e,r=se(t);return a.jsx(ff,{...r,...o,ref:n})});ji.displayName=Pf;var Nf="DropdownMenuRadioGroup",Af=h.forwardRef((e,n)=>{const{__scopeDropdownMenu:t,...o}=e,r=se(t);return a.jsx(gf,{...r,...o,ref:n})});Af.displayName=Nf;var Ff="DropdownMenuRadioItem",Tf=h.forwardRef((e,n)=>{const{__scopeDropdownMenu:t,...o}=e,r=se(t);return a.jsx(mf,{...r,...o,ref:n})});Tf.displayName=Ff;var If="DropdownMenuItemIndicator",Pi=h.forwardRef((e,n)=>{const{__scopeDropdownMenu:t,...o}=e,r=se(t);return a.jsx(pf,{...r,...o,ref:n})});Pi.displayName=If;var Df="DropdownMenuSeparator",$f=h.forwardRef((e,n)=>{const{__scopeDropdownMenu:t,...o}=e,r=se(t);return a.jsx(hf,{...r,...o,ref:n})});$f.displayName=Df;var Of="DropdownMenuArrow",kf=h.forwardRef((e,n)=>{const{__scopeDropdownMenu:t,...o}=e,r=se(t);return a.jsx(vf,{...r,...o,ref:n})});kf.displayName=Of;var Lf="DropdownMenuSubTrigger",Vf=h.forwardRef((e,n)=>{const{__scopeDropdownMenu:t,...o}=e,r=se(t);return a.jsx(xf,{...r,...o,ref:n})});Vf.displayName=Lf;var Hf="DropdownMenuSubContent",Gf=h.forwardRef((e,n)=>{const{__scopeDropdownMenu:t,...o}=e,r=se(t);return a.jsx(wf,{...r,...o,ref:n,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});Gf.displayName=Hf;var zf=yi,Bf=bi,Uf=Mi,Wf=_i,Kf=ji,qf=Pi;function Xf({...e}){return a.jsx(zf,{"data-slot":"dropdown-menu",...e})}function Yf({...e}){return a.jsx(Bf,{"data-slot":"dropdown-menu-trigger",...e})}function Jf({className:e,sideOffset:n=4,...t}){return a.jsx(Uf,{children:a.jsx(Wf,{"data-slot":"dropdown-menu-content",sideOffset:n,className:Z("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md",e),...t})})}function Zf({className:e,children:n,checked:t,...o}){return a.jsxs(Kf,{"data-slot":"dropdown-menu-checkbox-item",className:Z("focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),checked:t,...o,children:[a.jsx("span",{className:"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center",children:a.jsx(qf,{children:a.jsx(Kr,{className:"size-4"})})}),n]})}function ko({className:e,...n}){return a.jsx("div",{"data-slot":"table-container",className:"relative w-full overflow-x-auto",children:a.jsx("table",{"data-slot":"table",className:Z("w-full caption-bottom text-sm",e),...n})})}function Qf({className:e,...n}){return a.jsx("thead",{"data-slot":"table-header",className:Z("[&_tr]:border-b",e),...n})}function Lo({className:e,...n}){return a.jsx("tbody",{"data-slot":"table-body",className:Z("[&_tr:last-child]:border-0",e),...n})}function re({className:e,...n}){return a.jsx("tr",{"data-slot":"table-row",className:Z("hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",e),...n})}function eg({className:e,...n}){return a.jsx("th",{"data-slot":"table-head",className:Z("text-foreground h-10 px-2 text-left align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",e),...n})}function N({className:e,...n}){return a.jsx("td",{"data-slot":"table-cell",className:Z("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",e),...n})}function gn({columns:e,data:n,searchColumn:t,searchPlaceholder:o="Filter...",defaultColumnVisibility:r={},pageSize:s=25,defaultSorting:i=[]}){var w,x;const[l,u]=h.useState(i),[f,g]=h.useState([]),[m,d]=h.useState(r),[c,v]=h.useState({}),p=nc({data:n,columns:e,onSortingChange:u,onColumnFiltersChange:g,getCoreRowModel:Ul(),getPaginationRowModel:Jl(),getSortedRowModel:Zl(),getFilteredRowModel:Yl(),onColumnVisibilityChange:d,onRowSelectionChange:v,initialState:{pagination:{pageSize:s}},state:{sorting:l,columnFilters:f,columnVisibility:m,rowSelection:c}});return a.jsxs("div",{className:"w-full",children:[a.jsxs("div",{className:"flex items-center py-4",children:[t&&a.jsx(Qn,{placeholder:o,value:((w=p.getColumn(t))==null?void 0:w.getFilterValue())??"",onChange:S=>{var C;return(C=p.getColumn(t))==null?void 0:C.setFilterValue(S.target.value)},className:"max-w-sm"}),a.jsxs(Xf,{children:[a.jsx(Yf,{asChild:!0,children:a.jsxs(dt,{variant:"outline",className:"ml-auto",children:["Columns ",a.jsx(qr,{className:"ml-2 h-4 w-4"})]})}),a.jsx(Jf,{align:"end",children:p.getAllColumns().filter(S=>S.getCanHide()).map(S=>a.jsx(Zf,{className:"capitalize",checked:S.getIsVisible(),onCheckedChange:C=>S.toggleVisibility(!!C),children:S.id},S.id))})]})]}),a.jsx("div",{className:"rounded-md border",children:a.jsxs(ko,{children:[a.jsx(Qf,{children:p.getHeaderGroups().map(S=>a.jsx(re,{children:S.headers.map(C=>a.jsx(eg,{children:C.isPlaceholder?null:er(C.column.columnDef.header,C.getContext())},C.id))},S.id))}),a.jsx(Lo,{children:(x=p.getRowModel().rows)!=null&&x.length?p.getRowModel().rows.map(S=>a.jsx(re,{"data-state":S.getIsSelected()&&"selected",children:S.getVisibleCells().map(C=>a.jsx(N,{children:er(C.column.columnDef.cell,C.getContext())},C.id))},S.id)):a.jsx(re,{children:a.jsx(N,{colSpan:e.length,className:"h-24 text-center",children:"No results."})})})]})}),a.jsxs("div",{className:"flex items-center justify-end space-x-2 py-4",children:[a.jsxs("div",{className:"text-muted-foreground flex-1 text-sm",children:[p.getFilteredRowModel().rows.length," row(s) total."]}),a.jsxs("div",{className:"space-x-2",children:[a.jsx(dt,{variant:"outline",size:"sm",onClick:()=>p.previousPage(),disabled:!p.getCanPreviousPage(),children:"Previous"}),a.jsx(dt,{variant:"outline",size:"sm",onClick:()=>p.nextPage(),disabled:!p.getCanNextPage(),children:"Next"})]})]})]})}function q(e,n="left"){return({column:t})=>{const o=n==="right"?"justify-end":n==="center"?"justify-center":"justify-start",r=t.getIsSorted();return a.jsx("div",{className:`flex ${o}`,children:a.jsxs(dt,{variant:"ghost",onClick:()=>t.toggleSorting(t.getIsSorted()==="asc"),className:`${n==="right"?"ml-auto":""} hover:bg-muted/50 h-auto p-0 font-medium text-sm`,children:[e,r==="asc"&&a.jsx(Ga,{className:"ml-1 h-3 w-3 text-muted-foreground"}),r==="desc"&&a.jsx(qr,{className:"ml-1 h-3 w-3 text-muted-foreground"})]})})}}const tg=5*60*1e3;function Ni(e){const[n,t]=h.useState(new Map),o=h.useRef();return h.useEffect(()=>{const s=new Date().toISOString(),i=new Set(e.map(l=>l.id));t(l=>{const u=new Map(l);return e.forEach(f=>{u.set(f.id,{...f,lastSeenAt:s,disconnectedAt:void 0})}),u.forEach((f,g)=>{!i.has(g)&&!f.disconnectedAt&&u.set(g,{...f,isConnected:!1,connectionStatus:"Disconnected",disconnectedAt:s,lastActivity:f.lastActivity||s})}),u})},[e]),h.useEffect(()=>{const s=()=>{const i=Date.now();t(l=>{const u=new Map(l);return u.forEach((f,g)=>{if(f.disconnectedAt){const m=new Date(f.disconnectedAt).getTime();i-m>tg&&u.delete(g)}}),u})};return s(),o.current=setInterval(s,3e4),()=>{o.current&&clearInterval(o.current)}},[]),Array.from(n.values()).sort((s,i)=>s.isConnected!==i.isConnected?s.isConnected?-1:1:new Date(i.lastActivity).getTime()-new Date(s.lastActivity).getTime())}function yr(e){const n=new Date,t=new Date(e),o=n.getTime()-t.getTime(),r=Math.floor(o/1e3);if(r<60)return"just now";const s=Math.floor(r/60);if(s<60)return`${s}m ago`;const i=Math.floor(s/60);return i<24?`${i}h ago`:`${Math.floor(i/24)}d ago`}function ng(e){const n=Math.floor(e/86400),t=Math.floor(e%86400/3600),o=Math.floor(e%3600/60);return n>0?`${n}d ${t}h ${o}m`:t>0?`${t}h ${o}m`:`${o}m`}function og(e){return e.length<=12?e:`${e.slice(0,5)}...${e.slice(-5)}`}function rg(e){return e.length<=42?e:`${e.slice(0,35)}.....${e.slice(-5)}`}function sg({metrics:e}){const n=e.sessions||[],t=Ni(n),o=()=>[{accessorKey:"clientInfo",header:q("Client"),cell:({row:r})=>{const s=r.original,i=s.clientInfo?`${rg(s.clientInfo.name)}@${s.clientInfo.version}`:"unknown";return a.jsx("div",{className:"font-mono text-sm",title:s.clientInfo?`${s.clientInfo.name}@${s.clientInfo.version}`:"unknown",children:i})}},{accessorKey:"id",header:q("Session ID"),cell:({row:r})=>a.jsx("div",{className:"font-mono text-sm",title:r.getValue("id"),children:og(r.getValue("id"))})},{accessorKey:"isConnected",header:q("Status"),cell:({row:r})=>{const s=r.original;return a.jsxs(Ze,{variant:s.isConnected?"success":"secondary",className:"gap-1",children:[s.isConnected?a.jsx(Jr,{className:"h-3 w-3"}):a.jsx(Yr,{className:"h-3 w-3"}),s.isConnected?"Connected":"Disconnected"]})}},{accessorKey:"connectedAt",header:q("Connected"),cell:({row:r})=>a.jsx("div",{className:"text-sm",children:yr(r.getValue("connectedAt"))})},{accessorKey:"requestCount",header:q("Requests","right"),cell:({row:r})=>a.jsx("div",{className:"text-right font-mono text-sm",children:r.getValue("requestCount")})},{accessorKey:"lastActivity",header:q("Last Activity"),cell:({row:r})=>a.jsx("div",{className:"text-sm",children:yr(r.getValue("lastActivity"))})}];return a.jsxs(Te,{children:[a.jsxs(Ie,{children:[a.jsx(De,{children:"📊 Transport Metrics"}),a.jsx(tt,{children:"Real-time connection and performance metrics for STDIO transport"})]}),a.jsxs($e,{className:"space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"Transport Type"}),a.jsx("p",{className:"text-sm font-mono",children:"STDIO"})]}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"Uptime"}),a.jsx("p",{className:"text-sm font-mono",children:ng(e.uptimeSeconds)})]})]}),a.jsxs(a.Fragment,{children:[a.jsx(Qe,{}),a.jsxs("div",{children:[a.jsxs("h3",{className:"text-sm font-semibold text-foreground mb-3",children:["Sessions (",t.filter(r=>r.isConnected).length," active,"," ",t.filter(r=>!r.isConnected).length," disconnected)"]}),a.jsx(gn,{columns:o(),data:t,searchColumn:"id",searchPlaceholder:"Filter sessions...",pageSize:10,defaultSorting:[{id:"lastActivity",desc:!0}]})]})]})]})]})}function Rr(e){const n=new Date,t=new Date(e),o=n.getTime()-t.getTime(),r=Math.floor(o/1e3);if(r<60)return"just now";const s=Math.floor(r/60);if(s<60)return`${s}m ago`;const i=Math.floor(s/60);return i<24?`${i}h ago`:`${Math.floor(i/24)}d ago`}function ig(e){const n=Math.floor(e/86400),t=Math.floor(e%86400/3600),o=Math.floor(e%3600/60);return n>0?`${n}d ${t}h ${o}m`:t>0?`${t}h ${o}m`:`${o}m`}function zt(e){return e<1e3?`${e}ms`:e<6e4?`${Math.round(e/1e3)}s`:`${Math.round(e/6e4)}m`}function ag(e){return e.length<=12?e:`${e.slice(0,5)}...${e.slice(-5)}`}function lg(e){return e.length<=42?e:`${e.slice(0,35)}.....${e.slice(-5)}`}function cg({metrics:e}){const n=e.sessions||[],t=Ni(n),o={sse:"Server-Sent Events",streamableHttp:"Streamable HTTP"},r=()=>[{accessorKey:"clientInfo",header:q("Client"),cell:({row:s})=>{const i=s.original,l=i.clientInfo?`${lg(i.clientInfo.name)}@${i.clientInfo.version}`:"unknown";return a.jsx("div",{className:"font-mono text-sm",title:i.clientInfo?`${i.clientInfo.name}@${i.clientInfo.version}`:"unknown",children:l})}},{accessorKey:"id",header:q("Session ID"),cell:({row:s})=>a.jsx("div",{className:"font-mono text-sm",title:s.getValue("id"),children:ag(s.getValue("id"))})},{accessorKey:"connectionStatus",header:q("Status"),cell:({row:s})=>{const i=s.original,l=i.connectionStatus||(i.isConnected?"Connected":"Disconnected");return l==="Connected"?a.jsxs(Ze,{variant:"success",className:"gap-1",children:[a.jsx(Jr,{className:"h-3 w-3"}),"Connected"]}):l==="Distressed"?a.jsxs(Ze,{variant:"destructive",className:"gap-1",children:[a.jsx(Xr,{className:"h-3 w-3"}),"Distressed ",i.pingFailures?`(${i.pingFailures} failed)`:""]}):a.jsxs(Ze,{variant:"secondary",className:"gap-1",children:[a.jsx(Yr,{className:"h-3 w-3"}),"Disconnected"]})}},{accessorKey:"connectedAt",header:q("Connected"),cell:({row:s})=>a.jsx("div",{className:"text-sm",children:Rr(s.getValue("connectedAt"))})},{accessorKey:"requestCount",header:q("Requests","right"),cell:({row:s})=>a.jsx("div",{className:"text-right font-mono text-sm",children:s.getValue("requestCount")})},{accessorKey:"lastActivity",header:q("Last Activity"),cell:({row:s})=>a.jsx("div",{className:"text-sm",children:Rr(s.getValue("lastActivity"))})}];return a.jsxs(Te,{children:[a.jsxs(Ie,{children:[a.jsx(De,{children:"📊 Transport Metrics"}),a.jsxs(tt,{children:["Real-time connection and performance metrics for"," ",o[e.transport]||e.transport," transport"]})]}),a.jsxs($e,{className:"space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"Transport Type"}),a.jsx("p",{className:"text-sm font-mono",children:o[e.transport]||e.transport})]}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"Uptime"}),a.jsx("p",{className:"text-sm font-mono",children:ig(e.uptimeSeconds)})]})]}),e.configuration&&a.jsx(a.Fragment,{children:a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium text-muted-foreground mb-2",children:"Configuration"}),a.jsx("div",{className:"grid grid-cols-1 gap-2",children:e.pings&&a.jsx("div",{className:"text-xs text-muted-foreground bg-muted/30 p-2 rounded",children:e.pings.sent>0&&a.jsxs("p",{children:[a.jsx("span",{className:"font-medium",children:"Ping Status:"})," ",e.pings.successful,"/",e.pings.sent," successful (",e.pings.sent>0?Math.round(e.pings.successful/e.pings.sent*100):0,"%)"]})})}),a.jsxs("p",{className:"text-xs text-muted-foreground mt-2",children:["SSE connections checked every ",zt(e.configuration.heartbeatInterval||3e4),", sessions swept every ",zt(e.configuration.staleCheckInterval),", removed after"," ",zt(e.configuration.staleTimeout)," inactive",e.configuration.pingEnabled&&e.configuration.pingInterval&&`, pings sent every ${zt(e.configuration.pingInterval)}`,e.configuration.pingEnabled&&`, marked distressed after ${e.configuration.pingFailureThreshold||1} failed ping${(e.configuration.pingFailureThreshold||1)!==1?"s":""}`]})]})}),a.jsx(Qe,{}),a.jsx("div",{children:a.jsx(ko,{children:a.jsxs(Lo,{children:[a.jsxs(re,{children:[a.jsx(N,{className:"font-medium text-sm",children:"Active Connections"}),a.jsx(N,{className:"text-sm font-mono",children:e.connections.active}),a.jsx(N,{className:"font-medium text-sm",children:"Cleaned Sessions"}),a.jsx(N,{className:"text-sm font-mono",children:e.connections.cleaned??0})]}),a.jsxs(re,{children:[a.jsx(N,{className:"font-medium text-sm",children:"Total Connections"}),a.jsx(N,{className:"text-sm font-mono",children:e.connections.total}),a.jsx(N,{className:"font-medium text-sm",children:"Requests per Minute"}),a.jsx(N,{className:"text-sm font-mono",children:e.requests.averagePerMinute})]}),a.jsxs(re,{children:[a.jsx(N,{className:"font-medium text-sm",children:"Client Errors (4xx)"}),a.jsx(N,{className:"text-sm font-mono",children:e.errors.expected}),a.jsx(N,{className:"font-medium text-sm",children:"Server Errors (5xx)"}),a.jsx(N,{className:"text-sm font-mono",children:e.errors.unexpected})]}),e.pings&&a.jsxs(re,{children:[a.jsx(N,{className:"font-medium text-sm",children:"Pings Sent"}),a.jsx(N,{className:"text-sm font-mono",children:e.pings.sent}),a.jsx(N,{className:"font-medium text-sm",children:"Ping Success Rate"}),a.jsx(N,{className:"text-sm font-mono",children:e.pings.sent>0?`${Math.round(e.pings.successful/e.pings.sent*100)}%`:"-"})]}),e.apiMetrics&&a.jsxs(a.Fragment,{children:[a.jsxs(re,{children:[a.jsx(N,{className:"font-medium text-sm",children:"Anonymous Users"}),a.jsx(N,{className:"text-sm font-mono",children:e.apiMetrics.anonymous}),a.jsx(N,{className:"font-medium text-sm",children:"Authenticated Users"}),a.jsx(N,{className:"text-sm font-mono",children:e.apiMetrics.authenticated})]}),a.jsxs(re,{children:[a.jsx(N,{className:"font-medium text-sm",children:"401 Unauthorized Users"}),a.jsx(N,{className:"text-sm font-mono",children:e.apiMetrics.unauthorized}),a.jsx(N,{className:"font-medium text-sm",children:"403 Forbidden Users"}),a.jsx(N,{className:"text-sm font-mono",children:e.apiMetrics.forbidden})]})]})]})})}),a.jsxs(a.Fragment,{children:[a.jsx(Qe,{}),a.jsxs("div",{children:[a.jsxs("h3",{className:"text-sm font-semibold text-foreground mb-3",children:["Sessions (",t.filter(s=>s.isConnected).length," active,"," ",t.filter(s=>!s.isConnected).length," disconnected)"]}),a.jsx(gn,{columns:r(),data:t,searchColumn:"id",searchPlaceholder:"Filter sessions...",pageSize:10,defaultSorting:[{id:"lastActivity",desc:!0}]})]})]})]})]})}function br(e){const n=new Date,t=new Date(e),o=n.getTime()-t.getTime(),r=Math.floor(o/1e3);if(r<60)return"just now";const s=Math.floor(r/60);if(s<60)return`${s}m ago`;const i=Math.floor(s/60);return i<24?`${i}h ago`:`${Math.floor(i/24)}d ago`}function ug(e){const n=Math.floor(e/86400),t=Math.floor(e%86400/3600),o=Math.floor(e%3600/60);return n>0?`${n}d ${t}h ${o}m`:t>0?`${t}h ${o}m`:`${o}m`}function dg(e){const n=new Date,t=new Date(e),o=n.getTime()-t.getTime();return Math.floor(o/6e4)<5}function fg(e){return e.length<=42?e:`${e.slice(0,35)}.....${e.slice(-5)}`}function gg({metrics:e}){const n=e.clients,t=()=>[{accessorKey:"name",header:q("Client"),cell:({row:o})=>{const r=o.original,s=`${fg(r.name)}@${r.version}`;return a.jsxs("div",{children:[a.jsx("p",{className:"font-medium font-mono text-sm",title:`${r.name}@${r.version}`,children:s}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:["First seen ",br(r.firstSeen)]})]})}},{accessorKey:"requestCount",header:q("Initializations","right"),cell:({row:o})=>a.jsx("div",{className:"text-right font-mono text-sm",children:o.getValue("requestCount")})},{accessorKey:"isConnected",header:q("Status"),cell:({row:o})=>{const r=o.original;return a.jsx("div",{children:dg(r.lastSeen)?a.jsxs(Ze,{variant:"success",className:"gap-1",children:[a.jsx(ka,{className:"h-3 w-3"}),"Recent"]}):a.jsxs(Ze,{variant:"secondary",className:"gap-1",children:[a.jsx(Ba,{className:"h-3 w-3"}),"Idle"]})})}},{accessorKey:"lastSeen",header:q("Last Seen","right"),cell:({row:o})=>a.jsx("div",{className:"text-right text-sm",children:br(o.getValue("lastSeen"))})}];return a.jsxs(Te,{children:[a.jsxs(Ie,{children:[a.jsx(De,{children:"📊 Transport Metrics"}),a.jsx(tt,{children:"Real-time connection and performance metrics for Stateless HTTP JSON transport"})]}),a.jsxs($e,{className:"space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"Transport Type"}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("p",{className:"text-sm font-mono",children:"Stateless HTTP JSON"}),a.jsx(Ze,{variant:"secondary",children:"stateless"})]})]}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"Uptime"}),a.jsx("p",{className:"text-sm font-mono",children:ug(e.uptimeSeconds)})]})]}),a.jsx(Qe,{}),a.jsx("div",{children:a.jsx(ko,{children:a.jsxs(Lo,{children:[a.jsxs(re,{children:[a.jsx(N,{className:"font-medium text-sm",children:"Request Count (MCP)"}),a.jsx(N,{className:"text-sm font-mono",children:e.connections.total}),a.jsx(N,{className:"font-medium text-sm",children:"Requests per Minute"}),a.jsx(N,{className:"text-sm font-mono",children:e.requests.averagePerMinute})]}),a.jsxs(re,{children:[a.jsx(N,{className:"font-medium text-sm",children:"Client Errors (4xx)"}),a.jsx(N,{className:"text-sm font-mono",children:e.errors.expected}),a.jsx(N,{className:"font-medium text-sm",children:"Server Errors (5xx)"}),a.jsx(N,{className:"text-sm font-mono",children:e.errors.unexpected})]}),(e.staticPageHits200!==void 0||e.staticPageHits405!==void 0)&&a.jsxs(re,{children:[a.jsx(N,{className:"font-medium text-sm",children:a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(Wa,{className:"h-3 w-3"}),"hf.co/mcp (200/405)"]})}),a.jsxs(N,{className:"text-sm font-mono",children:[e.staticPageHits200||0,"/",e.staticPageHits405||0]}),a.jsx(N,{className:"font-medium text-sm",children:a.jsx("div",{className:"flex items-center gap-1",children:"Auth Status (Anon/Auth/401)"})}),a.jsxs(N,{className:"text-sm font-mono",children:[e.connections.anonymous,"/",e.connections.authenticated,"/",e.connections.unauthorized||0]})]}),e.apiMetrics&&a.jsxs(a.Fragment,{children:[a.jsxs(re,{children:[a.jsx(N,{className:"font-medium text-sm",children:"Tool API - Anonymous"}),a.jsx(N,{className:"text-sm font-mono",children:e.apiMetrics.anonymous}),a.jsx(N,{className:"font-medium text-sm",children:"Tool API - Authenticated"}),a.jsx(N,{className:"text-sm font-mono",children:e.apiMetrics.authenticated})]}),a.jsxs(re,{children:[a.jsx(N,{className:"font-medium text-sm",children:"Tool API - 401 Unauthorized"}),a.jsx(N,{className:"text-sm font-mono",children:e.apiMetrics.unauthorized}),a.jsx(N,{className:"font-medium text-sm",children:"Tool API - 403 Forbidden"}),a.jsx(N,{className:"text-sm font-mono",children:e.apiMetrics.forbidden})]})]}),e.gradioMetrics&&a.jsx(a.Fragment,{children:a.jsxs(re,{children:[a.jsx(N,{className:"font-medium text-sm",children:"Gradio Tool - Success"}),a.jsx(N,{className:"text-sm font-mono",children:e.gradioMetrics.success}),a.jsx(N,{className:"font-medium text-sm",children:"Gradio Tool - Failure"}),a.jsx(N,{className:"text-sm font-mono",children:e.gradioMetrics.failure})]})})]})})}),a.jsxs(a.Fragment,{children:[a.jsx(Qe,{}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-sm font-semibold text-foreground mb-3",children:"Client Identities"}),a.jsx(gn,{columns:t(),data:n,searchColumn:"name",searchPlaceholder:"Filter clients...",pageSize:50,defaultSorting:[{id:"lastSeen",desc:!0}]})]})]})]})]})}const mg=e=>fetch(e).then(n=>{if(!n.ok)throw new Error(`Failed to fetch: ${n.status}`);return n.json()});function pg(){const{data:e,error:n}=St("/api/transport-metrics",mg,{refreshInterval:3e3,revalidateOnFocus:!0,revalidateOnReconnect:!0});return n?a.jsxs(Te,{children:[a.jsx(Ie,{children:a.jsx(De,{children:"📊 Transport Metrics"})}),a.jsx($e,{children:a.jsxs(nl,{variant:"destructive",children:[a.jsx(Xr,{className:"h-4 w-4"}),a.jsx(ol,{children:"Error Loading Metrics"}),a.jsxs(rl,{children:["Failed to load transport metrics: ",n.message]})]})})]}):e?e.transport==="stdio"?a.jsx(sg,{metrics:e}):e.isStateless?a.jsx(gg,{metrics:e}):a.jsx(cg,{metrics:e}):a.jsxs(Te,{children:[a.jsx(Ie,{children:a.jsx(De,{children:"📊 Transport Metrics"})}),a.jsx($e,{children:a.jsxs("div",{className:"animate-pulse space-y-2",children:[a.jsx("div",{className:"h-4 bg-gray-200 rounded w-3/4"}),a.jsx("div",{className:"h-4 bg-gray-200 rounded w-1/2"}),a.jsx("div",{className:"h-4 bg-gray-200 rounded w-2/3"})]})})]})}const hg=e=>fetch(e).then(n=>{if(!n.ok)throw new Error(`Failed to fetch: ${n.status}`);return n.json()});function vg(){const[e,n]=h.useState(!1),{data:t,error:o}=St("/api/transport-metrics",hg,{refreshInterval:3e3,revalidateOnFocus:!0,revalidateOnReconnect:!0}),r=!t&&!o,s=(t==null?void 0:t.transport)==="stdio",i=((t==null?void 0:t.methods)||[]).map(d=>{let c=d.errors,v,p;if(d.method.startsWith("tools/call:")&&(t!=null&&t.gradioMetrics)){const S=d.method.replace("tools/call:",""),C=t.gradioMetrics.byTool;C[S]&&(v=C[S].success,p=C[S].failure,c+=p)}const w=d.count>0?c/d.count*100:0;return{method:d.method,count:d.count,errors:c,errorRate:w,averageResponseTime:d.averageResponseTime,lastCalled:d.lastCalled,gradioSuccess:v,gradioFailure:p}}),l=e?i.filter(d=>d.method.startsWith("tools/call")||d.method.startsWith("prompts/get")):i,u=i.reduce((d,c)=>d+c.count,0),f=i.filter(d=>d.method.startsWith("tools/call")).reduce((d,c)=>d+c.count,0),g=i.filter(d=>d.method.startsWith("prompts/get")).reduce((d,c)=>d+c.count,0),m=[{accessorKey:"method",header:q("Method"),cell:({row:d})=>{const c=d.getValue("method");return a.jsx("div",{className:"font-mono text-sm",children:c==="tools/call"?a.jsx("span",{className:"text-blue-600 dark:text-blue-400",children:"tools/call"}):c.startsWith("tools/call:")?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"text-blue-600 dark:text-blue-400",children:"tools/call:"}),a.jsx("span",{className:"text-green-600 dark:text-green-400",children:c.replace("tools/call:","")})]}):c==="prompts/get"?a.jsx("span",{className:"text-purple-600 dark:text-purple-400",children:"prompts/get"}):c.startsWith("prompts/get:")?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"text-purple-600 dark:text-purple-400",children:"prompts/get:"}),a.jsx("span",{className:"text-orange-600 dark:text-orange-400",children:c.replace("prompts/get:","")})]}):c})}},{accessorKey:"count",header:q("Calls","right"),cell:({row:d})=>a.jsx("div",{className:"text-right font-mono",children:d.getValue("count").toLocaleString()})},{accessorKey:"errors",header:q("Errors","right"),cell:({row:d})=>{const c=d.getValue("errors");return a.jsx("div",{className:"text-right font-mono",children:c>0?a.jsx("span",{className:"text-red-600 dark:text-red-400",children:c}):"0"})}},{accessorKey:"gradioMetrics",header:q("Success/Failure","right"),cell:({row:d})=>{const c=d.original;return c.gradioSuccess!==void 0&&c.gradioFailure!==void 0?a.jsxs("div",{className:"text-right font-mono text-sm",children:[a.jsx("span",{className:"text-green-600 dark:text-green-400",children:c.gradioSuccess}),a.jsx("span",{className:"text-muted-foreground",children:"/"}),a.jsx("span",{className:"text-red-600 dark:text-red-400",children:c.gradioFailure})]}):a.jsx("div",{className:"text-right text-muted-foreground",children:"—"})}},{accessorKey:"errorRate",header:q("Error Rate","right"),cell:({row:d})=>{const c=d.getValue("errorRate");return a.jsx("div",{className:"text-right font-mono",children:c>0?a.jsxs("span",{className:"text-red-600 dark:text-red-400",children:[c.toFixed(1),"%"]}):"0%"})}},{accessorKey:"averageResponseTime",header:q("Avg Response","right"),cell:({row:d})=>{const c=d.getValue("averageResponseTime");return a.jsx("div",{className:"text-right font-mono",children:c?`${c.toFixed(0)}ms`:"—"})}},{accessorKey:"lastCalled",header:q("Last Called","right"),cell:({row:d})=>a.jsx("div",{className:"text-right text-sm text-muted-foreground",children:new Date(d.getValue("lastCalled")).toLocaleTimeString()})}];return a.jsxs(Te,{children:[a.jsxs(Ie,{children:[a.jsx(De,{children:"HTTP JSON Transport Statistics"}),a.jsxs(tt,{children:["MCP method call statistics and performance metrics",s?" (Empty in STDIO mode)":t!=null&&t.isStateless?"":" (Response times not available in stateful modes)"]})]}),a.jsxs($e,{children:[r&&a.jsx("div",{className:"flex items-center justify-center py-8",children:a.jsx("div",{className:"text-sm text-muted-foreground",children:"Loading metrics..."})}),o&&a.jsx("div",{className:"flex items-center justify-center py-8",children:a.jsxs("div",{className:"text-sm text-destructive",children:["Error loading metrics: ",o.message]})}),s&&a.jsx("div",{className:"flex items-center justify-center py-8",children:a.jsx("div",{className:"text-sm text-muted-foreground",children:"Method tracking is not available in STDIO mode. This data is only collected for HTTP-based transports."})}),t&&!s&&a.jsxs("div",{className:"space-y-4",children:[i.length>0&&a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"text-sm text-muted-foreground",children:["Showing ",l.length," method",l.length!==1?"s":""," tracked since"," ",new Date(t.startupTime).toLocaleString()]}),a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsxs("div",{className:"text-sm font-medium",children:["Total MCP Calls: ",a.jsx("span",{className:"font-mono",children:u.toLocaleString()})]}),a.jsxs("div",{className:"text-sm font-medium",children:["Tool Calls: ",a.jsx("span",{className:"font-mono",children:f.toLocaleString()})]}),a.jsxs("div",{className:"text-sm font-medium",children:["Prompt Calls: ",a.jsx("span",{className:"font-mono",children:g.toLocaleString()})]})]})]}),i.length>0&&a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(ho,{id:"tool-prompt-calls-filter",checked:e,onCheckedChange:d=>n(!!d)}),a.jsx("label",{htmlFor:"tool-prompt-calls-filter",className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 cursor-pointer",children:"Show only Tools/Prompts"})]}),l.length===0?a.jsx("div",{className:"flex items-center justify-center py-8",children:a.jsx("div",{className:"text-sm text-muted-foreground",children:e?"No tool or prompt calls recorded yet.":"No method calls recorded yet."})}):a.jsx(gn,{columns:m,data:l,searchColumn:"method",searchPlaceholder:"Filter methods...",pageSize:50,defaultColumnVisibility:{method:!0,count:!0,errors:!1,gradioMetrics:!1,errorRate:!0,averageResponseTime:t.transport==="streamableHttpJson",lastCalled:!0},defaultSorting:[{id:"count",desc:!0}]})]})]})]})}function Mr(e){return e.transport==="stdio"?e.defaultHfTokenSet&&e.hfTokenMasked?{text:e.hfTokenMasked,isWarning:!1}:{text:"Warning: No token set",isWarning:!0}:e.defaultHfTokenSet?{text:`⚠️ Using ${e.hfTokenMasked||"token"} as default`,isWarning:!0}:{text:"Using Authorization Headers",isWarning:!1}}function xg({isLoading:e,error:n,transportInfo:t}){const o=()=>{switch(t.transport){case"stdio":return"STDIO";case"sse":return"SSE";case"streamableHttp":case"streamableHttpJson":return"Streamable HTTP";default:return"Unknown"}},r=()=>{switch(t.transport){case"sse":return"/sse";case"streamableHttp":case"streamableHttpJson":return"/mcp";case"stdio":return"stdin/stdout";default:return"unknown"}},s=()=>t.transport==="streamableHttpJson"||t.transport==="streamableHttp"&&t.jsonResponseEnabled===!0,i=()=>s()?a.jsx("span",{className:"ml-1.5 px-1.5 py-0.5 bg-green-100 text-green-800 text-[10px] rounded-sm whitespace-nowrap",children:"JSON (stateless)"}):t.transport==="streamableHttp"?a.jsx("span",{className:"ml-1.5 px-1.5 py-0.5 bg-blue-100 text-blue-800 text-[10px] rounded-sm whitespace-nowrap",children:"Session Based"}):t.transport==="sse"?a.jsx("span",{className:"ml-1.5 px-1.5 py-0.5 bg-purple-100 text-purple-800 text-[10px] rounded-sm whitespace-nowrap",children:"Event Stream"}):null;if(e)return a.jsx("div",{className:"text-center text-xs text-muted-foreground py-2",children:"Loading connection information..."});if(n)return a.jsxs("div",{className:"text-center text-xs text-destructive py-2",children:["Error: ",n]});const l=t.port||3e3,u=t.transport!=="stdio";return a.jsx("div",{className:"fixed bottom-0 left-0 w-full bg-muted/50 border-t border-border py-2 px-4",children:a.jsxs("div",{className:"max-w-[700px] mx-auto flex justify-between items-center text-xs",children:[a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("span",{className:"text-muted-foreground",children:"Using"}),a.jsx("span",{className:"font-medium text-primary",children:o()}),t.transport==="stdio"&&a.jsxs("span",{className:"text-muted-foreground flex items-center",children:["Client Info :",t.stdioClient?a.jsx("span",{className:"ml-2 flex items-center",children:a.jsxs("span",{className:"ml-1 font-medium text-green-700",children:[t.stdioClient.name," ",t.stdioClient.version]})}):a.jsx("span",{className:"ml-2 text-muted-foreground",children:" (disconnected) "})]}),u&&a.jsxs("span",{className:"text-muted-foreground flex items-center",children:["on port ",a.jsx("span",{className:"font-mono mx-1",children:l}),"at ",a.jsx("span",{className:"font-mono mx-1",children:r()}),i()]})]}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("span",{className:"text-muted-foreground",children:" Default HF Token:"}),a.jsx("span",{className:`font-mono ${Mr(t).isWarning?"text-red-500":""}`,children:Mr(t).text})]})]})})}var mn="Tabs",[wg,Fg]=nt(mn,[ln]),Ai=ln(),[Sg,Vo]=wg(mn),Fi=h.forwardRef((e,n)=>{const{__scopeTabs:t,value:o,onValueChange:r,defaultValue:s,orientation:i="horizontal",dir:l,activationMode:u="automatic",...f}=e,g=Co(l),[m,d]=tn({prop:o,onChange:r,defaultProp:s??"",caller:mn});return a.jsx(Sg,{scope:t,baseId:qt(),value:m,onValueChange:d,orientation:i,dir:g,activationMode:u,children:a.jsx(X.div,{dir:g,"data-orientation":i,...f,ref:n})})});Fi.displayName=mn;var Ti="TabsList",Ii=h.forwardRef((e,n)=>{const{__scopeTabs:t,loop:o=!0,...r}=e,s=Vo(Ti,t),i=Ai(t);return a.jsx(Hs,{asChild:!0,...i,orientation:s.orientation,dir:s.dir,loop:o,children:a.jsx(X.div,{role:"tablist","aria-orientation":s.orientation,...r,ref:n})})});Ii.displayName=Ti;var Di="TabsTrigger",$i=h.forwardRef((e,n)=>{const{__scopeTabs:t,value:o,disabled:r=!1,...s}=e,i=Vo(Di,t),l=Ai(t),u=Li(i.baseId,o),f=Vi(i.baseId,o),g=o===i.value;return a.jsx(Gs,{asChild:!0,...l,focusable:!r,active:g,children:a.jsx(X.button,{type:"button",role:"tab","aria-selected":g,"aria-controls":f,"data-state":g?"active":"inactive","data-disabled":r?"":void 0,disabled:r,id:u,...s,ref:n,onMouseDown:k(e.onMouseDown,m=>{!r&&m.button===0&&m.ctrlKey===!1?i.onValueChange(o):m.preventDefault()}),onKeyDown:k(e.onKeyDown,m=>{[" ","Enter"].includes(m.key)&&i.onValueChange(o)}),onFocus:k(e.onFocus,()=>{const m=i.activationMode!=="manual";!g&&!r&&m&&i.onValueChange(o)})})})});$i.displayName=Di;var Oi="TabsContent",ki=h.forwardRef((e,n)=>{const{__scopeTabs:t,value:o,forceMount:r,children:s,...i}=e,l=Vo(Oi,t),u=Li(l.baseId,o),f=Vi(l.baseId,o),g=o===l.value,m=h.useRef(g);return h.useEffect(()=>{const d=requestAnimationFrame(()=>m.current=!1);return()=>cancelAnimationFrame(d)},[]),a.jsx(ot,{present:r||g,children:({present:d})=>a.jsx(X.div,{"data-state":g?"active":"inactive","data-orientation":l.orientation,role:"tabpanel","aria-labelledby":u,hidden:!d,id:f,tabIndex:0,...i,ref:n,style:{...e.style,animationDuration:m.current?"0s":void 0},children:d&&s})})});ki.displayName=Oi;function Li(e,n){return`${e}-trigger-${n}`}function Vi(e,n){return`${e}-content-${n}`}var Cg=Fi,yg=Ii,Rg=$i,bg=ki;function Mg({className:e,...n}){return a.jsx(Cg,{"data-slot":"tabs",className:Z("flex flex-col gap-2",e),...n})}function Eg({className:e,...n}){return a.jsx(yg,{"data-slot":"tabs-list",className:Z("bg-muted text-muted-foreground inline-flex h-9 w-fit items-center justify-center rounded-lg p-[3px]",e),...n})}function ct({className:e,...n}){return a.jsx(Rg,{"data-slot":"tabs-trigger",className:Z("data-[state=active]:bg-background dark:data-[state=active]:text-foreground focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring dark:data-[state=active]:border-input dark:data-[state=active]:bg-input/30 text-foreground dark:text-muted-foreground inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:shadow-sm [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...n})}function ut({className:e,...n}){return a.jsx(bg,{"data-slot":"tabs-content",className:Z("flex-1 outline-none",e),...n})}const zn=e=>fetch(e).then(n=>{if(!n.ok)throw new Error(`Failed to fetch: ${n.status}`);return n.json()});function _g(){var M,b,E,$,I,V,G,O,L;const{data:e,error:n}=St("/api/transport",zn,{refreshInterval:3e3,revalidateOnFocus:!0,revalidateOnReconnect:!0});St("/api/sessions",zn,{refreshInterval:3e3,revalidateOnFocus:!0});const{data:t}=St("/api/settings",zn),[o,r]=h.useState(["","",""]),[s,i]=h.useState(["","",""]),[l,u]=h.useState([!1,!1,!1]),[f,g]=h.useState(!1);h.useEffect(()=>{if(t!=null&&t.spaceTools&&!f){const D=["","",""],P=["","",""],T=[!1,!1,!1];t.spaceTools.forEach((j,_)=>{_<3&&(D[_]=j.name,P[_]=j.subdomain,T[_]=!0)}),r(D),i(P),u(T),g(!0)}},[t,f]);const m=!e&&!n,d=n?n.message:null,c=async(D,P)=>{try{const T=t||{builtInTools:[]},j=T.builtInTools,_=P?[...j.filter(Y=>Y!==D),D]:j.filter(Y=>Y!==D),U={...T,builtInTools:_};Bt("/api/settings",U,!1);const W=await fetch("/api/settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({builtInTools:_})});if(!W.ok)throw new Error(`Failed to update tool settings: ${W.status}`);Bt("/api/settings"),console.log(`${D} is now ${P?"enabled":"disabled"}`)}catch(T){console.error("Error updating tool settings:",T),alert(`Error updating ${D}: ${T instanceof Error?T.message:"Unknown error"}`),Bt("/api/settings")}},v=async(D,P)=>{const T=[...l];T[D]=P,u(T),await x(T)},p=async(D,P)=>{const T=[...o];T[D]=P,r(T),l[D]&&await x(l)},w=async(D,P)=>{const T=[...s];T[D]=P,i(T),l[D]&&await x(l)},x=async D=>{try{const P=[];for(let j=0;j<3;j++)D[j]&&o[j]&&s[j]&&P.push({_id:`space-${j}`,name:o[j],subdomain:s[j],emoji:"🔧"});const T=await fetch("/api/settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({spaceTools:P})});if(!T.ok)throw new Error(`Failed to update space tools: ${T.status}`)}catch(P){console.error("Error updating space tools:",P)}},S=async()=>{const D="https://huggingface.co/mcp";try{await navigator.clipboard.writeText(D)}catch(P){console.error("Failed to copy URL:",P)}},C=()=>{window.open("https://huggingface.co/settings/mcp","_blank")},y={paper_search:{id:"paper_search",label:"Papers Search",description:"Find Machine Learning Research Papers.",settings:{enabled:((M=t==null?void 0:t.builtInTools)==null?void 0:M.includes("paper_search"))??!0}},space_search:{id:"space_search",label:"Space Search",description:"Find Gradio Hugging Face Spaces.",settings:{enabled:((b=t==null?void 0:t.builtInTools)==null?void 0:b.includes("space_search"))??!0}},model_search:{id:"model_search",label:"Model Search",description:"Find models with filters for task, library, etc.",settings:{enabled:((E=t==null?void 0:t.builtInTools)==null?void 0:E.includes("model_search"))??!0}},model_details:{id:"model_details",label:"Model Details",description:"Detailed information about a specific model.",settings:{enabled:(($=t==null?void 0:t.builtInTools)==null?void 0:$.includes("model_details"))??!0}},dataset_search:{id:"dataset_search",label:"Dataset Search",description:"Find datasets with filters for author, tags, etc.",settings:{enabled:((I=t==null?void 0:t.builtInTools)==null?void 0:I.includes("dataset_search"))??!0}},dataset_details:{id:"dataset_details",label:"Dataset Details",description:"Detailed information about a specific dataset.",settings:{enabled:((V=t==null?void 0:t.builtInTools)==null?void 0:V.includes("dataset_details"))??!0}}},R={duplicate_space:{id:"duplicate_space",label:"Duplicate Space",description:"Duplicate a Space to your account.",settings:{enabled:((G=t==null?void 0:t.builtInTools)==null?void 0:G.includes("duplicate_space"))??!0}},space_info:{id:"space_info",label:"Spaces Information",description:"Get detailed information about your Spaces.",settings:{enabled:((O=t==null?void 0:t.builtInTools)==null?void 0:O.includes("space_info"))??!0}},space_files:{id:"space_files",label:"Space Files",description:"List all files in a static Space with download URLs.",settings:{enabled:((L=t==null?void 0:t.builtInTools)==null?void 0:L.includes("space_files"))??!0}}};return a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"min-h-screen p-4 sm:p-8 pb-20",children:a.jsx("div",{className:"max-w-4xl mx-auto",children:a.jsxs(Mg,{defaultValue:"metrics",className:"w-full",children:[a.jsxs(Eg,{className:"mb-6 w-full overflow-x-auto flex-nowrap",children:[a.jsx(ct,{value:"metrics",className:"whitespace-nowrap",children:"📊 Metrics"}),a.jsx(ct,{value:"mcp",className:"whitespace-nowrap",children:"🔧 MCP"}),!(e!=null&&e.externalApiMode)&&a.jsx(ct,{value:"search",className:"whitespace-nowrap",children:"🔍 Search"}),!(e!=null&&e.externalApiMode)&&a.jsx(ct,{value:"spaces",className:"whitespace-nowrap",children:"🚀 Spaces"}),!(e!=null&&e.externalApiMode)&&a.jsx(ct,{value:"gradio",className:"whitespace-nowrap",children:"🚀 Gradio"}),a.jsx(ct,{value:"home",className:"whitespace-nowrap",children:"🏠 Home"})]}),a.jsx(ut,{value:"metrics",className:"mt-0",children:a.jsx(pg,{})}),a.jsx(ut,{value:"mcp",className:"mt-0",children:a.jsx(vg,{})}),!(e!=null&&e.externalApiMode)&&a.jsx(ut,{value:"search",className:"mt-0",children:a.jsx(Jo,{title:"🤗 Hugging Face Search Tools (MCP)",description:"Find and use Hugging Face and Community content.",tools:y,onToolToggle:c})}),!(e!=null&&e.externalApiMode)&&a.jsx(ut,{value:"spaces",className:"mt-0",children:a.jsx(Jo,{title:"🤗 Hugging Face Space Tools (MCP)",description:"Manage and duplicate Hugging Face Spaces.",tools:R,onToolToggle:c})}),!(e!=null&&e.externalApiMode)&&a.jsx(ut,{value:"gradio",className:"mt-0",children:a.jsx(el,{spaceNames:o,spaceSubdomains:s,enabledSpaces:l,onSpaceToolToggle:v,onSpaceToolNameChange:p,onSpaceToolSubdomainChange:w})}),a.jsx(ut,{value:"home",className:"mt-0",children:a.jsxs(Te,{children:[a.jsxs(Ie,{children:[a.jsx(De,{children:"🤗 HF MCP Server"}),a.jsx(tt,{children:"Connect with AI assistants through the Model Context Protocol"})]}),a.jsxs($e,{className:"space-y-6",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-sm font-semibold text-foreground mb-3",children:"What's MCP?"}),a.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:"The Model Context Protocol (MCP) is an open standard that enables AI assistants to securely connect to external data sources and tools. This HF MCP Server provides access to Hugging Face's ecosystem of models, datasets, and Spaces, allowing AI assistants to search, analyze, and interact with ML resources directly."})]}),a.jsx(Qe,{}),a.jsx("div",{className:"bg-blue-50 dark:bg-blue-950 border border-blue-200 dark:border-blue-800 rounded-lg p-4",children:a.jsxs("div",{className:"flex items-start space-x-3",children:[a.jsx("div",{className:"flex-shrink-0 mt-0.5",children:a.jsx("svg",{className:"h-5 w-5 text-blue-600 dark:text-blue-400",fill:"currentColor",viewBox:"0 0 20 20",children:a.jsx("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z",clipRule:"evenodd"})})}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-sm font-semibold text-blue-900 dark:text-blue-100 mb-2",children:"Tool Management Scope"}),((e==null?void 0:e.externalApiMode)||(e==null?void 0:e.transport)!=="stdio"&&!(e!=null&&e.externalApiMode))&&a.jsx("p",{className:"text-sm text-blue-700 dark:text-blue-300 leading-relaxed",children:e!=null&&e.externalApiMode?a.jsxs(a.Fragment,{children:[a.jsx("strong",{children:"External API Mode:"})," Tools are managed by an external API. Tool Selection Tabs are not available."]}):a.jsxs(a.Fragment,{children:[a.jsx("strong",{children:"Shared Mode:"})," Tool toggles in this interface affect"," ",a.jsx("strong",{children:"all connected MCP server instances"})," and control tool availability for all connected Hosts."]})})]})]})}),a.jsx(Qe,{}),a.jsxs("div",{className:"flex flex-col gap-4",children:[a.jsxs(dt,{size:"xl",onClick:S,className:"w-full transition-all duration-200 active:bg-green-500 active:border-green-500 touch-manipulation",children:[a.jsx(Wi,{className:"mr-2 h-5 w-5"}),"Copy MCP URL"]}),a.jsxs(dt,{size:"xl",variant:"outline",onClick:C,className:"w-full touch-manipulation",children:[a.jsx(Ki,{className:"mr-2 h-5 w-5"}),"Go to Settings"]})]})]})]})})]})})}),a.jsx(xg,{isLoading:m,error:d,transportInfo:e||{transport:"unknown"}})]})}qi.createRoot(document.getElementById("root")).render(a.jsx(h.StrictMode,{children:a.jsx(_g,{})}));