@llmindset/hf-mcp-server 0.2.31 → 0.2.33

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.
@@ -142,4 +142,4 @@ import{r as xc,a as h,R as He,j as l,b as Fi,g as yc,c as wc,d as bc}from"./inde
142
142
  `)},ti=function(){var e=parseInt(document.body.getAttribute(Wt)||"0",10);return isFinite(e)?e:0},np=function(){h.useEffect(function(){return document.body.setAttribute(Wt,(ti()+1).toString()),function(){var e=ti()-1;e<=0?document.body.removeAttribute(Wt):document.body.setAttribute(Wt,e.toString())}},[])},rp=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,o=r===void 0?"margin":r;np();var s=h.useMemo(function(){return Qg(o)},[o]);return h.createElement(ep,{styles:tp(s,!t,o,n?"":"!important")})},yo=!1;if(typeof window<"u")try{var Dn=Object.defineProperty({},"passive",{get:function(){return yo=!0,!0}});window.addEventListener("test",Dn,Dn),window.removeEventListener("test",Dn,Dn)}catch{yo=!1}var Vt=yo?{passive:!1}:!1,op=function(e){return e.tagName==="TEXTAREA"},xl=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!op(e)&&n[t]==="visible")},sp=function(e){return xl(e,"overflowY")},ip=function(e){return xl(e,"overflowX")},ni=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var o=yl(e,r);if(o){var s=wl(e,r),i=s[1],a=s[2];if(i>a)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},ap=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},lp=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},yl=function(e,t){return e==="v"?sp(t):ip(t)},wl=function(e,t){return e==="v"?ap(t):lp(t)},cp=function(e,t){return e==="h"&&t==="rtl"?-1:1},up=function(e,t,n,r,o){var s=cp(e,window.getComputedStyle(t).direction),i=s*r,a=n.target,c=t.contains(a),u=!1,d=i>0,g=0,m=0;do{if(!a)break;var f=wl(e,a),v=f[0],p=f[1],y=f[2],x=p-y-s*v;(v||x)&&yl(e,a)&&(g+=x,m+=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(d&&Math.abs(g)<1||!d&&Math.abs(m)<1)&&(u=!0),u},$n=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},ri=function(e){return[e.deltaX,e.deltaY]},oi=function(e){return e&&"current"in e?e.current:e},dp=function(e,t){return e[0]===t[0]&&e[1]===t[1]},fp=function(e){return`
143
143
  .block-interactivity-`.concat(e,` {pointer-events: none;}
144
144
  .allow-interactivity-`).concat(e,` {pointer-events: all;}
