@llmindset/hf-mcp-server 0.2.12 → 0.2.14
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 +23 -1
- package/dist/server/mcp-server.js.map +1 -1
- package/dist/server/transport/stateless-http-transport.d.ts.map +1 -1
- package/dist/server/transport/stateless-http-transport.js +0 -3
- package/dist/server/transport/stateless-http-transport.js.map +1 -1
- package/dist/shared/transport-metrics.d.ts +9 -0
- package/dist/shared/transport-metrics.d.ts.map +1 -1
- package/dist/shared/transport-metrics.js +54 -0
- package/dist/shared/transport-metrics.js.map +1 -1
- package/dist/web/assets/{main-CEzepEBw.js → main-_Tk3V7Ka.js} +3 -3
- package/dist/web/index.html +1 -1
- package/package.json +2 -2
|
@@ -6,7 +6,7 @@ import{r as Cl,a as p,R as Oe,j as l,b as ti,u as ge,P as se,c as nt,d as ce,C a
|
|
|
6
6
|
*
|
|
7
7
|
* This source code is licensed under the MIT license found in the
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var Ws;function jl(){if(Ws)return rr;Ws=1;var e=Cl();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 rr.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:f,rr}var Zs;function Al(){return Zs||(Zs=1,nr.exports=jl()),nr.exports}var kl=Al();const oi=0,ii=1,ai=2,qs=3;var Ks=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(Ks.call(e,n)&&++r&&!Ks.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 Ze=new WeakMap,it=()=>{},he=it(),kr=Object,q=e=>e===he,Fe=e=>typeof e=="function",dt=(e,t)=>({...e,...t}),li=e=>Fe(e.then),sr={},fn={},fs="undefined",sn=typeof window!=fs,Ir=typeof document!=fs,Il=sn&&"Deno"in window,Pl=()=>sn&&typeof window.requestAnimationFrame!=fs,ci=(e,t)=>{const n=Ze.get(e);return[()=>!q(t)&&e.get(t)||sr,r=>{if(!q(t)){const s=e.get(t);t in fn||(fn[t]=s),n[5](t,dt(s,r),s||sr)}},n[6],()=>!q(t)&&t in fn?fn[t]:!q(t)&&e.get(t)||sr]};let Pr=!0;const Ol=()=>Pr,[Or,Fr]=sn&&window.addEventListener?[window.addEventListener.bind(window),window.removeEventListener.bind(window)]:[it,it],Fl=()=>{const e=Ir&&document.visibilityState;return q(e)||e!=="hidden"},Dl=e=>(Ir&&document.addEventListener("visibilitychange",e),Or("focus",e),()=>{Ir&&document.removeEventListener("visibilitychange",e),Fr("focus",e)}),$l=e=>{const t=()=>{Pr=!0,e()},n=()=>{Pr=!1};return Or("online",t),Or("offline",n),()=>{Fr("online",t),Fr("offline",n)}},Ll={isOnline:Ol,isVisible:Fl},Vl={initFocus:Dl,initReconnect:$l},Xs=!Oe.useId,Yt=!sn||Il,Hl=e=>Pl()?window.requestAnimationFrame(e):setTimeout(e,1),or=Yt?p.useEffect:p.useLayoutEffect,ir=typeof navigator<"u"&&navigator.connection,Ys=!Yt&&ir&&(["slow-2g","2g"].includes(ir.effectiveType)||ir.saveData),gn=new WeakMap,ar=(e,t)=>kr.prototype.toString.call(e)===`[object ${t}]`;let zl=0;const Dr=e=>{const t=typeof e,n=ar(e,"Date"),r=ar(e,"RegExp"),s=ar(e,"Object");let o,i;if(kr(e)===e&&!n&&!r){if(o=gn.get(e),o)return o;if(o=++zl+"~",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(;!q(i=a.pop());)q(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 Gl=0;const $r=()=>++Gl;async function ui(...e){const[t,n,r,s]=e,o=dt({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]=ci(t,d),[y,x,w,_]=Ze.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](ai).then(()=>v().data):v().data};if(e.length<3)return S();let C=r,M;const E=$r();x[d]=[E,0];const N=!q(c),H=v(),F=H.data,Z=H._c,X=q(Z)?F:Z;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&&li(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:he}));if(i&&!M)if(Fe(i)){const z=i(C,X);h({data:z,error:he,_c:he})}else h({data:C,error:he,_c:he});if(x[d][1]=$r(),Promise.resolve(S()).then(()=>{h({_c:he})}),M){if(f)throw M;return}return C}}const Js=(e,t)=>{for(const n in e)e[n][0]&&e[n][0](t)},Bl=(e,t)=>{if(!Ze.has(e)){const n=dt(Vl,t),r=Object.create(null),s=ui.bind(he,e);let o=it;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(!Ze.has(e)&&(Ze.set(e,[r,Object.create(null),Object.create(null),Object.create(null),s,c,a]),!Yt)){const f=n.initFocus(setTimeout.bind(he,Js.bind(he,r,oi))),m=n.initReconnect(setTimeout.bind(he,Js.bind(he,r,ii)));o=()=>{f&&f(),m&&m(),Ze.delete(e)}}};return u(),[e,s,u,o]}return[e,Ze.get(e)[4]]},Ul=(e,t,n,r,s)=>{const o=n.errorRetryCount,i=s.retryCount,a=~~((Math.random()+.5)*(1<<(i<8?i:8)))*n.errorRetryInterval;!q(o)&&i>o||setTimeout(r,a,s)},Wl=Ar,[di,bn]=Bl(new Map),Zl=dt({onLoadingSlow:it,onSuccess:it,onError:it,onErrorRetry:Ul,onDiscarded:it,revalidateOnFocus:!0,revalidateOnReconnect:!0,revalidateIfStale:!0,shouldRetryOnError:!0,errorRetryInterval:Ys?1e4:5e3,focusThrottleInterval:5*1e3,dedupingInterval:2*1e3,loadingTimeout:Ys?5e3:3e3,compare:Wl,isPaused:()=>!1,cache:di,mutate:bn,fallback:{}},Ll),ql=(e,t)=>{const n=dt(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=dt(s,i))}return n},Kl=p.createContext({}),Xl="$inf$",fi=sn&&window.__SWR_DEVTOOLS_USE__,Yl=fi?window.__SWR_DEVTOOLS_USE__:[],Jl=()=>{fi&&(window.__SWR_DEVTOOLS_REACT__=Oe)},Ql=e=>Fe(e[1])?[e[0],e[1],e[2]||{}]:[e[0],null,(e[1]===null?e[2]:e[1])||{}],ec=()=>dt(Zl,p.useContext(Kl)),tc=e=>(t,n,r)=>e(t,n&&((...o)=>{const[i]=gs(t),[,,,a]=Ze.get(di);if(i.startsWith(Xl))return n(...o);const c=a[i];return q(c)?n(...o):(delete a[i],c)}),r),nc=Yl.concat(tc),rc=e=>function(...n){const r=ec(),[s,o,i]=Ql(n),a=ql(r,i);let c=e;const{use:u}=a,f=(u||[]).concat(nc);for(let m=f.length;m--;)c=f[m](c);return c(s,o||a.fetcher||null,a)},sc=(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())}};Jl();const lr=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}}),cr={dedupe:!0},oc=(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]=Ze.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,Z,X,z]=ci(r,x),U=p.useRef({}).current,te=q(i)?q(n.fallback)?he:n.fallback[x]:i,W=(J,ee)=>{for(const ue in U){const ne=ue;if(ne==="data"){if(!s(J[ne],ee[ne])&&(!q(J[ne])||!s(Ge,ee[ne])))return!1}else if(ee[ne]!==J[ne])return!1}return!0},D=p.useMemo(()=>{const J=!x||!t?!1:q(a)?N().isPaused()||o?!1:c!==!1:a,ee=me=>{const Be=dt(me);return delete Be._k,J?{isValidating:!0,isLoading:!0,...Be}:Be},ue=F(),ne=z(),_e=ee(ue),rt=ue===ne?_e:ee(ne);let oe=_e;return[()=>{const me=ee(F());return W(me,oe)?(oe.data=me.data,oe.isLoading=me.isLoading,oe.isValidating=me.isValidating,oe.error=me.error,oe):(oe=me,me)},()=>rt]},[r,x]),j=kl.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,ie=q(Q)?te&&li(te)?lr(te):te:Q,ye=j.error,we=p.useRef(ie),Ge=g?q(Q)?q(we.current)?ie:we.current:Q:ie,Pe=V&&!q(ye)?!1:R&&!q(a)?a:N().isPaused()?!1:o?q(ie)?!1:c:q(ie)||c,Ee=!!(x&&t&&R&&Pe),xt=q(j.isValidating)?Ee:j.isValidating,xe=q(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,ne,_e=!0;const rt=J||{},oe=!h[x]||!rt.dedupe,me=()=>Xs?!S.current&&x===C.current&&_.current:x===C.current,Be={isValidating:!1,isLoading:!1},Gs=()=>{Z(Be)},Bs=()=>{const Me=h[x];Me&&Me[1]===ne&&delete h[x]},Us={isValidating:!0};q(F().data)&&(Us.isLoading=!0);try{if(oe&&(Z(Us),n.loadingTimeout&&q(F().data)&&setTimeout(()=>{_e&&me()&&N().onLoadingSlow(x,n)},n.loadingTimeout),h[x]=[ee(w),$r()]),[ue,ne]=h[x],ue=await ue,oe&&setTimeout(Bs,n.dedupingInterval),!h[x]||h[x][1]!==ne)return oe&&me()&&N().onDiscarded(x),!1;Be.error=he;const Me=v[x];if(!q(Me)&&(ne<=Me[0]||ne<=Me[1]||Me[1]===0))return Gs(),oe&&me()&&N().onDiscarded(x),!1;const Ue=F().data;Be.data=s(Ue,ue)?Ue:ue,oe&&me()&&N().onSuccess(ue,x,n)}catch(Me){Bs();const Ue=N(),{shouldRetryOnError:er}=Ue;Ue.isPaused()||(Be.error=Me,oe&&me()&&(Ue.onError(Me,x,Ue),(er===!0||Fe(er)&&er(Me))&&(!N().revalidateOnFocus||!N().revalidateOnReconnect||H())&&Ue.onErrorRetry(Me,x,Ue,Sl=>{const tr=d[x];tr&&tr[0]&&tr[0](qs,Sl)},{retryCount:(rt.retryCount||0)+1,dedupe:!0})))}return _e=!1,Gs(),!0},[x,r]),Ut=p.useCallback((...J)=>ui(r,C.current,...J),[]);if(or(()=>{M.current=t,E.current=n,q(Q)||(we.current=Q)}),or(()=>{if(!x)return;const J=je.bind(he,cr);let ee=0;N().revalidateOnFocus&&(ee=Date.now()+N().focusThrottleInterval);const ne=sc(x,d,(_e,rt={})=>{if(_e==oi){const oe=Date.now();N().revalidateOnFocus&&oe>ee&&H()&&(ee=oe+N().focusThrottleInterval,J())}else if(_e==ii)N().revalidateOnReconnect&&H()&&J();else{if(_e==ai)return je();if(_e==qs)return je(rt)}});return S.current=!1,C.current=x,_.current=!0,Z({_k:w}),Pe&&(q(ie)||Yt?J():Hl(J)),()=>{S.current=!0,ne()}},[x]),or(()=>{let J;function ee(){const ne=Fe(u)?u(F().data):u;ne&&J!==-1&&(J=setTimeout(ue,ne))}function ue(){!F().error&&(f||N().isVisible())&&(m||N().isOnline())?je(cr).then(ee):ee()}return ee(),()=>{J&&(clearTimeout(J),J=-1)}},[u,f,m,x]),p.useDebugValue(Ge),o&&q(ie)&&x){if(!Xs&&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(!q(J)){const ee=Ut(J);lr(ee)}if(q(ye)){const ee=je(cr);q(Ge)||(ee.status="fulfilled",ee.value=!0),lr(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,xt},get isLoading(){return U.isLoading=!0,xe}}},Kt=rc(oc);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,ic(s,...t)]}function ic(...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 ft=globalThis!=null&&globalThis.document?p.useLayoutEffect:()=>{},ac=ti[" useInsertionEffect ".trim().toString()]||ft;function Vn({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[s,o,i]=lc({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=cc(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 lc({defaultProp:e,onChange:t}){const[n,r]=p.useState(e),s=p.useRef(n),o=p.useRef(t);return ac(()=>{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 cc(e){return typeof e=="function"}function uc(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 gi(e){const[t,n]=p.useState(void 0);return ft(()=>{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 dc(e,t){return p.useReducer((n,r)=>t[n][r]??n,e)}var Rt=e=>{const{present:t,children:n}=e,r=fc(t),s=typeof n=="function"?n({present:r.isPresent}):p.Children.only(n),o=ge(r.ref,gc(s));return typeof n=="function"||r.isPresent?p.cloneElement(s,{ref:o}):null};Rt.displayName="Presence";function fc(e){const[t,n]=p.useState(),r=p.useRef(null),s=p.useRef(e),o=p.useRef("none"),i=e?"mounted":"unmounted",[a,c]=dc(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]),ft(()=>{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]),ft(()=>{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 gc(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 Hn="Checkbox",[mc,zh]=bt(Hn),[hc,ms]=mc(Hn);function pc(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]=Vn({prop:n,defaultProp:s??!1,onChange:c,caller:Hn}),[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:ct(s)?!1:s,isFormControl:_,bubbleInput:y,setBubbleInput:x};return l.jsx(hc,{scope:t,...S,children:vc(m)?m(S):r})}var mi="CheckboxTrigger",hi=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}=ms(mi,e),h=ge(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(se.button,{type:"button",role:"checkbox","aria-checked":ct(c)?"mixed":c,"aria-required":u,"data-state":_i(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=>ct(w)?!0:!w),v&&d&&(g.current=x.isPropagationStopped(),g.current||x.stopPropagation())})})});hi.displayName=mi;var pi=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(pc,{__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(hi,{...m,ref:t,__scopeCheckbox:n}),g&&l.jsx(wi,{__scopeCheckbox:n})]})})});pi.displayName=Hn;var vi="CheckboxIndicator",xi=p.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:r,...s}=e,o=ms(vi,n);return l.jsx(Rt,{present:r||ct(o.checked)||o.checked===!0,children:l.jsx(se.span,{"data-state":_i(o.checked),"data-disabled":o.disabled?"":void 0,...s,ref:t,style:{pointerEvents:"none",...e.style}})})});xi.displayName=vi;var yi="CheckboxBubbleInput",wi=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}=ms(yi,e),v=ge(n,d),h=uc(o),y=gi(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=ct(o),C.call(w,ct(o)?!1:o),w.dispatchEvent(E)}},[g,h,o,s]);const x=p.useRef(ct(o)?!1:o);return l.jsx(se.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%)"}})});wi.displayName=yi;function vc(e){return typeof e=="function"}function ct(e){return e==="indeterminate"}function _i(e){return ct(e)?"indeterminate":e?"checked":"unchecked"}/**
|
|
9
|
+
*/var Ws;function jl(){if(Ws)return rr;Ws=1;var e=Cl();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 rr.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:f,rr}var Zs;function Al(){return Zs||(Zs=1,nr.exports=jl()),nr.exports}var kl=Al();const oi=0,ii=1,ai=2,qs=3;var Ks=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(Ks.call(e,n)&&++r&&!Ks.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 Ze=new WeakMap,it=()=>{},pe=it(),kr=Object,q=e=>e===pe,Fe=e=>typeof e=="function",dt=(e,t)=>({...e,...t}),li=e=>Fe(e.then),sr={},fn={},fs="undefined",sn=typeof window!=fs,Ir=typeof document!=fs,Il=sn&&"Deno"in window,Pl=()=>sn&&typeof window.requestAnimationFrame!=fs,ci=(e,t)=>{const n=Ze.get(e);return[()=>!q(t)&&e.get(t)||sr,r=>{if(!q(t)){const s=e.get(t);t in fn||(fn[t]=s),n[5](t,dt(s,r),s||sr)}},n[6],()=>!q(t)&&t in fn?fn[t]:!q(t)&&e.get(t)||sr]};let Pr=!0;const Ol=()=>Pr,[Or,Fr]=sn&&window.addEventListener?[window.addEventListener.bind(window),window.removeEventListener.bind(window)]:[it,it],Fl=()=>{const e=Ir&&document.visibilityState;return q(e)||e!=="hidden"},Dl=e=>(Ir&&document.addEventListener("visibilitychange",e),Or("focus",e),()=>{Ir&&document.removeEventListener("visibilitychange",e),Fr("focus",e)}),$l=e=>{const t=()=>{Pr=!0,e()},n=()=>{Pr=!1};return Or("online",t),Or("offline",n),()=>{Fr("online",t),Fr("offline",n)}},Ll={isOnline:Ol,isVisible:Fl},Vl={initFocus:Dl,initReconnect:$l},Xs=!Oe.useId,Yt=!sn||Il,Hl=e=>Pl()?window.requestAnimationFrame(e):setTimeout(e,1),or=Yt?p.useEffect:p.useLayoutEffect,ir=typeof navigator<"u"&&navigator.connection,Ys=!Yt&&ir&&(["slow-2g","2g"].includes(ir.effectiveType)||ir.saveData),gn=new WeakMap,ar=(e,t)=>kr.prototype.toString.call(e)===`[object ${t}]`;let zl=0;const Dr=e=>{const t=typeof e,n=ar(e,"Date"),r=ar(e,"RegExp"),s=ar(e,"Object");let o,i;if(kr(e)===e&&!n&&!r){if(o=gn.get(e),o)return o;if(o=++zl+"~",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(;!q(i=a.pop());)q(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 Gl=0;const $r=()=>++Gl;async function ui(...e){const[t,n,r,s]=e,o=dt({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]=ci(t,d),[y,x,w,_]=Ze.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](ai).then(()=>v().data):v().data};if(e.length<3)return S();let C=r,M;const E=$r();x[d]=[E,0];const N=!q(c),H=v(),F=H.data,Z=H._c,X=q(Z)?F:Z;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&&li(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 Js=(e,t)=>{for(const n in e)e[n][0]&&e[n][0](t)},Bl=(e,t)=>{if(!Ze.has(e)){const n=dt(Vl,t),r=Object.create(null),s=ui.bind(pe,e);let o=it;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(!Ze.has(e)&&(Ze.set(e,[r,Object.create(null),Object.create(null),Object.create(null),s,c,a]),!Yt)){const f=n.initFocus(setTimeout.bind(pe,Js.bind(pe,r,oi))),m=n.initReconnect(setTimeout.bind(pe,Js.bind(pe,r,ii)));o=()=>{f&&f(),m&&m(),Ze.delete(e)}}};return u(),[e,s,u,o]}return[e,Ze.get(e)[4]]},Ul=(e,t,n,r,s)=>{const o=n.errorRetryCount,i=s.retryCount,a=~~((Math.random()+.5)*(1<<(i<8?i:8)))*n.errorRetryInterval;!q(o)&&i>o||setTimeout(r,a,s)},Wl=Ar,[di,bn]=Bl(new Map),Zl=dt({onLoadingSlow:it,onSuccess:it,onError:it,onErrorRetry:Ul,onDiscarded:it,revalidateOnFocus:!0,revalidateOnReconnect:!0,revalidateIfStale:!0,shouldRetryOnError:!0,errorRetryInterval:Ys?1e4:5e3,focusThrottleInterval:5*1e3,dedupingInterval:2*1e3,loadingTimeout:Ys?5e3:3e3,compare:Wl,isPaused:()=>!1,cache:di,mutate:bn,fallback:{}},Ll),ql=(e,t)=>{const n=dt(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=dt(s,i))}return n},Kl=p.createContext({}),Xl="$inf$",fi=sn&&window.__SWR_DEVTOOLS_USE__,Yl=fi?window.__SWR_DEVTOOLS_USE__:[],Jl=()=>{fi&&(window.__SWR_DEVTOOLS_REACT__=Oe)},Ql=e=>Fe(e[1])?[e[0],e[1],e[2]||{}]:[e[0],null,(e[1]===null?e[2]:e[1])||{}],ec=()=>dt(Zl,p.useContext(Kl)),tc=e=>(t,n,r)=>e(t,n&&((...o)=>{const[i]=gs(t),[,,,a]=Ze.get(di);if(i.startsWith(Xl))return n(...o);const c=a[i];return q(c)?n(...o):(delete a[i],c)}),r),nc=Yl.concat(tc),rc=e=>function(...n){const r=ec(),[s,o,i]=Ql(n),a=ql(r,i);let c=e;const{use:u}=a,f=(u||[]).concat(nc);for(let m=f.length;m--;)c=f[m](c);return c(s,o||a.fetcher||null,a)},sc=(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())}};Jl();const lr=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}}),cr={dedupe:!0},oc=(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]=Ze.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,Z,X,z]=ci(r,x),U=p.useRef({}).current,te=q(i)?q(n.fallback)?pe:n.fallback[x]:i,W=(J,ee)=>{for(const ue in U){const ne=ue;if(ne==="data"){if(!s(J[ne],ee[ne])&&(!q(J[ne])||!s(Ge,ee[ne])))return!1}else if(ee[ne]!==J[ne])return!1}return!0},D=p.useMemo(()=>{const J=!x||!t?!1:q(a)?N().isPaused()||o?!1:c!==!1:a,ee=he=>{const Be=dt(he);return delete Be._k,J?{isValidating:!0,isLoading:!0,...Be}:Be},ue=F(),ne=z(),_e=ee(ue),rt=ue===ne?_e:ee(ne);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)},()=>rt]},[r,x]),j=kl.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=q(Q)?te&&li(te)?lr(te):te:Q,ye=j.error,we=p.useRef(ae),Ge=g?q(Q)?q(we.current)?ae:we.current:Q:ae,Pe=V&&!q(ye)?!1:R&&!q(a)?a:N().isPaused()?!1:o?q(ae)?!1:c:q(ae)||c,Ee=!!(x&&t&&R&&Pe),xt=q(j.isValidating)?Ee:j.isValidating,xe=q(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,ne,_e=!0;const rt=J||{},oe=!h[x]||!rt.dedupe,he=()=>Xs?!S.current&&x===C.current&&_.current:x===C.current,Be={isValidating:!1,isLoading:!1},Gs=()=>{Z(Be)},Bs=()=>{const Me=h[x];Me&&Me[1]===ne&&delete h[x]},Us={isValidating:!0};q(F().data)&&(Us.isLoading=!0);try{if(oe&&(Z(Us),n.loadingTimeout&&q(F().data)&&setTimeout(()=>{_e&&he()&&N().onLoadingSlow(x,n)},n.loadingTimeout),h[x]=[ee(w),$r()]),[ue,ne]=h[x],ue=await ue,oe&&setTimeout(Bs,n.dedupingInterval),!h[x]||h[x][1]!==ne)return oe&&he()&&N().onDiscarded(x),!1;Be.error=pe;const Me=v[x];if(!q(Me)&&(ne<=Me[0]||ne<=Me[1]||Me[1]===0))return Gs(),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){Bs();const Ue=N(),{shouldRetryOnError:er}=Ue;Ue.isPaused()||(Be.error=Me,oe&&he()&&(Ue.onError(Me,x,Ue),(er===!0||Fe(er)&&er(Me))&&(!N().revalidateOnFocus||!N().revalidateOnReconnect||H())&&Ue.onErrorRetry(Me,x,Ue,Sl=>{const tr=d[x];tr&&tr[0]&&tr[0](qs,Sl)},{retryCount:(rt.retryCount||0)+1,dedupe:!0})))}return _e=!1,Gs(),!0},[x,r]),Ut=p.useCallback((...J)=>ui(r,C.current,...J),[]);if(or(()=>{M.current=t,E.current=n,q(Q)||(we.current=Q)}),or(()=>{if(!x)return;const J=je.bind(pe,cr);let ee=0;N().revalidateOnFocus&&(ee=Date.now()+N().focusThrottleInterval);const ne=sc(x,d,(_e,rt={})=>{if(_e==oi){const oe=Date.now();N().revalidateOnFocus&&oe>ee&&H()&&(ee=oe+N().focusThrottleInterval,J())}else if(_e==ii)N().revalidateOnReconnect&&H()&&J();else{if(_e==ai)return je();if(_e==qs)return je(rt)}});return S.current=!1,C.current=x,_.current=!0,Z({_k:w}),Pe&&(q(ae)||Yt?J():Hl(J)),()=>{S.current=!0,ne()}},[x]),or(()=>{let J;function ee(){const ne=Fe(u)?u(F().data):u;ne&&J!==-1&&(J=setTimeout(ue,ne))}function ue(){!F().error&&(f||N().isVisible())&&(m||N().isOnline())?je(cr).then(ee):ee()}return ee(),()=>{J&&(clearTimeout(J),J=-1)}},[u,f,m,x]),p.useDebugValue(Ge),o&&q(ae)&&x){if(!Xs&&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(!q(J)){const ee=Ut(J);lr(ee)}if(q(ye)){const ee=je(cr);q(Ge)||(ee.status="fulfilled",ee.value=!0),lr(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,xt},get isLoading(){return U.isLoading=!0,xe}}},Kt=rc(oc);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,ic(s,...t)]}function ic(...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 ft=globalThis!=null&&globalThis.document?p.useLayoutEffect:()=>{},ac=ti[" useInsertionEffect ".trim().toString()]||ft;function Vn({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[s,o,i]=lc({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=cc(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 lc({defaultProp:e,onChange:t}){const[n,r]=p.useState(e),s=p.useRef(n),o=p.useRef(t);return ac(()=>{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 cc(e){return typeof e=="function"}function uc(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 gi(e){const[t,n]=p.useState(void 0);return ft(()=>{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 dc(e,t){return p.useReducer((n,r)=>t[n][r]??n,e)}var Rt=e=>{const{present:t,children:n}=e,r=fc(t),s=typeof n=="function"?n({present:r.isPresent}):p.Children.only(n),o=ge(r.ref,gc(s));return typeof n=="function"||r.isPresent?p.cloneElement(s,{ref:o}):null};Rt.displayName="Presence";function fc(e){const[t,n]=p.useState(),r=p.useRef(null),s=p.useRef(e),o=p.useRef("none"),i=e?"mounted":"unmounted",[a,c]=dc(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]),ft(()=>{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]),ft(()=>{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 gc(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 Hn="Checkbox",[mc,zh]=bt(Hn),[hc,ms]=mc(Hn);function pc(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]=Vn({prop:n,defaultProp:s??!1,onChange:c,caller:Hn}),[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:ct(s)?!1:s,isFormControl:_,bubbleInput:y,setBubbleInput:x};return l.jsx(hc,{scope:t,...S,children:vc(m)?m(S):r})}var mi="CheckboxTrigger",hi=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}=ms(mi,e),h=ge(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(se.button,{type:"button",role:"checkbox","aria-checked":ct(c)?"mixed":c,"aria-required":u,"data-state":_i(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=>ct(w)?!0:!w),v&&d&&(g.current=x.isPropagationStopped(),g.current||x.stopPropagation())})})});hi.displayName=mi;var pi=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(pc,{__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(hi,{...m,ref:t,__scopeCheckbox:n}),g&&l.jsx(wi,{__scopeCheckbox:n})]})})});pi.displayName=Hn;var vi="CheckboxIndicator",xi=p.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:r,...s}=e,o=ms(vi,n);return l.jsx(Rt,{present:r||ct(o.checked)||o.checked===!0,children:l.jsx(se.span,{"data-state":_i(o.checked),"data-disabled":o.disabled?"":void 0,...s,ref:t,style:{pointerEvents:"none",...e.style}})})});xi.displayName=vi;var yi="CheckboxBubbleInput",wi=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}=ms(yi,e),v=ge(n,d),h=uc(o),y=gi(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=ct(o),C.call(w,ct(o)?!1:o),w.dispatchEvent(E)}},[g,h,o,s]);const x=p.useRef(ct(o)?!1:o);return l.jsx(se.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%)"}})});wi.displayName=yi;function vc(e){return typeof e=="function"}function ct(e){return e==="indeterminate"}function _i(e){return ct(e)?"indeterminate":e?"checked":"unchecked"}/**
|
|
10
10
|
* @license lucide-react v0.507.0 - ISC
|
|
11
11
|
*
|
|
12
12
|
* This source code is licensed under the ISC license.
|
|
@@ -72,7 +72,7 @@ import{r as Cl,a as p,R as Oe,j as l,b as ti,u as ge,P as se,c as nt,d as ce,C a
|
|
|
72
72
|
* LICENSE.md file in the root directory of this source tree.
|
|
73
73
|
*
|
|
74
74
|
* @license MIT
|
|
75
|
-
*/function no(e,t){return e?Pu(e)?p.createElement(e,t):e:null}function Pu(e){return Ou(e)||typeof e=="function"||Fu(e)}function Ou(e){return typeof e=="function"&&(()=>{const t=Object.getPrototypeOf(e);return t.prototype&&t.prototype.isReactComponent})()}function Fu(e){return typeof e=="object"&&typeof e.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(e.$$typeof.description)}function Du(e){const t={state:{},onStateChange:()=>{},renderFallbackValue:null,...e},[n]=p.useState(()=>({current:Ru(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 Di(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=jr(a),u=Oe.forwardRef((h,y)=>{const{scope:x,children:w}=h,_=o(a,x),S=ge(y,_.collectionRef);return l.jsx(c,{ref:S,children:w})});u.displayName=a;const f=e+"CollectionItemSlot",m="data-radix-collection-item",g=jr(f),d=Oe.forwardRef((h,y)=>{const{scope:x,children:w,..._}=h,S=Oe.useRef(null),C=ge(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 $u=p.createContext(void 0);function ws(e){const t=p.useContext($u);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 Lu(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 Vu="DismissableLayer",Ur="dismissableLayer.update",Hu="dismissableLayer.pointerDownOutside",zu="dismissableLayer.focusOutside",ro,$i=p.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Li=p.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:s,onFocusOutside:o,onInteractOutside:i,onDismiss:a,...c}=e,u=p.useContext($i),[f,m]=p.useState(null),g=(f==null?void 0:f.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,d]=p.useState({}),v=ge(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=Uu(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=Wu(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 Lu(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&&(ro=g.body.style.pointerEvents,g.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(f)),u.layers.add(f),so(),()=>{n&&u.layersWithOutsidePointerEventsDisabled.size===1&&(g.body.style.pointerEvents=ro)}},[f,g,n,u]),p.useEffect(()=>()=>{f&&(u.layers.delete(f),u.layersWithOutsidePointerEventsDisabled.delete(f),so())},[f,u]),p.useEffect(()=>{const E=()=>d({});return document.addEventListener(Ur,E),()=>document.removeEventListener(Ur,E)},[]),l.jsx(se.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)})});Li.displayName=Vu;var Gu="DismissableLayerBranch",Bu=p.forwardRef((e,t)=>{const n=p.useContext($i),r=p.useRef(null),s=ge(t,r);return p.useEffect(()=>{const o=r.current;if(o)return n.branches.add(o),()=>{n.branches.delete(o)}},[n.branches]),l.jsx(se.div,{...e,ref:s})});Bu.displayName=Gu;function Uu(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(){Vi(Hu,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 Wu(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&&Vi(zu,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 so(){const e=new CustomEvent(Ur);document.dispatchEvent(e)}function Vi(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?ri(s,o):s.dispatchEvent(o)}var vr=0;function Zu(){p.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??oo()),document.body.insertAdjacentElement("beforeend",e[1]??oo()),vr++,()=>{vr===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),vr--}},[])}function oo(){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 xr="focusScope.autoFocusOnMount",yr="focusScope.autoFocusOnUnmount",io={bubbles:!1,cancelable:!0},qu="FocusScope",Hi=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=ge(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:st(m.current,{select:!0})},y=function(_){if(d.paused||!a)return;const S=_.relatedTarget;S!==null&&(a.contains(S)||st(m.current,{select:!0}))},x=function(_){if(document.activeElement===document.body)for(const C of _)C.removedNodes.length>0&&st(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){lo.add(d);const h=document.activeElement;if(!a.contains(h)){const x=new CustomEvent(xr,io);a.addEventListener(xr,u),a.dispatchEvent(x),x.defaultPrevented||(Ku(ed(zi(a)),{select:!0}),document.activeElement===h&&st(a))}return()=>{a.removeEventListener(xr,u),setTimeout(()=>{const x=new CustomEvent(yr,io);a.addEventListener(yr,f),a.dispatchEvent(x),x.defaultPrevented||st(h??document.body,{select:!0}),a.removeEventListener(yr,f),lo.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]=Xu(w);_&&S?!h.shiftKey&&x===S?(h.preventDefault(),n&&st(_,{select:!0})):h.shiftKey&&x===_&&(h.preventDefault(),n&&st(S,{select:!0})):x===w&&h.preventDefault()}},[n,r,d.paused]);return l.jsx(se.div,{tabIndex:-1,...i,ref:g,onKeyDown:v})});Hi.displayName=qu;function Ku(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(st(r,{select:t}),document.activeElement!==n)return}function Xu(e){const t=zi(e),n=ao(t,e),r=ao(t.reverse(),e);return[n,r]}function zi(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 ao(e,t){for(const n of e)if(!Yu(n,{upTo:t}))return n}function Yu(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 Ju(e){return e instanceof HTMLInputElement&&"select"in e}function st(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&Ju(e)&&t&&e.select()}}var lo=Qu();function Qu(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=co(e,t),e.unshift(t)},remove(t){var n;e=co(e,t),(n=e[0])==null||n.resume()}}}function co(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function ed(e){return e.filter(t=>t.tagName!=="A")}var td=ti[" useId ".trim().toString()]||(()=>{}),nd=0;function Nn(e){const[t,n]=p.useState(td());return ft(()=>{n(r=>r??String(nd++))},[e]),e||(t?`radix-${t}`:"")}const rd=["top","right","bottom","left"],mt=Math.min,Se=Math.max,Tn=Math.round,xn=Math.floor,Le=e=>({x:e,y:e}),sd={left:"right",right:"left",bottom:"top",top:"bottom"},od={start:"end",end:"start"};function Wr(e,t,n){return Se(e,mt(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 _s(e){return e==="x"?"y":"x"}function Ss(e){return e==="y"?"height":"width"}function $e(e){return["top","bottom"].includes(et(e))?"y":"x"}function Cs(e){return _s($e(e))}function id(e,t,n){n===void 0&&(n=!1);const r=Gt(e),s=Cs(e),o=Ss(s);let i=s==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(i=jn(i)),[i,jn(i)]}function ad(e){const t=jn(e);return[Zr(e),t,Zr(t)]}function Zr(e){return e.replace(/start|end/g,t=>od[t])}function ld(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 cd(e,t,n,r){const s=Gt(e);let o=ld(et(e),n==="start",r);return s&&(o=o.map(i=>i+"-"+s),t&&(o=o.concat(o.map(Zr)))),o}function jn(e){return e.replace(/left|right|bottom|top/g,t=>sd[t])}function ud(e){return{top:0,right:0,bottom:0,left:0,...e}}function Gi(e){return typeof e!="number"?ud(e):{top:e,right:e,bottom:e,left:e}}function An(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 uo(e,t,n){let{reference:r,floating:s}=e;const o=$e(t),i=Cs(t),a=Ss(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 dd=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}=uo(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}=uo(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=Gi(d),y=a[g?m==="floating"?"reference":"floating":m],x=An(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=An(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 fd=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=Gi(f),g={x:n,y:r},d=Cs(s),v=Ss(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=mt(m[x],H),Z=mt(m[w],H),X=F,z=E-h[v]-Z,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:Z)-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}}}),gd=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?[jn(a)]:ad(a)),M=v!=="none";!g&&M&&C.push(...cd(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=id(s,i,S);H.push(N[U[0]],N[U[1]])}if(F=[...F,{placement:s,overflows:H}],!H.every(U=>U<=0)){var Z,X;const U=(((Z=o.flip)==null?void 0:Z.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 fo(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function go(e){return rd.some(t=>e[t]>=0)}const md=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=fo(o,n.reference);return{data:{referenceHiddenOffsets:i,referenceHidden:go(i)}}}case"escaped":{const o=await Jt(t,{...s,altBoundary:!0}),i=fo(o,n.floating);return{data:{escapedOffsets:i,escaped:go(i)}}}default:return{}}}}};async function hd(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 pd=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 hd(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}}}}},vd=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=_s(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}}}}}},xd=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=_s(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}}}},yd=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=mt(h-f[y],w),C=mt(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),Z=Se(f.right,0),X=Se(f.top,0),z=Se(f.bottom,0);d?N=v-2*(F!==0||Z!==0?F+Z: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 Gn(){return typeof window<"u"}function Bt(e){return Bi(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=(Bi(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Bi(e){return Gn()?e instanceof Node||e instanceof Ce(e).Node:!1}function ke(e){return Gn()?e instanceof Element||e instanceof Ce(e).Element:!1}function He(e){return Gn()?e instanceof HTMLElement||e instanceof Ce(e).HTMLElement:!1}function mo(e){return!Gn()||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 wd(e){return["table","td","th"].includes(Bt(e))}function Bn(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function bs(e){const t=Rs(),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 _d(e){let t=ht(e);for(;He(t)&&!Dt(t);){if(bs(t))return t;if(Bn(t))return null;t=ht(t)}return null}function Rs(){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 Un(e){return ke(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function ht(e){if(Bt(e)==="html")return e;const t=e.assignedSlot||e.parentNode||mo(e)&&e.host||ze(e);return mo(t)?t.host:t}function Ui(e){const t=ht(e);return Dt(t)?e.ownerDocument?e.ownerDocument.body:e.body:He(t)&&on(t)?t:Ui(t)}function Qt(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const s=Ui(e),o=s===((r=e.ownerDocument)==null?void 0:r.body),i=Ce(s);if(o){const a=qr(i);return t.concat(i,i.visualViewport||[],on(s)?s:[],a&&n?Qt(a):[])}return t.concat(s,Qt(s,[],n))}function qr(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Wi(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=Tn(n)!==o||Tn(r)!==i;return a&&(n=o,r=i),{width:n,height:r,$:a}}function Es(e){return ke(e)?e:e.contextElement}function Ot(e){const t=Es(e);if(!He(t))return Le(1);const n=t.getBoundingClientRect(),{width:r,height:s,$:o}=Wi(t);let i=(o?Tn(n.width):n.width)/r,a=(o?Tn(n.height):n.height)/s;return(!i||!Number.isFinite(i))&&(i=1),(!a||!Number.isFinite(a))&&(a=1),{x:i,y:a}}const Sd=Le(0);function Zi(e){const t=Ce(e);return!Rs()||!t.visualViewport?Sd:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Cd(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Ce(e)?!1:t}function _t(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const s=e.getBoundingClientRect(),o=Es(e);let i=Le(1);t&&(r?ke(r)&&(i=Ot(r)):i=Ot(e));const a=Cd(o,n,r)?Zi(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=qr(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=qr(v)}}return An({width:f,height:m,x:c,y:u})}function Ms(e,t){const n=Un(e).scrollLeft;return t?t.left+n:_t(ze(e)).left+n}function qi(e,t,n){n===void 0&&(n=!1);const r=e.getBoundingClientRect(),s=r.left+t.scrollLeft-(n?0:Ms(e,r)),o=r.top+t.scrollTop;return{x:s,y:o}}function bd(e){let{elements:t,rect:n,offsetParent:r,strategy:s}=e;const o=s==="fixed",i=ze(r),a=t?Bn(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=Un(r)),He(r))){const d=_t(r);u=Ot(r),f.x=d.x+r.clientLeft,f.y=d.y+r.clientTop}const g=i&&!m&&!o?qi(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 Rd(e){return Array.from(e.getClientRects())}function Ed(e){const t=ze(e),n=Un(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+Ms(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 Md(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=Rs();(!u||u&&t==="fixed")&&(a=s.offsetLeft,c=s.offsetTop)}return{width:o,height:i,x:a,y:c}}function Nd(e,t){const n=_t(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 ho(e,t,n){let r;if(t==="viewport")r=Md(e,n);else if(t==="document")r=Ed(ze(e));else if(ke(t))r=Nd(t,n);else{const s=Zi(e);r={x:t.x-s.x,y:t.y-s.y,width:t.width,height:t.height}}return An(r)}function Ki(e,t){const n=ht(e);return n===t||!ke(n)||Dt(n)?!1:Ie(n).position==="fixed"||Ki(n,t)}function Td(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?ht(e):e;for(;ke(i)&&!Dt(i);){const a=Ie(i),c=bs(i);!c&&a.position==="fixed"&&(s=null),(o?!c&&!s:!c&&a.position==="static"&&!!s&&["absolute","fixed"].includes(s.position)||on(i)&&!c&&Ki(e,i))?r=r.filter(f=>f!==i):s=a,i=ht(i)}return t.set(e,r),r}function jd(e){let{element:t,boundary:n,rootBoundary:r,strategy:s}=e;const i=[...n==="clippingAncestors"?Bn(t)?[]:Td(t,this._c):[].concat(n),r],a=i[0],c=i.reduce((u,f)=>{const m=ho(t,f,s);return u.top=Se(m.top,u.top),u.right=mt(m.right,u.right),u.bottom=mt(m.bottom,u.bottom),u.left=Se(m.left,u.left),u},ho(t,a,s));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function Ad(e){const{width:t,height:n}=Wi(e);return{width:t,height:n}}function kd(e,t,n){const r=He(t),s=ze(t),o=n==="fixed",i=_t(e,!0,o,t);let a={scrollLeft:0,scrollTop:0};const c=Le(0);function u(){c.x=Ms(s)}if(r||!r&&!o)if((Bt(t)!=="body"||on(s))&&(a=Un(t)),r){const d=_t(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?qi(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 wr(e){return Ie(e).position==="static"}function po(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 Xi(e,t){const n=Ce(e);if(Bn(e))return n;if(!He(e)){let s=ht(e);for(;s&&!Dt(s);){if(ke(s)&&!wr(s))return s;s=ht(s)}return n}let r=po(e,t);for(;r&&wd(r)&&wr(r);)r=po(r,t);return r&&Dt(r)&&wr(r)&&!bs(r)?n:r||_d(e)||n}const Id=async function(e){const t=this.getOffsetParent||Xi,n=this.getDimensions,r=await n(e.floating);return{reference:kd(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Pd(e){return Ie(e).direction==="rtl"}const Od={convertOffsetParentRelativeRectToViewportRelativeRect:bd,getDocumentElement:ze,getClippingRect:jd,getOffsetParent:Xi,getElementRects:Id,getClientRects:Rd,getDimensions:Ad,getScale:Ot,isElement:ke,isRTL:Pd};function Yi(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Fd(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,mt(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&&!Yi(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 Dd(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=Es(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?Fd(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?_t(e):null;c&&y();function y(){const x=_t(e);h&&!Yi(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 $d=pd,Ld=vd,Vd=gd,Hd=yd,zd=md,vo=fd,Gd=xd,Bd=(e,t,n)=>{const r=new Map,s={platform:Od,...n},o={...s.platform,_c:r};return dd(e,t,{...s,platform:o})};var Ud=typeof document<"u",Wd=function(){},Rn=Ud?p.useLayoutEffect:Wd;function kn(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(!kn(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)&&!kn(e[o],t[o]))return!1}return!0}return e!==e&&t!==t}function Ji(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function xo(e,t){const n=Ji(e);return Math.round(t*n)/n}function _r(e){const t=p.useRef(e);return Rn(()=>{t.current=e}),t}function Zd(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);kn(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=_r(c),Z=_r(s),X=_r(u),z=p.useCallback(()=>{if(!M.current||!E.current)return;const j={placement:t,strategy:n,middleware:g};Z.current&&(j.platform=Z.current),Bd(M.current,E.current,j).then(R=>{const V={...R,isPositioned:X.current!==!1};U.current&&!kn(N.current,V)&&(N.current=V,Rl.flushSync(()=>{m(V)}))})},[g,t,n,Z,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=xo(W.floating,f.x),V=xo(W.floating,f.y);return a?{...j,transform:"translate("+R+"px, "+V+"px)",...Ji(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 qd=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?vo({element:r.current,padding:s}).fn(n):{}:r?vo({element:r,padding:s}).fn(n):{}}}},Kd=(e,t)=>({...$d(e),options:[e,t]}),Xd=(e,t)=>({...Ld(e),options:[e,t]}),Yd=(e,t)=>({...Gd(e),options:[e,t]}),Jd=(e,t)=>({...Vd(e),options:[e,t]}),Qd=(e,t)=>({...Hd(e),options:[e,t]}),ef=(e,t)=>({...zd(e),options:[e,t]}),tf=(e,t)=>({...qd(e),options:[e,t]});var nf="Arrow",Qi=p.forwardRef((e,t)=>{const{children:n,width:r=10,height:s=5,...o}=e;return l.jsx(se.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"})})});Qi.displayName=nf;var rf=Qi,Ns="Popper",[ea,ta]=bt(Ns),[sf,na]=ea(Ns),ra=e=>{const{__scopePopper:t,children:n}=e,[r,s]=p.useState(null);return l.jsx(sf,{scope:t,anchor:r,onAnchorChange:s,children:n})};ra.displayName=Ns;var sa="PopperAnchor",oa=p.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...s}=e,o=na(sa,n),i=p.useRef(null),a=ge(t,i);return p.useEffect(()=>{o.onAnchorChange((r==null?void 0:r.current)||i.current)}),r?null:l.jsx(se.div,{...s,ref:a})});oa.displayName=sa;var Ts="PopperContent",[of,af]=ea(Ts),ia=p.forwardRef((e,t)=>{var Ee,xt,xe,je,Ut,Qn;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=na(Ts,n),[x,w]=p.useState(null),_=ge(t,J=>w(J)),[S,C]=p.useState(null),M=gi(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},Z=Array.isArray(u)?u:[u],X=Z.length>0,z={padding:F,boundary:Z.filter(cf),altBoundary:X},{refs:U,floatingStyles:te,placement:W,isPositioned:D,middlewareData:j}=Zd({strategy:"fixed",placement:H,whileElementsMounted:(...J)=>Dd(...J,{animationFrame:d==="always"}),elements:{reference:y.anchor},middleware:[Kd({mainAxis:s+N,alignmentAxis:i}),c&&Xd({mainAxis:!0,crossAxis:!1,limiter:m==="partial"?Yd():void 0,...z}),c&&Jd({...z}),Qd({...z,apply:({elements:J,rects:ee,availableWidth:ue,availableHeight:ne})=>{const{width:_e,height:rt}=ee.reference,oe=J.floating.style;oe.setProperty("--radix-popper-available-width",`${ue}px`),oe.setProperty("--radix-popper-available-height",`${ne}px`),oe.setProperty("--radix-popper-anchor-width",`${_e}px`),oe.setProperty("--radix-popper-anchor-height",`${rt}px`)}}),S&&tf({element:S,padding:a}),uf({arrowWidth:E,arrowHeight:N}),g&&ef({strategy:"referenceHidden",...z})]}),[R,V]=ca(W),Q=Je(v);ft(()=>{D&&(Q==null||Q())},[D,Q]);const ie=(Ee=j.arrow)==null?void 0:Ee.x,ye=(xt=j.arrow)==null?void 0:xt.y,we=((xe=j.arrow)==null?void 0:xe.centerOffset)!==0,[Ge,Pe]=p.useState();return ft(()=>{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(" "),...((Qn=j.hide)==null?void 0:Qn.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:l.jsx(of,{scope:n,placedSide:R,onArrowChange:C,arrowX:ie,arrowY:ye,shouldHideArrow:we,children:l.jsx(se.div,{"data-side":R,"data-align":V,...h,ref:_,style:{...h.style,animation:D?void 0:"none"}})})})});ia.displayName=Ts;var aa="PopperArrow",lf={top:"bottom",right:"left",bottom:"top",left:"right"},la=p.forwardRef(function(t,n){const{__scopePopper:r,...s}=t,o=af(aa,r),i=lf[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(rf,{...s,ref:n,style:{...s.style,display:"block"}})})});la.displayName=aa;function cf(e){return e!==null}var uf=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]=ca(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 ca(e){const[t,n="center"]=e.split("-");return[t,n]}var df=ra,ff=oa,gf=ia,mf=la,hf="Portal",ua=p.forwardRef((e,t)=>{var a;const{container:n,...r}=e,[s,o]=p.useState(!1);ft(()=>o(!0),[]);const i=n||s&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return i?El.createPortal(l.jsx(se.div,{...r,ref:t}),i):null});ua.displayName=hf;var Sr="rovingFocusGroup.onEntryFocus",pf={bubbles:!1,cancelable:!0},an="RovingFocusGroup",[Kr,da,vf]=Di(an),[xf,Wn]=bt(an,[vf]),[yf,wf]=xf(an),fa=p.forwardRef((e,t)=>l.jsx(Kr.Provider,{scope:e.__scopeRovingFocusGroup,children:l.jsx(Kr.Slot,{scope:e.__scopeRovingFocusGroup,children:l.jsx(_f,{...e,ref:t})})}));fa.displayName=an;var _f=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=ge(t,g),v=ws(o),[h,y]=Vn({prop:i,defaultProp:a??null,onChange:c,caller:an}),[x,w]=p.useState(!1),_=Je(u),S=da(n),C=p.useRef(!1),[M,E]=p.useState(0);return p.useEffect(()=>{const N=g.current;if(N)return N.addEventListener(Sr,_),()=>N.removeEventListener(Sr,_)},[_]),l.jsx(yf,{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(se.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(Sr,pf);if(N.currentTarget.dispatchEvent(F),!F.defaultPrevented){const Z=S().filter(W=>W.focusable),X=Z.find(W=>W.active),z=Z.find(W=>W.id===h),te=[X,z,...Z].filter(Boolean).map(W=>W.ref.current);ha(te,f)}}C.current=!1}),onBlur:G(e.onBlur,()=>w(!1))})})}),ga="RovingFocusGroupItem",ma=p.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:s=!1,tabStopId:o,children:i,...a}=e,c=Nn(),u=o||c,f=wf(ga,n),m=f.currentTabStopId===u,g=da(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(se.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=bf(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?Rf(_,S+1):_.slice(S+1)}setTimeout(()=>ha(_))}}),children:typeof i=="function"?i({isCurrentTabStop:m,hasTabStop:h!=null}):i})})});ma.displayName=ga;var Sf={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Cf(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function bf(e,t,n){const r=Cf(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return Sf[r]}function ha(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function Rf(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var pa=fa,va=ma,Ef=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={},Cr=0,xa=function(e){return e&&(e.host||xa(e.parentNode))},Mf=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=xa(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})},Nf=function(e,t,n,r){var s=Mf(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(),Cr++,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)}),Cr--,Cr||(Nt=new WeakMap,Nt=new WeakMap,yn=new WeakMap,wn={})}},Tf=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),s=Ef(e);return s?(r.push.apply(r,Array.from(s.querySelectorAll("[aria-live], script"))),Nf(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 ya(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 jf(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",Af="with-scroll-bars-hidden",kf="--removed-body-scroll-bar-size";function br(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function If(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 Pf=typeof window<"u"?p.useLayoutEffect:p.useEffect,yo=new WeakMap;function Of(e,t){var n=If(null,function(r){return e.forEach(function(s){return br(s,r)})});return Pf(function(){var r=yo.get(n);if(r){var s=new Set(r),o=new Set(e),i=n.current;s.forEach(function(a){o.has(a)||br(a,null)}),o.forEach(function(a){s.has(a)||br(a,i)})}yo.set(n,e)},[e]),n}function Ff(e){return e}function Df(e,t){t===void 0&&(t=Ff);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 $f(e){e===void 0&&(e={});var t=Df(null);return t.options=De({async:!0,ssr:!1},e),t}var wa=function(e){var t=e.sideCar,n=ya(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))};wa.isSideCarExport=!0;function Lf(e,t){return e.useMedium(t),wa}var _a=$f(),Rr=function(){},Zn=p.forwardRef(function(e,t){var n=p.useRef(null),r=p.useState({onScrollCapture:Rr,onWheelCapture:Rr,onTouchMoveCapture:Rr}),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=ya(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),C=g,M=Of([n,t]),E=De(De({},S),s);return p.createElement(p.Fragment,null,f&&p.createElement(C,{sideCar:_a,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 Vf=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function Hf(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=Vf();return t&&e.setAttribute("nonce",t),e}function zf(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function Gf(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var Bf=function(){var e=0,t=null;return{add:function(n){e==0&&(t=Hf())&&(zf(t,n),Gf(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Uf=function(){var e=Bf();return function(t,n){p.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Sa=function(){var e=Uf(),t=function(n){var r=n.styles,s=n.dynamic;return e(r,s),null};return t},Wf={left:0,top:0,right:0,gap:0},Er=function(e){return parseInt(e||"",10)||0},Zf=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[Er(n),Er(r),Er(s)]},qf=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return Wf;var t=Zf(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])}},Kf=Sa(),Ft="data-scroll-locked",Xf=function(e,t,n,r){var s=e.left,o=e.top,i=e.right,a=e.gap;return n===void 0&&(n="margin"),`
|
|
75
|
+
*/function no(e,t){return e?Pu(e)?p.createElement(e,t):e:null}function Pu(e){return Ou(e)||typeof e=="function"||Fu(e)}function Ou(e){return typeof e=="function"&&(()=>{const t=Object.getPrototypeOf(e);return t.prototype&&t.prototype.isReactComponent})()}function Fu(e){return typeof e=="object"&&typeof e.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(e.$$typeof.description)}function Du(e){const t={state:{},onStateChange:()=>{},renderFallbackValue:null,...e},[n]=p.useState(()=>({current:Ru(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 Di(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=jr(a),u=Oe.forwardRef((h,y)=>{const{scope:x,children:w}=h,_=o(a,x),S=ge(y,_.collectionRef);return l.jsx(c,{ref:S,children:w})});u.displayName=a;const f=e+"CollectionItemSlot",m="data-radix-collection-item",g=jr(f),d=Oe.forwardRef((h,y)=>{const{scope:x,children:w,..._}=h,S=Oe.useRef(null),C=ge(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 $u=p.createContext(void 0);function ws(e){const t=p.useContext($u);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 Lu(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 Vu="DismissableLayer",Ur="dismissableLayer.update",Hu="dismissableLayer.pointerDownOutside",zu="dismissableLayer.focusOutside",ro,$i=p.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Li=p.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:s,onFocusOutside:o,onInteractOutside:i,onDismiss:a,...c}=e,u=p.useContext($i),[f,m]=p.useState(null),g=(f==null?void 0:f.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,d]=p.useState({}),v=ge(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=Uu(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=Wu(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 Lu(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&&(ro=g.body.style.pointerEvents,g.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(f)),u.layers.add(f),so(),()=>{n&&u.layersWithOutsidePointerEventsDisabled.size===1&&(g.body.style.pointerEvents=ro)}},[f,g,n,u]),p.useEffect(()=>()=>{f&&(u.layers.delete(f),u.layersWithOutsidePointerEventsDisabled.delete(f),so())},[f,u]),p.useEffect(()=>{const E=()=>d({});return document.addEventListener(Ur,E),()=>document.removeEventListener(Ur,E)},[]),l.jsx(se.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)})});Li.displayName=Vu;var Gu="DismissableLayerBranch",Bu=p.forwardRef((e,t)=>{const n=p.useContext($i),r=p.useRef(null),s=ge(t,r);return p.useEffect(()=>{const o=r.current;if(o)return n.branches.add(o),()=>{n.branches.delete(o)}},[n.branches]),l.jsx(se.div,{...e,ref:s})});Bu.displayName=Gu;function Uu(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(){Vi(Hu,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 Wu(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&&Vi(zu,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 so(){const e=new CustomEvent(Ur);document.dispatchEvent(e)}function Vi(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?ri(s,o):s.dispatchEvent(o)}var vr=0;function Zu(){p.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??oo()),document.body.insertAdjacentElement("beforeend",e[1]??oo()),vr++,()=>{vr===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),vr--}},[])}function oo(){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 xr="focusScope.autoFocusOnMount",yr="focusScope.autoFocusOnUnmount",io={bubbles:!1,cancelable:!0},qu="FocusScope",Hi=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=ge(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:st(m.current,{select:!0})},y=function(_){if(d.paused||!a)return;const S=_.relatedTarget;S!==null&&(a.contains(S)||st(m.current,{select:!0}))},x=function(_){if(document.activeElement===document.body)for(const C of _)C.removedNodes.length>0&&st(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){lo.add(d);const h=document.activeElement;if(!a.contains(h)){const x=new CustomEvent(xr,io);a.addEventListener(xr,u),a.dispatchEvent(x),x.defaultPrevented||(Ku(ed(zi(a)),{select:!0}),document.activeElement===h&&st(a))}return()=>{a.removeEventListener(xr,u),setTimeout(()=>{const x=new CustomEvent(yr,io);a.addEventListener(yr,f),a.dispatchEvent(x),x.defaultPrevented||st(h??document.body,{select:!0}),a.removeEventListener(yr,f),lo.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]=Xu(w);_&&S?!h.shiftKey&&x===S?(h.preventDefault(),n&&st(_,{select:!0})):h.shiftKey&&x===_&&(h.preventDefault(),n&&st(S,{select:!0})):x===w&&h.preventDefault()}},[n,r,d.paused]);return l.jsx(se.div,{tabIndex:-1,...i,ref:g,onKeyDown:v})});Hi.displayName=qu;function Ku(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(st(r,{select:t}),document.activeElement!==n)return}function Xu(e){const t=zi(e),n=ao(t,e),r=ao(t.reverse(),e);return[n,r]}function zi(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 ao(e,t){for(const n of e)if(!Yu(n,{upTo:t}))return n}function Yu(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 Ju(e){return e instanceof HTMLInputElement&&"select"in e}function st(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&Ju(e)&&t&&e.select()}}var lo=Qu();function Qu(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=co(e,t),e.unshift(t)},remove(t){var n;e=co(e,t),(n=e[0])==null||n.resume()}}}function co(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function ed(e){return e.filter(t=>t.tagName!=="A")}var td=ti[" useId ".trim().toString()]||(()=>{}),nd=0;function Nn(e){const[t,n]=p.useState(td());return ft(()=>{n(r=>r??String(nd++))},[e]),e||(t?`radix-${t}`:"")}const rd=["top","right","bottom","left"],mt=Math.min,Se=Math.max,Tn=Math.round,xn=Math.floor,Le=e=>({x:e,y:e}),sd={left:"right",right:"left",bottom:"top",top:"bottom"},od={start:"end",end:"start"};function Wr(e,t,n){return Se(e,mt(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 _s(e){return e==="x"?"y":"x"}function Ss(e){return e==="y"?"height":"width"}function $e(e){return["top","bottom"].includes(et(e))?"y":"x"}function Cs(e){return _s($e(e))}function id(e,t,n){n===void 0&&(n=!1);const r=Gt(e),s=Cs(e),o=Ss(s);let i=s==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(i=jn(i)),[i,jn(i)]}function ad(e){const t=jn(e);return[Zr(e),t,Zr(t)]}function Zr(e){return e.replace(/start|end/g,t=>od[t])}function ld(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 cd(e,t,n,r){const s=Gt(e);let o=ld(et(e),n==="start",r);return s&&(o=o.map(i=>i+"-"+s),t&&(o=o.concat(o.map(Zr)))),o}function jn(e){return e.replace(/left|right|bottom|top/g,t=>sd[t])}function ud(e){return{top:0,right:0,bottom:0,left:0,...e}}function Gi(e){return typeof e!="number"?ud(e):{top:e,right:e,bottom:e,left:e}}function An(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 uo(e,t,n){let{reference:r,floating:s}=e;const o=$e(t),i=Cs(t),a=Ss(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 dd=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}=uo(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}=uo(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=Gi(d),y=a[g?m==="floating"?"reference":"floating":m],x=An(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=An(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 fd=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=Gi(f),g={x:n,y:r},d=Cs(s),v=Ss(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=mt(m[x],H),Z=mt(m[w],H),X=F,z=E-h[v]-Z,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:Z)-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}}}),gd=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?[jn(a)]:ad(a)),M=v!=="none";!g&&M&&C.push(...cd(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=id(s,i,S);H.push(N[U[0]],N[U[1]])}if(F=[...F,{placement:s,overflows:H}],!H.every(U=>U<=0)){var Z,X;const U=(((Z=o.flip)==null?void 0:Z.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 fo(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function go(e){return rd.some(t=>e[t]>=0)}const md=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=fo(o,n.reference);return{data:{referenceHiddenOffsets:i,referenceHidden:go(i)}}}case"escaped":{const o=await Jt(t,{...s,altBoundary:!0}),i=fo(o,n.floating);return{data:{escapedOffsets:i,escaped:go(i)}}}default:return{}}}}};async function hd(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 pd=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 hd(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}}}}},vd=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=_s(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}}}}}},xd=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=_s(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}}}},yd=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=mt(h-f[y],w),C=mt(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),Z=Se(f.right,0),X=Se(f.top,0),z=Se(f.bottom,0);d?N=v-2*(F!==0||Z!==0?F+Z: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 Gn(){return typeof window<"u"}function Bt(e){return Bi(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=(Bi(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Bi(e){return Gn()?e instanceof Node||e instanceof Ce(e).Node:!1}function ke(e){return Gn()?e instanceof Element||e instanceof Ce(e).Element:!1}function He(e){return Gn()?e instanceof HTMLElement||e instanceof Ce(e).HTMLElement:!1}function mo(e){return!Gn()||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 wd(e){return["table","td","th"].includes(Bt(e))}function Bn(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function bs(e){const t=Rs(),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 _d(e){let t=ht(e);for(;He(t)&&!Dt(t);){if(bs(t))return t;if(Bn(t))return null;t=ht(t)}return null}function Rs(){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 Un(e){return ke(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function ht(e){if(Bt(e)==="html")return e;const t=e.assignedSlot||e.parentNode||mo(e)&&e.host||ze(e);return mo(t)?t.host:t}function Ui(e){const t=ht(e);return Dt(t)?e.ownerDocument?e.ownerDocument.body:e.body:He(t)&&on(t)?t:Ui(t)}function Qt(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const s=Ui(e),o=s===((r=e.ownerDocument)==null?void 0:r.body),i=Ce(s);if(o){const a=qr(i);return t.concat(i,i.visualViewport||[],on(s)?s:[],a&&n?Qt(a):[])}return t.concat(s,Qt(s,[],n))}function qr(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Wi(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=Tn(n)!==o||Tn(r)!==i;return a&&(n=o,r=i),{width:n,height:r,$:a}}function Es(e){return ke(e)?e:e.contextElement}function Ot(e){const t=Es(e);if(!He(t))return Le(1);const n=t.getBoundingClientRect(),{width:r,height:s,$:o}=Wi(t);let i=(o?Tn(n.width):n.width)/r,a=(o?Tn(n.height):n.height)/s;return(!i||!Number.isFinite(i))&&(i=1),(!a||!Number.isFinite(a))&&(a=1),{x:i,y:a}}const Sd=Le(0);function Zi(e){const t=Ce(e);return!Rs()||!t.visualViewport?Sd:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Cd(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Ce(e)?!1:t}function _t(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const s=e.getBoundingClientRect(),o=Es(e);let i=Le(1);t&&(r?ke(r)&&(i=Ot(r)):i=Ot(e));const a=Cd(o,n,r)?Zi(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=qr(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=qr(v)}}return An({width:f,height:m,x:c,y:u})}function Ms(e,t){const n=Un(e).scrollLeft;return t?t.left+n:_t(ze(e)).left+n}function qi(e,t,n){n===void 0&&(n=!1);const r=e.getBoundingClientRect(),s=r.left+t.scrollLeft-(n?0:Ms(e,r)),o=r.top+t.scrollTop;return{x:s,y:o}}function bd(e){let{elements:t,rect:n,offsetParent:r,strategy:s}=e;const o=s==="fixed",i=ze(r),a=t?Bn(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=Un(r)),He(r))){const d=_t(r);u=Ot(r),f.x=d.x+r.clientLeft,f.y=d.y+r.clientTop}const g=i&&!m&&!o?qi(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 Rd(e){return Array.from(e.getClientRects())}function Ed(e){const t=ze(e),n=Un(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+Ms(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 Md(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=Rs();(!u||u&&t==="fixed")&&(a=s.offsetLeft,c=s.offsetTop)}return{width:o,height:i,x:a,y:c}}function Nd(e,t){const n=_t(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 ho(e,t,n){let r;if(t==="viewport")r=Md(e,n);else if(t==="document")r=Ed(ze(e));else if(ke(t))r=Nd(t,n);else{const s=Zi(e);r={x:t.x-s.x,y:t.y-s.y,width:t.width,height:t.height}}return An(r)}function Ki(e,t){const n=ht(e);return n===t||!ke(n)||Dt(n)?!1:Ie(n).position==="fixed"||Ki(n,t)}function Td(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?ht(e):e;for(;ke(i)&&!Dt(i);){const a=Ie(i),c=bs(i);!c&&a.position==="fixed"&&(s=null),(o?!c&&!s:!c&&a.position==="static"&&!!s&&["absolute","fixed"].includes(s.position)||on(i)&&!c&&Ki(e,i))?r=r.filter(f=>f!==i):s=a,i=ht(i)}return t.set(e,r),r}function jd(e){let{element:t,boundary:n,rootBoundary:r,strategy:s}=e;const i=[...n==="clippingAncestors"?Bn(t)?[]:Td(t,this._c):[].concat(n),r],a=i[0],c=i.reduce((u,f)=>{const m=ho(t,f,s);return u.top=Se(m.top,u.top),u.right=mt(m.right,u.right),u.bottom=mt(m.bottom,u.bottom),u.left=Se(m.left,u.left),u},ho(t,a,s));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function Ad(e){const{width:t,height:n}=Wi(e);return{width:t,height:n}}function kd(e,t,n){const r=He(t),s=ze(t),o=n==="fixed",i=_t(e,!0,o,t);let a={scrollLeft:0,scrollTop:0};const c=Le(0);function u(){c.x=Ms(s)}if(r||!r&&!o)if((Bt(t)!=="body"||on(s))&&(a=Un(t)),r){const d=_t(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?qi(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 wr(e){return Ie(e).position==="static"}function po(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 Xi(e,t){const n=Ce(e);if(Bn(e))return n;if(!He(e)){let s=ht(e);for(;s&&!Dt(s);){if(ke(s)&&!wr(s))return s;s=ht(s)}return n}let r=po(e,t);for(;r&&wd(r)&&wr(r);)r=po(r,t);return r&&Dt(r)&&wr(r)&&!bs(r)?n:r||_d(e)||n}const Id=async function(e){const t=this.getOffsetParent||Xi,n=this.getDimensions,r=await n(e.floating);return{reference:kd(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Pd(e){return Ie(e).direction==="rtl"}const Od={convertOffsetParentRelativeRectToViewportRelativeRect:bd,getDocumentElement:ze,getClippingRect:jd,getOffsetParent:Xi,getElementRects:Id,getClientRects:Rd,getDimensions:Ad,getScale:Ot,isElement:ke,isRTL:Pd};function Yi(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Fd(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,mt(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&&!Yi(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 Dd(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=Es(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?Fd(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?_t(e):null;c&&y();function y(){const x=_t(e);h&&!Yi(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 $d=pd,Ld=vd,Vd=gd,Hd=yd,zd=md,vo=fd,Gd=xd,Bd=(e,t,n)=>{const r=new Map,s={platform:Od,...n},o={...s.platform,_c:r};return dd(e,t,{...s,platform:o})};var Ud=typeof document<"u",Wd=function(){},Rn=Ud?p.useLayoutEffect:Wd;function kn(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(!kn(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)&&!kn(e[o],t[o]))return!1}return!0}return e!==e&&t!==t}function Ji(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function xo(e,t){const n=Ji(e);return Math.round(t*n)/n}function _r(e){const t=p.useRef(e);return Rn(()=>{t.current=e}),t}function Zd(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);kn(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=_r(c),Z=_r(s),X=_r(u),z=p.useCallback(()=>{if(!M.current||!E.current)return;const j={placement:t,strategy:n,middleware:g};Z.current&&(j.platform=Z.current),Bd(M.current,E.current,j).then(R=>{const V={...R,isPositioned:X.current!==!1};U.current&&!kn(N.current,V)&&(N.current=V,Rl.flushSync(()=>{m(V)}))})},[g,t,n,Z,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=xo(W.floating,f.x),V=xo(W.floating,f.y);return a?{...j,transform:"translate("+R+"px, "+V+"px)",...Ji(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 qd=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?vo({element:r.current,padding:s}).fn(n):{}:r?vo({element:r,padding:s}).fn(n):{}}}},Kd=(e,t)=>({...$d(e),options:[e,t]}),Xd=(e,t)=>({...Ld(e),options:[e,t]}),Yd=(e,t)=>({...Gd(e),options:[e,t]}),Jd=(e,t)=>({...Vd(e),options:[e,t]}),Qd=(e,t)=>({...Hd(e),options:[e,t]}),ef=(e,t)=>({...zd(e),options:[e,t]}),tf=(e,t)=>({...qd(e),options:[e,t]});var nf="Arrow",Qi=p.forwardRef((e,t)=>{const{children:n,width:r=10,height:s=5,...o}=e;return l.jsx(se.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"})})});Qi.displayName=nf;var rf=Qi,Ns="Popper",[ea,ta]=bt(Ns),[sf,na]=ea(Ns),ra=e=>{const{__scopePopper:t,children:n}=e,[r,s]=p.useState(null);return l.jsx(sf,{scope:t,anchor:r,onAnchorChange:s,children:n})};ra.displayName=Ns;var sa="PopperAnchor",oa=p.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...s}=e,o=na(sa,n),i=p.useRef(null),a=ge(t,i);return p.useEffect(()=>{o.onAnchorChange((r==null?void 0:r.current)||i.current)}),r?null:l.jsx(se.div,{...s,ref:a})});oa.displayName=sa;var Ts="PopperContent",[of,af]=ea(Ts),ia=p.forwardRef((e,t)=>{var Ee,xt,xe,je,Ut,Qn;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=na(Ts,n),[x,w]=p.useState(null),_=ge(t,J=>w(J)),[S,C]=p.useState(null),M=gi(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},Z=Array.isArray(u)?u:[u],X=Z.length>0,z={padding:F,boundary:Z.filter(cf),altBoundary:X},{refs:U,floatingStyles:te,placement:W,isPositioned:D,middlewareData:j}=Zd({strategy:"fixed",placement:H,whileElementsMounted:(...J)=>Dd(...J,{animationFrame:d==="always"}),elements:{reference:y.anchor},middleware:[Kd({mainAxis:s+N,alignmentAxis:i}),c&&Xd({mainAxis:!0,crossAxis:!1,limiter:m==="partial"?Yd():void 0,...z}),c&&Jd({...z}),Qd({...z,apply:({elements:J,rects:ee,availableWidth:ue,availableHeight:ne})=>{const{width:_e,height:rt}=ee.reference,oe=J.floating.style;oe.setProperty("--radix-popper-available-width",`${ue}px`),oe.setProperty("--radix-popper-available-height",`${ne}px`),oe.setProperty("--radix-popper-anchor-width",`${_e}px`),oe.setProperty("--radix-popper-anchor-height",`${rt}px`)}}),S&&tf({element:S,padding:a}),uf({arrowWidth:E,arrowHeight:N}),g&&ef({strategy:"referenceHidden",...z})]}),[R,V]=ca(W),Q=Je(v);ft(()=>{D&&(Q==null||Q())},[D,Q]);const ae=(Ee=j.arrow)==null?void 0:Ee.x,ye=(xt=j.arrow)==null?void 0:xt.y,we=((xe=j.arrow)==null?void 0:xe.centerOffset)!==0,[Ge,Pe]=p.useState();return ft(()=>{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(" "),...((Qn=j.hide)==null?void 0:Qn.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:l.jsx(of,{scope:n,placedSide:R,onArrowChange:C,arrowX:ae,arrowY:ye,shouldHideArrow:we,children:l.jsx(se.div,{"data-side":R,"data-align":V,...h,ref:_,style:{...h.style,animation:D?void 0:"none"}})})})});ia.displayName=Ts;var aa="PopperArrow",lf={top:"bottom",right:"left",bottom:"top",left:"right"},la=p.forwardRef(function(t,n){const{__scopePopper:r,...s}=t,o=af(aa,r),i=lf[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(rf,{...s,ref:n,style:{...s.style,display:"block"}})})});la.displayName=aa;function cf(e){return e!==null}var uf=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]=ca(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 ca(e){const[t,n="center"]=e.split("-");return[t,n]}var df=ra,ff=oa,gf=ia,mf=la,hf="Portal",ua=p.forwardRef((e,t)=>{var a;const{container:n,...r}=e,[s,o]=p.useState(!1);ft(()=>o(!0),[]);const i=n||s&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return i?El.createPortal(l.jsx(se.div,{...r,ref:t}),i):null});ua.displayName=hf;var Sr="rovingFocusGroup.onEntryFocus",pf={bubbles:!1,cancelable:!0},an="RovingFocusGroup",[Kr,da,vf]=Di(an),[xf,Wn]=bt(an,[vf]),[yf,wf]=xf(an),fa=p.forwardRef((e,t)=>l.jsx(Kr.Provider,{scope:e.__scopeRovingFocusGroup,children:l.jsx(Kr.Slot,{scope:e.__scopeRovingFocusGroup,children:l.jsx(_f,{...e,ref:t})})}));fa.displayName=an;var _f=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=ge(t,g),v=ws(o),[h,y]=Vn({prop:i,defaultProp:a??null,onChange:c,caller:an}),[x,w]=p.useState(!1),_=Je(u),S=da(n),C=p.useRef(!1),[M,E]=p.useState(0);return p.useEffect(()=>{const N=g.current;if(N)return N.addEventListener(Sr,_),()=>N.removeEventListener(Sr,_)},[_]),l.jsx(yf,{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(se.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(Sr,pf);if(N.currentTarget.dispatchEvent(F),!F.defaultPrevented){const Z=S().filter(W=>W.focusable),X=Z.find(W=>W.active),z=Z.find(W=>W.id===h),te=[X,z,...Z].filter(Boolean).map(W=>W.ref.current);ha(te,f)}}C.current=!1}),onBlur:G(e.onBlur,()=>w(!1))})})}),ga="RovingFocusGroupItem",ma=p.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:s=!1,tabStopId:o,children:i,...a}=e,c=Nn(),u=o||c,f=wf(ga,n),m=f.currentTabStopId===u,g=da(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(se.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=bf(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?Rf(_,S+1):_.slice(S+1)}setTimeout(()=>ha(_))}}),children:typeof i=="function"?i({isCurrentTabStop:m,hasTabStop:h!=null}):i})})});ma.displayName=ga;var Sf={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Cf(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function bf(e,t,n){const r=Cf(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return Sf[r]}function ha(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function Rf(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var pa=fa,va=ma,Ef=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={},Cr=0,xa=function(e){return e&&(e.host||xa(e.parentNode))},Mf=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=xa(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})},Nf=function(e,t,n,r){var s=Mf(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(),Cr++,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)}),Cr--,Cr||(Nt=new WeakMap,Nt=new WeakMap,yn=new WeakMap,wn={})}},Tf=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),s=Ef(e);return s?(r.push.apply(r,Array.from(s.querySelectorAll("[aria-live], script"))),Nf(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 ya(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 jf(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",Af="with-scroll-bars-hidden",kf="--removed-body-scroll-bar-size";function br(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function If(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 Pf=typeof window<"u"?p.useLayoutEffect:p.useEffect,yo=new WeakMap;function Of(e,t){var n=If(null,function(r){return e.forEach(function(s){return br(s,r)})});return Pf(function(){var r=yo.get(n);if(r){var s=new Set(r),o=new Set(e),i=n.current;s.forEach(function(a){o.has(a)||br(a,null)}),o.forEach(function(a){s.has(a)||br(a,i)})}yo.set(n,e)},[e]),n}function Ff(e){return e}function Df(e,t){t===void 0&&(t=Ff);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 $f(e){e===void 0&&(e={});var t=Df(null);return t.options=De({async:!0,ssr:!1},e),t}var wa=function(e){var t=e.sideCar,n=ya(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))};wa.isSideCarExport=!0;function Lf(e,t){return e.useMedium(t),wa}var _a=$f(),Rr=function(){},Zn=p.forwardRef(function(e,t){var n=p.useRef(null),r=p.useState({onScrollCapture:Rr,onWheelCapture:Rr,onTouchMoveCapture:Rr}),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=ya(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),C=g,M=Of([n,t]),E=De(De({},S),s);return p.createElement(p.Fragment,null,f&&p.createElement(C,{sideCar:_a,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 Vf=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function Hf(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=Vf();return t&&e.setAttribute("nonce",t),e}function zf(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function Gf(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var Bf=function(){var e=0,t=null;return{add:function(n){e==0&&(t=Hf())&&(zf(t,n),Gf(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Uf=function(){var e=Bf();return function(t,n){p.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Sa=function(){var e=Uf(),t=function(n){var r=n.styles,s=n.dynamic;return e(r,s),null};return t},Wf={left:0,top:0,right:0,gap:0},Er=function(e){return parseInt(e||"",10)||0},Zf=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[Er(n),Er(r),Er(s)]},qf=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return Wf;var t=Zf(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])}},Kf=Sa(),Ft="data-scroll-locked",Xf=function(e,t,n,r){var s=e.left,o=e.top,i=e.right,a=e.gap;return n===void 0&&(n="margin"),`
|
|
76
76
|
.`.concat(Af,` {
|
|
77
77
|
overflow: hidden `).concat(r,`;
|
|
78
78
|
padding-right: `).concat(a,"px ").concat(r,`;
|
|
@@ -112,4 +112,4 @@ import{r as Cl,a as p,R as Oe,j as l,b as ti,u as ge,P as se,c as nt,d as ce,C a
|
|
|
112
112
|
`)},wo=function(){var e=parseInt(document.body.getAttribute(Ft)||"0",10);return isFinite(e)?e:0},Yf=function(){p.useEffect(function(){return document.body.setAttribute(Ft,(wo()+1).toString()),function(){var e=wo()-1;e<=0?document.body.removeAttribute(Ft):document.body.setAttribute(Ft,e.toString())}},[])},Jf=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,s=r===void 0?"margin":r;Yf();var o=p.useMemo(function(){return qf(s)},[s]);return p.createElement(Kf,{styles:Xf(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,Qf=function(e){return e.tagName==="TEXTAREA"},Ca=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!Qf(e)&&n[t]==="visible")},eg=function(e){return Ca(e,"overflowY")},tg=function(e){return Ca(e,"overflowX")},_o=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var s=ba(e,r);if(s){var o=Ra(e,r),i=o[1],a=o[2];if(i>a)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},ng=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},rg=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},ba=function(e,t){return e==="v"?eg(t):tg(t)},Ra=function(e,t){return e==="v"?ng(t):rg(t)},sg=function(e,t){return e==="h"&&t==="rtl"?-1:1},og=function(e,t,n,r,s){var o=sg(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=Ra(e,a),v=d[0],h=d[1],y=d[2],x=h-y-o*v;(v||x)&&ba(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]},So=function(e){return[e.deltaX,e.deltaY]},Co=function(e){return e&&"current"in e?e.current:e},ig=function(e,t){return e[0]===t[0]&&e[1]===t[1]},ag=function(e){return`
|
|
113
113
|
.block-interactivity-`.concat(e,` {pointer-events: none;}
|
|
114
114
|
.allow-interactivity-`).concat(e,` {pointer-events: all;}
|
|
115
|
-
`)},lg=0,jt=[];function cg(e){var t=p.useRef([]),n=p.useRef([0,0]),r=p.useRef(),s=p.useState(lg++)[0],o=p.useState(Sa)[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=jf([e.lockRef.current],(e.shards||[]).map(Co),!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=_o(E,M);if(!N)return!0;if(N?C=E:(C=E==="v"?"h":"v",N=_o(E,M)),!N)return!1;if(!r.current&&"changedTouches"in h&&(_||S)&&(r.current=C),!C)return!0;var H=r.current||C;return og(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?So(y):Sn(y),w=t.current.filter(function(C){return C.name===y.type&&(C.target===y.target||y.target===C.shadowParent)&&ig(C.delta,x)})[0];if(w&&w.should){y.cancelable&&y.preventDefault();return}if(!w){var _=(i.current.shards||[]).map(Co).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:ug(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,So(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:ag(s)}):null,d?p.createElement(Jf,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function ug(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const dg=Lf(_a,cg);var Ea=p.forwardRef(function(e,t){return p.createElement(Zn,De({},e,{ref:t,sideCar:dg}))});Ea.classNames=Zn.classNames;var Yr=["Enter"," "],fg=["ArrowDown","PageUp","Home"],Ma=["ArrowUp","PageDown","End"],gg=[...fg,...Ma],mg={ltr:[...Yr,"ArrowRight"],rtl:[...Yr,"ArrowLeft"]},hg={ltr:["ArrowLeft"],rtl:["ArrowRight"]},ln="Menu",[en,pg,vg]=Di(ln),[Et,Na]=bt(ln,[vg,ta,Wn]),qn=ta(),Ta=Wn(),[xg,Mt]=Et(ln),[yg,cn]=Et(ln),ja=e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:s,onOpenChange:o,modal:i=!0}=e,a=qn(t),[c,u]=p.useState(null),f=p.useRef(!1),m=Je(o),g=ws(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(df,{...a,children:l.jsx(xg,{scope:t,open:n,onOpenChange:m,content:c,onContentChange:u,children:l.jsx(yg,{scope:t,onClose:p.useCallback(()=>m(!1),[m]),isUsingKeyboardRef:f,dir:g,modal:i,children:r})})})};ja.displayName=ln;var wg="MenuAnchor",js=p.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,s=qn(n);return l.jsx(ff,{...s,...r,ref:t})});js.displayName=wg;var As="MenuPortal",[_g,Aa]=Et(As,{forceMount:void 0}),ka=e=>{const{__scopeMenu:t,forceMount:n,children:r,container:s}=e,o=Mt(As,t);return l.jsx(_g,{scope:t,forceMount:n,children:l.jsx(Rt,{present:n||o.open,children:l.jsx(ua,{asChild:!0,container:s,children:r})})})};ka.displayName=As;var Ne="MenuContent",[Sg,ks]=Et(Ne),Ia=p.forwardRef((e,t)=>{const n=Aa(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(Cg,{...s,ref:t}):l.jsx(bg,{...s,ref:t})})})})}),Cg=p.forwardRef((e,t)=>{const n=Mt(Ne,e.__scopeMenu),r=p.useRef(null),s=ge(t,r);return p.useEffect(()=>{const o=r.current;if(o)return Tf(o)},[]),l.jsx(Is,{...e,ref:s,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:G(e.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),bg=p.forwardRef((e,t)=>{const n=Mt(Ne,e.__scopeMenu);return l.jsx(Is,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),Rg=jr("MenuContent.ScrollLock"),Is=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=qn(n),_=Ta(n),S=pg(n),[C,M]=p.useState(null),E=p.useRef(null),N=ge(t,E,y.onContentChange),H=p.useRef(0),F=p.useRef(""),Z=p.useRef(0),X=p.useRef(null),z=p.useRef("right"),U=p.useRef(0),te=v?Ea:p.Fragment,W=v?{as:Rg,allowPinchZoom:!0}:void 0,D=R=>{var Ee,xt;const V=F.current+R,Q=S().filter(xe=>!xe.disabled),ie=document.activeElement,ye=(Ee=Q.find(xe=>xe.ref.current===ie))==null?void 0:Ee.textValue,we=Q.map(xe=>xe.textValue),Ge=Dg(we,V,ye),Pe=(xt=Q.find(xe=>xe.textValue===Ge))==null?void 0:xt.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),[]),Zu();const j=p.useCallback(R=>{var Q,ie;return z.current===((Q=X.current)==null?void 0:Q.side)&&Lg(R,(ie=X.current)==null?void 0:ie.area)},[]);return l.jsx(Sg,{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:Z,onPointerGraceIntentChange:p.useCallback(R=>{X.current=R},[]),children:l.jsx(te,{...W,children:l.jsx(Hi,{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(Li,{asChild:!0,disableOutsidePointerEvents:a,onEscapeKeyDown:u,onPointerDownOutside:f,onFocusOutside:m,onInteractOutside:g,onDismiss:d,children:l.jsx(pa,{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(gf,{role:"menu","aria-orientation":"vertical","data-state":Ka(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,ie=R.ctrlKey||R.altKey||R.metaKey,ye=R.key.length===1;Q&&(R.key==="Tab"&&R.preventDefault(),!ie&&ye&&D(R.key));const we=E.current;if(R.target!==we||!gg.includes(R.key))return;R.preventDefault();const Pe=S().filter(Ee=>!Ee.disabled).map(Ee=>Ee.ref.current);Ma.includes(R.key)&&Pe.reverse(),Og(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 ie=R.clientX>U.current?"right":"left";z.current=ie,U.current=R.clientX}}))})})})})})})});Ia.displayName=Ne;var Eg="MenuGroup",Ps=p.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return l.jsx(se.div,{role:"group",...r,ref:t})});Ps.displayName=Eg;var Mg="MenuLabel",Pa=p.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return l.jsx(se.div,{...r,ref:t})});Pa.displayName=Mg;var In="MenuItem",bo="menu.itemSelect",Kn=p.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:r,...s}=e,o=p.useRef(null),i=cn(In,e.__scopeMenu),a=ks(In,e.__scopeMenu),c=ge(t,o),u=p.useRef(!1),f=()=>{const m=o.current;if(!n&&m){const g=new CustomEvent(bo,{bubbles:!0,cancelable:!0});m.addEventListener(bo,d=>r==null?void 0:r(d),{once:!0}),ri(m,g),g.defaultPrevented?u.current=!1:i.onClose()}};return l.jsx(Oa,{...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())})})});Kn.displayName=In;var Oa=p.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:r=!1,textValue:s,...o}=e,i=ks(In,n),a=Ta(n),c=p.useRef(null),u=ge(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(va,{asChild:!0,...a,focusable:!r,children:l.jsx(se.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))})})})}),Ng="MenuCheckboxItem",Fa=p.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:r,...s}=e;return l.jsx(Ha,{scope:e.__scopeMenu,checked:n,children:l.jsx(Kn,{role:"menuitemcheckbox","aria-checked":Pn(n)?"mixed":n,...s,ref:t,"data-state":Fs(n),onSelect:G(s.onSelect,()=>r==null?void 0:r(Pn(n)?!0:!n),{checkForDefaultPrevented:!1})})})});Fa.displayName=Ng;var Da="MenuRadioGroup",[Tg,jg]=Et(Da,{value:void 0,onValueChange:()=>{}}),$a=p.forwardRef((e,t)=>{const{value:n,onValueChange:r,...s}=e,o=Je(r);return l.jsx(Tg,{scope:e.__scopeMenu,value:n,onValueChange:o,children:l.jsx(Ps,{...s,ref:t})})});$a.displayName=Da;var La="MenuRadioItem",Va=p.forwardRef((e,t)=>{const{value:n,...r}=e,s=jg(La,e.__scopeMenu),o=n===s.value;return l.jsx(Ha,{scope:e.__scopeMenu,checked:o,children:l.jsx(Kn,{role:"menuitemradio","aria-checked":o,...r,ref:t,"data-state":Fs(o),onSelect:G(r.onSelect,()=>{var i;return(i=s.onValueChange)==null?void 0:i.call(s,n)},{checkForDefaultPrevented:!1})})})});Va.displayName=La;var Os="MenuItemIndicator",[Ha,Ag]=Et(Os,{checked:!1}),za=p.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:r,...s}=e,o=Ag(Os,n);return l.jsx(Rt,{present:r||Pn(o.checked)||o.checked===!0,children:l.jsx(se.span,{...s,ref:t,"data-state":Fs(o.checked)})})});za.displayName=Os;var kg="MenuSeparator",Ga=p.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return l.jsx(se.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})});Ga.displayName=kg;var Ig="MenuArrow",Ba=p.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,s=qn(n);return l.jsx(mf,{...s,...r,ref:t})});Ba.displayName=Ig;var Pg="MenuSub",[Gh,Ua]=Et(Pg),Zt="MenuSubTrigger",Wa=p.forwardRef((e,t)=>{const n=Mt(Zt,e.__scopeMenu),r=cn(Zt,e.__scopeMenu),s=Ua(Zt,e.__scopeMenu),o=ks(Zt,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(js,{asChild:!0,...u,children:l.jsx(Oa,{id:s.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":s.contentId,"data-state":Ka(n.open),...e,ref:si(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===" "||mg[r.dir].includes(m.key)&&(n.onOpenChange(!0),(d=n.content)==null||d.focus(),m.preventDefault())})})})});Wa.displayName=Zt;var Za="MenuSubContent",qa=p.forwardRef((e,t)=>{const n=Aa(Ne,e.__scopeMenu),{forceMount:r=n.forceMount,...s}=e,o=Mt(Ne,e.__scopeMenu),i=cn(Ne,e.__scopeMenu),a=Ua(Za,e.__scopeMenu),c=p.useRef(null),u=ge(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(Is,{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=hg[i.dir].includes(f.key);m&&g&&(o.onOpenChange(!1),(d=a.trigger)==null||d.focus(),f.preventDefault())})})})})})});qa.displayName=Za;function Ka(e){return e?"open":"closed"}function Pn(e){return e==="indeterminate"}function Fs(e){return Pn(e)?"indeterminate":e?"checked":"unchecked"}function Og(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function Fg(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function Dg(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=Fg(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 $g(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 Lg(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return $g(n,t)}function tn(e){return t=>t.pointerType==="mouse"?e(t):void 0}var Vg=ja,Hg=js,zg=ka,Gg=Ia,Bg=Ps,Ug=Pa,Wg=Kn,Zg=Fa,qg=$a,Kg=Va,Xg=za,Yg=Ga,Jg=Ba,Qg=Wa,em=qa,Xn="DropdownMenu",[tm,Bh]=bt(Xn,[Na]),pe=Na(),[nm,Xa]=tm(Xn),Ya=e=>{const{__scopeDropdownMenu:t,children:n,dir:r,open:s,defaultOpen:o,onOpenChange:i,modal:a=!0}=e,c=pe(t),u=p.useRef(null),[f,m]=Vn({prop:s,defaultProp:o??!1,onChange:i,caller:Xn});return l.jsx(nm,{scope:t,triggerId:Nn(),triggerRef:u,contentId:Nn(),open:f,onOpenChange:m,onOpenToggle:p.useCallback(()=>m(g=>!g),[m]),modal:a,children:l.jsx(Vg,{...c,open:f,onOpenChange:m,dir:r,modal:a,children:n})})};Ya.displayName=Xn;var Ja="DropdownMenuTrigger",Qa=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...s}=e,o=Xa(Ja,n),i=pe(n);return l.jsx(Hg,{asChild:!0,...i,children:l.jsx(se.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:si(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())})})})});Qa.displayName=Ja;var rm="DropdownMenuPortal",el=e=>{const{__scopeDropdownMenu:t,...n}=e,r=pe(t);return l.jsx(zg,{...r,...n})};el.displayName=rm;var tl="DropdownMenuContent",nl=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Xa(tl,n),o=pe(n),i=p.useRef(!1);return l.jsx(Gg,{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)"}})});nl.displayName=tl;var sm="DropdownMenuGroup",om=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=pe(n);return l.jsx(Bg,{...s,...r,ref:t})});om.displayName=sm;var im="DropdownMenuLabel",am=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=pe(n);return l.jsx(Ug,{...s,...r,ref:t})});am.displayName=im;var lm="DropdownMenuItem",cm=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=pe(n);return l.jsx(Wg,{...s,...r,ref:t})});cm.displayName=lm;var um="DropdownMenuCheckboxItem",rl=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=pe(n);return l.jsx(Zg,{...s,...r,ref:t})});rl.displayName=um;var dm="DropdownMenuRadioGroup",fm=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=pe(n);return l.jsx(qg,{...s,...r,ref:t})});fm.displayName=dm;var gm="DropdownMenuRadioItem",mm=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=pe(n);return l.jsx(Kg,{...s,...r,ref:t})});mm.displayName=gm;var hm="DropdownMenuItemIndicator",sl=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=pe(n);return l.jsx(Xg,{...s,...r,ref:t})});sl.displayName=hm;var pm="DropdownMenuSeparator",vm=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=pe(n);return l.jsx(Yg,{...s,...r,ref:t})});vm.displayName=pm;var xm="DropdownMenuArrow",ym=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=pe(n);return l.jsx(Jg,{...s,...r,ref:t})});ym.displayName=xm;var wm="DropdownMenuSubTrigger",_m=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=pe(n);return l.jsx(Qg,{...s,...r,ref:t})});_m.displayName=wm;var Sm="DropdownMenuSubContent",Cm=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=pe(n);return l.jsx(em,{...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)"}})});Cm.displayName=Sm;var bm=Ya,Rm=Qa,Em=el,Mm=nl,Nm=rl,Tm=sl;function jm({...e}){return l.jsx(bm,{"data-slot":"dropdown-menu",...e})}function Am({...e}){return l.jsx(Rm,{"data-slot":"dropdown-menu-trigger",...e})}function km({className:e,sideOffset:t=4,...n}){return l.jsx(Em,{children:l.jsx(Mm,{"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 Im({className:e,children:t,checked:n,...r}){return l.jsxs(Nm,{"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(Tm,{children:l.jsx(Si,{className:"size-4"})})}),t]})}function Ds({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 Pm({className:e,...t}){return l.jsx("thead",{"data-slot":"table-header",className:ce("[&_tr]:border-b",e),...t})}function $s({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 Om({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 Yn({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=Du({data:t,columns:e,onSortingChange:c,onColumnFiltersChange:f,getCoreRowModel:Eu(),getPaginationRowModel:ku(),getSortedRowModel:Iu(),getFilteredRowModel:Au(),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(jm,{children:[l.jsx(Am,{asChild:!0,children:l.jsxs(Pt,{variant:"outline",className:"ml-auto",children:["Columns ",l.jsx(Ci,{className:"ml-2 h-4 w-4"})]})}),l.jsx(km,{align:"end",children:h.getAllColumns().filter(w=>w.getCanHide()).map(w=>l.jsx(Im,{className:"capitalize",checked:w.getIsVisible(),onCheckedChange:_=>w.toggleVisibility(!!_),children:w.id},w.id))})]})]}),l.jsx("div",{className:"rounded-md border",children:l.jsxs(Ds,{children:[l.jsx(Pm,{children:h.getHeaderGroups().map(w=>l.jsx(de,{children:w.headers.map(_=>l.jsx(Om,{children:_.isPlaceholder?null:no(_.column.columnDef.header,_.getContext())},_.id))},w.id))}),l.jsx($s,{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:no(_.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 re(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(Cc,{className:"ml-1 h-3 w-3 text-muted-foreground"}),s==="desc"&&l.jsx(Ci,{className:"ml-1 h-3 w-3 text-muted-foreground"})]})})}}const Fm=5*60*1e3;function ol(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>Fm&&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 Ro(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 Dm(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 $m(e){return e.length<=12?e:`${e.slice(0,5)}...${e.slice(-5)}`}function Lm(e){return e.length<=42?e:`${e.slice(0,35)}.....${e.slice(-5)}`}function Vm({metrics:e}){const t=e.sessions||[],n=ol(t),r=()=>[{accessorKey:"clientInfo",header:re("Client"),cell:({row:s})=>{const o=s.original,i=o.clientInfo?`${Lm(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:re("Session ID"),cell:({row:s})=>l.jsx("div",{className:"font-mono text-sm",title:s.getValue("id"),children:$m(s.getValue("id"))})},{accessorKey:"isConnected",header:re("Status"),cell:({row:s})=>{const o=s.original;return l.jsxs(yt,{variant:o.isConnected?"success":"secondary",className:"gap-1",children:[o.isConnected?l.jsx(Ei,{className:"h-3 w-3"}):l.jsx(Ri,{className:"h-3 w-3"}),o.isConnected?"Connected":"Disconnected"]})}},{accessorKey:"connectedAt",header:re("Connected"),cell:({row:s})=>l.jsx("div",{className:"text-sm",children:Ro(s.getValue("connectedAt"))})},{accessorKey:"requestCount",header:re("Requests","right"),cell:({row:s})=>l.jsx("div",{className:"text-right font-mono text-sm",children:s.getValue("requestCount")})},{accessorKey:"lastActivity",header:re("Last Activity"),cell:({row:s})=>l.jsx("div",{className:"text-sm",children:Ro(s.getValue("lastActivity"))})}];return l.jsxs(qe,{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:Dm(e.uptimeSeconds)})]})]}),l.jsxs(l.Fragment,{children:[l.jsx(wt,{}),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(Yn,{columns:r(),data:n,searchColumn:"id",searchPlaceholder:"Filter sessions...",pageSize:10,defaultSorting:[{id:"lastActivity",desc:!0}]})]})]})]})]})}function Eo(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 Hm(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 zm(e){return e.length<=12?e:`${e.slice(0,5)}...${e.slice(-5)}`}function Gm(e){return e.length<=42?e:`${e.slice(0,35)}.....${e.slice(-5)}`}function Bm({metrics:e}){const t=e.sessions||[],n=ol(t),r={sse:"Server-Sent Events",streamableHttp:"Streamable HTTP"},s=()=>[{accessorKey:"clientInfo",header:re("Client"),cell:({row:o})=>{const i=o.original,a=i.clientInfo?`${Gm(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:re("Session ID"),cell:({row:o})=>l.jsx("div",{className:"font-mono text-sm",title:o.getValue("id"),children:zm(o.getValue("id"))})},{accessorKey:"connectionStatus",header:re("Status"),cell:({row:o})=>{const i=o.original,a=i.connectionStatus||(i.isConnected?"Connected":"Disconnected");return a==="Connected"?l.jsxs(yt,{variant:"success",className:"gap-1",children:[l.jsx(Ei,{className:"h-3 w-3"}),"Connected"]}):a==="Distressed"?l.jsxs(yt,{variant:"destructive",className:"gap-1",children:[l.jsx(bi,{className:"h-3 w-3"}),"Distressed ",i.pingFailures?`(${i.pingFailures} failed)`:""]}):l.jsxs(yt,{variant:"secondary",className:"gap-1",children:[l.jsx(Ri,{className:"h-3 w-3"}),"Disconnected"]})}},{accessorKey:"connectedAt",header:re("Connected"),cell:({row:o})=>l.jsx("div",{className:"text-sm",children:Eo(o.getValue("connectedAt"))})},{accessorKey:"requestCount",header:re("Requests","right"),cell:({row:o})=>l.jsx("div",{className:"text-right font-mono text-sm",children:o.getValue("requestCount")})},{accessorKey:"lastActivity",header:re("Last Activity"),cell:({row:o})=>l.jsx("div",{className:"text-sm",children:Eo(o.getValue("lastActivity"))})}];return l.jsxs(qe,{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:Hm(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(wt,{}),l.jsx("div",{children:l.jsx(Ds,{children:l.jsxs($s,{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"}),l.jsx(I,{className:"text-sm font-mono",children:e.requests.averagePerMinute})]}),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(wt,{}),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(Yn,{columns:s(),data:n,searchColumn:"id",searchPlaceholder:"Filter sessions...",pageSize:10,defaultSorting:[{id:"lastActivity",desc:!0}]})]})]})]})]})}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 Um(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 Wm(e){const t=new Date,n=new Date(e),r=t.getTime()-n.getTime();return Math.floor(r/6e4)<5}function Zm(e){return e.length<=42?e:`${e.slice(0,35)}.....${e.slice(-5)}`}function qm({metrics:e}){const t=e.clients,n=()=>[{accessorKey:"name",header:re("Client"),cell:({row:r})=>{const s=r.original,o=`${Zm(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 ",Mo(s.firstSeen)]})]})}},{accessorKey:"requestCount",header:re("Initializations","right"),cell:({row:r})=>l.jsx("div",{className:"text-right font-mono text-sm",children:r.getValue("requestCount")})},{accessorKey:"isConnected",header:re("Status"),cell:({row:r})=>{const s=r.original;return l.jsx("div",{children:Wm(s.lastSeen)?l.jsxs(yt,{variant:"success",className:"gap-1",children:[l.jsx(yc,{className:"h-3 w-3"}),"Recent"]}):l.jsxs(yt,{variant:"secondary",className:"gap-1",children:[l.jsx(Rc,{className:"h-3 w-3"}),"Idle"]})})}},{accessorKey:"lastSeen",header:re("Last Seen","right"),cell:({row:r})=>l.jsx("div",{className:"text-right text-sm",children:Mo(r.getValue("lastSeen"))})}];return l.jsxs(qe,{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(yt,{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:Um(e.uptimeSeconds)})]})]}),l.jsx(wt,{}),l.jsx("div",{children:l.jsx(Ds,{children:l.jsxs($s,{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"}),l.jsx(I,{className:"text-sm font-mono",children:e.requests.averagePerMinute})]}),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(Mc,{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(wt,{}),l.jsxs("div",{children:[l.jsx("h3",{className:"text-sm font-semibold text-foreground mb-3",children:"Client Identities"}),l.jsx(Yn,{columns:n(),data:t,searchColumn:"name",searchPlaceholder:"Filter clients...",pageSize:50,defaultSorting:[{id:"lastSeen",desc:!0}]})]})]})]})]})}const Km=e=>fetch(e).then(t=>{if(!t.ok)throw new Error(`Failed to fetch: ${t.status}`);return t.json()});function Xm(){const{data:e,error:t}=Kt("/api/transport-metrics",Km,{refreshInterval:3e3,revalidateOnFocus:!0,revalidateOnReconnect:!0});return t?l.jsxs(qe,{children:[l.jsx(Ke,{children:l.jsx(Xe,{children:"📊 Transport Metrics"})}),l.jsx(Ye,{children:l.jsxs(Dc,{variant:"destructive",children:[l.jsx(bi,{className:"h-4 w-4"}),l.jsx($c,{children:"Error Loading Metrics"}),l.jsxs(Lc,{children:["Failed to load transport metrics: ",t.message]})]})})]}):e?e.transport==="stdio"?l.jsx(Vm,{metrics:e}):e.isStateless?l.jsx(qm,{metrics:e}):l.jsx(Bm,{metrics:e}):l.jsxs(qe,{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 Ym=e=>fetch(e).then(t=>{if(!t.ok)throw new Error(`Failed to fetch: ${t.status}`);return t.json()});function Jm(){const[e,t]=p.useState(!1),{data:n,error:r}=Kt("/api/transport-metrics",Ym,{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:re("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:re("Calls","right"),cell:({row:g})=>l.jsx("div",{className:"text-right font-mono",children:g.getValue("count").toLocaleString()})},{accessorKey:"errors",header:re("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:re("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:re("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:re("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:re("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(qe,{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(hs,{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(Yn,{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 No(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 Qm({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 ${No(n).isWarning?"text-red-500":""}`,children:No(n).text})]})]})})}var Jn="Tabs",[eh,Uh]=bt(Jn,[Wn]),il=Wn(),[th,Ls]=eh(Jn),al=p.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:s,defaultValue:o,orientation:i="horizontal",dir:a,activationMode:c="automatic",...u}=e,f=ws(a),[m,g]=Vn({prop:r,onChange:s,defaultProp:o??"",caller:Jn});return l.jsx(th,{scope:n,baseId:Nn(),value:m,onValueChange:g,orientation:i,dir:f,activationMode:c,children:l.jsx(se.div,{dir:f,"data-orientation":i,...u,ref:t})})});al.displayName=Jn;var ll="TabsList",cl=p.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...s}=e,o=Ls(ll,n),i=il(n);return l.jsx(pa,{asChild:!0,...i,orientation:o.orientation,dir:o.dir,loop:r,children:l.jsx(se.div,{role:"tablist","aria-orientation":o.orientation,...s,ref:t})})});cl.displayName=ll;var ul="TabsTrigger",dl=p.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:s=!1,...o}=e,i=Ls(ul,n),a=il(n),c=ml(i.baseId,r),u=hl(i.baseId,r),f=r===i.value;return l.jsx(va,{asChild:!0,...a,focusable:!s,active:f,children:l.jsx(se.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)})})})});dl.displayName=ul;var fl="TabsContent",gl=p.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:s,children:o,...i}=e,a=Ls(fl,n),c=ml(a.baseId,r),u=hl(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(se.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})})});gl.displayName=fl;function ml(e,t){return`${e}-trigger-${t}`}function hl(e,t){return`${e}-content-${t}`}var nh=al,rh=cl,sh=dl,oh=gl;function ih({className:e,...t}){return l.jsx(nh,{"data-slot":"tabs",className:ce("flex flex-col gap-2",e),...t})}function ah({className:e,...t}){return l.jsx(rh,{"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(sh,{"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(oh,{"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 To;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(To||(To={}));const A=Y.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),ot=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 lh=Jr;function ch(){return lh}const uh=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=ch(),r=uh({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"}),qt=e=>({status:"dirty",value:e}),Te=e=>({status:"valid",value:e}),jo=e=>e.status==="aborted",Ao=e=>e.status==="dirty",$t=e=>e.status==="valid",On=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 pt{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 ko=(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 ot(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:ot(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:ot(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const n=this._parse(t);if(On(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:ot(t)},s=this._parseSync({data:t,path:r.path,parent:r});return ko(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:ot(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:ot(t)},s=this._parse({data:t,path:r.path,parent:r}),o=await(On(s)?s:Promise.resolve(s));return ko(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 ut.create(this,this._def)}nullable(){return zt.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Ve.create(this)}promise(){return Ln.create(this,this._def)}or(t){return Dn.create([this,t],this._def)}and(t){return $n.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 Ih({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 Vs.create(this,t)}readonly(){return rs.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const dh=/^c[^\s-]{8,}$/i,fh=/^[0-9a-z]+$/,gh=/^[0-9A-HJKMNP-TV-Z]{26}$/i,mh=/^[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,hh=/^[a-z0-9_-]{21}$/i,ph=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,vh=/^[-+]?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)?)??$/,xh=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,yh="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Mr;const wh=/^(?:(?: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])$/,_h=/^(?:(?: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])$/,Sh=/^(([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]))$/,Ch=/^(([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])$/,bh=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Rh=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,pl="((\\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])))",Eh=new RegExp(`^${pl}$`);function vl(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 Mh(e){return new RegExp(`^${vl(e)}$`)}function Nh(e){let t=`${pl}T${vl(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 Th(e,t){return!!((t==="v4"||!t)&&wh.test(e)||(t==="v6"||!t)&&Sh.test(e))}function jh(e,t){if(!ph.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 Ah(e,t){return!!((t==="v4"||!t)&&_h.test(e)||(t==="v6"||!t)&&Ch.test(e))}class lt 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")xh.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")Mr||(Mr=new RegExp(yh,"u")),Mr.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")mh.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")hh.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")dh.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")fh.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")gh.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"?Nh(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"?Eh.test(t.data)||(s=this._getOrReturnCtx(t,s),T(s,{code:b.invalid_string,validation:"date",message:o.message}),r.dirty()):o.kind==="time"?Mh(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"?vh.test(t.data)||(s=this._getOrReturnCtx(t,s),T(s,{validation:"duration",code:b.invalid_string,message:o.message}),r.dirty()):o.kind==="ip"?Th(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"?jh(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"?Ah(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"?bh.test(t.data)||(s=this._getOrReturnCtx(t,s),T(s,{validation:"base64",code:b.invalid_string,message:o.message}),r.dirty()):o.kind==="base64url"?Rh.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 lt({...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 lt({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new lt({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new lt({...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}}lt.create=e=>new lt({checks:[],typeName:L.ZodString,coerce:(e==null?void 0:e.coerce)??!1,...B(e)});function kh(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"?kh(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 Fn 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 Fn({...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}}Fn.create=e=>new Fn({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:L.ZodDate,...B(e)});class Io 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)}}Io.create=e=>new Io({typeName:L.ZodSymbol,...B(e)});class Po 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)}}Po.create=e=>new Po({typeName:L.ZodUndefined,...B(e)});class Oo 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)}}Oo.create=e=>new Oo({typeName:L.ZodNull,...B(e)});class Fo extends K{constructor(){super(...arguments),this._any=!0}_parse(t){return Te(t.data)}}Fo.create=e=>new Fo({typeName:L.ZodAny,...B(e)});class Do extends K{constructor(){super(...arguments),this._unknown=!0}_parse(t){return Te(t.data)}}Do.create=e=>new Do({typeName:L.ZodUnknown,...B(e)});class vt extends K{_parse(t){const n=this._getOrReturnCtx(t);return T(n,{code:b.invalid_type,expected:A.never,received:n.parsedType}),$}}vt.create=e=>new vt({typeName:L.ZodNever,...B(e)});class $o 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)}}$o.create=e=>new $o({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 pt(n,i,n.path,a)))).then(i=>Re.mergeArray(r,i));const o=[...n.data].map((i,a)=>s.type._parseSync(new pt(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 ae){const t={};for(const n in e.shape){const r=e.shape[n];t[n]=ut.create(It(r))}return new ae({...e._def,shape:()=>t})}else return e instanceof Ve?new Ve({...e._def,type:It(e.element)}):e instanceof ut?ut.create(It(e.unwrap())):e instanceof zt?zt.create(It(e.unwrap())):e instanceof St?St.create(e.items.map(t=>It(t))):e}class ae 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 vt&&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 pt(s,m,s.path,u)),alwaysSet:u in s.data})}if(this._def.catchall instanceof vt){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 pt(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 ae({...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 ae({...this._def,unknownKeys:"strip"})}passthrough(){return new ae({...this._def,unknownKeys:"passthrough"})}extend(t){return new ae({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new ae({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 ae({...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 ae({...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 ae({...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 ae({...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 ut;)o=o._def.innerType;n[r]=o}return new ae({...this._def,shape:()=>n})}keyof(){return xl(Y.objectKeys(this.shape))}}ae.create=(e,t)=>new ae({shape:()=>e,unknownKeys:"strip",catchall:vt.create(),typeName:L.ZodObject,...B(t)});ae.strictCreate=(e,t)=>new ae({shape:()=>e,unknownKeys:"strict",catchall:vt.create(),typeName:L.ZodObject,...B(t)});ae.lazycreate=(e,t)=>new ae({shape:e,unknownKeys:"strip",catchall:vt.create(),typeName:L.ZodObject,...B(t)});class Dn 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}}Dn.create=(e,t)=>new Dn({options:e,typeName:L.ZodUnion,...B(t)});function es(e,t){const n=ot(e),r=ot(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 $n extends K{_parse(t){const{status:n,ctx:r}=this._processInputParams(t),s=(o,i)=>{if(jo(o)||jo(i))return $;const a=es(o.value,i.value);return a.valid?((Ao(o)||Ao(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}))}}$n.create=(e,t,n)=>new $n({left:e,right:t,typeName:L.ZodIntersection,...B(n)});class St 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 pt(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 St({...this._def,rest:t})}}St.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new St({items:e,typeName:L.ZodTuple,rest:null,...B(t)})};class Lo 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 pt(r,a,r.path,[u,"key"])),value:o._parse(new pt(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}}}}Lo.create=(e,t,n)=>new Lo({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 pt(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 Vo 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})}}Vo.create=(e,t)=>new Vo({getter:e,typeName:L.ZodLazy,...B(t)});class Ho 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}}Ho.create=(e,t)=>new Ho({value:e,typeName:L.ZodLiteral,...B(t)});function xl(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=xl;class zo 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}}zo.create=(e,t)=>new zo({values:e,typeName:L.ZodNativeEnum,...B(t)});class Ln 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})))}}Ln.create=(e,t)=>new Ln({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"?qt(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"?qt(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 ut extends K{_parse(t){return this._getType(t)===A.undefined?Te(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}ut.create=(e,t)=>new ut({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 On(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 Go 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}}}Go.create=e=>new Go({typeName:L.ZodNaN,...B(e)});class Ih 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 Vs 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(),qt(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 Vs({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 On(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 le=lt.create,un=Lt.create,Hs=Qr.create;vt.create;const Ph=Ve.create,ve=ae.create;Dn.create;$n.create;St.create;const dn=Vt.create;Ln.create;ut.create;zt.create;const Oh=10,ss={name:"space_search",description:"Find Hugging Face Spaces using semantic search. Include links to the Space when presenting the results.",schema:ve({query:le().min(1,"Query is required").max(100,"Query too long").describe("Semantic Search Query"),limit:un().optional().default(Oh).describe("Number of results to return"),mcp:Hs().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:ve({query:le().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:le().optional().describe("Organization or user who created the model (e.g., 'google', 'meta-llama', 'microsoft')"),task:le().optional().describe("Model task type (e.g., 'text-generation', 'image-classification', 'translation')"),library:le().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 Nr=65536;Fh();function Fh(){try{return new Uint32Array(Nr)}catch{const t=new Array(Nr);for(let n=0;n<Nr;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:ve({model_id:le().min(1,"Model ID is required").describe("Model ID (e.g., microsoft/DialoGPT-large)")}),annotations:{title:"Model Details"}},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:ve({query:le().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:Hs().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:ve({query:le().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:le().optional().describe("Organization or user who created the dataset (e.g., 'google', 'facebook', 'allenai')"),tags:Ph(le()).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:ve({dataset_id:le().min(5,"Dataset ID is required").describe("Dataset ID (e.g. institutional/institutional-books-1.0, Anthropic/hh-rlhf etc.)")}),annotations:{title:"Dataset Details"}},yl={name:"duplicate_space",schema:ve({sourceSpaceId:le().min(1).describe("Space ID to copy (e.g., 'username/space-name')"),newSpaceId:le().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:Hs().optional().default(!0).describe("Check with User whether the new space should be public or private.")}),annotations:{title:"Duplicate Hugging Face Space"}},wl={name:"space_info",schema:ve({username:le().optional().describe("Username to get spaces for (defaults to authenticated user)")}),annotations:{title:"Hugging Face Spaces Information"}},_l={name:"space_files",schema:ve({spaceName:le().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"}};ve({fileType:dn(["all","image","audio","text"]).optional().default("all").describe("Filter by type")});ve({});ve({user_id:le().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")});ve({paper_id:le().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 zs=typeof window<"u"?window:{};function Dh(){var e=zs.DOMParser,t=!1;try{new e().parseFromString("","text/html")&&(t=!0)}catch{}return t}function $h(){var e=function(){};return Lh()?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 Lh(){var e=!1;try{document.implementation.createHTMLDocument("").open()}catch{zs.ActiveXObject&&(e=!0)}return e}Dh()?zs.DOMParser:$h();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:ve({doc_url:le().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:ve({query:le().min(3,"Supply at least one search term").max(200,"Query too long").describe("Semantic search query"),product:le().optional().describe('Filter by Product (e.g., "hub", "dataset-viewer", "transformers"). Supply when known for focused results')}),annotations:{title:"Hugging Face Documentation Library Search"}},Bo=ss.name,Uo=os.name,Wo=is.name,Zo=as.name,qo=ls.name,Ko=cs.name,Xo=yl.name,Yo=wl.name,Jo=_l.name,Qo=ds.name,ei=us.name,Tr=e=>fetch(e).then(t=>{if(!t.ok)throw new Error(`Failed to fetch: ${t.status}`);return t.json()});function Vh(){var M,E,N,H,F,Z,X,z,U,te,W;const{data:e,error:t}=Kt("/api/transport",Tr,{refreshInterval:3e3,revalidateOnFocus:!0,revalidateOnReconnect:!0});Kt("/api/sessions",Tr,{refreshInterval:3e3,revalidateOnFocus:!0});const{data:n}=Kt("/api/settings",Tr),[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),ie={...R,builtInTools:Q};bn("/api/settings",ie,!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:Zo,label:as.annotations.title,description:as.description,settings:{enabled:((M=n==null?void 0:n.builtInTools)==null?void 0:M.includes(Zo))??!0}},space_search:{id:Bo,label:ss.annotations.title,description:ss.description,settings:{enabled:((E=n==null?void 0:n.builtInTools)==null?void 0:E.includes(Bo))??!0}},model_search:{id:Uo,label:os.annotations.title,description:os.description,settings:{enabled:((N=n==null?void 0:n.builtInTools)==null?void 0:N.includes(Uo))??!0}},model_details:{id:Wo,label:is.annotations.title,description:is.description,settings:{enabled:((H=n==null?void 0:n.builtInTools)==null?void 0:H.includes(Wo))??!0}},dataset_search:{id:qo,label:ls.annotations.title,description:ls.description,settings:{enabled:((F=n==null?void 0:n.builtInTools)==null?void 0:F.includes(qo))??!0}},dataset_details:{id:Ko,label:cs.annotations.title,description:cs.description,settings:{enabled:((Z=n==null?void 0:n.builtInTools)==null?void 0:Z.includes(Ko))??!0}},doc_semantic_search:{id:Qo,label:ds.annotations.title,description:ds.description,settings:{enabled:((X=n==null?void 0:n.builtInTools)==null?void 0:X.includes(Qo))??!0}},doc_fetch:{id:ei,label:us.annotations.title,description:us.description,settings:{enabled:((z=n==null?void 0:n.builtInTools)==null?void 0:z.includes(ei))??!0}}},C={duplicate_space:{id:Xo,label:yl.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(Xo))??!0}},space_info:{id:Yo,label:wl.annotations.title,description:"Get detailed information about Hugging Face Spaces.",settings:{enabled:((te=n==null?void 0:n.builtInTools)==null?void 0:te.includes(Yo))??!0}},space_files:{id:Jo,label:_l.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(Jo))??!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(ih,{defaultValue:"metrics",className:"w-full",children:[l.jsxs(ah,{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(Xm,{})}),l.jsx(kt,{value:"mcp",className:"mt-0",children:l.jsx(Jm,{})}),!(e!=null&&e.externalApiMode)&&l.jsx(kt,{value:"search",className:"mt-0",children:l.jsx(Qs,{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(Qs,{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(Oc,{spaceNames:r,spaceSubdomains:o,enabledSpaces:a,onSpaceToolToggle:v,onSpaceToolNameChange:h,onSpaceToolSubdomainChange:y})}),l.jsx(kt,{value:"home",className:"mt-0",children:l.jsxs(qe,{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(wt,{}),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(wt,{}),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(Ml,{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(Nl,{className:"mr-2 h-5 w-5"}),"Go to Settings"]})]})]})]})})]})})}),l.jsx(Qm,{isLoading:m,error:g,transportInfo:e||{transport:"unknown"}})]})}Tl.createRoot(document.getElementById("root")).render(l.jsx(p.StrictMode,{children:l.jsx(Vh,{})}));
|
|
115
|
+
`)},lg=0,jt=[];function cg(e){var t=p.useRef([]),n=p.useRef([0,0]),r=p.useRef(),s=p.useState(lg++)[0],o=p.useState(Sa)[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=jf([e.lockRef.current],(e.shards||[]).map(Co),!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=_o(E,M);if(!N)return!0;if(N?C=E:(C=E==="v"?"h":"v",N=_o(E,M)),!N)return!1;if(!r.current&&"changedTouches"in h&&(_||S)&&(r.current=C),!C)return!0;var H=r.current||C;return og(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?So(y):Sn(y),w=t.current.filter(function(C){return C.name===y.type&&(C.target===y.target||y.target===C.shadowParent)&&ig(C.delta,x)})[0];if(w&&w.should){y.cancelable&&y.preventDefault();return}if(!w){var _=(i.current.shards||[]).map(Co).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:ug(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,So(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:ag(s)}):null,d?p.createElement(Jf,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function ug(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const dg=Lf(_a,cg);var Ea=p.forwardRef(function(e,t){return p.createElement(Zn,De({},e,{ref:t,sideCar:dg}))});Ea.classNames=Zn.classNames;var Yr=["Enter"," "],fg=["ArrowDown","PageUp","Home"],Ma=["ArrowUp","PageDown","End"],gg=[...fg,...Ma],mg={ltr:[...Yr,"ArrowRight"],rtl:[...Yr,"ArrowLeft"]},hg={ltr:["ArrowLeft"],rtl:["ArrowRight"]},ln="Menu",[en,pg,vg]=Di(ln),[Et,Na]=bt(ln,[vg,ta,Wn]),qn=ta(),Ta=Wn(),[xg,Mt]=Et(ln),[yg,cn]=Et(ln),ja=e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:s,onOpenChange:o,modal:i=!0}=e,a=qn(t),[c,u]=p.useState(null),f=p.useRef(!1),m=Je(o),g=ws(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(df,{...a,children:l.jsx(xg,{scope:t,open:n,onOpenChange:m,content:c,onContentChange:u,children:l.jsx(yg,{scope:t,onClose:p.useCallback(()=>m(!1),[m]),isUsingKeyboardRef:f,dir:g,modal:i,children:r})})})};ja.displayName=ln;var wg="MenuAnchor",js=p.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,s=qn(n);return l.jsx(ff,{...s,...r,ref:t})});js.displayName=wg;var As="MenuPortal",[_g,Aa]=Et(As,{forceMount:void 0}),ka=e=>{const{__scopeMenu:t,forceMount:n,children:r,container:s}=e,o=Mt(As,t);return l.jsx(_g,{scope:t,forceMount:n,children:l.jsx(Rt,{present:n||o.open,children:l.jsx(ua,{asChild:!0,container:s,children:r})})})};ka.displayName=As;var Ne="MenuContent",[Sg,ks]=Et(Ne),Ia=p.forwardRef((e,t)=>{const n=Aa(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(Cg,{...s,ref:t}):l.jsx(bg,{...s,ref:t})})})})}),Cg=p.forwardRef((e,t)=>{const n=Mt(Ne,e.__scopeMenu),r=p.useRef(null),s=ge(t,r);return p.useEffect(()=>{const o=r.current;if(o)return Tf(o)},[]),l.jsx(Is,{...e,ref:s,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:G(e.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),bg=p.forwardRef((e,t)=>{const n=Mt(Ne,e.__scopeMenu);return l.jsx(Is,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),Rg=jr("MenuContent.ScrollLock"),Is=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=qn(n),_=Ta(n),S=pg(n),[C,M]=p.useState(null),E=p.useRef(null),N=ge(t,E,y.onContentChange),H=p.useRef(0),F=p.useRef(""),Z=p.useRef(0),X=p.useRef(null),z=p.useRef("right"),U=p.useRef(0),te=v?Ea:p.Fragment,W=v?{as:Rg,allowPinchZoom:!0}:void 0,D=R=>{var Ee,xt;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=Dg(we,V,ye),Pe=(xt=Q.find(xe=>xe.textValue===Ge))==null?void 0:xt.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),[]),Zu();const j=p.useCallback(R=>{var Q,ae;return z.current===((Q=X.current)==null?void 0:Q.side)&&Lg(R,(ae=X.current)==null?void 0:ae.area)},[]);return l.jsx(Sg,{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:Z,onPointerGraceIntentChange:p.useCallback(R=>{X.current=R},[]),children:l.jsx(te,{...W,children:l.jsx(Hi,{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(Li,{asChild:!0,disableOutsidePointerEvents:a,onEscapeKeyDown:u,onPointerDownOutside:f,onFocusOutside:m,onInteractOutside:g,onDismiss:d,children:l.jsx(pa,{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(gf,{role:"menu","aria-orientation":"vertical","data-state":Ka(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||!gg.includes(R.key))return;R.preventDefault();const Pe=S().filter(Ee=>!Ee.disabled).map(Ee=>Ee.ref.current);Ma.includes(R.key)&&Pe.reverse(),Og(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}}))})})})})})})});Ia.displayName=Ne;var Eg="MenuGroup",Ps=p.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return l.jsx(se.div,{role:"group",...r,ref:t})});Ps.displayName=Eg;var Mg="MenuLabel",Pa=p.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return l.jsx(se.div,{...r,ref:t})});Pa.displayName=Mg;var In="MenuItem",bo="menu.itemSelect",Kn=p.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:r,...s}=e,o=p.useRef(null),i=cn(In,e.__scopeMenu),a=ks(In,e.__scopeMenu),c=ge(t,o),u=p.useRef(!1),f=()=>{const m=o.current;if(!n&&m){const g=new CustomEvent(bo,{bubbles:!0,cancelable:!0});m.addEventListener(bo,d=>r==null?void 0:r(d),{once:!0}),ri(m,g),g.defaultPrevented?u.current=!1:i.onClose()}};return l.jsx(Oa,{...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())})})});Kn.displayName=In;var Oa=p.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:r=!1,textValue:s,...o}=e,i=ks(In,n),a=Ta(n),c=p.useRef(null),u=ge(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(va,{asChild:!0,...a,focusable:!r,children:l.jsx(se.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))})})})}),Ng="MenuCheckboxItem",Fa=p.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:r,...s}=e;return l.jsx(Ha,{scope:e.__scopeMenu,checked:n,children:l.jsx(Kn,{role:"menuitemcheckbox","aria-checked":Pn(n)?"mixed":n,...s,ref:t,"data-state":Fs(n),onSelect:G(s.onSelect,()=>r==null?void 0:r(Pn(n)?!0:!n),{checkForDefaultPrevented:!1})})})});Fa.displayName=Ng;var Da="MenuRadioGroup",[Tg,jg]=Et(Da,{value:void 0,onValueChange:()=>{}}),$a=p.forwardRef((e,t)=>{const{value:n,onValueChange:r,...s}=e,o=Je(r);return l.jsx(Tg,{scope:e.__scopeMenu,value:n,onValueChange:o,children:l.jsx(Ps,{...s,ref:t})})});$a.displayName=Da;var La="MenuRadioItem",Va=p.forwardRef((e,t)=>{const{value:n,...r}=e,s=jg(La,e.__scopeMenu),o=n===s.value;return l.jsx(Ha,{scope:e.__scopeMenu,checked:o,children:l.jsx(Kn,{role:"menuitemradio","aria-checked":o,...r,ref:t,"data-state":Fs(o),onSelect:G(r.onSelect,()=>{var i;return(i=s.onValueChange)==null?void 0:i.call(s,n)},{checkForDefaultPrevented:!1})})})});Va.displayName=La;var Os="MenuItemIndicator",[Ha,Ag]=Et(Os,{checked:!1}),za=p.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:r,...s}=e,o=Ag(Os,n);return l.jsx(Rt,{present:r||Pn(o.checked)||o.checked===!0,children:l.jsx(se.span,{...s,ref:t,"data-state":Fs(o.checked)})})});za.displayName=Os;var kg="MenuSeparator",Ga=p.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return l.jsx(se.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})});Ga.displayName=kg;var Ig="MenuArrow",Ba=p.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,s=qn(n);return l.jsx(mf,{...s,...r,ref:t})});Ba.displayName=Ig;var Pg="MenuSub",[Gh,Ua]=Et(Pg),Zt="MenuSubTrigger",Wa=p.forwardRef((e,t)=>{const n=Mt(Zt,e.__scopeMenu),r=cn(Zt,e.__scopeMenu),s=Ua(Zt,e.__scopeMenu),o=ks(Zt,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(js,{asChild:!0,...u,children:l.jsx(Oa,{id:s.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":s.contentId,"data-state":Ka(n.open),...e,ref:si(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===" "||mg[r.dir].includes(m.key)&&(n.onOpenChange(!0),(d=n.content)==null||d.focus(),m.preventDefault())})})})});Wa.displayName=Zt;var Za="MenuSubContent",qa=p.forwardRef((e,t)=>{const n=Aa(Ne,e.__scopeMenu),{forceMount:r=n.forceMount,...s}=e,o=Mt(Ne,e.__scopeMenu),i=cn(Ne,e.__scopeMenu),a=Ua(Za,e.__scopeMenu),c=p.useRef(null),u=ge(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(Is,{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=hg[i.dir].includes(f.key);m&&g&&(o.onOpenChange(!1),(d=a.trigger)==null||d.focus(),f.preventDefault())})})})})})});qa.displayName=Za;function Ka(e){return e?"open":"closed"}function Pn(e){return e==="indeterminate"}function Fs(e){return Pn(e)?"indeterminate":e?"checked":"unchecked"}function Og(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function Fg(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function Dg(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=Fg(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 $g(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 Lg(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return $g(n,t)}function tn(e){return t=>t.pointerType==="mouse"?e(t):void 0}var Vg=ja,Hg=js,zg=ka,Gg=Ia,Bg=Ps,Ug=Pa,Wg=Kn,Zg=Fa,qg=$a,Kg=Va,Xg=za,Yg=Ga,Jg=Ba,Qg=Wa,em=qa,Xn="DropdownMenu",[tm,Bh]=bt(Xn,[Na]),ve=Na(),[nm,Xa]=tm(Xn),Ya=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]=Vn({prop:s,defaultProp:o??!1,onChange:i,caller:Xn});return l.jsx(nm,{scope:t,triggerId:Nn(),triggerRef:u,contentId:Nn(),open:f,onOpenChange:m,onOpenToggle:p.useCallback(()=>m(g=>!g),[m]),modal:a,children:l.jsx(Vg,{...c,open:f,onOpenChange:m,dir:r,modal:a,children:n})})};Ya.displayName=Xn;var Ja="DropdownMenuTrigger",Qa=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...s}=e,o=Xa(Ja,n),i=ve(n);return l.jsx(Hg,{asChild:!0,...i,children:l.jsx(se.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:si(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())})})})});Qa.displayName=Ja;var rm="DropdownMenuPortal",el=e=>{const{__scopeDropdownMenu:t,...n}=e,r=ve(t);return l.jsx(zg,{...r,...n})};el.displayName=rm;var tl="DropdownMenuContent",nl=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Xa(tl,n),o=ve(n),i=p.useRef(!1);return l.jsx(Gg,{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)"}})});nl.displayName=tl;var sm="DropdownMenuGroup",om=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=ve(n);return l.jsx(Bg,{...s,...r,ref:t})});om.displayName=sm;var im="DropdownMenuLabel",am=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=ve(n);return l.jsx(Ug,{...s,...r,ref:t})});am.displayName=im;var lm="DropdownMenuItem",cm=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=ve(n);return l.jsx(Wg,{...s,...r,ref:t})});cm.displayName=lm;var um="DropdownMenuCheckboxItem",rl=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=ve(n);return l.jsx(Zg,{...s,...r,ref:t})});rl.displayName=um;var dm="DropdownMenuRadioGroup",fm=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=ve(n);return l.jsx(qg,{...s,...r,ref:t})});fm.displayName=dm;var gm="DropdownMenuRadioItem",mm=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=ve(n);return l.jsx(Kg,{...s,...r,ref:t})});mm.displayName=gm;var hm="DropdownMenuItemIndicator",sl=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=ve(n);return l.jsx(Xg,{...s,...r,ref:t})});sl.displayName=hm;var pm="DropdownMenuSeparator",vm=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=ve(n);return l.jsx(Yg,{...s,...r,ref:t})});vm.displayName=pm;var xm="DropdownMenuArrow",ym=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=ve(n);return l.jsx(Jg,{...s,...r,ref:t})});ym.displayName=xm;var wm="DropdownMenuSubTrigger",_m=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=ve(n);return l.jsx(Qg,{...s,...r,ref:t})});_m.displayName=wm;var Sm="DropdownMenuSubContent",Cm=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=ve(n);return l.jsx(em,{...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)"}})});Cm.displayName=Sm;var bm=Ya,Rm=Qa,Em=el,Mm=nl,Nm=rl,Tm=sl;function jm({...e}){return l.jsx(bm,{"data-slot":"dropdown-menu",...e})}function Am({...e}){return l.jsx(Rm,{"data-slot":"dropdown-menu-trigger",...e})}function km({className:e,sideOffset:t=4,...n}){return l.jsx(Em,{children:l.jsx(Mm,{"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 Im({className:e,children:t,checked:n,...r}){return l.jsxs(Nm,{"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(Tm,{children:l.jsx(Si,{className:"size-4"})})}),t]})}function Ds({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 Pm({className:e,...t}){return l.jsx("thead",{"data-slot":"table-header",className:ce("[&_tr]:border-b",e),...t})}function $s({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 Om({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 Yn({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=Du({data:t,columns:e,onSortingChange:c,onColumnFiltersChange:f,getCoreRowModel:Eu(),getPaginationRowModel:ku(),getSortedRowModel:Iu(),getFilteredRowModel:Au(),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(jm,{children:[l.jsx(Am,{asChild:!0,children:l.jsxs(Pt,{variant:"outline",className:"ml-auto",children:["Columns ",l.jsx(Ci,{className:"ml-2 h-4 w-4"})]})}),l.jsx(km,{align:"end",children:h.getAllColumns().filter(w=>w.getCanHide()).map(w=>l.jsx(Im,{className:"capitalize",checked:w.getIsVisible(),onCheckedChange:_=>w.toggleVisibility(!!_),children:w.id},w.id))})]})]}),l.jsx("div",{className:"rounded-md border",children:l.jsxs(Ds,{children:[l.jsx(Pm,{children:h.getHeaderGroups().map(w=>l.jsx(de,{children:w.headers.map(_=>l.jsx(Om,{children:_.isPlaceholder?null:no(_.column.columnDef.header,_.getContext())},_.id))},w.id))}),l.jsx($s,{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:no(_.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 re(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(Cc,{className:"ml-1 h-3 w-3 text-muted-foreground"}),s==="desc"&&l.jsx(Ci,{className:"ml-1 h-3 w-3 text-muted-foreground"})]})})}}const Fm=5*60*1e3;function ol(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>Fm&&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 Ro(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 Dm(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 $m(e){return e.length<=12?e:`${e.slice(0,5)}...${e.slice(-5)}`}function Lm(e){return e.length<=42?e:`${e.slice(0,35)}.....${e.slice(-5)}`}function Vm({metrics:e}){const t=e.sessions||[],n=ol(t),r=()=>[{accessorKey:"clientInfo",header:re("Client"),cell:({row:s})=>{const o=s.original,i=o.clientInfo?`${Lm(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:re("Session ID"),cell:({row:s})=>l.jsx("div",{className:"font-mono text-sm",title:s.getValue("id"),children:$m(s.getValue("id"))})},{accessorKey:"isConnected",header:re("Status"),cell:({row:s})=>{const o=s.original;return l.jsxs(yt,{variant:o.isConnected?"success":"secondary",className:"gap-1",children:[o.isConnected?l.jsx(Ei,{className:"h-3 w-3"}):l.jsx(Ri,{className:"h-3 w-3"}),o.isConnected?"Connected":"Disconnected"]})}},{accessorKey:"connectedAt",header:re("Connected"),cell:({row:s})=>l.jsx("div",{className:"text-sm",children:Ro(s.getValue("connectedAt"))})},{accessorKey:"requestCount",header:re("Requests","right"),cell:({row:s})=>l.jsx("div",{className:"text-right font-mono text-sm",children:s.getValue("requestCount")})},{accessorKey:"lastActivity",header:re("Last Activity"),cell:({row:s})=>l.jsx("div",{className:"text-sm",children:Ro(s.getValue("lastActivity"))})}];return l.jsxs(qe,{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:Dm(e.uptimeSeconds)})]})]}),l.jsxs(l.Fragment,{children:[l.jsx(wt,{}),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(Yn,{columns:r(),data:n,searchColumn:"id",searchPlaceholder:"Filter sessions...",pageSize:10,defaultSorting:[{id:"lastActivity",desc:!0}]})]})]})]})]})}function Eo(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 Hm(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 zm(e){return e.length<=12?e:`${e.slice(0,5)}...${e.slice(-5)}`}function Gm(e){return e.length<=42?e:`${e.slice(0,35)}.....${e.slice(-5)}`}function Bm({metrics:e}){const t=e.sessions||[],n=ol(t),r={sse:"Server-Sent Events",streamableHttp:"Streamable HTTP"},s=()=>[{accessorKey:"clientInfo",header:re("Client"),cell:({row:o})=>{const i=o.original,a=i.clientInfo?`${Gm(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:re("Session ID"),cell:({row:o})=>l.jsx("div",{className:"font-mono text-sm",title:o.getValue("id"),children:zm(o.getValue("id"))})},{accessorKey:"connectionStatus",header:re("Status"),cell:({row:o})=>{const i=o.original,a=i.connectionStatus||(i.isConnected?"Connected":"Disconnected");return a==="Connected"?l.jsxs(yt,{variant:"success",className:"gap-1",children:[l.jsx(Ei,{className:"h-3 w-3"}),"Connected"]}):a==="Distressed"?l.jsxs(yt,{variant:"destructive",className:"gap-1",children:[l.jsx(bi,{className:"h-3 w-3"}),"Distressed ",i.pingFailures?`(${i.pingFailures} failed)`:""]}):l.jsxs(yt,{variant:"secondary",className:"gap-1",children:[l.jsx(Ri,{className:"h-3 w-3"}),"Disconnected"]})}},{accessorKey:"connectedAt",header:re("Connected"),cell:({row:o})=>l.jsx("div",{className:"text-sm",children:Eo(o.getValue("connectedAt"))})},{accessorKey:"requestCount",header:re("Requests","right"),cell:({row:o})=>l.jsx("div",{className:"text-right font-mono text-sm",children:o.getValue("requestCount")})},{accessorKey:"lastActivity",header:re("Last Activity"),cell:({row:o})=>l.jsx("div",{className:"text-sm",children:Eo(o.getValue("lastActivity"))})}];return l.jsxs(qe,{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:Hm(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(wt,{}),l.jsx("div",{children:l.jsx(Ds,{children:l.jsxs($s,{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(wt,{}),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(Yn,{columns:s(),data:n,searchColumn:"id",searchPlaceholder:"Filter sessions...",pageSize:10,defaultSorting:[{id:"lastActivity",desc:!0}]})]})]})]})]})}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 Um(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 Wm(e){const t=new Date,n=new Date(e),r=t.getTime()-n.getTime();return Math.floor(r/6e4)<5}function Zm(e){return e.length<=42?e:`${e.slice(0,35)}.....${e.slice(-5)}`}function qm({metrics:e}){const t=e.clients,n=()=>[{accessorKey:"name",header:re("Client"),cell:({row:r})=>{const s=r.original,o=`${Zm(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 ",Mo(s.firstSeen)]})]})}},{accessorKey:"requestCount",header:re("Initializations","right"),cell:({row:r})=>l.jsx("div",{className:"text-right font-mono text-sm",children:r.getValue("requestCount")})},{accessorKey:"isConnected",header:re("Status"),cell:({row:r})=>{const s=r.original;return l.jsx("div",{children:Wm(s.lastSeen)?l.jsxs(yt,{variant:"success",className:"gap-1",children:[l.jsx(yc,{className:"h-3 w-3"}),"Recent"]}):l.jsxs(yt,{variant:"secondary",className:"gap-1",children:[l.jsx(Rc,{className:"h-3 w-3"}),"Idle"]})})}},{accessorKey:"lastSeen",header:re("Last Seen","right"),cell:({row:r})=>l.jsx("div",{className:"text-right text-sm",children:Mo(r.getValue("lastSeen"))})}];return l.jsxs(qe,{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(yt,{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:Um(e.uptimeSeconds)})]})]}),l.jsx(wt,{}),l.jsx("div",{children:l.jsx(Ds,{children:l.jsxs($s,{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(Mc,{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(wt,{}),l.jsxs("div",{children:[l.jsx("h3",{className:"text-sm font-semibold text-foreground mb-3",children:"Client Identities"}),l.jsx(Yn,{columns:n(),data:t,searchColumn:"name",searchPlaceholder:"Filter clients...",pageSize:50,defaultSorting:[{id:"lastSeen",desc:!0}]})]})]})]})]})}const Km=e=>fetch(e).then(t=>{if(!t.ok)throw new Error(`Failed to fetch: ${t.status}`);return t.json()});function Xm(){const{data:e,error:t}=Kt("/api/transport-metrics",Km,{refreshInterval:3e3,revalidateOnFocus:!0,revalidateOnReconnect:!0});return t?l.jsxs(qe,{children:[l.jsx(Ke,{children:l.jsx(Xe,{children:"📊 Transport Metrics"})}),l.jsx(Ye,{children:l.jsxs(Dc,{variant:"destructive",children:[l.jsx(bi,{className:"h-4 w-4"}),l.jsx($c,{children:"Error Loading Metrics"}),l.jsxs(Lc,{children:["Failed to load transport metrics: ",t.message]})]})})]}):e?e.transport==="stdio"?l.jsx(Vm,{metrics:e}):e.isStateless?l.jsx(qm,{metrics:e}):l.jsx(Bm,{metrics:e}):l.jsxs(qe,{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 Ym=e=>fetch(e).then(t=>{if(!t.ok)throw new Error(`Failed to fetch: ${t.status}`);return t.json()});function Jm(){const[e,t]=p.useState(!1),{data:n,error:r}=Kt("/api/transport-metrics",Ym,{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:re("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:re("Calls","right"),cell:({row:g})=>l.jsx("div",{className:"text-right font-mono",children:g.getValue("count").toLocaleString()})},{accessorKey:"errors",header:re("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:re("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:re("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:re("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:re("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(qe,{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(hs,{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(Yn,{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 No(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 Qm({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 ${No(n).isWarning?"text-red-500":""}`,children:No(n).text})]})]})})}var Jn="Tabs",[eh,Uh]=bt(Jn,[Wn]),il=Wn(),[th,Ls]=eh(Jn),al=p.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:s,defaultValue:o,orientation:i="horizontal",dir:a,activationMode:c="automatic",...u}=e,f=ws(a),[m,g]=Vn({prop:r,onChange:s,defaultProp:o??"",caller:Jn});return l.jsx(th,{scope:n,baseId:Nn(),value:m,onValueChange:g,orientation:i,dir:f,activationMode:c,children:l.jsx(se.div,{dir:f,"data-orientation":i,...u,ref:t})})});al.displayName=Jn;var ll="TabsList",cl=p.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...s}=e,o=Ls(ll,n),i=il(n);return l.jsx(pa,{asChild:!0,...i,orientation:o.orientation,dir:o.dir,loop:r,children:l.jsx(se.div,{role:"tablist","aria-orientation":o.orientation,...s,ref:t})})});cl.displayName=ll;var ul="TabsTrigger",dl=p.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:s=!1,...o}=e,i=Ls(ul,n),a=il(n),c=ml(i.baseId,r),u=hl(i.baseId,r),f=r===i.value;return l.jsx(va,{asChild:!0,...a,focusable:!s,active:f,children:l.jsx(se.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)})})})});dl.displayName=ul;var fl="TabsContent",gl=p.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:s,children:o,...i}=e,a=Ls(fl,n),c=ml(a.baseId,r),u=hl(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(se.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})})});gl.displayName=fl;function ml(e,t){return`${e}-trigger-${t}`}function hl(e,t){return`${e}-content-${t}`}var nh=al,rh=cl,sh=dl,oh=gl;function ih({className:e,...t}){return l.jsx(nh,{"data-slot":"tabs",className:ce("flex flex-col gap-2",e),...t})}function ah({className:e,...t}){return l.jsx(rh,{"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(sh,{"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(oh,{"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 To;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(To||(To={}));const A=Y.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),ot=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 lh=Jr;function ch(){return lh}const uh=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=ch(),r=uh({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"}),qt=e=>({status:"dirty",value:e}),Te=e=>({status:"valid",value:e}),jo=e=>e.status==="aborted",Ao=e=>e.status==="dirty",$t=e=>e.status==="valid",On=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 pt{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 ko=(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 ot(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:ot(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:ot(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const n=this._parse(t);if(On(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:ot(t)},s=this._parseSync({data:t,path:r.path,parent:r});return ko(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:ot(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:ot(t)},s=this._parse({data:t,path:r.path,parent:r}),o=await(On(s)?s:Promise.resolve(s));return ko(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 ut.create(this,this._def)}nullable(){return zt.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Ve.create(this)}promise(){return Ln.create(this,this._def)}or(t){return Dn.create([this,t],this._def)}and(t){return $n.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 Ih({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 Vs.create(this,t)}readonly(){return rs.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const dh=/^c[^\s-]{8,}$/i,fh=/^[0-9a-z]+$/,gh=/^[0-9A-HJKMNP-TV-Z]{26}$/i,mh=/^[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,hh=/^[a-z0-9_-]{21}$/i,ph=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,vh=/^[-+]?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)?)??$/,xh=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,yh="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Mr;const wh=/^(?:(?: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])$/,_h=/^(?:(?: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])$/,Sh=/^(([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]))$/,Ch=/^(([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])$/,bh=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Rh=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,pl="((\\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])))",Eh=new RegExp(`^${pl}$`);function vl(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 Mh(e){return new RegExp(`^${vl(e)}$`)}function Nh(e){let t=`${pl}T${vl(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 Th(e,t){return!!((t==="v4"||!t)&&wh.test(e)||(t==="v6"||!t)&&Sh.test(e))}function jh(e,t){if(!ph.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 Ah(e,t){return!!((t==="v4"||!t)&&_h.test(e)||(t==="v6"||!t)&&Ch.test(e))}class lt 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")xh.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")Mr||(Mr=new RegExp(yh,"u")),Mr.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")mh.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")hh.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")dh.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")fh.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")gh.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"?Nh(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"?Eh.test(t.data)||(s=this._getOrReturnCtx(t,s),T(s,{code:b.invalid_string,validation:"date",message:o.message}),r.dirty()):o.kind==="time"?Mh(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"?vh.test(t.data)||(s=this._getOrReturnCtx(t,s),T(s,{validation:"duration",code:b.invalid_string,message:o.message}),r.dirty()):o.kind==="ip"?Th(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"?jh(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"?Ah(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"?bh.test(t.data)||(s=this._getOrReturnCtx(t,s),T(s,{validation:"base64",code:b.invalid_string,message:o.message}),r.dirty()):o.kind==="base64url"?Rh.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 lt({...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 lt({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new lt({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new lt({...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}}lt.create=e=>new lt({checks:[],typeName:L.ZodString,coerce:(e==null?void 0:e.coerce)??!1,...B(e)});function kh(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"?kh(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 Fn 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 Fn({...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}}Fn.create=e=>new Fn({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:L.ZodDate,...B(e)});class Io 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)}}Io.create=e=>new Io({typeName:L.ZodSymbol,...B(e)});class Po 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)}}Po.create=e=>new Po({typeName:L.ZodUndefined,...B(e)});class Oo 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)}}Oo.create=e=>new Oo({typeName:L.ZodNull,...B(e)});class Fo extends K{constructor(){super(...arguments),this._any=!0}_parse(t){return Te(t.data)}}Fo.create=e=>new Fo({typeName:L.ZodAny,...B(e)});class Do extends K{constructor(){super(...arguments),this._unknown=!0}_parse(t){return Te(t.data)}}Do.create=e=>new Do({typeName:L.ZodUnknown,...B(e)});class vt extends K{_parse(t){const n=this._getOrReturnCtx(t);return T(n,{code:b.invalid_type,expected:A.never,received:n.parsedType}),$}}vt.create=e=>new vt({typeName:L.ZodNever,...B(e)});class $o 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)}}$o.create=e=>new $o({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 pt(n,i,n.path,a)))).then(i=>Re.mergeArray(r,i));const o=[...n.data].map((i,a)=>s.type._parseSync(new pt(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]=ut.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 ut?ut.create(It(e.unwrap())):e instanceof zt?zt.create(It(e.unwrap())):e instanceof St?St.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 vt&&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 pt(s,m,s.path,u)),alwaysSet:u in s.data})}if(this._def.catchall instanceof vt){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 pt(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 ut;)o=o._def.innerType;n[r]=o}return new le({...this._def,shape:()=>n})}keyof(){return xl(Y.objectKeys(this.shape))}}le.create=(e,t)=>new le({shape:()=>e,unknownKeys:"strip",catchall:vt.create(),typeName:L.ZodObject,...B(t)});le.strictCreate=(e,t)=>new le({shape:()=>e,unknownKeys:"strict",catchall:vt.create(),typeName:L.ZodObject,...B(t)});le.lazycreate=(e,t)=>new le({shape:e,unknownKeys:"strip",catchall:vt.create(),typeName:L.ZodObject,...B(t)});class Dn 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}}Dn.create=(e,t)=>new Dn({options:e,typeName:L.ZodUnion,...B(t)});function es(e,t){const n=ot(e),r=ot(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 $n extends K{_parse(t){const{status:n,ctx:r}=this._processInputParams(t),s=(o,i)=>{if(jo(o)||jo(i))return $;const a=es(o.value,i.value);return a.valid?((Ao(o)||Ao(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}))}}$n.create=(e,t,n)=>new $n({left:e,right:t,typeName:L.ZodIntersection,...B(n)});class St 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 pt(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 St({...this._def,rest:t})}}St.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new St({items:e,typeName:L.ZodTuple,rest:null,...B(t)})};class Lo 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 pt(r,a,r.path,[u,"key"])),value:o._parse(new pt(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}}}}Lo.create=(e,t,n)=>new Lo({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 pt(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 Vo 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})}}Vo.create=(e,t)=>new Vo({getter:e,typeName:L.ZodLazy,...B(t)});class Ho 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}}Ho.create=(e,t)=>new Ho({value:e,typeName:L.ZodLiteral,...B(t)});function xl(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=xl;class zo 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}}zo.create=(e,t)=>new zo({values:e,typeName:L.ZodNativeEnum,...B(t)});class Ln 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})))}}Ln.create=(e,t)=>new Ln({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"?qt(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"?qt(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 ut extends K{_parse(t){return this._getType(t)===A.undefined?Te(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}ut.create=(e,t)=>new ut({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 On(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 Go 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}}}Go.create=e=>new Go({typeName:L.ZodNaN,...B(e)});class Ih 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 Vs 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(),qt(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 Vs({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 On(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=lt.create,un=Lt.create,Hs=Qr.create;vt.create;const Ph=Ve.create,me=le.create;Dn.create;$n.create;St.create;const dn=Vt.create;Ln.create;ut.create;zt.create;const Oh=10,ss={name:"space_search",description:"Find Hugging Face Spaces using semantic search. Include links to the Space when presenting the results.",schema:me({query:ie().min(1,"Query is required").max(100,"Query too long").describe("Semantic Search Query"),limit:un().optional().default(Oh).describe("Number of results to return"),mcp:Hs().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:me({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 Nr=65536;Fh();function Fh(){try{return new Uint32Array(Nr)}catch{const t=new Array(Nr);for(let n=0;n<Nr;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:me({model_id:ie().min(1,"Model ID is required").describe("Model ID (e.g., microsoft/DialoGPT-large)")}),annotations:{title:"Model Details"}};me({model_id:ie().min(5,"Model ID is required").max(50).describe("The Model ID in repo/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:me({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:Hs().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:me({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:Ph(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:me({dataset_id:ie().min(5,"Dataset ID is required").describe("Dataset ID (e.g. institutional/institutional-books-1.0, Anthropic/hh-rlhf etc.)")}),annotations:{title:"Dataset Details"}},yl={name:"duplicate_space",schema:me({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:Hs().optional().default(!0).describe("Check with User whether the new space should be public or private.")}),annotations:{title:"Duplicate Hugging Face Space"}},wl={name:"space_info",schema:me({username:ie().optional().describe("Username to get spaces for (defaults to authenticated user)")}),annotations:{title:"Hugging Face Spaces Information"}},_l={name:"space_files",schema:me({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"}};me({fileType:dn(["all","image","audio","text"]).optional().default("all").describe("Filter by type")});me({});me({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")});me({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 zs=typeof window<"u"?window:{};function Dh(){var e=zs.DOMParser,t=!1;try{new e().parseFromString("","text/html")&&(t=!0)}catch{}return t}function $h(){var e=function(){};return Lh()?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 Lh(){var e=!1;try{document.implementation.createHTMLDocument("").open()}catch{zs.ActiveXObject&&(e=!0)}return e}Dh()?zs.DOMParser:$h();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:me({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:me({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"}},Bo=ss.name,Uo=os.name,Wo=is.name,Zo=as.name,qo=ls.name,Ko=cs.name,Xo=yl.name,Yo=wl.name,Jo=_l.name,Qo=ds.name,ei=us.name,Tr=e=>fetch(e).then(t=>{if(!t.ok)throw new Error(`Failed to fetch: ${t.status}`);return t.json()});function Vh(){var M,E,N,H,F,Z,X,z,U,te,W;const{data:e,error:t}=Kt("/api/transport",Tr,{refreshInterval:3e3,revalidateOnFocus:!0,revalidateOnReconnect:!0});Kt("/api/sessions",Tr,{refreshInterval:3e3,revalidateOnFocus:!0});const{data:n}=Kt("/api/settings",Tr),[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:Zo,label:as.annotations.title,description:as.description,settings:{enabled:((M=n==null?void 0:n.builtInTools)==null?void 0:M.includes(Zo))??!0}},space_search:{id:Bo,label:ss.annotations.title,description:ss.description,settings:{enabled:((E=n==null?void 0:n.builtInTools)==null?void 0:E.includes(Bo))??!0}},model_search:{id:Uo,label:os.annotations.title,description:os.description,settings:{enabled:((N=n==null?void 0:n.builtInTools)==null?void 0:N.includes(Uo))??!0}},model_details:{id:Wo,label:is.annotations.title,description:is.description,settings:{enabled:((H=n==null?void 0:n.builtInTools)==null?void 0:H.includes(Wo))??!0}},dataset_search:{id:qo,label:ls.annotations.title,description:ls.description,settings:{enabled:((F=n==null?void 0:n.builtInTools)==null?void 0:F.includes(qo))??!0}},dataset_details:{id:Ko,label:cs.annotations.title,description:cs.description,settings:{enabled:((Z=n==null?void 0:n.builtInTools)==null?void 0:Z.includes(Ko))??!0}},doc_semantic_search:{id:Qo,label:ds.annotations.title,description:ds.description,settings:{enabled:((X=n==null?void 0:n.builtInTools)==null?void 0:X.includes(Qo))??!0}},doc_fetch:{id:ei,label:us.annotations.title,description:us.description,settings:{enabled:((z=n==null?void 0:n.builtInTools)==null?void 0:z.includes(ei))??!0}}},C={duplicate_space:{id:Xo,label:yl.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(Xo))??!0}},space_info:{id:Yo,label:wl.annotations.title,description:"Get detailed information about Hugging Face Spaces.",settings:{enabled:((te=n==null?void 0:n.builtInTools)==null?void 0:te.includes(Yo))??!0}},space_files:{id:Jo,label:_l.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(Jo))??!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(ih,{defaultValue:"metrics",className:"w-full",children:[l.jsxs(ah,{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(Xm,{})}),l.jsx(kt,{value:"mcp",className:"mt-0",children:l.jsx(Jm,{})}),!(e!=null&&e.externalApiMode)&&l.jsx(kt,{value:"search",className:"mt-0",children:l.jsx(Qs,{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(Qs,{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(Oc,{spaceNames:r,spaceSubdomains:o,enabledSpaces:a,onSpaceToolToggle:v,onSpaceToolNameChange:h,onSpaceToolSubdomainChange:y})}),l.jsx(kt,{value:"home",className:"mt-0",children:l.jsxs(qe,{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(wt,{}),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(wt,{}),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(Ml,{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(Nl,{className:"mr-2 h-5 w-5"}),"Go to Settings"]})]})]})]})})]})})}),l.jsx(Qm,{isLoading:m,error:g,transportInfo:e||{transport:"unknown"}})]})}Tl.createRoot(document.getElementById("root")).render(l.jsx(p.StrictMode,{children:l.jsx(Vh,{})}));
|