@llmindset/hf-mcp-server 0.2.18 → 0.2.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.
- package/dist/server/mcp-server.d.ts.map +1 -1
- package/dist/server/mcp-server.js +39 -7
- package/dist/server/mcp-server.js.map +1 -1
- package/dist/server/utils/tool-selection-strategy.d.ts.map +1 -1
- package/dist/server/utils/tool-selection-strategy.js +9 -1
- package/dist/server/utils/tool-selection-strategy.js.map +1 -1
- package/dist/web/assets/{button-CF3c4sM2.css → button-7on4uJ5J.css} +1 -1
- package/dist/web/assets/main-CN6ZjpZA.js +105 -0
- package/dist/web/assets/mcpWelcome-CZrUtCJN.js +72 -0
- package/dist/web/index.html +3 -3
- package/dist/web/mcp-welcome.html +22 -20
- package/package.json +2 -2
- package/dist/web/assets/main-Dy7mEb3m.js +0 -105
- package/dist/web/assets/mcpWelcome-UmrUlXbs.js +0 -70
- /package/dist/web/assets/{button-D9KbQhFy.js → button-BfAUzAE-.js} +0 -0
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import{r as El,a as p,R as Oe,j as l,b as ri,u as me,g as Ml,c as Nl,d as Nn,e as St,f as ce,C as Ze,h as Ke,i as Xe,k as Ct,l as Ye,m as si,S as Tl,n as oi,B as Pt,o as ii,T as ai,p as jl,q as Al,s as kl}from"./button-D9KbQhFy.js";var rr={exports:{}},sr={};/**
|
|
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 qs;function Il(){if(qs)return sr;qs=1;var e=El();function t(m,g){return m===g&&(m!==0||1/m===1/g)||m!==m&&g!==g}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,s=e.useEffect,o=e.useLayoutEffect,i=e.useDebugValue;function a(m,g){var d=g(),v=r({inst:{value:d,getSnapshot:g}}),h=v[0].inst,y=v[1];return o(function(){h.value=d,h.getSnapshot=g,c(h)&&y({inst:h})},[m,d,g]),s(function(){return c(h)&&y({inst:h}),m(function(){c(h)&&y({inst:h})})},[m]),i(d),d}function c(m){var g=m.getSnapshot;m=m.value;try{var d=g();return!n(m,d)}catch{return!0}}function u(m,g){return g()}var f=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?u:a;return sr.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:f,sr}var Zs;function Pl(){return Zs||(Zs=1,rr.exports=Il()),rr.exports}var Ol=Pl();const li=0,ci=1,ui=2,Ks=3;var Xs=Object.prototype.hasOwnProperty;function Ar(e,t){var n,r;if(e===t)return!0;if(e&&t&&(n=e.constructor)===t.constructor){if(n===Date)return e.getTime()===t.getTime();if(n===RegExp)return e.toString()===t.toString();if(n===Array){if((r=e.length)===t.length)for(;r--&&Ar(e[r],t[r]););return r===-1}if(!n||typeof e=="object"){r=0;for(n in e)if(Xs.call(e,n)&&++r&&!Xs.call(t,n)||!(n in t)||!Ar(e[n],t[n]))return!1;return Object.keys(t).length===r}}return e!==e&&t!==t}const qe=new WeakMap,ot=()=>{},pe=ot(),kr=Object,Z=e=>e===pe,Fe=e=>typeof e=="function",ut=(e,t)=>({...e,...t}),di=e=>Fe(e.then),or={},fn={},fs="undefined",sn=typeof window!=fs,Ir=typeof document!=fs,Fl=sn&&"Deno"in window,Dl=()=>sn&&typeof window.requestAnimationFrame!=fs,fi=(e,t)=>{const n=qe.get(e);return[()=>!Z(t)&&e.get(t)||or,r=>{if(!Z(t)){const s=e.get(t);t in fn||(fn[t]=s),n[5](t,ut(s,r),s||or)}},n[6],()=>!Z(t)&&t in fn?fn[t]:!Z(t)&&e.get(t)||or]};let Pr=!0;const $l=()=>Pr,[Or,Fr]=sn&&window.addEventListener?[window.addEventListener.bind(window),window.removeEventListener.bind(window)]:[ot,ot],Ll=()=>{const e=Ir&&document.visibilityState;return Z(e)||e!=="hidden"},Vl=e=>(Ir&&document.addEventListener("visibilitychange",e),Or("focus",e),()=>{Ir&&document.removeEventListener("visibilitychange",e),Fr("focus",e)}),Hl=e=>{const t=()=>{Pr=!0,e()},n=()=>{Pr=!1};return Or("online",t),Or("offline",n),()=>{Fr("online",t),Fr("offline",n)}},zl={isOnline:$l,isVisible:Ll},Gl={initFocus:Vl,initReconnect:Hl},Ys=!Oe.useId,Yt=!sn||Fl,Bl=e=>Dl()?window.requestAnimationFrame(e):setTimeout(e,1),ir=Yt?p.useEffect:p.useLayoutEffect,ar=typeof navigator<"u"&&navigator.connection,Js=!Yt&&ar&&(["slow-2g","2g"].includes(ar.effectiveType)||ar.saveData),gn=new WeakMap,lr=(e,t)=>kr.prototype.toString.call(e)===`[object ${t}]`;let Ul=0;const Dr=e=>{const t=typeof e,n=lr(e,"Date"),r=lr(e,"RegExp"),s=lr(e,"Object");let o,i;if(kr(e)===e&&!n&&!r){if(o=gn.get(e),o)return o;if(o=++Ul+"~",gn.set(e,o),Array.isArray(e)){for(o="@",i=0;i<e.length;i++)o+=Dr(e[i])+",";gn.set(e,o)}if(s){o="#";const a=kr.keys(e).sort();for(;!Z(i=a.pop());)Z(e[i])||(o+=i+":"+Dr(e[i])+",");gn.set(e,o)}}else o=n?e.toJSON():t=="symbol"?e.toString():t=="string"?JSON.stringify(e):""+e;return o},gs=e=>{if(Fe(e))try{e=e()}catch{e=""}const t=e;return e=typeof e=="string"?e:(Array.isArray(e)?e.length:e)?Dr(e):"",[e,t]};let Wl=0;const $r=()=>++Wl;async function gi(...e){const[t,n,r,s]=e,o=ut({populateCache:!0,throwOnError:!0},typeof s=="boolean"?{revalidate:s}:s||{});let i=o.populateCache;const a=o.rollbackOnError;let c=o.optimisticData;const u=g=>typeof a=="function"?a(g):a!==!1,f=o.throwOnError;if(Fe(n)){const g=n,d=[],v=t.keys();for(const h of v)!/^\$(inf|sub)\$/.test(h)&&g(t.get(h)._k)&&d.push(h);return Promise.all(d.map(m))}return m(n);async function m(g){const[d]=gs(g);if(!d)return;const[v,h]=fi(t,d),[y,x,w,_]=qe.get(t),S=()=>{const z=y[d];return(Fe(o.revalidate)?o.revalidate(v().data,g):o.revalidate!==!1)&&(delete w[d],delete _[d],z&&z[0])?z[0](ui).then(()=>v().data):v().data};if(e.length<3)return S();let C=r,M;const E=$r();x[d]=[E,0];const N=!Z(c),H=v(),F=H.data,q=H._c,X=Z(q)?F:q;if(N&&(c=Fe(c)?c(X,F):c,h({data:c,_c:X})),Fe(C))try{C=C(X)}catch(z){M=z}if(C&&di(C))if(C=await C.catch(z=>{M=z}),E!==x[d][0]){if(M)throw M;return C}else M&&N&&u(M)&&(i=!0,h({data:X,_c:pe}));if(i&&!M)if(Fe(i)){const z=i(C,X);h({data:z,error:pe,_c:pe})}else h({data:C,error:pe,_c:pe});if(x[d][1]=$r(),Promise.resolve(S()).then(()=>{h({_c:pe})}),M){if(f)throw M;return}return C}}const Qs=(e,t)=>{for(const n in e)e[n][0]&&e[n][0](t)},ql=(e,t)=>{if(!qe.has(e)){const n=ut(Gl,t),r=Object.create(null),s=gi.bind(pe,e);let o=ot;const i=Object.create(null),a=(f,m)=>{const g=i[f]||[];return i[f]=g,g.push(m),()=>g.splice(g.indexOf(m),1)},c=(f,m,g)=>{e.set(f,m);const d=i[f];if(d)for(const v of d)v(m,g)},u=()=>{if(!qe.has(e)&&(qe.set(e,[r,Object.create(null),Object.create(null),Object.create(null),s,c,a]),!Yt)){const f=n.initFocus(setTimeout.bind(pe,Qs.bind(pe,r,li))),m=n.initReconnect(setTimeout.bind(pe,Qs.bind(pe,r,ci)));o=()=>{f&&f(),m&&m(),qe.delete(e)}}};return u(),[e,s,u,o]}return[e,qe.get(e)[4]]},Zl=(e,t,n,r,s)=>{const o=n.errorRetryCount,i=s.retryCount,a=~~((Math.random()+.5)*(1<<(i<8?i:8)))*n.errorRetryInterval;!Z(o)&&i>o||setTimeout(r,a,s)},Kl=Ar,[mi,bn]=ql(new Map),Xl=ut({onLoadingSlow:ot,onSuccess:ot,onError:ot,onErrorRetry:Zl,onDiscarded:ot,revalidateOnFocus:!0,revalidateOnReconnect:!0,revalidateIfStale:!0,shouldRetryOnError:!0,errorRetryInterval:Js?1e4:5e3,focusThrottleInterval:5*1e3,dedupingInterval:2*1e3,loadingTimeout:Js?5e3:3e3,compare:Kl,isPaused:()=>!1,cache:mi,mutate:bn,fallback:{}},zl),Yl=(e,t)=>{const n=ut(e,t);if(t){const{use:r,fallback:s}=e,{use:o,fallback:i}=t;r&&o&&(n.use=r.concat(o)),s&&i&&(n.fallback=ut(s,i))}return n},Jl=p.createContext({}),Ql="$inf$",hi=sn&&window.__SWR_DEVTOOLS_USE__,ec=hi?window.__SWR_DEVTOOLS_USE__:[],tc=()=>{hi&&(window.__SWR_DEVTOOLS_REACT__=Oe)},nc=e=>Fe(e[1])?[e[0],e[1],e[2]||{}]:[e[0],null,(e[1]===null?e[2]:e[1])||{}],rc=()=>ut(Xl,p.useContext(Jl)),sc=e=>(t,n,r)=>e(t,n&&((...o)=>{const[i]=gs(t),[,,,a]=qe.get(mi);if(i.startsWith(Ql))return n(...o);const c=a[i];return Z(c)?n(...o):(delete a[i],c)}),r),oc=ec.concat(sc),ic=e=>function(...n){const r=rc(),[s,o,i]=nc(n),a=Yl(r,i);let c=e;const{use:u}=a,f=(u||[]).concat(oc);for(let m=f.length;m--;)c=f[m](c);return c(s,o||a.fetcher||null,a)},ac=(e,t,n)=>{const r=t[e]||(t[e]=[]);return r.push(n),()=>{const s=r.indexOf(n);s>=0&&(r[s]=r[r.length-1],r.pop())}};tc();const cr=Oe.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(t=>{e.status="fulfilled",e.value=t},t=>{e.status="rejected",e.reason=t}),e}}),ur={dedupe:!0},lc=(e,t,n)=>{const{cache:r,compare:s,suspense:o,fallbackData:i,revalidateOnMount:a,revalidateIfStale:c,refreshInterval:u,refreshWhenHidden:f,refreshWhenOffline:m,keepPreviousData:g}=n,[d,v,h,y]=qe.get(r),[x,w]=gs(e),_=p.useRef(!1),S=p.useRef(!1),C=p.useRef(x),M=p.useRef(t),E=p.useRef(n),N=()=>E.current,H=()=>N().isVisible()&&N().isOnline(),[F,q,X,z]=fi(r,x),U=p.useRef({}).current,te=Z(i)?Z(n.fallback)?pe:n.fallback[x]:i,W=(J,ee)=>{for(const ue in U){const re=ue;if(re==="data"){if(!s(J[re],ee[re])&&(!Z(J[re])||!s(Ge,ee[re])))return!1}else if(ee[re]!==J[re])return!1}return!0},D=p.useMemo(()=>{const J=!x||!t?!1:Z(a)?N().isPaused()||o?!1:c!==!1:a,ee=he=>{const Be=ut(he);return delete Be._k,J?{isValidating:!0,isLoading:!0,...Be}:Be},ue=F(),re=z(),_e=ee(ue),nt=ue===re?_e:ee(re);let oe=_e;return[()=>{const he=ee(F());return W(he,oe)?(oe.data=he.data,oe.isLoading=he.isLoading,oe.isValidating=he.isValidating,oe.error=he.error,oe):(oe=he,he)},()=>nt]},[r,x]),j=Ol.useSyncExternalStore(p.useCallback(J=>X(x,(ee,ue)=>{W(ue,ee)||J()}),[r,x]),D[0],D[1]),R=!_.current,V=d[x]&&d[x].length>0,Q=j.data,ae=Z(Q)?te&&di(te)?cr(te):te:Q,ye=j.error,we=p.useRef(ae),Ge=g?Z(Q)?Z(we.current)?ae:we.current:Q:ae,Pe=V&&!Z(ye)?!1:R&&!Z(a)?a:N().isPaused()?!1:o?Z(ae)?!1:c:Z(ae)||c,Ee=!!(x&&t&&R&&Pe),vt=Z(j.isValidating)?Ee:j.isValidating,xe=Z(j.isLoading)?Ee:j.isLoading,je=p.useCallback(async J=>{const ee=M.current;if(!x||!ee||S.current||N().isPaused())return!1;let ue,re,_e=!0;const nt=J||{},oe=!h[x]||!nt.dedupe,he=()=>Ys?!S.current&&x===C.current&&_.current:x===C.current,Be={isValidating:!1,isLoading:!1},Bs=()=>{q(Be)},Us=()=>{const Me=h[x];Me&&Me[1]===re&&delete h[x]},Ws={isValidating:!0};Z(F().data)&&(Ws.isLoading=!0);try{if(oe&&(q(Ws),n.loadingTimeout&&Z(F().data)&&setTimeout(()=>{_e&&he()&&N().onLoadingSlow(x,n)},n.loadingTimeout),h[x]=[ee(w),$r()]),[ue,re]=h[x],ue=await ue,oe&&setTimeout(Us,n.dedupingInterval),!h[x]||h[x][1]!==re)return oe&&he()&&N().onDiscarded(x),!1;Be.error=pe;const Me=v[x];if(!Z(Me)&&(re<=Me[0]||re<=Me[1]||Me[1]===0))return Bs(),oe&&he()&&N().onDiscarded(x),!1;const Ue=F().data;Be.data=s(Ue,ue)?Ue:ue,oe&&he()&&N().onSuccess(ue,x,n)}catch(Me){Us();const Ue=N(),{shouldRetryOnError:tr}=Ue;Ue.isPaused()||(Be.error=Me,oe&&he()&&(Ue.onError(Me,x,Ue),(tr===!0||Fe(tr)&&tr(Me))&&(!N().revalidateOnFocus||!N().revalidateOnReconnect||H())&&Ue.onErrorRetry(Me,x,Ue,Rl=>{const nr=d[x];nr&&nr[0]&&nr[0](Ks,Rl)},{retryCount:(nt.retryCount||0)+1,dedupe:!0})))}return _e=!1,Bs(),!0},[x,r]),Ut=p.useCallback((...J)=>gi(r,C.current,...J),[]);if(ir(()=>{M.current=t,E.current=n,Z(Q)||(we.current=Q)}),ir(()=>{if(!x)return;const J=je.bind(pe,ur);let ee=0;N().revalidateOnFocus&&(ee=Date.now()+N().focusThrottleInterval);const re=ac(x,d,(_e,nt={})=>{if(_e==li){const oe=Date.now();N().revalidateOnFocus&&oe>ee&&H()&&(ee=oe+N().focusThrottleInterval,J())}else if(_e==ci)N().revalidateOnReconnect&&H()&&J();else{if(_e==ui)return je();if(_e==Ks)return je(nt)}});return S.current=!1,C.current=x,_.current=!0,q({_k:w}),Pe&&(Z(ae)||Yt?J():Bl(J)),()=>{S.current=!0,re()}},[x]),ir(()=>{let J;function ee(){const re=Fe(u)?u(F().data):u;re&&J!==-1&&(J=setTimeout(ue,re))}function ue(){!F().error&&(f||N().isVisible())&&(m||N().isOnline())?je(ur).then(ee):ee()}return ee(),()=>{J&&(clearTimeout(J),J=-1)}},[u,f,m,x]),p.useDebugValue(Ge),o&&Z(ae)&&x){if(!Ys&&Yt)throw new Error("Fallback data is required when using Suspense in SSR.");M.current=t,E.current=n,S.current=!1;const J=y[x];if(!Z(J)){const ee=Ut(J);cr(ee)}if(Z(ye)){const ee=je(ur);Z(Ge)||(ee.status="fulfilled",ee.value=!0),cr(ee)}else throw ye}return{mutate:Ut,get data(){return U.data=!0,Ge},get error(){return U.error=!0,ye},get isValidating(){return U.isValidating=!0,vt},get isLoading(){return U.isLoading=!0,xe}}},Kt=ic(lc);function bt(e,t=[]){let n=[];function r(o,i){const a=p.createContext(i),c=n.length;n=[...n,i];const u=m=>{var x;const{scope:g,children:d,...v}=m,h=((x=g==null?void 0:g[e])==null?void 0:x[c])||a,y=p.useMemo(()=>v,Object.values(v));return l.jsx(h.Provider,{value:y,children:d})};u.displayName=o+"Provider";function f(m,g){var h;const d=((h=g==null?void 0:g[e])==null?void 0:h[c])||a,v=p.useContext(d);if(v)return v;if(i!==void 0)return i;throw new Error(`\`${m}\` must be used within \`${o}\``)}return[u,f]}const s=()=>{const o=n.map(i=>p.createContext(i));return function(a){const c=(a==null?void 0:a[e])||o;return p.useMemo(()=>({[`__scope${e}`]:{...a,[e]:c}}),[a,c])}};return s.scopeName=e,[r,cc(s,...t)]}function cc(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(o){const i=r.reduce((a,{useScope:c,scopeName:u})=>{const m=c(o)[`__scope${u}`];return{...a,...m}},{});return p.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])}};return n.scopeName=t.scopeName,n}function G(e,t,{checkForDefaultPrevented:n=!0}={}){return function(s){if(e==null||e(s),n===!1||!s.defaultPrevented)return t==null?void 0:t(s)}}var dt=globalThis!=null&&globalThis.document?p.useLayoutEffect:()=>{},uc=ri[" useInsertionEffect ".trim().toString()]||dt;function Hn({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[s,o,i]=dc({defaultProp:t,onChange:n}),a=e!==void 0,c=a?e:s;{const f=p.useRef(e!==void 0);p.useEffect(()=>{const m=f.current;m!==a&&console.warn(`${r} is changing from ${m?"controlled":"uncontrolled"} to ${a?"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.`),f.current=a},[a,r])}const u=p.useCallback(f=>{var m;if(a){const g=fc(f)?f(e):f;g!==e&&((m=i.current)==null||m.call(i,g))}else o(f)},[a,e,o,i]);return[c,u]}function dc({defaultProp:e,onChange:t}){const[n,r]=p.useState(e),s=p.useRef(n),o=p.useRef(t);return uc(()=>{o.current=t},[t]),p.useEffect(()=>{var i;s.current!==n&&((i=o.current)==null||i.call(o,n),s.current=n)},[n,s]),[n,r,o]}function fc(e){return typeof e=="function"}function gc(e){const t=p.useRef({value:e,previous:e});return p.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function pi(e){const[t,n]=p.useState(void 0);return dt(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(s=>{if(!Array.isArray(s)||!s.length)return;const o=s[0];let i,a;if("borderBoxSize"in o){const c=o.borderBoxSize,u=Array.isArray(c)?c[0]:c;i=u.inlineSize,a=u.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}function mc(e,t){return p.useReducer((n,r)=>t[n][r]??n,e)}var Rt=e=>{const{present:t,children:n}=e,r=hc(t),s=typeof n=="function"?n({present:r.isPresent}):p.Children.only(n),o=me(r.ref,pc(s));return typeof n=="function"||r.isPresent?p.cloneElement(s,{ref:o}):null};Rt.displayName="Presence";function hc(e){const[t,n]=p.useState(),r=p.useRef(null),s=p.useRef(e),o=p.useRef("none"),i=e?"mounted":"unmounted",[a,c]=mc(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return p.useEffect(()=>{const u=mn(r.current);o.current=a==="mounted"?u:"none"},[a]),dt(()=>{const u=r.current,f=s.current;if(f!==e){const g=o.current,d=mn(u);e?c("MOUNT"):d==="none"||(u==null?void 0:u.display)==="none"?c("UNMOUNT"):c(f&&g!==d?"ANIMATION_OUT":"UNMOUNT"),s.current=e}},[e,c]),dt(()=>{if(t){let u;const f=t.ownerDocument.defaultView??window,m=d=>{const h=mn(r.current).includes(d.animationName);if(d.target===t&&h&&(c("ANIMATION_END"),!s.current)){const y=t.style.animationFillMode;t.style.animationFillMode="forwards",u=f.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=y)})}},g=d=>{d.target===t&&(o.current=mn(r.current))};return t.addEventListener("animationstart",g),t.addEventListener("animationcancel",m),t.addEventListener("animationend",m),()=>{f.clearTimeout(u),t.removeEventListener("animationstart",g),t.removeEventListener("animationcancel",m),t.removeEventListener("animationend",m)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:p.useCallback(u=>{r.current=u?getComputedStyle(u):null,n(u)},[])}}function mn(e){return(e==null?void 0:e.animationName)||"none"}function pc(e){var r,s;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var ms=Nl();const vc=Ml(ms);var xc=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ne=xc.reduce((e,t)=>{const n=Nn(`Primitive.${t}`),r=p.forwardRef((s,o)=>{const{asChild:i,...a}=s,c=i?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),l.jsx(c,{...a,ref:o})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function vi(e,t){e&&ms.flushSync(()=>e.dispatchEvent(t))}var zn="Checkbox",[yc,Kh]=bt(zn),[wc,hs]=yc(zn);function _c(e){const{__scopeCheckbox:t,checked:n,children:r,defaultChecked:s,disabled:o,form:i,name:a,onCheckedChange:c,required:u,value:f="on",internal_do_not_use_render:m}=e,[g,d]=Hn({prop:n,defaultProp:s??!1,onChange:c,caller:zn}),[v,h]=p.useState(null),[y,x]=p.useState(null),w=p.useRef(!1),_=v?!!i||!!v.closest("form"):!0,S={checked:g,disabled:o,setChecked:d,control:v,setControl:h,name:a,form:i,value:f,hasConsumerStoppedPropagationRef:w,required:u,defaultChecked:lt(s)?!1:s,isFormControl:_,bubbleInput:y,setBubbleInput:x};return l.jsx(wc,{scope:t,...S,children:Sc(m)?m(S):r})}var xi="CheckboxTrigger",yi=p.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:n,...r},s)=>{const{control:o,value:i,disabled:a,checked:c,required:u,setControl:f,setChecked:m,hasConsumerStoppedPropagationRef:g,isFormControl:d,bubbleInput:v}=hs(xi,e),h=me(s,f),y=p.useRef(c);return p.useEffect(()=>{const x=o==null?void 0:o.form;if(x){const w=()=>m(y.current);return x.addEventListener("reset",w),()=>x.removeEventListener("reset",w)}},[o,m]),l.jsx(ne.button,{type:"button",role:"checkbox","aria-checked":lt(c)?"mixed":c,"aria-required":u,"data-state":Ri(c),"data-disabled":a?"":void 0,disabled:a,value:i,...r,ref:h,onKeyDown:G(t,x=>{x.key==="Enter"&&x.preventDefault()}),onClick:G(n,x=>{m(w=>lt(w)?!0:!w),v&&d&&(g.current=x.isPropagationStopped(),g.current||x.stopPropagation())})})});yi.displayName=xi;var wi=p.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:r,checked:s,defaultChecked:o,required:i,disabled:a,value:c,onCheckedChange:u,form:f,...m}=e;return l.jsx(_c,{__scopeCheckbox:n,checked:s,defaultChecked:o,disabled:a,required:i,onCheckedChange:u,name:r,form:f,value:c,internal_do_not_use_render:({isFormControl:g})=>l.jsxs(l.Fragment,{children:[l.jsx(yi,{...m,ref:t,__scopeCheckbox:n}),g&&l.jsx(bi,{__scopeCheckbox:n})]})})});wi.displayName=zn;var _i="CheckboxIndicator",Si=p.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:r,...s}=e,o=hs(_i,n);return l.jsx(Rt,{present:r||lt(o.checked)||o.checked===!0,children:l.jsx(ne.span,{"data-state":Ri(o.checked),"data-disabled":o.disabled?"":void 0,...s,ref:t,style:{pointerEvents:"none",...e.style}})})});Si.displayName=_i;var Ci="CheckboxBubbleInput",bi=p.forwardRef(({__scopeCheckbox:e,...t},n)=>{const{control:r,hasConsumerStoppedPropagationRef:s,checked:o,defaultChecked:i,required:a,disabled:c,name:u,value:f,form:m,bubbleInput:g,setBubbleInput:d}=hs(Ci,e),v=me(n,d),h=gc(o),y=pi(r);p.useEffect(()=>{const w=g;if(!w)return;const _=window.HTMLInputElement.prototype,C=Object.getOwnPropertyDescriptor(_,"checked").set,M=!s.current;if(h!==o&&C){const E=new Event("click",{bubbles:M});w.indeterminate=lt(o),C.call(w,lt(o)?!1:o),w.dispatchEvent(E)}},[g,h,o,s]);const x=p.useRef(lt(o)?!1:o);return l.jsx(ne.input,{type:"checkbox","aria-hidden":!0,defaultChecked:i??x.current,required:a,disabled:c,name:u,value:f,form:m,...t,tabIndex:-1,ref:v,style:{...t.style,...y,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});bi.displayName=Ci;function Sc(e){return typeof e=="function"}function lt(e){return e==="indeterminate"}function Ri(e){return lt(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 Cc=[["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"}]],bc=St("activity",Cc);/**
|
|
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 Rc=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Ei=St("check",Rc);/**
|
|
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 Ec=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],Mc=St("chevron-up",Ec);/**
|
|
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 Nc=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]],Tc=St("clock",Nc);/**
|
|
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 jc=[["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"}]],Ac=St("globe",jc);/**
|
|
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 kc=[["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"}]],Mi=St("wifi-off",kc);/**
|
|
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 Ic=[["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"}]],Ni=St("wifi",Ic);function ps({className:e,...t}){return l.jsx(wi,{"data-slot":"checkbox",className:ce("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),...t,children:l.jsx(Si,{"data-slot":"checkbox-indicator",className:"flex items-center justify-center text-current transition-none",children:l.jsx(Ei,{className:"size-3.5"})})})}function Pc({id:e,label:t,description:n,isEnabled:r,onToggle:s}){return l.jsx("div",{children:l.jsxs("div",{className:"items-top flex space-x-2",children:[l.jsx(ps,{id:e,checked:r,onCheckedChange:o=>s(o===!0)}),l.jsxs("div",{className:"grid gap-1.5 leading-none",children:[l.jsx("label",{htmlFor:e,className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:t}),l.jsx("p",{className:"text-sm text-muted-foreground",children:n})]})]})})}function eo({title:e,description:t,tools:n,onToolToggle:r}){return l.jsxs(Ze,{className:"w-full",children:[l.jsxs(Ke,{children:[l.jsx(Xe,{children:e}),l.jsx(Ct,{children:t})]}),l.jsx(Ye,{children:l.jsx("div",{className:"grid grid-cols-2 gap-6 mb-6",children:Object.entries(n).map(([s,o])=>l.jsx(Pc,{id:o.id,label:o.label,description:o.description,isEnabled:o.settings.enabled,onToggle:i=>{r(o.id,i)}},s))})})]})}function Lr({className:e,type:t,...n}){return l.jsx("input",{type:t,"data-slot":"input",className:ce("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),...n})}var Oc="Label",Ti=p.forwardRef((e,t)=>l.jsx(ne.label,{...e,ref:t,onMouseDown:n=>{var s;n.target.closest("button, input, select, textarea")||((s=e.onMouseDown)==null||s.call(e,n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));Ti.displayName=Oc;var Fc=Ti;function Dc({className:e,...t}){return l.jsx(Fc,{"data-slot":"label",className:ce("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),...t})}function $c({spaceNames:e,spaceSubdomains:t,enabledSpaces:n,onSpaceToolToggle:r,onSpaceToolNameChange:s,onSpaceToolSubdomainChange:o}){const i=[0,1,2];return l.jsxs(Ze,{className:"w-full",children:[l.jsxs(Ke,{children:[l.jsx(Xe,{children:"🚀 Gradio Spaces"}),l.jsxs(Ct,{children:["Configure up to 3 Gradio spaces for remote tool access. Edit the name and subdomain fields.",l.jsx("span",{className:"font-semibold",children:" Note: Changes may require reconnecting your MCP client."})]})]}),l.jsx(Ye,{children:l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{className:"flex items-center space-x-3 pb-2 border-b",children:[l.jsx("div",{className:"w-6"})," ",l.jsx("div",{className:"text-sm font-medium min-w-[80px]",children:"Space"}),l.jsx("div",{className:"flex-1 text-sm font-medium",children:"Name"}),l.jsx("div",{className:"flex-1 text-sm font-medium",children:"Subdomain"})]}),i.map(a=>l.jsxs("div",{className:"flex items-center space-x-3",children:[l.jsx(ps,{id:`space-tool-${a}`,checked:n[a]||!1,onCheckedChange:c=>r(a,c===!0)}),l.jsx(Dc,{htmlFor:`space-tool-${a}`,className:"text-sm font-medium min-w-[80px]",children:a+1}),l.jsx(Lr,{placeholder:"username/space-name",value:e[a]||"",onChange:c=>s(a,c.target.value),className:"flex-1 text-sm"}),l.jsx(Lr,{placeholder:"username-space-name",value:t[a]||"",onChange:c=>o(a,c.target.value),className:"flex-1 text-sm"})]},a))]})})]})}const Lc=si("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 Vc({className:e,variant:t,...n}){return l.jsx("div",{"data-slot":"alert",role:"alert",className:ce(Lc({variant:t}),e),...n})}function Hc({className:e,...t}){return l.jsx("div",{"data-slot":"alert-title",className:ce("col-start-2 line-clamp-1 min-h-4 font-medium tracking-tight",e),...t})}function zc({className:e,...t}){return l.jsx("div",{"data-slot":"alert-description",className:ce("text-muted-foreground col-start-2 grid justify-items-start gap-1 text-sm [&_p]:leading-relaxed",e),...t})}const Gc=si("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 xt({className:e,variant:t,asChild:n=!1,...r}){const s=n?Tl:"span";return l.jsx(s,{"data-slot":"badge",className:ce(Gc({variant:t}),e),...r})}var Bc="Separator",to="horizontal",Uc=["horizontal","vertical"],ji=p.forwardRef((e,t)=>{const{decorative:n,orientation:r=to,...s}=e,o=Wc(r)?r:to,a=n?{role:"none"}:{"aria-orientation":o==="vertical"?o:void 0,role:"separator"};return l.jsx(ne.div,{"data-orientation":o,...a,...s,ref:t})});ji.displayName=Bc;function Wc(e){return Uc.includes(e)}var qc=ji;function yt({className:e,orientation:t="horizontal",decorative:n=!0,...r}){return l.jsx(qc,{"data-slot":"separator",decorative:n,orientation:t,className:ce("bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",e),...r})}/**
|
|
45
|
-
* table-core
|
|
46
|
-
*
|
|
47
|
-
* Copyright (c) TanStack
|
|
48
|
-
*
|
|
49
|
-
* This source code is licensed under the MIT license found in the
|
|
50
|
-
* LICENSE.md file in the root directory of this source tree.
|
|
51
|
-
*
|
|
52
|
-
* @license MIT
|
|
53
|
-
*/function it(e,t){return typeof e=="function"?e(t):e}function be(e,t){return n=>{t.setState(r=>({...r,[e]:it(n,r[e])}))}}function Gn(e){return e instanceof Function}function Zc(e){return Array.isArray(e)&&e.every(t=>typeof t=="number")}function Kc(e,t){const n=[],r=s=>{s.forEach(o=>{n.push(o);const i=t(o);i!=null&&i.length&&r(i)})};return r(e),n}function P(e,t,n){let r=[],s;return o=>{let i;n.key&&n.debug&&(i=Date.now());const a=e(o);if(!(a.length!==r.length||a.some((f,m)=>r[m]!==f)))return s;r=a;let u;if(n.key&&n.debug&&(u=Date.now()),s=t(...a),n==null||n.onChange==null||n.onChange(s),n.key&&n.debug&&n!=null&&n.debug()){const f=Math.round((Date.now()-i)*100)/100,m=Math.round((Date.now()-u)*100)/100,g=m/16,d=(v,h)=>{for(v=String(v);v.length<h;)v=" "+v;return v};console.info(`%c⏱ ${d(m,5)} /${d(f,5)} ms`,`
|
|
54
|
-
font-size: .6rem;
|
|
55
|
-
font-weight: bold;
|
|
56
|
-
color: hsl(${Math.max(0,Math.min(120-120*g,120))}deg 100% 31%);`,n==null?void 0:n.key)}return s}}function O(e,t,n,r){return{debug:()=>{var s;return(s=e==null?void 0:e.debugAll)!=null?s:e[t]},key:!1,onChange:r}}function Xc(e,t,n,r){const s=()=>{var i;return(i=o.getValue())!=null?i:e.options.renderFallbackValue},o={id:`${t.id}_${n.id}`,row:t,column:n,getValue:()=>t.getValue(r),renderValue:s,getContext:P(()=>[e,n,t,o],(i,a,c,u)=>({table:i,column:a,row:c,cell:u,getValue:u.getValue,renderValue:u.renderValue}),O(e.options,"debugCells"))};return e._features.forEach(i=>{i.createCell==null||i.createCell(o,n,t,e)},{}),o}function Yc(e,t,n,r){var s,o;const a={...e._getDefaultColumnDef(),...t},c=a.accessorKey;let u=(s=(o=a.id)!=null?o:c?typeof String.prototype.replaceAll=="function"?c.replaceAll(".","_"):c.replace(/\./g,"_"):void 0)!=null?s:typeof a.header=="string"?a.header:void 0,f;if(a.accessorFn?f=a.accessorFn:c&&(c.includes(".")?f=g=>{let d=g;for(const h of c.split(".")){var v;d=(v=d)==null?void 0:v[h]}return d}:f=g=>g[a.accessorKey]),!u)throw new Error;let m={id:`${String(u)}`,accessorFn:f,parent:r,depth:n,columnDef:a,columns:[],getFlatColumns:P(()=>[!0],()=>{var g;return[m,...(g=m.columns)==null?void 0:g.flatMap(d=>d.getFlatColumns())]},O(e.options,"debugColumns")),getLeafColumns:P(()=>[e._getOrderColumnsFn()],g=>{var d;if((d=m.columns)!=null&&d.length){let v=m.columns.flatMap(h=>h.getLeafColumns());return g(v)}return[m]},O(e.options,"debugColumns"))};for(const g of e._features)g.createColumn==null||g.createColumn(m,e);return m}const ge="debugHeaders";function no(e,t,n){var r;let o={id:(r=n.id)!=null?r:t.id,column:t,index:n.index,isPlaceholder:!!n.isPlaceholder,placeholderId:n.placeholderId,depth:n.depth,subHeaders:[],colSpan:0,rowSpan:0,headerGroup:null,getLeafHeaders:()=>{const i=[],a=c=>{c.subHeaders&&c.subHeaders.length&&c.subHeaders.map(a),i.push(c)};return a(o),i},getContext:()=>({table:e,header:o,column:t})};return e._features.forEach(i=>{i.createHeader==null||i.createHeader(o,e)}),o}const Jc={createTable:e=>{e.getHeaderGroups=P(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,r,s)=>{var o,i;const a=(o=r==null?void 0:r.map(m=>n.find(g=>g.id===m)).filter(Boolean))!=null?o:[],c=(i=s==null?void 0:s.map(m=>n.find(g=>g.id===m)).filter(Boolean))!=null?i:[],u=n.filter(m=>!(r!=null&&r.includes(m.id))&&!(s!=null&&s.includes(m.id)));return hn(t,[...a,...u,...c],e)},O(e.options,ge)),e.getCenterHeaderGroups=P(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,r,s)=>(n=n.filter(o=>!(r!=null&&r.includes(o.id))&&!(s!=null&&s.includes(o.id))),hn(t,n,e,"center")),O(e.options,ge)),e.getLeftHeaderGroups=P(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left],(t,n,r)=>{var s;const o=(s=r==null?void 0:r.map(i=>n.find(a=>a.id===i)).filter(Boolean))!=null?s:[];return hn(t,o,e,"left")},O(e.options,ge)),e.getRightHeaderGroups=P(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.right],(t,n,r)=>{var s;const o=(s=r==null?void 0:r.map(i=>n.find(a=>a.id===i)).filter(Boolean))!=null?s:[];return hn(t,o,e,"right")},O(e.options,ge)),e.getFooterGroups=P(()=>[e.getHeaderGroups()],t=>[...t].reverse(),O(e.options,ge)),e.getLeftFooterGroups=P(()=>[e.getLeftHeaderGroups()],t=>[...t].reverse(),O(e.options,ge)),e.getCenterFooterGroups=P(()=>[e.getCenterHeaderGroups()],t=>[...t].reverse(),O(e.options,ge)),e.getRightFooterGroups=P(()=>[e.getRightHeaderGroups()],t=>[...t].reverse(),O(e.options,ge)),e.getFlatHeaders=P(()=>[e.getHeaderGroups()],t=>t.map(n=>n.headers).flat(),O(e.options,ge)),e.getLeftFlatHeaders=P(()=>[e.getLeftHeaderGroups()],t=>t.map(n=>n.headers).flat(),O(e.options,ge)),e.getCenterFlatHeaders=P(()=>[e.getCenterHeaderGroups()],t=>t.map(n=>n.headers).flat(),O(e.options,ge)),e.getRightFlatHeaders=P(()=>[e.getRightHeaderGroups()],t=>t.map(n=>n.headers).flat(),O(e.options,ge)),e.getCenterLeafHeaders=P(()=>[e.getCenterFlatHeaders()],t=>t.filter(n=>{var r;return!((r=n.subHeaders)!=null&&r.length)}),O(e.options,ge)),e.getLeftLeafHeaders=P(()=>[e.getLeftFlatHeaders()],t=>t.filter(n=>{var r;return!((r=n.subHeaders)!=null&&r.length)}),O(e.options,ge)),e.getRightLeafHeaders=P(()=>[e.getRightFlatHeaders()],t=>t.filter(n=>{var r;return!((r=n.subHeaders)!=null&&r.length)}),O(e.options,ge)),e.getLeafHeaders=P(()=>[e.getLeftHeaderGroups(),e.getCenterHeaderGroups(),e.getRightHeaderGroups()],(t,n,r)=>{var s,o,i,a,c,u;return[...(s=(o=t[0])==null?void 0:o.headers)!=null?s:[],...(i=(a=n[0])==null?void 0:a.headers)!=null?i:[],...(c=(u=r[0])==null?void 0:u.headers)!=null?c:[]].map(f=>f.getLeafHeaders()).flat()},O(e.options,ge))}};function hn(e,t,n,r){var s,o;let i=0;const a=function(g,d){d===void 0&&(d=1),i=Math.max(i,d),g.filter(v=>v.getIsVisible()).forEach(v=>{var h;(h=v.columns)!=null&&h.length&&a(v.columns,d+1)},0)};a(e);let c=[];const u=(g,d)=>{const v={depth:d,id:[r,`${d}`].filter(Boolean).join("_"),headers:[]},h=[];g.forEach(y=>{const x=[...h].reverse()[0],w=y.column.depth===v.depth;let _,S=!1;if(w&&y.column.parent?_=y.column.parent:(_=y.column,S=!0),x&&(x==null?void 0:x.column)===_)x.subHeaders.push(y);else{const C=no(n,_,{id:[r,d,_.id,y==null?void 0:y.id].filter(Boolean).join("_"),isPlaceholder:S,placeholderId:S?`${h.filter(M=>M.column===_).length}`:void 0,depth:d,index:h.length});C.subHeaders.push(y),h.push(C)}v.headers.push(y),y.headerGroup=v}),c.push(v),d>0&&u(h,d-1)},f=t.map((g,d)=>no(n,g,{depth:i,index:d}));u(f,i-1),c.reverse();const m=g=>g.filter(v=>v.column.getIsVisible()).map(v=>{let h=0,y=0,x=[0];v.subHeaders&&v.subHeaders.length?(x=[],m(v.subHeaders).forEach(_=>{let{colSpan:S,rowSpan:C}=_;h+=S,x.push(C)})):h=1;const w=Math.min(...x);return y=y+w,v.colSpan=h,v.rowSpan=y,{colSpan:h,rowSpan:y}});return m((s=(o=c[0])==null?void 0:o.headers)!=null?s:[]),c}const vs=(e,t,n,r,s,o,i)=>{let a={id:t,index:r,original:n,depth:s,parentId:i,_valuesCache:{},_uniqueValuesCache:{},getValue:c=>{if(a._valuesCache.hasOwnProperty(c))return a._valuesCache[c];const u=e.getColumn(c);if(u!=null&&u.accessorFn)return a._valuesCache[c]=u.accessorFn(a.original,r),a._valuesCache[c]},getUniqueValues:c=>{if(a._uniqueValuesCache.hasOwnProperty(c))return a._uniqueValuesCache[c];const u=e.getColumn(c);if(u!=null&&u.accessorFn)return u.columnDef.getUniqueValues?(a._uniqueValuesCache[c]=u.columnDef.getUniqueValues(a.original,r),a._uniqueValuesCache[c]):(a._uniqueValuesCache[c]=[a.getValue(c)],a._uniqueValuesCache[c])},renderValue:c=>{var u;return(u=a.getValue(c))!=null?u:e.options.renderFallbackValue},subRows:[],getLeafRows:()=>Kc(a.subRows,c=>c.subRows),getParentRow:()=>a.parentId?e.getRow(a.parentId,!0):void 0,getParentRows:()=>{let c=[],u=a;for(;;){const f=u.getParentRow();if(!f)break;c.push(f),u=f}return c.reverse()},getAllCells:P(()=>[e.getAllLeafColumns()],c=>c.map(u=>Xc(e,a,u,u.id)),O(e.options,"debugRows")),_getAllCellsByColumnId:P(()=>[a.getAllCells()],c=>c.reduce((u,f)=>(u[f.column.id]=f,u),{}),O(e.options,"debugRows"))};for(let c=0;c<e._features.length;c++){const u=e._features[c];u==null||u.createRow==null||u.createRow(a,e)}return a},Qc={createColumn:(e,t)=>{e._getFacetedRowModel=t.options.getFacetedRowModel&&t.options.getFacetedRowModel(t,e.id),e.getFacetedRowModel=()=>e._getFacetedRowModel?e._getFacetedRowModel():t.getPreFilteredRowModel(),e._getFacetedUniqueValues=t.options.getFacetedUniqueValues&&t.options.getFacetedUniqueValues(t,e.id),e.getFacetedUniqueValues=()=>e._getFacetedUniqueValues?e._getFacetedUniqueValues():new Map,e._getFacetedMinMaxValues=t.options.getFacetedMinMaxValues&&t.options.getFacetedMinMaxValues(t,e.id),e.getFacetedMinMaxValues=()=>{if(e._getFacetedMinMaxValues)return e._getFacetedMinMaxValues()}}},Ai=(e,t,n)=>{var r,s;const o=n==null||(r=n.toString())==null?void 0:r.toLowerCase();return!!(!((s=e.getValue(t))==null||(s=s.toString())==null||(s=s.toLowerCase())==null)&&s.includes(o))};Ai.autoRemove=e=>Ae(e);const ki=(e,t,n)=>{var r;return!!(!((r=e.getValue(t))==null||(r=r.toString())==null)&&r.includes(n))};ki.autoRemove=e=>Ae(e);const Ii=(e,t,n)=>{var r;return((r=e.getValue(t))==null||(r=r.toString())==null?void 0:r.toLowerCase())===(n==null?void 0:n.toLowerCase())};Ii.autoRemove=e=>Ae(e);const Pi=(e,t,n)=>{var r;return(r=e.getValue(t))==null?void 0:r.includes(n)};Pi.autoRemove=e=>Ae(e);const Oi=(e,t,n)=>!n.some(r=>{var s;return!((s=e.getValue(t))!=null&&s.includes(r))});Oi.autoRemove=e=>Ae(e)||!(e!=null&&e.length);const Fi=(e,t,n)=>n.some(r=>{var s;return(s=e.getValue(t))==null?void 0:s.includes(r)});Fi.autoRemove=e=>Ae(e)||!(e!=null&&e.length);const Di=(e,t,n)=>e.getValue(t)===n;Di.autoRemove=e=>Ae(e);const $i=(e,t,n)=>e.getValue(t)==n;$i.autoRemove=e=>Ae(e);const xs=(e,t,n)=>{let[r,s]=n;const o=e.getValue(t);return o>=r&&o<=s};xs.resolveFilterValue=e=>{let[t,n]=e,r=typeof t!="number"?parseFloat(t):t,s=typeof n!="number"?parseFloat(n):n,o=t===null||Number.isNaN(r)?-1/0:r,i=n===null||Number.isNaN(s)?1/0:s;if(o>i){const a=o;o=i,i=a}return[o,i]};xs.autoRemove=e=>Ae(e)||Ae(e[0])&&Ae(e[1]);const We={includesString:Ai,includesStringSensitive:ki,equalsString:Ii,arrIncludes:Pi,arrIncludesAll:Oi,arrIncludesSome:Fi,equals:Di,weakEquals:$i,inNumberRange:xs};function Ae(e){return e==null||e===""}const eu={getDefaultColumnDef:()=>({filterFn:"auto"}),getInitialState:e=>({columnFilters:[],...e}),getDefaultOptions:e=>({onColumnFiltersChange:be("columnFilters",e),filterFromLeafRows:!1,maxLeafRowFilterDepth:100}),createColumn:(e,t)=>{e.getAutoFilterFn=()=>{const n=t.getCoreRowModel().flatRows[0],r=n==null?void 0:n.getValue(e.id);return typeof r=="string"?We.includesString:typeof r=="number"?We.inNumberRange:typeof r=="boolean"||r!==null&&typeof r=="object"?We.equals:Array.isArray(r)?We.arrIncludes:We.weakEquals},e.getFilterFn=()=>{var n,r;return Gn(e.columnDef.filterFn)?e.columnDef.filterFn:e.columnDef.filterFn==="auto"?e.getAutoFilterFn():(n=(r=t.options.filterFns)==null?void 0:r[e.columnDef.filterFn])!=null?n:We[e.columnDef.filterFn]},e.getCanFilter=()=>{var n,r,s;return((n=e.columnDef.enableColumnFilter)!=null?n:!0)&&((r=t.options.enableColumnFilters)!=null?r:!0)&&((s=t.options.enableFilters)!=null?s:!0)&&!!e.accessorFn},e.getIsFiltered=()=>e.getFilterIndex()>-1,e.getFilterValue=()=>{var n;return(n=t.getState().columnFilters)==null||(n=n.find(r=>r.id===e.id))==null?void 0:n.value},e.getFilterIndex=()=>{var n,r;return(n=(r=t.getState().columnFilters)==null?void 0:r.findIndex(s=>s.id===e.id))!=null?n:-1},e.setFilterValue=n=>{t.setColumnFilters(r=>{const s=e.getFilterFn(),o=r==null?void 0:r.find(f=>f.id===e.id),i=it(n,o?o.value:void 0);if(ro(s,i,e)){var a;return(a=r==null?void 0:r.filter(f=>f.id!==e.id))!=null?a:[]}const c={id:e.id,value:i};if(o){var u;return(u=r==null?void 0:r.map(f=>f.id===e.id?c:f))!=null?u:[]}return r!=null&&r.length?[...r,c]:[c]})}},createRow:(e,t)=>{e.columnFilters={},e.columnFiltersMeta={}},createTable:e=>{e.setColumnFilters=t=>{const n=e.getAllLeafColumns(),r=s=>{var o;return(o=it(t,s))==null?void 0:o.filter(i=>{const a=n.find(c=>c.id===i.id);if(a){const c=a.getFilterFn();if(ro(c,i.value,a))return!1}return!0})};e.options.onColumnFiltersChange==null||e.options.onColumnFiltersChange(r)},e.resetColumnFilters=t=>{var n,r;e.setColumnFilters(t?[]:(n=(r=e.initialState)==null?void 0:r.columnFilters)!=null?n:[])},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 ro(e,t,n){return(e&&e.autoRemove?e.autoRemove(t,n):!1)||typeof t>"u"||typeof t=="string"&&!t}const tu=(e,t,n)=>n.reduce((r,s)=>{const o=s.getValue(e);return r+(typeof o=="number"?o:0)},0),nu=(e,t,n)=>{let r;return n.forEach(s=>{const o=s.getValue(e);o!=null&&(r>o||r===void 0&&o>=o)&&(r=o)}),r},ru=(e,t,n)=>{let r;return n.forEach(s=>{const o=s.getValue(e);o!=null&&(r<o||r===void 0&&o>=o)&&(r=o)}),r},su=(e,t,n)=>{let r,s;return n.forEach(o=>{const i=o.getValue(e);i!=null&&(r===void 0?i>=i&&(r=s=i):(r>i&&(r=i),s<i&&(s=i)))}),[r,s]},ou=(e,t)=>{let n=0,r=0;if(t.forEach(s=>{let o=s.getValue(e);o!=null&&(o=+o)>=o&&(++n,r+=o)}),n)return r/n},iu=(e,t)=>{if(!t.length)return;const n=t.map(o=>o.getValue(e));if(!Zc(n))return;if(n.length===1)return n[0];const r=Math.floor(n.length/2),s=n.sort((o,i)=>o-i);return n.length%2!==0?s[r]:(s[r-1]+s[r])/2},au=(e,t)=>Array.from(new Set(t.map(n=>n.getValue(e))).values()),lu=(e,t)=>new Set(t.map(n=>n.getValue(e))).size,cu=(e,t)=>t.length,dr={sum:tu,min:nu,max:ru,extent:su,mean:ou,median:iu,unique:au,uniqueCount:lu,count:cu},uu={getDefaultColumnDef:()=>({aggregatedCell:e=>{var t,n;return(t=(n=e.getValue())==null||n.toString==null?void 0:n.toString())!=null?t:null},aggregationFn:"auto"}),getInitialState:e=>({grouping:[],...e}),getDefaultOptions:e=>({onGroupingChange:be("grouping",e),groupedColumnMode:"reorder"}),createColumn:(e,t)=>{e.toggleGrouping=()=>{t.setGrouping(n=>n!=null&&n.includes(e.id)?n.filter(r=>r!==e.id):[...n??[],e.id])},e.getCanGroup=()=>{var n,r;return((n=e.columnDef.enableGrouping)!=null?n:!0)&&((r=t.options.enableGrouping)!=null?r:!0)&&(!!e.accessorFn||!!e.columnDef.getGroupingValue)},e.getIsGrouped=()=>{var n;return(n=t.getState().grouping)==null?void 0:n.includes(e.id)},e.getGroupedIndex=()=>{var n;return(n=t.getState().grouping)==null?void 0:n.indexOf(e.id)},e.getToggleGroupingHandler=()=>{const n=e.getCanGroup();return()=>{n&&e.toggleGrouping()}},e.getAutoAggregationFn=()=>{const n=t.getCoreRowModel().flatRows[0],r=n==null?void 0:n.getValue(e.id);if(typeof r=="number")return dr.sum;if(Object.prototype.toString.call(r)==="[object Date]")return dr.extent},e.getAggregationFn=()=>{var n,r;if(!e)throw new Error;return Gn(e.columnDef.aggregationFn)?e.columnDef.aggregationFn:e.columnDef.aggregationFn==="auto"?e.getAutoAggregationFn():(n=(r=t.options.aggregationFns)==null?void 0:r[e.columnDef.aggregationFn])!=null?n:dr[e.columnDef.aggregationFn]}},createTable:e=>{e.setGrouping=t=>e.options.onGroupingChange==null?void 0:e.options.onGroupingChange(t),e.resetGrouping=t=>{var n,r;e.setGrouping(t?[]:(n=(r=e.initialState)==null?void 0:r.grouping)!=null?n:[])},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,t)=>{e.getIsGrouped=()=>!!e.groupingColumnId,e.getGroupingValue=n=>{if(e._groupingValuesCache.hasOwnProperty(n))return e._groupingValuesCache[n];const r=t.getColumn(n);return r!=null&&r.columnDef.getGroupingValue?(e._groupingValuesCache[n]=r.columnDef.getGroupingValue(e.original),e._groupingValuesCache[n]):e.getValue(n)},e._groupingValuesCache={}},createCell:(e,t,n,r)=>{e.getIsGrouped=()=>t.getIsGrouped()&&t.id===n.groupingColumnId,e.getIsPlaceholder=()=>!e.getIsGrouped()&&t.getIsGrouped(),e.getIsAggregated=()=>{var s;return!e.getIsGrouped()&&!e.getIsPlaceholder()&&!!((s=n.subRows)!=null&&s.length)}}};function du(e,t,n){if(!(t!=null&&t.length)||!n)return e;const r=e.filter(o=>!t.includes(o.id));return n==="remove"?r:[...t.map(o=>e.find(i=>i.id===o)).filter(Boolean),...r]}const fu={getInitialState:e=>({columnOrder:[],...e}),getDefaultOptions:e=>({onColumnOrderChange:be("columnOrder",e)}),createColumn:(e,t)=>{e.getIndex=P(n=>[Xt(t,n)],n=>n.findIndex(r=>r.id===e.id),O(t.options,"debugColumns")),e.getIsFirstColumn=n=>{var r;return((r=Xt(t,n)[0])==null?void 0:r.id)===e.id},e.getIsLastColumn=n=>{var r;const s=Xt(t,n);return((r=s[s.length-1])==null?void 0:r.id)===e.id}},createTable:e=>{e.setColumnOrder=t=>e.options.onColumnOrderChange==null?void 0:e.options.onColumnOrderChange(t),e.resetColumnOrder=t=>{var n;e.setColumnOrder(t?[]:(n=e.initialState.columnOrder)!=null?n:[])},e._getOrderColumnsFn=P(()=>[e.getState().columnOrder,e.getState().grouping,e.options.groupedColumnMode],(t,n,r)=>s=>{let o=[];if(!(t!=null&&t.length))o=s;else{const i=[...t],a=[...s];for(;a.length&&i.length;){const c=i.shift(),u=a.findIndex(f=>f.id===c);u>-1&&o.push(a.splice(u,1)[0])}o=[...o,...a]}return du(o,n,r)},O(e.options,"debugTable"))}},fr=()=>({left:[],right:[]}),gu={getInitialState:e=>({columnPinning:fr(),...e}),getDefaultOptions:e=>({onColumnPinningChange:be("columnPinning",e)}),createColumn:(e,t)=>{e.pin=n=>{const r=e.getLeafColumns().map(s=>s.id).filter(Boolean);t.setColumnPinning(s=>{var o,i;if(n==="right"){var a,c;return{left:((a=s==null?void 0:s.left)!=null?a:[]).filter(m=>!(r!=null&&r.includes(m))),right:[...((c=s==null?void 0:s.right)!=null?c:[]).filter(m=>!(r!=null&&r.includes(m))),...r]}}if(n==="left"){var u,f;return{left:[...((u=s==null?void 0:s.left)!=null?u:[]).filter(m=>!(r!=null&&r.includes(m))),...r],right:((f=s==null?void 0:s.right)!=null?f:[]).filter(m=>!(r!=null&&r.includes(m)))}}return{left:((o=s==null?void 0:s.left)!=null?o:[]).filter(m=>!(r!=null&&r.includes(m))),right:((i=s==null?void 0:s.right)!=null?i:[]).filter(m=>!(r!=null&&r.includes(m)))}})},e.getCanPin=()=>e.getLeafColumns().some(r=>{var s,o,i;return((s=r.columnDef.enablePinning)!=null?s:!0)&&((o=(i=t.options.enableColumnPinning)!=null?i:t.options.enablePinning)!=null?o:!0)}),e.getIsPinned=()=>{const n=e.getLeafColumns().map(a=>a.id),{left:r,right:s}=t.getState().columnPinning,o=n.some(a=>r==null?void 0:r.includes(a)),i=n.some(a=>s==null?void 0:s.includes(a));return o?"left":i?"right":!1},e.getPinnedIndex=()=>{var n,r;const s=e.getIsPinned();return s?(n=(r=t.getState().columnPinning)==null||(r=r[s])==null?void 0:r.indexOf(e.id))!=null?n:-1:0}},createRow:(e,t)=>{e.getCenterVisibleCells=P(()=>[e._getAllVisibleCells(),t.getState().columnPinning.left,t.getState().columnPinning.right],(n,r,s)=>{const o=[...r??[],...s??[]];return n.filter(i=>!o.includes(i.column.id))},O(t.options,"debugRows")),e.getLeftVisibleCells=P(()=>[e._getAllVisibleCells(),t.getState().columnPinning.left],(n,r)=>(r??[]).map(o=>n.find(i=>i.column.id===o)).filter(Boolean).map(o=>({...o,position:"left"})),O(t.options,"debugRows")),e.getRightVisibleCells=P(()=>[e._getAllVisibleCells(),t.getState().columnPinning.right],(n,r)=>(r??[]).map(o=>n.find(i=>i.column.id===o)).filter(Boolean).map(o=>({...o,position:"right"})),O(t.options,"debugRows"))},createTable:e=>{e.setColumnPinning=t=>e.options.onColumnPinningChange==null?void 0:e.options.onColumnPinningChange(t),e.resetColumnPinning=t=>{var n,r;return e.setColumnPinning(t?fr():(n=(r=e.initialState)==null?void 0:r.columnPinning)!=null?n:fr())},e.getIsSomeColumnsPinned=t=>{var n;const r=e.getState().columnPinning;if(!t){var s,o;return!!((s=r.left)!=null&&s.length||(o=r.right)!=null&&o.length)}return!!((n=r[t])!=null&&n.length)},e.getLeftLeafColumns=P(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left],(t,n)=>(n??[]).map(r=>t.find(s=>s.id===r)).filter(Boolean),O(e.options,"debugColumns")),e.getRightLeafColumns=P(()=>[e.getAllLeafColumns(),e.getState().columnPinning.right],(t,n)=>(n??[]).map(r=>t.find(s=>s.id===r)).filter(Boolean),O(e.options,"debugColumns")),e.getCenterLeafColumns=P(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,r)=>{const s=[...n??[],...r??[]];return t.filter(o=>!s.includes(o.id))},O(e.options,"debugColumns"))}};function mu(e){return e||(typeof document<"u"?document:null)}const pn={size:150,minSize:20,maxSize:Number.MAX_SAFE_INTEGER},gr=()=>({startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}),hu={getDefaultColumnDef:()=>pn,getInitialState:e=>({columnSizing:{},columnSizingInfo:gr(),...e}),getDefaultOptions:e=>({columnResizeMode:"onEnd",columnResizeDirection:"ltr",onColumnSizingChange:be("columnSizing",e),onColumnSizingInfoChange:be("columnSizingInfo",e)}),createColumn:(e,t)=>{e.getSize=()=>{var n,r,s;const o=t.getState().columnSizing[e.id];return Math.min(Math.max((n=e.columnDef.minSize)!=null?n:pn.minSize,(r=o??e.columnDef.size)!=null?r:pn.size),(s=e.columnDef.maxSize)!=null?s:pn.maxSize)},e.getStart=P(n=>[n,Xt(t,n),t.getState().columnSizing],(n,r)=>r.slice(0,e.getIndex(n)).reduce((s,o)=>s+o.getSize(),0),O(t.options,"debugColumns")),e.getAfter=P(n=>[n,Xt(t,n),t.getState().columnSizing],(n,r)=>r.slice(e.getIndex(n)+1).reduce((s,o)=>s+o.getSize(),0),O(t.options,"debugColumns")),e.resetSize=()=>{t.setColumnSizing(n=>{let{[e.id]:r,...s}=n;return s})},e.getCanResize=()=>{var n,r;return((n=e.columnDef.enableResizing)!=null?n:!0)&&((r=t.options.enableColumnResizing)!=null?r:!0)},e.getIsResizing=()=>t.getState().columnSizingInfo.isResizingColumn===e.id},createHeader:(e,t)=>{e.getSize=()=>{let n=0;const r=s=>{if(s.subHeaders.length)s.subHeaders.forEach(r);else{var o;n+=(o=s.column.getSize())!=null?o:0}};return r(e),n},e.getStart=()=>{if(e.index>0){const n=e.headerGroup.headers[e.index-1];return n.getStart()+n.getSize()}return 0},e.getResizeHandler=n=>{const r=t.getColumn(e.column.id),s=r==null?void 0:r.getCanResize();return o=>{if(!r||!s||(o.persist==null||o.persist(),mr(o)&&o.touches&&o.touches.length>1))return;const i=e.getSize(),a=e?e.getLeafHeaders().map(x=>[x.column.id,x.column.getSize()]):[[r.id,r.getSize()]],c=mr(o)?Math.round(o.touches[0].clientX):o.clientX,u={},f=(x,w)=>{typeof w=="number"&&(t.setColumnSizingInfo(_=>{var S,C;const M=t.options.columnResizeDirection==="rtl"?-1:1,E=(w-((S=_==null?void 0:_.startOffset)!=null?S:0))*M,N=Math.max(E/((C=_==null?void 0:_.startSize)!=null?C:0),-.999999);return _.columnSizingStart.forEach(H=>{let[F,q]=H;u[F]=Math.round(Math.max(q+q*N,0)*100)/100}),{..._,deltaOffset:E,deltaPercentage:N}}),(t.options.columnResizeMode==="onChange"||x==="end")&&t.setColumnSizing(_=>({..._,...u})))},m=x=>f("move",x),g=x=>{f("end",x),t.setColumnSizingInfo(w=>({...w,isResizingColumn:!1,startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,columnSizingStart:[]}))},d=mu(n),v={moveHandler:x=>m(x.clientX),upHandler:x=>{d==null||d.removeEventListener("mousemove",v.moveHandler),d==null||d.removeEventListener("mouseup",v.upHandler),g(x.clientX)}},h={moveHandler:x=>(x.cancelable&&(x.preventDefault(),x.stopPropagation()),m(x.touches[0].clientX),!1),upHandler:x=>{var w;d==null||d.removeEventListener("touchmove",h.moveHandler),d==null||d.removeEventListener("touchend",h.upHandler),x.cancelable&&(x.preventDefault(),x.stopPropagation()),g((w=x.touches[0])==null?void 0:w.clientX)}},y=pu()?{passive:!1}:!1;mr(o)?(d==null||d.addEventListener("touchmove",h.moveHandler,y),d==null||d.addEventListener("touchend",h.upHandler,y)):(d==null||d.addEventListener("mousemove",v.moveHandler,y),d==null||d.addEventListener("mouseup",v.upHandler,y)),t.setColumnSizingInfo(x=>({...x,startOffset:c,startSize:i,deltaOffset:0,deltaPercentage:0,columnSizingStart:a,isResizingColumn:r.id}))}}},createTable:e=>{e.setColumnSizing=t=>e.options.onColumnSizingChange==null?void 0:e.options.onColumnSizingChange(t),e.setColumnSizingInfo=t=>e.options.onColumnSizingInfoChange==null?void 0:e.options.onColumnSizingInfoChange(t),e.resetColumnSizing=t=>{var n;e.setColumnSizing(t?{}:(n=e.initialState.columnSizing)!=null?n:{})},e.resetHeaderSizeInfo=t=>{var n;e.setColumnSizingInfo(t?gr():(n=e.initialState.columnSizingInfo)!=null?n:gr())},e.getTotalSize=()=>{var t,n;return(t=(n=e.getHeaderGroups()[0])==null?void 0:n.headers.reduce((r,s)=>r+s.getSize(),0))!=null?t:0},e.getLeftTotalSize=()=>{var t,n;return(t=(n=e.getLeftHeaderGroups()[0])==null?void 0:n.headers.reduce((r,s)=>r+s.getSize(),0))!=null?t:0},e.getCenterTotalSize=()=>{var t,n;return(t=(n=e.getCenterHeaderGroups()[0])==null?void 0:n.headers.reduce((r,s)=>r+s.getSize(),0))!=null?t:0},e.getRightTotalSize=()=>{var t,n;return(t=(n=e.getRightHeaderGroups()[0])==null?void 0:n.headers.reduce((r,s)=>r+s.getSize(),0))!=null?t:0}}};let vn=null;function pu(){if(typeof vn=="boolean")return vn;let e=!1;try{const t={get passive(){return e=!0,!1}},n=()=>{};window.addEventListener("test",n,t),window.removeEventListener("test",n)}catch{e=!1}return vn=e,vn}function mr(e){return e.type==="touchstart"}const vu={getInitialState:e=>({columnVisibility:{},...e}),getDefaultOptions:e=>({onColumnVisibilityChange:be("columnVisibility",e)}),createColumn:(e,t)=>{e.toggleVisibility=n=>{e.getCanHide()&&t.setColumnVisibility(r=>({...r,[e.id]:n??!e.getIsVisible()}))},e.getIsVisible=()=>{var n,r;const s=e.columns;return(n=s.length?s.some(o=>o.getIsVisible()):(r=t.getState().columnVisibility)==null?void 0:r[e.id])!=null?n:!0},e.getCanHide=()=>{var n,r;return((n=e.columnDef.enableHiding)!=null?n:!0)&&((r=t.options.enableHiding)!=null?r:!0)},e.getToggleVisibilityHandler=()=>n=>{e.toggleVisibility==null||e.toggleVisibility(n.target.checked)}},createRow:(e,t)=>{e._getAllVisibleCells=P(()=>[e.getAllCells(),t.getState().columnVisibility],n=>n.filter(r=>r.column.getIsVisible()),O(t.options,"debugRows")),e.getVisibleCells=P(()=>[e.getLeftVisibleCells(),e.getCenterVisibleCells(),e.getRightVisibleCells()],(n,r,s)=>[...n,...r,...s],O(t.options,"debugRows"))},createTable:e=>{const t=(n,r)=>P(()=>[r(),r().filter(s=>s.getIsVisible()).map(s=>s.id).join("_")],s=>s.filter(o=>o.getIsVisible==null?void 0:o.getIsVisible()),O(e.options,"debugColumns"));e.getVisibleFlatColumns=t("getVisibleFlatColumns",()=>e.getAllFlatColumns()),e.getVisibleLeafColumns=t("getVisibleLeafColumns",()=>e.getAllLeafColumns()),e.getLeftVisibleLeafColumns=t("getLeftVisibleLeafColumns",()=>e.getLeftLeafColumns()),e.getRightVisibleLeafColumns=t("getRightVisibleLeafColumns",()=>e.getRightLeafColumns()),e.getCenterVisibleLeafColumns=t("getCenterVisibleLeafColumns",()=>e.getCenterLeafColumns()),e.setColumnVisibility=n=>e.options.onColumnVisibilityChange==null?void 0:e.options.onColumnVisibilityChange(n),e.resetColumnVisibility=n=>{var r;e.setColumnVisibility(n?{}:(r=e.initialState.columnVisibility)!=null?r:{})},e.toggleAllColumnsVisible=n=>{var r;n=(r=n)!=null?r:!e.getIsAllColumnsVisible(),e.setColumnVisibility(e.getAllLeafColumns().reduce((s,o)=>({...s,[o.id]:n||!(o.getCanHide!=null&&o.getCanHide())}),{}))},e.getIsAllColumnsVisible=()=>!e.getAllLeafColumns().some(n=>!(n.getIsVisible!=null&&n.getIsVisible())),e.getIsSomeColumnsVisible=()=>e.getAllLeafColumns().some(n=>n.getIsVisible==null?void 0:n.getIsVisible()),e.getToggleAllColumnsVisibilityHandler=()=>n=>{var r;e.toggleAllColumnsVisible((r=n.target)==null?void 0:r.checked)}}};function Xt(e,t){return t?t==="center"?e.getCenterVisibleLeafColumns():t==="left"?e.getLeftVisibleLeafColumns():e.getRightVisibleLeafColumns():e.getVisibleLeafColumns()}const xu={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()}}},yu={getInitialState:e=>({globalFilter:void 0,...e}),getDefaultOptions:e=>({onGlobalFilterChange:be("globalFilter",e),globalFilterFn:"auto",getColumnCanGlobalFilter:t=>{var n;const r=(n=e.getCoreRowModel().flatRows[0])==null||(n=n._getAllCellsByColumnId()[t.id])==null?void 0:n.getValue();return typeof r=="string"||typeof r=="number"}}),createColumn:(e,t)=>{e.getCanGlobalFilter=()=>{var n,r,s,o;return((n=e.columnDef.enableGlobalFilter)!=null?n:!0)&&((r=t.options.enableGlobalFilter)!=null?r:!0)&&((s=t.options.enableFilters)!=null?s:!0)&&((o=t.options.getColumnCanGlobalFilter==null?void 0:t.options.getColumnCanGlobalFilter(e))!=null?o:!0)&&!!e.accessorFn}},createTable:e=>{e.getGlobalAutoFilterFn=()=>We.includesString,e.getGlobalFilterFn=()=>{var t,n;const{globalFilterFn:r}=e.options;return Gn(r)?r:r==="auto"?e.getGlobalAutoFilterFn():(t=(n=e.options.filterFns)==null?void 0:n[r])!=null?t:We[r]},e.setGlobalFilter=t=>{e.options.onGlobalFilterChange==null||e.options.onGlobalFilterChange(t)},e.resetGlobalFilter=t=>{e.setGlobalFilter(t?void 0:e.initialState.globalFilter)}}},wu={getInitialState:e=>({expanded:{},...e}),getDefaultOptions:e=>({onExpandedChange:be("expanded",e),paginateExpandedRows:!0}),createTable:e=>{let t=!1,n=!1;e._autoResetExpanded=()=>{var r,s;if(!t){e._queue(()=>{t=!0});return}if((r=(s=e.options.autoResetAll)!=null?s:e.options.autoResetExpanded)!=null?r:!e.options.manualExpanding){if(n)return;n=!0,e._queue(()=>{e.resetExpanded(),n=!1})}},e.setExpanded=r=>e.options.onExpandedChange==null?void 0:e.options.onExpandedChange(r),e.toggleAllRowsExpanded=r=>{r??!e.getIsAllRowsExpanded()?e.setExpanded(!0):e.setExpanded({})},e.resetExpanded=r=>{var s,o;e.setExpanded(r?{}:(s=(o=e.initialState)==null?void 0:o.expanded)!=null?s:{})},e.getCanSomeRowsExpand=()=>e.getPrePaginationRowModel().flatRows.some(r=>r.getCanExpand()),e.getToggleAllRowsExpandedHandler=()=>r=>{r.persist==null||r.persist(),e.toggleAllRowsExpanded()},e.getIsSomeRowsExpanded=()=>{const r=e.getState().expanded;return r===!0||Object.values(r).some(Boolean)},e.getIsAllRowsExpanded=()=>{const r=e.getState().expanded;return typeof r=="boolean"?r===!0:!(!Object.keys(r).length||e.getRowModel().flatRows.some(s=>!s.getIsExpanded()))},e.getExpandedDepth=()=>{let r=0;return(e.getState().expanded===!0?Object.keys(e.getRowModel().rowsById):Object.keys(e.getState().expanded)).forEach(o=>{const i=o.split(".");r=Math.max(r,i.length)}),r},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,t)=>{e.toggleExpanded=n=>{t.setExpanded(r=>{var s;const o=r===!0?!0:!!(r!=null&&r[e.id]);let i={};if(r===!0?Object.keys(t.getRowModel().rowsById).forEach(a=>{i[a]=!0}):i=r,n=(s=n)!=null?s:!o,!o&&n)return{...i,[e.id]:!0};if(o&&!n){const{[e.id]:a,...c}=i;return c}return r})},e.getIsExpanded=()=>{var n;const r=t.getState().expanded;return!!((n=t.options.getIsRowExpanded==null?void 0:t.options.getIsRowExpanded(e))!=null?n:r===!0||r!=null&&r[e.id])},e.getCanExpand=()=>{var n,r,s;return(n=t.options.getRowCanExpand==null?void 0:t.options.getRowCanExpand(e))!=null?n:((r=t.options.enableExpanding)!=null?r:!0)&&!!((s=e.subRows)!=null&&s.length)},e.getIsAllParentsExpanded=()=>{let n=!0,r=e;for(;n&&r.parentId;)r=t.getRow(r.parentId,!0),n=r.getIsExpanded();return n},e.getToggleExpandedHandler=()=>{const n=e.getCanExpand();return()=>{n&&e.toggleExpanded()}}}},Vr=0,Hr=10,hr=()=>({pageIndex:Vr,pageSize:Hr}),_u={getInitialState:e=>({...e,pagination:{...hr(),...e==null?void 0:e.pagination}}),getDefaultOptions:e=>({onPaginationChange:be("pagination",e)}),createTable:e=>{let t=!1,n=!1;e._autoResetPageIndex=()=>{var r,s;if(!t){e._queue(()=>{t=!0});return}if((r=(s=e.options.autoResetAll)!=null?s:e.options.autoResetPageIndex)!=null?r:!e.options.manualPagination){if(n)return;n=!0,e._queue(()=>{e.resetPageIndex(),n=!1})}},e.setPagination=r=>{const s=o=>it(r,o);return e.options.onPaginationChange==null?void 0:e.options.onPaginationChange(s)},e.resetPagination=r=>{var s;e.setPagination(r?hr():(s=e.initialState.pagination)!=null?s:hr())},e.setPageIndex=r=>{e.setPagination(s=>{let o=it(r,s.pageIndex);const i=typeof e.options.pageCount>"u"||e.options.pageCount===-1?Number.MAX_SAFE_INTEGER:e.options.pageCount-1;return o=Math.max(0,Math.min(o,i)),{...s,pageIndex:o}})},e.resetPageIndex=r=>{var s,o;e.setPageIndex(r?Vr:(s=(o=e.initialState)==null||(o=o.pagination)==null?void 0:o.pageIndex)!=null?s:Vr)},e.resetPageSize=r=>{var s,o;e.setPageSize(r?Hr:(s=(o=e.initialState)==null||(o=o.pagination)==null?void 0:o.pageSize)!=null?s:Hr)},e.setPageSize=r=>{e.setPagination(s=>{const o=Math.max(1,it(r,s.pageSize)),i=s.pageSize*s.pageIndex,a=Math.floor(i/o);return{...s,pageIndex:a,pageSize:o}})},e.setPageCount=r=>e.setPagination(s=>{var o;let i=it(r,(o=e.options.pageCount)!=null?o:-1);return typeof i=="number"&&(i=Math.max(-1,i)),{...s,pageCount:i}}),e.getPageOptions=P(()=>[e.getPageCount()],r=>{let s=[];return r&&r>0&&(s=[...new Array(r)].fill(null).map((o,i)=>i)),s},O(e.options,"debugTable")),e.getCanPreviousPage=()=>e.getState().pagination.pageIndex>0,e.getCanNextPage=()=>{const{pageIndex:r}=e.getState().pagination,s=e.getPageCount();return s===-1?!0:s===0?!1:r<s-1},e.previousPage=()=>e.setPageIndex(r=>r-1),e.nextPage=()=>e.setPageIndex(r=>r+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 r;return(r=e.options.pageCount)!=null?r:Math.ceil(e.getRowCount()/e.getState().pagination.pageSize)},e.getRowCount=()=>{var r;return(r=e.options.rowCount)!=null?r:e.getPrePaginationRowModel().rows.length}}},pr=()=>({top:[],bottom:[]}),Su={getInitialState:e=>({rowPinning:pr(),...e}),getDefaultOptions:e=>({onRowPinningChange:be("rowPinning",e)}),createRow:(e,t)=>{e.pin=(n,r,s)=>{const o=r?e.getLeafRows().map(c=>{let{id:u}=c;return u}):[],i=s?e.getParentRows().map(c=>{let{id:u}=c;return u}):[],a=new Set([...i,e.id,...o]);t.setRowPinning(c=>{var u,f;if(n==="bottom"){var m,g;return{top:((m=c==null?void 0:c.top)!=null?m:[]).filter(h=>!(a!=null&&a.has(h))),bottom:[...((g=c==null?void 0:c.bottom)!=null?g:[]).filter(h=>!(a!=null&&a.has(h))),...Array.from(a)]}}if(n==="top"){var d,v;return{top:[...((d=c==null?void 0:c.top)!=null?d:[]).filter(h=>!(a!=null&&a.has(h))),...Array.from(a)],bottom:((v=c==null?void 0:c.bottom)!=null?v:[]).filter(h=>!(a!=null&&a.has(h)))}}return{top:((u=c==null?void 0:c.top)!=null?u:[]).filter(h=>!(a!=null&&a.has(h))),bottom:((f=c==null?void 0:c.bottom)!=null?f:[]).filter(h=>!(a!=null&&a.has(h)))}})},e.getCanPin=()=>{var n;const{enableRowPinning:r,enablePinning:s}=t.options;return typeof r=="function"?r(e):(n=r??s)!=null?n:!0},e.getIsPinned=()=>{const n=[e.id],{top:r,bottom:s}=t.getState().rowPinning,o=n.some(a=>r==null?void 0:r.includes(a)),i=n.some(a=>s==null?void 0:s.includes(a));return o?"top":i?"bottom":!1},e.getPinnedIndex=()=>{var n,r;const s=e.getIsPinned();if(!s)return-1;const o=(n=s==="top"?t.getTopRows():t.getBottomRows())==null?void 0:n.map(i=>{let{id:a}=i;return a});return(r=o==null?void 0:o.indexOf(e.id))!=null?r:-1}},createTable:e=>{e.setRowPinning=t=>e.options.onRowPinningChange==null?void 0:e.options.onRowPinningChange(t),e.resetRowPinning=t=>{var n,r;return e.setRowPinning(t?pr():(n=(r=e.initialState)==null?void 0:r.rowPinning)!=null?n:pr())},e.getIsSomeRowsPinned=t=>{var n;const r=e.getState().rowPinning;if(!t){var s,o;return!!((s=r.top)!=null&&s.length||(o=r.bottom)!=null&&o.length)}return!!((n=r[t])!=null&&n.length)},e._getPinnedRows=(t,n,r)=>{var s;return((s=e.options.keepPinnedRows)==null||s?(n??[]).map(i=>{const a=e.getRow(i,!0);return a.getIsAllParentsExpanded()?a:null}):(n??[]).map(i=>t.find(a=>a.id===i))).filter(Boolean).map(i=>({...i,position:r}))},e.getTopRows=P(()=>[e.getRowModel().rows,e.getState().rowPinning.top],(t,n)=>e._getPinnedRows(t,n,"top"),O(e.options,"debugRows")),e.getBottomRows=P(()=>[e.getRowModel().rows,e.getState().rowPinning.bottom],(t,n)=>e._getPinnedRows(t,n,"bottom"),O(e.options,"debugRows")),e.getCenterRows=P(()=>[e.getRowModel().rows,e.getState().rowPinning.top,e.getState().rowPinning.bottom],(t,n,r)=>{const s=new Set([...n??[],...r??[]]);return t.filter(o=>!s.has(o.id))},O(e.options,"debugRows"))}},Cu={getInitialState:e=>({rowSelection:{},...e}),getDefaultOptions:e=>({onRowSelectionChange:be("rowSelection",e),enableRowSelection:!0,enableMultiRowSelection:!0,enableSubRowSelection:!0}),createTable:e=>{e.setRowSelection=t=>e.options.onRowSelectionChange==null?void 0:e.options.onRowSelectionChange(t),e.resetRowSelection=t=>{var n;return e.setRowSelection(t?{}:(n=e.initialState.rowSelection)!=null?n:{})},e.toggleAllRowsSelected=t=>{e.setRowSelection(n=>{t=typeof t<"u"?t:!e.getIsAllRowsSelected();const r={...n},s=e.getPreGroupedRowModel().flatRows;return t?s.forEach(o=>{o.getCanSelect()&&(r[o.id]=!0)}):s.forEach(o=>{delete r[o.id]}),r})},e.toggleAllPageRowsSelected=t=>e.setRowSelection(n=>{const r=typeof t<"u"?t:!e.getIsAllPageRowsSelected(),s={...n};return e.getRowModel().rows.forEach(o=>{zr(s,o.id,r,!0,e)}),s}),e.getPreSelectedRowModel=()=>e.getCoreRowModel(),e.getSelectedRowModel=P(()=>[e.getState().rowSelection,e.getCoreRowModel()],(t,n)=>Object.keys(t).length?vr(e,n):{rows:[],flatRows:[],rowsById:{}},O(e.options,"debugTable")),e.getFilteredSelectedRowModel=P(()=>[e.getState().rowSelection,e.getFilteredRowModel()],(t,n)=>Object.keys(t).length?vr(e,n):{rows:[],flatRows:[],rowsById:{}},O(e.options,"debugTable")),e.getGroupedSelectedRowModel=P(()=>[e.getState().rowSelection,e.getSortedRowModel()],(t,n)=>Object.keys(t).length?vr(e,n):{rows:[],flatRows:[],rowsById:{}},O(e.options,"debugTable")),e.getIsAllRowsSelected=()=>{const t=e.getFilteredRowModel().flatRows,{rowSelection:n}=e.getState();let r=!!(t.length&&Object.keys(n).length);return r&&t.some(s=>s.getCanSelect()&&!n[s.id])&&(r=!1),r},e.getIsAllPageRowsSelected=()=>{const t=e.getPaginationRowModel().flatRows.filter(s=>s.getCanSelect()),{rowSelection:n}=e.getState();let r=!!t.length;return r&&t.some(s=>!n[s.id])&&(r=!1),r},e.getIsSomeRowsSelected=()=>{var t;const n=Object.keys((t=e.getState().rowSelection)!=null?t:{}).length;return n>0&&n<e.getFilteredRowModel().flatRows.length},e.getIsSomePageRowsSelected=()=>{const t=e.getPaginationRowModel().flatRows;return e.getIsAllPageRowsSelected()?!1:t.filter(n=>n.getCanSelect()).some(n=>n.getIsSelected()||n.getIsSomeSelected())},e.getToggleAllRowsSelectedHandler=()=>t=>{e.toggleAllRowsSelected(t.target.checked)},e.getToggleAllPageRowsSelectedHandler=()=>t=>{e.toggleAllPageRowsSelected(t.target.checked)}},createRow:(e,t)=>{e.toggleSelected=(n,r)=>{const s=e.getIsSelected();t.setRowSelection(o=>{var i;if(n=typeof n<"u"?n:!s,e.getCanSelect()&&s===n)return o;const a={...o};return zr(a,e.id,n,(i=r==null?void 0:r.selectChildren)!=null?i:!0,t),a})},e.getIsSelected=()=>{const{rowSelection:n}=t.getState();return ys(e,n)},e.getIsSomeSelected=()=>{const{rowSelection:n}=t.getState();return Gr(e,n)==="some"},e.getIsAllSubRowsSelected=()=>{const{rowSelection:n}=t.getState();return Gr(e,n)==="all"},e.getCanSelect=()=>{var n;return typeof t.options.enableRowSelection=="function"?t.options.enableRowSelection(e):(n=t.options.enableRowSelection)!=null?n:!0},e.getCanSelectSubRows=()=>{var n;return typeof t.options.enableSubRowSelection=="function"?t.options.enableSubRowSelection(e):(n=t.options.enableSubRowSelection)!=null?n:!0},e.getCanMultiSelect=()=>{var n;return typeof t.options.enableMultiRowSelection=="function"?t.options.enableMultiRowSelection(e):(n=t.options.enableMultiRowSelection)!=null?n:!0},e.getToggleSelectedHandler=()=>{const n=e.getCanSelect();return r=>{var s;n&&e.toggleSelected((s=r.target)==null?void 0:s.checked)}}}},zr=(e,t,n,r,s)=>{var o;const i=s.getRow(t,!0);n?(i.getCanMultiSelect()||Object.keys(e).forEach(a=>delete e[a]),i.getCanSelect()&&(e[t]=!0)):delete e[t],r&&(o=i.subRows)!=null&&o.length&&i.getCanSelectSubRows()&&i.subRows.forEach(a=>zr(e,a.id,n,r,s))};function vr(e,t){const n=e.getState().rowSelection,r=[],s={},o=function(i,a){return i.map(c=>{var u;const f=ys(c,n);if(f&&(r.push(c),s[c.id]=c),(u=c.subRows)!=null&&u.length&&(c={...c,subRows:o(c.subRows)}),f)return c}).filter(Boolean)};return{rows:o(t.rows),flatRows:r,rowsById:s}}function ys(e,t){var n;return(n=t[e.id])!=null?n:!1}function Gr(e,t,n){var r;if(!((r=e.subRows)!=null&&r.length))return!1;let s=!0,o=!1;return e.subRows.forEach(i=>{if(!(o&&!s)&&(i.getCanSelect()&&(ys(i,t)?o=!0:s=!1),i.subRows&&i.subRows.length)){const a=Gr(i,t);a==="all"?o=!0:(a==="some"&&(o=!0),s=!1)}}),s?"all":o?"some":!1}const Br=/([0-9]+)/gm,bu=(e,t,n)=>Li(ft(e.getValue(n)).toLowerCase(),ft(t.getValue(n)).toLowerCase()),Ru=(e,t,n)=>Li(ft(e.getValue(n)),ft(t.getValue(n))),Eu=(e,t,n)=>ws(ft(e.getValue(n)).toLowerCase(),ft(t.getValue(n)).toLowerCase()),Mu=(e,t,n)=>ws(ft(e.getValue(n)),ft(t.getValue(n))),Nu=(e,t,n)=>{const r=e.getValue(n),s=t.getValue(n);return r>s?1:r<s?-1:0},Tu=(e,t,n)=>ws(e.getValue(n),t.getValue(n));function ws(e,t){return e===t?0:e>t?1:-1}function ft(e){return typeof e=="number"?isNaN(e)||e===1/0||e===-1/0?"":String(e):typeof e=="string"?e:""}function Li(e,t){const n=e.split(Br).filter(Boolean),r=t.split(Br).filter(Boolean);for(;n.length&&r.length;){const s=n.shift(),o=r.shift(),i=parseInt(s,10),a=parseInt(o,10),c=[i,a].sort();if(isNaN(c[0])){if(s>o)return 1;if(o>s)return-1;continue}if(isNaN(c[1]))return isNaN(i)?-1:1;if(i>a)return 1;if(a>i)return-1}return n.length-r.length}const Wt={alphanumeric:bu,alphanumericCaseSensitive:Ru,text:Eu,textCaseSensitive:Mu,datetime:Nu,basic:Tu},ju={getInitialState:e=>({sorting:[],...e}),getDefaultColumnDef:()=>({sortingFn:"auto",sortUndefined:1}),getDefaultOptions:e=>({onSortingChange:be("sorting",e),isMultiSortEvent:t=>t.shiftKey}),createColumn:(e,t)=>{e.getAutoSortingFn=()=>{const n=t.getFilteredRowModel().flatRows.slice(10);let r=!1;for(const s of n){const o=s==null?void 0:s.getValue(e.id);if(Object.prototype.toString.call(o)==="[object Date]")return Wt.datetime;if(typeof o=="string"&&(r=!0,o.split(Br).length>1))return Wt.alphanumeric}return r?Wt.text:Wt.basic},e.getAutoSortDir=()=>{const n=t.getFilteredRowModel().flatRows[0];return typeof(n==null?void 0:n.getValue(e.id))=="string"?"asc":"desc"},e.getSortingFn=()=>{var n,r;if(!e)throw new Error;return Gn(e.columnDef.sortingFn)?e.columnDef.sortingFn:e.columnDef.sortingFn==="auto"?e.getAutoSortingFn():(n=(r=t.options.sortingFns)==null?void 0:r[e.columnDef.sortingFn])!=null?n:Wt[e.columnDef.sortingFn]},e.toggleSorting=(n,r)=>{const s=e.getNextSortingOrder(),o=typeof n<"u"&&n!==null;t.setSorting(i=>{const a=i==null?void 0:i.find(d=>d.id===e.id),c=i==null?void 0:i.findIndex(d=>d.id===e.id);let u=[],f,m=o?n:s==="desc";if(i!=null&&i.length&&e.getCanMultiSort()&&r?a?f="toggle":f="add":i!=null&&i.length&&c!==i.length-1?f="replace":a?f="toggle":f="replace",f==="toggle"&&(o||s||(f="remove")),f==="add"){var g;u=[...i,{id:e.id,desc:m}],u.splice(0,u.length-((g=t.options.maxMultiSortColCount)!=null?g:Number.MAX_SAFE_INTEGER))}else f==="toggle"?u=i.map(d=>d.id===e.id?{...d,desc:m}:d):f==="remove"?u=i.filter(d=>d.id!==e.id):u=[{id:e.id,desc:m}];return u})},e.getFirstSortDir=()=>{var n,r;return((n=(r=e.columnDef.sortDescFirst)!=null?r:t.options.sortDescFirst)!=null?n:e.getAutoSortDir()==="desc")?"desc":"asc"},e.getNextSortingOrder=n=>{var r,s;const o=e.getFirstSortDir(),i=e.getIsSorted();return i?i!==o&&((r=t.options.enableSortingRemoval)==null||r)&&(!(n&&(s=t.options.enableMultiRemove)!=null)||s)?!1:i==="desc"?"asc":"desc":o},e.getCanSort=()=>{var n,r;return((n=e.columnDef.enableSorting)!=null?n:!0)&&((r=t.options.enableSorting)!=null?r:!0)&&!!e.accessorFn},e.getCanMultiSort=()=>{var n,r;return(n=(r=e.columnDef.enableMultiSort)!=null?r:t.options.enableMultiSort)!=null?n:!!e.accessorFn},e.getIsSorted=()=>{var n;const r=(n=t.getState().sorting)==null?void 0:n.find(s=>s.id===e.id);return r?r.desc?"desc":"asc":!1},e.getSortIndex=()=>{var n,r;return(n=(r=t.getState().sorting)==null?void 0:r.findIndex(s=>s.id===e.id))!=null?n:-1},e.clearSorting=()=>{t.setSorting(n=>n!=null&&n.length?n.filter(r=>r.id!==e.id):[])},e.getToggleSortingHandler=()=>{const n=e.getCanSort();return r=>{n&&(r.persist==null||r.persist(),e.toggleSorting==null||e.toggleSorting(void 0,e.getCanMultiSort()?t.options.isMultiSortEvent==null?void 0:t.options.isMultiSortEvent(r):!1))}}},createTable:e=>{e.setSorting=t=>e.options.onSortingChange==null?void 0:e.options.onSortingChange(t),e.resetSorting=t=>{var n,r;e.setSorting(t?[]:(n=(r=e.initialState)==null?void 0:r.sorting)!=null?n:[])},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())}},Au=[Jc,vu,fu,gu,Qc,eu,xu,yu,ju,uu,wu,_u,Su,Cu,hu];function ku(e){var t,n;const r=[...Au,...(t=e._features)!=null?t:[]];let s={_features:r};const o=s._features.reduce((g,d)=>Object.assign(g,d.getDefaultOptions==null?void 0:d.getDefaultOptions(s)),{}),i=g=>s.options.mergeOptions?s.options.mergeOptions(o,g):{...o,...g};let c={...{},...(n=e.initialState)!=null?n:{}};s._features.forEach(g=>{var d;c=(d=g.getInitialState==null?void 0:g.getInitialState(c))!=null?d:c});const u=[];let f=!1;const m={_features:r,options:{...o,...e},initialState:c,_queue:g=>{u.push(g),f||(f=!0,Promise.resolve().then(()=>{for(;u.length;)u.shift()();f=!1}).catch(d=>setTimeout(()=>{throw d})))},reset:()=>{s.setState(s.initialState)},setOptions:g=>{const d=it(g,s.options);s.options=i(d)},getState:()=>s.options.state,setState:g=>{s.options.onStateChange==null||s.options.onStateChange(g)},_getRowId:(g,d,v)=>{var h;return(h=s.options.getRowId==null?void 0:s.options.getRowId(g,d,v))!=null?h:`${v?[v.id,d].join("."):d}`},getCoreRowModel:()=>(s._getCoreRowModel||(s._getCoreRowModel=s.options.getCoreRowModel(s)),s._getCoreRowModel()),getRowModel:()=>s.getPaginationRowModel(),getRow:(g,d)=>{let v=(d?s.getPrePaginationRowModel():s.getRowModel()).rowsById[g];if(!v&&(v=s.getCoreRowModel().rowsById[g],!v))throw new Error;return v},_getDefaultColumnDef:P(()=>[s.options.defaultColumn],g=>{var d;return g=(d=g)!=null?d:{},{header:v=>{const h=v.header.column.columnDef;return h.accessorKey?h.accessorKey:h.accessorFn?h.id:null},cell:v=>{var h,y;return(h=(y=v.renderValue())==null||y.toString==null?void 0:y.toString())!=null?h:null},...s._features.reduce((v,h)=>Object.assign(v,h.getDefaultColumnDef==null?void 0:h.getDefaultColumnDef()),{}),...g}},O(e,"debugColumns")),_getColumnDefs:()=>s.options.columns,getAllColumns:P(()=>[s._getColumnDefs()],g=>{const d=function(v,h,y){return y===void 0&&(y=0),v.map(x=>{const w=Yc(s,x,y,h),_=x;return w.columns=_.columns?d(_.columns,w,y+1):[],w})};return d(g)},O(e,"debugColumns")),getAllFlatColumns:P(()=>[s.getAllColumns()],g=>g.flatMap(d=>d.getFlatColumns()),O(e,"debugColumns")),_getAllFlatColumnsById:P(()=>[s.getAllFlatColumns()],g=>g.reduce((d,v)=>(d[v.id]=v,d),{}),O(e,"debugColumns")),getAllLeafColumns:P(()=>[s.getAllColumns(),s._getOrderColumnsFn()],(g,d)=>{let v=g.flatMap(h=>h.getLeafColumns());return d(v)},O(e,"debugColumns")),getColumn:g=>s._getAllFlatColumnsById()[g]};Object.assign(s,m);for(let g=0;g<s._features.length;g++){const d=s._features[g];d==null||d.createTable==null||d.createTable(s)}return s}function Iu(){return e=>P(()=>[e.options.data],t=>{const n={rows:[],flatRows:[],rowsById:{}},r=function(s,o,i){o===void 0&&(o=0);const a=[];for(let u=0;u<s.length;u++){const f=vs(e,e._getRowId(s[u],u,i),s[u],u,o,void 0,i==null?void 0:i.id);if(n.flatRows.push(f),n.rowsById[f.id]=f,a.push(f),e.options.getSubRows){var c;f.originalSubRows=e.options.getSubRows(s[u],u),(c=f.originalSubRows)!=null&&c.length&&(f.subRows=r(f.originalSubRows,o+1,f))}}return a};return n.rows=r(t),n},O(e.options,"debugTable","getRowModel",()=>e._autoResetPageIndex()))}function Pu(e){const t=[],n=r=>{var s;t.push(r),(s=r.subRows)!=null&&s.length&&r.getIsExpanded()&&r.subRows.forEach(n)};return e.rows.forEach(n),{rows:t,flatRows:e.flatRows,rowsById:e.rowsById}}function Ou(e,t,n){return n.options.filterFromLeafRows?Fu(e,t,n):Du(e,t,n)}function Fu(e,t,n){var r;const s=[],o={},i=(r=n.options.maxLeafRowFilterDepth)!=null?r:100,a=function(c,u){u===void 0&&(u=0);const f=[];for(let g=0;g<c.length;g++){var m;let d=c[g];const v=vs(n,d.id,d.original,d.index,d.depth,void 0,d.parentId);if(v.columnFilters=d.columnFilters,(m=d.subRows)!=null&&m.length&&u<i){if(v.subRows=a(d.subRows,u+1),d=v,t(d)&&!v.subRows.length){f.push(d),o[d.id]=d,s.push(d);continue}if(t(d)||v.subRows.length){f.push(d),o[d.id]=d,s.push(d);continue}}else d=v,t(d)&&(f.push(d),o[d.id]=d,s.push(d))}return f};return{rows:a(e),flatRows:s,rowsById:o}}function Du(e,t,n){var r;const s=[],o={},i=(r=n.options.maxLeafRowFilterDepth)!=null?r:100,a=function(c,u){u===void 0&&(u=0);const f=[];for(let g=0;g<c.length;g++){let d=c[g];if(t(d)){var m;if((m=d.subRows)!=null&&m.length&&u<i){const h=vs(n,d.id,d.original,d.index,d.depth,void 0,d.parentId);h.subRows=a(d.subRows,u+1),d=h}f.push(d),s.push(d),o[d.id]=d}}return f};return{rows:a(e),flatRows:s,rowsById:o}}function $u(){return e=>P(()=>[e.getPreFilteredRowModel(),e.getState().columnFilters,e.getState().globalFilter],(t,n,r)=>{if(!t.rows.length||!(n!=null&&n.length)&&!r){for(let g=0;g<t.flatRows.length;g++)t.flatRows[g].columnFilters={},t.flatRows[g].columnFiltersMeta={};return t}const s=[],o=[];(n??[]).forEach(g=>{var d;const v=e.getColumn(g.id);if(!v)return;const h=v.getFilterFn();h&&s.push({id:g.id,filterFn:h,resolvedValue:(d=h.resolveFilterValue==null?void 0:h.resolveFilterValue(g.value))!=null?d:g.value})});const i=(n??[]).map(g=>g.id),a=e.getGlobalFilterFn(),c=e.getAllLeafColumns().filter(g=>g.getCanGlobalFilter());r&&a&&c.length&&(i.push("__global__"),c.forEach(g=>{var d;o.push({id:g.id,filterFn:a,resolvedValue:(d=a.resolveFilterValue==null?void 0:a.resolveFilterValue(r))!=null?d:r})}));let u,f;for(let g=0;g<t.flatRows.length;g++){const d=t.flatRows[g];if(d.columnFilters={},s.length)for(let v=0;v<s.length;v++){u=s[v];const h=u.id;d.columnFilters[h]=u.filterFn(d,h,u.resolvedValue,y=>{d.columnFiltersMeta[h]=y})}if(o.length){for(let v=0;v<o.length;v++){f=o[v];const h=f.id;if(f.filterFn(d,h,f.resolvedValue,y=>{d.columnFiltersMeta[h]=y})){d.columnFilters.__global__=!0;break}}d.columnFilters.__global__!==!0&&(d.columnFilters.__global__=!1)}}const m=g=>{for(let d=0;d<i.length;d++)if(g.columnFilters[i[d]]===!1)return!1;return!0};return Ou(t.rows,m,e)},O(e.options,"debugTable","getFilteredRowModel",()=>e._autoResetPageIndex()))}function Lu(e){return t=>P(()=>[t.getState().pagination,t.getPrePaginationRowModel(),t.options.paginateExpandedRows?void 0:t.getState().expanded],(n,r)=>{if(!r.rows.length)return r;const{pageSize:s,pageIndex:o}=n;let{rows:i,flatRows:a,rowsById:c}=r;const u=s*o,f=u+s;i=i.slice(u,f);let m;t.options.paginateExpandedRows?m={rows:i,flatRows:a,rowsById:c}:m=Pu({rows:i,flatRows:a,rowsById:c}),m.flatRows=[];const g=d=>{m.flatRows.push(d),d.subRows.length&&d.subRows.forEach(g)};return m.rows.forEach(g),m},O(t.options,"debugTable"))}function Vu(){return e=>P(()=>[e.getState().sorting,e.getPreSortedRowModel()],(t,n)=>{if(!n.rows.length||!(t!=null&&t.length))return n;const r=e.getState().sorting,s=[],o=r.filter(c=>{var u;return(u=e.getColumn(c.id))==null?void 0:u.getCanSort()}),i={};o.forEach(c=>{const u=e.getColumn(c.id);u&&(i[c.id]={sortUndefined:u.columnDef.sortUndefined,invertSorting:u.columnDef.invertSorting,sortingFn:u.getSortingFn()})});const a=c=>{const u=c.map(f=>({...f}));return u.sort((f,m)=>{for(let d=0;d<o.length;d+=1){var g;const v=o[d],h=i[v.id],y=h.sortUndefined,x=(g=v==null?void 0:v.desc)!=null?g:!1;let w=0;if(y){const _=f.getValue(v.id),S=m.getValue(v.id),C=_===void 0,M=S===void 0;if(C||M){if(y==="first")return C?-1:1;if(y==="last")return C?1:-1;w=C&&M?0:C?y:-y}}if(w===0&&(w=h.sortingFn(f,m,v.id)),w!==0)return x&&(w*=-1),h.invertSorting&&(w*=-1),w}return f.index-m.index}),u.forEach(f=>{var m;s.push(f),(m=f.subRows)!=null&&m.length&&(f.subRows=a(f.subRows))}),u};return{rows:a(n.rows),flatRows:s,rowsById:n.rowsById}},O(e.options,"debugTable","getSortedRowModel",()=>e._autoResetPageIndex()))}/**
|
|
57
|
-
* react-table
|
|
58
|
-
*
|
|
59
|
-
* Copyright (c) TanStack
|
|
60
|
-
*
|
|
61
|
-
* This source code is licensed under the MIT license found in the
|
|
62
|
-
* LICENSE.md file in the root directory of this source tree.
|
|
63
|
-
*
|
|
64
|
-
* @license MIT
|
|
65
|
-
*/function so(e,t){return e?Hu(e)?p.createElement(e,t):e:null}function Hu(e){return zu(e)||typeof e=="function"||Gu(e)}function zu(e){return typeof e=="function"&&(()=>{const t=Object.getPrototypeOf(e);return t.prototype&&t.prototype.isReactComponent})()}function Gu(e){return typeof e=="object"&&typeof e.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(e.$$typeof.description)}function Bu(e){const t={state:{},onStateChange:()=>{},renderFallbackValue:null,...e},[n]=p.useState(()=>({current:ku(t)})),[r,s]=p.useState(()=>n.current.initialState);return n.current.setOptions(o=>({...o,...e,state:{...r,...e.state},onStateChange:i=>{s(i),e.onStateChange==null||e.onStateChange(i)}})),n.current}function Vi(e){const t=e+"CollectionProvider",[n,r]=bt(t),[s,o]=n(t,{collectionRef:{current:null},itemMap:new Map}),i=h=>{const{scope:y,children:x}=h,w=Oe.useRef(null),_=Oe.useRef(new Map).current;return l.jsx(s,{scope:y,itemMap:_,collectionRef:w,children:x})};i.displayName=t;const a=e+"CollectionSlot",c=Nn(a),u=Oe.forwardRef((h,y)=>{const{scope:x,children:w}=h,_=o(a,x),S=me(y,_.collectionRef);return l.jsx(c,{ref:S,children:w})});u.displayName=a;const f=e+"CollectionItemSlot",m="data-radix-collection-item",g=Nn(f),d=Oe.forwardRef((h,y)=>{const{scope:x,children:w,..._}=h,S=Oe.useRef(null),C=me(y,S),M=o(f,x);return Oe.useEffect(()=>(M.itemMap.set(S,{ref:S,..._}),()=>void M.itemMap.delete(S))),l.jsx(g,{[m]:"",ref:C,children:w})});d.displayName=f;function v(h){const y=o(e+"CollectionConsumer",h);return Oe.useCallback(()=>{const w=y.collectionRef.current;if(!w)return[];const _=Array.from(w.querySelectorAll(`[${m}]`));return Array.from(y.itemMap.values()).sort((M,E)=>_.indexOf(M.ref.current)-_.indexOf(E.ref.current))},[y.collectionRef,y.itemMap])}return[{Provider:i,Slot:u,ItemSlot:d},v,r]}var Uu=p.createContext(void 0);function _s(e){const t=p.useContext(Uu);return e||t||"ltr"}function Je(e){const t=p.useRef(e);return p.useEffect(()=>{t.current=e}),p.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}function Wu(e,t=globalThis==null?void 0:globalThis.document){const n=Je(e);p.useEffect(()=>{const r=s=>{s.key==="Escape"&&n(s)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var qu="DismissableLayer",Ur="dismissableLayer.update",Zu="dismissableLayer.pointerDownOutside",Ku="dismissableLayer.focusOutside",oo,Hi=p.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),zi=p.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:s,onFocusOutside:o,onInteractOutside:i,onDismiss:a,...c}=e,u=p.useContext(Hi),[f,m]=p.useState(null),g=(f==null?void 0:f.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,d]=p.useState({}),v=me(t,E=>m(E)),h=Array.from(u.layers),[y]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),x=h.indexOf(y),w=f?h.indexOf(f):-1,_=u.layersWithOutsidePointerEventsDisabled.size>0,S=w>=x,C=Ju(E=>{const N=E.target,H=[...u.branches].some(F=>F.contains(N));!S||H||(s==null||s(E),i==null||i(E),E.defaultPrevented||a==null||a())},g),M=Qu(E=>{const N=E.target;[...u.branches].some(F=>F.contains(N))||(o==null||o(E),i==null||i(E),E.defaultPrevented||a==null||a())},g);return Wu(E=>{w===u.layers.size-1&&(r==null||r(E),!E.defaultPrevented&&a&&(E.preventDefault(),a()))},g),p.useEffect(()=>{if(f)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(oo=g.body.style.pointerEvents,g.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(f)),u.layers.add(f),io(),()=>{n&&u.layersWithOutsidePointerEventsDisabled.size===1&&(g.body.style.pointerEvents=oo)}},[f,g,n,u]),p.useEffect(()=>()=>{f&&(u.layers.delete(f),u.layersWithOutsidePointerEventsDisabled.delete(f),io())},[f,u]),p.useEffect(()=>{const E=()=>d({});return document.addEventListener(Ur,E),()=>document.removeEventListener(Ur,E)},[]),l.jsx(ne.div,{...c,ref:v,style:{pointerEvents:_?S?"auto":"none":void 0,...e.style},onFocusCapture:G(e.onFocusCapture,M.onFocusCapture),onBlurCapture:G(e.onBlurCapture,M.onBlurCapture),onPointerDownCapture:G(e.onPointerDownCapture,C.onPointerDownCapture)})});zi.displayName=qu;var Xu="DismissableLayerBranch",Yu=p.forwardRef((e,t)=>{const n=p.useContext(Hi),r=p.useRef(null),s=me(t,r);return p.useEffect(()=>{const o=r.current;if(o)return n.branches.add(o),()=>{n.branches.delete(o)}},[n.branches]),l.jsx(ne.div,{...e,ref:s})});Yu.displayName=Xu;function Ju(e,t=globalThis==null?void 0:globalThis.document){const n=Je(e),r=p.useRef(!1),s=p.useRef(()=>{});return p.useEffect(()=>{const o=a=>{if(a.target&&!r.current){let c=function(){Gi(Zu,n,u,{discrete:!0})};const u={originalEvent:a};a.pointerType==="touch"?(t.removeEventListener("click",s.current),s.current=c,t.addEventListener("click",s.current,{once:!0})):c()}else t.removeEventListener("click",s.current);r.current=!1},i=window.setTimeout(()=>{t.addEventListener("pointerdown",o)},0);return()=>{window.clearTimeout(i),t.removeEventListener("pointerdown",o),t.removeEventListener("click",s.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function Qu(e,t=globalThis==null?void 0:globalThis.document){const n=Je(e),r=p.useRef(!1);return p.useEffect(()=>{const s=o=>{o.target&&!r.current&&Gi(Ku,n,{originalEvent:o},{discrete:!1})};return t.addEventListener("focusin",s),()=>t.removeEventListener("focusin",s)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function io(){const e=new CustomEvent(Ur);document.dispatchEvent(e)}function Gi(e,t,n,{discrete:r}){const s=n.originalEvent.target,o=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&s.addEventListener(e,t,{once:!0}),r?vi(s,o):s.dispatchEvent(o)}var xr=0;function ed(){p.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??ao()),document.body.insertAdjacentElement("beforeend",e[1]??ao()),xr++,()=>{xr===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),xr--}},[])}function ao(){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 yr="focusScope.autoFocusOnMount",wr="focusScope.autoFocusOnUnmount",lo={bubbles:!1,cancelable:!0},td="FocusScope",Bi=p.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:s,onUnmountAutoFocus:o,...i}=e,[a,c]=p.useState(null),u=Je(s),f=Je(o),m=p.useRef(null),g=me(t,h=>c(h)),d=p.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;p.useEffect(()=>{if(r){let h=function(_){if(d.paused||!a)return;const S=_.target;a.contains(S)?m.current=S:rt(m.current,{select:!0})},y=function(_){if(d.paused||!a)return;const S=_.relatedTarget;S!==null&&(a.contains(S)||rt(m.current,{select:!0}))},x=function(_){if(document.activeElement===document.body)for(const C of _)C.removedNodes.length>0&&rt(a)};document.addEventListener("focusin",h),document.addEventListener("focusout",y);const w=new MutationObserver(x);return a&&w.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",h),document.removeEventListener("focusout",y),w.disconnect()}}},[r,a,d.paused]),p.useEffect(()=>{if(a){uo.add(d);const h=document.activeElement;if(!a.contains(h)){const x=new CustomEvent(yr,lo);a.addEventListener(yr,u),a.dispatchEvent(x),x.defaultPrevented||(nd(ad(Ui(a)),{select:!0}),document.activeElement===h&&rt(a))}return()=>{a.removeEventListener(yr,u),setTimeout(()=>{const x=new CustomEvent(wr,lo);a.addEventListener(wr,f),a.dispatchEvent(x),x.defaultPrevented||rt(h??document.body,{select:!0}),a.removeEventListener(wr,f),uo.remove(d)},0)}}},[a,u,f,d]);const v=p.useCallback(h=>{if(!n&&!r||d.paused)return;const y=h.key==="Tab"&&!h.altKey&&!h.ctrlKey&&!h.metaKey,x=document.activeElement;if(y&&x){const w=h.currentTarget,[_,S]=rd(w);_&&S?!h.shiftKey&&x===S?(h.preventDefault(),n&&rt(_,{select:!0})):h.shiftKey&&x===_&&(h.preventDefault(),n&&rt(S,{select:!0})):x===w&&h.preventDefault()}},[n,r,d.paused]);return l.jsx(ne.div,{tabIndex:-1,...i,ref:g,onKeyDown:v})});Bi.displayName=td;function nd(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(rt(r,{select:t}),document.activeElement!==n)return}function rd(e){const t=Ui(e),n=co(t,e),r=co(t.reverse(),e);return[n,r]}function Ui(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const s=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||s?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function co(e,t){for(const n of e)if(!sd(n,{upTo:t}))return n}function sd(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function od(e){return e instanceof HTMLInputElement&&"select"in e}function rt(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&od(e)&&t&&e.select()}}var uo=id();function id(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=fo(e,t),e.unshift(t)},remove(t){var n;e=fo(e,t),(n=e[0])==null||n.resume()}}}function fo(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function ad(e){return e.filter(t=>t.tagName!=="A")}var ld=ri[" useId ".trim().toString()]||(()=>{}),cd=0;function Tn(e){const[t,n]=p.useState(ld());return dt(()=>{n(r=>r??String(cd++))},[e]),e||(t?`radix-${t}`:"")}const ud=["top","right","bottom","left"],gt=Math.min,Se=Math.max,jn=Math.round,xn=Math.floor,Le=e=>({x:e,y:e}),dd={left:"right",right:"left",bottom:"top",top:"bottom"},fd={start:"end",end:"start"};function Wr(e,t,n){return Se(e,gt(t,n))}function Qe(e,t){return typeof e=="function"?e(t):e}function et(e){return e.split("-")[0]}function Gt(e){return e.split("-")[1]}function Ss(e){return e==="x"?"y":"x"}function Cs(e){return e==="y"?"height":"width"}function $e(e){return["top","bottom"].includes(et(e))?"y":"x"}function bs(e){return Ss($e(e))}function gd(e,t,n){n===void 0&&(n=!1);const r=Gt(e),s=bs(e),o=Cs(s);let i=s==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(i=An(i)),[i,An(i)]}function md(e){const t=An(e);return[qr(e),t,qr(t)]}function qr(e){return e.replace(/start|end/g,t=>fd[t])}function hd(e,t,n){const r=["left","right"],s=["right","left"],o=["top","bottom"],i=["bottom","top"];switch(e){case"top":case"bottom":return n?t?s:r:t?r:s;case"left":case"right":return t?o:i;default:return[]}}function pd(e,t,n,r){const s=Gt(e);let o=hd(et(e),n==="start",r);return s&&(o=o.map(i=>i+"-"+s),t&&(o=o.concat(o.map(qr)))),o}function An(e){return e.replace(/left|right|bottom|top/g,t=>dd[t])}function vd(e){return{top:0,right:0,bottom:0,left:0,...e}}function Wi(e){return typeof e!="number"?vd(e):{top:e,right:e,bottom:e,left:e}}function kn(e){const{x:t,y:n,width:r,height:s}=e;return{width:r,height:s,top:n,left:t,right:t+r,bottom:n+s,x:t,y:n}}function go(e,t,n){let{reference:r,floating:s}=e;const o=$e(t),i=bs(t),a=Cs(i),c=et(t),u=o==="y",f=r.x+r.width/2-s.width/2,m=r.y+r.height/2-s.height/2,g=r[a]/2-s[a]/2;let d;switch(c){case"top":d={x:f,y:r.y-s.height};break;case"bottom":d={x:f,y:r.y+r.height};break;case"right":d={x:r.x+r.width,y:m};break;case"left":d={x:r.x-s.width,y:m};break;default:d={x:r.x,y:r.y}}switch(Gt(t)){case"start":d[i]-=g*(n&&u?-1:1);break;case"end":d[i]+=g*(n&&u?-1:1);break}return d}const xd=async(e,t,n)=>{const{placement:r="bottom",strategy:s="absolute",middleware:o=[],platform:i}=n,a=o.filter(Boolean),c=await(i.isRTL==null?void 0:i.isRTL(t));let u=await i.getElementRects({reference:e,floating:t,strategy:s}),{x:f,y:m}=go(u,r,c),g=r,d={},v=0;for(let h=0;h<a.length;h++){const{name:y,fn:x}=a[h],{x:w,y:_,data:S,reset:C}=await x({x:f,y:m,initialPlacement:r,placement:g,strategy:s,middlewareData:d,rects:u,platform:i,elements:{reference:e,floating:t}});f=w??f,m=_??m,d={...d,[y]:{...d[y],...S}},C&&v<=50&&(v++,typeof C=="object"&&(C.placement&&(g=C.placement),C.rects&&(u=C.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:s}):C.rects),{x:f,y:m}=go(u,g,c)),h=-1)}return{x:f,y:m,placement:g,strategy:s,middlewareData:d}};async function Jt(e,t){var n;t===void 0&&(t={});const{x:r,y:s,platform:o,rects:i,elements:a,strategy:c}=e,{boundary:u="clippingAncestors",rootBoundary:f="viewport",elementContext:m="floating",altBoundary:g=!1,padding:d=0}=Qe(t,e),v=Wi(d),y=a[g?m==="floating"?"reference":"floating":m],x=kn(await o.getClippingRect({element:(n=await(o.isElement==null?void 0:o.isElement(y)))==null||n?y:y.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(a.floating)),boundary:u,rootBoundary:f,strategy:c})),w=m==="floating"?{x:r,y:s,width:i.floating.width,height:i.floating.height}:i.reference,_=await(o.getOffsetParent==null?void 0:o.getOffsetParent(a.floating)),S=await(o.isElement==null?void 0:o.isElement(_))?await(o.getScale==null?void 0:o.getScale(_))||{x:1,y:1}:{x:1,y:1},C=kn(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:w,offsetParent:_,strategy:c}):w);return{top:(x.top-C.top+v.top)/S.y,bottom:(C.bottom-x.bottom+v.bottom)/S.y,left:(x.left-C.left+v.left)/S.x,right:(C.right-x.right+v.right)/S.x}}const yd=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:s,rects:o,platform:i,elements:a,middlewareData:c}=t,{element:u,padding:f=0}=Qe(e,t)||{};if(u==null)return{};const m=Wi(f),g={x:n,y:r},d=bs(s),v=Cs(d),h=await i.getDimensions(u),y=d==="y",x=y?"top":"left",w=y?"bottom":"right",_=y?"clientHeight":"clientWidth",S=o.reference[v]+o.reference[d]-g[d]-o.floating[v],C=g[d]-o.reference[d],M=await(i.getOffsetParent==null?void 0:i.getOffsetParent(u));let E=M?M[_]:0;(!E||!await(i.isElement==null?void 0:i.isElement(M)))&&(E=a.floating[_]||o.floating[v]);const N=S/2-C/2,H=E/2-h[v]/2-1,F=gt(m[x],H),q=gt(m[w],H),X=F,z=E-h[v]-q,U=E/2-h[v]/2+N,te=Wr(X,U,z),W=!c.arrow&&Gt(s)!=null&&U!==te&&o.reference[v]/2-(U<X?F:q)-h[v]/2<0,D=W?U<X?U-X:U-z:0;return{[d]:g[d]+D,data:{[d]:te,centerOffset:U-te-D,...W&&{alignmentOffset:D}},reset:W}}}),wd=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:s,middlewareData:o,rects:i,initialPlacement:a,platform:c,elements:u}=t,{mainAxis:f=!0,crossAxis:m=!0,fallbackPlacements:g,fallbackStrategy:d="bestFit",fallbackAxisSideDirection:v="none",flipAlignment:h=!0,...y}=Qe(e,t);if((n=o.arrow)!=null&&n.alignmentOffset)return{};const x=et(s),w=$e(a),_=et(a)===a,S=await(c.isRTL==null?void 0:c.isRTL(u.floating)),C=g||(_||!h?[An(a)]:md(a)),M=v!=="none";!g&&M&&C.push(...pd(a,h,v,S));const E=[a,...C],N=await Jt(t,y),H=[];let F=((r=o.flip)==null?void 0:r.overflows)||[];if(f&&H.push(N[x]),m){const U=gd(s,i,S);H.push(N[U[0]],N[U[1]])}if(F=[...F,{placement:s,overflows:H}],!H.every(U=>U<=0)){var q,X;const U=(((q=o.flip)==null?void 0:q.index)||0)+1,te=E[U];if(te&&(!(m==="alignment"?w!==$e(te):!1)||F.every(j=>j.overflows[0]>0&&$e(j.placement)===w)))return{data:{index:U,overflows:F},reset:{placement:te}};let W=(X=F.filter(D=>D.overflows[0]<=0).sort((D,j)=>D.overflows[1]-j.overflows[1])[0])==null?void 0:X.placement;if(!W)switch(d){case"bestFit":{var z;const D=(z=F.filter(j=>{if(M){const R=$e(j.placement);return R===w||R==="y"}return!0}).map(j=>[j.placement,j.overflows.filter(R=>R>0).reduce((R,V)=>R+V,0)]).sort((j,R)=>j[1]-R[1])[0])==null?void 0:z[0];D&&(W=D);break}case"initialPlacement":W=a;break}if(s!==W)return{reset:{placement:W}}}return{}}}};function mo(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function ho(e){return ud.some(t=>e[t]>=0)}const _d=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:r="referenceHidden",...s}=Qe(e,t);switch(r){case"referenceHidden":{const o=await Jt(t,{...s,elementContext:"reference"}),i=mo(o,n.reference);return{data:{referenceHiddenOffsets:i,referenceHidden:ho(i)}}}case"escaped":{const o=await Jt(t,{...s,altBoundary:!0}),i=mo(o,n.floating);return{data:{escapedOffsets:i,escaped:ho(i)}}}default:return{}}}}};async function Sd(e,t){const{placement:n,platform:r,elements:s}=e,o=await(r.isRTL==null?void 0:r.isRTL(s.floating)),i=et(n),a=Gt(n),c=$e(n)==="y",u=["left","top"].includes(i)?-1:1,f=o&&c?-1:1,m=Qe(t,e);let{mainAxis:g,crossAxis:d,alignmentAxis:v}=typeof m=="number"?{mainAxis:m,crossAxis:0,alignmentAxis:null}:{mainAxis:m.mainAxis||0,crossAxis:m.crossAxis||0,alignmentAxis:m.alignmentAxis};return a&&typeof v=="number"&&(d=a==="end"?v*-1:v),c?{x:d*f,y:g*u}:{x:g*u,y:d*f}}const Cd=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:s,y:o,placement:i,middlewareData:a}=t,c=await Sd(t,e);return i===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:s+c.x,y:o+c.y,data:{...c,placement:i}}}}},bd=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:s}=t,{mainAxis:o=!0,crossAxis:i=!1,limiter:a={fn:y=>{let{x,y:w}=y;return{x,y:w}}},...c}=Qe(e,t),u={x:n,y:r},f=await Jt(t,c),m=$e(et(s)),g=Ss(m);let d=u[g],v=u[m];if(o){const y=g==="y"?"top":"left",x=g==="y"?"bottom":"right",w=d+f[y],_=d-f[x];d=Wr(w,d,_)}if(i){const y=m==="y"?"top":"left",x=m==="y"?"bottom":"right",w=v+f[y],_=v-f[x];v=Wr(w,v,_)}const h=a.fn({...t,[g]:d,[m]:v});return{...h,data:{x:h.x-n,y:h.y-r,enabled:{[g]:o,[m]:i}}}}}},Rd=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:s,rects:o,middlewareData:i}=t,{offset:a=0,mainAxis:c=!0,crossAxis:u=!0}=Qe(e,t),f={x:n,y:r},m=$e(s),g=Ss(m);let d=f[g],v=f[m];const h=Qe(a,t),y=typeof h=="number"?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(c){const _=g==="y"?"height":"width",S=o.reference[g]-o.floating[_]+y.mainAxis,C=o.reference[g]+o.reference[_]-y.mainAxis;d<S?d=S:d>C&&(d=C)}if(u){var x,w;const _=g==="y"?"width":"height",S=["top","left"].includes(et(s)),C=o.reference[m]-o.floating[_]+(S&&((x=i.offset)==null?void 0:x[m])||0)+(S?0:y.crossAxis),M=o.reference[m]+o.reference[_]+(S?0:((w=i.offset)==null?void 0:w[m])||0)-(S?y.crossAxis:0);v<C?v=C:v>M&&(v=M)}return{[g]:d,[m]:v}}}},Ed=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:s,rects:o,platform:i,elements:a}=t,{apply:c=()=>{},...u}=Qe(e,t),f=await Jt(t,u),m=et(s),g=Gt(s),d=$e(s)==="y",{width:v,height:h}=o.floating;let y,x;m==="top"||m==="bottom"?(y=m,x=g===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?"start":"end")?"left":"right"):(x=m,y=g==="end"?"top":"bottom");const w=h-f.top-f.bottom,_=v-f.left-f.right,S=gt(h-f[y],w),C=gt(v-f[x],_),M=!t.middlewareData.shift;let E=S,N=C;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(N=_),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(E=w),M&&!g){const F=Se(f.left,0),q=Se(f.right,0),X=Se(f.top,0),z=Se(f.bottom,0);d?N=v-2*(F!==0||q!==0?F+q:Se(f.left,f.right)):E=h-2*(X!==0||z!==0?X+z:Se(f.top,f.bottom))}await c({...t,availableWidth:N,availableHeight:E});const H=await i.getDimensions(a.floating);return v!==H.width||h!==H.height?{reset:{rects:!0}}:{}}}};function Bn(){return typeof window<"u"}function Bt(e){return qi(e)?(e.nodeName||"").toLowerCase():"#document"}function Ce(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function ze(e){var t;return(t=(qi(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function qi(e){return Bn()?e instanceof Node||e instanceof Ce(e).Node:!1}function ke(e){return Bn()?e instanceof Element||e instanceof Ce(e).Element:!1}function He(e){return Bn()?e instanceof HTMLElement||e instanceof Ce(e).HTMLElement:!1}function po(e){return!Bn()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Ce(e).ShadowRoot}function on(e){const{overflow:t,overflowX:n,overflowY:r,display:s}=Ie(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(s)}function Md(e){return["table","td","th"].includes(Bt(e))}function Un(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function Rs(e){const t=Es(),n=ke(e)?Ie(e):e;return["transform","translate","scale","rotate","perspective"].some(r=>n[r]?n[r]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||["transform","translate","scale","rotate","perspective","filter"].some(r=>(n.willChange||"").includes(r))||["paint","layout","strict","content"].some(r=>(n.contain||"").includes(r))}function Nd(e){let t=mt(e);for(;He(t)&&!Dt(t);){if(Rs(t))return t;if(Un(t))return null;t=mt(t)}return null}function Es(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Dt(e){return["html","body","#document"].includes(Bt(e))}function Ie(e){return Ce(e).getComputedStyle(e)}function Wn(e){return ke(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function mt(e){if(Bt(e)==="html")return e;const t=e.assignedSlot||e.parentNode||po(e)&&e.host||ze(e);return po(t)?t.host:t}function Zi(e){const t=mt(e);return Dt(t)?e.ownerDocument?e.ownerDocument.body:e.body:He(t)&&on(t)?t:Zi(t)}function Qt(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const s=Zi(e),o=s===((r=e.ownerDocument)==null?void 0:r.body),i=Ce(s);if(o){const a=Zr(i);return t.concat(i,i.visualViewport||[],on(s)?s:[],a&&n?Qt(a):[])}return t.concat(s,Qt(s,[],n))}function Zr(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Ki(e){const t=Ie(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const s=He(e),o=s?e.offsetWidth:n,i=s?e.offsetHeight:r,a=jn(n)!==o||jn(r)!==i;return a&&(n=o,r=i),{width:n,height:r,$:a}}function Ms(e){return ke(e)?e:e.contextElement}function Ot(e){const t=Ms(e);if(!He(t))return Le(1);const n=t.getBoundingClientRect(),{width:r,height:s,$:o}=Ki(t);let i=(o?jn(n.width):n.width)/r,a=(o?jn(n.height):n.height)/s;return(!i||!Number.isFinite(i))&&(i=1),(!a||!Number.isFinite(a))&&(a=1),{x:i,y:a}}const Td=Le(0);function Xi(e){const t=Ce(e);return!Es()||!t.visualViewport?Td:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function jd(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Ce(e)?!1:t}function wt(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const s=e.getBoundingClientRect(),o=Ms(e);let i=Le(1);t&&(r?ke(r)&&(i=Ot(r)):i=Ot(e));const a=jd(o,n,r)?Xi(o):Le(0);let c=(s.left+a.x)/i.x,u=(s.top+a.y)/i.y,f=s.width/i.x,m=s.height/i.y;if(o){const g=Ce(o),d=r&&ke(r)?Ce(r):r;let v=g,h=Zr(v);for(;h&&r&&d!==v;){const y=Ot(h),x=h.getBoundingClientRect(),w=Ie(h),_=x.left+(h.clientLeft+parseFloat(w.paddingLeft))*y.x,S=x.top+(h.clientTop+parseFloat(w.paddingTop))*y.y;c*=y.x,u*=y.y,f*=y.x,m*=y.y,c+=_,u+=S,v=Ce(h),h=Zr(v)}}return kn({width:f,height:m,x:c,y:u})}function Ns(e,t){const n=Wn(e).scrollLeft;return t?t.left+n:wt(ze(e)).left+n}function Yi(e,t,n){n===void 0&&(n=!1);const r=e.getBoundingClientRect(),s=r.left+t.scrollLeft-(n?0:Ns(e,r)),o=r.top+t.scrollTop;return{x:s,y:o}}function Ad(e){let{elements:t,rect:n,offsetParent:r,strategy:s}=e;const o=s==="fixed",i=ze(r),a=t?Un(t.floating):!1;if(r===i||a&&o)return n;let c={scrollLeft:0,scrollTop:0},u=Le(1);const f=Le(0),m=He(r);if((m||!m&&!o)&&((Bt(r)!=="body"||on(i))&&(c=Wn(r)),He(r))){const d=wt(r);u=Ot(r),f.x=d.x+r.clientLeft,f.y=d.y+r.clientTop}const g=i&&!m&&!o?Yi(i,c,!0):Le(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-c.scrollLeft*u.x+f.x+g.x,y:n.y*u.y-c.scrollTop*u.y+f.y+g.y}}function kd(e){return Array.from(e.getClientRects())}function Id(e){const t=ze(e),n=Wn(e),r=e.ownerDocument.body,s=Se(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),o=Se(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let i=-n.scrollLeft+Ns(e);const a=-n.scrollTop;return Ie(r).direction==="rtl"&&(i+=Se(t.clientWidth,r.clientWidth)-s),{width:s,height:o,x:i,y:a}}function Pd(e,t){const n=Ce(e),r=ze(e),s=n.visualViewport;let o=r.clientWidth,i=r.clientHeight,a=0,c=0;if(s){o=s.width,i=s.height;const u=Es();(!u||u&&t==="fixed")&&(a=s.offsetLeft,c=s.offsetTop)}return{width:o,height:i,x:a,y:c}}function Od(e,t){const n=wt(e,!0,t==="fixed"),r=n.top+e.clientTop,s=n.left+e.clientLeft,o=He(e)?Ot(e):Le(1),i=e.clientWidth*o.x,a=e.clientHeight*o.y,c=s*o.x,u=r*o.y;return{width:i,height:a,x:c,y:u}}function vo(e,t,n){let r;if(t==="viewport")r=Pd(e,n);else if(t==="document")r=Id(ze(e));else if(ke(t))r=Od(t,n);else{const s=Xi(e);r={x:t.x-s.x,y:t.y-s.y,width:t.width,height:t.height}}return kn(r)}function Ji(e,t){const n=mt(e);return n===t||!ke(n)||Dt(n)?!1:Ie(n).position==="fixed"||Ji(n,t)}function Fd(e,t){const n=t.get(e);if(n)return n;let r=Qt(e,[],!1).filter(a=>ke(a)&&Bt(a)!=="body"),s=null;const o=Ie(e).position==="fixed";let i=o?mt(e):e;for(;ke(i)&&!Dt(i);){const a=Ie(i),c=Rs(i);!c&&a.position==="fixed"&&(s=null),(o?!c&&!s:!c&&a.position==="static"&&!!s&&["absolute","fixed"].includes(s.position)||on(i)&&!c&&Ji(e,i))?r=r.filter(f=>f!==i):s=a,i=mt(i)}return t.set(e,r),r}function Dd(e){let{element:t,boundary:n,rootBoundary:r,strategy:s}=e;const i=[...n==="clippingAncestors"?Un(t)?[]:Fd(t,this._c):[].concat(n),r],a=i[0],c=i.reduce((u,f)=>{const m=vo(t,f,s);return u.top=Se(m.top,u.top),u.right=gt(m.right,u.right),u.bottom=gt(m.bottom,u.bottom),u.left=Se(m.left,u.left),u},vo(t,a,s));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function $d(e){const{width:t,height:n}=Ki(e);return{width:t,height:n}}function Ld(e,t,n){const r=He(t),s=ze(t),o=n==="fixed",i=wt(e,!0,o,t);let a={scrollLeft:0,scrollTop:0};const c=Le(0);function u(){c.x=Ns(s)}if(r||!r&&!o)if((Bt(t)!=="body"||on(s))&&(a=Wn(t)),r){const d=wt(t,!0,o,t);c.x=d.x+t.clientLeft,c.y=d.y+t.clientTop}else s&&u();o&&!r&&s&&u();const f=s&&!r&&!o?Yi(s,a):Le(0),m=i.left+a.scrollLeft-c.x-f.x,g=i.top+a.scrollTop-c.y-f.y;return{x:m,y:g,width:i.width,height:i.height}}function _r(e){return Ie(e).position==="static"}function xo(e,t){if(!He(e)||Ie(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return ze(e)===n&&(n=n.ownerDocument.body),n}function Qi(e,t){const n=Ce(e);if(Un(e))return n;if(!He(e)){let s=mt(e);for(;s&&!Dt(s);){if(ke(s)&&!_r(s))return s;s=mt(s)}return n}let r=xo(e,t);for(;r&&Md(r)&&_r(r);)r=xo(r,t);return r&&Dt(r)&&_r(r)&&!Rs(r)?n:r||Nd(e)||n}const Vd=async function(e){const t=this.getOffsetParent||Qi,n=this.getDimensions,r=await n(e.floating);return{reference:Ld(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Hd(e){return Ie(e).direction==="rtl"}const zd={convertOffsetParentRelativeRectToViewportRelativeRect:Ad,getDocumentElement:ze,getClippingRect:Dd,getOffsetParent:Qi,getElementRects:Vd,getClientRects:kd,getDimensions:$d,getScale:Ot,isElement:ke,isRTL:Hd};function ea(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Gd(e,t){let n=null,r;const s=ze(e);function o(){var a;clearTimeout(r),(a=n)==null||a.disconnect(),n=null}function i(a,c){a===void 0&&(a=!1),c===void 0&&(c=1),o();const u=e.getBoundingClientRect(),{left:f,top:m,width:g,height:d}=u;if(a||t(),!g||!d)return;const v=xn(m),h=xn(s.clientWidth-(f+g)),y=xn(s.clientHeight-(m+d)),x=xn(f),_={rootMargin:-v+"px "+-h+"px "+-y+"px "+-x+"px",threshold:Se(0,gt(1,c))||1};let S=!0;function C(M){const E=M[0].intersectionRatio;if(E!==c){if(!S)return i();E?i(!1,E):r=setTimeout(()=>{i(!1,1e-7)},1e3)}E===1&&!ea(u,e.getBoundingClientRect())&&i(),S=!1}try{n=new IntersectionObserver(C,{..._,root:s.ownerDocument})}catch{n=new IntersectionObserver(C,_)}n.observe(e)}return i(!0),o}function Bd(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:s=!0,ancestorResize:o=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:c=!1}=r,u=Ms(e),f=s||o?[...u?Qt(u):[],...Qt(t)]:[];f.forEach(x=>{s&&x.addEventListener("scroll",n,{passive:!0}),o&&x.addEventListener("resize",n)});const m=u&&a?Gd(u,n):null;let g=-1,d=null;i&&(d=new ResizeObserver(x=>{let[w]=x;w&&w.target===u&&d&&(d.unobserve(t),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var _;(_=d)==null||_.observe(t)})),n()}),u&&!c&&d.observe(u),d.observe(t));let v,h=c?wt(e):null;c&&y();function y(){const x=wt(e);h&&!ea(h,x)&&n(),h=x,v=requestAnimationFrame(y)}return n(),()=>{var x;f.forEach(w=>{s&&w.removeEventListener("scroll",n),o&&w.removeEventListener("resize",n)}),m==null||m(),(x=d)==null||x.disconnect(),d=null,c&&cancelAnimationFrame(v)}}const Ud=Cd,Wd=bd,qd=wd,Zd=Ed,Kd=_d,yo=yd,Xd=Rd,Yd=(e,t,n)=>{const r=new Map,s={platform:zd,...n},o={...s.platform,_c:r};return xd(e,t,{...s,platform:o})};var Jd=typeof document<"u",Qd=function(){},Rn=Jd?p.useLayoutEffect:Qd;function In(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,s;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!In(e[r],t[r]))return!1;return!0}if(s=Object.keys(e),n=s.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,s[r]))return!1;for(r=n;r--!==0;){const o=s[r];if(!(o==="_owner"&&e.$$typeof)&&!In(e[o],t[o]))return!1}return!0}return e!==e&&t!==t}function ta(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function wo(e,t){const n=ta(e);return Math.round(t*n)/n}function Sr(e){const t=p.useRef(e);return Rn(()=>{t.current=e}),t}function ef(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:s,elements:{reference:o,floating:i}={},transform:a=!0,whileElementsMounted:c,open:u}=e,[f,m]=p.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[g,d]=p.useState(r);In(g,r)||d(r);const[v,h]=p.useState(null),[y,x]=p.useState(null),w=p.useCallback(j=>{j!==M.current&&(M.current=j,h(j))},[]),_=p.useCallback(j=>{j!==E.current&&(E.current=j,x(j))},[]),S=o||v,C=i||y,M=p.useRef(null),E=p.useRef(null),N=p.useRef(f),H=c!=null,F=Sr(c),q=Sr(s),X=Sr(u),z=p.useCallback(()=>{if(!M.current||!E.current)return;const j={placement:t,strategy:n,middleware:g};q.current&&(j.platform=q.current),Yd(M.current,E.current,j).then(R=>{const V={...R,isPositioned:X.current!==!1};U.current&&!In(N.current,V)&&(N.current=V,ms.flushSync(()=>{m(V)}))})},[g,t,n,q,X]);Rn(()=>{u===!1&&N.current.isPositioned&&(N.current.isPositioned=!1,m(j=>({...j,isPositioned:!1})))},[u]);const U=p.useRef(!1);Rn(()=>(U.current=!0,()=>{U.current=!1}),[]),Rn(()=>{if(S&&(M.current=S),C&&(E.current=C),S&&C){if(F.current)return F.current(S,C,z);z()}},[S,C,z,F,H]);const te=p.useMemo(()=>({reference:M,floating:E,setReference:w,setFloating:_}),[w,_]),W=p.useMemo(()=>({reference:S,floating:C}),[S,C]),D=p.useMemo(()=>{const j={position:n,left:0,top:0};if(!W.floating)return j;const R=wo(W.floating,f.x),V=wo(W.floating,f.y);return a?{...j,transform:"translate("+R+"px, "+V+"px)",...ta(W.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:R,top:V}},[n,a,W.floating,f.x,f.y]);return p.useMemo(()=>({...f,update:z,refs:te,elements:W,floatingStyles:D}),[f,z,te,W,D])}const tf=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:s}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?yo({element:r.current,padding:s}).fn(n):{}:r?yo({element:r,padding:s}).fn(n):{}}}},nf=(e,t)=>({...Ud(e),options:[e,t]}),rf=(e,t)=>({...Wd(e),options:[e,t]}),sf=(e,t)=>({...Xd(e),options:[e,t]}),of=(e,t)=>({...qd(e),options:[e,t]}),af=(e,t)=>({...Zd(e),options:[e,t]}),lf=(e,t)=>({...Kd(e),options:[e,t]}),cf=(e,t)=>({...tf(e),options:[e,t]});var uf="Arrow",na=p.forwardRef((e,t)=>{const{children:n,width:r=10,height:s=5,...o}=e;return l.jsx(ne.svg,{...o,ref:t,width:r,height:s,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:l.jsx("polygon",{points:"0,0 30,0 15,10"})})});na.displayName=uf;var df=na,Ts="Popper",[ra,sa]=bt(Ts),[ff,oa]=ra(Ts),ia=e=>{const{__scopePopper:t,children:n}=e,[r,s]=p.useState(null);return l.jsx(ff,{scope:t,anchor:r,onAnchorChange:s,children:n})};ia.displayName=Ts;var aa="PopperAnchor",la=p.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...s}=e,o=oa(aa,n),i=p.useRef(null),a=me(t,i);return p.useEffect(()=>{o.onAnchorChange((r==null?void 0:r.current)||i.current)}),r?null:l.jsx(ne.div,{...s,ref:a})});la.displayName=aa;var js="PopperContent",[gf,mf]=ra(js),ca=p.forwardRef((e,t)=>{var Ee,vt,xe,je,Ut,er;const{__scopePopper:n,side:r="bottom",sideOffset:s=0,align:o="center",alignOffset:i=0,arrowPadding:a=0,avoidCollisions:c=!0,collisionBoundary:u=[],collisionPadding:f=0,sticky:m="partial",hideWhenDetached:g=!1,updatePositionStrategy:d="optimized",onPlaced:v,...h}=e,y=oa(js,n),[x,w]=p.useState(null),_=me(t,J=>w(J)),[S,C]=p.useState(null),M=pi(S),E=(M==null?void 0:M.width)??0,N=(M==null?void 0:M.height)??0,H=r+(o!=="center"?"-"+o:""),F=typeof f=="number"?f:{top:0,right:0,bottom:0,left:0,...f},q=Array.isArray(u)?u:[u],X=q.length>0,z={padding:F,boundary:q.filter(pf),altBoundary:X},{refs:U,floatingStyles:te,placement:W,isPositioned:D,middlewareData:j}=ef({strategy:"fixed",placement:H,whileElementsMounted:(...J)=>Bd(...J,{animationFrame:d==="always"}),elements:{reference:y.anchor},middleware:[nf({mainAxis:s+N,alignmentAxis:i}),c&&rf({mainAxis:!0,crossAxis:!1,limiter:m==="partial"?sf():void 0,...z}),c&&of({...z}),af({...z,apply:({elements:J,rects:ee,availableWidth:ue,availableHeight:re})=>{const{width:_e,height:nt}=ee.reference,oe=J.floating.style;oe.setProperty("--radix-popper-available-width",`${ue}px`),oe.setProperty("--radix-popper-available-height",`${re}px`),oe.setProperty("--radix-popper-anchor-width",`${_e}px`),oe.setProperty("--radix-popper-anchor-height",`${nt}px`)}}),S&&cf({element:S,padding:a}),vf({arrowWidth:E,arrowHeight:N}),g&&lf({strategy:"referenceHidden",...z})]}),[R,V]=fa(W),Q=Je(v);dt(()=>{D&&(Q==null||Q())},[D,Q]);const ae=(Ee=j.arrow)==null?void 0:Ee.x,ye=(vt=j.arrow)==null?void 0:vt.y,we=((xe=j.arrow)==null?void 0:xe.centerOffset)!==0,[Ge,Pe]=p.useState();return dt(()=>{x&&Pe(window.getComputedStyle(x).zIndex)},[x]),l.jsx("div",{ref:U.setFloating,"data-radix-popper-content-wrapper":"",style:{...te,transform:D?te.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Ge,"--radix-popper-transform-origin":[(je=j.transformOrigin)==null?void 0:je.x,(Ut=j.transformOrigin)==null?void 0:Ut.y].join(" "),...((er=j.hide)==null?void 0:er.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:l.jsx(gf,{scope:n,placedSide:R,onArrowChange:C,arrowX:ae,arrowY:ye,shouldHideArrow:we,children:l.jsx(ne.div,{"data-side":R,"data-align":V,...h,ref:_,style:{...h.style,animation:D?void 0:"none"}})})})});ca.displayName=js;var ua="PopperArrow",hf={top:"bottom",right:"left",bottom:"top",left:"right"},da=p.forwardRef(function(t,n){const{__scopePopper:r,...s}=t,o=mf(ua,r),i=hf[o.placedSide];return l.jsx("span",{ref:o.onArrowChange,style:{position:"absolute",left:o.arrowX,top:o.arrowY,[i]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[o.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[o.placedSide],visibility:o.shouldHideArrow?"hidden":void 0},children:l.jsx(df,{...s,ref:n,style:{...s.style,display:"block"}})})});da.displayName=ua;function pf(e){return e!==null}var vf=e=>({name:"transformOrigin",options:e,fn(t){var y,x,w;const{placement:n,rects:r,middlewareData:s}=t,i=((y=s.arrow)==null?void 0:y.centerOffset)!==0,a=i?0:e.arrowWidth,c=i?0:e.arrowHeight,[u,f]=fa(n),m={start:"0%",center:"50%",end:"100%"}[f],g=(((x=s.arrow)==null?void 0:x.x)??0)+a/2,d=(((w=s.arrow)==null?void 0:w.y)??0)+c/2;let v="",h="";return u==="bottom"?(v=i?m:`${g}px`,h=`${-c}px`):u==="top"?(v=i?m:`${g}px`,h=`${r.floating.height+c}px`):u==="right"?(v=`${-c}px`,h=i?m:`${d}px`):u==="left"&&(v=`${r.floating.width+c}px`,h=i?m:`${d}px`),{data:{x:v,y:h}}}});function fa(e){const[t,n="center"]=e.split("-");return[t,n]}var xf=ia,yf=la,wf=ca,_f=da,Sf="Portal",ga=p.forwardRef((e,t)=>{var a;const{container:n,...r}=e,[s,o]=p.useState(!1);dt(()=>o(!0),[]);const i=n||s&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return i?vc.createPortal(l.jsx(ne.div,{...r,ref:t}),i):null});ga.displayName=Sf;var Cr="rovingFocusGroup.onEntryFocus",Cf={bubbles:!1,cancelable:!0},an="RovingFocusGroup",[Kr,ma,bf]=Vi(an),[Rf,qn]=bt(an,[bf]),[Ef,Mf]=Rf(an),ha=p.forwardRef((e,t)=>l.jsx(Kr.Provider,{scope:e.__scopeRovingFocusGroup,children:l.jsx(Kr.Slot,{scope:e.__scopeRovingFocusGroup,children:l.jsx(Nf,{...e,ref:t})})}));ha.displayName=an;var Nf=p.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:s=!1,dir:o,currentTabStopId:i,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:c,onEntryFocus:u,preventScrollOnEntryFocus:f=!1,...m}=e,g=p.useRef(null),d=me(t,g),v=_s(o),[h,y]=Hn({prop:i,defaultProp:a??null,onChange:c,caller:an}),[x,w]=p.useState(!1),_=Je(u),S=ma(n),C=p.useRef(!1),[M,E]=p.useState(0);return p.useEffect(()=>{const N=g.current;if(N)return N.addEventListener(Cr,_),()=>N.removeEventListener(Cr,_)},[_]),l.jsx(Ef,{scope:n,orientation:r,dir:v,loop:s,currentTabStopId:h,onItemFocus:p.useCallback(N=>y(N),[y]),onItemShiftTab:p.useCallback(()=>w(!0),[]),onFocusableItemAdd:p.useCallback(()=>E(N=>N+1),[]),onFocusableItemRemove:p.useCallback(()=>E(N=>N-1),[]),children:l.jsx(ne.div,{tabIndex:x||M===0?-1:0,"data-orientation":r,...m,ref:d,style:{outline:"none",...e.style},onMouseDown:G(e.onMouseDown,()=>{C.current=!0}),onFocus:G(e.onFocus,N=>{const H=!C.current;if(N.target===N.currentTarget&&H&&!x){const F=new CustomEvent(Cr,Cf);if(N.currentTarget.dispatchEvent(F),!F.defaultPrevented){const q=S().filter(W=>W.focusable),X=q.find(W=>W.active),z=q.find(W=>W.id===h),te=[X,z,...q].filter(Boolean).map(W=>W.ref.current);xa(te,f)}}C.current=!1}),onBlur:G(e.onBlur,()=>w(!1))})})}),pa="RovingFocusGroupItem",va=p.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:s=!1,tabStopId:o,children:i,...a}=e,c=Tn(),u=o||c,f=Mf(pa,n),m=f.currentTabStopId===u,g=ma(n),{onFocusableItemAdd:d,onFocusableItemRemove:v,currentTabStopId:h}=f;return p.useEffect(()=>{if(r)return d(),()=>v()},[r,d,v]),l.jsx(Kr.ItemSlot,{scope:n,id:u,focusable:r,active:s,children:l.jsx(ne.span,{tabIndex:m?0:-1,"data-orientation":f.orientation,...a,ref:t,onMouseDown:G(e.onMouseDown,y=>{r?f.onItemFocus(u):y.preventDefault()}),onFocus:G(e.onFocus,()=>f.onItemFocus(u)),onKeyDown:G(e.onKeyDown,y=>{if(y.key==="Tab"&&y.shiftKey){f.onItemShiftTab();return}if(y.target!==y.currentTarget)return;const x=Af(y,f.orientation,f.dir);if(x!==void 0){if(y.metaKey||y.ctrlKey||y.altKey||y.shiftKey)return;y.preventDefault();let _=g().filter(S=>S.focusable).map(S=>S.ref.current);if(x==="last")_.reverse();else if(x==="prev"||x==="next"){x==="prev"&&_.reverse();const S=_.indexOf(y.currentTarget);_=f.loop?kf(_,S+1):_.slice(S+1)}setTimeout(()=>xa(_))}}),children:typeof i=="function"?i({isCurrentTabStop:m,hasTabStop:h!=null}):i})})});va.displayName=pa;var Tf={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function jf(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function Af(e,t,n){const r=jf(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return Tf[r]}function xa(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function kf(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var ya=ha,wa=va,If=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Nt=new WeakMap,yn=new WeakMap,wn={},br=0,_a=function(e){return e&&(e.host||_a(e.parentNode))},Pf=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=_a(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},Of=function(e,t,n,r){var s=Pf(t,Array.isArray(e)?e:[e]);wn[n]||(wn[n]=new WeakMap);var o=wn[n],i=[],a=new Set,c=new Set(s),u=function(m){!m||a.has(m)||(a.add(m),u(m.parentNode))};s.forEach(u);var f=function(m){!m||c.has(m)||Array.prototype.forEach.call(m.children,function(g){if(a.has(g))f(g);else try{var d=g.getAttribute(r),v=d!==null&&d!=="false",h=(Nt.get(g)||0)+1,y=(o.get(g)||0)+1;Nt.set(g,h),o.set(g,y),i.push(g),h===1&&v&&yn.set(g,!0),y===1&&g.setAttribute(n,"true"),v||g.setAttribute(r,"true")}catch(x){console.error("aria-hidden: cannot operate on ",g,x)}})};return f(t),a.clear(),br++,function(){i.forEach(function(m){var g=Nt.get(m)-1,d=o.get(m)-1;Nt.set(m,g),o.set(m,d),g||(yn.has(m)||m.removeAttribute(r),yn.delete(m)),d||m.removeAttribute(n)}),br--,br||(Nt=new WeakMap,Nt=new WeakMap,yn=new WeakMap,wn={})}},Ff=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),s=If(e);return s?(r.push.apply(r,Array.from(s.querySelectorAll("[aria-live], script"))),Of(r,s,n,"aria-hidden")):function(){return null}},De=function(){return De=Object.assign||function(t){for(var n,r=1,s=arguments.length;r<s;r++){n=arguments[r];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},De.apply(this,arguments)};function Sa(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(e);s<r.length;s++)t.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(e,r[s])&&(n[r[s]]=e[r[s]]);return n}function Df(e,t,n){if(n||arguments.length===2)for(var r=0,s=t.length,o;r<s;r++)(o||!(r in t))&&(o||(o=Array.prototype.slice.call(t,0,r)),o[r]=t[r]);return e.concat(o||Array.prototype.slice.call(t))}var En="right-scroll-bar-position",Mn="width-before-scroll-bar",$f="with-scroll-bars-hidden",Lf="--removed-body-scroll-bar-size";function Rr(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function Vf(e,t){var n=p.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var s=n.value;s!==r&&(n.value=r,n.callback(r,s))}}}})[0];return n.callback=t,n.facade}var Hf=typeof window<"u"?p.useLayoutEffect:p.useEffect,_o=new WeakMap;function zf(e,t){var n=Vf(null,function(r){return e.forEach(function(s){return Rr(s,r)})});return Hf(function(){var r=_o.get(n);if(r){var s=new Set(r),o=new Set(e),i=n.current;s.forEach(function(a){o.has(a)||Rr(a,null)}),o.forEach(function(a){s.has(a)||Rr(a,i)})}_o.set(n,e)},[e]),n}function Gf(e){return e}function Bf(e,t){t===void 0&&(t=Gf);var n=[],r=!1,s={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(o){var i=t(o,r);return n.push(i),function(){n=n.filter(function(a){return a!==i})}},assignSyncMedium:function(o){for(r=!0;n.length;){var i=n;n=[],i.forEach(o)}n={push:function(a){return o(a)},filter:function(){return n}}},assignMedium:function(o){r=!0;var i=[];if(n.length){var a=n;n=[],a.forEach(o),i=n}var c=function(){var f=i;i=[],f.forEach(o)},u=function(){return Promise.resolve().then(c)};u(),n={push:function(f){i.push(f),u()},filter:function(f){return i=i.filter(f),n}}}};return s}function Uf(e){e===void 0&&(e={});var t=Bf(null);return t.options=De({async:!0,ssr:!1},e),t}var Ca=function(e){var t=e.sideCar,n=Sa(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return p.createElement(r,De({},n))};Ca.isSideCarExport=!0;function Wf(e,t){return e.useMedium(t),Ca}var ba=Uf(),Er=function(){},Zn=p.forwardRef(function(e,t){var n=p.useRef(null),r=p.useState({onScrollCapture:Er,onWheelCapture:Er,onTouchMoveCapture:Er}),s=r[0],o=r[1],i=e.forwardProps,a=e.children,c=e.className,u=e.removeScrollBar,f=e.enabled,m=e.shards,g=e.sideCar,d=e.noRelative,v=e.noIsolation,h=e.inert,y=e.allowPinchZoom,x=e.as,w=x===void 0?"div":x,_=e.gapMode,S=Sa(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),C=g,M=zf([n,t]),E=De(De({},S),s);return p.createElement(p.Fragment,null,f&&p.createElement(C,{sideCar:ba,removeScrollBar:u,shards:m,noRelative:d,noIsolation:v,inert:h,setCallbacks:o,allowPinchZoom:!!y,lockRef:n,gapMode:_}),i?p.cloneElement(p.Children.only(a),De(De({},E),{ref:M})):p.createElement(w,De({},E,{className:c,ref:M}),a))});Zn.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Zn.classNames={fullWidth:Mn,zeroRight:En};var qf=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function Zf(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=qf();return t&&e.setAttribute("nonce",t),e}function Kf(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function Xf(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var Yf=function(){var e=0,t=null;return{add:function(n){e==0&&(t=Zf())&&(Kf(t,n),Xf(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Jf=function(){var e=Yf();return function(t,n){p.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Ra=function(){var e=Jf(),t=function(n){var r=n.styles,s=n.dynamic;return e(r,s),null};return t},Qf={left:0,top:0,right:0,gap:0},Mr=function(e){return parseInt(e||"",10)||0},eg=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],s=t[e==="padding"?"paddingRight":"marginRight"];return[Mr(n),Mr(r),Mr(s)]},tg=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return Qf;var t=eg(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},ng=Ra(),Ft="data-scroll-locked",rg=function(e,t,n,r){var s=e.left,o=e.top,i=e.right,a=e.gap;return n===void 0&&(n="margin"),`
|
|
66
|
-
.`.concat($f,` {
|
|
67
|
-
overflow: hidden `).concat(r,`;
|
|
68
|
-
padding-right: `).concat(a,"px ").concat(r,`;
|
|
69
|
-
}
|
|
70
|
-
body[`).concat(Ft,`] {
|
|
71
|
-
overflow: hidden `).concat(r,`;
|
|
72
|
-
overscroll-behavior: contain;
|
|
73
|
-
`).concat([t&&"position: relative ".concat(r,";"),n==="margin"&&`
|
|
74
|
-
padding-left: `.concat(s,`px;
|
|
75
|
-
padding-top: `).concat(o,`px;
|
|
76
|
-
padding-right: `).concat(i,`px;
|
|
77
|
-
margin-left:0;
|
|
78
|
-
margin-top:0;
|
|
79
|
-
margin-right: `).concat(a,"px ").concat(r,`;
|
|
80
|
-
`),n==="padding"&&"padding-right: ".concat(a,"px ").concat(r,";")].filter(Boolean).join(""),`
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
.`).concat(En,` {
|
|
84
|
-
right: `).concat(a,"px ").concat(r,`;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
.`).concat(Mn,` {
|
|
88
|
-
margin-right: `).concat(a,"px ").concat(r,`;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
.`).concat(En," .").concat(En,` {
|
|
92
|
-
right: 0 `).concat(r,`;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
.`).concat(Mn," .").concat(Mn,` {
|
|
96
|
-
margin-right: 0 `).concat(r,`;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
body[`).concat(Ft,`] {
|
|
100
|
-
`).concat(Lf,": ").concat(a,`px;
|
|
101
|
-
}
|
|
102
|
-
`)},So=function(){var e=parseInt(document.body.getAttribute(Ft)||"0",10);return isFinite(e)?e:0},sg=function(){p.useEffect(function(){return document.body.setAttribute(Ft,(So()+1).toString()),function(){var e=So()-1;e<=0?document.body.removeAttribute(Ft):document.body.setAttribute(Ft,e.toString())}},[])},og=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,s=r===void 0?"margin":r;sg();var o=p.useMemo(function(){return tg(s)},[s]);return p.createElement(ng,{styles:rg(o,!t,s,n?"":"!important")})},Xr=!1;if(typeof window<"u")try{var _n=Object.defineProperty({},"passive",{get:function(){return Xr=!0,!0}});window.addEventListener("test",_n,_n),window.removeEventListener("test",_n,_n)}catch{Xr=!1}var Tt=Xr?{passive:!1}:!1,ig=function(e){return e.tagName==="TEXTAREA"},Ea=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!ig(e)&&n[t]==="visible")},ag=function(e){return Ea(e,"overflowY")},lg=function(e){return Ea(e,"overflowX")},Co=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var s=Ma(e,r);if(s){var o=Na(e,r),i=o[1],a=o[2];if(i>a)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},cg=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},ug=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},Ma=function(e,t){return e==="v"?ag(t):lg(t)},Na=function(e,t){return e==="v"?cg(t):ug(t)},dg=function(e,t){return e==="h"&&t==="rtl"?-1:1},fg=function(e,t,n,r,s){var o=dg(e,window.getComputedStyle(t).direction),i=o*r,a=n.target,c=t.contains(a),u=!1,f=i>0,m=0,g=0;do{if(!a)break;var d=Na(e,a),v=d[0],h=d[1],y=d[2],x=h-y-o*v;(v||x)&&Ma(e,a)&&(m+=x,g+=v);var w=a.parentNode;a=w&&w.nodeType===Node.DOCUMENT_FRAGMENT_NODE?w.host:w}while(!c&&a!==document.body||c&&(t.contains(a)||t===a));return(f&&Math.abs(m)<1||!f&&Math.abs(g)<1)&&(u=!0),u},Sn=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},bo=function(e){return[e.deltaX,e.deltaY]},Ro=function(e){return e&&"current"in e?e.current:e},gg=function(e,t){return e[0]===t[0]&&e[1]===t[1]},mg=function(e){return`
|
|
103
|
-
.block-interactivity-`.concat(e,` {pointer-events: none;}
|
|
104
|
-
.allow-interactivity-`).concat(e,` {pointer-events: all;}
|
|
105
|
-
`)},hg=0,jt=[];function pg(e){var t=p.useRef([]),n=p.useRef([0,0]),r=p.useRef(),s=p.useState(hg++)[0],o=p.useState(Ra)[0],i=p.useRef(e);p.useEffect(function(){i.current=e},[e]),p.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(s));var h=Df([e.lockRef.current],(e.shards||[]).map(Ro),!0).filter(Boolean);return h.forEach(function(y){return y.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),h.forEach(function(y){return y.classList.remove("allow-interactivity-".concat(s))})}}},[e.inert,e.lockRef.current,e.shards]);var a=p.useCallback(function(h,y){if("touches"in h&&h.touches.length===2||h.type==="wheel"&&h.ctrlKey)return!i.current.allowPinchZoom;var x=Sn(h),w=n.current,_="deltaX"in h?h.deltaX:w[0]-x[0],S="deltaY"in h?h.deltaY:w[1]-x[1],C,M=h.target,E=Math.abs(_)>Math.abs(S)?"h":"v";if("touches"in h&&E==="h"&&M.type==="range")return!1;var N=Co(E,M);if(!N)return!0;if(N?C=E:(C=E==="v"?"h":"v",N=Co(E,M)),!N)return!1;if(!r.current&&"changedTouches"in h&&(_||S)&&(r.current=C),!C)return!0;var H=r.current||C;return fg(H,y,h,H==="h"?_:S)},[]),c=p.useCallback(function(h){var y=h;if(!(!jt.length||jt[jt.length-1]!==o)){var x="deltaY"in y?bo(y):Sn(y),w=t.current.filter(function(C){return C.name===y.type&&(C.target===y.target||y.target===C.shadowParent)&&gg(C.delta,x)})[0];if(w&&w.should){y.cancelable&&y.preventDefault();return}if(!w){var _=(i.current.shards||[]).map(Ro).filter(Boolean).filter(function(C){return C.contains(y.target)}),S=_.length>0?a(y,_[0]):!i.current.noIsolation;S&&y.cancelable&&y.preventDefault()}}},[]),u=p.useCallback(function(h,y,x,w){var _={name:h,delta:y,target:x,should:w,shadowParent:vg(x)};t.current.push(_),setTimeout(function(){t.current=t.current.filter(function(S){return S!==_})},1)},[]),f=p.useCallback(function(h){n.current=Sn(h),r.current=void 0},[]),m=p.useCallback(function(h){u(h.type,bo(h),h.target,a(h,e.lockRef.current))},[]),g=p.useCallback(function(h){u(h.type,Sn(h),h.target,a(h,e.lockRef.current))},[]);p.useEffect(function(){return jt.push(o),e.setCallbacks({onScrollCapture:m,onWheelCapture:m,onTouchMoveCapture:g}),document.addEventListener("wheel",c,Tt),document.addEventListener("touchmove",c,Tt),document.addEventListener("touchstart",f,Tt),function(){jt=jt.filter(function(h){return h!==o}),document.removeEventListener("wheel",c,Tt),document.removeEventListener("touchmove",c,Tt),document.removeEventListener("touchstart",f,Tt)}},[]);var d=e.removeScrollBar,v=e.inert;return p.createElement(p.Fragment,null,v?p.createElement(o,{styles:mg(s)}):null,d?p.createElement(og,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function vg(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const xg=Wf(ba,pg);var Ta=p.forwardRef(function(e,t){return p.createElement(Zn,De({},e,{ref:t,sideCar:xg}))});Ta.classNames=Zn.classNames;var Yr=["Enter"," "],yg=["ArrowDown","PageUp","Home"],ja=["ArrowUp","PageDown","End"],wg=[...yg,...ja],_g={ltr:[...Yr,"ArrowRight"],rtl:[...Yr,"ArrowLeft"]},Sg={ltr:["ArrowLeft"],rtl:["ArrowRight"]},ln="Menu",[en,Cg,bg]=Vi(ln),[Et,Aa]=bt(ln,[bg,sa,qn]),Kn=sa(),ka=qn(),[Rg,Mt]=Et(ln),[Eg,cn]=Et(ln),Ia=e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:s,onOpenChange:o,modal:i=!0}=e,a=Kn(t),[c,u]=p.useState(null),f=p.useRef(!1),m=Je(o),g=_s(s);return p.useEffect(()=>{const d=()=>{f.current=!0,document.addEventListener("pointerdown",v,{capture:!0,once:!0}),document.addEventListener("pointermove",v,{capture:!0,once:!0})},v=()=>f.current=!1;return document.addEventListener("keydown",d,{capture:!0}),()=>{document.removeEventListener("keydown",d,{capture:!0}),document.removeEventListener("pointerdown",v,{capture:!0}),document.removeEventListener("pointermove",v,{capture:!0})}},[]),l.jsx(xf,{...a,children:l.jsx(Rg,{scope:t,open:n,onOpenChange:m,content:c,onContentChange:u,children:l.jsx(Eg,{scope:t,onClose:p.useCallback(()=>m(!1),[m]),isUsingKeyboardRef:f,dir:g,modal:i,children:r})})})};Ia.displayName=ln;var Mg="MenuAnchor",As=p.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,s=Kn(n);return l.jsx(yf,{...s,...r,ref:t})});As.displayName=Mg;var ks="MenuPortal",[Ng,Pa]=Et(ks,{forceMount:void 0}),Oa=e=>{const{__scopeMenu:t,forceMount:n,children:r,container:s}=e,o=Mt(ks,t);return l.jsx(Ng,{scope:t,forceMount:n,children:l.jsx(Rt,{present:n||o.open,children:l.jsx(ga,{asChild:!0,container:s,children:r})})})};Oa.displayName=ks;var Ne="MenuContent",[Tg,Is]=Et(Ne),Fa=p.forwardRef((e,t)=>{const n=Pa(Ne,e.__scopeMenu),{forceMount:r=n.forceMount,...s}=e,o=Mt(Ne,e.__scopeMenu),i=cn(Ne,e.__scopeMenu);return l.jsx(en.Provider,{scope:e.__scopeMenu,children:l.jsx(Rt,{present:r||o.open,children:l.jsx(en.Slot,{scope:e.__scopeMenu,children:i.modal?l.jsx(jg,{...s,ref:t}):l.jsx(Ag,{...s,ref:t})})})})}),jg=p.forwardRef((e,t)=>{const n=Mt(Ne,e.__scopeMenu),r=p.useRef(null),s=me(t,r);return p.useEffect(()=>{const o=r.current;if(o)return Ff(o)},[]),l.jsx(Ps,{...e,ref:s,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:G(e.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),Ag=p.forwardRef((e,t)=>{const n=Mt(Ne,e.__scopeMenu);return l.jsx(Ps,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),kg=Nn("MenuContent.ScrollLock"),Ps=p.forwardRef((e,t)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:s,onOpenAutoFocus:o,onCloseAutoFocus:i,disableOutsidePointerEvents:a,onEntryFocus:c,onEscapeKeyDown:u,onPointerDownOutside:f,onFocusOutside:m,onInteractOutside:g,onDismiss:d,disableOutsideScroll:v,...h}=e,y=Mt(Ne,n),x=cn(Ne,n),w=Kn(n),_=ka(n),S=Cg(n),[C,M]=p.useState(null),E=p.useRef(null),N=me(t,E,y.onContentChange),H=p.useRef(0),F=p.useRef(""),q=p.useRef(0),X=p.useRef(null),z=p.useRef("right"),U=p.useRef(0),te=v?Ta:p.Fragment,W=v?{as:kg,allowPinchZoom:!0}:void 0,D=R=>{var Ee,vt;const V=F.current+R,Q=S().filter(xe=>!xe.disabled),ae=document.activeElement,ye=(Ee=Q.find(xe=>xe.ref.current===ae))==null?void 0:Ee.textValue,we=Q.map(xe=>xe.textValue),Ge=Bg(we,V,ye),Pe=(vt=Q.find(xe=>xe.textValue===Ge))==null?void 0:vt.ref.current;(function xe(je){F.current=je,window.clearTimeout(H.current),je!==""&&(H.current=window.setTimeout(()=>xe(""),1e3))})(V),Pe&&setTimeout(()=>Pe.focus())};p.useEffect(()=>()=>window.clearTimeout(H.current),[]),ed();const j=p.useCallback(R=>{var Q,ae;return z.current===((Q=X.current)==null?void 0:Q.side)&&Wg(R,(ae=X.current)==null?void 0:ae.area)},[]);return l.jsx(Tg,{scope:n,searchRef:F,onItemEnter:p.useCallback(R=>{j(R)&&R.preventDefault()},[j]),onItemLeave:p.useCallback(R=>{var V;j(R)||((V=E.current)==null||V.focus(),M(null))},[j]),onTriggerLeave:p.useCallback(R=>{j(R)&&R.preventDefault()},[j]),pointerGraceTimerRef:q,onPointerGraceIntentChange:p.useCallback(R=>{X.current=R},[]),children:l.jsx(te,{...W,children:l.jsx(Bi,{asChild:!0,trapped:s,onMountAutoFocus:G(o,R=>{var V;R.preventDefault(),(V=E.current)==null||V.focus({preventScroll:!0})}),onUnmountAutoFocus:i,children:l.jsx(zi,{asChild:!0,disableOutsidePointerEvents:a,onEscapeKeyDown:u,onPointerDownOutside:f,onFocusOutside:m,onInteractOutside:g,onDismiss:d,children:l.jsx(ya,{asChild:!0,..._,dir:x.dir,orientation:"vertical",loop:r,currentTabStopId:C,onCurrentTabStopIdChange:M,onEntryFocus:G(c,R=>{x.isUsingKeyboardRef.current||R.preventDefault()}),preventScrollOnEntryFocus:!0,children:l.jsx(wf,{role:"menu","aria-orientation":"vertical","data-state":Ja(y.open),"data-radix-menu-content":"",dir:x.dir,...w,...h,ref:N,style:{outline:"none",...h.style},onKeyDown:G(h.onKeyDown,R=>{const Q=R.target.closest("[data-radix-menu-content]")===R.currentTarget,ae=R.ctrlKey||R.altKey||R.metaKey,ye=R.key.length===1;Q&&(R.key==="Tab"&&R.preventDefault(),!ae&&ye&&D(R.key));const we=E.current;if(R.target!==we||!wg.includes(R.key))return;R.preventDefault();const Pe=S().filter(Ee=>!Ee.disabled).map(Ee=>Ee.ref.current);ja.includes(R.key)&&Pe.reverse(),zg(Pe)}),onBlur:G(e.onBlur,R=>{R.currentTarget.contains(R.target)||(window.clearTimeout(H.current),F.current="")}),onPointerMove:G(e.onPointerMove,tn(R=>{const V=R.target,Q=U.current!==R.clientX;if(R.currentTarget.contains(V)&&Q){const ae=R.clientX>U.current?"right":"left";z.current=ae,U.current=R.clientX}}))})})})})})})});Fa.displayName=Ne;var Ig="MenuGroup",Os=p.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return l.jsx(ne.div,{role:"group",...r,ref:t})});Os.displayName=Ig;var Pg="MenuLabel",Da=p.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return l.jsx(ne.div,{...r,ref:t})});Da.displayName=Pg;var Pn="MenuItem",Eo="menu.itemSelect",Xn=p.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:r,...s}=e,o=p.useRef(null),i=cn(Pn,e.__scopeMenu),a=Is(Pn,e.__scopeMenu),c=me(t,o),u=p.useRef(!1),f=()=>{const m=o.current;if(!n&&m){const g=new CustomEvent(Eo,{bubbles:!0,cancelable:!0});m.addEventListener(Eo,d=>r==null?void 0:r(d),{once:!0}),vi(m,g),g.defaultPrevented?u.current=!1:i.onClose()}};return l.jsx($a,{...s,ref:c,disabled:n,onClick:G(e.onClick,f),onPointerDown:m=>{var g;(g=e.onPointerDown)==null||g.call(e,m),u.current=!0},onPointerUp:G(e.onPointerUp,m=>{var g;u.current||(g=m.currentTarget)==null||g.click()}),onKeyDown:G(e.onKeyDown,m=>{const g=a.searchRef.current!=="";n||g&&m.key===" "||Yr.includes(m.key)&&(m.currentTarget.click(),m.preventDefault())})})});Xn.displayName=Pn;var $a=p.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:r=!1,textValue:s,...o}=e,i=Is(Pn,n),a=ka(n),c=p.useRef(null),u=me(t,c),[f,m]=p.useState(!1),[g,d]=p.useState("");return p.useEffect(()=>{const v=c.current;v&&d((v.textContent??"").trim())},[o.children]),l.jsx(en.ItemSlot,{scope:n,disabled:r,textValue:s??g,children:l.jsx(wa,{asChild:!0,...a,focusable:!r,children:l.jsx(ne.div,{role:"menuitem","data-highlighted":f?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...o,ref:u,onPointerMove:G(e.onPointerMove,tn(v=>{r?i.onItemLeave(v):(i.onItemEnter(v),v.defaultPrevented||v.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:G(e.onPointerLeave,tn(v=>i.onItemLeave(v))),onFocus:G(e.onFocus,()=>m(!0)),onBlur:G(e.onBlur,()=>m(!1))})})})}),Og="MenuCheckboxItem",La=p.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:r,...s}=e;return l.jsx(Ba,{scope:e.__scopeMenu,checked:n,children:l.jsx(Xn,{role:"menuitemcheckbox","aria-checked":On(n)?"mixed":n,...s,ref:t,"data-state":Ds(n),onSelect:G(s.onSelect,()=>r==null?void 0:r(On(n)?!0:!n),{checkForDefaultPrevented:!1})})})});La.displayName=Og;var Va="MenuRadioGroup",[Fg,Dg]=Et(Va,{value:void 0,onValueChange:()=>{}}),Ha=p.forwardRef((e,t)=>{const{value:n,onValueChange:r,...s}=e,o=Je(r);return l.jsx(Fg,{scope:e.__scopeMenu,value:n,onValueChange:o,children:l.jsx(Os,{...s,ref:t})})});Ha.displayName=Va;var za="MenuRadioItem",Ga=p.forwardRef((e,t)=>{const{value:n,...r}=e,s=Dg(za,e.__scopeMenu),o=n===s.value;return l.jsx(Ba,{scope:e.__scopeMenu,checked:o,children:l.jsx(Xn,{role:"menuitemradio","aria-checked":o,...r,ref:t,"data-state":Ds(o),onSelect:G(r.onSelect,()=>{var i;return(i=s.onValueChange)==null?void 0:i.call(s,n)},{checkForDefaultPrevented:!1})})})});Ga.displayName=za;var Fs="MenuItemIndicator",[Ba,$g]=Et(Fs,{checked:!1}),Ua=p.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:r,...s}=e,o=$g(Fs,n);return l.jsx(Rt,{present:r||On(o.checked)||o.checked===!0,children:l.jsx(ne.span,{...s,ref:t,"data-state":Ds(o.checked)})})});Ua.displayName=Fs;var Lg="MenuSeparator",Wa=p.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return l.jsx(ne.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})});Wa.displayName=Lg;var Vg="MenuArrow",qa=p.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,s=Kn(n);return l.jsx(_f,{...s,...r,ref:t})});qa.displayName=Vg;var Hg="MenuSub",[Xh,Za]=Et(Hg),qt="MenuSubTrigger",Ka=p.forwardRef((e,t)=>{const n=Mt(qt,e.__scopeMenu),r=cn(qt,e.__scopeMenu),s=Za(qt,e.__scopeMenu),o=Is(qt,e.__scopeMenu),i=p.useRef(null),{pointerGraceTimerRef:a,onPointerGraceIntentChange:c}=o,u={__scopeMenu:e.__scopeMenu},f=p.useCallback(()=>{i.current&&window.clearTimeout(i.current),i.current=null},[]);return p.useEffect(()=>f,[f]),p.useEffect(()=>{const m=a.current;return()=>{window.clearTimeout(m),c(null)}},[a,c]),l.jsx(As,{asChild:!0,...u,children:l.jsx($a,{id:s.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":s.contentId,"data-state":Ja(n.open),...e,ref:oi(t,s.onTriggerChange),onClick:m=>{var g;(g=e.onClick)==null||g.call(e,m),!(e.disabled||m.defaultPrevented)&&(m.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:G(e.onPointerMove,tn(m=>{o.onItemEnter(m),!m.defaultPrevented&&!e.disabled&&!n.open&&!i.current&&(o.onPointerGraceIntentChange(null),i.current=window.setTimeout(()=>{n.onOpenChange(!0),f()},100))})),onPointerLeave:G(e.onPointerLeave,tn(m=>{var d,v;f();const g=(d=n.content)==null?void 0:d.getBoundingClientRect();if(g){const h=(v=n.content)==null?void 0:v.dataset.side,y=h==="right",x=y?-5:5,w=g[y?"left":"right"],_=g[y?"right":"left"];o.onPointerGraceIntentChange({area:[{x:m.clientX+x,y:m.clientY},{x:w,y:g.top},{x:_,y:g.top},{x:_,y:g.bottom},{x:w,y:g.bottom}],side:h}),window.clearTimeout(a.current),a.current=window.setTimeout(()=>o.onPointerGraceIntentChange(null),300)}else{if(o.onTriggerLeave(m),m.defaultPrevented)return;o.onPointerGraceIntentChange(null)}})),onKeyDown:G(e.onKeyDown,m=>{var d;const g=o.searchRef.current!=="";e.disabled||g&&m.key===" "||_g[r.dir].includes(m.key)&&(n.onOpenChange(!0),(d=n.content)==null||d.focus(),m.preventDefault())})})})});Ka.displayName=qt;var Xa="MenuSubContent",Ya=p.forwardRef((e,t)=>{const n=Pa(Ne,e.__scopeMenu),{forceMount:r=n.forceMount,...s}=e,o=Mt(Ne,e.__scopeMenu),i=cn(Ne,e.__scopeMenu),a=Za(Xa,e.__scopeMenu),c=p.useRef(null),u=me(t,c);return l.jsx(en.Provider,{scope:e.__scopeMenu,children:l.jsx(Rt,{present:r||o.open,children:l.jsx(en.Slot,{scope:e.__scopeMenu,children:l.jsx(Ps,{id:a.contentId,"aria-labelledby":a.triggerId,...s,ref:u,align:"start",side:i.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:f=>{var m;i.isUsingKeyboardRef.current&&((m=c.current)==null||m.focus()),f.preventDefault()},onCloseAutoFocus:f=>f.preventDefault(),onFocusOutside:G(e.onFocusOutside,f=>{f.target!==a.trigger&&o.onOpenChange(!1)}),onEscapeKeyDown:G(e.onEscapeKeyDown,f=>{i.onClose(),f.preventDefault()}),onKeyDown:G(e.onKeyDown,f=>{var d;const m=f.currentTarget.contains(f.target),g=Sg[i.dir].includes(f.key);m&&g&&(o.onOpenChange(!1),(d=a.trigger)==null||d.focus(),f.preventDefault())})})})})})});Ya.displayName=Xa;function Ja(e){return e?"open":"closed"}function On(e){return e==="indeterminate"}function Ds(e){return On(e)?"indeterminate":e?"checked":"unchecked"}function zg(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function Gg(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function Bg(e,t,n){const s=t.length>1&&Array.from(t).every(u=>u===t[0])?t[0]:t,o=n?e.indexOf(n):-1;let i=Gg(e,Math.max(o,0));s.length===1&&(i=i.filter(u=>u!==n));const c=i.find(u=>u.toLowerCase().startsWith(s.toLowerCase()));return c!==n?c:void 0}function Ug(e,t){const{x:n,y:r}=e;let s=!1;for(let o=0,i=t.length-1;o<t.length;i=o++){const a=t[o],c=t[i],u=a.x,f=a.y,m=c.x,g=c.y;f>r!=g>r&&n<(m-u)*(r-f)/(g-f)+u&&(s=!s)}return s}function Wg(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return Ug(n,t)}function tn(e){return t=>t.pointerType==="mouse"?e(t):void 0}var qg=Ia,Zg=As,Kg=Oa,Xg=Fa,Yg=Os,Jg=Da,Qg=Xn,em=La,tm=Ha,nm=Ga,rm=Ua,sm=Wa,om=qa,im=Ka,am=Ya,Yn="DropdownMenu",[lm,Yh]=bt(Yn,[Aa]),ve=Aa(),[cm,Qa]=lm(Yn),el=e=>{const{__scopeDropdownMenu:t,children:n,dir:r,open:s,defaultOpen:o,onOpenChange:i,modal:a=!0}=e,c=ve(t),u=p.useRef(null),[f,m]=Hn({prop:s,defaultProp:o??!1,onChange:i,caller:Yn});return l.jsx(cm,{scope:t,triggerId:Tn(),triggerRef:u,contentId:Tn(),open:f,onOpenChange:m,onOpenToggle:p.useCallback(()=>m(g=>!g),[m]),modal:a,children:l.jsx(qg,{...c,open:f,onOpenChange:m,dir:r,modal:a,children:n})})};el.displayName=Yn;var tl="DropdownMenuTrigger",nl=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...s}=e,o=Qa(tl,n),i=ve(n);return l.jsx(Zg,{asChild:!0,...i,children:l.jsx(ne.button,{type:"button",id:o.triggerId,"aria-haspopup":"menu","aria-expanded":o.open,"aria-controls":o.open?o.contentId:void 0,"data-state":o.open?"open":"closed","data-disabled":r?"":void 0,disabled:r,...s,ref:oi(t,o.triggerRef),onPointerDown:G(e.onPointerDown,a=>{!r&&a.button===0&&a.ctrlKey===!1&&(o.onOpenToggle(),o.open||a.preventDefault())}),onKeyDown:G(e.onKeyDown,a=>{r||(["Enter"," "].includes(a.key)&&o.onOpenToggle(),a.key==="ArrowDown"&&o.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(a.key)&&a.preventDefault())})})})});nl.displayName=tl;var um="DropdownMenuPortal",rl=e=>{const{__scopeDropdownMenu:t,...n}=e,r=ve(t);return l.jsx(Kg,{...r,...n})};rl.displayName=um;var sl="DropdownMenuContent",ol=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Qa(sl,n),o=ve(n),i=p.useRef(!1);return l.jsx(Xg,{id:s.contentId,"aria-labelledby":s.triggerId,...o,...r,ref:t,onCloseAutoFocus:G(e.onCloseAutoFocus,a=>{var c;i.current||(c=s.triggerRef.current)==null||c.focus(),i.current=!1,a.preventDefault()}),onInteractOutside:G(e.onInteractOutside,a=>{const c=a.detail.originalEvent,u=c.button===0&&c.ctrlKey===!0,f=c.button===2||u;(!s.modal||f)&&(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)"}})});ol.displayName=sl;var dm="DropdownMenuGroup",fm=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=ve(n);return l.jsx(Yg,{...s,...r,ref:t})});fm.displayName=dm;var gm="DropdownMenuLabel",mm=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=ve(n);return l.jsx(Jg,{...s,...r,ref:t})});mm.displayName=gm;var hm="DropdownMenuItem",pm=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=ve(n);return l.jsx(Qg,{...s,...r,ref:t})});pm.displayName=hm;var vm="DropdownMenuCheckboxItem",il=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=ve(n);return l.jsx(em,{...s,...r,ref:t})});il.displayName=vm;var xm="DropdownMenuRadioGroup",ym=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=ve(n);return l.jsx(tm,{...s,...r,ref:t})});ym.displayName=xm;var wm="DropdownMenuRadioItem",_m=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=ve(n);return l.jsx(nm,{...s,...r,ref:t})});_m.displayName=wm;var Sm="DropdownMenuItemIndicator",al=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=ve(n);return l.jsx(rm,{...s,...r,ref:t})});al.displayName=Sm;var Cm="DropdownMenuSeparator",bm=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=ve(n);return l.jsx(sm,{...s,...r,ref:t})});bm.displayName=Cm;var Rm="DropdownMenuArrow",Em=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=ve(n);return l.jsx(om,{...s,...r,ref:t})});Em.displayName=Rm;var Mm="DropdownMenuSubTrigger",Nm=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=ve(n);return l.jsx(im,{...s,...r,ref:t})});Nm.displayName=Mm;var Tm="DropdownMenuSubContent",jm=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=ve(n);return l.jsx(am,{...s,...r,ref:t,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)"}})});jm.displayName=Tm;var Am=el,km=nl,Im=rl,Pm=ol,Om=il,Fm=al;function Dm({...e}){return l.jsx(Am,{"data-slot":"dropdown-menu",...e})}function $m({...e}){return l.jsx(km,{"data-slot":"dropdown-menu-trigger",...e})}function Lm({className:e,sideOffset:t=4,...n}){return l.jsx(Im,{children:l.jsx(Pm,{"data-slot":"dropdown-menu-content",sideOffset:t,className:ce("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),...n})})}function Vm({className:e,children:t,checked:n,...r}){return l.jsxs(Om,{"data-slot":"dropdown-menu-checkbox-item",className:ce("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:n,...r,children:[l.jsx("span",{className:"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center",children:l.jsx(Fm,{children:l.jsx(Ei,{className:"size-4"})})}),t]})}function $s({className:e,...t}){return l.jsx("div",{"data-slot":"table-container",className:"relative w-full overflow-x-auto",children:l.jsx("table",{"data-slot":"table",className:ce("w-full caption-bottom text-sm",e),...t})})}function Hm({className:e,...t}){return l.jsx("thead",{"data-slot":"table-header",className:ce("[&_tr]:border-b",e),...t})}function Ls({className:e,...t}){return l.jsx("tbody",{"data-slot":"table-body",className:ce("[&_tr:last-child]:border-0",e),...t})}function de({className:e,...t}){return l.jsx("tr",{"data-slot":"table-row",className:ce("hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",e),...t})}function zm({className:e,...t}){return l.jsx("th",{"data-slot":"table-head",className:ce("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),...t})}function I({className:e,...t}){return l.jsx("td",{"data-slot":"table-cell",className:ce("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",e),...t})}function Jn({columns:e,data:t,searchColumn:n,searchPlaceholder:r="Filter...",defaultColumnVisibility:s={},pageSize:o=25,defaultSorting:i=[]}){var y,x;const[a,c]=p.useState(i),[u,f]=p.useState([]),[m,g]=p.useState(s),[d,v]=p.useState({}),h=Bu({data:t,columns:e,onSortingChange:c,onColumnFiltersChange:f,getCoreRowModel:Iu(),getPaginationRowModel:Lu(),getSortedRowModel:Vu(),getFilteredRowModel:$u(),onColumnVisibilityChange:g,onRowSelectionChange:v,initialState:{pagination:{pageSize:o}},state:{sorting:a,columnFilters:u,columnVisibility:m,rowSelection:d}});return l.jsxs("div",{className:"w-full",children:[l.jsxs("div",{className:"flex items-center py-4",children:[n&&l.jsx(Lr,{placeholder:r,value:((y=h.getColumn(n))==null?void 0:y.getFilterValue())??"",onChange:w=>{var _;return(_=h.getColumn(n))==null?void 0:_.setFilterValue(w.target.value)},className:"max-w-sm"}),l.jsxs(Dm,{children:[l.jsx($m,{asChild:!0,children:l.jsxs(Pt,{variant:"outline",className:"ml-auto",children:["Columns ",l.jsx(ii,{className:"ml-2 h-4 w-4"})]})}),l.jsx(Lm,{align:"end",children:h.getAllColumns().filter(w=>w.getCanHide()).map(w=>l.jsx(Vm,{className:"capitalize",checked:w.getIsVisible(),onCheckedChange:_=>w.toggleVisibility(!!_),children:w.id},w.id))})]})]}),l.jsx("div",{className:"rounded-md border",children:l.jsxs($s,{children:[l.jsx(Hm,{children:h.getHeaderGroups().map(w=>l.jsx(de,{children:w.headers.map(_=>l.jsx(zm,{children:_.isPlaceholder?null:so(_.column.columnDef.header,_.getContext())},_.id))},w.id))}),l.jsx(Ls,{children:(x=h.getRowModel().rows)!=null&&x.length?h.getRowModel().rows.map(w=>l.jsx(de,{"data-state":w.getIsSelected()&&"selected",children:w.getVisibleCells().map(_=>l.jsx(I,{children:so(_.column.columnDef.cell,_.getContext())},_.id))},w.id)):l.jsx(de,{children:l.jsx(I,{colSpan:e.length,className:"h-24 text-center",children:"No results."})})})]})}),l.jsxs("div",{className:"flex items-center justify-end space-x-2 py-4",children:[l.jsxs("div",{className:"text-muted-foreground flex-1 text-sm",children:[h.getFilteredRowModel().rows.length," row(s) total."]}),l.jsxs("div",{className:"space-x-2",children:[l.jsx(Pt,{variant:"outline",size:"sm",onClick:()=>h.previousPage(),disabled:!h.getCanPreviousPage(),children:"Previous"}),l.jsx(Pt,{variant:"outline",size:"sm",onClick:()=>h.nextPage(),disabled:!h.getCanNextPage(),children:"Next"})]})]})]})}function se(e,t="left"){return({column:n})=>{const r=t==="right"?"justify-end":t==="center"?"justify-center":"justify-start",s=n.getIsSorted();return l.jsx("div",{className:`flex ${r}`,children:l.jsxs(Pt,{variant:"ghost",onClick:()=>n.toggleSorting(n.getIsSorted()==="asc"),className:`${t==="right"?"ml-auto":""} hover:bg-muted/50 h-auto p-0 font-medium text-sm`,children:[e,s==="asc"&&l.jsx(Mc,{className:"ml-1 h-3 w-3 text-muted-foreground"}),s==="desc"&&l.jsx(ii,{className:"ml-1 h-3 w-3 text-muted-foreground"})]})})}}const Gm=5*60*1e3;function ll(e){const[t,n]=p.useState(new Map),r=p.useRef();return p.useEffect(()=>{const o=new Date().toISOString(),i=new Set(e.map(a=>a.id));n(a=>{const c=new Map(a);return e.forEach(u=>{c.set(u.id,{...u,lastSeenAt:o,disconnectedAt:void 0})}),c.forEach((u,f)=>{!i.has(f)&&!u.disconnectedAt&&c.set(f,{...u,isConnected:!1,connectionStatus:"Disconnected",disconnectedAt:o,lastActivity:u.lastActivity||o})}),c})},[e]),p.useEffect(()=>{const o=()=>{const i=Date.now();n(a=>{const c=new Map(a);return c.forEach((u,f)=>{if(u.disconnectedAt){const m=new Date(u.disconnectedAt).getTime();i-m>Gm&&c.delete(f)}}),c})};return o(),r.current=setInterval(o,3e4),()=>{r.current&&clearInterval(r.current)}},[]),Array.from(t.values()).sort((o,i)=>o.isConnected!==i.isConnected?o.isConnected?-1:1:new Date(i.lastActivity).getTime()-new Date(o.lastActivity).getTime())}function Mo(e){const t=new Date,n=new Date(e),r=t.getTime()-n.getTime(),s=Math.floor(r/1e3);if(s<60)return"just now";const o=Math.floor(s/60);if(o<60)return`${o}m ago`;const i=Math.floor(o/60);return i<24?`${i}h ago`:`${Math.floor(i/24)}d ago`}function Bm(e){const t=Math.floor(e/86400),n=Math.floor(e%86400/3600),r=Math.floor(e%3600/60);return t>0?`${t}d ${n}h ${r}m`:n>0?`${n}h ${r}m`:`${r}m`}function Um(e){return e.length<=12?e:`${e.slice(0,5)}...${e.slice(-5)}`}function Wm(e){return e.length<=42?e:`${e.slice(0,35)}.....${e.slice(-5)}`}function qm({metrics:e}){const t=e.sessions||[],n=ll(t),r=()=>[{accessorKey:"clientInfo",header:se("Client"),cell:({row:s})=>{const o=s.original,i=o.clientInfo?`${Wm(o.clientInfo.name)}@${o.clientInfo.version}`:"unknown";return l.jsx("div",{className:"font-mono text-sm",title:o.clientInfo?`${o.clientInfo.name}@${o.clientInfo.version}`:"unknown",children:i})}},{accessorKey:"id",header:se("Session ID"),cell:({row:s})=>l.jsx("div",{className:"font-mono text-sm",title:s.getValue("id"),children:Um(s.getValue("id"))})},{accessorKey:"isConnected",header:se("Status"),cell:({row:s})=>{const o=s.original;return l.jsxs(xt,{variant:o.isConnected?"success":"secondary",className:"gap-1",children:[o.isConnected?l.jsx(Ni,{className:"h-3 w-3"}):l.jsx(Mi,{className:"h-3 w-3"}),o.isConnected?"Connected":"Disconnected"]})}},{accessorKey:"connectedAt",header:se("Connected"),cell:({row:s})=>l.jsx("div",{className:"text-sm",children:Mo(s.getValue("connectedAt"))})},{accessorKey:"requestCount",header:se("Requests","right"),cell:({row:s})=>l.jsx("div",{className:"text-right font-mono text-sm",children:s.getValue("requestCount")})},{accessorKey:"lastActivity",header:se("Last Activity"),cell:({row:s})=>l.jsx("div",{className:"text-sm",children:Mo(s.getValue("lastActivity"))})}];return l.jsxs(Ze,{children:[l.jsxs(Ke,{children:[l.jsx(Xe,{children:"📊 Transport Metrics"}),l.jsx(Ct,{children:"Real-time connection and performance metrics for STDIO transport"})]}),l.jsxs(Ye,{className:"space-y-4",children:[l.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[l.jsxs("div",{children:[l.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"Transport Type"}),l.jsx("p",{className:"text-sm font-mono",children:"STDIO"})]}),l.jsxs("div",{children:[l.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"Uptime"}),l.jsx("p",{className:"text-sm font-mono",children:Bm(e.uptimeSeconds)})]})]}),l.jsxs(l.Fragment,{children:[l.jsx(yt,{}),l.jsxs("div",{children:[l.jsxs("h3",{className:"text-sm font-semibold text-foreground mb-3",children:["Sessions (",n.filter(s=>s.isConnected).length," active,"," ",n.filter(s=>!s.isConnected).length," disconnected)"]}),l.jsx(Jn,{columns:r(),data:n,searchColumn:"id",searchPlaceholder:"Filter sessions...",pageSize:10,defaultSorting:[{id:"lastActivity",desc:!0}]})]})]})]})]})}function No(e){const t=new Date,n=new Date(e),r=t.getTime()-n.getTime(),s=Math.floor(r/1e3);if(s<60)return"just now";const o=Math.floor(s/60);if(o<60)return`${o}m ago`;const i=Math.floor(o/60);return i<24?`${i}h ago`:`${Math.floor(i/24)}d ago`}function Zm(e){const t=Math.floor(e/86400),n=Math.floor(e%86400/3600),r=Math.floor(e%3600/60);return t>0?`${t}d ${n}h ${r}m`:n>0?`${n}h ${r}m`:`${r}m`}function Cn(e){return e<1e3?`${e}ms`:e<6e4?`${Math.round(e/1e3)}s`:`${Math.round(e/6e4)}m`}function Km(e){return e.length<=12?e:`${e.slice(0,5)}...${e.slice(-5)}`}function Xm(e){return e.length<=42?e:`${e.slice(0,35)}.....${e.slice(-5)}`}function Ym({metrics:e}){const t=e.sessions||[],n=ll(t),r={sse:"Server-Sent Events",streamableHttp:"Streamable HTTP"},s=()=>[{accessorKey:"clientInfo",header:se("Client"),cell:({row:o})=>{const i=o.original,a=i.clientInfo?`${Xm(i.clientInfo.name)}@${i.clientInfo.version}`:"unknown";return l.jsx("div",{className:"font-mono text-sm",title:i.clientInfo?`${i.clientInfo.name}@${i.clientInfo.version}`:"unknown",children:a})}},{accessorKey:"id",header:se("Session ID"),cell:({row:o})=>l.jsx("div",{className:"font-mono text-sm",title:o.getValue("id"),children:Km(o.getValue("id"))})},{accessorKey:"connectionStatus",header:se("Status"),cell:({row:o})=>{const i=o.original,a=i.connectionStatus||(i.isConnected?"Connected":"Disconnected");return a==="Connected"?l.jsxs(xt,{variant:"success",className:"gap-1",children:[l.jsx(Ni,{className:"h-3 w-3"}),"Connected"]}):a==="Distressed"?l.jsxs(xt,{variant:"destructive",className:"gap-1",children:[l.jsx(ai,{className:"h-3 w-3"}),"Distressed ",i.pingFailures?`(${i.pingFailures} failed)`:""]}):l.jsxs(xt,{variant:"secondary",className:"gap-1",children:[l.jsx(Mi,{className:"h-3 w-3"}),"Disconnected"]})}},{accessorKey:"connectedAt",header:se("Connected"),cell:({row:o})=>l.jsx("div",{className:"text-sm",children:No(o.getValue("connectedAt"))})},{accessorKey:"requestCount",header:se("Requests","right"),cell:({row:o})=>l.jsx("div",{className:"text-right font-mono text-sm",children:o.getValue("requestCount")})},{accessorKey:"lastActivity",header:se("Last Activity"),cell:({row:o})=>l.jsx("div",{className:"text-sm",children:No(o.getValue("lastActivity"))})}];return l.jsxs(Ze,{children:[l.jsxs(Ke,{children:[l.jsx(Xe,{children:"📊 Transport Metrics"}),l.jsxs(Ct,{children:["Real-time connection and performance metrics for"," ",r[e.transport]||e.transport," transport"]})]}),l.jsxs(Ye,{className:"space-y-4",children:[l.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[l.jsxs("div",{children:[l.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"Transport Type"}),l.jsx("p",{className:"text-sm font-mono",children:r[e.transport]||e.transport})]}),l.jsxs("div",{children:[l.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"Uptime"}),l.jsx("p",{className:"text-sm font-mono",children:Zm(e.uptimeSeconds)})]})]}),e.configuration&&l.jsx(l.Fragment,{children:l.jsxs("div",{children:[l.jsx("p",{className:"text-sm font-medium text-muted-foreground mb-2",children:"Configuration"}),l.jsx("div",{className:"grid grid-cols-1 gap-2",children:e.pings&&l.jsx("div",{className:"text-xs text-muted-foreground bg-muted/30 p-2 rounded",children:e.pings.sent>0&&l.jsxs("p",{children:[l.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,"%)"]})})}),l.jsxs("p",{className:"text-xs text-muted-foreground mt-2",children:["SSE connections checked every ",Cn(e.configuration.heartbeatInterval||3e4),", sessions swept every ",Cn(e.configuration.staleCheckInterval),", removed after"," ",Cn(e.configuration.staleTimeout)," inactive",e.configuration.pingEnabled&&e.configuration.pingInterval&&`, pings sent every ${Cn(e.configuration.pingInterval)}`,e.configuration.pingEnabled&&`, marked distressed after ${e.configuration.pingFailureThreshold||1} failed ping${(e.configuration.pingFailureThreshold||1)!==1?"s":""}`]})]})}),l.jsx(yt,{}),l.jsx("div",{children:l.jsx($s,{children:l.jsxs(Ls,{children:[l.jsxs(de,{children:[l.jsx(I,{className:"font-medium text-sm",children:"Active Connections"}),l.jsx(I,{className:"text-sm font-mono",children:e.connections.active}),l.jsx(I,{className:"font-medium text-sm",children:"Cleaned Sessions"}),l.jsx(I,{className:"text-sm font-mono",children:e.connections.cleaned??0})]}),l.jsxs(de,{children:[l.jsx(I,{className:"font-medium text-sm",children:"Total Connections"}),l.jsx(I,{className:"text-sm font-mono",children:e.connections.total}),l.jsx(I,{className:"font-medium text-sm",children:"Requests per Minute (tot/3hr/hr)"}),l.jsxs(I,{className:"text-sm font-mono",children:[e.requests.averagePerMinute,"/",e.requests.last3Hours,"/",e.requests.lastHour]})]}),e.sessionLifecycle&&l.jsxs(de,{children:[l.jsx(I,{className:"font-medium text-sm",children:"Sessions New/Res-fail/Del"}),l.jsxs(I,{className:"text-sm font-mono",colSpan:3,children:[e.sessionLifecycle.created,"/",e.sessionLifecycle.resumedFailed,"/",e.sessionLifecycle.deleted]})]}),l.jsxs(de,{children:[l.jsx(I,{className:"font-medium text-sm",children:"Client Errors (4xx)"}),l.jsx(I,{className:"text-sm font-mono",children:e.errors.expected}),l.jsx(I,{className:"font-medium text-sm",children:"Server Errors (5xx)"}),l.jsx(I,{className:"text-sm font-mono",children:e.errors.unexpected})]}),e.pings&&l.jsxs(de,{children:[l.jsx(I,{className:"font-medium text-sm",children:"Pings Sent"}),l.jsx(I,{className:"text-sm font-mono",children:e.pings.sent}),l.jsx(I,{className:"font-medium text-sm",children:"Ping Success Rate"}),l.jsx(I,{className:"text-sm font-mono",children:e.pings.sent>0?`${Math.round(e.pings.successful/e.pings.sent*100)}%`:"-"})]}),e.apiMetrics&&l.jsxs(l.Fragment,{children:[l.jsxs(de,{children:[l.jsx(I,{className:"font-medium text-sm",children:"Anonymous Users"}),l.jsx(I,{className:"text-sm font-mono",children:e.apiMetrics.anonymous}),l.jsx(I,{className:"font-medium text-sm",children:"Authenticated Users"}),l.jsx(I,{className:"text-sm font-mono",children:e.apiMetrics.authenticated})]}),l.jsxs(de,{children:[l.jsx(I,{className:"font-medium text-sm",children:"401 Unauthorized Users"}),l.jsx(I,{className:"text-sm font-mono",children:e.apiMetrics.unauthorized}),l.jsx(I,{className:"font-medium text-sm",children:"403 Forbidden Users"}),l.jsx(I,{className:"text-sm font-mono",children:e.apiMetrics.forbidden})]})]}),l.jsxs(de,{children:[l.jsx(I,{className:"font-medium text-sm",children:"Gradio Success/Fail"}),l.jsx(I,{className:"text-sm font-mono",children:e.gradioMetrics?`${e.gradioMetrics.success}/${e.gradioMetrics.failure}`:"0/0"}),l.jsx(I,{className:"font-medium text-sm",children:"-"}),l.jsx(I,{className:"text-sm font-mono",children:"-"})]})]})})}),l.jsxs(l.Fragment,{children:[l.jsx(yt,{}),l.jsxs("div",{children:[l.jsxs("h3",{className:"text-sm font-semibold text-foreground mb-3",children:["Sessions (",n.filter(o=>o.isConnected).length," active,"," ",n.filter(o=>!o.isConnected).length," disconnected)"]}),l.jsx(Jn,{columns:s(),data:n,searchColumn:"id",searchPlaceholder:"Filter sessions...",pageSize:10,defaultSorting:[{id:"lastActivity",desc:!0}]})]})]})]})]})}function To(e){const t=new Date,n=new Date(e),r=t.getTime()-n.getTime(),s=Math.floor(r/1e3);if(s<60)return"just now";const o=Math.floor(s/60);if(o<60)return`${o}m ago`;const i=Math.floor(o/60);return i<24?`${i}h ago`:`${Math.floor(i/24)}d ago`}function Jm(e){const t=Math.floor(e/86400),n=Math.floor(e%86400/3600),r=Math.floor(e%3600/60);return t>0?`${t}d ${n}h ${r}m`:n>0?`${n}h ${r}m`:`${r}m`}function Qm(e){const t=new Date,n=new Date(e),r=t.getTime()-n.getTime();return Math.floor(r/6e4)<5}function eh(e){return e.length<=42?e:`${e.slice(0,35)}.....${e.slice(-5)}`}function th({metrics:e}){const t=e.clients,n=()=>[{accessorKey:"name",header:se("Client"),cell:({row:r})=>{const s=r.original,o=`${eh(s.name)}@${s.version}`;return l.jsxs("div",{children:[l.jsx("p",{className:"font-medium font-mono text-sm",title:`${s.name}@${s.version}`,children:o}),l.jsxs("p",{className:"text-xs text-muted-foreground",children:["First seen ",To(s.firstSeen)]})]})}},{accessorKey:"requestCount",header:se("Initializations","right"),cell:({row:r})=>l.jsx("div",{className:"text-right font-mono text-sm",children:r.getValue("requestCount")})},{accessorKey:"isConnected",header:se("Status"),cell:({row:r})=>{const s=r.original;return l.jsx("div",{children:Qm(s.lastSeen)?l.jsxs(xt,{variant:"success",className:"gap-1",children:[l.jsx(bc,{className:"h-3 w-3"}),"Recent"]}):l.jsxs(xt,{variant:"secondary",className:"gap-1",children:[l.jsx(Tc,{className:"h-3 w-3"}),"Idle"]})})}},{accessorKey:"lastSeen",header:se("Last Seen","right"),cell:({row:r})=>l.jsx("div",{className:"text-right text-sm",children:To(r.getValue("lastSeen"))})}];return l.jsxs(Ze,{children:[l.jsxs(Ke,{children:[l.jsx(Xe,{children:"📊 Transport Metrics"}),l.jsx(Ct,{children:"Real-time connection and performance metrics for Stateless HTTP JSON transport"})]}),l.jsxs(Ye,{className:"space-y-4",children:[l.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[l.jsxs("div",{children:[l.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"Transport Type"}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("p",{className:"text-sm font-mono",children:"Stateless HTTP JSON"}),l.jsx(xt,{variant:"secondary",children:e.sessionLifecycle?"analytics":"stateless"})]})]}),l.jsxs("div",{children:[l.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"Uptime"}),l.jsx("p",{className:"text-sm font-mono",children:Jm(e.uptimeSeconds)})]})]}),l.jsx(yt,{}),l.jsx("div",{children:l.jsx($s,{children:l.jsxs(Ls,{children:[l.jsxs(de,{children:[l.jsx(I,{className:"font-medium text-sm",children:"Request Count (MCP)"}),l.jsx(I,{className:"text-sm font-mono",children:e.connections.total}),l.jsx(I,{className:"font-medium text-sm",children:"Requests per Minute (tot/3hr/hr)"}),l.jsxs(I,{className:"text-sm font-mono",children:[e.requests.averagePerMinute,"/",e.requests.last3Hours,"/",e.requests.lastHour]})]}),l.jsxs(de,{children:[l.jsx(I,{className:"font-medium text-sm",children:"Client Errors (4xx)"}),l.jsx(I,{className:"text-sm font-mono",children:e.errors.expected}),l.jsx(I,{className:"font-medium text-sm",children:"Server Errors (5xx)"}),l.jsx(I,{className:"text-sm font-mono",children:e.errors.unexpected})]}),(e.staticPageHits200!==void 0||e.staticPageHits405!==void 0)&&l.jsxs(de,{children:[l.jsx(I,{className:"font-medium text-sm",children:l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx(Ac,{className:"h-3 w-3"}),"hf.co/mcp (200/405)"]})}),l.jsxs(I,{className:"text-sm font-mono",children:[e.staticPageHits200||0,"/",e.staticPageHits405||0]}),l.jsx(I,{className:"font-medium text-sm",children:l.jsx("div",{className:"flex items-center gap-1",children:"Auth Status (Anon/Auth/401)"})}),l.jsxs(I,{className:"text-sm font-mono",children:[e.connections.anonymous,"/",e.connections.authenticated,"/",e.connections.unauthorized||0]})]}),e.apiMetrics&&l.jsxs(l.Fragment,{children:[l.jsxs(de,{children:[l.jsx(I,{className:"font-medium text-sm",children:"Tool API - Anonymous"}),l.jsx(I,{className:"text-sm font-mono",children:e.apiMetrics.anonymous}),l.jsx(I,{className:"font-medium text-sm",children:"Tool API - Authenticated"}),l.jsx(I,{className:"text-sm font-mono",children:e.apiMetrics.authenticated})]}),l.jsxs(de,{children:[l.jsx(I,{className:"font-medium text-sm",children:"Tool API - 401 Unauthorized"}),l.jsx(I,{className:"text-sm font-mono",children:e.apiMetrics.unauthorized}),l.jsx(I,{className:"font-medium text-sm",children:"Tool API - 403 Forbidden"}),l.jsx(I,{className:"text-sm font-mono",children:e.apiMetrics.forbidden})]})]}),l.jsxs(de,{children:[l.jsx(I,{className:"font-medium text-sm",children:"Gradio Success/Fail"}),l.jsx(I,{className:"text-sm font-mono",children:e.gradioMetrics?`${e.gradioMetrics.success}/${e.gradioMetrics.failure}`:"0/0"}),e.sessionLifecycle?l.jsxs(l.Fragment,{children:[l.jsx(I,{className:"font-medium text-sm",children:"Sessions New/Res-fail/Del"}),l.jsxs(I,{className:"text-sm font-mono",children:[e.sessionLifecycle.created,"/",e.sessionLifecycle.resumedFailed,"/",e.sessionLifecycle.deleted]})]}):l.jsxs(l.Fragment,{children:[l.jsx(I,{className:"font-medium text-sm",children:"-"}),l.jsx(I,{className:"text-sm font-mono",children:"-"})]})]})]})})}),l.jsxs(l.Fragment,{children:[l.jsx(yt,{}),l.jsxs("div",{children:[l.jsx("h3",{className:"text-sm font-semibold text-foreground mb-3",children:"Client Identities"}),l.jsx(Jn,{columns:n(),data:t,searchColumn:"name",searchPlaceholder:"Filter clients...",pageSize:50,defaultSorting:[{id:"lastSeen",desc:!0}]})]})]})]})]})}const nh=e=>fetch(e).then(t=>{if(!t.ok)throw new Error(`Failed to fetch: ${t.status}`);return t.json()});function rh(){const{data:e,error:t}=Kt("/api/transport-metrics",nh,{refreshInterval:3e3,revalidateOnFocus:!0,revalidateOnReconnect:!0});return t?l.jsxs(Ze,{children:[l.jsx(Ke,{children:l.jsx(Xe,{children:"📊 Transport Metrics"})}),l.jsx(Ye,{children:l.jsxs(Vc,{variant:"destructive",children:[l.jsx(ai,{className:"h-4 w-4"}),l.jsx(Hc,{children:"Error Loading Metrics"}),l.jsxs(zc,{children:["Failed to load transport metrics: ",t.message]})]})})]}):e?e.transport==="stdio"?l.jsx(qm,{metrics:e}):e.isStateless?l.jsx(th,{metrics:e}):l.jsx(Ym,{metrics:e}):l.jsxs(Ze,{children:[l.jsx(Ke,{children:l.jsx(Xe,{children:"📊 Transport Metrics"})}),l.jsx(Ye,{children:l.jsxs("div",{className:"animate-pulse space-y-2",children:[l.jsx("div",{className:"h-4 bg-gray-200 rounded w-3/4"}),l.jsx("div",{className:"h-4 bg-gray-200 rounded w-1/2"}),l.jsx("div",{className:"h-4 bg-gray-200 rounded w-2/3"})]})})]})}const sh=e=>fetch(e).then(t=>{if(!t.ok)throw new Error(`Failed to fetch: ${t.status}`);return t.json()});function oh(){const[e,t]=p.useState(!1),{data:n,error:r}=Kt("/api/transport-metrics",sh,{refreshInterval:3e3,revalidateOnFocus:!0,revalidateOnReconnect:!0}),s=!n&&!r,o=(n==null?void 0:n.transport)==="stdio",i=((n==null?void 0:n.methods)||[]).map(g=>{let d=g.errors,v,h;if(g.method.startsWith("tools/call:")&&(n!=null&&n.gradioMetrics)){const w=g.method.replace("tools/call:",""),_=n.gradioMetrics.byTool;_[w]&&(v=_[w].success,h=_[w].failure,d+=h)}const y=g.count>0?d/g.count*100:0;return{method:g.method,count:g.count,errors:d,errorRate:y,averageResponseTime:g.averageResponseTime,lastCalled:g.lastCalled,gradioSuccess:v,gradioFailure:h}}),a=e?i.filter(g=>g.method.startsWith("tools/call")||g.method.startsWith("prompts/get")):i,c=i.reduce((g,d)=>g+d.count,0),u=i.filter(g=>g.method.startsWith("tools/call")).reduce((g,d)=>g+d.count,0),f=i.filter(g=>g.method.startsWith("prompts/get")).reduce((g,d)=>g+d.count,0),m=[{accessorKey:"method",header:se("Method"),cell:({row:g})=>{const d=g.getValue("method");return l.jsx("div",{className:"font-mono text-sm",children:d==="tools/call"?l.jsx("span",{className:"text-blue-600 dark:text-blue-400",children:"tools/call"}):d.startsWith("tools/call:")?l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"text-blue-600 dark:text-blue-400",children:"tools/call:"}),l.jsx("span",{className:"text-green-600 dark:text-green-400",children:d.replace("tools/call:","")})]}):d==="prompts/get"?l.jsx("span",{className:"text-purple-600 dark:text-purple-400",children:"prompts/get"}):d.startsWith("prompts/get:")?l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"text-purple-600 dark:text-purple-400",children:"prompts/get:"}),l.jsx("span",{className:"text-orange-600 dark:text-orange-400",children:d.replace("prompts/get:","")})]}):d})}},{accessorKey:"count",header:se("Calls","right"),cell:({row:g})=>l.jsx("div",{className:"text-right font-mono",children:g.getValue("count").toLocaleString()})},{accessorKey:"errors",header:se("Errors","right"),cell:({row:g})=>{const d=g.getValue("errors");return l.jsx("div",{className:"text-right font-mono",children:d>0?l.jsx("span",{className:"text-red-600 dark:text-red-400",children:d}):"0"})}},{accessorKey:"gradioMetrics",header:se("Success/Failure","right"),cell:({row:g})=>{const d=g.original;return d.gradioSuccess!==void 0&&d.gradioFailure!==void 0?l.jsxs("div",{className:"text-right font-mono text-sm",children:[l.jsx("span",{className:"text-green-600 dark:text-green-400",children:d.gradioSuccess}),l.jsx("span",{className:"text-muted-foreground",children:"/"}),l.jsx("span",{className:"text-red-600 dark:text-red-400",children:d.gradioFailure})]}):l.jsx("div",{className:"text-right text-muted-foreground",children:"—"})}},{accessorKey:"errorRate",header:se("Error Rate","right"),cell:({row:g})=>{const d=g.getValue("errorRate");return l.jsx("div",{className:"text-right font-mono",children:d>0?l.jsxs("span",{className:"text-red-600 dark:text-red-400",children:[d.toFixed(1),"%"]}):"0%"})}},{accessorKey:"averageResponseTime",header:se("Avg Response","right"),cell:({row:g})=>{const d=g.getValue("averageResponseTime");return l.jsx("div",{className:"text-right font-mono",children:d?`${d.toFixed(0)}ms`:"—"})}},{accessorKey:"lastCalled",header:se("Last Called","right"),cell:({row:g})=>l.jsx("div",{className:"text-right text-sm text-muted-foreground",children:new Date(g.getValue("lastCalled")).toLocaleTimeString()})}];return l.jsxs(Ze,{children:[l.jsxs(Ke,{children:[l.jsx(Xe,{children:"HTTP JSON Transport Statistics"}),l.jsxs(Ct,{children:["MCP method call statistics and performance metrics",o?" (Empty in STDIO mode)":n!=null&&n.isStateless?"":" (Response times not available in stateful modes)"]})]}),l.jsxs(Ye,{children:[s&&l.jsx("div",{className:"flex items-center justify-center py-8",children:l.jsx("div",{className:"text-sm text-muted-foreground",children:"Loading metrics..."})}),r&&l.jsx("div",{className:"flex items-center justify-center py-8",children:l.jsxs("div",{className:"text-sm text-destructive",children:["Error loading metrics: ",r.message]})}),o&&l.jsx("div",{className:"flex items-center justify-center py-8",children:l.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."})}),n&&!o&&l.jsxs("div",{className:"space-y-4",children:[i.length>0&&l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{className:"text-sm text-muted-foreground",children:["Showing ",a.length," method",a.length!==1?"s":""," tracked since"," ",new Date(n.startupTime).toLocaleString()]}),l.jsxs("div",{className:"flex items-center gap-4",children:[l.jsxs("div",{className:"text-sm font-medium",children:["Total MCP Calls: ",l.jsx("span",{className:"font-mono",children:c.toLocaleString()})]}),l.jsxs("div",{className:"text-sm font-medium",children:["Tool Calls: ",l.jsx("span",{className:"font-mono",children:u.toLocaleString()})]}),l.jsxs("div",{className:"text-sm font-medium",children:["Prompt Calls: ",l.jsx("span",{className:"font-mono",children:f.toLocaleString()})]})]})]}),i.length>0&&l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx(ps,{id:"tool-prompt-calls-filter",checked:e,onCheckedChange:g=>t(!!g)}),l.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"})]}),a.length===0?l.jsx("div",{className:"flex items-center justify-center py-8",children:l.jsx("div",{className:"text-sm text-muted-foreground",children:e?"No tool or prompt calls recorded yet.":"No method calls recorded yet."})}):l.jsx(Jn,{columns:m,data:a,searchColumn:"method",searchPlaceholder:"Filter methods...",pageSize:50,defaultColumnVisibility:{method:!0,count:!0,errors:!1,gradioMetrics:!1,errorRate:!0,averageResponseTime:n.transport==="streamableHttpJson",lastCalled:!0},defaultSorting:[{id:"count",desc:!0}]})]})]})]})}function jo(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 ih({isLoading:e,error:t,transportInfo:n}){const r=()=>{switch(n.transport){case"stdio":return"STDIO";case"sse":return"SSE";case"streamableHttp":case"streamableHttpJson":return"Streamable HTTP";default:return"Unknown"}},s=()=>{switch(n.transport){case"sse":return"/sse";case"streamableHttp":case"streamableHttpJson":return"/mcp";case"stdio":return"stdin/stdout";default:return"unknown"}},o=()=>n.transport==="streamableHttpJson"||n.transport==="streamableHttp"&&n.jsonResponseEnabled===!0,i=()=>o()?l.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)"}):n.transport==="streamableHttp"?l.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"}):n.transport==="sse"?l.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 l.jsx("div",{className:"text-center text-xs text-muted-foreground py-2",children:"Loading connection information..."});if(t)return l.jsxs("div",{className:"text-center text-xs text-destructive py-2",children:["Error: ",t]});const a=n.port||3e3,c=n.transport!=="stdio";return l.jsx("div",{className:"fixed bottom-0 left-0 w-full bg-muted/50 border-t border-border py-2 px-4",children:l.jsxs("div",{className:"max-w-[700px] mx-auto flex justify-between items-center text-xs",children:[l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx("span",{className:"text-muted-foreground",children:"Using"}),l.jsx("span",{className:"font-medium text-primary",children:r()}),n.transport==="stdio"&&l.jsxs("span",{className:"text-muted-foreground flex items-center",children:["Client Info :",n.stdioClient?l.jsx("span",{className:"ml-2 flex items-center",children:l.jsxs("span",{className:"ml-1 font-medium text-green-700",children:[n.stdioClient.name," ",n.stdioClient.version]})}):l.jsx("span",{className:"ml-2 text-muted-foreground",children:" (disconnected) "})]}),c&&l.jsxs("span",{className:"text-muted-foreground flex items-center",children:["on port ",l.jsx("span",{className:"font-mono mx-1",children:a}),"at ",l.jsx("span",{className:"font-mono mx-1",children:s()}),i()]})]}),l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx("span",{className:"text-muted-foreground",children:" Default HF Token:"}),l.jsx("span",{className:`font-mono ${jo(n).isWarning?"text-red-500":""}`,children:jo(n).text})]})]})})}var Qn="Tabs",[ah,Jh]=bt(Qn,[qn]),cl=qn(),[lh,Vs]=ah(Qn),ul=p.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:s,defaultValue:o,orientation:i="horizontal",dir:a,activationMode:c="automatic",...u}=e,f=_s(a),[m,g]=Hn({prop:r,onChange:s,defaultProp:o??"",caller:Qn});return l.jsx(lh,{scope:n,baseId:Tn(),value:m,onValueChange:g,orientation:i,dir:f,activationMode:c,children:l.jsx(ne.div,{dir:f,"data-orientation":i,...u,ref:t})})});ul.displayName=Qn;var dl="TabsList",fl=p.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...s}=e,o=Vs(dl,n),i=cl(n);return l.jsx(ya,{asChild:!0,...i,orientation:o.orientation,dir:o.dir,loop:r,children:l.jsx(ne.div,{role:"tablist","aria-orientation":o.orientation,...s,ref:t})})});fl.displayName=dl;var gl="TabsTrigger",ml=p.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:s=!1,...o}=e,i=Vs(gl,n),a=cl(n),c=vl(i.baseId,r),u=xl(i.baseId,r),f=r===i.value;return l.jsx(wa,{asChild:!0,...a,focusable:!s,active:f,children:l.jsx(ne.button,{type:"button",role:"tab","aria-selected":f,"aria-controls":u,"data-state":f?"active":"inactive","data-disabled":s?"":void 0,disabled:s,id:c,...o,ref:t,onMouseDown:G(e.onMouseDown,m=>{!s&&m.button===0&&m.ctrlKey===!1?i.onValueChange(r):m.preventDefault()}),onKeyDown:G(e.onKeyDown,m=>{[" ","Enter"].includes(m.key)&&i.onValueChange(r)}),onFocus:G(e.onFocus,()=>{const m=i.activationMode!=="manual";!f&&!s&&m&&i.onValueChange(r)})})})});ml.displayName=gl;var hl="TabsContent",pl=p.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:s,children:o,...i}=e,a=Vs(hl,n),c=vl(a.baseId,r),u=xl(a.baseId,r),f=r===a.value,m=p.useRef(f);return p.useEffect(()=>{const g=requestAnimationFrame(()=>m.current=!1);return()=>cancelAnimationFrame(g)},[]),l.jsx(Rt,{present:s||f,children:({present:g})=>l.jsx(ne.div,{"data-state":f?"active":"inactive","data-orientation":a.orientation,role:"tabpanel","aria-labelledby":c,hidden:!g,id:u,tabIndex:0,...i,ref:t,style:{...e.style,animationDuration:m.current?"0s":void 0},children:g&&o})})});pl.displayName=hl;function vl(e,t){return`${e}-trigger-${t}`}function xl(e,t){return`${e}-content-${t}`}var ch=ul,uh=fl,dh=ml,fh=pl;function gh({className:e,...t}){return l.jsx(ch,{"data-slot":"tabs",className:ce("flex flex-col gap-2",e),...t})}function mh({className:e,...t}){return l.jsx(uh,{"data-slot":"tabs-list",className:ce("bg-muted text-muted-foreground inline-flex h-9 w-fit items-center justify-center rounded-lg p-[3px]",e),...t})}function At({className:e,...t}){return l.jsx(dh,{"data-slot":"tabs-trigger",className:ce("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),...t})}function kt({className:e,...t}){return l.jsx(fh,{"data-slot":"tabs-content",className:ce("flex-1 outline-none",e),...t})}var Y;(function(e){e.assertEqual=s=>{};function t(s){}e.assertIs=t;function n(s){throw new Error}e.assertNever=n,e.arrayToEnum=s=>{const o={};for(const i of s)o[i]=i;return o},e.getValidEnumValues=s=>{const o=e.objectKeys(s).filter(a=>typeof s[s[a]]!="number"),i={};for(const a of o)i[a]=s[a];return e.objectValues(i)},e.objectValues=s=>e.objectKeys(s).map(function(o){return s[o]}),e.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{const o=[];for(const i in s)Object.prototype.hasOwnProperty.call(s,i)&&o.push(i);return o},e.find=(s,o)=>{for(const i of s)if(o(i))return i},e.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&Number.isFinite(s)&&Math.floor(s)===s;function r(s,o=" | "){return s.map(i=>typeof i=="string"?`'${i}'`:i).join(o)}e.joinValues=r,e.jsonStringifyReplacer=(s,o)=>typeof o=="bigint"?o.toString():o})(Y||(Y={}));var Ao;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(Ao||(Ao={}));const A=Y.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),st=e=>{switch(typeof e){case"undefined":return A.undefined;case"string":return A.string;case"number":return Number.isNaN(e)?A.nan:A.number;case"boolean":return A.boolean;case"function":return A.function;case"bigint":return A.bigint;case"symbol":return A.symbol;case"object":return Array.isArray(e)?A.array:e===null?A.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?A.promise:typeof Map<"u"&&e instanceof Map?A.map:typeof Set<"u"&&e instanceof Set?A.set:typeof Date<"u"&&e instanceof Date?A.date:A.object;default:return A.unknown}},b=Y.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class tt extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=t}format(t){const n=t||function(o){return o.message},r={_errors:[]},s=o=>{for(const i of o.issues)if(i.code==="invalid_union")i.unionErrors.map(s);else if(i.code==="invalid_return_type")s(i.returnTypeError);else if(i.code==="invalid_arguments")s(i.argumentsError);else if(i.path.length===0)r._errors.push(n(i));else{let a=r,c=0;for(;c<i.path.length;){const u=i.path[c];c===i.path.length-1?(a[u]=a[u]||{_errors:[]},a[u]._errors.push(n(i))):a[u]=a[u]||{_errors:[]},a=a[u],c++}}};return s(this),r}static assert(t){if(!(t instanceof tt))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Y.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=n=>n.message){const n={},r=[];for(const s of this.issues)s.path.length>0?(n[s.path[0]]=n[s.path[0]]||[],n[s.path[0]].push(t(s))):r.push(t(s));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}tt.create=e=>new tt(e);const Jr=(e,t)=>{let n;switch(e.code){case b.invalid_type:e.received===A.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case b.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,Y.jsonStringifyReplacer)}`;break;case b.unrecognized_keys:n=`Unrecognized key(s) in object: ${Y.joinValues(e.keys,", ")}`;break;case b.invalid_union:n="Invalid input";break;case b.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Y.joinValues(e.options)}`;break;case b.invalid_enum_value:n=`Invalid enum value. Expected ${Y.joinValues(e.options)}, received '${e.received}'`;break;case b.invalid_arguments:n="Invalid function arguments";break;case b.invalid_return_type:n="Invalid function return type";break;case b.invalid_date:n="Invalid date";break;case b.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:Y.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case b.too_small:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:n="Invalid input";break;case b.too_big:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?n=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:n="Invalid input";break;case b.custom:n="Invalid input";break;case b.invalid_intersection_types:n="Intersection results could not be merged";break;case b.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case b.not_finite:n="Number must be finite";break;default:n=t.defaultError,Y.assertNever(e)}return{message:n}};let hh=Jr;function ph(){return hh}const vh=e=>{const{data:t,path:n,errorMaps:r,issueData:s}=e,o=[...n,...s.path||[]],i={...s,path:o};if(s.message!==void 0)return{...s,path:o,message:s.message};let a="";const c=r.filter(u=>!!u).slice().reverse();for(const u of c)a=u(i,{data:t,defaultError:a}).message;return{...s,path:o,message:a}};function T(e,t){const n=ph(),r=vh({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===Jr?void 0:Jr].filter(s=>!!s)});e.common.issues.push(r)}class Re{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,n){const r=[];for(const s of n){if(s.status==="aborted")return $;s.status==="dirty"&&t.dirty(),r.push(s.value)}return{status:t.value,value:r}}static async mergeObjectAsync(t,n){const r=[];for(const s of n){const o=await s.key,i=await s.value;r.push({key:o,value:i})}return Re.mergeObjectSync(t,r)}static mergeObjectSync(t,n){const r={};for(const s of n){const{key:o,value:i}=s;if(o.status==="aborted"||i.status==="aborted")return $;o.status==="dirty"&&t.dirty(),i.status==="dirty"&&t.dirty(),o.value!=="__proto__"&&(typeof i.value<"u"||s.alwaysSet)&&(r[o.value]=i.value)}return{status:t.value,value:r}}}const $=Object.freeze({status:"aborted"}),Zt=e=>({status:"dirty",value:e}),Te=e=>({status:"valid",value:e}),ko=e=>e.status==="aborted",Io=e=>e.status==="dirty",$t=e=>e.status==="valid",Fn=e=>typeof Promise<"u"&&e instanceof Promise;var k;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t==null?void 0:t.message})(k||(k={}));class ht{constructor(t,n,r,s){this._cachedPath=[],this.parent=t,this.data=n,this._path=r,this._key=s}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Po=(e,t)=>{if($t(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new tt(e.common.issues);return this._error=n,this._error}}};function B(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:r,description:s}=e;if(t&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:s}:{errorMap:(i,a)=>{const{message:c}=e;return i.code==="invalid_enum_value"?{message:c??a.defaultError}:typeof a.data>"u"?{message:c??r??a.defaultError}:i.code!=="invalid_type"?{message:a.defaultError}:{message:c??n??a.defaultError}},description:s}}class K{get description(){return this._def.description}_getType(t){return st(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:st(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new Re,ctx:{common:t.parent.common,data:t.data,parsedType:st(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const n=this._parse(t);if(Fn(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(t){const n=this._parse(t);return Promise.resolve(n)}parse(t,n){const r=this.safeParse(t,n);if(r.success)return r.data;throw r.error}safeParse(t,n){const r={common:{issues:[],async:(n==null?void 0:n.async)??!1,contextualErrorMap:n==null?void 0:n.errorMap},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:st(t)},s=this._parseSync({data:t,path:r.path,parent:r});return Po(r,s)}"~validate"(t){var r,s;const n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:st(t)};if(!this["~standard"].async)try{const o=this._parseSync({data:t,path:[],parent:n});return $t(o)?{value:o.value}:{issues:n.common.issues}}catch(o){(s=(r=o==null?void 0:o.message)==null?void 0:r.toLowerCase())!=null&&s.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:n}).then(o=>$t(o)?{value:o.value}:{issues:n.common.issues})}async parseAsync(t,n){const r=await this.safeParseAsync(t,n);if(r.success)return r.data;throw r.error}async safeParseAsync(t,n){const r={common:{issues:[],contextualErrorMap:n==null?void 0:n.errorMap,async:!0},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:st(t)},s=this._parse({data:t,path:r.path,parent:r}),o=await(Fn(s)?s:Promise.resolve(s));return Po(r,o)}refine(t,n){const r=s=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(s):n;return this._refinement((s,o)=>{const i=t(s),a=()=>o.addIssue({code:b.custom,...r(s)});return typeof Promise<"u"&&i instanceof Promise?i.then(c=>c?!0:(a(),!1)):i?!0:(a(),!1)})}refinement(t,n){return this._refinement((r,s)=>t(r)?!0:(s.addIssue(typeof n=="function"?n(r,s):n),!1))}_refinement(t){return new Ht({schema:this,typeName:L.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:n=>this["~validate"](n)}}optional(){return ct.create(this,this._def)}nullable(){return zt.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Ve.create(this)}promise(){return Vn.create(this,this._def)}or(t){return $n.create([this,t],this._def)}and(t){return Ln.create(this,t,this._def)}transform(t){return new Ht({...B(this._def),schema:this,typeName:L.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const n=typeof t=="function"?t:()=>t;return new ts({...B(this._def),innerType:this,defaultValue:n,typeName:L.ZodDefault})}brand(){return new Vh({typeName:L.ZodBranded,type:this,...B(this._def)})}catch(t){const n=typeof t=="function"?t:()=>t;return new ns({...B(this._def),innerType:this,catchValue:n,typeName:L.ZodCatch})}describe(t){const n=this.constructor;return new n({...this._def,description:t})}pipe(t){return Hs.create(this,t)}readonly(){return rs.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const xh=/^c[^\s-]{8,}$/i,yh=/^[0-9a-z]+$/,wh=/^[0-9A-HJKMNP-TV-Z]{26}$/i,_h=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Sh=/^[a-z0-9_-]{21}$/i,Ch=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,bh=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Rh=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Eh="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Nr;const Mh=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Nh=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,Th=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,jh=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Ah=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,kh=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,yl="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Ih=new RegExp(`^${yl}$`);function wl(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);const n=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${n}`}function Ph(e){return new RegExp(`^${wl(e)}$`)}function Oh(e){let t=`${yl}T${wl(e)}`;const n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function Fh(e,t){return!!((t==="v4"||!t)&&Mh.test(e)||(t==="v6"||!t)&&Th.test(e))}function Dh(e,t){if(!Ch.test(e))return!1;try{const[n]=e.split("."),r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),s=JSON.parse(atob(r));return!(typeof s!="object"||s===null||"typ"in s&&(s==null?void 0:s.typ)!=="JWT"||!s.alg||t&&s.alg!==t)}catch{return!1}}function $h(e,t){return!!((t==="v4"||!t)&&Nh.test(e)||(t==="v6"||!t)&&jh.test(e))}class at extends K{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==A.string){const o=this._getOrReturnCtx(t);return T(o,{code:b.invalid_type,expected:A.string,received:o.parsedType}),$}const r=new Re;let s;for(const o of this._def.checks)if(o.kind==="min")t.data.length<o.value&&(s=this._getOrReturnCtx(t,s),T(s,{code:b.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),r.dirty());else if(o.kind==="max")t.data.length>o.value&&(s=this._getOrReturnCtx(t,s),T(s,{code:b.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),r.dirty());else if(o.kind==="length"){const i=t.data.length>o.value,a=t.data.length<o.value;(i||a)&&(s=this._getOrReturnCtx(t,s),i?T(s,{code:b.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}):a&&T(s,{code:b.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}),r.dirty())}else if(o.kind==="email")Rh.test(t.data)||(s=this._getOrReturnCtx(t,s),T(s,{validation:"email",code:b.invalid_string,message:o.message}),r.dirty());else if(o.kind==="emoji")Nr||(Nr=new RegExp(Eh,"u")),Nr.test(t.data)||(s=this._getOrReturnCtx(t,s),T(s,{validation:"emoji",code:b.invalid_string,message:o.message}),r.dirty());else if(o.kind==="uuid")_h.test(t.data)||(s=this._getOrReturnCtx(t,s),T(s,{validation:"uuid",code:b.invalid_string,message:o.message}),r.dirty());else if(o.kind==="nanoid")Sh.test(t.data)||(s=this._getOrReturnCtx(t,s),T(s,{validation:"nanoid",code:b.invalid_string,message:o.message}),r.dirty());else if(o.kind==="cuid")xh.test(t.data)||(s=this._getOrReturnCtx(t,s),T(s,{validation:"cuid",code:b.invalid_string,message:o.message}),r.dirty());else if(o.kind==="cuid2")yh.test(t.data)||(s=this._getOrReturnCtx(t,s),T(s,{validation:"cuid2",code:b.invalid_string,message:o.message}),r.dirty());else if(o.kind==="ulid")wh.test(t.data)||(s=this._getOrReturnCtx(t,s),T(s,{validation:"ulid",code:b.invalid_string,message:o.message}),r.dirty());else if(o.kind==="url")try{new URL(t.data)}catch{s=this._getOrReturnCtx(t,s),T(s,{validation:"url",code:b.invalid_string,message:o.message}),r.dirty()}else o.kind==="regex"?(o.regex.lastIndex=0,o.regex.test(t.data)||(s=this._getOrReturnCtx(t,s),T(s,{validation:"regex",code:b.invalid_string,message:o.message}),r.dirty())):o.kind==="trim"?t.data=t.data.trim():o.kind==="includes"?t.data.includes(o.value,o.position)||(s=this._getOrReturnCtx(t,s),T(s,{code:b.invalid_string,validation:{includes:o.value,position:o.position},message:o.message}),r.dirty()):o.kind==="toLowerCase"?t.data=t.data.toLowerCase():o.kind==="toUpperCase"?t.data=t.data.toUpperCase():o.kind==="startsWith"?t.data.startsWith(o.value)||(s=this._getOrReturnCtx(t,s),T(s,{code:b.invalid_string,validation:{startsWith:o.value},message:o.message}),r.dirty()):o.kind==="endsWith"?t.data.endsWith(o.value)||(s=this._getOrReturnCtx(t,s),T(s,{code:b.invalid_string,validation:{endsWith:o.value},message:o.message}),r.dirty()):o.kind==="datetime"?Oh(o).test(t.data)||(s=this._getOrReturnCtx(t,s),T(s,{code:b.invalid_string,validation:"datetime",message:o.message}),r.dirty()):o.kind==="date"?Ih.test(t.data)||(s=this._getOrReturnCtx(t,s),T(s,{code:b.invalid_string,validation:"date",message:o.message}),r.dirty()):o.kind==="time"?Ph(o).test(t.data)||(s=this._getOrReturnCtx(t,s),T(s,{code:b.invalid_string,validation:"time",message:o.message}),r.dirty()):o.kind==="duration"?bh.test(t.data)||(s=this._getOrReturnCtx(t,s),T(s,{validation:"duration",code:b.invalid_string,message:o.message}),r.dirty()):o.kind==="ip"?Fh(t.data,o.version)||(s=this._getOrReturnCtx(t,s),T(s,{validation:"ip",code:b.invalid_string,message:o.message}),r.dirty()):o.kind==="jwt"?Dh(t.data,o.alg)||(s=this._getOrReturnCtx(t,s),T(s,{validation:"jwt",code:b.invalid_string,message:o.message}),r.dirty()):o.kind==="cidr"?$h(t.data,o.version)||(s=this._getOrReturnCtx(t,s),T(s,{validation:"cidr",code:b.invalid_string,message:o.message}),r.dirty()):o.kind==="base64"?Ah.test(t.data)||(s=this._getOrReturnCtx(t,s),T(s,{validation:"base64",code:b.invalid_string,message:o.message}),r.dirty()):o.kind==="base64url"?kh.test(t.data)||(s=this._getOrReturnCtx(t,s),T(s,{validation:"base64url",code:b.invalid_string,message:o.message}),r.dirty()):Y.assertNever(o);return{status:r.value,value:t.data}}_regex(t,n,r){return this.refinement(s=>t.test(s),{validation:n,code:b.invalid_string,...k.errToObj(r)})}_addCheck(t){return new at({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...k.errToObj(t)})}url(t){return this._addCheck({kind:"url",...k.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...k.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...k.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...k.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...k.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...k.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...k.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...k.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...k.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...k.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...k.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...k.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,offset:(t==null?void 0:t.offset)??!1,local:(t==null?void 0:t.local)??!1,...k.errToObj(t==null?void 0:t.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,...k.errToObj(t==null?void 0:t.message)})}duration(t){return this._addCheck({kind:"duration",...k.errToObj(t)})}regex(t,n){return this._addCheck({kind:"regex",regex:t,...k.errToObj(n)})}includes(t,n){return this._addCheck({kind:"includes",value:t,position:n==null?void 0:n.position,...k.errToObj(n==null?void 0:n.message)})}startsWith(t,n){return this._addCheck({kind:"startsWith",value:t,...k.errToObj(n)})}endsWith(t,n){return this._addCheck({kind:"endsWith",value:t,...k.errToObj(n)})}min(t,n){return this._addCheck({kind:"min",value:t,...k.errToObj(n)})}max(t,n){return this._addCheck({kind:"max",value:t,...k.errToObj(n)})}length(t,n){return this._addCheck({kind:"length",value:t,...k.errToObj(n)})}nonempty(t){return this.min(1,k.errToObj(t))}trim(){return new at({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new at({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new at({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxLength(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}}at.create=e=>new at({checks:[],typeName:L.ZodString,coerce:(e==null?void 0:e.coerce)??!1,...B(e)});function Lh(e,t){const n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,s=n>r?n:r,o=Number.parseInt(e.toFixed(s).replace(".","")),i=Number.parseInt(t.toFixed(s).replace(".",""));return o%i/10**s}class Lt extends K{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==A.number){const o=this._getOrReturnCtx(t);return T(o,{code:b.invalid_type,expected:A.number,received:o.parsedType}),$}let r;const s=new Re;for(const o of this._def.checks)o.kind==="int"?Y.isInteger(t.data)||(r=this._getOrReturnCtx(t,r),T(r,{code:b.invalid_type,expected:"integer",received:"float",message:o.message}),s.dirty()):o.kind==="min"?(o.inclusive?t.data<o.value:t.data<=o.value)&&(r=this._getOrReturnCtx(t,r),T(r,{code:b.too_small,minimum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),s.dirty()):o.kind==="max"?(o.inclusive?t.data>o.value:t.data>=o.value)&&(r=this._getOrReturnCtx(t,r),T(r,{code:b.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),s.dirty()):o.kind==="multipleOf"?Lh(t.data,o.value)!==0&&(r=this._getOrReturnCtx(t,r),T(r,{code:b.not_multiple_of,multipleOf:o.value,message:o.message}),s.dirty()):o.kind==="finite"?Number.isFinite(t.data)||(r=this._getOrReturnCtx(t,r),T(r,{code:b.not_finite,message:o.message}),s.dirty()):Y.assertNever(o);return{status:s.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,k.toString(n))}gt(t,n){return this.setLimit("min",t,!1,k.toString(n))}lte(t,n){return this.setLimit("max",t,!0,k.toString(n))}lt(t,n){return this.setLimit("max",t,!1,k.toString(n))}setLimit(t,n,r,s){return new Lt({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:k.toString(s)}]})}_addCheck(t){return new Lt({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:k.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:k.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:k.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:k.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:k.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:k.toString(n)})}finite(t){return this._addCheck({kind:"finite",message:k.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:k.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:k.toString(t)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&Y.isInteger(t.value))}get isFinite(){let t=null,n=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(t===null||r.value<t)&&(t=r.value)}return Number.isFinite(n)&&Number.isFinite(t)}}Lt.create=e=>new Lt({checks:[],typeName:L.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1,...B(e)});class nn extends K{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==A.bigint)return this._getInvalidInput(t);let r;const s=new Re;for(const o of this._def.checks)o.kind==="min"?(o.inclusive?t.data<o.value:t.data<=o.value)&&(r=this._getOrReturnCtx(t,r),T(r,{code:b.too_small,type:"bigint",minimum:o.value,inclusive:o.inclusive,message:o.message}),s.dirty()):o.kind==="max"?(o.inclusive?t.data>o.value:t.data>=o.value)&&(r=this._getOrReturnCtx(t,r),T(r,{code:b.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),s.dirty()):o.kind==="multipleOf"?t.data%o.value!==BigInt(0)&&(r=this._getOrReturnCtx(t,r),T(r,{code:b.not_multiple_of,multipleOf:o.value,message:o.message}),s.dirty()):Y.assertNever(o);return{status:s.value,value:t.data}}_getInvalidInput(t){const n=this._getOrReturnCtx(t);return T(n,{code:b.invalid_type,expected:A.bigint,received:n.parsedType}),$}gte(t,n){return this.setLimit("min",t,!0,k.toString(n))}gt(t,n){return this.setLimit("min",t,!1,k.toString(n))}lte(t,n){return this.setLimit("max",t,!0,k.toString(n))}lt(t,n){return this.setLimit("max",t,!1,k.toString(n))}setLimit(t,n,r,s){return new nn({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:k.toString(s)}]})}_addCheck(t){return new nn({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:k.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:k.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:k.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:k.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:k.toString(n)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}}nn.create=e=>new nn({checks:[],typeName:L.ZodBigInt,coerce:(e==null?void 0:e.coerce)??!1,...B(e)});class Qr extends K{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==A.boolean){const r=this._getOrReturnCtx(t);return T(r,{code:b.invalid_type,expected:A.boolean,received:r.parsedType}),$}return Te(t.data)}}Qr.create=e=>new Qr({typeName:L.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1,...B(e)});class Dn extends K{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==A.date){const o=this._getOrReturnCtx(t);return T(o,{code:b.invalid_type,expected:A.date,received:o.parsedType}),$}if(Number.isNaN(t.data.getTime())){const o=this._getOrReturnCtx(t);return T(o,{code:b.invalid_date}),$}const r=new Re;let s;for(const o of this._def.checks)o.kind==="min"?t.data.getTime()<o.value&&(s=this._getOrReturnCtx(t,s),T(s,{code:b.too_small,message:o.message,inclusive:!0,exact:!1,minimum:o.value,type:"date"}),r.dirty()):o.kind==="max"?t.data.getTime()>o.value&&(s=this._getOrReturnCtx(t,s),T(s,{code:b.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),r.dirty()):Y.assertNever(o);return{status:r.value,value:new Date(t.data.getTime())}}_addCheck(t){return new Dn({...this._def,checks:[...this._def.checks,t]})}min(t,n){return this._addCheck({kind:"min",value:t.getTime(),message:k.toString(n)})}max(t,n){return this._addCheck({kind:"max",value:t.getTime(),message:k.toString(n)})}get minDate(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t!=null?new Date(t):null}}Dn.create=e=>new Dn({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:L.ZodDate,...B(e)});class Oo extends K{_parse(t){if(this._getType(t)!==A.symbol){const r=this._getOrReturnCtx(t);return T(r,{code:b.invalid_type,expected:A.symbol,received:r.parsedType}),$}return Te(t.data)}}Oo.create=e=>new Oo({typeName:L.ZodSymbol,...B(e)});class Fo extends K{_parse(t){if(this._getType(t)!==A.undefined){const r=this._getOrReturnCtx(t);return T(r,{code:b.invalid_type,expected:A.undefined,received:r.parsedType}),$}return Te(t.data)}}Fo.create=e=>new Fo({typeName:L.ZodUndefined,...B(e)});class Do extends K{_parse(t){if(this._getType(t)!==A.null){const r=this._getOrReturnCtx(t);return T(r,{code:b.invalid_type,expected:A.null,received:r.parsedType}),$}return Te(t.data)}}Do.create=e=>new Do({typeName:L.ZodNull,...B(e)});class $o extends K{constructor(){super(...arguments),this._any=!0}_parse(t){return Te(t.data)}}$o.create=e=>new $o({typeName:L.ZodAny,...B(e)});class Lo extends K{constructor(){super(...arguments),this._unknown=!0}_parse(t){return Te(t.data)}}Lo.create=e=>new Lo({typeName:L.ZodUnknown,...B(e)});class pt extends K{_parse(t){const n=this._getOrReturnCtx(t);return T(n,{code:b.invalid_type,expected:A.never,received:n.parsedType}),$}}pt.create=e=>new pt({typeName:L.ZodNever,...B(e)});class Vo extends K{_parse(t){if(this._getType(t)!==A.undefined){const r=this._getOrReturnCtx(t);return T(r,{code:b.invalid_type,expected:A.void,received:r.parsedType}),$}return Te(t.data)}}Vo.create=e=>new Vo({typeName:L.ZodVoid,...B(e)});class Ve extends K{_parse(t){const{ctx:n,status:r}=this._processInputParams(t),s=this._def;if(n.parsedType!==A.array)return T(n,{code:b.invalid_type,expected:A.array,received:n.parsedType}),$;if(s.exactLength!==null){const i=n.data.length>s.exactLength.value,a=n.data.length<s.exactLength.value;(i||a)&&(T(n,{code:i?b.too_big:b.too_small,minimum:a?s.exactLength.value:void 0,maximum:i?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),r.dirty())}if(s.minLength!==null&&n.data.length<s.minLength.value&&(T(n,{code:b.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),r.dirty()),s.maxLength!==null&&n.data.length>s.maxLength.value&&(T(n,{code:b.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((i,a)=>s.type._parseAsync(new ht(n,i,n.path,a)))).then(i=>Re.mergeArray(r,i));const o=[...n.data].map((i,a)=>s.type._parseSync(new ht(n,i,n.path,a)));return Re.mergeArray(r,o)}get element(){return this._def.type}min(t,n){return new Ve({...this._def,minLength:{value:t,message:k.toString(n)}})}max(t,n){return new Ve({...this._def,maxLength:{value:t,message:k.toString(n)}})}length(t,n){return new Ve({...this._def,exactLength:{value:t,message:k.toString(n)}})}nonempty(t){return this.min(1,t)}}Ve.create=(e,t)=>new Ve({type:e,minLength:null,maxLength:null,exactLength:null,typeName:L.ZodArray,...B(t)});function It(e){if(e instanceof le){const t={};for(const n in e.shape){const r=e.shape[n];t[n]=ct.create(It(r))}return new le({...e._def,shape:()=>t})}else return e instanceof Ve?new Ve({...e._def,type:It(e.element)}):e instanceof ct?ct.create(It(e.unwrap())):e instanceof zt?zt.create(It(e.unwrap())):e instanceof _t?_t.create(e.items.map(t=>It(t))):e}class le extends K{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const t=this._def.shape(),n=Y.objectKeys(t);return this._cached={shape:t,keys:n},this._cached}_parse(t){if(this._getType(t)!==A.object){const u=this._getOrReturnCtx(t);return T(u,{code:b.invalid_type,expected:A.object,received:u.parsedType}),$}const{status:r,ctx:s}=this._processInputParams(t),{shape:o,keys:i}=this._getCached(),a=[];if(!(this._def.catchall instanceof pt&&this._def.unknownKeys==="strip"))for(const u in s.data)i.includes(u)||a.push(u);const c=[];for(const u of i){const f=o[u],m=s.data[u];c.push({key:{status:"valid",value:u},value:f._parse(new ht(s,m,s.path,u)),alwaysSet:u in s.data})}if(this._def.catchall instanceof pt){const u=this._def.unknownKeys;if(u==="passthrough")for(const f of a)c.push({key:{status:"valid",value:f},value:{status:"valid",value:s.data[f]}});else if(u==="strict")a.length>0&&(T(s,{code:b.unrecognized_keys,keys:a}),r.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const u=this._def.catchall;for(const f of a){const m=s.data[f];c.push({key:{status:"valid",value:f},value:u._parse(new ht(s,m,s.path,f)),alwaysSet:f in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const u=[];for(const f of c){const m=await f.key,g=await f.value;u.push({key:m,value:g,alwaysSet:f.alwaysSet})}return u}).then(u=>Re.mergeObjectSync(r,u)):Re.mergeObjectSync(r,c)}get shape(){return this._def.shape()}strict(t){return k.errToObj,new le({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(n,r)=>{var o,i;const s=((i=(o=this._def).errorMap)==null?void 0:i.call(o,n,r).message)??r.defaultError;return n.code==="unrecognized_keys"?{message:k.errToObj(t).message??s}:{message:s}}}:{}})}strip(){return new le({...this._def,unknownKeys:"strip"})}passthrough(){return new le({...this._def,unknownKeys:"passthrough"})}extend(t){return new le({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new le({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:L.ZodObject})}setKey(t,n){return this.augment({[t]:n})}catchall(t){return new le({...this._def,catchall:t})}pick(t){const n={};for(const r of Y.objectKeys(t))t[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new le({...this._def,shape:()=>n})}omit(t){const n={};for(const r of Y.objectKeys(this.shape))t[r]||(n[r]=this.shape[r]);return new le({...this._def,shape:()=>n})}deepPartial(){return It(this)}partial(t){const n={};for(const r of Y.objectKeys(this.shape)){const s=this.shape[r];t&&!t[r]?n[r]=s:n[r]=s.optional()}return new le({...this._def,shape:()=>n})}required(t){const n={};for(const r of Y.objectKeys(this.shape))if(t&&!t[r])n[r]=this.shape[r];else{let o=this.shape[r];for(;o instanceof ct;)o=o._def.innerType;n[r]=o}return new le({...this._def,shape:()=>n})}keyof(){return _l(Y.objectKeys(this.shape))}}le.create=(e,t)=>new le({shape:()=>e,unknownKeys:"strip",catchall:pt.create(),typeName:L.ZodObject,...B(t)});le.strictCreate=(e,t)=>new le({shape:()=>e,unknownKeys:"strict",catchall:pt.create(),typeName:L.ZodObject,...B(t)});le.lazycreate=(e,t)=>new le({shape:e,unknownKeys:"strip",catchall:pt.create(),typeName:L.ZodObject,...B(t)});class $n extends K{_parse(t){const{ctx:n}=this._processInputParams(t),r=this._def.options;function s(o){for(const a of o)if(a.result.status==="valid")return a.result;for(const a of o)if(a.result.status==="dirty")return n.common.issues.push(...a.ctx.common.issues),a.result;const i=o.map(a=>new tt(a.ctx.common.issues));return T(n,{code:b.invalid_union,unionErrors:i}),$}if(n.common.async)return Promise.all(r.map(async o=>{const i={...n,common:{...n.common,issues:[]},parent:null};return{result:await o._parseAsync({data:n.data,path:n.path,parent:i}),ctx:i}})).then(s);{let o;const i=[];for(const c of r){const u={...n,common:{...n.common,issues:[]},parent:null},f=c._parseSync({data:n.data,path:n.path,parent:u});if(f.status==="valid")return f;f.status==="dirty"&&!o&&(o={result:f,ctx:u}),u.common.issues.length&&i.push(u.common.issues)}if(o)return n.common.issues.push(...o.ctx.common.issues),o.result;const a=i.map(c=>new tt(c));return T(n,{code:b.invalid_union,unionErrors:a}),$}}get options(){return this._def.options}}$n.create=(e,t)=>new $n({options:e,typeName:L.ZodUnion,...B(t)});function es(e,t){const n=st(e),r=st(t);if(e===t)return{valid:!0,data:e};if(n===A.object&&r===A.object){const s=Y.objectKeys(t),o=Y.objectKeys(e).filter(a=>s.indexOf(a)!==-1),i={...e,...t};for(const a of o){const c=es(e[a],t[a]);if(!c.valid)return{valid:!1};i[a]=c.data}return{valid:!0,data:i}}else if(n===A.array&&r===A.array){if(e.length!==t.length)return{valid:!1};const s=[];for(let o=0;o<e.length;o++){const i=e[o],a=t[o],c=es(i,a);if(!c.valid)return{valid:!1};s.push(c.data)}return{valid:!0,data:s}}else return n===A.date&&r===A.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class Ln extends K{_parse(t){const{status:n,ctx:r}=this._processInputParams(t),s=(o,i)=>{if(ko(o)||ko(i))return $;const a=es(o.value,i.value);return a.valid?((Io(o)||Io(i))&&n.dirty(),{status:n.value,value:a.data}):(T(r,{code:b.invalid_intersection_types}),$)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([o,i])=>s(o,i)):s(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}Ln.create=(e,t,n)=>new Ln({left:e,right:t,typeName:L.ZodIntersection,...B(n)});class _t extends K{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==A.array)return T(r,{code:b.invalid_type,expected:A.array,received:r.parsedType}),$;if(r.data.length<this._def.items.length)return T(r,{code:b.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),$;!this._def.rest&&r.data.length>this._def.items.length&&(T(r,{code:b.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const o=[...r.data].map((i,a)=>{const c=this._def.items[a]||this._def.rest;return c?c._parse(new ht(r,i,r.path,a)):null}).filter(i=>!!i);return r.common.async?Promise.all(o).then(i=>Re.mergeArray(n,i)):Re.mergeArray(n,o)}get items(){return this._def.items}rest(t){return new _t({...this._def,rest:t})}}_t.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new _t({items:e,typeName:L.ZodTuple,rest:null,...B(t)})};class Ho extends K{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==A.map)return T(r,{code:b.invalid_type,expected:A.map,received:r.parsedType}),$;const s=this._def.keyType,o=this._def.valueType,i=[...r.data.entries()].map(([a,c],u)=>({key:s._parse(new ht(r,a,r.path,[u,"key"])),value:o._parse(new ht(r,c,r.path,[u,"value"]))}));if(r.common.async){const a=new Map;return Promise.resolve().then(async()=>{for(const c of i){const u=await c.key,f=await c.value;if(u.status==="aborted"||f.status==="aborted")return $;(u.status==="dirty"||f.status==="dirty")&&n.dirty(),a.set(u.value,f.value)}return{status:n.value,value:a}})}else{const a=new Map;for(const c of i){const u=c.key,f=c.value;if(u.status==="aborted"||f.status==="aborted")return $;(u.status==="dirty"||f.status==="dirty")&&n.dirty(),a.set(u.value,f.value)}return{status:n.value,value:a}}}}Ho.create=(e,t,n)=>new Ho({valueType:t,keyType:e,typeName:L.ZodMap,...B(n)});class rn extends K{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==A.set)return T(r,{code:b.invalid_type,expected:A.set,received:r.parsedType}),$;const s=this._def;s.minSize!==null&&r.data.size<s.minSize.value&&(T(r,{code:b.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),n.dirty()),s.maxSize!==null&&r.data.size>s.maxSize.value&&(T(r,{code:b.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),n.dirty());const o=this._def.valueType;function i(c){const u=new Set;for(const f of c){if(f.status==="aborted")return $;f.status==="dirty"&&n.dirty(),u.add(f.value)}return{status:n.value,value:u}}const a=[...r.data.values()].map((c,u)=>o._parse(new ht(r,c,r.path,u)));return r.common.async?Promise.all(a).then(c=>i(c)):i(a)}min(t,n){return new rn({...this._def,minSize:{value:t,message:k.toString(n)}})}max(t,n){return new rn({...this._def,maxSize:{value:t,message:k.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}}rn.create=(e,t)=>new rn({valueType:e,minSize:null,maxSize:null,typeName:L.ZodSet,...B(t)});class zo extends K{get schema(){return this._def.getter()}_parse(t){const{ctx:n}=this._processInputParams(t);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}zo.create=(e,t)=>new zo({getter:e,typeName:L.ZodLazy,...B(t)});class Go extends K{_parse(t){if(t.data!==this._def.value){const n=this._getOrReturnCtx(t);return T(n,{received:n.data,code:b.invalid_literal,expected:this._def.value}),$}return{status:"valid",value:t.data}}get value(){return this._def.value}}Go.create=(e,t)=>new Go({value:e,typeName:L.ZodLiteral,...B(t)});function _l(e,t){return new Vt({values:e,typeName:L.ZodEnum,...B(t)})}class Vt extends K{_parse(t){if(typeof t.data!="string"){const n=this._getOrReturnCtx(t),r=this._def.values;return T(n,{expected:Y.joinValues(r),received:n.parsedType,code:b.invalid_type}),$}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){const n=this._getOrReturnCtx(t),r=this._def.values;return T(n,{received:n.data,code:b.invalid_enum_value,options:r}),$}return Te(t.data)}get options(){return this._def.values}get enum(){const t={};for(const n of this._def.values)t[n]=n;return t}get Values(){const t={};for(const n of this._def.values)t[n]=n;return t}get Enum(){const t={};for(const n of this._def.values)t[n]=n;return t}extract(t,n=this._def){return Vt.create(t,{...this._def,...n})}exclude(t,n=this._def){return Vt.create(this.options.filter(r=>!t.includes(r)),{...this._def,...n})}}Vt.create=_l;class Bo extends K{_parse(t){const n=Y.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==A.string&&r.parsedType!==A.number){const s=Y.objectValues(n);return T(r,{expected:Y.joinValues(s),received:r.parsedType,code:b.invalid_type}),$}if(this._cache||(this._cache=new Set(Y.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){const s=Y.objectValues(n);return T(r,{received:r.data,code:b.invalid_enum_value,options:s}),$}return Te(t.data)}get enum(){return this._def.values}}Bo.create=(e,t)=>new Bo({values:e,typeName:L.ZodNativeEnum,...B(t)});class Vn extends K{unwrap(){return this._def.type}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==A.promise&&n.common.async===!1)return T(n,{code:b.invalid_type,expected:A.promise,received:n.parsedType}),$;const r=n.parsedType===A.promise?n.data:Promise.resolve(n.data);return Te(r.then(s=>this._def.type.parseAsync(s,{path:n.path,errorMap:n.common.contextualErrorMap})))}}Vn.create=(e,t)=>new Vn({type:e,typeName:L.ZodPromise,...B(t)});class Ht extends K{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===L.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:n,ctx:r}=this._processInputParams(t),s=this._def.effect||null,o={addIssue:i=>{T(r,i),i.fatal?n.abort():n.dirty()},get path(){return r.path}};if(o.addIssue=o.addIssue.bind(o),s.type==="preprocess"){const i=s.transform(r.data,o);if(r.common.async)return Promise.resolve(i).then(async a=>{if(n.value==="aborted")return $;const c=await this._def.schema._parseAsync({data:a,path:r.path,parent:r});return c.status==="aborted"?$:c.status==="dirty"||n.value==="dirty"?Zt(c.value):c});{if(n.value==="aborted")return $;const a=this._def.schema._parseSync({data:i,path:r.path,parent:r});return a.status==="aborted"?$:a.status==="dirty"||n.value==="dirty"?Zt(a.value):a}}if(s.type==="refinement"){const i=a=>{const c=s.refinement(a,o);if(r.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(r.common.async===!1){const a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?$:(a.status==="dirty"&&n.dirty(),i(a.value),{status:n.value,value:a.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(a=>a.status==="aborted"?$:(a.status==="dirty"&&n.dirty(),i(a.value).then(()=>({status:n.value,value:a.value}))))}if(s.type==="transform")if(r.common.async===!1){const i=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!$t(i))return $;const a=s.transform(i.value,o);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:a}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(i=>$t(i)?Promise.resolve(s.transform(i.value,o)).then(a=>({status:n.value,value:a})):$);Y.assertNever(s)}}Ht.create=(e,t,n)=>new Ht({schema:e,typeName:L.ZodEffects,effect:t,...B(n)});Ht.createWithPreprocess=(e,t,n)=>new Ht({schema:t,effect:{type:"preprocess",transform:e},typeName:L.ZodEffects,...B(n)});class ct extends K{_parse(t){return this._getType(t)===A.undefined?Te(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}ct.create=(e,t)=>new ct({innerType:e,typeName:L.ZodOptional,...B(t)});class zt extends K{_parse(t){return this._getType(t)===A.null?Te(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}zt.create=(e,t)=>new zt({innerType:e,typeName:L.ZodNullable,...B(t)});class ts extends K{_parse(t){const{ctx:n}=this._processInputParams(t);let r=n.data;return n.parsedType===A.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}ts.create=(e,t)=>new ts({innerType:e,typeName:L.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...B(t)});class ns extends K{_parse(t){const{ctx:n}=this._processInputParams(t),r={...n,common:{...n.common,issues:[]}},s=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return Fn(s)?s.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new tt(r.common.issues)},input:r.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new tt(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}ns.create=(e,t)=>new ns({innerType:e,typeName:L.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...B(t)});class Uo extends K{_parse(t){if(this._getType(t)!==A.nan){const r=this._getOrReturnCtx(t);return T(r,{code:b.invalid_type,expected:A.nan,received:r.parsedType}),$}return{status:"valid",value:t.data}}}Uo.create=e=>new Uo({typeName:L.ZodNaN,...B(e)});class Vh extends K{_parse(t){const{ctx:n}=this._processInputParams(t),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}}class Hs extends K{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.common.async)return(async()=>{const o=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?$:o.status==="dirty"?(n.dirty(),Zt(o.value)):this._def.out._parseAsync({data:o.value,path:r.path,parent:r})})();{const s=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?$:s.status==="dirty"?(n.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:r.path,parent:r})}}static create(t,n){return new Hs({in:t,out:n,typeName:L.ZodPipeline})}}class rs extends K{_parse(t){const n=this._def.innerType._parse(t),r=s=>($t(s)&&(s.value=Object.freeze(s.value)),s);return Fn(n)?n.then(s=>r(s)):r(n)}unwrap(){return this._def.innerType}}rs.create=(e,t)=>new rs({innerType:e,typeName:L.ZodReadonly,...B(t)});var L;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(L||(L={}));const ie=at.create,un=Lt.create,zs=Qr.create;pt.create;const Hh=Ve.create,fe=le.create;$n.create;Ln.create;_t.create;const dn=Vt.create;Vn.create;ct.create;zt.create;const zh=10,ss={name:"space_search",description:"Find Hugging Face Spaces using semantic search. Include links to the Space when presenting the results.",schema:fe({query:ie().min(1,"Query is required").max(100,"Query too long").describe("Semantic Search Query"),limit:un().optional().default(zh).describe("Number of results to return"),mcp:zs().optional().default(!1).describe("Only return MCP Server enabled Spaces")}),annotations:{title:"Hugging Face Space Search"}},os={name:"model_search",description:"Find Machine Learning models hosted on Hugging Face. Returns comprehensive information about matching models including downloads, likes, tags, and direct links. Include links to the models in your response",schema:fe({query:ie().optional().describe('Search term. Leave blank and specify "sort" and "limit" to get e.g. "Top 20 trending models", "Top 10 most recent models" etc" '),author:ie().optional().describe("Organization or user who created the model (e.g., 'google', 'meta-llama', 'microsoft')"),task:ie().optional().describe("Model task type (e.g., 'text-generation', 'image-classification', 'translation')"),library:ie().optional().describe("Framework the model uses (e.g., 'transformers', 'diffusers', 'timm')"),sort:dn(["trendingScore","downloads","likes","createdAt","lastModified"]).optional().describe("Sort order: trendingScore, downloads , likes, createdAt, lastModified"),limit:un().min(1).max(100).optional().default(20).describe("Maximum number of results to return")}),annotations:{title:"Model Search"}};new Promise(e=>{});var Tr=65536;Gh();function Gh(){try{return new Uint32Array(Tr)}catch{const t=new Array(Tr);for(let n=0;n<Tr;n++)t[n]=0;return t}}const is={name:"model_details",description:"Get detailed information about a model from the Hugging Face Hub. Include relevant links in result summaries.",schema:fe({model_id:ie().min(1,"Model ID is required").describe("The Model ID in author/model format (e.g., microsoft/DialoGPT-large)")}),annotations:{title:"Model Details"}};fe({model_id:ie().min(5,"Model ID is required").max(50).describe("The Model ID in author/model format (e.g. 'openai/gpt-oss-120b')")});const as={name:"paper_search",description:"Find Machine Learning research papers on the Hugging Face hub. Include 'Link to paper' When presenting the results. Consider whether tabulating results matches user intent.",schema:fe({query:ie().min(3,"Supply at least one search term").max(200,"Query too long").describe("Semantic Search query"),results_limit:un().optional().default(12).describe("Number of results to return"),concise_only:zs().optional().default(!1).describe("Return a 2 sentence summary of the abstract. Use for broad search terms which may return a lot of results. Check with User if unsure.")}),annotations:{title:"Paper Search"}},ls={name:"dataset_search",description:"Find Datasets hosted on the Hugging Face hub. Returns comprehensive information about matching datasets including downloads, likes, tags, and direct links. Include links to the datasets in your response",schema:fe({query:ie().optional().describe('Search term. Leave blank and specify "sort" and "limit" to get e.g. "Top 20 trending datasets", "Top 10 most recent datasets" etc" '),author:ie().optional().describe("Organization or user who created the dataset (e.g., 'google', 'facebook', 'allenai')"),tags:Hh(ie()).optional().describe("Tags to filter datasets (e.g., ['language:en', 'size_categories:1M<n<10M', 'task_categories:text-classification'])"),sort:dn(["trendingScore","downloads","likes","createdAt","lastModified"]).optional().describe("Sort order: trendingScore, downloads, likes, createdAt, lastModified"),limit:un().min(1).max(100).optional().default(20).describe("Maximum number of results to return")}),annotations:{title:"Dataset Search"}},cs={name:"dataset_details",description:"Get detailed information about a specific dataset on Hugging Face Hub.",schema:fe({dataset_id:ie().min(5,"Dataset ID is required").describe("The Dataset ID (e.g. Anthropic/hh-rlhf, squad)")}),annotations:{title:"Dataset Details"}};fe({dataset_id:ie().min(3,"Dataset ID is required").max(100).describe("The Dataset ID (e.g. 'Anthropic/hh-rlhf', 'squad')")});const Sl={name:"duplicate_space",schema:fe({sourceSpaceId:ie().min(1).describe("Space ID to copy (e.g., 'username/space-name')"),newSpaceId:ie().optional().describe("Name for the new space (optional, defaults to source space-name)"),hardware:dn(["freecpu","zerogpu"]).optional().describe('Either "freecpu" or "zerogpu" (defaults based on source). Both options are in the free tier.'),private:zs().optional().default(!0).describe("Check with User whether the new space should be public or private.")}),annotations:{title:"Duplicate Hugging Face Space"}},Cl={name:"space_info",schema:fe({username:ie().optional().describe("Username to get spaces for (defaults to authenticated user)")}),annotations:{title:"Hugging Face Spaces Information"}},bl={name:"space_files",schema:fe({spaceName:ie().optional().describe('Space identifier in format "username/spacename"'),fileType:dn(["all","image","audio"]).optional().default("all").describe("Filter files by type: all (default), image, or audio files only")}),annotations:{title:"Space Files List"}};fe({fileType:dn(["all","image","audio","text"]).optional().default("all").describe("Filter by type")});fe({});fe({user_id:ie().min(3,"User ID must be at least 3 characters long").describe('Hugging Face user ID or URL (e.g., "evalstate" or "hf.co/evalstate")').max(60).describe("Maximum length is 30 characters")});fe({paper_id:ie().min(1,"Paper ID is required").describe('arXiv paper ID in various formats (e.g., "2502.16161", "arxiv:2502.16161", or full URL)').max(60).describe("Maximum length is 100 characters")});var Gs=typeof window<"u"?window:{};function Bh(){var e=Gs.DOMParser,t=!1;try{new e().parseFromString("","text/html")&&(t=!0)}catch{}return t}function Uh(){var e=function(){};return Wh()?e.prototype.parseFromString=function(t){var n=new window.ActiveXObject("htmlfile");return n.designMode="on",n.open(),n.write(t),n.close(),n}:e.prototype.parseFromString=function(t){var n=document.implementation.createHTMLDocument("");return n.open(),n.write(t),n.close(),n},e}function Wh(){var e=!1;try{document.implementation.createHTMLDocument("").open()}catch{Gs.ActiveXObject&&(e=!0)}return e}Bh()?Gs.DOMParser:Uh();const us={name:"hf_doc_fetch",description:"Fetch a document from the Hugging Face documentation library. For large documents, use offset to get subsequent chunks.",schema:fe({doc_url:ie().min(28,"Url should start with https://huggingface.co/docs/").max(200,"Query too long").describe("Hugging Face documentation URL"),offset:un().min(0).optional().describe("Token offset for large documents (use the offset from truncation message)")}),annotations:{title:"Fetch a document from the Hugging Face library"}},ds={name:"hf_doc_search",description:"Search documentation about all of Hugging Face products and libraries (Transformers, Datasets, Diffusers, Gradio, Hub, and more). Use this for the most up-to-date information Returns excerpts grouped by Product and Document.",schema:fe({query:ie().min(3,"Supply at least one search term").max(200,"Query too long").describe("Semantic search query"),product:ie().optional().describe('Filter by Product (e.g., "hub", "dataset-viewer", "transformers"). Supply when known for focused results')}),annotations:{title:"Hugging Face Documentation Library Search"}},Wo=ss.name,qo=os.name,Zo=is.name,Ko=as.name,Xo=ls.name,Yo=cs.name,Jo=Sl.name,Qo=Cl.name,ei=bl.name,ti=ds.name,ni=us.name,jr=e=>fetch(e).then(t=>{if(!t.ok)throw new Error(`Failed to fetch: ${t.status}`);return t.json()});function qh(){var M,E,N,H,F,q,X,z,U,te,W;const{data:e,error:t}=Kt("/api/transport",jr,{refreshInterval:3e3,revalidateOnFocus:!0,revalidateOnReconnect:!0});Kt("/api/sessions",jr,{refreshInterval:3e3,revalidateOnFocus:!0});const{data:n}=Kt("/api/settings",jr),[r,s]=p.useState(["","",""]),[o,i]=p.useState(["","",""]),[a,c]=p.useState([!1,!1,!1]),[u,f]=p.useState(!1);p.useEffect(()=>{if(n!=null&&n.spaceTools&&!u){const D=["","",""],j=["","",""],R=[!1,!1,!1];n.spaceTools.forEach((V,Q)=>{Q<3&&(D[Q]=V.name,j[Q]=V.subdomain,R[Q]=!0)}),s(D),i(j),c(R),f(!0)}},[n,u]);const m=!e&&!t,g=t?t.message:null,d=async(D,j)=>{try{const R=n||{builtInTools:[]},V=R.builtInTools,Q=j?[...V.filter(we=>we!==D),D]:V.filter(we=>we!==D),ae={...R,builtInTools:Q};bn("/api/settings",ae,!1);const ye=await fetch("/api/settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({builtInTools:Q})});if(!ye.ok)throw new Error(`Failed to update tool settings: ${ye.status}`);bn("/api/settings"),console.log(`${D} is now ${j?"enabled":"disabled"}`)}catch(R){console.error("Error updating tool settings:",R),alert(`Error updating ${D}: ${R instanceof Error?R.message:"Unknown error"}`),bn("/api/settings")}},v=async(D,j)=>{const R=[...a];R[D]=j,c(R),await x(R)},h=async(D,j)=>{const R=[...r];R[D]=j,s(R),a[D]&&await x(a)},y=async(D,j)=>{const R=[...o];R[D]=j,i(R),a[D]&&await x(a)},x=async D=>{try{const j=[];for(let V=0;V<3;V++)D[V]&&r[V]&&o[V]&&j.push({_id:`space-${V}`,name:r[V],subdomain:o[V],emoji:"🔧"});const R=await fetch("/api/settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({spaceTools:j})});if(!R.ok)throw new Error(`Failed to update space tools: ${R.status}`)}catch(j){console.error("Error updating space tools:",j)}},w=async()=>{const D="https://huggingface.co/mcp";try{await navigator.clipboard.writeText(D)}catch(j){console.error("Failed to copy URL:",j)}},_=()=>{window.open("https://huggingface.co/settings/mcp","_blank")},S={paper_search:{id:Ko,label:as.annotations.title,description:as.description,settings:{enabled:((M=n==null?void 0:n.builtInTools)==null?void 0:M.includes(Ko))??!0}},space_search:{id:Wo,label:ss.annotations.title,description:ss.description,settings:{enabled:((E=n==null?void 0:n.builtInTools)==null?void 0:E.includes(Wo))??!0}},model_search:{id:qo,label:os.annotations.title,description:os.description,settings:{enabled:((N=n==null?void 0:n.builtInTools)==null?void 0:N.includes(qo))??!0}},model_details:{id:Zo,label:is.annotations.title,description:is.description,settings:{enabled:((H=n==null?void 0:n.builtInTools)==null?void 0:H.includes(Zo))??!0}},dataset_search:{id:Xo,label:ls.annotations.title,description:ls.description,settings:{enabled:((F=n==null?void 0:n.builtInTools)==null?void 0:F.includes(Xo))??!0}},dataset_details:{id:Yo,label:cs.annotations.title,description:cs.description,settings:{enabled:((q=n==null?void 0:n.builtInTools)==null?void 0:q.includes(Yo))??!0}},doc_semantic_search:{id:ti,label:ds.annotations.title,description:ds.description,settings:{enabled:((X=n==null?void 0:n.builtInTools)==null?void 0:X.includes(ti))??!0}},doc_fetch:{id:ni,label:us.annotations.title,description:us.description,settings:{enabled:((z=n==null?void 0:n.builtInTools)==null?void 0:z.includes(ni))??!0}}},C={duplicate_space:{id:Jo,label:Sl.annotations.title,description:"Duplicate a Hugging Face Space to your account.",settings:{enabled:((U=n==null?void 0:n.builtInTools)==null?void 0:U.includes(Jo))??!0}},space_info:{id:Qo,label:Cl.annotations.title,description:"Get detailed information about Hugging Face Spaces.",settings:{enabled:((te=n==null?void 0:n.builtInTools)==null?void 0:te.includes(Qo))??!0}},space_files:{id:ei,label:bl.annotations.title,description:"List all files in a static Hugging Face Space with download URLs.",settings:{enabled:((W=n==null?void 0:n.builtInTools)==null?void 0:W.includes(ei))??!0}}};return l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"min-h-screen p-4 sm:p-8 pb-20",children:l.jsx("div",{className:"max-w-4xl mx-auto",children:l.jsxs(gh,{defaultValue:"metrics",className:"w-full",children:[l.jsxs(mh,{className:"mb-6 w-full overflow-x-auto flex-nowrap",children:[l.jsx(At,{value:"metrics",className:"whitespace-nowrap",children:"📊 Metrics"}),l.jsx(At,{value:"mcp",className:"whitespace-nowrap",children:"🔧 MCP"}),!(e!=null&&e.externalApiMode)&&l.jsx(At,{value:"search",className:"whitespace-nowrap",children:"🔍 Search"}),!(e!=null&&e.externalApiMode)&&l.jsx(At,{value:"spaces",className:"whitespace-nowrap",children:"🚀 Spaces"}),!(e!=null&&e.externalApiMode)&&l.jsx(At,{value:"gradio",className:"whitespace-nowrap",children:"🚀 Gradio"}),l.jsx(At,{value:"home",className:"whitespace-nowrap",children:"🏠 Home"})]}),l.jsx(kt,{value:"metrics",className:"mt-0",children:l.jsx(rh,{})}),l.jsx(kt,{value:"mcp",className:"mt-0",children:l.jsx(oh,{})}),!(e!=null&&e.externalApiMode)&&l.jsx(kt,{value:"search",className:"mt-0",children:l.jsx(eo,{title:"🤗 Hugging Face Search Tools (MCP)",description:"Find and use Hugging Face and Community content.",tools:S,onToolToggle:d})}),!(e!=null&&e.externalApiMode)&&l.jsx(kt,{value:"spaces",className:"mt-0",children:l.jsx(eo,{title:"🤗 Hugging Face Space Tools (MCP)",description:"Manage and duplicate Hugging Face Spaces.",tools:C,onToolToggle:d})}),!(e!=null&&e.externalApiMode)&&l.jsx(kt,{value:"gradio",className:"mt-0",children:l.jsx($c,{spaceNames:r,spaceSubdomains:o,enabledSpaces:a,onSpaceToolToggle:v,onSpaceToolNameChange:h,onSpaceToolSubdomainChange:y})}),l.jsx(kt,{value:"home",className:"mt-0",children:l.jsxs(Ze,{children:[l.jsxs(Ke,{children:[l.jsx(Xe,{children:"🤗 HF MCP Server"}),l.jsx(Ct,{children:"Connect with AI assistants through the Model Context Protocol"})]}),l.jsxs(Ye,{className:"space-y-6",children:[l.jsxs("div",{children:[l.jsx("h3",{className:"text-sm font-semibold text-foreground mb-3",children:"What's MCP?"}),l.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."})]}),l.jsx(yt,{}),l.jsx("div",{className:"bg-blue-50 dark:bg-blue-950 border border-blue-200 dark:border-blue-800 rounded-lg p-4",children:l.jsxs("div",{className:"flex items-start space-x-3",children:[l.jsx("div",{className:"flex-shrink-0 mt-0.5",children:l.jsx("svg",{className:"h-5 w-5 text-blue-600 dark:text-blue-400",fill:"currentColor",viewBox:"0 0 20 20",children:l.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"})})}),l.jsxs("div",{children:[l.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))&&l.jsx("p",{className:"text-sm text-blue-700 dark:text-blue-300 leading-relaxed",children:e!=null&&e.externalApiMode?l.jsxs(l.Fragment,{children:[l.jsx("strong",{children:"External API Mode:"})," Tools are managed by an external API. Tool Selection Tabs are not available."]}):l.jsxs(l.Fragment,{children:[l.jsx("strong",{children:"Shared Mode:"})," Tool toggles in this interface affect"," ",l.jsx("strong",{children:"all connected MCP server instances"})," and control tool availability for all connected Hosts."]})})]})]})}),l.jsx(yt,{}),l.jsxs("div",{className:"flex flex-col gap-4",children:[l.jsxs(Pt,{size:"xl",onClick:w,className:"w-full transition-all duration-200 active:bg-green-500 active:border-green-500 touch-manipulation",children:[l.jsx(jl,{className:"mr-2 h-5 w-5"}),"Copy MCP URL"]}),l.jsxs(Pt,{size:"xl",variant:"outline",onClick:_,className:"w-full touch-manipulation",children:[l.jsx(Al,{className:"mr-2 h-5 w-5"}),"Go to Settings"]})]})]})]})})]})})}),l.jsx(ih,{isLoading:m,error:g,transportInfo:e||{transport:"unknown"}})]})}kl.createRoot(document.getElementById("root")).render(l.jsx(p.StrictMode,{children:l.jsx(qh,{})}));
|