145
- `)},mp=0,zt=[];function gp(e){var t=h.useRef([]),n=h.useRef([0,0]),r=h.useRef(),o=h.useState(mp++)[0],s=h.useState(vl)[0],i=h.useRef(e);h.useEffect(function(){i.current=e},[e]),h.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var p=Og([e.lockRef.current],(e.shards||[]).map(oi),!0).filter(Boolean);return p.forEach(function(y){return y.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),p.forEach(function(y){return y.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var a=h.useCallback(function(p,y){if("touches"in p&&p.touches.length===2||p.type==="wheel"&&p.ctrlKey)return!i.current.allowPinchZoom;var x=$n(p),w=n.current,b="deltaX"in p?p.deltaX:w[0]-x[0],_="deltaY"in p?p.deltaY:w[1]-x[1],C,N=p.target,E=Math.abs(b)>Math.abs(_)?"h":"v";if("touches"in p&&E==="h"&&N.type==="range")return!1;var S=ni(E,N);if(!S)return!0;if(S?C=E:(C=E==="v"?"h":"v",S=ni(E,N)),!S)return!1;if(!r.current&&"changedTouches"in p&&(b||_)&&(r.current=C),!C)return!0;var $=r.current||C;return up($,y,p,$==="h"?b:_)},[]),c=h.useCallback(function(p){var y=p;if(!(!zt.length||zt[zt.length-1]!==s)){var x="deltaY"in y?ri(y):$n(y),w=t.current.filter(function(C){return C.name===y.type&&(C.target===y.target||y.target===C.shadowParent)&&dp(C.delta,x)})[0];if(w&&w.should){y.cancelable&&y.preventDefault();return}if(!w){var b=(i.current.shards||[]).map(oi).filter(Boolean).filter(function(C){return C.contains(y.target)}),_=b.length>0?a(y,b[0]):!i.current.noIsolation;_&&y.cancelable&&y.preventDefault()}}},[]),u=h.useCallback(function(p,y,x,w){var b={name:p,delta:y,target:x,should:w,shadowParent:pp(x)};t.current.push(b),setTimeout(function(){t.current=t.current.filter(function(_){return _!==b})},1)},[]),d=h.useCallback(function(p){n.current=$n(p),r.current=void 0},[]),g=h.useCallback(function(p){u(p.type,ri(p),p.target,a(p,e.lockRef.current))},[]),m=h.useCallback(function(p){u(p.type,$n(p),p.target,a(p,e.lockRef.current))},[]);h.useEffect(function(){return zt.push(s),e.setCallbacks({onScrollCapture:g,onWheelCapture:g,onTouchMoveCapture:m}),document.addEventListener("wheel",c,Vt),document.addEventListener("touchmove",c,Vt),document.addEventListener("touchstart",d,Vt),function(){zt=zt.filter(function(p){return p!==s}),document.removeEventListener("wheel",c,Vt),document.removeEventListener("touchmove",c,Vt),document.removeEventListener("touchstart",d,Vt)}},[]);var f=e.removeScrollBar,v=e.inert;return h.createElement(h.Fragment,null,v?h.createElement(s,{styles:fp(o)}):null,f?h.createElement(rp,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function pp(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const hp=Bg(hl,gp);var bl=h.forwardRef(function(e,t){return h.createElement(dr,Be({},e,{ref:t,sideCar:hp}))});bl.classNames=dr.classNames;var wo=["Enter"," "],vp=["ArrowDown","PageUp","Home"],_l=["ArrowUp","PageDown","End"],xp=[...vp,..._l],yp={ltr:[...wo,"ArrowRight"],rtl:[...wo,"ArrowLeft"]},wp={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Sn="Menu",[hn,bp,_p]=Ta(Sn),[Ft,Sl]=Pt(Sn,[_p,Xa,ur]),fr=Xa(),Cl=ur(),[Sp,Dt]=Ft(Sn),[Cp,Cn]=Ft(Sn),Rl=e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:o,onOpenChange:s,modal:i=!0}=e,a=fr(t),[c,u]=h.useState(null),d=h.useRef(!1),g=it(s),m=Uo(o);return h.useEffect(()=>{const f=()=>{d.current=!0,document.addEventListener("pointerdown",v,{capture:!0,once:!0}),document.addEventListener("pointermove",v,{capture:!0,once:!0})},v=()=>d.current=!1;return document.addEventListener("keydown",f,{capture:!0}),()=>{document.removeEventListener("keydown",f,{capture:!0}),document.removeEventListener("pointerdown",v,{capture:!0}),document.removeEventListener("pointermove",v,{capture:!0})}},[]),l.jsx(hg,{...a,children:l.jsx(Sp,{scope:t,open:n,onOpenChange:g,content:c,onContentChange:u,children:l.jsx(Cp,{scope:t,onClose:h.useCallback(()=>g(!1),[g]),isUsingKeyboardRef:d,dir:m,modal:i,children:r})})})};Rl.displayName=Sn;var Rp="MenuAnchor",es=h.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,o=fr(n);return l.jsx(vg,{...o,...r,ref:t})});es.displayName=Rp;var ts="MenuPortal",[kp,kl]=Ft(ts,{forceMount:void 0}),El=e=>{const{__scopeMenu:t,forceMount:n,children:r,container:o}=e,s=Dt(ts,t);return l.jsx(kp,{scope:t,forceMount:n,children:l.jsx(Ot,{present:n||s.open,children:l.jsx(sl,{asChild:!0,container:o,children:r})})})};El.displayName=ts;var Oe="MenuContent",[Ep,ns]=Ft(Oe),Ml=h.forwardRef((e,t)=>{const n=kl(Oe,e.__scopeMenu),{forceMount:r=n.forceMount,...o}=e,s=Dt(Oe,e.__scopeMenu),i=Cn(Oe,e.__scopeMenu);return l.jsx(hn.Provider,{scope:e.__scopeMenu,children:l.jsx(Ot,{present:r||s.open,children:l.jsx(hn.Slot,{scope:e.__scopeMenu,children:i.modal?l.jsx(Mp,{...o,ref:t}):l.jsx(Np,{...o,ref:t})})})})}),Mp=h.forwardRef((e,t)=>{const n=Dt(Oe,e.__scopeMenu),r=h.useRef(null),o=ke(t,r);return h.useEffect(()=>{const s=r.current;if(s)return Pg(s)},[]),l.jsx(rs,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:q(e.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),Np=h.forwardRef((e,t)=>{const n=Dt(Oe,e.__scopeMenu);return l.jsx(rs,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),Ap=mn("MenuContent.ScrollLock"),rs=h.forwardRef((e,t)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:o,onOpenAutoFocus:s,onCloseAutoFocus:i,disableOutsidePointerEvents:a,onEntryFocus:c,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:g,onInteractOutside:m,onDismiss:f,disableOutsideScroll:v,...p}=e,y=Dt(Oe,n),x=Cn(Oe,n),w=fr(n),b=Cl(n),_=bp(n),[C,N]=h.useState(null),E=h.useRef(null),S=ke(t,E,y.onContentChange),$=h.useRef(0),L=h.useRef(""),X=h.useRef(0),te=h.useRef(null),Z=h.useRef("right"),V=h.useRef(0),ne=v?bl:h.Fragment,G=v?{as:Ap,allowPinchZoom:!0}:void 0,J=M=>{var Q,ze;const H=L.current+M,z=_().filter(ve=>!ve.disabled),Y=document.activeElement,re=(Q=z.find(ve=>ve.ref.current===Y))==null?void 0:Q.textValue,le=z.map(ve=>ve.textValue),be=Hp(le,H,re),_e=(ze=z.find(ve=>ve.textValue===be))==null?void 0:ze.ref.current;(function ve(Se){L.current=Se,window.clearTimeout($.current),Se!==""&&($.current=window.setTimeout(()=>ve(""),1e3))})(H),_e&&setTimeout(()=>_e.focus())};h.useEffect(()=>()=>window.clearTimeout($.current),[]),Hf();const R=h.useCallback(M=>{var z,Y;return Z.current===((z=te.current)==null?void 0:z.side)&&Bp(M,(Y=te.current)==null?void 0:Y.area)},[]);return l.jsx(Ep,{scope:n,searchRef:L,onItemEnter:h.useCallback(M=>{R(M)&&M.preventDefault()},[R]),onItemLeave:h.useCallback(M=>{var H;R(M)||((H=E.current)==null||H.focus(),N(null))},[R]),onTriggerLeave:h.useCallback(M=>{R(M)&&M.preventDefault()},[R]),pointerGraceTimerRef:X,onPointerGraceIntentChange:h.useCallback(M=>{te.current=M},[]),children:l.jsx(ne,{...G,children:l.jsx(Oa,{asChild:!0,trapped:o,onMountAutoFocus:q(s,M=>{var H;M.preventDefault(),(H=E.current)==null||H.focus({preventScroll:!0})}),onUnmountAutoFocus:i,children:l.jsx(Ia,{asChild:!0,disableOutsidePointerEvents:a,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:g,onInteractOutside:m,onDismiss:f,children:l.jsx(dl,{asChild:!0,...b,dir:x.dir,orientation:"vertical",loop:r,currentTabStopId:C,onCurrentTabStopIdChange:N,onEntryFocus:q(c,M=>{x.isUsingKeyboardRef.current||M.preventDefault()}),preventScrollOnEntryFocus:!0,children:l.jsx(xg,{role:"menu","aria-orientation":"vertical","data-state":Bl(y.open),"data-radix-menu-content":"",dir:x.dir,...w,...p,ref:S,style:{outline:"none",...p.style},onKeyDown:q(p.onKeyDown,M=>{const z=M.target.closest("[data-radix-menu-content]")===M.currentTarget,Y=M.ctrlKey||M.altKey||M.metaKey,re=M.key.length===1;z&&(M.key==="Tab"&&M.preventDefault(),!Y&&re&&J(M.key));const le=E.current;if(M.target!==le||!xp.includes(M.key))return;M.preventDefault();const _e=_().filter(Q=>!Q.disabled).map(Q=>Q.ref.current);_l.includes(M.key)&&_e.reverse(),Vp(_e)}),onBlur:q(e.onBlur,M=>{M.currentTarget.contains(M.target)||(window.clearTimeout($.current),L.current="")}),onPointerMove:q(e.onPointerMove,vn(M=>{const H=M.target,z=V.current!==M.clientX;if(M.currentTarget.contains(H)&&z){const Y=M.clientX>V.current?"right":"left";Z.current=Y,V.current=M.clientX}}))})})})})})})});Ml.displayName=Oe;var Tp="MenuGroup",os=h.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return l.jsx(fe.div,{role:"group",...r,ref:t})});os.displayName=Tp;var jp="MenuLabel",Nl=h.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return l.jsx(fe.div,{...r,ref:t})});Nl.displayName=jp;var Kn="MenuItem",si="menu.itemSelect",mr=h.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:r,...o}=e,s=h.useRef(null),i=Cn(Kn,e.__scopeMenu),a=ns(Kn,e.__scopeMenu),c=ke(t,s),u=h.useRef(!1),d=()=>{const g=s.current;if(!n&&g){const m=new CustomEvent(si,{bubbles:!0,cancelable:!0});g.addEventListener(si,f=>r==null?void 0:r(f),{once:!0}),sa(g,m),m.defaultPrevented?u.current=!1:i.onClose()}};return l.jsx(Al,{...o,ref:c,disabled:n,onClick:q(e.onClick,d),onPointerDown:g=>{var m;(m=e.onPointerDown)==null||m.call(e,g),u.current=!0},onPointerUp:q(e.onPointerUp,g=>{var m;u.current||(m=g.currentTarget)==null||m.click()}),onKeyDown:q(e.onKeyDown,g=>{const m=a.searchRef.current!=="";n||m&&g.key===" "||wo.includes(g.key)&&(g.currentTarget.click(),g.preventDefault())})})});mr.displayName=Kn;var Al=h.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:r=!1,textValue:o,...s}=e,i=ns(Kn,n),a=Cl(n),c=h.useRef(null),u=ke(t,c),[d,g]=h.useState(!1),[m,f]=h.useState("");return h.useEffect(()=>{const v=c.current;v&&f((v.textContent??"").trim())},[s.children]),l.jsx(hn.ItemSlot,{scope:n,disabled:r,textValue:o??m,children:l.jsx(fl,{asChild:!0,...a,focusable:!r,children:l.jsx(fe.div,{role:"menuitem","data-highlighted":d?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...s,ref:u,onPointerMove:q(e.onPointerMove,vn(v=>{r?i.onItemLeave(v):(i.onItemEnter(v),v.defaultPrevented||v.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:q(e.onPointerLeave,vn(v=>i.onItemLeave(v))),onFocus:q(e.onFocus,()=>g(!0)),onBlur:q(e.onBlur,()=>g(!1))})})})}),Ip="MenuCheckboxItem",Tl=h.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:r,...o}=e;return l.jsx(Fl,{scope:e.__scopeMenu,checked:n,children:l.jsx(mr,{role:"menuitemcheckbox","aria-checked":Xn(n)?"mixed":n,...o,ref:t,"data-state":is(n),onSelect:q(o.onSelect,()=>r==null?void 0:r(Xn(n)?!0:!n),{checkForDefaultPrevented:!1})})})});Tl.displayName=Ip;var jl="MenuRadioGroup",[Pp,Op]=Ft(jl,{value:void 0,onValueChange:()=>{}}),Il=h.forwardRef((e,t)=>{const{value:n,onValueChange:r,...o}=e,s=it(r);return l.jsx(Pp,{scope:e.__scopeMenu,value:n,onValueChange:s,children:l.jsx(os,{...o,ref:t})})});Il.displayName=jl;var Pl="MenuRadioItem",Ol=h.forwardRef((e,t)=>{const{value:n,...r}=e,o=Op(Pl,e.__scopeMenu),s=n===o.value;return l.jsx(Fl,{scope:e.__scopeMenu,checked:s,children:l.jsx(mr,{role:"menuitemradio","aria-checked":s,...r,ref:t,"data-state":is(s),onSelect:q(r.onSelect,()=>{var i;return(i=o.onValueChange)==null?void 0:i.call(o,n)},{checkForDefaultPrevented:!1})})})});Ol.displayName=Pl;var ss="MenuItemIndicator",[Fl,Fp]=Ft(ss,{checked:!1}),Dl=h.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:r,...o}=e,s=Fp(ss,n);return l.jsx(Ot,{present:r||Xn(s.checked)||s.checked===!0,children:l.jsx(fe.span,{...o,ref:t,"data-state":is(s.checked)})})});Dl.displayName=ss;var Dp="MenuSeparator",$l=h.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return l.jsx(fe.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})});$l.displayName=Dp;var $p="MenuArrow",Ll=h.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,o=fr(n);return l.jsx(yg,{...o,...r,ref:t})});Ll.displayName=$p;var Lp="MenuSub",[Xv,Vl]=Ft(Lp),an="MenuSubTrigger",zl=h.forwardRef((e,t)=>{const n=Dt(an,e.__scopeMenu),r=Cn(an,e.__scopeMenu),o=Vl(an,e.__scopeMenu),s=ns(an,e.__scopeMenu),i=h.useRef(null),{pointerGraceTimerRef:a,onPointerGraceIntentChange:c}=s,u={__scopeMenu:e.__scopeMenu},d=h.useCallback(()=>{i.current&&window.clearTimeout(i.current),i.current=null},[]);return h.useEffect(()=>d,[d]),h.useEffect(()=>{const g=a.current;return()=>{window.clearTimeout(g),c(null)}},[a,c]),l.jsx(es,{asChild:!0,...u,children:l.jsx(Al,{id:o.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":o.contentId,"data-state":Bl(n.open),...e,ref:nr(t,o.onTriggerChange),onClick:g=>{var m;(m=e.onClick)==null||m.call(e,g),!(e.disabled||g.defaultPrevented)&&(g.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:q(e.onPointerMove,vn(g=>{s.onItemEnter(g),!g.defaultPrevented&&!e.disabled&&!n.open&&!i.current&&(s.onPointerGraceIntentChange(null),i.current=window.setTimeout(()=>{n.onOpenChange(!0),d()},100))})),onPointerLeave:q(e.onPointerLeave,vn(g=>{var f,v;d();const m=(f=n.content)==null?void 0:f.getBoundingClientRect();if(m){const p=(v=n.content)==null?void 0:v.dataset.side,y=p==="right",x=y?-5:5,w=m[y?"left":"right"],b=m[y?"right":"left"];s.onPointerGraceIntentChange({area:[{x:g.clientX+x,y:g.clientY},{x:w,y:m.top},{x:b,y:m.top},{x:b,y:m.bottom},{x:w,y:m.bottom}],side:p}),window.clearTimeout(a.current),a.current=window.setTimeout(()=>s.onPointerGraceIntentChange(null),300)}else{if(s.onTriggerLeave(g),g.defaultPrevented)return;s.onPointerGraceIntentChange(null)}})),onKeyDown:q(e.onKeyDown,g=>{var f;const m=s.searchRef.current!=="";e.disabled||m&&g.key===" "||yp[r.dir].includes(g.key)&&(n.onOpenChange(!0),(f=n.content)==null||f.focus(),g.preventDefault())})})})});zl.displayName=an;var Hl="MenuSubContent",Gl=h.forwardRef((e,t)=>{const n=kl(Oe,e.__scopeMenu),{forceMount:r=n.forceMount,...o}=e,s=Dt(Oe,e.__scopeMenu),i=Cn(Oe,e.__scopeMenu),a=Vl(Hl,e.__scopeMenu),c=h.useRef(null),u=ke(t,c);return l.jsx(hn.Provider,{scope:e.__scopeMenu,children:l.jsx(Ot,{present:r||s.open,children:l.jsx(hn.Slot,{scope:e.__scopeMenu,children:l.jsx(rs,{id:a.contentId,"aria-labelledby":a.triggerId,...o,ref:u,align:"start",side:i.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:d=>{var g;i.isUsingKeyboardRef.current&&((g=c.current)==null||g.focus()),d.preventDefault()},onCloseAutoFocus:d=>d.preventDefault(),onFocusOutside:q(e.onFocusOutside,d=>{d.target!==a.trigger&&s.onOpenChange(!1)}),onEscapeKeyDown:q(e.onEscapeKeyDown,d=>{i.onClose(),d.preventDefault()}),onKeyDown:q(e.onKeyDown,d=>{var f;const g=d.currentTarget.contains(d.target),m=wp[i.dir].includes(d.key);g&&m&&(s.onOpenChange(!1),(f=a.trigger)==null||f.focus(),d.preventDefault())})})})})})});Gl.displayName=Hl;function Bl(e){return e?"open":"closed"}function Xn(e){return e==="indeterminate"}function is(e){return Xn(e)?"indeterminate":e?"checked":"unchecked"}function Vp(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function zp(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function Hp(e,t,n){const o=t.length>1&&Array.from(t).every(u=>u===t[0])?t[0]:t,s=n?e.indexOf(n):-1;let i=zp(e,Math.max(s,0));o.length===1&&(i=i.filter(u=>u!==n));const c=i.find(u=>u.toLowerCase().startsWith(o.toLowerCase()));return c!==n?c:void 0}function Gp(e,t){const{x:n,y:r}=e;let o=!1;for(let s=0,i=t.length-1;s<t.length;i=s++){const a=t[s],c=t[i],u=a.x,d=a.y,g=c.x,m=c.y;d>r!=m>r&&n<(g-u)*(r-d)/(m-d)+u&&(o=!o)}return o}function Bp(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return Gp(n,t)}function vn(e){return t=>t.pointerType==="mouse"?e(t):void 0}var Up=Rl,Wp=es,qp=El,Zp=Ml,Kp=os,Xp=Nl,Yp=mr,Jp=Tl,Qp=Il,eh=Ol,th=Dl,nh=$l,rh=Ll,oh=zl,sh=Gl,gr="DropdownMenu",[ih]=Pt(gr,[Sl]),Me=Sl(),[ah,Ul]=ih(gr),Wl=e=>{const{__scopeDropdownMenu:t,children:n,dir:r,open:o,defaultOpen:s,onOpenChange:i,modal:a=!0}=e,c=Me(t),u=h.useRef(null),[d,g]=rr({prop:o,defaultProp:s??!1,onChange:i,caller:gr});return l.jsx(ah,{scope:t,triggerId:Bn(),triggerRef:u,contentId:Bn(),open:d,onOpenChange:g,onOpenToggle:h.useCallback(()=>g(m=>!m),[g]),modal:a,children:l.jsx(Up,{...c,open:d,onOpenChange:g,dir:r,modal:a,children:n})})};Wl.displayName=gr;var ql="DropdownMenuTrigger",Zl=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...o}=e,s=Ul(ql,n),i=Me(n);return l.jsx(Wp,{asChild:!0,...i,children:l.jsx(fe.button,{type:"button",id:s.triggerId,"aria-haspopup":"menu","aria-expanded":s.open,"aria-controls":s.open?s.contentId:void 0,"data-state":s.open?"open":"closed","data-disabled":r?"":void 0,disabled:r,...o,ref:nr(t,s.triggerRef),onPointerDown:q(e.onPointerDown,a=>{!r&&a.button===0&&a.ctrlKey===!1&&(s.onOpenToggle(),s.open||a.preventDefault())}),onKeyDown:q(e.onKeyDown,a=>{r||(["Enter"," "].includes(a.key)&&s.onOpenToggle(),a.key==="ArrowDown"&&s.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(a.key)&&a.preventDefault())})})})});Zl.displayName=ql;var lh="DropdownMenuPortal",Kl=e=>{const{__scopeDropdownMenu:t,...n}=e,r=Me(t);return l.jsx(qp,{...r,...n})};Kl.displayName=lh;var Xl="DropdownMenuContent",Yl=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Ul(Xl,n),s=Me(n),i=h.useRef(!1);return l.jsx(Zp,{id:o.contentId,"aria-labelledby":o.triggerId,...s,...r,ref:t,onCloseAutoFocus:q(e.onCloseAutoFocus,a=>{var c;i.current||(c=o.triggerRef.current)==null||c.focus(),i.current=!1,a.preventDefault()}),onInteractOutside:q(e.onInteractOutside,a=>{const c=a.detail.originalEvent,u=c.button===0&&c.ctrlKey===!0,d=c.button===2||u;(!o.modal||d)&&(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)"}})});Yl.displayName=Xl;var ch="DropdownMenuGroup",uh=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Me(n);return l.jsx(Kp,{...o,...r,ref:t})});uh.displayName=ch;var dh="DropdownMenuLabel",fh=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Me(n);return l.jsx(Xp,{...o,...r,ref:t})});fh.displayName=dh;var mh="DropdownMenuItem",gh=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Me(n);return l.jsx(Yp,{...o,...r,ref:t})});gh.displayName=mh;var ph="DropdownMenuCheckboxItem",Jl=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Me(n);return l.jsx(Jp,{...o,...r,ref:t})});Jl.displayName=ph;var hh="DropdownMenuRadioGroup",vh=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Me(n);return l.jsx(Qp,{...o,...r,ref:t})});vh.displayName=hh;var xh="DropdownMenuRadioItem",yh=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Me(n);return l.jsx(eh,{...o,...r,ref:t})});yh.displayName=xh;var wh="DropdownMenuItemIndicator",Ql=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Me(n);return l.jsx(th,{...o,...r,ref:t})});Ql.displayName=wh;var bh="DropdownMenuSeparator",_h=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Me(n);return l.jsx(nh,{...o,...r,ref:t})});_h.displayName=bh;var Sh="DropdownMenuArrow",Ch=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Me(n);return l.jsx(rh,{...o,...r,ref:t})});Ch.displayName=Sh;var Rh="DropdownMenuSubTrigger",kh=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Me(n);return l.jsx(oh,{...o,...r,ref:t})});kh.displayName=Rh;var Eh="DropdownMenuSubContent",Mh=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Me(n);return l.jsx(sh,{...o,...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)"}})});Mh.displayName=Eh;var Nh=Wl,Ah=Zl,Th=Kl,jh=Yl,Ih=Jl,Ph=Ql;function Oh({...e}){return l.jsx(Nh,{"data-slot":"dropdown-menu",...e})}function Fh({...e}){return l.jsx(Ah,{"data-slot":"dropdown-menu-trigger",...e})}function Dh({className:e,sideOffset:t=4,...n}){return l.jsx(Th,{children:l.jsx(jh,{"data-slot":"dropdown-menu-content",sideOffset:t,className:ue("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 $h({className:e,children:t,checked:n,...r}){return l.jsxs(Ih,{"data-slot":"dropdown-menu-checkbox-item",className:ue("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(Ph,{children:l.jsx(pa,{className:"size-4"})})}),t]})}function as({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:ue("w-full caption-bottom text-sm",e),...t})})}function Lh({className:e,...t}){return l.jsx("thead",{"data-slot":"table-header",className:ue("[&_tr]:border-b",e),...t})}function ls({className:e,...t}){return l.jsx("tbody",{"data-slot":"table-body",className:ue("[&_tr:last-child]:border-0",e),...t})}function we({className:e,...t}){return l.jsx("tr",{"data-slot":"table-row",className:ue("hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",e),...t})}function Vh({className:e,...t}){return l.jsx("th",{"data-slot":"table-head",className:ue("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 O({className:e,...t}){return l.jsx("td",{"data-slot":"table-cell",className:ue("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",e),...t})}function pr({columns:e,data:t,searchColumn:n,searchPlaceholder:r="Filter...",defaultColumnVisibility:o={},pageSize:s=25,defaultSorting:i=[]}){var y,x;const[a,c]=h.useState(i),[u,d]=h.useState([]),[g,m]=h.useState(o),[f,v]=h.useState({}),p=Tf({data:t,columns:e,onSortingChange:c,onColumnFiltersChange:d,getCoreRowModel:wf(),getPaginationRowModel:kf(),getSortedRowModel:Ef(),getFilteredRowModel:Rf(),onColumnVisibilityChange:m,onRowSelectionChange:v,initialState:{pagination:{pageSize:s}},state:{sorting:a,columnFilters:u,columnVisibility:g,rowSelection:f}});return l.jsxs("div",{className:"w-full",children:[l.jsxs("div",{className:"flex items-center py-4",children:[n&&l.jsx(ao,{placeholder:r,value:((y=p.getColumn(n))==null?void 0:y.getFilterValue())??"",onChange:w=>{var b;return(b=p.getColumn(n))==null?void 0:b.setFilterValue(w.target.value)},className:"max-w-sm"}),l.jsxs(Oh,{children:[l.jsx(Fh,{asChild:!0,children:l.jsxs(Nt,{variant:"outline",className:"ml-auto",children:["Columns ",l.jsx(ha,{className:"ml-2 h-4 w-4"})]})}),l.jsx(Dh,{align:"end",children:p.getAllColumns().filter(w=>w.getCanHide()).map(w=>l.jsx($h,{className:"capitalize",checked:w.getIsVisible(),onCheckedChange:b=>w.toggleVisibility(!!b),children:w.id},w.id))})]})]}),l.jsx("div",{className:"rounded-md border",children:l.jsxs(as,{children:[l.jsx(Lh,{children:p.getHeaderGroups().map(w=>l.jsx(we,{children:w.headers.map(b=>l.jsx(Vh,{children:b.isPlaceholder?null:Os(b.column.columnDef.header,b.getContext())},b.id))},w.id))}),l.jsx(ls,{children:(x=p.getRowModel().rows)!=null&&x.length?p.getRowModel().rows.map(w=>l.jsx(we,{"data-state":w.getIsSelected()&&"selected",children:w.getVisibleCells().map(b=>l.jsx(O,{children:Os(b.column.columnDef.cell,b.getContext())},b.id))},w.id)):l.jsx(we,{children:l.jsx(O,{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:[p.getFilteredRowModel().rows.length," row(s) total."]}),l.jsxs("div",{className:"space-x-2",children:[l.jsx(Nt,{variant:"outline",size:"sm",onClick:()=>p.previousPage(),disabled:!p.getCanPreviousPage(),children:"Previous"}),l.jsx(Nt,{variant:"outline",size:"sm",onClick:()=>p.nextPage(),disabled:!p.getCanNextPage(),children:"Next"})]})]})]})}function me(e,t="left"){return({column:n})=>{const r=t==="right"?"justify-end":t==="center"?"justify-center":"justify-start",o=n.getIsSorted();return l.jsx("div",{className:`flex ${r}`,children:l.jsxs(Nt,{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,o==="asc"&&l.jsx(ld,{className:"ml-1 h-3 w-3 text-muted-foreground"}),o==="desc"&&l.jsx(ha,{className:"ml-1 h-3 w-3 text-muted-foreground"})]})})}}const zh=300*1e3;function ec(e){const[t,n]=h.useState(new Map),r=h.useRef();return h.useEffect(()=>{const s=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:s,disconnectedAt:void 0})}),c.forEach((u,d)=>{!i.has(d)&&!u.disconnectedAt&&c.set(d,{...u,isConnected:!1,connectionStatus:"Disconnected",disconnectedAt:s,lastActivity:u.lastActivity||s})}),c})},[e]),h.useEffect(()=>{const s=()=>{const i=Date.now();n(a=>{const c=new Map(a);return c.forEach((u,d)=>{if(u.disconnectedAt){const g=new Date(u.disconnectedAt).getTime();i-g>zh&&c.delete(d)}}),c})};return s(),r.current=setInterval(s,3e4),()=>{r.current&&clearInterval(r.current)}},[]),Array.from(t.values()).sort((s,i)=>s.isConnected!==i.isConnected?s.isConnected?-1:1:new Date(i.lastActivity).getTime()-new Date(s.lastActivity).getTime())}function ii(e){const t=new Date,n=new Date(e),r=t.getTime()-n.getTime(),o=Math.floor(r/1e3);if(o<60)return"just now";const s=Math.floor(o/60);if(s<60)return`${s}m ago`;const i=Math.floor(s/60);return i<24?`${i}h ago`:`${Math.floor(i/24)}d ago`}function Hh(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 Gh(e){return e.length<=12?e:`${e.slice(0,5)}...${e.slice(-5)}`}function Bh(e){return e.length<=42?e:`${e.slice(0,35)}.....${e.slice(-5)}`}function Uh({metrics:e}){const t=e.sessions||[],n=ec(t),r=()=>[{accessorKey:"clientInfo",header:me("Client"),cell:({row:o})=>{const s=o.original,i=s.clientInfo?`${Bh(s.clientInfo.name)}@${s.clientInfo.version}`:"unknown";return l.jsx("div",{className:"font-mono text-sm",title:s.clientInfo?`${s.clientInfo.name}@${s.clientInfo.version}`:"unknown",children:i})}},{accessorKey:"id",header:me("Session ID"),cell:({row:o})=>l.jsx("div",{className:"font-mono text-sm",title:o.getValue("id"),children:Gh(o.getValue("id"))})},{accessorKey:"isConnected",header:me("Status"),cell:({row:o})=>{const s=o.original;return l.jsxs(Mt,{variant:s.isConnected?"success":"secondary",className:"gap-1",children:[s.isConnected?l.jsx(ya,{className:"h-3 w-3"}):l.jsx(xa,{className:"h-3 w-3"}),s.isConnected?"Connected":"Disconnected"]})}},{accessorKey:"connectedAt",header:me("Connected"),cell:({row:o})=>l.jsx("div",{className:"text-sm",children:ii(o.getValue("connectedAt"))})},{accessorKey:"requestCount",header:me("Requests","right"),cell:({row:o})=>l.jsx("div",{className:"text-right font-mono text-sm",children:o.getValue("requestCount")})},{accessorKey:"lastActivity",header:me("Last Activity"),cell:({row:o})=>l.jsx("div",{className:"text-sm",children:ii(o.getValue("lastActivity"))})}];return l.jsxs(nt,{children:[l.jsxs(rt,{children:[l.jsx(ot,{children:"📊 Transport Metrics"}),l.jsx(It,{children:"Real-time connection and performance metrics for STDIO transport"})]}),l.jsxs(st,{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:Hh(e.uptimeSeconds)})]})]}),l.jsxs(l.Fragment,{children:[l.jsx(At,{}),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(pr,{columns:r(),data:n,searchColumn:"id",searchPlaceholder:"Filter sessions...",pageSize:10,defaultSorting:[{id:"lastActivity",desc:!0}]})]})]})]})]})}function ai(e){const t=new Date,n=new Date(e),r=t.getTime()-n.getTime(),o=Math.floor(r/1e3);if(o<60)return"just now";const s=Math.floor(o/60);if(s<60)return`${s}m ago`;const i=Math.floor(s/60);return i<24?`${i}h ago`:`${Math.floor(i/24)}d ago`}function Wh(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 Ln(e){return e<1e3?`${e}ms`:e<6e4?`${Math.round(e/1e3)}s`:`${Math.round(e/6e4)}m`}function qh(e){return e.length<=12?e:`${e.slice(0,5)}...${e.slice(-5)}`}function Zh(e){return e.length<=42?e:`${e.slice(0,35)}.....${e.slice(-5)}`}function Kh({metrics:e}){const t=e.sessions||[],n=ec(t),r={sse:"Server-Sent Events",streamableHttp:"Streamable HTTP"},o=()=>[{accessorKey:"clientInfo",header:me("Client"),cell:({row:s})=>{const i=s.original,a=i.clientInfo?`${Zh(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:me("Session ID"),cell:({row:s})=>l.jsx("div",{className:"font-mono text-sm",title:s.getValue("id"),children:qh(s.getValue("id"))})},{accessorKey:"connectionStatus",header:me("Status"),cell:({row:s})=>{const i=s.original,a=i.connectionStatus||(i.isConnected?"Connected":"Disconnected");return a==="Connected"?l.jsxs(Mt,{variant:"success",className:"gap-1",children:[l.jsx(ya,{className:"h-3 w-3"}),"Connected"]}):a==="Distressed"?l.jsxs(Mt,{variant:"destructive",className:"gap-1",children:[l.jsx(va,{className:"h-3 w-3"}),"Distressed ",i.pingFailures?`(${i.pingFailures} failed)`:""]}):l.jsxs(Mt,{variant:"secondary",className:"gap-1",children:[l.jsx(xa,{className:"h-3 w-3"}),"Disconnected"]})}},{accessorKey:"connectedAt",header:me("Connected"),cell:({row:s})=>l.jsx("div",{className:"text-sm",children:ai(s.getValue("connectedAt"))})},{accessorKey:"requestCount",header:me("Requests","right"),cell:({row:s})=>l.jsx("div",{className:"text-right font-mono text-sm",children:s.getValue("requestCount")})},{accessorKey:"lastActivity",header:me("Last Activity"),cell:({row:s})=>l.jsx("div",{className:"text-sm",children:ai(s.getValue("lastActivity"))})}];return l.jsxs(nt,{children:[l.jsxs(rt,{children:[l.jsx(ot,{children:"📊 Transport Metrics"}),l.jsxs(It,{children:["Real-time connection and performance metrics for"," ",r[e.transport]||e.transport," transport"]})]}),l.jsxs(st,{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:Wh(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 ",Ln(e.configuration.heartbeatInterval||3e4),", sessions swept every ",Ln(e.configuration.staleCheckInterval),", removed after"," ",Ln(e.configuration.staleTimeout)," inactive",e.configuration.pingEnabled&&e.configuration.pingInterval&&`, pings sent every ${Ln(e.configuration.pingInterval)}`,e.configuration.pingEnabled&&`, marked distressed after ${e.configuration.pingFailureThreshold||1} failed ping${(e.configuration.pingFailureThreshold||1)!==1?"s":""}`]})]})}),l.jsx(At,{}),l.jsx("div",{children:l.jsx(as,{children:l.jsxs(ls,{children:[l.jsxs(we,{children:[l.jsx(O,{className:"font-medium text-sm",children:"Active Connections"}),l.jsx(O,{className:"text-sm font-mono",children:e.connections.active}),l.jsx(O,{className:"font-medium text-sm",children:"Cleaned Sessions"}),l.jsx(O,{className:"text-sm font-mono",children:e.connections.cleaned??0})]}),l.jsxs(we,{children:[l.jsx(O,{className:"font-medium text-sm",children:"Total Connections"}),l.jsx(O,{className:"text-sm font-mono",children:e.connections.total}),l.jsx(O,{className:"font-medium text-sm",children:"Requests per Minute (tot/3hr/hr)"}),l.jsxs(O,{className:"text-sm font-mono",children:[e.requests.averagePerMinute,"/",e.requests.last3Hours,"/",e.requests.lastHour]})]}),e.sessionLifecycle&&l.jsxs(we,{children:[l.jsx(O,{className:"font-medium text-sm",children:"Sessions New/Res-fail/Del"}),l.jsxs(O,{className:"text-sm font-mono",colSpan:3,children:[e.sessionLifecycle.created,"/",e.sessionLifecycle.resumedFailed,"/",e.sessionLifecycle.deleted]})]}),l.jsxs(we,{children:[l.jsx(O,{className:"font-medium text-sm",children:"Client Errors (4xx)"}),l.jsx(O,{className:"text-sm font-mono",children:e.errors.expected}),l.jsx(O,{className:"font-medium text-sm",children:"Server Errors (5xx)"}),l.jsx(O,{className:"text-sm font-mono",children:e.errors.unexpected})]}),e.pings&&l.jsxs(we,{children:[l.jsx(O,{className:"font-medium text-sm",children:"Pings Sent"}),l.jsx(O,{className:"text-sm font-mono",children:e.pings.sent}),l.jsx(O,{className:"font-medium text-sm",children:"Ping Success Rate"}),l.jsx(O,{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(we,{children:[l.jsx(O,{className:"font-medium text-sm",children:"Anonymous Users"}),l.jsx(O,{className:"text-sm font-mono",children:e.apiMetrics.anonymous}),l.jsx(O,{className:"font-medium text-sm",children:"Authenticated Users"}),l.jsx(O,{className:"text-sm font-mono",children:e.apiMetrics.authenticated})]}),l.jsxs(we,{children:[l.jsx(O,{className:"font-medium text-sm",children:"401 Unauthorized Users"}),l.jsx(O,{className:"text-sm font-mono",children:e.apiMetrics.unauthorized}),l.jsx(O,{className:"font-medium text-sm",children:"403 Forbidden Users"}),l.jsx(O,{className:"text-sm font-mono",children:e.apiMetrics.forbidden})]})]}),l.jsxs(we,{children:[l.jsx(O,{className:"font-medium text-sm",children:"Gradio Success/Fail"}),l.jsx(O,{className:"text-sm font-mono",children:e.gradioMetrics?`${e.gradioMetrics.success}/${e.gradioMetrics.failure}`:"0/0"}),l.jsx(O,{className:"font-medium text-sm",children:"-"}),l.jsx(O,{className:"text-sm font-mono",children:"-"})]})]})})}),l.jsxs(l.Fragment,{children:[l.jsx(At,{}),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(pr,{columns:o(),data:n,searchColumn:"id",searchPlaceholder:"Filter sessions...",pageSize:10,defaultSorting:[{id:"lastActivity",desc:!0}]})]})]})]})]})}function li(e){const t=new Date,n=new Date(e),r=t.getTime()-n.getTime(),o=Math.floor(r/1e3);if(o<60)return"just now";const s=Math.floor(o/60);if(s<60)return`${s}m ago`;const i=Math.floor(s/60);return i<24?`${i}h ago`:`${Math.floor(i/24)}d ago`}function Xh(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 Yh(e){const t=new Date,n=new Date(e),r=t.getTime()-n.getTime();return Math.floor(r/6e4)<5}function Jh(e){return e.length<=42?e:`${e.slice(0,35)}.....${e.slice(-5)}`}function Qh({metrics:e}){const t=e.clients,n=()=>[{accessorKey:"name",header:me("Client"),cell:({row:r})=>{const o=r.original,s=`${Jh(o.name)}@${o.version}`;return l.jsxs("div",{children:[l.jsx("p",{className:"font-medium font-mono text-sm",title:`${o.name}@${o.version}`,children:s}),l.jsxs("p",{className:"text-xs text-muted-foreground",children:["First seen ",li(o.firstSeen)]})]})}},{accessorKey:"requestCount",header:me("Initializations","right"),cell:({row:r})=>l.jsx("div",{className:"text-right font-mono text-sm",children:r.getValue("requestCount")})},{accessorKey:"isConnected",header:me("Status"),cell:({row:r})=>{const o=r.original;return l.jsx("div",{children:Yh(o.lastSeen)?l.jsxs(Mt,{variant:"success",className:"gap-1",children:[l.jsx(od,{className:"h-3 w-3"}),"Recent"]}):l.jsxs(Mt,{variant:"secondary",className:"gap-1",children:[l.jsx(ud,{className:"h-3 w-3"}),"Idle"]})})}},{accessorKey:"lastSeen",header:me("Last Seen","right"),cell:({row:r})=>l.jsx("div",{className:"text-right text-sm",children:li(r.getValue("lastSeen"))})}];return l.jsxs(nt,{children:[l.jsxs(rt,{children:[l.jsx(ot,{children:"📊 Transport Metrics"}),l.jsx(It,{children:"Real-time connection and performance metrics for Stateless HTTP JSON transport"})]}),l.jsxs(st,{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(Mt,{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:Xh(e.uptimeSeconds)})]})]}),l.jsx(At,{}),l.jsx("div",{children:l.jsx(as,{children:l.jsxs(ls,{children:[l.jsxs(we,{children:[l.jsx(O,{className:"font-medium text-sm",children:"Request Count (MCP)"}),l.jsx(O,{className:"text-sm font-mono",children:e.connections.total}),l.jsx(O,{className:"font-medium text-sm",children:"Requests per Minute (tot/3hr/hr)"}),l.jsxs(O,{className:"text-sm font-mono",children:[e.requests.averagePerMinute,"/",e.requests.last3Hours,"/",e.requests.lastHour]})]}),l.jsxs(we,{children:[l.jsx(O,{className:"font-medium text-sm",children:"Client Errors (4xx)"}),l.jsx(O,{className:"text-sm font-mono",children:e.errors.expected}),l.jsx(O,{className:"font-medium text-sm",children:"Server Errors (5xx)"}),l.jsx(O,{className:"text-sm font-mono",children:e.errors.unexpected})]}),(e.staticPageHits200!==void 0||e.staticPageHits405!==void 0)&&l.jsxs(we,{children:[l.jsx(O,{className:"font-medium text-sm",children:l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx(gd,{className:"h-3 w-3"}),"hf.co/mcp (200/405)"]})}),l.jsxs(O,{className:"text-sm font-mono",children:[e.staticPageHits200||0,"/",e.staticPageHits405||0]}),l.jsx(O,{className:"font-medium text-sm",children:l.jsx("div",{className:"flex items-center gap-1",children:"Auth Status (Anon/Auth/401)"})}),l.jsxs(O,{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(we,{children:[l.jsx(O,{className:"font-medium text-sm",children:"Tool API - Anonymous"}),l.jsx(O,{className:"text-sm font-mono",children:e.apiMetrics.anonymous}),l.jsx(O,{className:"font-medium text-sm",children:"Tool API - Authenticated"}),l.jsx(O,{className:"text-sm font-mono",children:e.apiMetrics.authenticated})]}),l.jsxs(we,{children:[l.jsx(O,{className:"font-medium text-sm",children:"Tool API - 401 Unauthorized"}),l.jsx(O,{className:"text-sm font-mono",children:e.apiMetrics.unauthorized}),l.jsx(O,{className:"font-medium text-sm",children:"Tool API - 403 Forbidden"}),l.jsx(O,{className:"text-sm font-mono",children:e.apiMetrics.forbidden})]})]}),l.jsxs(we,{children:[l.jsx(O,{className:"font-medium text-sm",children:"Gradio Success/Fail"}),l.jsx(O,{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(O,{className:"font-medium text-sm",children:"Sessions New/Res-fail/Del"}),l.jsxs(O,{className:"text-sm font-mono",children:[e.sessionLifecycle.created,"/",e.sessionLifecycle.resumedFailed,"/",e.sessionLifecycle.deleted]})]}):l.jsxs(l.Fragment,{children:[l.jsx(O,{className:"font-medium text-sm",children:"-"}),l.jsx(O,{className:"text-sm font-mono",children:"-"})]})]})]})})}),l.jsxs(l.Fragment,{children:[l.jsx(At,{}),l.jsxs("div",{children:[l.jsx("h3",{className:"text-sm font-semibold text-foreground mb-3",children:"Client Identities"}),l.jsx(pr,{columns:n(),data:t,searchColumn:"name",searchPlaceholder:"Filter clients...",pageSize:50,defaultSorting:[{id:"lastSeen",desc:!0}]})]})]})]})]})}const ev=e=>fetch(e).then(t=>{if(!t.ok)throw new Error(`Failed to fetch: ${t.status}`);return t.json()});function tv(){const{data:e,error:t}=cn("/api/transport-metrics",ev,{refreshInterval:3e3,revalidateOnFocus:!0,revalidateOnReconnect:!0});return t?l.jsxs(nt,{children:[l.jsx(rt,{children:l.jsx(ot,{children:"📊 Transport Metrics"})}),l.jsx(st,{children:l.jsxs(kd,{variant:"destructive",children:[l.jsx(va,{className:"h-4 w-4"}),l.jsx(Ed,{children:"Error Loading Metrics"}),l.jsxs(Md,{children:["Failed to load transport metrics: ",t.message]})]})})]}):e?e.transport==="stdio"?l.jsx(Uh,{metrics:e}):e.isStateless?l.jsx(Qh,{metrics:e}):l.jsx(Kh,{metrics:e}):l.jsxs(nt,{children:[l.jsx(rt,{children:l.jsx(ot,{children:"📊 Transport Metrics"})}),l.jsx(st,{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 nv=e=>fetch(e).then(t=>{if(!t.ok)throw new Error(`Failed to fetch: ${t.status}`);return t.json()});function rv(){const[e,t]=h.useState(!1),{data:n,error:r}=cn("/api/transport-metrics",nv,{refreshInterval:3e3,revalidateOnFocus:!0,revalidateOnReconnect:!0}),o=!n&&!r,s=(n==null?void 0:n.transport)==="stdio",i=((n==null?void 0:n.methods)||[]).map(m=>{let f=m.errors,v,p;if(m.method.startsWith("tools/call:")&&(n!=null&&n.gradioMetrics)){const w=m.method.replace("tools/call:",""),b=n.gradioMetrics.byTool;b[w]&&(v=b[w].success,p=b[w].failure,f+=p)}const y=m.count>0?f/m.count*100:0;return{method:m.method,count:m.count,errors:f,errorRate:y,averageResponseTime:m.averageResponseTime,lastCalled:m.lastCalled,gradioSuccess:v,gradioFailure:p}}),a=e?i.filter(m=>m.method.startsWith("tools/call")||m.method.startsWith("prompts/get")):i,c=i.reduce((m,f)=>m+f.count,0),u=i.filter(m=>m.method.startsWith("tools/call")).reduce((m,f)=>m+f.count,0),d=i.filter(m=>m.method.startsWith("prompts/get")).reduce((m,f)=>m+f.count,0),g=[{accessorKey:"method",header:me("Method"),cell:({row:m})=>{const f=m.getValue("method");return l.jsx("div",{className:"font-mono text-sm",children:f==="tools/call"?l.jsx("span",{className:"text-blue-600 dark:text-blue-400",children:"tools/call"}):f.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:f.replace("tools/call:","")})]}):f==="prompts/get"?l.jsx("span",{className:"text-purple-600 dark:text-purple-400",children:"prompts/get"}):f.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:f.replace("prompts/get:","")})]}):f})}},{accessorKey:"count",header:me("Calls","right"),cell:({row:m})=>l.jsx("div",{className:"text-right font-mono",children:m.getValue("count").toLocaleString()})},{accessorKey:"errors",header:me("Errors","right"),cell:({row:m})=>{const f=m.getValue("errors");return l.jsx("div",{className:"text-right font-mono",children:f>0?l.jsx("span",{className:"text-red-600 dark:text-red-400",children:f}):"0"})}},{accessorKey:"gradioMetrics",header:me("Success/Failure","right"),cell:({row:m})=>{const f=m.original;return f.gradioSuccess!==void 0&&f.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:f.gradioSuccess}),l.jsx("span",{className:"text-muted-foreground",children:"/"}),l.jsx("span",{className:"text-red-600 dark:text-red-400",children:f.gradioFailure})]}):l.jsx("div",{className:"text-right text-muted-foreground",children:"—"})}},{accessorKey:"errorRate",header:me("Error Rate","right"),cell:({row:m})=>{const f=m.getValue("errorRate");return l.jsx("div",{className:"text-right font-mono",children:f>0?l.jsxs("span",{className:"text-red-600 dark:text-red-400",children:[f.toFixed(1),"%"]}):"0%"})}},{accessorKey:"averageResponseTime",header:me("Avg Response","right"),cell:({row:m})=>{const f=m.getValue("averageResponseTime");return l.jsx("div",{className:"text-right font-mono",children:f?`${f.toFixed(0)}ms`:"—"})}},{accessorKey:"lastCalled",header:me("Last Called","right"),cell:({row:m})=>l.jsx("div",{className:"text-right text-sm text-muted-foreground",children:new Date(m.getValue("lastCalled")).toLocaleTimeString()})}];return l.jsxs(nt,{children:[l.jsxs(rt,{children:[l.jsx(ot,{children:"HTTP JSON Transport Statistics"}),l.jsxs(It,{children:["MCP method call statistics and performance metrics",s?" (Empty in STDIO mode)":n!=null&&n.isStateless?"":" (Response times not available in stateful modes)"]})]}),l.jsxs(st,{children:[o&&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]})}),s&&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&&!s&&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:d.toLocaleString()})]})]})]}),i.length>0&&l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx(Lo,{id:"tool-prompt-calls-filter",checked:e,onCheckedChange:m=>t(!!m)}),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(pr,{columns:g,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 ci(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 ov({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"}},o=()=>{switch(n.transport){case"sse":return"/sse";case"streamableHttp":case"streamableHttpJson":return"/mcp";case"stdio":return"stdin/stdout";default:return"unknown"}},s=()=>n.transport==="streamableHttpJson"||n.transport==="streamableHttp"&&n.jsonResponseEnabled===!0,i=()=>s()?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:o()}),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 ${ci(n).isWarning?"text-red-500":""}`,children:ci(n).text})]})]})})}var hr="Tabs",[sv]=Pt(hr,[ur]),tc=ur(),[iv,cs]=sv(hr),nc=h.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:o,defaultValue:s,orientation:i="horizontal",dir:a,activationMode:c="automatic",...u}=e,d=Uo(a),[g,m]=rr({prop:r,onChange:o,defaultProp:s??"",caller:hr});return l.jsx(iv,{scope:n,baseId:Bn(),value:g,onValueChange:m,orientation:i,dir:d,activationMode:c,children:l.jsx(fe.div,{dir:d,"data-orientation":i,...u,ref:t})})});nc.displayName=hr;var rc="TabsList",oc=h.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...o}=e,s=cs(rc,n),i=tc(n);return l.jsx(dl,{asChild:!0,...i,orientation:s.orientation,dir:s.dir,loop:r,children:l.jsx(fe.div,{role:"tablist","aria-orientation":s.orientation,...o,ref:t})})});oc.displayName=rc;var sc="TabsTrigger",ic=h.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:o=!1,...s}=e,i=cs(sc,n),a=tc(n),c=cc(i.baseId,r),u=uc(i.baseId,r),d=r===i.value;return l.jsx(fl,{asChild:!0,...a,focusable:!o,active:d,children:l.jsx(fe.button,{type:"button",role:"tab","aria-selected":d,"aria-controls":u,"data-state":d?"active":"inactive","data-disabled":o?"":void 0,disabled:o,id:c,...s,ref:t,onMouseDown:q(e.onMouseDown,g=>{!o&&g.button===0&&g.ctrlKey===!1?i.onValueChange(r):g.preventDefault()}),onKeyDown:q(e.onKeyDown,g=>{[" ","Enter"].includes(g.key)&&i.onValueChange(r)}),onFocus:q(e.onFocus,()=>{const g=i.activationMode!=="manual";!d&&!o&&g&&i.onValueChange(r)})})})});ic.displayName=sc;var ac="TabsContent",lc=h.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:o,children:s,...i}=e,a=cs(ac,n),c=cc(a.baseId,r),u=uc(a.baseId,r),d=r===a.value,g=h.useRef(d);return h.useEffect(()=>{const m=requestAnimationFrame(()=>g.current=!1);return()=>cancelAnimationFrame(m)},[]),l.jsx(Ot,{present:o||d,children:({present:m})=>l.jsx(fe.div,{"data-state":d?"active":"inactive","data-orientation":a.orientation,role:"tabpanel","aria-labelledby":c,hidden:!m,id:u,tabIndex:0,...i,ref:t,style:{...e.style,animationDuration:g.current?"0s":void 0},children:m&&s})})});lc.displayName=ac;function cc(e,t){return`${e}-trigger-${t}`}function uc(e,t){return`${e}-content-${t}`}var av=nc,lv=oc,cv=ic,uv=lc;function dv({className:e,...t}){return l.jsx(av,{"data-slot":"tabs",className:ue("flex flex-col gap-2",e),...t})}function fv({className:e,...t}){return l.jsx(lv,{"data-slot":"tabs-list",className:ue("bg-muted text-muted-foreground inline-flex h-9 w-fit items-center justify-center rounded-lg p-[3px]",e),...t})}function Ht({className:e,...t}){return l.jsx(cv,{"data-slot":"tabs-trigger",className:ue("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 Gt({className:e,...t}){return l.jsx(uv,{"data-slot":"tabs-content",className:ue("flex-1 outline-none",e),...t})}const ui="ALLOW_README_INCLUDE",di="NO_GRADIO_IMAGE_CONTENT";var ie;(function(e){e.assertEqual=o=>{};function t(o){}e.assertIs=t;function n(o){throw new Error}e.assertNever=n,e.arrayToEnum=o=>{const s={};for(const i of o)s[i]=i;return s},e.getValidEnumValues=o=>{const s=e.objectKeys(o).filter(a=>typeof o[o[a]]!="number"),i={};for(const a of s)i[a]=o[a];return e.objectValues(i)},e.objectValues=o=>e.objectKeys(o).map(function(s){return o[s]}),e.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{const s=[];for(const i in o)Object.prototype.hasOwnProperty.call(o,i)&&s.push(i);return s},e.find=(o,s)=>{for(const i of o)if(s(i))return i},e.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&Number.isFinite(o)&&Math.floor(o)===o;function r(o,s=" | "){return o.map(i=>typeof i=="string"?`'${i}'`:i).join(s)}e.joinValues=r,e.jsonStringifyReplacer=(o,s)=>typeof s=="bigint"?s.toString():s})(ie||(ie={}));var fi;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(fi||(fi={}));const I=ie.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),gt=e=>{switch(typeof e){case"undefined":return I.undefined;case"string":return I.string;case"number":return Number.isNaN(e)?I.nan:I.number;case"boolean":return I.boolean;case"function":return I.function;case"bigint":return I.bigint;case"symbol":return I.symbol;case"object":return Array.isArray(e)?I.array:e===null?I.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?I.promise:typeof Map<"u"&&e instanceof Map?I.map:typeof Set<"u"&&e instanceof Set?I.set:typeof Date<"u"&&e instanceof Date?I.date:I.object;default:return I.unknown}},k=ie.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 ct 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(s){return s.message},r={_errors:[]},o=s=>{for(const i of s.issues)if(i.code==="invalid_union")i.unionErrors.map(o);else if(i.code==="invalid_return_type")o(i.returnTypeError);else if(i.code==="invalid_arguments")o(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 o(this),r}static assert(t){if(!(t instanceof ct))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,ie.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=n=>n.message){const n={},r=[];for(const o of this.issues)if(o.path.length>0){const s=o.path[0];n[s]=n[s]||[],n[s].push(t(o))}else r.push(t(o));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}ct.create=e=>new ct(e);const bo=(e,t)=>{let n;switch(e.code){case k.invalid_type:e.received===I.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case k.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,ie.jsonStringifyReplacer)}`;break;case k.unrecognized_keys:n=`Unrecognized key(s) in object: ${ie.joinValues(e.keys,", ")}`;break;case k.invalid_union:n="Invalid input";break;case k.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${ie.joinValues(e.options)}`;break;case k.invalid_enum_value:n=`Invalid enum value. Expected ${ie.joinValues(e.options)}, received '${e.received}'`;break;case k.invalid_arguments:n="Invalid function arguments";break;case k.invalid_return_type:n="Invalid function return type";break;case k.invalid_date:n="Invalid date";break;case k.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}"`:ie.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case k.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==="bigint"?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 k.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 k.custom:n="Invalid input";break;case k.invalid_intersection_types:n="Intersection results could not be merged";break;case k.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case k.not_finite:n="Number must be finite";break;default:n=t.defaultError,ie.assertNever(e)}return{message:n}};let mv=bo;function gv(){return mv}const pv=e=>{const{data:t,path:n,errorMaps:r,issueData:o}=e,s=[...n,...o.path||[]],i={...o,path:s};if(o.message!==void 0)return{...o,path:s,message:o.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{...o,path:s,message:a}};function A(e,t){const n=gv(),r=pv({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===bo?void 0:bo].filter(o=>!!o)});e.common.issues.push(r)}class Ie{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 o of n){if(o.status==="aborted")return B;o.status==="dirty"&&t.dirty(),r.push(o.value)}return{status:t.value,value:r}}static async mergeObjectAsync(t,n){const r=[];for(const o of n){const s=await o.key,i=await o.value;r.push({key:s,value:i})}return Ie.mergeObjectSync(t,r)}static mergeObjectSync(t,n){const r={};for(const o of n){const{key:s,value:i}=o;if(s.status==="aborted"||i.status==="aborted")return B;s.status==="dirty"&&t.dirty(),i.status==="dirty"&&t.dirty(),s.value!=="__proto__"&&(typeof i.value<"u"||o.alwaysSet)&&(r[s.value]=i.value)}return{status:t.value,value:r}}}const B=Object.freeze({status:"aborted"}),ln=e=>({status:"dirty",value:e}),Fe=e=>({status:"valid",value:e}),mi=e=>e.status==="aborted",gi=e=>e.status==="dirty",Zt=e=>e.status==="valid",Yn=e=>typeof Promise<"u"&&e instanceof Promise;var P;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t==null?void 0:t.message})(P||(P={}));class Rt{constructor(t,n,r,o){this._cachedPath=[],this.parent=t,this.data=n,this._path=r,this._key=o}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 pi=(e,t)=>{if(Zt(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 ct(e.common.issues);return this._error=n,this._error}}};function K(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:r,description:o}=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:o}:{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:o}}class se{get description(){return this._def.description}_getType(t){return gt(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:gt(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new Ie,ctx:{common:t.parent.common,data:t.data,parsedType:gt(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const n=this._parse(t);if(Yn(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:gt(t)},o=this._parseSync({data:t,path:r.path,parent:r});return pi(r,o)}"~validate"(t){var r,o;const n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:gt(t)};if(!this["~standard"].async)try{const s=this._parseSync({data:t,path:[],parent:n});return Zt(s)?{value:s.value}:{issues:n.common.issues}}catch(s){(o=(r=s==null?void 0:s.message)==null?void 0:r.toLowerCase())!=null&&o.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:n}).then(s=>Zt(s)?{value:s.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:gt(t)},o=this._parse({data:t,path:r.path,parent:r}),s=await(Yn(o)?o:Promise.resolve(o));return pi(r,s)}refine(t,n){const r=o=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(o):n;return this._refinement((o,s)=>{const i=t(o),a=()=>s.addIssue({code:k.custom,...r(o)});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,o)=>t(r)?!0:(o.addIssue(typeof n=="function"?n(r,o):n),!1))}_refinement(t){return new Yt({schema:this,typeName:U.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 yt.create(this,this._def)}nullable(){return Jt.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return qe.create(this)}promise(){return tr.create(this,this._def)}or(t){return Qn.create([this,t],this._def)}and(t){return er.create(this,t,this._def)}transform(t){return new Yt({...K(this._def),schema:this,typeName:U.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const n=typeof t=="function"?t:()=>t;return new Co({...K(this._def),innerType:this,defaultValue:n,typeName:U.ZodDefault})}brand(){return new $v({typeName:U.ZodBranded,type:this,...K(this._def)})}catch(t){const n=typeof t=="function"?t:()=>t;return new Ro({...K(this._def),innerType:this,catchValue:n,typeName:U.ZodCatch})}describe(t){const n=this.constructor;return new n({...this._def,description:t})}pipe(t){return us.create(this,t)}readonly(){return ko.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const hv=/^c[^\s-]{8,}$/i,vv=/^[0-9a-z]+$/,xv=/^[0-9A-HJKMNP-TV-Z]{26}$/i,yv=/^[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,wv=/^[a-z0-9_-]{21}$/i,bv=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,_v=/^[-+]?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)?)??$/,Sv=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Cv="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let qr;const Rv=/^(?:(?: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])$/,kv=/^(?:(?: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])$/,Ev=/^(([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]))$/,Mv=/^(([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])$/,Nv=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Av=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,dc="((\\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])))",Tv=new RegExp(`^${dc}$`);function fc(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 jv(e){return new RegExp(`^${fc(e)}$`)}function Iv(e){let t=`${dc}T${fc(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 Pv(e,t){return!!((t==="v4"||!t)&&Rv.test(e)||(t==="v6"||!t)&&Ev.test(e))}function Ov(e,t){if(!bv.test(e))return!1;try{const[n]=e.split(".");if(!n)return!1;const r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),o=JSON.parse(atob(r));return!(typeof o!="object"||o===null||"typ"in o&&(o==null?void 0:o.typ)!=="JWT"||!o.alg||t&&o.alg!==t)}catch{return!1}}function Fv(e,t){return!!((t==="v4"||!t)&&kv.test(e)||(t==="v6"||!t)&&Mv.test(e))}class vt extends se{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==I.string){const s=this._getOrReturnCtx(t);return A(s,{code:k.invalid_type,expected:I.string,received:s.parsedType}),B}const r=new Ie;let o;for(const s of this._def.checks)if(s.kind==="min")t.data.length<s.value&&(o=this._getOrReturnCtx(t,o),A(o,{code:k.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="max")t.data.length>s.value&&(o=this._getOrReturnCtx(t,o),A(o,{code:k.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="length"){const i=t.data.length>s.value,a=t.data.length<s.value;(i||a)&&(o=this._getOrReturnCtx(t,o),i?A(o,{code:k.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):a&&A(o,{code:k.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),r.dirty())}else if(s.kind==="email")Sv.test(t.data)||(o=this._getOrReturnCtx(t,o),A(o,{validation:"email",code:k.invalid_string,message:s.message}),r.dirty());else if(s.kind==="emoji")qr||(qr=new RegExp(Cv,"u")),qr.test(t.data)||(o=this._getOrReturnCtx(t,o),A(o,{validation:"emoji",code:k.invalid_string,message:s.message}),r.dirty());else if(s.kind==="uuid")yv.test(t.data)||(o=this._getOrReturnCtx(t,o),A(o,{validation:"uuid",code:k.invalid_string,message:s.message}),r.dirty());else if(s.kind==="nanoid")wv.test(t.data)||(o=this._getOrReturnCtx(t,o),A(o,{validation:"nanoid",code:k.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid")hv.test(t.data)||(o=this._getOrReturnCtx(t,o),A(o,{validation:"cuid",code:k.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid2")vv.test(t.data)||(o=this._getOrReturnCtx(t,o),A(o,{validation:"cuid2",code:k.invalid_string,message:s.message}),r.dirty());else if(s.kind==="ulid")xv.test(t.data)||(o=this._getOrReturnCtx(t,o),A(o,{validation:"ulid",code:k.invalid_string,message:s.message}),r.dirty());else if(s.kind==="url")try{new URL(t.data)}catch{o=this._getOrReturnCtx(t,o),A(o,{validation:"url",code:k.invalid_string,message:s.message}),r.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(t.data)||(o=this._getOrReturnCtx(t,o),A(o,{validation:"regex",code:k.invalid_string,message:s.message}),r.dirty())):s.kind==="trim"?t.data=t.data.trim():s.kind==="includes"?t.data.includes(s.value,s.position)||(o=this._getOrReturnCtx(t,o),A(o,{code:k.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),r.dirty()):s.kind==="toLowerCase"?t.data=t.data.toLowerCase():s.kind==="toUpperCase"?t.data=t.data.toUpperCase():s.kind==="startsWith"?t.data.startsWith(s.value)||(o=this._getOrReturnCtx(t,o),A(o,{code:k.invalid_string,validation:{startsWith:s.value},message:s.message}),r.dirty()):s.kind==="endsWith"?t.data.endsWith(s.value)||(o=this._getOrReturnCtx(t,o),A(o,{code:k.invalid_string,validation:{endsWith:s.value},message:s.message}),r.dirty()):s.kind==="datetime"?Iv(s).test(t.data)||(o=this._getOrReturnCtx(t,o),A(o,{code:k.invalid_string,validation:"datetime",message:s.message}),r.dirty()):s.kind==="date"?Tv.test(t.data)||(o=this._getOrReturnCtx(t,o),A(o,{code:k.invalid_string,validation:"date",message:s.message}),r.dirty()):s.kind==="time"?jv(s).test(t.data)||(o=this._getOrReturnCtx(t,o),A(o,{code:k.invalid_string,validation:"time",message:s.message}),r.dirty()):s.kind==="duration"?_v.test(t.data)||(o=this._getOrReturnCtx(t,o),A(o,{validation:"duration",code:k.invalid_string,message:s.message}),r.dirty()):s.kind==="ip"?Pv(t.data,s.version)||(o=this._getOrReturnCtx(t,o),A(o,{validation:"ip",code:k.invalid_string,message:s.message}),r.dirty()):s.kind==="jwt"?Ov(t.data,s.alg)||(o=this._getOrReturnCtx(t,o),A(o,{validation:"jwt",code:k.invalid_string,message:s.message}),r.dirty()):s.kind==="cidr"?Fv(t.data,s.version)||(o=this._getOrReturnCtx(t,o),A(o,{validation:"cidr",code:k.invalid_string,message:s.message}),r.dirty()):s.kind==="base64"?Nv.test(t.data)||(o=this._getOrReturnCtx(t,o),A(o,{validation:"base64",code:k.invalid_string,message:s.message}),r.dirty()):s.kind==="base64url"?Av.test(t.data)||(o=this._getOrReturnCtx(t,o),A(o,{validation:"base64url",code:k.invalid_string,message:s.message}),r.dirty()):ie.assertNever(s);return{status:r.value,value:t.data}}_regex(t,n,r){return this.refinement(o=>t.test(o),{validation:n,code:k.invalid_string,...P.errToObj(r)})}_addCheck(t){return new vt({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...P.errToObj(t)})}url(t){return this._addCheck({kind:"url",...P.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...P.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...P.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...P.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...P.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...P.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...P.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...P.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...P.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...P.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...P.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...P.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,...P.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,...P.errToObj(t==null?void 0:t.message)})}duration(t){return this._addCheck({kind:"duration",...P.errToObj(t)})}regex(t,n){return this._addCheck({kind:"regex",regex:t,...P.errToObj(n)})}includes(t,n){return this._addCheck({kind:"includes",value:t,position:n==null?void 0:n.position,...P.errToObj(n==null?void 0:n.message)})}startsWith(t,n){return this._addCheck({kind:"startsWith",value:t,...P.errToObj(n)})}endsWith(t,n){return this._addCheck({kind:"endsWith",value:t,...P.errToObj(n)})}min(t,n){return this._addCheck({kind:"min",value:t,...P.errToObj(n)})}max(t,n){return this._addCheck({kind:"max",value:t,...P.errToObj(n)})}length(t,n){return this._addCheck({kind:"length",value:t,...P.errToObj(n)})}nonempty(t){return this.min(1,P.errToObj(t))}trim(){return new vt({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new vt({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new vt({...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}}vt.create=e=>new vt({checks:[],typeName:U.ZodString,coerce:(e==null?void 0:e.coerce)??!1,...K(e)});function Dv(e,t){const n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,o=n>r?n:r,s=Number.parseInt(e.toFixed(o).replace(".","")),i=Number.parseInt(t.toFixed(o).replace(".",""));return s%i/10**o}class Kt extends se{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)!==I.number){const s=this._getOrReturnCtx(t);return A(s,{code:k.invalid_type,expected:I.number,received:s.parsedType}),B}let r;const o=new Ie;for(const s of this._def.checks)s.kind==="int"?ie.isInteger(t.data)||(r=this._getOrReturnCtx(t,r),A(r,{code:k.invalid_type,expected:"integer",received:"float",message:s.message}),o.dirty()):s.kind==="min"?(s.inclusive?t.data<s.value:t.data<=s.value)&&(r=this._getOrReturnCtx(t,r),A(r,{code:k.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),o.dirty()):s.kind==="max"?(s.inclusive?t.data>s.value:t.data>=s.value)&&(r=this._getOrReturnCtx(t,r),A(r,{code:k.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),o.dirty()):s.kind==="multipleOf"?Dv(t.data,s.value)!==0&&(r=this._getOrReturnCtx(t,r),A(r,{code:k.not_multiple_of,multipleOf:s.value,message:s.message}),o.dirty()):s.kind==="finite"?Number.isFinite(t.data)||(r=this._getOrReturnCtx(t,r),A(r,{code:k.not_finite,message:s.message}),o.dirty()):ie.assertNever(s);return{status:o.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,P.toString(n))}gt(t,n){return this.setLimit("min",t,!1,P.toString(n))}lte(t,n){return this.setLimit("max",t,!0,P.toString(n))}lt(t,n){return this.setLimit("max",t,!1,P.toString(n))}setLimit(t,n,r,o){return new Kt({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:P.toString(o)}]})}_addCheck(t){return new Kt({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:P.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:P.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:P.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:P.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:P.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:P.toString(n)})}finite(t){return this._addCheck({kind:"finite",message:P.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:P.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:P.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"&&ie.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)}}Kt.create=e=>new Kt({checks:[],typeName:U.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1,...K(e)});class xn extends se{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)!==I.bigint)return this._getInvalidInput(t);let r;const o=new Ie;for(const s of this._def.checks)s.kind==="min"?(s.inclusive?t.data<s.value:t.data<=s.value)&&(r=this._getOrReturnCtx(t,r),A(r,{code:k.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),o.dirty()):s.kind==="max"?(s.inclusive?t.data>s.value:t.data>=s.value)&&(r=this._getOrReturnCtx(t,r),A(r,{code:k.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),o.dirty()):s.kind==="multipleOf"?t.data%s.value!==BigInt(0)&&(r=this._getOrReturnCtx(t,r),A(r,{code:k.not_multiple_of,multipleOf:s.value,message:s.message}),o.dirty()):ie.assertNever(s);return{status:o.value,value:t.data}}_getInvalidInput(t){const n=this._getOrReturnCtx(t);return A(n,{code:k.invalid_type,expected:I.bigint,received:n.parsedType}),B}gte(t,n){return this.setLimit("min",t,!0,P.toString(n))}gt(t,n){return this.setLimit("min",t,!1,P.toString(n))}lte(t,n){return this.setLimit("max",t,!0,P.toString(n))}lt(t,n){return this.setLimit("max",t,!1,P.toString(n))}setLimit(t,n,r,o){return new xn({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:P.toString(o)}]})}_addCheck(t){return new xn({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:P.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:P.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:P.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:P.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:P.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}}xn.create=e=>new xn({checks:[],typeName:U.ZodBigInt,coerce:(e==null?void 0:e.coerce)??!1,...K(e)});class _o extends se{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==I.boolean){const r=this._getOrReturnCtx(t);return A(r,{code:k.invalid_type,expected:I.boolean,received:r.parsedType}),B}return Fe(t.data)}}_o.create=e=>new _o({typeName:U.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1,...K(e)});class Jn extends se{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==I.date){const s=this._getOrReturnCtx(t);return A(s,{code:k.invalid_type,expected:I.date,received:s.parsedType}),B}if(Number.isNaN(t.data.getTime())){const s=this._getOrReturnCtx(t);return A(s,{code:k.invalid_date}),B}const r=new Ie;let o;for(const s of this._def.checks)s.kind==="min"?t.data.getTime()<s.value&&(o=this._getOrReturnCtx(t,o),A(o,{code:k.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),r.dirty()):s.kind==="max"?t.data.getTime()>s.value&&(o=this._getOrReturnCtx(t,o),A(o,{code:k.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),r.dirty()):ie.assertNever(s);return{status:r.value,value:new Date(t.data.getTime())}}_addCheck(t){return new Jn({...this._def,checks:[...this._def.checks,t]})}min(t,n){return this._addCheck({kind:"min",value:t.getTime(),message:P.toString(n)})}max(t,n){return this._addCheck({kind:"max",value:t.getTime(),message:P.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}}Jn.create=e=>new Jn({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:U.ZodDate,...K(e)});class hi extends se{_parse(t){if(this._getType(t)!==I.symbol){const r=this._getOrReturnCtx(t);return A(r,{code:k.invalid_type,expected:I.symbol,received:r.parsedType}),B}return Fe(t.data)}}hi.create=e=>new hi({typeName:U.ZodSymbol,...K(e)});class vi extends se{_parse(t){if(this._getType(t)!==I.undefined){const r=this._getOrReturnCtx(t);return A(r,{code:k.invalid_type,expected:I.undefined,received:r.parsedType}),B}return Fe(t.data)}}vi.create=e=>new vi({typeName:U.ZodUndefined,...K(e)});class xi extends se{_parse(t){if(this._getType(t)!==I.null){const r=this._getOrReturnCtx(t);return A(r,{code:k.invalid_type,expected:I.null,received:r.parsedType}),B}return Fe(t.data)}}xi.create=e=>new xi({typeName:U.ZodNull,...K(e)});class yi extends se{constructor(){super(...arguments),this._any=!0}_parse(t){return Fe(t.data)}}yi.create=e=>new yi({typeName:U.ZodAny,...K(e)});class wi extends se{constructor(){super(...arguments),this._unknown=!0}_parse(t){return Fe(t.data)}}wi.create=e=>new wi({typeName:U.ZodUnknown,...K(e)});class kt extends se{_parse(t){const n=this._getOrReturnCtx(t);return A(n,{code:k.invalid_type,expected:I.never,received:n.parsedType}),B}}kt.create=e=>new kt({typeName:U.ZodNever,...K(e)});class bi extends se{_parse(t){if(this._getType(t)!==I.undefined){const r=this._getOrReturnCtx(t);return A(r,{code:k.invalid_type,expected:I.void,received:r.parsedType}),B}return Fe(t.data)}}bi.create=e=>new bi({typeName:U.ZodVoid,...K(e)});class qe extends se{_parse(t){const{ctx:n,status:r}=this._processInputParams(t),o=this._def;if(n.parsedType!==I.array)return A(n,{code:k.invalid_type,expected:I.array,received:n.parsedType}),B;if(o.exactLength!==null){const i=n.data.length>o.exactLength.value,a=n.data.length<o.exactLength.value;(i||a)&&(A(n,{code:i?k.too_big:k.too_small,minimum:a?o.exactLength.value:void 0,maximum:i?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),r.dirty())}if(o.minLength!==null&&n.data.length<o.minLength.value&&(A(n,{code:k.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),r.dirty()),o.maxLength!==null&&n.data.length>o.maxLength.value&&(A(n,{code:k.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((i,a)=>o.type._parseAsync(new Rt(n,i,n.path,a)))).then(i=>Ie.mergeArray(r,i));const s=[...n.data].map((i,a)=>o.type._parseSync(new Rt(n,i,n.path,a)));return Ie.mergeArray(r,s)}get element(){return this._def.type}min(t,n){return new qe({...this._def,minLength:{value:t,message:P.toString(n)}})}max(t,n){return new qe({...this._def,maxLength:{value:t,message:P.toString(n)}})}length(t,n){return new qe({...this._def,exactLength:{value:t,message:P.toString(n)}})}nonempty(t){return this.min(1,t)}}qe.create=(e,t)=>new qe({type:e,minLength:null,maxLength:null,exactLength:null,typeName:U.ZodArray,...K(t)});function Bt(e){if(e instanceof he){const t={};for(const n in e.shape){const r=e.shape[n];t[n]=yt.create(Bt(r))}return new he({...e._def,shape:()=>t})}else return e instanceof qe?new qe({...e._def,type:Bt(e.element)}):e instanceof yt?yt.create(Bt(e.unwrap())):e instanceof Jt?Jt.create(Bt(e.unwrap())):e instanceof jt?jt.create(e.items.map(t=>Bt(t))):e}class he extends se{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=ie.objectKeys(t);return this._cached={shape:t,keys:n},this._cached}_parse(t){if(this._getType(t)!==I.object){const u=this._getOrReturnCtx(t);return A(u,{code:k.invalid_type,expected:I.object,received:u.parsedType}),B}const{status:r,ctx:o}=this._processInputParams(t),{shape:s,keys:i}=this._getCached(),a=[];if(!(this._def.catchall instanceof kt&&this._def.unknownKeys==="strip"))for(const u in o.data)i.includes(u)||a.push(u);const c=[];for(const u of i){const d=s[u],g=o.data[u];c.push({key:{status:"valid",value:u},value:d._parse(new Rt(o,g,o.path,u)),alwaysSet:u in o.data})}if(this._def.catchall instanceof kt){const u=this._def.unknownKeys;if(u==="passthrough")for(const d of a)c.push({key:{status:"valid",value:d},value:{status:"valid",value:o.data[d]}});else if(u==="strict")a.length>0&&(A(o,{code:k.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 d of a){const g=o.data[d];c.push({key:{status:"valid",value:d},value:u._parse(new Rt(o,g,o.path,d)),alwaysSet:d in o.data})}}return o.common.async?Promise.resolve().then(async()=>{const u=[];for(const d of c){const g=await d.key,m=await d.value;u.push({key:g,value:m,alwaysSet:d.alwaysSet})}return u}).then(u=>Ie.mergeObjectSync(r,u)):Ie.mergeObjectSync(r,c)}get shape(){return this._def.shape()}strict(t){return P.errToObj,new he({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(n,r)=>{var s,i;const o=((i=(s=this._def).errorMap)==null?void 0:i.call(s,n,r).message)??r.defaultError;return n.code==="unrecognized_keys"?{message:P.errToObj(t).message??o}:{message:o}}}:{}})}strip(){return new he({...this._def,unknownKeys:"strip"})}passthrough(){return new he({...this._def,unknownKeys:"passthrough"})}extend(t){return new he({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new he({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:U.ZodObject})}setKey(t,n){return this.augment({[t]:n})}catchall(t){return new he({...this._def,catchall:t})}pick(t){const n={};for(const r of ie.objectKeys(t))t[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new he({...this._def,shape:()=>n})}omit(t){const n={};for(const r of ie.objectKeys(this.shape))t[r]||(n[r]=this.shape[r]);return new he({...this._def,shape:()=>n})}deepPartial(){return Bt(this)}partial(t){const n={};for(const r of ie.objectKeys(this.shape)){const o=this.shape[r];t&&!t[r]?n[r]=o:n[r]=o.optional()}return new he({...this._def,shape:()=>n})}required(t){const n={};for(const r of ie.objectKeys(this.shape))if(t&&!t[r])n[r]=this.shape[r];else{let s=this.shape[r];for(;s instanceof yt;)s=s._def.innerType;n[r]=s}return new he({...this._def,shape:()=>n})}keyof(){return mc(ie.objectKeys(this.shape))}}he.create=(e,t)=>new he({shape:()=>e,unknownKeys:"strip",catchall:kt.create(),typeName:U.ZodObject,...K(t)});he.strictCreate=(e,t)=>new he({shape:()=>e,unknownKeys:"strict",catchall:kt.create(),typeName:U.ZodObject,...K(t)});he.lazycreate=(e,t)=>new he({shape:e,unknownKeys:"strip",catchall:kt.create(),typeName:U.ZodObject,...K(t)});class Qn extends se{_parse(t){const{ctx:n}=this._processInputParams(t),r=this._def.options;function o(s){for(const a of s)if(a.result.status==="valid")return a.result;for(const a of s)if(a.result.status==="dirty")return n.common.issues.push(...a.ctx.common.issues),a.result;const i=s.map(a=>new ct(a.ctx.common.issues));return A(n,{code:k.invalid_union,unionErrors:i}),B}if(n.common.async)return Promise.all(r.map(async s=>{const i={...n,common:{...n.common,issues:[]},parent:null};return{result:await s._parseAsync({data:n.data,path:n.path,parent:i}),ctx:i}})).then(o);{let s;const i=[];for(const c of r){const u={...n,common:{...n.common,issues:[]},parent:null},d=c._parseSync({data:n.data,path:n.path,parent:u});if(d.status==="valid")return d;d.status==="dirty"&&!s&&(s={result:d,ctx:u}),u.common.issues.length&&i.push(u.common.issues)}if(s)return n.common.issues.push(...s.ctx.common.issues),s.result;const a=i.map(c=>new ct(c));return A(n,{code:k.invalid_union,unionErrors:a}),B}}get options(){return this._def.options}}Qn.create=(e,t)=>new Qn({options:e,typeName:U.ZodUnion,...K(t)});function So(e,t){const n=gt(e),r=gt(t);if(e===t)return{valid:!0,data:e};if(n===I.object&&r===I.object){const o=ie.objectKeys(t),s=ie.objectKeys(e).filter(a=>o.indexOf(a)!==-1),i={...e,...t};for(const a of s){const c=So(e[a],t[a]);if(!c.valid)return{valid:!1};i[a]=c.data}return{valid:!0,data:i}}else if(n===I.array&&r===I.array){if(e.length!==t.length)return{valid:!1};const o=[];for(let s=0;s<e.length;s++){const i=e[s],a=t[s],c=So(i,a);if(!c.valid)return{valid:!1};o.push(c.data)}return{valid:!0,data:o}}else return n===I.date&&r===I.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class er extends se{_parse(t){const{status:n,ctx:r}=this._processInputParams(t),o=(s,i)=>{if(mi(s)||mi(i))return B;const a=So(s.value,i.value);return a.valid?((gi(s)||gi(i))&&n.dirty(),{status:n.value,value:a.data}):(A(r,{code:k.invalid_intersection_types}),B)};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(([s,i])=>o(s,i)):o(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}er.create=(e,t,n)=>new er({left:e,right:t,typeName:U.ZodIntersection,...K(n)});class jt extends se{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==I.array)return A(r,{code:k.invalid_type,expected:I.array,received:r.parsedType}),B;if(r.data.length<this._def.items.length)return A(r,{code:k.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),B;!this._def.rest&&r.data.length>this._def.items.length&&(A(r,{code:k.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const s=[...r.data].map((i,a)=>{const c=this._def.items[a]||this._def.rest;return c?c._parse(new Rt(r,i,r.path,a)):null}).filter(i=>!!i);return r.common.async?Promise.all(s).then(i=>Ie.mergeArray(n,i)):Ie.mergeArray(n,s)}get items(){return this._def.items}rest(t){return new jt({...this._def,rest:t})}}jt.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new jt({items:e,typeName:U.ZodTuple,rest:null,...K(t)})};class _i extends se{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!==I.map)return A(r,{code:k.invalid_type,expected:I.map,received:r.parsedType}),B;const o=this._def.keyType,s=this._def.valueType,i=[...r.data.entries()].map(([a,c],u)=>({key:o._parse(new Rt(r,a,r.path,[u,"key"])),value:s._parse(new Rt(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,d=await c.value;if(u.status==="aborted"||d.status==="aborted")return B;(u.status==="dirty"||d.status==="dirty")&&n.dirty(),a.set(u.value,d.value)}return{status:n.value,value:a}})}else{const a=new Map;for(const c of i){const u=c.key,d=c.value;if(u.status==="aborted"||d.status==="aborted")return B;(u.status==="dirty"||d.status==="dirty")&&n.dirty(),a.set(u.value,d.value)}return{status:n.value,value:a}}}}_i.create=(e,t,n)=>new _i({valueType:t,keyType:e,typeName:U.ZodMap,...K(n)});class yn extends se{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==I.set)return A(r,{code:k.invalid_type,expected:I.set,received:r.parsedType}),B;const o=this._def;o.minSize!==null&&r.data.size<o.minSize.value&&(A(r,{code:k.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),n.dirty()),o.maxSize!==null&&r.data.size>o.maxSize.value&&(A(r,{code:k.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),n.dirty());const s=this._def.valueType;function i(c){const u=new Set;for(const d of c){if(d.status==="aborted")return B;d.status==="dirty"&&n.dirty(),u.add(d.value)}return{status:n.value,value:u}}const a=[...r.data.values()].map((c,u)=>s._parse(new Rt(r,c,r.path,u)));return r.common.async?Promise.all(a).then(c=>i(c)):i(a)}min(t,n){return new yn({...this._def,minSize:{value:t,message:P.toString(n)}})}max(t,n){return new yn({...this._def,maxSize:{value:t,message:P.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}}yn.create=(e,t)=>new yn({valueType:e,minSize:null,maxSize:null,typeName:U.ZodSet,...K(t)});class Si extends se{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})}}Si.create=(e,t)=>new Si({getter:e,typeName:U.ZodLazy,...K(t)});class Ci extends se{_parse(t){if(t.data!==this._def.value){const n=this._getOrReturnCtx(t);return A(n,{received:n.data,code:k.invalid_literal,expected:this._def.value}),B}return{status:"valid",value:t.data}}get value(){return this._def.value}}Ci.create=(e,t)=>new Ci({value:e,typeName:U.ZodLiteral,...K(t)});function mc(e,t){return new Xt({values:e,typeName:U.ZodEnum,...K(t)})}class Xt extends se{_parse(t){if(typeof t.data!="string"){const n=this._getOrReturnCtx(t),r=this._def.values;return A(n,{expected:ie.joinValues(r),received:n.parsedType,code:k.invalid_type}),B}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 A(n,{received:n.data,code:k.invalid_enum_value,options:r}),B}return Fe(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 Xt.create(t,{...this._def,...n})}exclude(t,n=this._def){return Xt.create(this.options.filter(r=>!t.includes(r)),{...this._def,...n})}}Xt.create=mc;class Ri extends se{_parse(t){const n=ie.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==I.string&&r.parsedType!==I.number){const o=ie.objectValues(n);return A(r,{expected:ie.joinValues(o),received:r.parsedType,code:k.invalid_type}),B}if(this._cache||(this._cache=new Set(ie.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){const o=ie.objectValues(n);return A(r,{received:r.data,code:k.invalid_enum_value,options:o}),B}return Fe(t.data)}get enum(){return this._def.values}}Ri.create=(e,t)=>new Ri({values:e,typeName:U.ZodNativeEnum,...K(t)});class tr extends se{unwrap(){return this._def.type}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==I.promise&&n.common.async===!1)return A(n,{code:k.invalid_type,expected:I.promise,received:n.parsedType}),B;const r=n.parsedType===I.promise?n.data:Promise.resolve(n.data);return Fe(r.then(o=>this._def.type.parseAsync(o,{path:n.path,errorMap:n.common.contextualErrorMap})))}}tr.create=(e,t)=>new tr({type:e,typeName:U.ZodPromise,...K(t)});class Yt extends se{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===U.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:n,ctx:r}=this._processInputParams(t),o=this._def.effect||null,s={addIssue:i=>{A(r,i),i.fatal?n.abort():n.dirty()},get path(){return r.path}};if(s.addIssue=s.addIssue.bind(s),o.type==="preprocess"){const i=o.transform(r.data,s);if(r.common.async)return Promise.resolve(i).then(async a=>{if(n.value==="aborted")return B;const c=await this._def.schema._parseAsync({data:a,path:r.path,parent:r});return c.status==="aborted"?B:c.status==="dirty"||n.value==="dirty"?ln(c.value):c});{if(n.value==="aborted")return B;const a=this._def.schema._parseSync({data:i,path:r.path,parent:r});return a.status==="aborted"?B:a.status==="dirty"||n.value==="dirty"?ln(a.value):a}}if(o.type==="refinement"){const i=a=>{const c=o.refinement(a,s);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"?B:(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"?B:(a.status==="dirty"&&n.dirty(),i(a.value).then(()=>({status:n.value,value:a.value}))))}if(o.type==="transform")if(r.common.async===!1){const i=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Zt(i))return B;const a=o.transform(i.value,s);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=>Zt(i)?Promise.resolve(o.transform(i.value,s)).then(a=>({status:n.value,value:a})):B);ie.assertNever(o)}}Yt.create=(e,t,n)=>new Yt({schema:e,typeName:U.ZodEffects,effect:t,...K(n)});Yt.createWithPreprocess=(e,t,n)=>new Yt({schema:t,effect:{type:"preprocess",transform:e},typeName:U.ZodEffects,...K(n)});class yt extends se{_parse(t){return this._getType(t)===I.undefined?Fe(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}yt.create=(e,t)=>new yt({innerType:e,typeName:U.ZodOptional,...K(t)});class Jt extends se{_parse(t){return this._getType(t)===I.null?Fe(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}Jt.create=(e,t)=>new Jt({innerType:e,typeName:U.ZodNullable,...K(t)});class Co extends se{_parse(t){const{ctx:n}=this._processInputParams(t);let r=n.data;return n.parsedType===I.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}Co.create=(e,t)=>new Co({innerType:e,typeName:U.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...K(t)});class Ro extends se{_parse(t){const{ctx:n}=this._processInputParams(t),r={...n,common:{...n.common,issues:[]}},o=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return Yn(o)?o.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new ct(r.common.issues)},input:r.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new ct(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}Ro.create=(e,t)=>new Ro({innerType:e,typeName:U.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...K(t)});class ki extends se{_parse(t){if(this._getType(t)!==I.nan){const r=this._getOrReturnCtx(t);return A(r,{code:k.invalid_type,expected:I.nan,received:r.parsedType}),B}return{status:"valid",value:t.data}}}ki.create=e=>new ki({typeName:U.ZodNaN,...K(e)});class $v extends se{_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 us extends se{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.common.async)return(async()=>{const s=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?B:s.status==="dirty"?(n.dirty(),ln(s.value)):this._def.out._parseAsync({data:s.value,path:r.path,parent:r})})();{const o=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?B:o.status==="dirty"?(n.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:r.path,parent:r})}}static create(t,n){return new us({in:t,out:n,typeName:U.ZodPipeline})}}class ko extends se{_parse(t){const n=this._def.innerType._parse(t),r=o=>(Zt(o)&&(o.value=Object.freeze(o.value)),o);return Yn(n)?n.then(o=>r(o)):r(n)}unwrap(){return this._def.innerType}}ko.create=(e,t)=>new ko({innerType:e,typeName:U.ZodReadonly,...K(t)});var U;(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"})(U||(U={}));const de=vt.create,Rn=Kt.create,vr=_o.create;kt.create;const gc=qe.create,ye=he.create;Qn.create;er.create;jt.create;const rn=Xt.create;tr.create;yt.create;Jt.create;const Lv=10,Eo={name:"space_search",description:"Find Hugging Face Spaces using semantic search. Include links to the Space when presenting the results.",schema:ye({query:de().min(1,"Query is required").max(100,"Query too long").describe("Semantic Search Query"),limit:Rn().optional().default(Lv).describe("Number of results to return"),mcp:vr().optional().default(!1).describe("Only return MCP Server enabled Spaces")}),annotations:{title:"Hugging Face Space Search"}},Mo={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:ye({query:de().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:de().optional().describe("Organization or user who created the model (e.g., 'google', 'meta-llama', 'microsoft')"),task:de().optional().describe("Model task type (e.g., 'text-generation', 'image-classification', 'translation')"),library:de().optional().describe("Framework the model uses (e.g., 'transformers', 'diffusers', 'timm')"),sort:rn(["trendingScore","downloads","likes","createdAt","lastModified"]).optional().describe("Sort order: trendingScore, downloads , likes, createdAt, lastModified"),limit:Rn().min(1).max(100).optional().default(20).describe("Maximum number of results to return")}),annotations:{title:"Model Search"}};new Promise(e=>{});var Zr=65536;Vv();function Vv(){try{return new Uint32Array(Zr)}catch{const t=new Array(Zr);for(let n=0;n<Zr;n++)t[n]=0;return t}}const zv={name:"model_details",schema:ye({model_id:de().min(1,"Model ID is required").describe("The Model ID in author/model format (e.g., microsoft/DialoGPT-large)")})};ye({model_id:de().min(5,"Model ID is required").max(50).describe("The Model ID in author/model format (e.g. 'openai/gpt-oss-120b')")});const No={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:ye({query:de().min(3,"Supply at least one search term").max(200,"Query too long").describe("Semantic Search query"),results_limit:Rn().optional().default(12).describe("Number of results to return"),concise_only:vr().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"}},Ao={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:ye({query:de().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:de().optional().describe("Organization or user who created the dataset (e.g., 'google', 'facebook', 'allenai')"),tags:gc(de()).optional().describe("Tags to filter datasets (e.g., ['language:en', 'size_categories:1M<n<10M', 'task_categories:text-classification'])"),sort:rn(["trendingScore","downloads","likes","createdAt","lastModified"]).optional().describe("Sort order: trendingScore, downloads, likes, createdAt, lastModified"),limit:Rn().min(1).max(100).optional().default(20).describe("Maximum number of results to return")}),annotations:{title:"Dataset Search"}},Hv={name:"dataset_details",schema:ye({dataset_id:de().min(5,"Dataset ID is required").describe("The Dataset ID (e.g. Anthropic/hh-rlhf, squad)")})};ye({dataset_id:de().min(3,"Dataset ID is required").max(100).describe("The Dataset ID (e.g. 'Anthropic/hh-rlhf', 'squad')")});const To={name:"hub_repo_details",description:"Get details for one or more Hugging Face repos (model, dataset, or space). Auto-detects type unless specified.",schema:ye({repo_ids:gc(de().min(1)).min(1,"Provide at least one id").max(10,"Provide at most 10 repo ids").describe("Repo IDs for (models|dataset/space) - usually in author/name format (e.g. openai/gpt-oss-120b)"),repo_type:rn(["model","dataset","space"]).optional().describe("Specify lookup type; otherwise auto-detects"),include_readme:vr().default(!1).describe("Include README from the repo")}),annotations:{title:"Hub Repo Details"}},pc={name:"duplicate_space",schema:ye({sourceSpaceId:de().min(1).describe("Space ID to copy (e.g., 'username/space-name')"),newSpaceId:de().optional().describe("Name for the new space (optional, defaults to source space-name)"),hardware:rn(["freecpu","zerogpu"]).optional().describe('Either "freecpu" or "zerogpu" (defaults based on source). Both options are in the free tier.'),private:vr().optional().default(!0).describe("Check with User whether the new space should be public or private.")}),annotations:{title:"Duplicate Hugging Face Space"}};ye({username:de().optional().describe("Username to get spaces for (defaults to authenticated user)")});const hc={name:"space_files",schema:ye({spaceName:de().optional().describe('Space identifier in format "username/spacename"'),fileType:rn(["all","image","audio"]).optional().default("all").describe("Filter files by type: all (default), image, or audio files only")}),annotations:{title:"Space Files List"}};ye({fileType:rn(["all","image","audio","text"]).optional().default("all").describe("Filter by type")});ye({});ye({user_id:de().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")});ye({paper_id:de().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 ds=typeof window<"u"?window:{};function Gv(){var e=ds.DOMParser,t=!1;try{new e().parseFromString("","text/html")&&(t=!0)}catch{}return t}function Bv(){var e=function(){};return Uv()?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 Uv(){var e=!1;try{document.implementation.createHTMLDocument("").open()}catch{ds.ActiveXObject&&(e=!0)}return e}Gv()?ds.DOMParser:Bv();const jo={name:"hf_doc_fetch",description:"Fetch a document from the Hugging Face or Gradio documentation library. For large documents, use offset to get subsequent chunks.",schema:ye({doc_url:de().max(200,"Query too long").describe("Documentation URL (Hugging Face or Gradio)"),offset:Rn().min(0).optional().describe("Token offset for large documents (use the offset from truncation message)")}),annotations:{title:"Fetch a document from the Hugging Face documentation library"}},Io={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:ye({query:de().min(3,"Supply at least one search term").max(200,"Query too long").describe("Semantic search query"),product:de().optional().describe('Filter by Product (e.g., "hub", "dataset-viewer", "transformers"). Supply when known for focused results')}),annotations:{title:"Hugging Face Documentation Library Search"}};ye({space_id:de().min(1).describe("Space ID in 'username/repo' format")});const Ei=Eo.name,Mi=Mo.name,Wv=zv.name,Ni=No.name,Ai=Ao.name,qv=Hv.name,dn=To.name,Ti=pc.name,ji=hc.name,Ii=Io.name,Pi=jo.name;function Oi(e){const t=new Set,n=[];let r=!1;for(const o of e){if(o===Wv||o===qv){r=!0;continue}t.has(o)||(t.add(o),n.push(o))}return r&&!t.has(dn)&&(t.add(dn),n.push(dn)),n}const Kr=e=>fetch(e).then(t=>{if(!t.ok)throw new Error(`Failed to fetch: ${t.status}`);return t.json()});function Zv(){var S,$,L,X,te,Z,V,ne,G,J,R;const{data:e,error:t}=cn("/api/transport",Kr,{refreshInterval:3e3,revalidateOnFocus:!0,revalidateOnReconnect:!0});cn("/api/sessions",Kr,{refreshInterval:3e3,revalidateOnFocus:!0});const{data:n}=cn("/api/settings",Kr),r=((S=n==null?void 0:n.builtInTools)==null?void 0:S.includes(ui))??!1,o=(($=n==null?void 0:n.builtInTools)==null?void 0:$.includes(di))??!1,[s,i]=h.useState(["","",""]),[a,c]=h.useState(["","",""]),[u,d]=h.useState([!1,!1,!1]),[g,m]=h.useState(!1);h.useEffect(()=>{if(n!=null&&n.spaceTools&&!g){const M=["","",""],H=["","",""],z=[!1,!1,!1];n.spaceTools.forEach((Y,re)=>{re<3&&(M[re]=Y.name,H[re]=Y.subdomain,z[re]=!0)}),i(M),c(H),d(z),m(!0)}},[n,g]);const f=!e&&!t,v=t?t.message:null,p=async(M,H)=>{try{const z=n||{builtInTools:[]},Y=Oi(z.builtInTools),re=H?[...Y.filter(Q=>Q!==M),M]:Y.filter(Q=>Q!==M),le=Oi(re),be={...z,builtInTools:le};Vn("/api/settings",be,!1);const _e=await fetch("/api/settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({builtInTools:le})});if(!_e.ok)throw new Error(`Failed to update tool settings: ${_e.status}`);Vn("/api/settings"),console.log(`${M} is now ${H?"enabled":"disabled"}`)}catch(z){console.error("Error updating tool settings:",z),alert(`Error updating ${M}: ${z instanceof Error?z.message:"Unknown error"}`),Vn("/api/settings")}},y=async(M,H)=>{const z=[...u];z[M]=H,d(z),await b(z)},x=async(M,H)=>{const z=[...s];z[M]=H,i(z),u[M]&&await b(u)},w=async(M,H)=>{const z=[...a];z[M]=H,c(z),u[M]&&await b(u)},b=async M=>{try{const H=[];for(let Y=0;Y<3;Y++)M[Y]&&s[Y]&&a[Y]&&H.push({_id:`space-${Y}`,name:s[Y],subdomain:a[Y],emoji:"🔧"});const z=await fetch("/api/settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({spaceTools:H})});if(!z.ok)throw new Error(`Failed to update space tools: ${z.status}`)}catch(H){console.error("Error updating space tools:",H)}},_=async()=>{const M="https://huggingface.co/mcp";try{await navigator.clipboard.writeText(M)}catch(H){console.error("Failed to copy URL:",H)}},C=()=>{window.open("https://huggingface.co/settings/mcp","_blank")},N={paper_search:{id:Ni,label:No.annotations.title,description:No.description,settings:{enabled:((L=n==null?void 0:n.builtInTools)==null?void 0:L.includes(Ni))??!0}},space_search:{id:Ei,label:Eo.annotations.title,description:Eo.description,settings:{enabled:((X=n==null?void 0:n.builtInTools)==null?void 0:X.includes(Ei))??!0}},model_search:{id:Mi,label:Mo.annotations.title,description:Mo.description,settings:{enabled:((te=n==null?void 0:n.builtInTools)==null?void 0:te.includes(Mi))??!0}},dataset_search:{id:Ai,label:Ao.annotations.title,description:Ao.description,settings:{enabled:((Z=n==null?void 0:n.builtInTools)==null?void 0:Z.includes(Ai))??!0}},hub_repo_details:{id:dn,label:To.annotations.title,description:To.description,settings:{enabled:((V=n==null?void 0:n.builtInTools)==null?void 0:V.includes(dn))??!0}},include_readme:{id:ui,label:"Allow README Include (flag)",description:"Allows hub_repo_details to attach README content when the tool request explicitly opts in. Requires reconnect to take effect.",settings:{enabled:r}},doc_semantic_search:{id:Ii,label:Io.annotations.title,description:Io.description,settings:{enabled:((ne=n==null?void 0:n.builtInTools)==null?void 0:ne.includes(Ii))??!0}},doc_fetch:{id:Pi,label:jo.annotations.title,description:jo.description,settings:{enabled:((G=n==null?void 0:n.builtInTools)==null?void 0:G.includes(Pi))??!0}}},E={duplicate_space:{id:Ti,label:pc.annotations.title,description:"Duplicate a Hugging Face Space to your account.",settings:{enabled:((J=n==null?void 0:n.builtInTools)==null?void 0:J.includes(Ti))??!0}},space_files:{id:ji,label:hc.annotations.title,description:"List all files in a static Hugging Face Space with download URLs.",settings:{enabled:((R=n==null?void 0:n.builtInTools)==null?void 0:R.includes(ji))??!0}},no_gradio_images:{id:di,label:"Disable Gradio Images (flag)",description:"Strips image responses from Gradio spaces. Mirrors the 'no_image_content' URL parameter and requires reconnect to take effect.",settings:{enabled:o}}};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(dv,{defaultValue:"metrics",className:"w-full",children:[l.jsxs(fv,{className:"mb-6 w-full overflow-x-auto flex-nowrap",children:[l.jsx(Ht,{value:"metrics",className:"whitespace-nowrap",children:"📊 Metrics"}),l.jsx(Ht,{value:"mcp",className:"whitespace-nowrap",children:"🔧 MCP"}),!(e!=null&&e.externalApiMode)&&l.jsx(Ht,{value:"search",className:"whitespace-nowrap",children:"🔍 Search"}),!(e!=null&&e.externalApiMode)&&l.jsx(Ht,{value:"spaces",className:"whitespace-nowrap",children:"🚀 Spaces"}),!(e!=null&&e.externalApiMode)&&l.jsx(Ht,{value:"gradio",className:"whitespace-nowrap",children:"🚀 Gradio"}),l.jsx(Ht,{value:"home",className:"whitespace-nowrap",children:"🏠 Home"})]}),l.jsx(Gt,{value:"metrics",className:"mt-0",children:l.jsx(tv,{})}),l.jsx(Gt,{value:"mcp",className:"mt-0",children:l.jsx(rv,{})}),!(e!=null&&e.externalApiMode)&&l.jsx(Gt,{value:"search",className:"mt-0",children:l.jsx(Ns,{title:"🤗 Hugging Face Search Tools (MCP)",description:"Find and use Hugging Face and Community content.",tools:N,onToolToggle:p})}),!(e!=null&&e.externalApiMode)&&l.jsx(Gt,{value:"spaces",className:"mt-0",children:l.jsx(Ns,{title:"🤗 Hugging Face Space Tools (MCP)",description:"Manage and duplicate Hugging Face Spaces.",tools:E,onToolToggle:p})}),!(e!=null&&e.externalApiMode)&&l.jsx(Gt,{value:"gradio",className:"mt-0",children:l.jsx(Cd,{spaceNames:s,spaceSubdomains:a,enabledSpaces:u,onSpaceToolToggle:y,onSpaceToolNameChange:x,onSpaceToolSubdomainChange:w})}),l.jsx(Gt,{value:"home",className:"mt-0",children:l.jsxs(nt,{children:[l.jsxs(rt,{children:[l.jsx(ot,{children:"🤗 HF MCP Server"}),l.jsx(It,{children:"Connect with AI assistants through the Model Context Protocol"})]}),l.jsxs(st,{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(At,{}),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(At,{}),l.jsxs("div",{className:"flex flex-col gap-4",children:[l.jsxs(Nt,{size:"xl",onClick:_,className:"w-full transition-all duration-200 active:bg-green-500 active:border-green-500 touch-manipulation",children:[l.jsx(fd,{className:"mr-2 h-5 w-5"}),"Copy MCP URL"]}),l.jsxs(Nt,{size:"xl",variant:"outline",onClick:C,className:"w-full touch-manipulation",children:[l.jsx(hd,{className:"mr-2 h-5 w-5"}),"Go to Settings"]})]})]})]})})]})})}),l.jsx(ov,{isLoading:f,error:v,transportInfo:e||{transport:"unknown"}})]})}bc.createRoot(document.getElementById("root")).render(l.jsx(h.StrictMode,{children:l.jsx(Zv,{})}));
145
+ `)},mp=0,zt=[];function gp(e){var t=h.useRef([]),n=h.useRef([0,0]),r=h.useRef(),o=h.useState(mp++)[0],s=h.useState(vl)[0],i=h.useRef(e);h.useEffect(function(){i.current=e},[e]),h.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var p=Og([e.lockRef.current],(e.shards||[]).map(oi),!0).filter(Boolean);return p.forEach(function(y){return y.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),p.forEach(function(y){return y.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var a=h.useCallback(function(p,y){if("touches"in p&&p.touches.length===2||p.type==="wheel"&&p.ctrlKey)return!i.current.allowPinchZoom;var x=$n(p),w=n.current,b="deltaX"in p?p.deltaX:w[0]-x[0],_="deltaY"in p?p.deltaY:w[1]-x[1],C,N=p.target,E=Math.abs(b)>Math.abs(_)?"h":"v";if("touches"in p&&E==="h"&&N.type==="range")return!1;var S=ni(E,N);if(!S)return!0;if(S?C=E:(C=E==="v"?"h":"v",S=ni(E,N)),!S)return!1;if(!r.current&&"changedTouches"in p&&(b||_)&&(r.current=C),!C)return!0;var $=r.current||C;return up($,y,p,$==="h"?b:_)},[]),c=h.useCallback(function(p){var y=p;if(!(!zt.length||zt[zt.length-1]!==s)){var x="deltaY"in y?ri(y):$n(y),w=t.current.filter(function(C){return C.name===y.type&&(C.target===y.target||y.target===C.shadowParent)&&dp(C.delta,x)})[0];if(w&&w.should){y.cancelable&&y.preventDefault();return}if(!w){var b=(i.current.shards||[]).map(oi).filter(Boolean).filter(function(C){return C.contains(y.target)}),_=b.length>0?a(y,b[0]):!i.current.noIsolation;_&&y.cancelable&&y.preventDefault()}}},[]),u=h.useCallback(function(p,y,x,w){var b={name:p,delta:y,target:x,should:w,shadowParent:pp(x)};t.current.push(b),setTimeout(function(){t.current=t.current.filter(function(_){return _!==b})},1)},[]),d=h.useCallback(function(p){n.current=$n(p),r.current=void 0},[]),g=h.useCallback(function(p){u(p.type,ri(p),p.target,a(p,e.lockRef.current))},[]),m=h.useCallback(function(p){u(p.type,$n(p),p.target,a(p,e.lockRef.current))},[]);h.useEffect(function(){return zt.push(s),e.setCallbacks({onScrollCapture:g,onWheelCapture:g,onTouchMoveCapture:m}),document.addEventListener("wheel",c,Vt),document.addEventListener("touchmove",c,Vt),document.addEventListener("touchstart",d,Vt),function(){zt=zt.filter(function(p){return p!==s}),document.removeEventListener("wheel",c,Vt),document.removeEventListener("touchmove",c,Vt),document.removeEventListener("touchstart",d,Vt)}},[]);var f=e.removeScrollBar,v=e.inert;return h.createElement(h.Fragment,null,v?h.createElement(s,{styles:fp(o)}):null,f?h.createElement(rp,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function pp(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const hp=Bg(hl,gp);var bl=h.forwardRef(function(e,t){return h.createElement(dr,Be({},e,{ref:t,sideCar:hp}))});bl.classNames=dr.classNames;var wo=["Enter"," "],vp=["ArrowDown","PageUp","Home"],_l=["ArrowUp","PageDown","End"],xp=[...vp,..._l],yp={ltr:[...wo,"ArrowRight"],rtl:[...wo,"ArrowLeft"]},wp={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Sn="Menu",[hn,bp,_p]=Ta(Sn),[Ft,Sl]=Pt(Sn,[_p,Xa,ur]),fr=Xa(),Cl=ur(),[Sp,Dt]=Ft(Sn),[Cp,Cn]=Ft(Sn),Rl=e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:o,onOpenChange:s,modal:i=!0}=e,a=fr(t),[c,u]=h.useState(null),d=h.useRef(!1),g=it(s),m=Uo(o);return h.useEffect(()=>{const f=()=>{d.current=!0,document.addEventListener("pointerdown",v,{capture:!0,once:!0}),document.addEventListener("pointermove",v,{capture:!0,once:!0})},v=()=>d.current=!1;return document.addEventListener("keydown",f,{capture:!0}),()=>{document.removeEventListener("keydown",f,{capture:!0}),document.removeEventListener("pointerdown",v,{capture:!0}),document.removeEventListener("pointermove",v,{capture:!0})}},[]),l.jsx(hg,{...a,children:l.jsx(Sp,{scope:t,open:n,onOpenChange:g,content:c,onContentChange:u,children:l.jsx(Cp,{scope:t,onClose:h.useCallback(()=>g(!1),[g]),isUsingKeyboardRef:d,dir:m,modal:i,children:r})})})};Rl.displayName=Sn;var Rp="MenuAnchor",es=h.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,o=fr(n);return l.jsx(vg,{...o,...r,ref:t})});es.displayName=Rp;var ts="MenuPortal",[kp,kl]=Ft(ts,{forceMount:void 0}),El=e=>{const{__scopeMenu:t,forceMount:n,children:r,container:o}=e,s=Dt(ts,t);return l.jsx(kp,{scope:t,forceMount:n,children:l.jsx(Ot,{present:n||s.open,children:l.jsx(sl,{asChild:!0,container:o,children:r})})})};El.displayName=ts;var Oe="MenuContent",[Ep,ns]=Ft(Oe),Ml=h.forwardRef((e,t)=>{const n=kl(Oe,e.__scopeMenu),{forceMount:r=n.forceMount,...o}=e,s=Dt(Oe,e.__scopeMenu),i=Cn(Oe,e.__scopeMenu);return l.jsx(hn.Provider,{scope:e.__scopeMenu,children:l.jsx(Ot,{present:r||s.open,children:l.jsx(hn.Slot,{scope:e.__scopeMenu,children:i.modal?l.jsx(Mp,{...o,ref:t}):l.jsx(Np,{...o,ref:t})})})})}),Mp=h.forwardRef((e,t)=>{const n=Dt(Oe,e.__scopeMenu),r=h.useRef(null),o=ke(t,r);return h.useEffect(()=>{const s=r.current;if(s)return Pg(s)},[]),l.jsx(rs,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:q(e.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),Np=h.forwardRef((e,t)=>{const n=Dt(Oe,e.__scopeMenu);return l.jsx(rs,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),Ap=mn("MenuContent.ScrollLock"),rs=h.forwardRef((e,t)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:o,onOpenAutoFocus:s,onCloseAutoFocus:i,disableOutsidePointerEvents:a,onEntryFocus:c,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:g,onInteractOutside:m,onDismiss:f,disableOutsideScroll:v,...p}=e,y=Dt(Oe,n),x=Cn(Oe,n),w=fr(n),b=Cl(n),_=bp(n),[C,N]=h.useState(null),E=h.useRef(null),S=ke(t,E,y.onContentChange),$=h.useRef(0),L=h.useRef(""),X=h.useRef(0),te=h.useRef(null),Z=h.useRef("right"),V=h.useRef(0),ne=v?bl:h.Fragment,G=v?{as:Ap,allowPinchZoom:!0}:void 0,J=M=>{var Q,ze;const H=L.current+M,z=_().filter(ve=>!ve.disabled),Y=document.activeElement,re=(Q=z.find(ve=>ve.ref.current===Y))==null?void 0:Q.textValue,le=z.map(ve=>ve.textValue),be=Hp(le,H,re),_e=(ze=z.find(ve=>ve.textValue===be))==null?void 0:ze.ref.current;(function ve(Se){L.current=Se,window.clearTimeout($.current),Se!==""&&($.current=window.setTimeout(()=>ve(""),1e3))})(H),_e&&setTimeout(()=>_e.focus())};h.useEffect(()=>()=>window.clearTimeout($.current),[]),Hf();const R=h.useCallback(M=>{var z,Y;return Z.current===((z=te.current)==null?void 0:z.side)&&Bp(M,(Y=te.current)==null?void 0:Y.area)},[]);return l.jsx(Ep,{scope:n,searchRef:L,onItemEnter:h.useCallback(M=>{R(M)&&M.preventDefault()},[R]),onItemLeave:h.useCallback(M=>{var H;R(M)||((H=E.current)==null||H.focus(),N(null))},[R]),onTriggerLeave:h.useCallback(M=>{R(M)&&M.preventDefault()},[R]),pointerGraceTimerRef:X,onPointerGraceIntentChange:h.useCallback(M=>{te.current=M},[]),children:l.jsx(ne,{...G,children:l.jsx(Oa,{asChild:!0,trapped:o,onMountAutoFocus:q(s,M=>{var H;M.preventDefault(),(H=E.current)==null||H.focus({preventScroll:!0})}),onUnmountAutoFocus:i,children:l.jsx(Ia,{asChild:!0,disableOutsidePointerEvents:a,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:g,onInteractOutside:m,onDismiss:f,children:l.jsx(dl,{asChild:!0,...b,dir:x.dir,orientation:"vertical",loop:r,currentTabStopId:C,onCurrentTabStopIdChange:N,onEntryFocus:q(c,M=>{x.isUsingKeyboardRef.current||M.preventDefault()}),preventScrollOnEntryFocus:!0,children:l.jsx(xg,{role:"menu","aria-orientation":"vertical","data-state":Bl(y.open),"data-radix-menu-content":"",dir:x.dir,...w,...p,ref:S,style:{outline:"none",...p.style},onKeyDown:q(p.onKeyDown,M=>{const z=M.target.closest("[data-radix-menu-content]")===M.currentTarget,Y=M.ctrlKey||M.altKey||M.metaKey,re=M.key.length===1;z&&(M.key==="Tab"&&M.preventDefault(),!Y&&re&&J(M.key));const le=E.current;if(M.target!==le||!xp.includes(M.key))return;M.preventDefault();const _e=_().filter(Q=>!Q.disabled).map(Q=>Q.ref.current);_l.includes(M.key)&&_e.reverse(),Vp(_e)}),onBlur:q(e.onBlur,M=>{M.currentTarget.contains(M.target)||(window.clearTimeout($.current),L.current="")}),onPointerMove:q(e.onPointerMove,vn(M=>{const H=M.target,z=V.current!==M.clientX;if(M.currentTarget.contains(H)&&z){const Y=M.clientX>V.current?"right":"left";Z.current=Y,V.current=M.clientX}}))})})})})})})});Ml.displayName=Oe;var Tp="MenuGroup",os=h.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return l.jsx(fe.div,{role:"group",...r,ref:t})});os.displayName=Tp;var jp="MenuLabel",Nl=h.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return l.jsx(fe.div,{...r,ref:t})});Nl.displayName=jp;var Kn="MenuItem",si="menu.itemSelect",mr=h.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:r,...o}=e,s=h.useRef(null),i=Cn(Kn,e.__scopeMenu),a=ns(Kn,e.__scopeMenu),c=ke(t,s),u=h.useRef(!1),d=()=>{const g=s.current;if(!n&&g){const m=new CustomEvent(si,{bubbles:!0,cancelable:!0});g.addEventListener(si,f=>r==null?void 0:r(f),{once:!0}),sa(g,m),m.defaultPrevented?u.current=!1:i.onClose()}};return l.jsx(Al,{...o,ref:c,disabled:n,onClick:q(e.onClick,d),onPointerDown:g=>{var m;(m=e.onPointerDown)==null||m.call(e,g),u.current=!0},onPointerUp:q(e.onPointerUp,g=>{var m;u.current||(m=g.currentTarget)==null||m.click()}),onKeyDown:q(e.onKeyDown,g=>{const m=a.searchRef.current!=="";n||m&&g.key===" "||wo.includes(g.key)&&(g.currentTarget.click(),g.preventDefault())})})});mr.displayName=Kn;var Al=h.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:r=!1,textValue:o,...s}=e,i=ns(Kn,n),a=Cl(n),c=h.useRef(null),u=ke(t,c),[d,g]=h.useState(!1),[m,f]=h.useState("");return h.useEffect(()=>{const v=c.current;v&&f((v.textContent??"").trim())},[s.children]),l.jsx(hn.ItemSlot,{scope:n,disabled:r,textValue:o??m,children:l.jsx(fl,{asChild:!0,...a,focusable:!r,children:l.jsx(fe.div,{role:"menuitem","data-highlighted":d?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...s,ref:u,onPointerMove:q(e.onPointerMove,vn(v=>{r?i.onItemLeave(v):(i.onItemEnter(v),v.defaultPrevented||v.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:q(e.onPointerLeave,vn(v=>i.onItemLeave(v))),onFocus:q(e.onFocus,()=>g(!0)),onBlur:q(e.onBlur,()=>g(!1))})})})}),Ip="MenuCheckboxItem",Tl=h.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:r,...o}=e;return l.jsx(Fl,{scope:e.__scopeMenu,checked:n,children:l.jsx(mr,{role:"menuitemcheckbox","aria-checked":Xn(n)?"mixed":n,...o,ref:t,"data-state":is(n),onSelect:q(o.onSelect,()=>r==null?void 0:r(Xn(n)?!0:!n),{checkForDefaultPrevented:!1})})})});Tl.displayName=Ip;var jl="MenuRadioGroup",[Pp,Op]=Ft(jl,{value:void 0,onValueChange:()=>{}}),Il=h.forwardRef((e,t)=>{const{value:n,onValueChange:r,...o}=e,s=it(r);return l.jsx(Pp,{scope:e.__scopeMenu,value:n,onValueChange:s,children:l.jsx(os,{...o,ref:t})})});Il.displayName=jl;var Pl="MenuRadioItem",Ol=h.forwardRef((e,t)=>{const{value:n,...r}=e,o=Op(Pl,e.__scopeMenu),s=n===o.value;return l.jsx(Fl,{scope:e.__scopeMenu,checked:s,children:l.jsx(mr,{role:"menuitemradio","aria-checked":s,...r,ref:t,"data-state":is(s),onSelect:q(r.onSelect,()=>{var i;return(i=o.onValueChange)==null?void 0:i.call(o,n)},{checkForDefaultPrevented:!1})})})});Ol.displayName=Pl;var ss="MenuItemIndicator",[Fl,Fp]=Ft(ss,{checked:!1}),Dl=h.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:r,...o}=e,s=Fp(ss,n);return l.jsx(Ot,{present:r||Xn(s.checked)||s.checked===!0,children:l.jsx(fe.span,{...o,ref:t,"data-state":is(s.checked)})})});Dl.displayName=ss;var Dp="MenuSeparator",$l=h.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return l.jsx(fe.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})});$l.displayName=Dp;var $p="MenuArrow",Ll=h.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,o=fr(n);return l.jsx(yg,{...o,...r,ref:t})});Ll.displayName=$p;var Lp="MenuSub",[Xv,Vl]=Ft(Lp),an="MenuSubTrigger",zl=h.forwardRef((e,t)=>{const n=Dt(an,e.__scopeMenu),r=Cn(an,e.__scopeMenu),o=Vl(an,e.__scopeMenu),s=ns(an,e.__scopeMenu),i=h.useRef(null),{pointerGraceTimerRef:a,onPointerGraceIntentChange:c}=s,u={__scopeMenu:e.__scopeMenu},d=h.useCallback(()=>{i.current&&window.clearTimeout(i.current),i.current=null},[]);return h.useEffect(()=>d,[d]),h.useEffect(()=>{const g=a.current;return()=>{window.clearTimeout(g),c(null)}},[a,c]),l.jsx(es,{asChild:!0,...u,children:l.jsx(Al,{id:o.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":o.contentId,"data-state":Bl(n.open),...e,ref:nr(t,o.onTriggerChange),onClick:g=>{var m;(m=e.onClick)==null||m.call(e,g),!(e.disabled||g.defaultPrevented)&&(g.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:q(e.onPointerMove,vn(g=>{s.onItemEnter(g),!g.defaultPrevented&&!e.disabled&&!n.open&&!i.current&&(s.onPointerGraceIntentChange(null),i.current=window.setTimeout(()=>{n.onOpenChange(!0),d()},100))})),onPointerLeave:q(e.onPointerLeave,vn(g=>{var f,v;d();const m=(f=n.content)==null?void 0:f.getBoundingClientRect();if(m){const p=(v=n.content)==null?void 0:v.dataset.side,y=p==="right",x=y?-5:5,w=m[y?"left":"right"],b=m[y?"right":"left"];s.onPointerGraceIntentChange({area:[{x:g.clientX+x,y:g.clientY},{x:w,y:m.top},{x:b,y:m.top},{x:b,y:m.bottom},{x:w,y:m.bottom}],side:p}),window.clearTimeout(a.current),a.current=window.setTimeout(()=>s.onPointerGraceIntentChange(null),300)}else{if(s.onTriggerLeave(g),g.defaultPrevented)return;s.onPointerGraceIntentChange(null)}})),onKeyDown:q(e.onKeyDown,g=>{var f;const m=s.searchRef.current!=="";e.disabled||m&&g.key===" "||yp[r.dir].includes(g.key)&&(n.onOpenChange(!0),(f=n.content)==null||f.focus(),g.preventDefault())})})})});zl.displayName=an;var Hl="MenuSubContent",Gl=h.forwardRef((e,t)=>{const n=kl(Oe,e.__scopeMenu),{forceMount:r=n.forceMount,...o}=e,s=Dt(Oe,e.__scopeMenu),i=Cn(Oe,e.__scopeMenu),a=Vl(Hl,e.__scopeMenu),c=h.useRef(null),u=ke(t,c);return l.jsx(hn.Provider,{scope:e.__scopeMenu,children:l.jsx(Ot,{present:r||s.open,children:l.jsx(hn.Slot,{scope:e.__scopeMenu,children:l.jsx(rs,{id:a.contentId,"aria-labelledby":a.triggerId,...o,ref:u,align:"start",side:i.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:d=>{var g;i.isUsingKeyboardRef.current&&((g=c.current)==null||g.focus()),d.preventDefault()},onCloseAutoFocus:d=>d.preventDefault(),onFocusOutside:q(e.onFocusOutside,d=>{d.target!==a.trigger&&s.onOpenChange(!1)}),onEscapeKeyDown:q(e.onEscapeKeyDown,d=>{i.onClose(),d.preventDefault()}),onKeyDown:q(e.onKeyDown,d=>{var f;const g=d.currentTarget.contains(d.target),m=wp[i.dir].includes(d.key);g&&m&&(s.onOpenChange(!1),(f=a.trigger)==null||f.focus(),d.preventDefault())})})})})})});Gl.displayName=Hl;function Bl(e){return e?"open":"closed"}function Xn(e){return e==="indeterminate"}function is(e){return Xn(e)?"indeterminate":e?"checked":"unchecked"}function Vp(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function zp(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function Hp(e,t,n){const o=t.length>1&&Array.from(t).every(u=>u===t[0])?t[0]:t,s=n?e.indexOf(n):-1;let i=zp(e,Math.max(s,0));o.length===1&&(i=i.filter(u=>u!==n));const c=i.find(u=>u.toLowerCase().startsWith(o.toLowerCase()));return c!==n?c:void 0}function Gp(e,t){const{x:n,y:r}=e;let o=!1;for(let s=0,i=t.length-1;s<t.length;i=s++){const a=t[s],c=t[i],u=a.x,d=a.y,g=c.x,m=c.y;d>r!=m>r&&n<(g-u)*(r-d)/(m-d)+u&&(o=!o)}return o}function Bp(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return Gp(n,t)}function vn(e){return t=>t.pointerType==="mouse"?e(t):void 0}var Up=Rl,Wp=es,qp=El,Zp=Ml,Kp=os,Xp=Nl,Yp=mr,Jp=Tl,Qp=Il,eh=Ol,th=Dl,nh=$l,rh=Ll,oh=zl,sh=Gl,gr="DropdownMenu",[ih]=Pt(gr,[Sl]),Me=Sl(),[ah,Ul]=ih(gr),Wl=e=>{const{__scopeDropdownMenu:t,children:n,dir:r,open:o,defaultOpen:s,onOpenChange:i,modal:a=!0}=e,c=Me(t),u=h.useRef(null),[d,g]=rr({prop:o,defaultProp:s??!1,onChange:i,caller:gr});return l.jsx(ah,{scope:t,triggerId:Bn(),triggerRef:u,contentId:Bn(),open:d,onOpenChange:g,onOpenToggle:h.useCallback(()=>g(m=>!m),[g]),modal:a,children:l.jsx(Up,{...c,open:d,onOpenChange:g,dir:r,modal:a,children:n})})};Wl.displayName=gr;var ql="DropdownMenuTrigger",Zl=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...o}=e,s=Ul(ql,n),i=Me(n);return l.jsx(Wp,{asChild:!0,...i,children:l.jsx(fe.button,{type:"button",id:s.triggerId,"aria-haspopup":"menu","aria-expanded":s.open,"aria-controls":s.open?s.contentId:void 0,"data-state":s.open?"open":"closed","data-disabled":r?"":void 0,disabled:r,...o,ref:nr(t,s.triggerRef),onPointerDown:q(e.onPointerDown,a=>{!r&&a.button===0&&a.ctrlKey===!1&&(s.onOpenToggle(),s.open||a.preventDefault())}),onKeyDown:q(e.onKeyDown,a=>{r||(["Enter"," "].includes(a.key)&&s.onOpenToggle(),a.key==="ArrowDown"&&s.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(a.key)&&a.preventDefault())})})})});Zl.displayName=ql;var lh="DropdownMenuPortal",Kl=e=>{const{__scopeDropdownMenu:t,...n}=e,r=Me(t);return l.jsx(qp,{...r,...n})};Kl.displayName=lh;var Xl="DropdownMenuContent",Yl=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Ul(Xl,n),s=Me(n),i=h.useRef(!1);return l.jsx(Zp,{id:o.contentId,"aria-labelledby":o.triggerId,...s,...r,ref:t,onCloseAutoFocus:q(e.onCloseAutoFocus,a=>{var c;i.current||(c=o.triggerRef.current)==null||c.focus(),i.current=!1,a.preventDefault()}),onInteractOutside:q(e.onInteractOutside,a=>{const c=a.detail.originalEvent,u=c.button===0&&c.ctrlKey===!0,d=c.button===2||u;(!o.modal||d)&&(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)"}})});Yl.displayName=Xl;var ch="DropdownMenuGroup",uh=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Me(n);return l.jsx(Kp,{...o,...r,ref:t})});uh.displayName=ch;var dh="DropdownMenuLabel",fh=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Me(n);return l.jsx(Xp,{...o,...r,ref:t})});fh.displayName=dh;var mh="DropdownMenuItem",gh=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Me(n);return l.jsx(Yp,{...o,...r,ref:t})});gh.displayName=mh;var ph="DropdownMenuCheckboxItem",Jl=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Me(n);return l.jsx(Jp,{...o,...r,ref:t})});Jl.displayName=ph;var hh="DropdownMenuRadioGroup",vh=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Me(n);return l.jsx(Qp,{...o,...r,ref:t})});vh.displayName=hh;var xh="DropdownMenuRadioItem",yh=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Me(n);return l.jsx(eh,{...o,...r,ref:t})});yh.displayName=xh;var wh="DropdownMenuItemIndicator",Ql=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Me(n);return l.jsx(th,{...o,...r,ref:t})});Ql.displayName=wh;var bh="DropdownMenuSeparator",_h=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Me(n);return l.jsx(nh,{...o,...r,ref:t})});_h.displayName=bh;var Sh="DropdownMenuArrow",Ch=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Me(n);return l.jsx(rh,{...o,...r,ref:t})});Ch.displayName=Sh;var Rh="DropdownMenuSubTrigger",kh=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Me(n);return l.jsx(oh,{...o,...r,ref:t})});kh.displayName=Rh;var Eh="DropdownMenuSubContent",Mh=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Me(n);return l.jsx(sh,{...o,...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)"}})});Mh.displayName=Eh;var Nh=Wl,Ah=Zl,Th=Kl,jh=Yl,Ih=Jl,Ph=Ql;function Oh({...e}){return l.jsx(Nh,{"data-slot":"dropdown-menu",...e})}function Fh({...e}){return l.jsx(Ah,{"data-slot":"dropdown-menu-trigger",...e})}function Dh({className:e,sideOffset:t=4,...n}){return l.jsx(Th,{children:l.jsx(jh,{"data-slot":"dropdown-menu-content",sideOffset:t,className:ue("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 $h({className:e,children:t,checked:n,...r}){return l.jsxs(Ih,{"data-slot":"dropdown-menu-checkbox-item",className:ue("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(Ph,{children:l.jsx(pa,{className:"size-4"})})}),t]})}function as({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:ue("w-full caption-bottom text-sm",e),...t})})}function Lh({className:e,...t}){return l.jsx("thead",{"data-slot":"table-header",className:ue("[&_tr]:border-b",e),...t})}function ls({className:e,...t}){return l.jsx("tbody",{"data-slot":"table-body",className:ue("[&_tr:last-child]:border-0",e),...t})}function we({className:e,...t}){return l.jsx("tr",{"data-slot":"table-row",className:ue("hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",e),...t})}function Vh({className:e,...t}){return l.jsx("th",{"data-slot":"table-head",className:ue("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 O({className:e,...t}){return l.jsx("td",{"data-slot":"table-cell",className:ue("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",e),...t})}function pr({columns:e,data:t,searchColumn:n,searchPlaceholder:r="Filter...",defaultColumnVisibility:o={},pageSize:s=25,defaultSorting:i=[]}){var y,x;const[a,c]=h.useState(i),[u,d]=h.useState([]),[g,m]=h.useState(o),[f,v]=h.useState({}),p=Tf({data:t,columns:e,onSortingChange:c,onColumnFiltersChange:d,getCoreRowModel:wf(),getPaginationRowModel:kf(),getSortedRowModel:Ef(),getFilteredRowModel:Rf(),onColumnVisibilityChange:m,onRowSelectionChange:v,initialState:{pagination:{pageSize:s}},state:{sorting:a,columnFilters:u,columnVisibility:g,rowSelection:f}});return l.jsxs("div",{className:"w-full",children:[l.jsxs("div",{className:"flex items-center py-4",children:[n&&l.jsx(ao,{placeholder:r,value:((y=p.getColumn(n))==null?void 0:y.getFilterValue())??"",onChange:w=>{var b;return(b=p.getColumn(n))==null?void 0:b.setFilterValue(w.target.value)},className:"max-w-sm"}),l.jsxs(Oh,{children:[l.jsx(Fh,{asChild:!0,children:l.jsxs(Nt,{variant:"outline",className:"ml-auto",children:["Columns ",l.jsx(ha,{className:"ml-2 h-4 w-4"})]})}),l.jsx(Dh,{align:"end",children:p.getAllColumns().filter(w=>w.getCanHide()).map(w=>l.jsx($h,{className:"capitalize",checked:w.getIsVisible(),onCheckedChange:b=>w.toggleVisibility(!!b),children:w.id},w.id))})]})]}),l.jsx("div",{className:"rounded-md border",children:l.jsxs(as,{children:[l.jsx(Lh,{children:p.getHeaderGroups().map(w=>l.jsx(we,{children:w.headers.map(b=>l.jsx(Vh,{children:b.isPlaceholder?null:Os(b.column.columnDef.header,b.getContext())},b.id))},w.id))}),l.jsx(ls,{children:(x=p.getRowModel().rows)!=null&&x.length?p.getRowModel().rows.map(w=>l.jsx(we,{"data-state":w.getIsSelected()&&"selected",children:w.getVisibleCells().map(b=>l.jsx(O,{children:Os(b.column.columnDef.cell,b.getContext())},b.id))},w.id)):l.jsx(we,{children:l.jsx(O,{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:[p.getFilteredRowModel().rows.length," row(s) total."]}),l.jsxs("div",{className:"space-x-2",children:[l.jsx(Nt,{variant:"outline",size:"sm",onClick:()=>p.previousPage(),disabled:!p.getCanPreviousPage(),children:"Previous"}),l.jsx(Nt,{variant:"outline",size:"sm",onClick:()=>p.nextPage(),disabled:!p.getCanNextPage(),children:"Next"})]})]})]})}function me(e,t="left"){return({column:n})=>{const r=t==="right"?"justify-end":t==="center"?"justify-center":"justify-start",o=n.getIsSorted();return l.jsx("div",{className:`flex ${r}`,children:l.jsxs(Nt,{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,o==="asc"&&l.jsx(ld,{className:"ml-1 h-3 w-3 text-muted-foreground"}),o==="desc"&&l.jsx(ha,{className:"ml-1 h-3 w-3 text-muted-foreground"})]})})}}const zh=300*1e3;function ec(e){const[t,n]=h.useState(new Map),r=h.useRef();return h.useEffect(()=>{const s=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:s,disconnectedAt:void 0})}),c.forEach((u,d)=>{!i.has(d)&&!u.disconnectedAt&&c.set(d,{...u,isConnected:!1,connectionStatus:"Disconnected",disconnectedAt:s,lastActivity:u.lastActivity||s})}),c})},[e]),h.useEffect(()=>{const s=()=>{const i=Date.now();n(a=>{const c=new Map(a);return c.forEach((u,d)=>{if(u.disconnectedAt){const g=new Date(u.disconnectedAt).getTime();i-g>zh&&c.delete(d)}}),c})};return s(),r.current=setInterval(s,3e4),()=>{r.current&&clearInterval(r.current)}},[]),Array.from(t.values()).sort((s,i)=>s.isConnected!==i.isConnected?s.isConnected?-1:1:new Date(i.lastActivity).getTime()-new Date(s.lastActivity).getTime())}function ii(e){const t=new Date,n=new Date(e),r=t.getTime()-n.getTime(),o=Math.floor(r/1e3);if(o<60)return"just now";const s=Math.floor(o/60);if(s<60)return`${s}m ago`;const i=Math.floor(s/60);return i<24?`${i}h ago`:`${Math.floor(i/24)}d ago`}function Hh(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 Gh(e){return e.length<=12?e:`${e.slice(0,5)}...${e.slice(-5)}`}function Bh(e){return e.length<=42?e:`${e.slice(0,35)}.....${e.slice(-5)}`}function Uh({metrics:e}){const t=e.sessions||[],n=ec(t),r=()=>[{accessorKey:"clientInfo",header:me("Client"),cell:({row:o})=>{const s=o.original,i=s.clientInfo?`${Bh(s.clientInfo.name)}@${s.clientInfo.version}`:"unknown";return l.jsx("div",{className:"font-mono text-sm",title:s.clientInfo?`${s.clientInfo.name}@${s.clientInfo.version}`:"unknown",children:i})}},{accessorKey:"id",header:me("Session ID"),cell:({row:o})=>l.jsx("div",{className:"font-mono text-sm",title:o.getValue("id"),children:Gh(o.getValue("id"))})},{accessorKey:"isConnected",header:me("Status"),cell:({row:o})=>{const s=o.original;return l.jsxs(Mt,{variant:s.isConnected?"success":"secondary",className:"gap-1",children:[s.isConnected?l.jsx(ya,{className:"h-3 w-3"}):l.jsx(xa,{className:"h-3 w-3"}),s.isConnected?"Connected":"Disconnected"]})}},{accessorKey:"connectedAt",header:me("Connected"),cell:({row:o})=>l.jsx("div",{className:"text-sm",children:ii(o.getValue("connectedAt"))})},{accessorKey:"requestCount",header:me("Requests","right"),cell:({row:o})=>l.jsx("div",{className:"text-right font-mono text-sm",children:o.getValue("requestCount")})},{accessorKey:"lastActivity",header:me("Last Activity"),cell:({row:o})=>l.jsx("div",{className:"text-sm",children:ii(o.getValue("lastActivity"))})}];return l.jsxs(nt,{children:[l.jsxs(rt,{children:[l.jsx(ot,{children:"📊 Transport Metrics"}),l.jsx(It,{children:"Real-time connection and performance metrics for STDIO transport"})]}),l.jsxs(st,{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:Hh(e.uptimeSeconds)})]})]}),l.jsxs(l.Fragment,{children:[l.jsx(At,{}),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(pr,{columns:r(),data:n,searchColumn:"id",searchPlaceholder:"Filter sessions...",pageSize:10,defaultSorting:[{id:"lastActivity",desc:!0}]})]})]})]})]})}function ai(e){const t=new Date,n=new Date(e),r=t.getTime()-n.getTime(),o=Math.floor(r/1e3);if(o<60)return"just now";const s=Math.floor(o/60);if(s<60)return`${s}m ago`;const i=Math.floor(s/60);return i<24?`${i}h ago`:`${Math.floor(i/24)}d ago`}function Wh(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 Ln(e){return e<1e3?`${e}ms`:e<6e4?`${Math.round(e/1e3)}s`:`${Math.round(e/6e4)}m`}function qh(e){return e.length<=12?e:`${e.slice(0,5)}...${e.slice(-5)}`}function Zh(e){return e.length<=42?e:`${e.slice(0,35)}.....${e.slice(-5)}`}function Kh({metrics:e}){const t=e.sessions||[],n=ec(t),r={sse:"Server-Sent Events",streamableHttp:"Streamable HTTP"},o=()=>[{accessorKey:"clientInfo",header:me("Client"),cell:({row:s})=>{const i=s.original,a=i.clientInfo?`${Zh(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:me("Session ID"),cell:({row:s})=>l.jsx("div",{className:"font-mono text-sm",title:s.getValue("id"),children:qh(s.getValue("id"))})},{accessorKey:"connectionStatus",header:me("Status"),cell:({row:s})=>{const i=s.original,a=i.connectionStatus||(i.isConnected?"Connected":"Disconnected");return a==="Connected"?l.jsxs(Mt,{variant:"success",className:"gap-1",children:[l.jsx(ya,{className:"h-3 w-3"}),"Connected"]}):a==="Distressed"?l.jsxs(Mt,{variant:"destructive",className:"gap-1",children:[l.jsx(va,{className:"h-3 w-3"}),"Distressed ",i.pingFailures?`(${i.pingFailures} failed)`:""]}):l.jsxs(Mt,{variant:"secondary",className:"gap-1",children:[l.jsx(xa,{className:"h-3 w-3"}),"Disconnected"]})}},{accessorKey:"connectedAt",header:me("Connected"),cell:({row:s})=>l.jsx("div",{className:"text-sm",children:ai(s.getValue("connectedAt"))})},{accessorKey:"requestCount",header:me("Requests","right"),cell:({row:s})=>l.jsx("div",{className:"text-right font-mono text-sm",children:s.getValue("requestCount")})},{accessorKey:"lastActivity",header:me("Last Activity"),cell:({row:s})=>l.jsx("div",{className:"text-sm",children:ai(s.getValue("lastActivity"))})}];return l.jsxs(nt,{children:[l.jsxs(rt,{children:[l.jsx(ot,{children:"📊 Transport Metrics"}),l.jsxs(It,{children:["Real-time connection and performance metrics for"," ",r[e.transport]||e.transport," transport"]})]}),l.jsxs(st,{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:Wh(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 ",Ln(e.configuration.heartbeatInterval||3e4),", sessions swept every ",Ln(e.configuration.staleCheckInterval),", removed after"," ",Ln(e.configuration.staleTimeout)," inactive",e.configuration.pingEnabled&&e.configuration.pingInterval&&`, pings sent every ${Ln(e.configuration.pingInterval)}`,e.configuration.pingEnabled&&`, marked distressed after ${e.configuration.pingFailureThreshold||1} failed ping${(e.configuration.pingFailureThreshold||1)!==1?"s":""}`]})]})}),l.jsx(At,{}),l.jsx("div",{children:l.jsx(as,{children:l.jsxs(ls,{children:[l.jsxs(we,{children:[l.jsx(O,{className:"font-medium text-sm",children:"Active Connections"}),l.jsx(O,{className:"text-sm font-mono",children:e.connections.active}),l.jsx(O,{className:"font-medium text-sm",children:"Cleaned Sessions"}),l.jsx(O,{className:"text-sm font-mono",children:e.connections.cleaned??0})]}),l.jsxs(we,{children:[l.jsx(O,{className:"font-medium text-sm",children:"Total Connections"}),l.jsx(O,{className:"text-sm font-mono",children:e.connections.total}),l.jsx(O,{className:"font-medium text-sm",children:"Requests per Minute (tot/3hr/hr)"}),l.jsxs(O,{className:"text-sm font-mono",children:[e.requests.averagePerMinute,"/",e.requests.last3Hours,"/",e.requests.lastHour]})]}),e.sessionLifecycle&&l.jsxs(we,{children:[l.jsx(O,{className:"font-medium text-sm",children:"Sessions New/Res-fail/Del"}),l.jsxs(O,{className:"text-sm font-mono",colSpan:3,children:[e.sessionLifecycle.created,"/",e.sessionLifecycle.resumedFailed,"/",e.sessionLifecycle.deleted]})]}),l.jsxs(we,{children:[l.jsx(O,{className:"font-medium text-sm",children:"Client Errors (4xx)"}),l.jsx(O,{className:"text-sm font-mono",children:e.errors.expected}),l.jsx(O,{className:"font-medium text-sm",children:"Server Errors (5xx)"}),l.jsx(O,{className:"text-sm font-mono",children:e.errors.unexpected})]}),e.pings&&l.jsxs(we,{children:[l.jsx(O,{className:"font-medium text-sm",children:"Pings Sent"}),l.jsx(O,{className:"text-sm font-mono",children:e.pings.sent}),l.jsx(O,{className:"font-medium text-sm",children:"Ping Success Rate"}),l.jsx(O,{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(we,{children:[l.jsx(O,{className:"font-medium text-sm",children:"Anonymous Users"}),l.jsx(O,{className:"text-sm font-mono",children:e.apiMetrics.anonymous}),l.jsx(O,{className:"font-medium text-sm",children:"Authenticated Users"}),l.jsx(O,{className:"text-sm font-mono",children:e.apiMetrics.authenticated})]}),l.jsxs(we,{children:[l.jsx(O,{className:"font-medium text-sm",children:"401 Unauthorized Users"}),l.jsx(O,{className:"text-sm font-mono",children:e.apiMetrics.unauthorized}),l.jsx(O,{className:"font-medium text-sm",children:"403 Forbidden Users"}),l.jsx(O,{className:"text-sm font-mono",children:e.apiMetrics.forbidden})]})]}),l.jsxs(we,{children:[l.jsx(O,{className:"font-medium text-sm",children:"Gradio Success/Fail"}),l.jsx(O,{className:"text-sm font-mono",children:e.gradioMetrics?`${e.gradioMetrics.success}/${e.gradioMetrics.failure}`:"0/0"}),l.jsx(O,{className:"font-medium text-sm",children:"-"}),l.jsx(O,{className:"text-sm font-mono",children:"-"})]})]})})}),l.jsxs(l.Fragment,{children:[l.jsx(At,{}),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(pr,{columns:o(),data:n,searchColumn:"id",searchPlaceholder:"Filter sessions...",pageSize:10,defaultSorting:[{id:"lastActivity",desc:!0}]})]})]})]})]})}function li(e){const t=new Date,n=new Date(e),r=t.getTime()-n.getTime(),o=Math.floor(r/1e3);if(o<60)return"just now";const s=Math.floor(o/60);if(s<60)return`${s}m ago`;const i=Math.floor(s/60);return i<24?`${i}h ago`:`${Math.floor(i/24)}d ago`}function Xh(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 Yh(e){const t=new Date,n=new Date(e),r=t.getTime()-n.getTime();return Math.floor(r/6e4)<5}function Jh(e){return e.length<=42?e:`${e.slice(0,35)}.....${e.slice(-5)}`}function Qh({metrics:e}){const t=e.clients,n=()=>[{accessorKey:"name",header:me("Client"),cell:({row:r})=>{const o=r.original,s=`${Jh(o.name)}@${o.version}`;return l.jsxs("div",{children:[l.jsx("p",{className:"font-medium font-mono text-sm",title:`${o.name}@${o.version}`,children:s}),l.jsxs("p",{className:"text-xs text-muted-foreground",children:["First seen ",li(o.firstSeen)]})]})}},{accessorKey:"requestCount",header:me("Initializations","right"),cell:({row:r})=>l.jsx("div",{className:"text-right font-mono text-sm",children:r.getValue("requestCount")})},{accessorKey:"isConnected",header:me("Status"),cell:({row:r})=>{const o=r.original;return l.jsx("div",{children:Yh(o.lastSeen)?l.jsxs(Mt,{variant:"success",className:"gap-1",children:[l.jsx(od,{className:"h-3 w-3"}),"Recent"]}):l.jsxs(Mt,{variant:"secondary",className:"gap-1",children:[l.jsx(ud,{className:"h-3 w-3"}),"Idle"]})})}},{accessorKey:"lastSeen",header:me("Last Seen","right"),cell:({row:r})=>l.jsx("div",{className:"text-right text-sm",children:li(r.getValue("lastSeen"))})}];return l.jsxs(nt,{children:[l.jsxs(rt,{children:[l.jsx(ot,{children:"📊 Transport Metrics"}),l.jsx(It,{children:"Real-time connection and performance metrics for Stateless HTTP JSON transport"})]}),l.jsxs(st,{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(Mt,{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:Xh(e.uptimeSeconds)})]})]}),l.jsx(At,{}),l.jsx("div",{children:l.jsx(as,{children:l.jsxs(ls,{children:[l.jsxs(we,{children:[l.jsx(O,{className:"font-medium text-sm",children:"Request Count (MCP)"}),l.jsx(O,{className:"text-sm font-mono",children:e.connections.total}),l.jsx(O,{className:"font-medium text-sm",children:"Requests per Minute (tot/3hr/hr)"}),l.jsxs(O,{className:"text-sm font-mono",children:[e.requests.averagePerMinute,"/",e.requests.last3Hours,"/",e.requests.lastHour]})]}),l.jsxs(we,{children:[l.jsx(O,{className:"font-medium text-sm",children:"Client Errors (4xx)"}),l.jsx(O,{className:"text-sm font-mono",children:e.errors.expected}),l.jsx(O,{className:"font-medium text-sm",children:"Server Errors (5xx)"}),l.jsx(O,{className:"text-sm font-mono",children:e.errors.unexpected})]}),(e.staticPageHits200!==void 0||e.staticPageHits405!==void 0)&&l.jsxs(we,{children:[l.jsx(O,{className:"font-medium text-sm",children:l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx(gd,{className:"h-3 w-3"}),"hf.co/mcp (200/405)"]})}),l.jsxs(O,{className:"text-sm font-mono",children:[e.staticPageHits200||0,"/",e.staticPageHits405||0]}),l.jsx(O,{className:"font-medium text-sm",children:l.jsx("div",{className:"flex items-center gap-1",children:"Auth Status (Anon/Auth/401)"})}),l.jsxs(O,{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(we,{children:[l.jsx(O,{className:"font-medium text-sm",children:"Tool API - Anonymous"}),l.jsx(O,{className:"text-sm font-mono",children:e.apiMetrics.anonymous}),l.jsx(O,{className:"font-medium text-sm",children:"Tool API - Authenticated"}),l.jsx(O,{className:"text-sm font-mono",children:e.apiMetrics.authenticated})]}),l.jsxs(we,{children:[l.jsx(O,{className:"font-medium text-sm",children:"Tool API - 401 Unauthorized"}),l.jsx(O,{className:"text-sm font-mono",children:e.apiMetrics.unauthorized}),l.jsx(O,{className:"font-medium text-sm",children:"Tool API - 403 Forbidden"}),l.jsx(O,{className:"text-sm font-mono",children:e.apiMetrics.forbidden})]})]}),l.jsxs(we,{children:[l.jsx(O,{className:"font-medium text-sm",children:"Gradio Success/Fail"}),l.jsx(O,{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(O,{className:"font-medium text-sm",children:"Sessions New/Res-fail/Del"}),l.jsxs(O,{className:"text-sm font-mono",children:[e.sessionLifecycle.created,"/",e.sessionLifecycle.resumedFailed,"/",e.sessionLifecycle.deleted]})]}):l.jsxs(l.Fragment,{children:[l.jsx(O,{className:"font-medium text-sm",children:"-"}),l.jsx(O,{className:"text-sm font-mono",children:"-"})]})]})]})})}),l.jsxs(l.Fragment,{children:[l.jsx(At,{}),l.jsxs("div",{children:[l.jsx("h3",{className:"text-sm font-semibold text-foreground mb-3",children:"Client Identities"}),l.jsx(pr,{columns:n(),data:t,searchColumn:"name",searchPlaceholder:"Filter clients...",pageSize:50,defaultSorting:[{id:"lastSeen",desc:!0}]})]})]})]})]})}const ev=e=>fetch(e).then(t=>{if(!t.ok)throw new Error(`Failed to fetch: ${t.status}`);return t.json()});function tv(){const{data:e,error:t}=cn("/api/transport-metrics",ev,{refreshInterval:3e3,revalidateOnFocus:!0,revalidateOnReconnect:!0});return t?l.jsxs(nt,{children:[l.jsx(rt,{children:l.jsx(ot,{children:"📊 Transport Metrics"})}),l.jsx(st,{children:l.jsxs(kd,{variant:"destructive",children:[l.jsx(va,{className:"h-4 w-4"}),l.jsx(Ed,{children:"Error Loading Metrics"}),l.jsxs(Md,{children:["Failed to load transport metrics: ",t.message]})]})})]}):e?e.transport==="stdio"?l.jsx(Uh,{metrics:e}):e.isStateless?l.jsx(Qh,{metrics:e}):l.jsx(Kh,{metrics:e}):l.jsxs(nt,{children:[l.jsx(rt,{children:l.jsx(ot,{children:"📊 Transport Metrics"})}),l.jsx(st,{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 nv=e=>fetch(e).then(t=>{if(!t.ok)throw new Error(`Failed to fetch: ${t.status}`);return t.json()});function rv(){const[e,t]=h.useState(!1),{data:n,error:r}=cn("/api/transport-metrics",nv,{refreshInterval:3e3,revalidateOnFocus:!0,revalidateOnReconnect:!0}),o=!n&&!r,s=(n==null?void 0:n.transport)==="stdio",i=((n==null?void 0:n.methods)||[]).map(m=>{let f=m.errors,v,p;if(m.method.startsWith("tools/call:")&&(n!=null&&n.gradioMetrics)){const w=m.method.replace("tools/call:",""),b=n.gradioMetrics.byTool;b[w]&&(v=b[w].success,p=b[w].failure,f+=p)}const y=m.count>0?f/m.count*100:0;return{method:m.method,count:m.count,errors:f,errorRate:y,averageResponseTime:m.averageResponseTime,lastCalled:m.lastCalled,gradioSuccess:v,gradioFailure:p}}),a=e?i.filter(m=>m.method.startsWith("tools/call")||m.method.startsWith("prompts/get")):i,c=i.reduce((m,f)=>m+f.count,0),u=i.filter(m=>m.method.startsWith("tools/call")).reduce((m,f)=>m+f.count,0),d=i.filter(m=>m.method.startsWith("prompts/get")).reduce((m,f)=>m+f.count,0),g=[{accessorKey:"method",header:me("Method"),cell:({row:m})=>{const f=m.getValue("method");return l.jsx("div",{className:"font-mono text-sm",children:f==="tools/call"?l.jsx("span",{className:"text-blue-600 dark:text-blue-400",children:"tools/call"}):f.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:f.replace("tools/call:","")})]}):f==="prompts/get"?l.jsx("span",{className:"text-purple-600 dark:text-purple-400",children:"prompts/get"}):f.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:f.replace("prompts/get:","")})]}):f})}},{accessorKey:"count",header:me("Calls","right"),cell:({row:m})=>l.jsx("div",{className:"text-right font-mono",children:m.getValue("count").toLocaleString()})},{accessorKey:"errors",header:me("Errors","right"),cell:({row:m})=>{const f=m.getValue("errors");return l.jsx("div",{className:"text-right font-mono",children:f>0?l.jsx("span",{className:"text-red-600 dark:text-red-400",children:f}):"0"})}},{accessorKey:"gradioMetrics",header:me("Success/Failure","right"),cell:({row:m})=>{const f=m.original;return f.gradioSuccess!==void 0&&f.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:f.gradioSuccess}),l.jsx("span",{className:"text-muted-foreground",children:"/"}),l.jsx("span",{className:"text-red-600 dark:text-red-400",children:f.gradioFailure})]}):l.jsx("div",{className:"text-right text-muted-foreground",children:"—"})}},{accessorKey:"errorRate",header:me("Error Rate","right"),cell:({row:m})=>{const f=m.getValue("errorRate");return l.jsx("div",{className:"text-right font-mono",children:f>0?l.jsxs("span",{className:"text-red-600 dark:text-red-400",children:[f.toFixed(1),"%"]}):"0%"})}},{accessorKey:"averageResponseTime",header:me("Avg Response","right"),cell:({row:m})=>{const f=m.getValue("averageResponseTime");return l.jsx("div",{className:"text-right font-mono",children:f?`${f.toFixed(0)}ms`:"—"})}},{accessorKey:"lastCalled",header:me("Last Called","right"),cell:({row:m})=>l.jsx("div",{className:"text-right text-sm text-muted-foreground",children:new Date(m.getValue("lastCalled")).toLocaleTimeString()})}];return l.jsxs(nt,{children:[l.jsxs(rt,{children:[l.jsx(ot,{children:"HTTP JSON Transport Statistics"}),l.jsxs(It,{children:["MCP method call statistics and performance metrics",s?" (Empty in STDIO mode)":n!=null&&n.isStateless?"":" (Response times not available in stateful modes)"]})]}),l.jsxs(st,{children:[o&&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]})}),s&&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&&!s&&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:d.toLocaleString()})]})]})]}),i.length>0&&l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx(Lo,{id:"tool-prompt-calls-filter",checked:e,onCheckedChange:m=>t(!!m)}),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(pr,{columns:g,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 ci(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 ov({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"}},o=()=>{switch(n.transport){case"sse":return"/sse";case"streamableHttp":case"streamableHttpJson":return"/mcp";case"stdio":return"stdin/stdout";default:return"unknown"}},s=()=>n.transport==="streamableHttpJson"||n.transport==="streamableHttp"&&n.jsonResponseEnabled===!0,i=()=>s()?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:o()}),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 ${ci(n).isWarning?"text-red-500":""}`,children:ci(n).text})]})]})})}var hr="Tabs",[sv]=Pt(hr,[ur]),tc=ur(),[iv,cs]=sv(hr),nc=h.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:o,defaultValue:s,orientation:i="horizontal",dir:a,activationMode:c="automatic",...u}=e,d=Uo(a),[g,m]=rr({prop:r,onChange:o,defaultProp:s??"",caller:hr});return l.jsx(iv,{scope:n,baseId:Bn(),value:g,onValueChange:m,orientation:i,dir:d,activationMode:c,children:l.jsx(fe.div,{dir:d,"data-orientation":i,...u,ref:t})})});nc.displayName=hr;var rc="TabsList",oc=h.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...o}=e,s=cs(rc,n),i=tc(n);return l.jsx(dl,{asChild:!0,...i,orientation:s.orientation,dir:s.dir,loop:r,children:l.jsx(fe.div,{role:"tablist","aria-orientation":s.orientation,...o,ref:t})})});oc.displayName=rc;var sc="TabsTrigger",ic=h.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:o=!1,...s}=e,i=cs(sc,n),a=tc(n),c=cc(i.baseId,r),u=uc(i.baseId,r),d=r===i.value;return l.jsx(fl,{asChild:!0,...a,focusable:!o,active:d,children:l.jsx(fe.button,{type:"button",role:"tab","aria-selected":d,"aria-controls":u,"data-state":d?"active":"inactive","data-disabled":o?"":void 0,disabled:o,id:c,...s,ref:t,onMouseDown:q(e.onMouseDown,g=>{!o&&g.button===0&&g.ctrlKey===!1?i.onValueChange(r):g.preventDefault()}),onKeyDown:q(e.onKeyDown,g=>{[" ","Enter"].includes(g.key)&&i.onValueChange(r)}),onFocus:q(e.onFocus,()=>{const g=i.activationMode!=="manual";!d&&!o&&g&&i.onValueChange(r)})})})});ic.displayName=sc;var ac="TabsContent",lc=h.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:o,children:s,...i}=e,a=cs(ac,n),c=cc(a.baseId,r),u=uc(a.baseId,r),d=r===a.value,g=h.useRef(d);return h.useEffect(()=>{const m=requestAnimationFrame(()=>g.current=!1);return()=>cancelAnimationFrame(m)},[]),l.jsx(Ot,{present:o||d,children:({present:m})=>l.jsx(fe.div,{"data-state":d?"active":"inactive","data-orientation":a.orientation,role:"tabpanel","aria-labelledby":c,hidden:!m,id:u,tabIndex:0,...i,ref:t,style:{...e.style,animationDuration:g.current?"0s":void 0},children:m&&s})})});lc.displayName=ac;function cc(e,t){return`${e}-trigger-${t}`}function uc(e,t){return`${e}-content-${t}`}var av=nc,lv=oc,cv=ic,uv=lc;function dv({className:e,...t}){return l.jsx(av,{"data-slot":"tabs",className:ue("flex flex-col gap-2",e),...t})}function fv({className:e,...t}){return l.jsx(lv,{"data-slot":"tabs-list",className:ue("bg-muted text-muted-foreground inline-flex h-9 w-fit items-center justify-center rounded-lg p-[3px]",e),...t})}function Ht({className:e,...t}){return l.jsx(cv,{"data-slot":"tabs-trigger",className:ue("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 Gt({className:e,...t}){return l.jsx(uv,{"data-slot":"tabs-content",className:ue("flex-1 outline-none",e),...t})}const ui="ALLOW_README_INCLUDE",di="NO_GRADIO_IMAGE_CONTENT";var ie;(function(e){e.assertEqual=o=>{};function t(o){}e.assertIs=t;function n(o){throw new Error}e.assertNever=n,e.arrayToEnum=o=>{const s={};for(const i of o)s[i]=i;return s},e.getValidEnumValues=o=>{const s=e.objectKeys(o).filter(a=>typeof o[o[a]]!="number"),i={};for(const a of s)i[a]=o[a];return e.objectValues(i)},e.objectValues=o=>e.objectKeys(o).map(function(s){return o[s]}),e.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{const s=[];for(const i in o)Object.prototype.hasOwnProperty.call(o,i)&&s.push(i);return s},e.find=(o,s)=>{for(const i of o)if(s(i))return i},e.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&Number.isFinite(o)&&Math.floor(o)===o;function r(o,s=" | "){return o.map(i=>typeof i=="string"?`'${i}'`:i).join(s)}e.joinValues=r,e.jsonStringifyReplacer=(o,s)=>typeof s=="bigint"?s.toString():s})(ie||(ie={}));var fi;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(fi||(fi={}));const I=ie.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),gt=e=>{switch(typeof e){case"undefined":return I.undefined;case"string":return I.string;case"number":return Number.isNaN(e)?I.nan:I.number;case"boolean":return I.boolean;case"function":return I.function;case"bigint":return I.bigint;case"symbol":return I.symbol;case"object":return Array.isArray(e)?I.array:e===null?I.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?I.promise:typeof Map<"u"&&e instanceof Map?I.map:typeof Set<"u"&&e instanceof Set?I.set:typeof Date<"u"&&e instanceof Date?I.date:I.object;default:return I.unknown}},k=ie.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 ct 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(s){return s.message},r={_errors:[]},o=s=>{for(const i of s.issues)if(i.code==="invalid_union")i.unionErrors.map(o);else if(i.code==="invalid_return_type")o(i.returnTypeError);else if(i.code==="invalid_arguments")o(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 o(this),r}static assert(t){if(!(t instanceof ct))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,ie.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=n=>n.message){const n={},r=[];for(const o of this.issues)if(o.path.length>0){const s=o.path[0];n[s]=n[s]||[],n[s].push(t(o))}else r.push(t(o));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}ct.create=e=>new ct(e);const bo=(e,t)=>{let n;switch(e.code){case k.invalid_type:e.received===I.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case k.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,ie.jsonStringifyReplacer)}`;break;case k.unrecognized_keys:n=`Unrecognized key(s) in object: ${ie.joinValues(e.keys,", ")}`;break;case k.invalid_union:n="Invalid input";break;case k.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${ie.joinValues(e.options)}`;break;case k.invalid_enum_value:n=`Invalid enum value. Expected ${ie.joinValues(e.options)}, received '${e.received}'`;break;case k.invalid_arguments:n="Invalid function arguments";break;case k.invalid_return_type:n="Invalid function return type";break;case k.invalid_date:n="Invalid date";break;case k.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}"`:ie.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case k.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==="bigint"?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 k.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 k.custom:n="Invalid input";break;case k.invalid_intersection_types:n="Intersection results could not be merged";break;case k.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case k.not_finite:n="Number must be finite";break;default:n=t.defaultError,ie.assertNever(e)}return{message:n}};let mv=bo;function gv(){return mv}const pv=e=>{const{data:t,path:n,errorMaps:r,issueData:o}=e,s=[...n,...o.path||[]],i={...o,path:s};if(o.message!==void 0)return{...o,path:s,message:o.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{...o,path:s,message:a}};function A(e,t){const n=gv(),r=pv({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===bo?void 0:bo].filter(o=>!!o)});e.common.issues.push(r)}class Ie{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 o of n){if(o.status==="aborted")return B;o.status==="dirty"&&t.dirty(),r.push(o.value)}return{status:t.value,value:r}}static async mergeObjectAsync(t,n){const r=[];for(const o of n){const s=await o.key,i=await o.value;r.push({key:s,value:i})}return Ie.mergeObjectSync(t,r)}static mergeObjectSync(t,n){const r={};for(const o of n){const{key:s,value:i}=o;if(s.status==="aborted"||i.status==="aborted")return B;s.status==="dirty"&&t.dirty(),i.status==="dirty"&&t.dirty(),s.value!=="__proto__"&&(typeof i.value<"u"||o.alwaysSet)&&(r[s.value]=i.value)}return{status:t.value,value:r}}}const B=Object.freeze({status:"aborted"}),ln=e=>({status:"dirty",value:e}),Fe=e=>({status:"valid",value:e}),mi=e=>e.status==="aborted",gi=e=>e.status==="dirty",Zt=e=>e.status==="valid",Yn=e=>typeof Promise<"u"&&e instanceof Promise;var P;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t==null?void 0:t.message})(P||(P={}));class Rt{constructor(t,n,r,o){this._cachedPath=[],this.parent=t,this.data=n,this._path=r,this._key=o}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 pi=(e,t)=>{if(Zt(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 ct(e.common.issues);return this._error=n,this._error}}};function K(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:r,description:o}=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:o}:{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:o}}class se{get description(){return this._def.description}_getType(t){return gt(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:gt(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new Ie,ctx:{common:t.parent.common,data:t.data,parsedType:gt(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const n=this._parse(t);if(Yn(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:gt(t)},o=this._parseSync({data:t,path:r.path,parent:r});return pi(r,o)}"~validate"(t){var r,o;const n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:gt(t)};if(!this["~standard"].async)try{const s=this._parseSync({data:t,path:[],parent:n});return Zt(s)?{value:s.value}:{issues:n.common.issues}}catch(s){(o=(r=s==null?void 0:s.message)==null?void 0:r.toLowerCase())!=null&&o.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:n}).then(s=>Zt(s)?{value:s.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:gt(t)},o=this._parse({data:t,path:r.path,parent:r}),s=await(Yn(o)?o:Promise.resolve(o));return pi(r,s)}refine(t,n){const r=o=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(o):n;return this._refinement((o,s)=>{const i=t(o),a=()=>s.addIssue({code:k.custom,...r(o)});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,o)=>t(r)?!0:(o.addIssue(typeof n=="function"?n(r,o):n),!1))}_refinement(t){return new Yt({schema:this,typeName:U.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 yt.create(this,this._def)}nullable(){return Jt.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return qe.create(this)}promise(){return tr.create(this,this._def)}or(t){return Qn.create([this,t],this._def)}and(t){return er.create(this,t,this._def)}transform(t){return new Yt({...K(this._def),schema:this,typeName:U.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const n=typeof t=="function"?t:()=>t;return new Co({...K(this._def),innerType:this,defaultValue:n,typeName:U.ZodDefault})}brand(){return new $v({typeName:U.ZodBranded,type:this,...K(this._def)})}catch(t){const n=typeof t=="function"?t:()=>t;return new Ro({...K(this._def),innerType:this,catchValue:n,typeName:U.ZodCatch})}describe(t){const n=this.constructor;return new n({...this._def,description:t})}pipe(t){return us.create(this,t)}readonly(){return ko.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const hv=/^c[^\s-]{8,}$/i,vv=/^[0-9a-z]+$/,xv=/^[0-9A-HJKMNP-TV-Z]{26}$/i,yv=/^[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,wv=/^[a-z0-9_-]{21}$/i,bv=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,_v=/^[-+]?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)?)??$/,Sv=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Cv="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let qr;const Rv=/^(?:(?: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])$/,kv=/^(?:(?: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])$/,Ev=/^(([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]))$/,Mv=/^(([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])$/,Nv=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Av=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,dc="((\\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])))",Tv=new RegExp(`^${dc}$`);function fc(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 jv(e){return new RegExp(`^${fc(e)}$`)}function Iv(e){let t=`${dc}T${fc(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 Pv(e,t){return!!((t==="v4"||!t)&&Rv.test(e)||(t==="v6"||!t)&&Ev.test(e))}function Ov(e,t){if(!bv.test(e))return!1;try{const[n]=e.split(".");if(!n)return!1;const r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),o=JSON.parse(atob(r));return!(typeof o!="object"||o===null||"typ"in o&&(o==null?void 0:o.typ)!=="JWT"||!o.alg||t&&o.alg!==t)}catch{return!1}}function Fv(e,t){return!!((t==="v4"||!t)&&kv.test(e)||(t==="v6"||!t)&&Mv.test(e))}class vt extends se{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==I.string){const s=this._getOrReturnCtx(t);return A(s,{code:k.invalid_type,expected:I.string,received:s.parsedType}),B}const r=new Ie;let o;for(const s of this._def.checks)if(s.kind==="min")t.data.length<s.value&&(o=this._getOrReturnCtx(t,o),A(o,{code:k.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="max")t.data.length>s.value&&(o=this._getOrReturnCtx(t,o),A(o,{code:k.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="length"){const i=t.data.length>s.value,a=t.data.length<s.value;(i||a)&&(o=this._getOrReturnCtx(t,o),i?A(o,{code:k.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):a&&A(o,{code:k.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),r.dirty())}else if(s.kind==="email")Sv.test(t.data)||(o=this._getOrReturnCtx(t,o),A(o,{validation:"email",code:k.invalid_string,message:s.message}),r.dirty());else if(s.kind==="emoji")qr||(qr=new RegExp(Cv,"u")),qr.test(t.data)||(o=this._getOrReturnCtx(t,o),A(o,{validation:"emoji",code:k.invalid_string,message:s.message}),r.dirty());else if(s.kind==="uuid")yv.test(t.data)||(o=this._getOrReturnCtx(t,o),A(o,{validation:"uuid",code:k.invalid_string,message:s.message}),r.dirty());else if(s.kind==="nanoid")wv.test(t.data)||(o=this._getOrReturnCtx(t,o),A(o,{validation:"nanoid",code:k.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid")hv.test(t.data)||(o=this._getOrReturnCtx(t,o),A(o,{validation:"cuid",code:k.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid2")vv.test(t.data)||(o=this._getOrReturnCtx(t,o),A(o,{validation:"cuid2",code:k.invalid_string,message:s.message}),r.dirty());else if(s.kind==="ulid")xv.test(t.data)||(o=this._getOrReturnCtx(t,o),A(o,{validation:"ulid",code:k.invalid_string,message:s.message}),r.dirty());else if(s.kind==="url")try{new URL(t.data)}catch{o=this._getOrReturnCtx(t,o),A(o,{validation:"url",code:k.invalid_string,message:s.message}),r.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(t.data)||(o=this._getOrReturnCtx(t,o),A(o,{validation:"regex",code:k.invalid_string,message:s.message}),r.dirty())):s.kind==="trim"?t.data=t.data.trim():s.kind==="includes"?t.data.includes(s.value,s.position)||(o=this._getOrReturnCtx(t,o),A(o,{code:k.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),r.dirty()):s.kind==="toLowerCase"?t.data=t.data.toLowerCase():s.kind==="toUpperCase"?t.data=t.data.toUpperCase():s.kind==="startsWith"?t.data.startsWith(s.value)||(o=this._getOrReturnCtx(t,o),A(o,{code:k.invalid_string,validation:{startsWith:s.value},message:s.message}),r.dirty()):s.kind==="endsWith"?t.data.endsWith(s.value)||(o=this._getOrReturnCtx(t,o),A(o,{code:k.invalid_string,validation:{endsWith:s.value},message:s.message}),r.dirty()):s.kind==="datetime"?Iv(s).test(t.data)||(o=this._getOrReturnCtx(t,o),A(o,{code:k.invalid_string,validation:"datetime",message:s.message}),r.dirty()):s.kind==="date"?Tv.test(t.data)||(o=this._getOrReturnCtx(t,o),A(o,{code:k.invalid_string,validation:"date",message:s.message}),r.dirty()):s.kind==="time"?jv(s).test(t.data)||(o=this._getOrReturnCtx(t,o),A(o,{code:k.invalid_string,validation:"time",message:s.message}),r.dirty()):s.kind==="duration"?_v.test(t.data)||(o=this._getOrReturnCtx(t,o),A(o,{validation:"duration",code:k.invalid_string,message:s.message}),r.dirty()):s.kind==="ip"?Pv(t.data,s.version)||(o=this._getOrReturnCtx(t,o),A(o,{validation:"ip",code:k.invalid_string,message:s.message}),r.dirty()):s.kind==="jwt"?Ov(t.data,s.alg)||(o=this._getOrReturnCtx(t,o),A(o,{validation:"jwt",code:k.invalid_string,message:s.message}),r.dirty()):s.kind==="cidr"?Fv(t.data,s.version)||(o=this._getOrReturnCtx(t,o),A(o,{validation:"cidr",code:k.invalid_string,message:s.message}),r.dirty()):s.kind==="base64"?Nv.test(t.data)||(o=this._getOrReturnCtx(t,o),A(o,{validation:"base64",code:k.invalid_string,message:s.message}),r.dirty()):s.kind==="base64url"?Av.test(t.data)||(o=this._getOrReturnCtx(t,o),A(o,{validation:"base64url",code:k.invalid_string,message:s.message}),r.dirty()):ie.assertNever(s);return{status:r.value,value:t.data}}_regex(t,n,r){return this.refinement(o=>t.test(o),{validation:n,code:k.invalid_string,...P.errToObj(r)})}_addCheck(t){return new vt({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...P.errToObj(t)})}url(t){return this._addCheck({kind:"url",...P.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...P.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...P.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...P.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...P.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...P.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...P.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...P.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...P.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...P.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...P.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...P.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,...P.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,...P.errToObj(t==null?void 0:t.message)})}duration(t){return this._addCheck({kind:"duration",...P.errToObj(t)})}regex(t,n){return this._addCheck({kind:"regex",regex:t,...P.errToObj(n)})}includes(t,n){return this._addCheck({kind:"includes",value:t,position:n==null?void 0:n.position,...P.errToObj(n==null?void 0:n.message)})}startsWith(t,n){return this._addCheck({kind:"startsWith",value:t,...P.errToObj(n)})}endsWith(t,n){return this._addCheck({kind:"endsWith",value:t,...P.errToObj(n)})}min(t,n){return this._addCheck({kind:"min",value:t,...P.errToObj(n)})}max(t,n){return this._addCheck({kind:"max",value:t,...P.errToObj(n)})}length(t,n){return this._addCheck({kind:"length",value:t,...P.errToObj(n)})}nonempty(t){return this.min(1,P.errToObj(t))}trim(){return new vt({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new vt({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new vt({...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}}vt.create=e=>new vt({checks:[],typeName:U.ZodString,coerce:(e==null?void 0:e.coerce)??!1,...K(e)});function Dv(e,t){const n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,o=n>r?n:r,s=Number.parseInt(e.toFixed(o).replace(".","")),i=Number.parseInt(t.toFixed(o).replace(".",""));return s%i/10**o}class Kt extends se{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)!==I.number){const s=this._getOrReturnCtx(t);return A(s,{code:k.invalid_type,expected:I.number,received:s.parsedType}),B}let r;const o=new Ie;for(const s of this._def.checks)s.kind==="int"?ie.isInteger(t.data)||(r=this._getOrReturnCtx(t,r),A(r,{code:k.invalid_type,expected:"integer",received:"float",message:s.message}),o.dirty()):s.kind==="min"?(s.inclusive?t.data<s.value:t.data<=s.value)&&(r=this._getOrReturnCtx(t,r),A(r,{code:k.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),o.dirty()):s.kind==="max"?(s.inclusive?t.data>s.value:t.data>=s.value)&&(r=this._getOrReturnCtx(t,r),A(r,{code:k.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),o.dirty()):s.kind==="multipleOf"?Dv(t.data,s.value)!==0&&(r=this._getOrReturnCtx(t,r),A(r,{code:k.not_multiple_of,multipleOf:s.value,message:s.message}),o.dirty()):s.kind==="finite"?Number.isFinite(t.data)||(r=this._getOrReturnCtx(t,r),A(r,{code:k.not_finite,message:s.message}),o.dirty()):ie.assertNever(s);return{status:o.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,P.toString(n))}gt(t,n){return this.setLimit("min",t,!1,P.toString(n))}lte(t,n){return this.setLimit("max",t,!0,P.toString(n))}lt(t,n){return this.setLimit("max",t,!1,P.toString(n))}setLimit(t,n,r,o){return new Kt({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:P.toString(o)}]})}_addCheck(t){return new Kt({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:P.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:P.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:P.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:P.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:P.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:P.toString(n)})}finite(t){return this._addCheck({kind:"finite",message:P.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:P.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:P.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"&&ie.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)}}Kt.create=e=>new Kt({checks:[],typeName:U.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1,...K(e)});class xn extends se{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)!==I.bigint)return this._getInvalidInput(t);let r;const o=new Ie;for(const s of this._def.checks)s.kind==="min"?(s.inclusive?t.data<s.value:t.data<=s.value)&&(r=this._getOrReturnCtx(t,r),A(r,{code:k.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),o.dirty()):s.kind==="max"?(s.inclusive?t.data>s.value:t.data>=s.value)&&(r=this._getOrReturnCtx(t,r),A(r,{code:k.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),o.dirty()):s.kind==="multipleOf"?t.data%s.value!==BigInt(0)&&(r=this._getOrReturnCtx(t,r),A(r,{code:k.not_multiple_of,multipleOf:s.value,message:s.message}),o.dirty()):ie.assertNever(s);return{status:o.value,value:t.data}}_getInvalidInput(t){const n=this._getOrReturnCtx(t);return A(n,{code:k.invalid_type,expected:I.bigint,received:n.parsedType}),B}gte(t,n){return this.setLimit("min",t,!0,P.toString(n))}gt(t,n){return this.setLimit("min",t,!1,P.toString(n))}lte(t,n){return this.setLimit("max",t,!0,P.toString(n))}lt(t,n){return this.setLimit("max",t,!1,P.toString(n))}setLimit(t,n,r,o){return new xn({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:P.toString(o)}]})}_addCheck(t){return new xn({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:P.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:P.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:P.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:P.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:P.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}}xn.create=e=>new xn({checks:[],typeName:U.ZodBigInt,coerce:(e==null?void 0:e.coerce)??!1,...K(e)});class _o extends se{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==I.boolean){const r=this._getOrReturnCtx(t);return A(r,{code:k.invalid_type,expected:I.boolean,received:r.parsedType}),B}return Fe(t.data)}}_o.create=e=>new _o({typeName:U.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1,...K(e)});class Jn extends se{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==I.date){const s=this._getOrReturnCtx(t);return A(s,{code:k.invalid_type,expected:I.date,received:s.parsedType}),B}if(Number.isNaN(t.data.getTime())){const s=this._getOrReturnCtx(t);return A(s,{code:k.invalid_date}),B}const r=new Ie;let o;for(const s of this._def.checks)s.kind==="min"?t.data.getTime()<s.value&&(o=this._getOrReturnCtx(t,o),A(o,{code:k.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),r.dirty()):s.kind==="max"?t.data.getTime()>s.value&&(o=this._getOrReturnCtx(t,o),A(o,{code:k.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),r.dirty()):ie.assertNever(s);return{status:r.value,value:new Date(t.data.getTime())}}_addCheck(t){return new Jn({...this._def,checks:[...this._def.checks,t]})}min(t,n){return this._addCheck({kind:"min",value:t.getTime(),message:P.toString(n)})}max(t,n){return this._addCheck({kind:"max",value:t.getTime(),message:P.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}}Jn.create=e=>new Jn({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:U.ZodDate,...K(e)});class hi extends se{_parse(t){if(this._getType(t)!==I.symbol){const r=this._getOrReturnCtx(t);return A(r,{code:k.invalid_type,expected:I.symbol,received:r.parsedType}),B}return Fe(t.data)}}hi.create=e=>new hi({typeName:U.ZodSymbol,...K(e)});class vi extends se{_parse(t){if(this._getType(t)!==I.undefined){const r=this._getOrReturnCtx(t);return A(r,{code:k.invalid_type,expected:I.undefined,received:r.parsedType}),B}return Fe(t.data)}}vi.create=e=>new vi({typeName:U.ZodUndefined,...K(e)});class xi extends se{_parse(t){if(this._getType(t)!==I.null){const r=this._getOrReturnCtx(t);return A(r,{code:k.invalid_type,expected:I.null,received:r.parsedType}),B}return Fe(t.data)}}xi.create=e=>new xi({typeName:U.ZodNull,...K(e)});class yi extends se{constructor(){super(...arguments),this._any=!0}_parse(t){return Fe(t.data)}}yi.create=e=>new yi({typeName:U.ZodAny,...K(e)});class wi extends se{constructor(){super(...arguments),this._unknown=!0}_parse(t){return Fe(t.data)}}wi.create=e=>new wi({typeName:U.ZodUnknown,...K(e)});class kt extends se{_parse(t){const n=this._getOrReturnCtx(t);return A(n,{code:k.invalid_type,expected:I.never,received:n.parsedType}),B}}kt.create=e=>new kt({typeName:U.ZodNever,...K(e)});class bi extends se{_parse(t){if(this._getType(t)!==I.undefined){const r=this._getOrReturnCtx(t);return A(r,{code:k.invalid_type,expected:I.void,received:r.parsedType}),B}return Fe(t.data)}}bi.create=e=>new bi({typeName:U.ZodVoid,...K(e)});class qe extends se{_parse(t){const{ctx:n,status:r}=this._processInputParams(t),o=this._def;if(n.parsedType!==I.array)return A(n,{code:k.invalid_type,expected:I.array,received:n.parsedType}),B;if(o.exactLength!==null){const i=n.data.length>o.exactLength.value,a=n.data.length<o.exactLength.value;(i||a)&&(A(n,{code:i?k.too_big:k.too_small,minimum:a?o.exactLength.value:void 0,maximum:i?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),r.dirty())}if(o.minLength!==null&&n.data.length<o.minLength.value&&(A(n,{code:k.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),r.dirty()),o.maxLength!==null&&n.data.length>o.maxLength.value&&(A(n,{code:k.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((i,a)=>o.type._parseAsync(new Rt(n,i,n.path,a)))).then(i=>Ie.mergeArray(r,i));const s=[...n.data].map((i,a)=>o.type._parseSync(new Rt(n,i,n.path,a)));return Ie.mergeArray(r,s)}get element(){return this._def.type}min(t,n){return new qe({...this._def,minLength:{value:t,message:P.toString(n)}})}max(t,n){return new qe({...this._def,maxLength:{value:t,message:P.toString(n)}})}length(t,n){return new qe({...this._def,exactLength:{value:t,message:P.toString(n)}})}nonempty(t){return this.min(1,t)}}qe.create=(e,t)=>new qe({type:e,minLength:null,maxLength:null,exactLength:null,typeName:U.ZodArray,...K(t)});function Bt(e){if(e instanceof he){const t={};for(const n in e.shape){const r=e.shape[n];t[n]=yt.create(Bt(r))}return new he({...e._def,shape:()=>t})}else return e instanceof qe?new qe({...e._def,type:Bt(e.element)}):e instanceof yt?yt.create(Bt(e.unwrap())):e instanceof Jt?Jt.create(Bt(e.unwrap())):e instanceof jt?jt.create(e.items.map(t=>Bt(t))):e}class he extends se{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=ie.objectKeys(t);return this._cached={shape:t,keys:n},this._cached}_parse(t){if(this._getType(t)!==I.object){const u=this._getOrReturnCtx(t);return A(u,{code:k.invalid_type,expected:I.object,received:u.parsedType}),B}const{status:r,ctx:o}=this._processInputParams(t),{shape:s,keys:i}=this._getCached(),a=[];if(!(this._def.catchall instanceof kt&&this._def.unknownKeys==="strip"))for(const u in o.data)i.includes(u)||a.push(u);const c=[];for(const u of i){const d=s[u],g=o.data[u];c.push({key:{status:"valid",value:u},value:d._parse(new Rt(o,g,o.path,u)),alwaysSet:u in o.data})}if(this._def.catchall instanceof kt){const u=this._def.unknownKeys;if(u==="passthrough")for(const d of a)c.push({key:{status:"valid",value:d},value:{status:"valid",value:o.data[d]}});else if(u==="strict")a.length>0&&(A(o,{code:k.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 d of a){const g=o.data[d];c.push({key:{status:"valid",value:d},value:u._parse(new Rt(o,g,o.path,d)),alwaysSet:d in o.data})}}return o.common.async?Promise.resolve().then(async()=>{const u=[];for(const d of c){const g=await d.key,m=await d.value;u.push({key:g,value:m,alwaysSet:d.alwaysSet})}return u}).then(u=>Ie.mergeObjectSync(r,u)):Ie.mergeObjectSync(r,c)}get shape(){return this._def.shape()}strict(t){return P.errToObj,new he({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(n,r)=>{var s,i;const o=((i=(s=this._def).errorMap)==null?void 0:i.call(s,n,r).message)??r.defaultError;return n.code==="unrecognized_keys"?{message:P.errToObj(t).message??o}:{message:o}}}:{}})}strip(){return new he({...this._def,unknownKeys:"strip"})}passthrough(){return new he({...this._def,unknownKeys:"passthrough"})}extend(t){return new he({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new he({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:U.ZodObject})}setKey(t,n){return this.augment({[t]:n})}catchall(t){return new he({...this._def,catchall:t})}pick(t){const n={};for(const r of ie.objectKeys(t))t[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new he({...this._def,shape:()=>n})}omit(t){const n={};for(const r of ie.objectKeys(this.shape))t[r]||(n[r]=this.shape[r]);return new he({...this._def,shape:()=>n})}deepPartial(){return Bt(this)}partial(t){const n={};for(const r of ie.objectKeys(this.shape)){const o=this.shape[r];t&&!t[r]?n[r]=o:n[r]=o.optional()}return new he({...this._def,shape:()=>n})}required(t){const n={};for(const r of ie.objectKeys(this.shape))if(t&&!t[r])n[r]=this.shape[r];else{let s=this.shape[r];for(;s instanceof yt;)s=s._def.innerType;n[r]=s}return new he({...this._def,shape:()=>n})}keyof(){return mc(ie.objectKeys(this.shape))}}he.create=(e,t)=>new he({shape:()=>e,unknownKeys:"strip",catchall:kt.create(),typeName:U.ZodObject,...K(t)});he.strictCreate=(e,t)=>new he({shape:()=>e,unknownKeys:"strict",catchall:kt.create(),typeName:U.ZodObject,...K(t)});he.lazycreate=(e,t)=>new he({shape:e,unknownKeys:"strip",catchall:kt.create(),typeName:U.ZodObject,...K(t)});class Qn extends se{_parse(t){const{ctx:n}=this._processInputParams(t),r=this._def.options;function o(s){for(const a of s)if(a.result.status==="valid")return a.result;for(const a of s)if(a.result.status==="dirty")return n.common.issues.push(...a.ctx.common.issues),a.result;const i=s.map(a=>new ct(a.ctx.common.issues));return A(n,{code:k.invalid_union,unionErrors:i}),B}if(n.common.async)return Promise.all(r.map(async s=>{const i={...n,common:{...n.common,issues:[]},parent:null};return{result:await s._parseAsync({data:n.data,path:n.path,parent:i}),ctx:i}})).then(o);{let s;const i=[];for(const c of r){const u={...n,common:{...n.common,issues:[]},parent:null},d=c._parseSync({data:n.data,path:n.path,parent:u});if(d.status==="valid")return d;d.status==="dirty"&&!s&&(s={result:d,ctx:u}),u.common.issues.length&&i.push(u.common.issues)}if(s)return n.common.issues.push(...s.ctx.common.issues),s.result;const a=i.map(c=>new ct(c));return A(n,{code:k.invalid_union,unionErrors:a}),B}}get options(){return this._def.options}}Qn.create=(e,t)=>new Qn({options:e,typeName:U.ZodUnion,...K(t)});function So(e,t){const n=gt(e),r=gt(t);if(e===t)return{valid:!0,data:e};if(n===I.object&&r===I.object){const o=ie.objectKeys(t),s=ie.objectKeys(e).filter(a=>o.indexOf(a)!==-1),i={...e,...t};for(const a of s){const c=So(e[a],t[a]);if(!c.valid)return{valid:!1};i[a]=c.data}return{valid:!0,data:i}}else if(n===I.array&&r===I.array){if(e.length!==t.length)return{valid:!1};const o=[];for(let s=0;s<e.length;s++){const i=e[s],a=t[s],c=So(i,a);if(!c.valid)return{valid:!1};o.push(c.data)}return{valid:!0,data:o}}else return n===I.date&&r===I.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class er extends se{_parse(t){const{status:n,ctx:r}=this._processInputParams(t),o=(s,i)=>{if(mi(s)||mi(i))return B;const a=So(s.value,i.value);return a.valid?((gi(s)||gi(i))&&n.dirty(),{status:n.value,value:a.data}):(A(r,{code:k.invalid_intersection_types}),B)};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(([s,i])=>o(s,i)):o(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}er.create=(e,t,n)=>new er({left:e,right:t,typeName:U.ZodIntersection,...K(n)});class jt extends se{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==I.array)return A(r,{code:k.invalid_type,expected:I.array,received:r.parsedType}),B;if(r.data.length<this._def.items.length)return A(r,{code:k.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),B;!this._def.rest&&r.data.length>this._def.items.length&&(A(r,{code:k.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const s=[...r.data].map((i,a)=>{const c=this._def.items[a]||this._def.rest;return c?c._parse(new Rt(r,i,r.path,a)):null}).filter(i=>!!i);return r.common.async?Promise.all(s).then(i=>Ie.mergeArray(n,i)):Ie.mergeArray(n,s)}get items(){return this._def.items}rest(t){return new jt({...this._def,rest:t})}}jt.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new jt({items:e,typeName:U.ZodTuple,rest:null,...K(t)})};class _i extends se{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!==I.map)return A(r,{code:k.invalid_type,expected:I.map,received:r.parsedType}),B;const o=this._def.keyType,s=this._def.valueType,i=[...r.data.entries()].map(([a,c],u)=>({key:o._parse(new Rt(r,a,r.path,[u,"key"])),value:s._parse(new Rt(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,d=await c.value;if(u.status==="aborted"||d.status==="aborted")return B;(u.status==="dirty"||d.status==="dirty")&&n.dirty(),a.set(u.value,d.value)}return{status:n.value,value:a}})}else{const a=new Map;for(const c of i){const u=c.key,d=c.value;if(u.status==="aborted"||d.status==="aborted")return B;(u.status==="dirty"||d.status==="dirty")&&n.dirty(),a.set(u.value,d.value)}return{status:n.value,value:a}}}}_i.create=(e,t,n)=>new _i({valueType:t,keyType:e,typeName:U.ZodMap,...K(n)});class yn extends se{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==I.set)return A(r,{code:k.invalid_type,expected:I.set,received:r.parsedType}),B;const o=this._def;o.minSize!==null&&r.data.size<o.minSize.value&&(A(r,{code:k.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),n.dirty()),o.maxSize!==null&&r.data.size>o.maxSize.value&&(A(r,{code:k.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),n.dirty());const s=this._def.valueType;function i(c){const u=new Set;for(const d of c){if(d.status==="aborted")return B;d.status==="dirty"&&n.dirty(),u.add(d.value)}return{status:n.value,value:u}}const a=[...r.data.values()].map((c,u)=>s._parse(new Rt(r,c,r.path,u)));return r.common.async?Promise.all(a).then(c=>i(c)):i(a)}min(t,n){return new yn({...this._def,minSize:{value:t,message:P.toString(n)}})}max(t,n){return new yn({...this._def,maxSize:{value:t,message:P.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}}yn.create=(e,t)=>new yn({valueType:e,minSize:null,maxSize:null,typeName:U.ZodSet,...K(t)});class Si extends se{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})}}Si.create=(e,t)=>new Si({getter:e,typeName:U.ZodLazy,...K(t)});class Ci extends se{_parse(t){if(t.data!==this._def.value){const n=this._getOrReturnCtx(t);return A(n,{received:n.data,code:k.invalid_literal,expected:this._def.value}),B}return{status:"valid",value:t.data}}get value(){return this._def.value}}Ci.create=(e,t)=>new Ci({value:e,typeName:U.ZodLiteral,...K(t)});function mc(e,t){return new Xt({values:e,typeName:U.ZodEnum,...K(t)})}class Xt extends se{_parse(t){if(typeof t.data!="string"){const n=this._getOrReturnCtx(t),r=this._def.values;return A(n,{expected:ie.joinValues(r),received:n.parsedType,code:k.invalid_type}),B}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 A(n,{received:n.data,code:k.invalid_enum_value,options:r}),B}return Fe(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 Xt.create(t,{...this._def,...n})}exclude(t,n=this._def){return Xt.create(this.options.filter(r=>!t.includes(r)),{...this._def,...n})}}Xt.create=mc;class Ri extends se{_parse(t){const n=ie.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==I.string&&r.parsedType!==I.number){const o=ie.objectValues(n);return A(r,{expected:ie.joinValues(o),received:r.parsedType,code:k.invalid_type}),B}if(this._cache||(this._cache=new Set(ie.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){const o=ie.objectValues(n);return A(r,{received:r.data,code:k.invalid_enum_value,options:o}),B}return Fe(t.data)}get enum(){return this._def.values}}Ri.create=(e,t)=>new Ri({values:e,typeName:U.ZodNativeEnum,...K(t)});class tr extends se{unwrap(){return this._def.type}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==I.promise&&n.common.async===!1)return A(n,{code:k.invalid_type,expected:I.promise,received:n.parsedType}),B;const r=n.parsedType===I.promise?n.data:Promise.resolve(n.data);return Fe(r.then(o=>this._def.type.parseAsync(o,{path:n.path,errorMap:n.common.contextualErrorMap})))}}tr.create=(e,t)=>new tr({type:e,typeName:U.ZodPromise,...K(t)});class Yt extends se{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===U.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:n,ctx:r}=this._processInputParams(t),o=this._def.effect||null,s={addIssue:i=>{A(r,i),i.fatal?n.abort():n.dirty()},get path(){return r.path}};if(s.addIssue=s.addIssue.bind(s),o.type==="preprocess"){const i=o.transform(r.data,s);if(r.common.async)return Promise.resolve(i).then(async a=>{if(n.value==="aborted")return B;const c=await this._def.schema._parseAsync({data:a,path:r.path,parent:r});return c.status==="aborted"?B:c.status==="dirty"||n.value==="dirty"?ln(c.value):c});{if(n.value==="aborted")return B;const a=this._def.schema._parseSync({data:i,path:r.path,parent:r});return a.status==="aborted"?B:a.status==="dirty"||n.value==="dirty"?ln(a.value):a}}if(o.type==="refinement"){const i=a=>{const c=o.refinement(a,s);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"?B:(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"?B:(a.status==="dirty"&&n.dirty(),i(a.value).then(()=>({status:n.value,value:a.value}))))}if(o.type==="transform")if(r.common.async===!1){const i=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Zt(i))return B;const a=o.transform(i.value,s);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=>Zt(i)?Promise.resolve(o.transform(i.value,s)).then(a=>({status:n.value,value:a})):B);ie.assertNever(o)}}Yt.create=(e,t,n)=>new Yt({schema:e,typeName:U.ZodEffects,effect:t,...K(n)});Yt.createWithPreprocess=(e,t,n)=>new Yt({schema:t,effect:{type:"preprocess",transform:e},typeName:U.ZodEffects,...K(n)});class yt extends se{_parse(t){return this._getType(t)===I.undefined?Fe(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}yt.create=(e,t)=>new yt({innerType:e,typeName:U.ZodOptional,...K(t)});class Jt extends se{_parse(t){return this._getType(t)===I.null?Fe(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}Jt.create=(e,t)=>new Jt({innerType:e,typeName:U.ZodNullable,...K(t)});class Co extends se{_parse(t){const{ctx:n}=this._processInputParams(t);let r=n.data;return n.parsedType===I.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}Co.create=(e,t)=>new Co({innerType:e,typeName:U.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...K(t)});class Ro extends se{_parse(t){const{ctx:n}=this._processInputParams(t),r={...n,common:{...n.common,issues:[]}},o=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return Yn(o)?o.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new ct(r.common.issues)},input:r.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new ct(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}Ro.create=(e,t)=>new Ro({innerType:e,typeName:U.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...K(t)});class ki extends se{_parse(t){if(this._getType(t)!==I.nan){const r=this._getOrReturnCtx(t);return A(r,{code:k.invalid_type,expected:I.nan,received:r.parsedType}),B}return{status:"valid",value:t.data}}}ki.create=e=>new ki({typeName:U.ZodNaN,...K(e)});class $v extends se{_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 us extends se{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.common.async)return(async()=>{const s=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?B:s.status==="dirty"?(n.dirty(),ln(s.value)):this._def.out._parseAsync({data:s.value,path:r.path,parent:r})})();{const o=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?B:o.status==="dirty"?(n.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:r.path,parent:r})}}static create(t,n){return new us({in:t,out:n,typeName:U.ZodPipeline})}}class ko extends se{_parse(t){const n=this._def.innerType._parse(t),r=o=>(Zt(o)&&(o.value=Object.freeze(o.value)),o);return Yn(n)?n.then(o=>r(o)):r(n)}unwrap(){return this._def.innerType}}ko.create=(e,t)=>new ko({innerType:e,typeName:U.ZodReadonly,...K(t)});var U;(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"})(U||(U={}));const de=vt.create,Rn=Kt.create,vr=_o.create;kt.create;const gc=qe.create,ye=he.create;Qn.create;er.create;jt.create;const rn=Xt.create;tr.create;yt.create;Jt.create;const Lv=10,Eo={name:"space_search",description:"Find Hugging Face Spaces using semantic search. Include links to the Space when presenting the results.",schema:ye({query:de().min(1,"Query is required").max(100,"Query too long").describe("Semantic Search Query"),limit:Rn().optional().default(Lv).describe("Number of results to return"),mcp:vr().optional().default(!1).describe("Only return MCP Server enabled Spaces")}),annotations:{title:"Hugging Face Space Search"}},Mo={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:ye({query:de().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:de().optional().describe("Organization or user who created the model (e.g., 'google', 'meta-llama', 'microsoft')"),task:de().optional().describe("Model task type (e.g., 'text-generation', 'image-classification', 'translation')"),library:de().optional().describe("Framework the model uses (e.g., 'transformers', 'diffusers', 'timm')"),sort:rn(["trendingScore","downloads","likes","createdAt","lastModified"]).optional().describe("Sort order: trendingScore, downloads , likes, createdAt, lastModified"),limit:Rn().min(1).max(100).optional().default(20).describe("Maximum number of results to return")}),annotations:{title:"Model Search"}};new Promise(e=>{});var Zr=65536;Vv();function Vv(){try{return new Uint32Array(Zr)}catch{const t=new Array(Zr);for(let n=0;n<Zr;n++)t[n]=0;return t}}const zv={name:"model_details",schema:ye({model_id:de().min(1,"Model ID is required").describe("The Model ID in author/model format (e.g., microsoft/DialoGPT-large)")})};ye({model_id:de().min(5,"Model ID is required").max(50).describe("The Model ID in author/model format (e.g. 'openai/gpt-oss-120b')")});const No={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:ye({query:de().min(3,"Supply at least one search term").max(200,"Query too long").describe("Semantic Search query"),results_limit:Rn().optional().default(12).describe("Number of results to return"),concise_only:vr().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"}},Ao={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:ye({query:de().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:de().optional().describe("Organization or user who created the dataset (e.g., 'google', 'facebook', 'allenai')"),tags:gc(de()).optional().describe("Tags to filter datasets (e.g., ['language:en', 'size_categories:1M<n<10M', 'task_categories:text-classification'])"),sort:rn(["trendingScore","downloads","likes","createdAt","lastModified"]).optional().describe("Sort order: trendingScore, downloads, likes, createdAt, lastModified"),limit:Rn().min(1).max(100).optional().default(20).describe("Maximum number of results to return")}),annotations:{title:"Dataset Search"}},Hv={name:"dataset_details",schema:ye({dataset_id:de().min(5,"Dataset ID is required").describe("The Dataset ID (e.g. Anthropic/hh-rlhf, squad)")})};ye({dataset_id:de().min(3,"Dataset ID is required").max(100).describe("The Dataset ID (e.g. 'Anthropic/hh-rlhf', 'squad')")});const To={name:"hub_repo_details",description:"Get details for one or more Hugging Face repos (model, dataset, or space). Auto-detects type unless specified.",schema:ye({repo_ids:gc(de().min(1)).min(1,"Provide at least one id").max(10,"Provide at most 10 repo ids").describe("Repo IDs for (models|dataset/space) - usually in author/name format (e.g. openai/gpt-oss-120b)"),repo_type:rn(["model","dataset","space"]).optional().describe("Specify lookup type; otherwise auto-detects"),include_readme:vr().default(!1).describe("Include README from the repo")}),annotations:{title:"Hub Repo Details"}},pc={name:"duplicate_space",schema:ye({sourceSpaceId:de().min(1).describe("Space ID to copy (e.g., 'username/space-name')"),newSpaceId:de().optional().describe("Name for the new space (optional, defaults to source space-name)"),hardware:rn(["freecpu","zerogpu"]).optional().describe('Either "freecpu" or "zerogpu" (defaults based on source). Both options are in the free tier.'),private:vr().optional().default(!0).describe("Check with User whether the new space should be public or private.")}),annotations:{title:"Duplicate Hugging Face Space"}};ye({username:de().optional().describe("Username to get spaces for (defaults to authenticated user)")});const hc={name:"space_files",schema:ye({spaceName:de().optional().describe('Space identifier in format "username/spacename"'),fileType:rn(["all","image","audio"]).optional().default("all").describe("Filter files by type: all (default), image, or audio files only")}),annotations:{title:"Space Files List"}};ye({fileType:rn(["all","image","audio","text"]).optional().default("all").describe("Filter by type")});ye({});ye({user_id:de().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")});ye({paper_id:de().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 ds=typeof window<"u"?window:{};function Gv(){var e=ds.DOMParser,t=!1;try{new e().parseFromString("","text/html")&&(t=!0)}catch{}return t}function Bv(){var e=function(){};return Uv()?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 Uv(){var e=!1;try{document.implementation.createHTMLDocument("").open()}catch{ds.ActiveXObject&&(e=!0)}return e}Gv()?ds.DOMParser:Bv();const jo={name:"hf_doc_fetch",description:"Fetch a document from the Hugging Face or Gradio documentation library. For large documents, use offset to get subsequent chunks.",schema:ye({doc_url:de().max(200,"Query too long").describe("Documentation URL (Hugging Face or Gradio)"),offset:Rn().min(0).optional().describe("Token offset for large documents (use the offset from truncation message)")}),annotations:{title:"Fetch a document from the Hugging Face documentation library"}},Io={name:"hf_doc_search",description:"Search and Discover Hugging Face Product and Library documentation. Use an empty query to discover structure and navigation hints and tips. You MUST consult this tool for the most up-to-date information when using Hugging Face libraries. Combine with the Product filter to focus results.",schema:ye({query:de().max(200,"Query too long").superRefine((e,t)=>{const n=e.trim();n.length!==0&&n.length<3&&t.addIssue({code:k.too_small,type:"string",minimum:3,inclusive:!0,message:"Supply at least one search term"})}).describe("Start with an empty query for structure, endpoint discovery and navigation tips. Use semantic queries for targetted searches."),product:de().optional().describe("Filter by Product. Supply when known for focused results")}),annotations:{title:"Hugging Face Documentation Search"}};ye({space_id:de().min(1).describe("Space ID in 'username/repo' format")});const Ei=Eo.name,Mi=Mo.name,Wv=zv.name,Ni=No.name,Ai=Ao.name,qv=Hv.name,dn=To.name,Ti=pc.name,ji=hc.name,Ii=Io.name,Pi=jo.name;function Oi(e){const t=new Set,n=[];let r=!1;for(const o of e){if(o===Wv||o===qv){r=!0;continue}t.has(o)||(t.add(o),n.push(o))}return r&&!t.has(dn)&&(t.add(dn),n.push(dn)),n}const Kr=e=>fetch(e).then(t=>{if(!t.ok)throw new Error(`Failed to fetch: ${t.status}`);return t.json()});function Zv(){var S,$,L,X,te,Z,V,ne,G,J,R;const{data:e,error:t}=cn("/api/transport",Kr,{refreshInterval:3e3,revalidateOnFocus:!0,revalidateOnReconnect:!0});cn("/api/sessions",Kr,{refreshInterval:3e3,revalidateOnFocus:!0});const{data:n}=cn("/api/settings",Kr),r=((S=n==null?void 0:n.builtInTools)==null?void 0:S.includes(ui))??!1,o=(($=n==null?void 0:n.builtInTools)==null?void 0:$.includes(di))??!1,[s,i]=h.useState(["","",""]),[a,c]=h.useState(["","",""]),[u,d]=h.useState([!1,!1,!1]),[g,m]=h.useState(!1);h.useEffect(()=>{if(n!=null&&n.spaceTools&&!g){const M=["","",""],H=["","",""],z=[!1,!1,!1];n.spaceTools.forEach((Y,re)=>{re<3&&(M[re]=Y.name,H[re]=Y.subdomain,z[re]=!0)}),i(M),c(H),d(z),m(!0)}},[n,g]);const f=!e&&!t,v=t?t.message:null,p=async(M,H)=>{try{const z=n||{builtInTools:[]},Y=Oi(z.builtInTools),re=H?[...Y.filter(Q=>Q!==M),M]:Y.filter(Q=>Q!==M),le=Oi(re),be={...z,builtInTools:le};Vn("/api/settings",be,!1);const _e=await fetch("/api/settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({builtInTools:le})});if(!_e.ok)throw new Error(`Failed to update tool settings: ${_e.status}`);Vn("/api/settings"),console.log(`${M} is now ${H?"enabled":"disabled"}`)}catch(z){console.error("Error updating tool settings:",z),alert(`Error updating ${M}: ${z instanceof Error?z.message:"Unknown error"}`),Vn("/api/settings")}},y=async(M,H)=>{const z=[...u];z[M]=H,d(z),await b(z)},x=async(M,H)=>{const z=[...s];z[M]=H,i(z),u[M]&&await b(u)},w=async(M,H)=>{const z=[...a];z[M]=H,c(z),u[M]&&await b(u)},b=async M=>{try{const H=[];for(let Y=0;Y<3;Y++)M[Y]&&s[Y]&&a[Y]&&H.push({_id:`space-${Y}`,name:s[Y],subdomain:a[Y],emoji:"🔧"});const z=await fetch("/api/settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({spaceTools:H})});if(!z.ok)throw new Error(`Failed to update space tools: ${z.status}`)}catch(H){console.error("Error updating space tools:",H)}},_=async()=>{const M="https://huggingface.co/mcp";try{await navigator.clipboard.writeText(M)}catch(H){console.error("Failed to copy URL:",H)}},C=()=>{window.open("https://huggingface.co/settings/mcp","_blank")},N={paper_search:{id:Ni,label:No.annotations.title,description:No.description,settings:{enabled:((L=n==null?void 0:n.builtInTools)==null?void 0:L.includes(Ni))??!0}},space_search:{id:Ei,label:Eo.annotations.title,description:Eo.description,settings:{enabled:((X=n==null?void 0:n.builtInTools)==null?void 0:X.includes(Ei))??!0}},model_search:{id:Mi,label:Mo.annotations.title,description:Mo.description,settings:{enabled:((te=n==null?void 0:n.builtInTools)==null?void 0:te.includes(Mi))??!0}},dataset_search:{id:Ai,label:Ao.annotations.title,description:Ao.description,settings:{enabled:((Z=n==null?void 0:n.builtInTools)==null?void 0:Z.includes(Ai))??!0}},hub_repo_details:{id:dn,label:To.annotations.title,description:To.description,settings:{enabled:((V=n==null?void 0:n.builtInTools)==null?void 0:V.includes(dn))??!0}},include_readme:{id:ui,label:"Allow README Include (flag)",description:"Allows hub_repo_details to attach README content when the tool request explicitly opts in. Requires reconnect to take effect.",settings:{enabled:r}},doc_semantic_search:{id:Ii,label:Io.annotations.title,description:Io.description,settings:{enabled:((ne=n==null?void 0:n.builtInTools)==null?void 0:ne.includes(Ii))??!0}},doc_fetch:{id:Pi,label:jo.annotations.title,description:jo.description,settings:{enabled:((G=n==null?void 0:n.builtInTools)==null?void 0:G.includes(Pi))??!0}}},E={duplicate_space:{id:Ti,label:pc.annotations.title,description:"Duplicate a Hugging Face Space to your account.",settings:{enabled:((J=n==null?void 0:n.builtInTools)==null?void 0:J.includes(Ti))??!0}},space_files:{id:ji,label:hc.annotations.title,description:"List all files in a static Hugging Face Space with download URLs.",settings:{enabled:((R=n==null?void 0:n.builtInTools)==null?void 0:R.includes(ji))??!0}},no_gradio_images:{id:di,label:"Disable Gradio Images (flag)",description:"Strips image responses from Gradio spaces. Mirrors the 'no_image_content' URL parameter and requires reconnect to take effect.",settings:{enabled:o}}};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(dv,{defaultValue:"metrics",className:"w-full",children:[l.jsxs(fv,{className:"mb-6 w-full overflow-x-auto flex-nowrap",children:[l.jsx(Ht,{value:"metrics",className:"whitespace-nowrap",children:"📊 Metrics"}),l.jsx(Ht,{value:"mcp",className:"whitespace-nowrap",children:"🔧 MCP"}),!(e!=null&&e.externalApiMode)&&l.jsx(Ht,{value:"search",className:"whitespace-nowrap",children:"🔍 Search"}),!(e!=null&&e.externalApiMode)&&l.jsx(Ht,{value:"spaces",className:"whitespace-nowrap",children:"🚀 Spaces"}),!(e!=null&&e.externalApiMode)&&l.jsx(Ht,{value:"gradio",className:"whitespace-nowrap",children:"🚀 Gradio"}),l.jsx(Ht,{value:"home",className:"whitespace-nowrap",children:"🏠 Home"})]}),l.jsx(Gt,{value:"metrics",className:"mt-0",children:l.jsx(tv,{})}),l.jsx(Gt,{value:"mcp",className:"mt-0",children:l.jsx(rv,{})}),!(e!=null&&e.externalApiMode)&&l.jsx(Gt,{value:"search",className:"mt-0",children:l.jsx(Ns,{title:"🤗 Hugging Face Search Tools (MCP)",description:"Find and use Hugging Face and Community content.",tools:N,onToolToggle:p})}),!(e!=null&&e.externalApiMode)&&l.jsx(Gt,{value:"spaces",className:"mt-0",children:l.jsx(Ns,{title:"🤗 Hugging Face Space Tools (MCP)",description:"Manage and duplicate Hugging Face Spaces.",tools:E,onToolToggle:p})}),!(e!=null&&e.externalApiMode)&&l.jsx(Gt,{value:"gradio",className:"mt-0",children:l.jsx(Cd,{spaceNames:s,spaceSubdomains:a,enabledSpaces:u,onSpaceToolToggle:y,onSpaceToolNameChange:x,onSpaceToolSubdomainChange:w})}),l.jsx(Gt,{value:"home",className:"mt-0",children:l.jsxs(nt,{children:[l.jsxs(rt,{children:[l.jsx(ot,{children:"🤗 HF MCP Server"}),l.jsx(It,{children:"Connect with AI assistants through the Model Context Protocol"})]}),l.jsxs(st,{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(At,{}),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(At,{}),l.jsxs("div",{className:"flex flex-col gap-4",children:[l.jsxs(Nt,{size:"xl",onClick:_,className:"w-full transition-all duration-200 active:bg-green-500 active:border-green-500 touch-manipulation",children:[l.jsx(fd,{className:"mr-2 h-5 w-5"}),"Copy MCP URL"]}),l.jsxs(Nt,{size:"xl",variant:"outline",onClick:C,className:"w-full touch-manipulation",children:[l.jsx(hd,{className:"mr-2 h-5 w-5"}),"Go to Settings"]})]})]})]})})]})})}),l.jsx(ov,{isLoading:f,error:v,transportInfo:e||{transport:"unknown"}})]})}bc.createRoot(document.getElementById("root")).render(l.jsx(h.StrictMode,{children:l.jsx(Zv,{})}));