@llmindset/hf-mcp-server 0.3.19 → 0.3.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/server/mcp-server.d.ts.map +1 -1
- package/dist/server/mcp-server.js +58 -2
- package/dist/server/mcp-server.js.map +1 -1
- package/dist/server/skills/skill-directory-schema.d.ts +40 -0
- package/dist/server/skills/skill-directory-schema.d.ts.map +1 -0
- package/dist/server/skills/skill-directory-schema.js +14 -0
- package/dist/server/skills/skill-directory-schema.js.map +1 -0
- package/dist/server/skills/skill-loader.d.ts.map +1 -1
- package/dist/server/skills/skill-loader.js +143 -43
- package/dist/server/skills/skill-loader.js.map +1 -1
- package/dist/server/skills/skill-resource-data.d.ts +11 -3
- package/dist/server/skills/skill-resource-data.d.ts.map +1 -1
- package/dist/server/skills/skill-resource-data.js +51 -25
- package/dist/server/skills/skill-resource-data.js.map +1 -1
- package/dist/server/skills/skill-resources.d.ts.map +1 -1
- package/dist/server/skills/skill-resources.js +23 -11
- package/dist/server/skills/skill-resources.js.map +1 -1
- package/dist/server/skills/skill-types.d.ts +28 -11
- package/dist/server/skills/skill-types.d.ts.map +1 -1
- package/dist/server/skills/skill-uri.d.ts +3 -1
- package/dist/server/skills/skill-uri.d.ts.map +1 -1
- package/dist/server/skills/skill-uri.js +18 -4
- package/dist/server/skills/skill-uri.js.map +1 -1
- package/dist/server/transport/stateless-http-transport.d.ts.map +1 -1
- package/dist/server/transport/stateless-http-transport.js +25 -3
- package/dist/server/transport/stateless-http-transport.js.map +1 -1
- package/dist/server/utils/capability-utils.d.ts.map +1 -1
- package/dist/server/utils/capability-utils.js +3 -1
- package/dist/server/utils/capability-utils.js.map +1 -1
- package/dist/server/utils/tool-selection-strategy.d.ts.map +1 -1
- package/dist/server/utils/tool-selection-strategy.js +11 -2
- package/dist/server/utils/tool-selection-strategy.js.map +1 -1
- package/dist/shared/bouquet-presets.d.ts.map +1 -1
- package/dist/shared/bouquet-presets.js +12 -0
- package/dist/shared/bouquet-presets.js.map +1 -1
- package/dist/web/assets/{main-DGLuoLv1.js → main-CvlQJc_z.js} +1 -1
- package/dist/web/index.html +1 -1
- package/dist/web/mcp-welcome.html +12 -12
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bouquet-presets.js","sourceRoot":"","sources":["../../src/shared/bouquet-presets.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,oBAAoB,EACpB,cAAc,EACd,wBAAwB,EACxB,iBAAiB,EACjB,eAAe,EACf,qBAAqB,EACrB,mBAAmB,EACnB,mBAAmB,EACnB,4BAA4B,GAC5B,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,mBAAmB,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAEpF,MAAM,CAAC,MAAM,QAAQ,GAAgC;IACpD,MAAM,EAAE;QACP,YAAY,EAAE,CAAC,GAAG,cAAc,CAAC,MAAM,CAAC;QACxC,UAAU,EAAE,EAAE;KACd;IACD,MAAM,EAAE;QACP,YAAY,EAAE,CAAC,GAAG,cAAc,CAAC,MAAM,CAAC;QACxC,UAAU,EAAE,EAAE;KACd;IACD,MAAM,EAAE;QACP,YAAY,EAAE,CAAC,GAAG,cAAc,CAAC,MAAM,CAAC;QACxC,UAAU,EAAE,EAAE;KACd;IACD,IAAI,EAAE;QACL,YAAY,EAAE,CAAC,GAAG,cAAc,CAAC,IAAI,CAAC;QACtC,UAAU,EAAE,EAAE;KACd;IACD,MAAM,EAAE;QACP,YAAY,EAAE;YACb,wBAAwB;YACxB,mBAAmB;YACnB,mBAAmB;YACnB,4BAA4B;YAC5B,eAAe;SACf;QACD,UAAU,EAAE,EAAE;KACd;IACD,GAAG,EAAE;QACJ,YAAY,EAAE,CAAC,GAAG,oBAAoB,CAAC;QACvC,UAAU,EAAE,EAAE;KACd;IAED,uBAAuB,EAAE;QACxB,YAAY,EAAE,CAAC,wBAAwB,EAAE,mBAAmB,CAAC;QAC7D,UAAU,EAAE,EAAE;KACd;IACD,gBAAgB,EAAE;QACjB,YAAY,EAAE,CAAC,wBAAwB,CAAC;QACxC,UAAU,EAAE,EAAE;KACd;IACD,gBAAgB,EAAE;QACjB,YAAY,EAAE,CAAC,wBAAwB,CAAC;QACxC,UAAU,EAAE,EAAE;KACd;IACD,MAAM,EAAE;QACP,YAAY,EAAE,CAAC,iBAAiB,CAAC;QACjC,UAAU,EAAE,EAAE;KACd;IACD,IAAI,EAAE;QACL,YAAY,EAAE,CAAC,eAAe,CAAC;QAC/B,UAAU,EAAE,EAAE;KACd;IACD,KAAK,EAAE;QACN,YAAY,EAAE,CAAC,mBAAmB,CAAC;QACnC,UAAU,EAAE,EAAE;KACd;IACD,aAAa,EAAE;QACd,YAAY,EAAE,CAAC,qBAAqB,CAAC;QACrC,UAAU,EAAE,EAAE;KACd;IACD,KAAK,EAAE;QACN,YAAY,EAAE,EAAE;QAChB,UAAU,EAAE,EAAE;KACd;CACD,CAAC;AAqBF,MAAM,WAAW,GAA+C;IAC/D;QACC,GAAG,EAAE,QAAQ;QACb,KAAK,EAAE,gBAAgB;QACvB,WAAW,
|
|
1
|
+
{"version":3,"file":"bouquet-presets.js","sourceRoot":"","sources":["../../src/shared/bouquet-presets.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,oBAAoB,EACpB,cAAc,EACd,wBAAwB,EACxB,iBAAiB,EACjB,eAAe,EACf,qBAAqB,EACrB,mBAAmB,EACnB,mBAAmB,EACnB,4BAA4B,GAC5B,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,mBAAmB,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAEpF,MAAM,CAAC,MAAM,QAAQ,GAAgC;IACpD,MAAM,EAAE;QACP,YAAY,EAAE,CAAC,GAAG,cAAc,CAAC,MAAM,CAAC;QACxC,UAAU,EAAE,EAAE;KACd;IACD,MAAM,EAAE;QACP,YAAY,EAAE,CAAC,GAAG,cAAc,CAAC,MAAM,CAAC;QACxC,UAAU,EAAE,EAAE;KACd;IACD,MAAM,EAAE;QACP,YAAY,EAAE,CAAC,GAAG,cAAc,CAAC,MAAM,CAAC;QACxC,UAAU,EAAE,EAAE;KACd;IACD,IAAI,EAAE;QACL,YAAY,EAAE,CAAC,GAAG,cAAc,CAAC,IAAI,CAAC;QACtC,UAAU,EAAE,EAAE;KACd;IACD,MAAM,EAAE;QACP,YAAY,EAAE;YACb,wBAAwB;YACxB,mBAAmB;YACnB,mBAAmB;YACnB,4BAA4B;YAC5B,eAAe;SACf;QACD,UAAU,EAAE,EAAE;KACd;IACD,GAAG,EAAE;QACJ,YAAY,EAAE,CAAC,GAAG,oBAAoB,CAAC;QACvC,UAAU,EAAE,EAAE;KACd;IAED,uBAAuB,EAAE;QACxB,YAAY,EAAE,CAAC,wBAAwB,EAAE,mBAAmB,CAAC;QAC7D,UAAU,EAAE,EAAE;KACd;IACD,gBAAgB,EAAE;QACjB,YAAY,EAAE,CAAC,wBAAwB,CAAC;QACxC,UAAU,EAAE,EAAE;KACd;IACD,gBAAgB,EAAE;QACjB,YAAY,EAAE,CAAC,wBAAwB,CAAC;QACxC,UAAU,EAAE,EAAE;KACd;IACD,MAAM,EAAE;QACP,YAAY,EAAE,CAAC,iBAAiB,CAAC;QACjC,UAAU,EAAE,EAAE;KACd;IACD,IAAI,EAAE;QACL,YAAY,EAAE,CAAC,eAAe,CAAC;QAC/B,UAAU,EAAE,EAAE;KACd;IACD,OAAO,EAAE;QACR,YAAY,EAAE,CAAC,GAAG,cAAc,CAAC,OAAO,CAAC;QACzC,UAAU,EAAE,EAAE;KACd;IACD,KAAK,EAAE;QACN,YAAY,EAAE,CAAC,mBAAmB,CAAC;QACnC,UAAU,EAAE,EAAE;KACd;IACD,aAAa,EAAE;QACd,YAAY,EAAE,CAAC,qBAAqB,CAAC;QACrC,UAAU,EAAE,EAAE;KACd;IACD,KAAK,EAAE;QACN,YAAY,EAAE,EAAE;QAChB,UAAU,EAAE,EAAE;KACd;CACD,CAAC;AAqBF,MAAM,WAAW,GAA+C;IAC/D;QACC,GAAG,EAAE,QAAQ;QACb,KAAK,EAAE,gBAAgB;QACvB,WAAW,EACV,+LAA+L;QAChM,QAAQ,EAAE,MAAM;QAChB,eAAe,EAAE,IAAI;QACrB,WAAW,EAAE,IAAI;KACjB;IACD;QACC,GAAG,EAAE,QAAQ;QACb,KAAK,EAAE,gBAAgB;QACvB,WAAW,EAAE,yDAAyD;QACtE,QAAQ,EAAE,MAAM;QAChB,eAAe,EAAE,IAAI;QACrB,WAAW,EAAE,IAAI;KACjB;IACD;QACC,GAAG,EAAE,QAAQ;QACb,KAAK,EAAE,cAAc;QACrB,WAAW,EAAE,2DAA2D;QACxE,QAAQ,EAAE,MAAM;QAChB,eAAe,EAAE,IAAI;QACrB,WAAW,EAAE,IAAI;KACjB;IACD;QACC,GAAG,EAAE,MAAM;QACX,KAAK,EAAE,4BAA4B;QACnC,WAAW,EAAE,uCAAuC;QACpD,QAAQ,EAAE,MAAM;QAChB,eAAe,EAAE,IAAI;QACrB,WAAW,EAAE,IAAI;KACjB;IACD;QACC,GAAG,EAAE,QAAQ;QACb,KAAK,EAAE,2BAA2B;QAClC,WAAW,EAAE,2EAA2E;QACxF,QAAQ,EAAE,MAAM;QAChB,eAAe,EAAE,IAAI;QACrB,WAAW,EAAE,IAAI;KACjB;IA0BD;QACC,GAAG,EAAE,kBAAkB;QACvB,KAAK,EAAE,kBAAkB;QACzB,WAAW,EAAE,6DAA6D;QAC1E,QAAQ,EAAE,UAAU;QACpB,eAAe,EAAE,KAAK;QACtB,WAAW,EAAE,KAAK;QAClB,YAAY,EAAE;YACb;gBACC,KAAK,EAAE,uBAAuB;gBAC9B,KAAK,EAAE,uBAAuB;gBAC9B,WAAW,EAAE,mDAAmD;aAChE;SACD;KACD;IACD;QACC,GAAG,EAAE,QAAQ;QACb,KAAK,EAAE,gBAAgB;QACvB,WAAW,EACV,+GAA+G;QAChH,QAAQ,EAAE,UAAU;QACpB,eAAe,EAAE,IAAI;QACrB,WAAW,EAAE,IAAI;KACjB;IACD;QACC,GAAG,EAAE,MAAM;QACX,KAAK,EAAE,qBAAqB;QAC5B,WAAW,EAAE,gEAAgE;QAC7E,QAAQ,EAAE,UAAU;QACpB,eAAe,EAAE,IAAI;QACrB,WAAW,EAAE,IAAI;KACjB;IACD;QACC,GAAG,EAAE,SAAS;QACd,KAAK,EAAE,SAAS;QAChB,WAAW,EAAE,yDAAyD;QACtE,QAAQ,EAAE,UAAU;QACpB,eAAe,EAAE,IAAI;QACrB,WAAW,EAAE,IAAI;KACjB;IACD;QACC,GAAG,EAAE,OAAO;QACZ,KAAK,EAAE,aAAa;QACpB,WAAW,EAAE,uDAAuD;QACpE,QAAQ,EAAE,UAAU;QACpB,eAAe,EAAE,IAAI;QACrB,WAAW,EAAE,IAAI;KACjB;IACD;QACC,GAAG,EAAE,OAAO;QACZ,KAAK,EAAE,aAAa;QACpB,WAAW,EAAE,6DAA6D;QAC1E,QAAQ,EAAE,UAAU;QACpB,eAAe,EAAE,IAAI;QACrB,WAAW,EAAE,IAAI;KACjB;CACD,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,GAAoB,WAAW,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE;IAC1E,MAAM,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IACpC,OAAO;QACN,GAAG,MAAM;QACT,YAAY,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,EAAE;QACpD,YAAY,EAAE,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS;KACpG,CAAC;AACH,CAAC,CAAC,CAAC;AAWH,MAAM,iBAAiB,GAAgE;IACtF,YAAY,EAAE;QACb,KAAK,EAAE,cAAc;QACrB,WAAW,EAAE,+DAA+D;KAC5E;IACD,eAAe,EAAE;QAChB,KAAK,EAAE,aAAa;QACpB,WAAW,EAAE,qEAAqE;KAClF;IACD,WAAW,EAAE;QACZ,KAAK,EAAE,aAAa;QACpB,WAAW,EAAE,uDAAuD;KACpE;IACD,aAAa,EAAE;QACd,KAAK,EAAE,eAAe;QACtB,WAAW,EAAE,6DAA6D;KAC1E;IACD,YAAY,EAAE;QACb,KAAK,EAAE,cAAc;QACrB,WAAW,EAAE,kDAAkD;KAC/D;IACD,eAAe,EAAE;QAChB,KAAK,EAAE,iBAAiB;QACxB,WAAW,EAAE,gDAAgD;KAC7D;IACD,eAAe,EAAE;QAChB,KAAK,EAAE,iBAAiB;QACxB,WAAW,EAAE,sDAAsD;KACnE;IACD,UAAU,EAAE;QACX,KAAK,EAAE,YAAY;QACnB,WAAW,EAAE,6CAA6C;KAC1D;IACD,WAAW,EAAE;QACZ,KAAK,EAAE,aAAa;QACpB,WAAW,EAAE,kDAAkD;KAC/D;IACD,SAAS,EAAE;QACV,KAAK,EAAE,WAAW;QAClB,WAAW,EAAE,qDAAqD;KAClE;IACD,aAAa,EAAE;QACd,KAAK,EAAE,aAAa;QACpB,WAAW,EAAE,6CAA6C;KAC1D;IACD,YAAY,EAAE;QACb,KAAK,EAAE,YAAY;QACnB,WAAW,EAAE,2DAA2D;KACxE;IACD,gBAAgB,EAAE;QACjB,KAAK,EAAE,kBAAkB;QACzB,WAAW,EAAE,8DAA8D;KAC3E;IACD,OAAO,EAAE;QACR,KAAK,EAAE,SAAS;QAChB,WAAW,EAAE,gEAAgE;KAC7E;CACD,CAAC;AAEF,MAAM,0BAA0B,GAAgE;IAC/F,CAAC,mBAAmB,CAAC,EAAE;QACtB,KAAK,EAAE,sBAAsB;QAC7B,WAAW,EAAE,gEAAgE;KAC7E;IACD,CAAC,wBAAwB,CAAC,EAAE;QAC3B,KAAK,EAAE,oBAAoB;QAC3B,WAAW,EAAE,2DAA2D;KACxE;CACD,CAAC;AAEF,MAAM,UAAU,mBAAmB,CAAC,EAAU;IAC7C,MAAM,IAAI,GAAG,iBAAiB,CAAC,EAAE,CAAC,CAAC;IACnC,IAAI,IAAI,EAAE,CAAC;QACV,OAAO;YACN,EAAE;YACF,IAAI,EAAE,MAAM;YACZ,GAAG,IAAI;SACP,CAAC;IACH,CAAC;IACD,MAAM,IAAI,GAAG,0BAA0B,CAAC,EAAE,CAAC,CAAC;IAC5C,IAAI,IAAI,EAAE,CAAC;QACV,OAAO;YACN,EAAE;YACF,IAAI,EAAE,eAAe;YACrB,GAAG,IAAI;SACP,CAAC;IACH,CAAC;IACD,OAAO;QACN,EAAE;QACF,KAAK,EAAE,EAAE;QACT,IAAI,EAAE,MAAM;KACZ,CAAC;AACH,CAAC"}
|
|
@@ -142,4 +142,4 @@ import{r as al,a as h,R as Ne,j as a,b as Ms,g as ll,c as cl,d as ul}from"./inde
|
|
|
142
142
|
`)},ls=function(){var e=parseInt(document.body.getAttribute(bt)||"0",10);return isFinite(e)?e:0},Gg=function(){h.useEffect(function(){return document.body.setAttribute(bt,(ls()+1).toString()),function(){var e=ls()-1;e<=0?document.body.removeAttribute(bt):document.body.setAttribute(bt,e.toString())}},[])},Bg=function(e){var t=e.noRelative,n=e.noImportant,o=e.gapMode,r=o===void 0?"margin":o;Gg();var s=h.useMemo(function(){return Vg(r)},[r]);return h.createElement(zg,{styles:Hg(s,!t,r,n?"":"!important")})},Fo=!1;if(typeof window<"u")try{var rn=Object.defineProperty({},"passive",{get:function(){return Fo=!0,!0}});window.addEventListener("test",rn,rn),window.removeEventListener("test",rn,rn)}catch{Fo=!1}var xt=Fo?{passive:!1}:!1,Ug=function(e){return e.tagName==="TEXTAREA"},da=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!Ug(e)&&n[t]==="visible")},Wg=function(e){return da(e,"overflowY")},Kg=function(e){return da(e,"overflowX")},cs=function(e,t){var n=t.ownerDocument,o=t;do{typeof ShadowRoot<"u"&&o instanceof ShadowRoot&&(o=o.host);var r=fa(e,o);if(r){var s=ga(e,o),i=s[1],l=s[2];if(i>l)return!0}o=o.parentNode}while(o&&o!==n.body);return!1},qg=function(e){var t=e.scrollTop,n=e.scrollHeight,o=e.clientHeight;return[t,n,o]},Xg=function(e){var t=e.scrollLeft,n=e.scrollWidth,o=e.clientWidth;return[t,n,o]},fa=function(e,t){return e==="v"?Wg(t):Kg(t)},ga=function(e,t){return e==="v"?qg(t):Xg(t)},Yg=function(e,t){return e==="h"&&t==="rtl"?-1:1},Jg=function(e,t,n,o,r){var s=Yg(e,window.getComputedStyle(t).direction),i=s*o,l=n.target,c=t.contains(l),d=!1,f=i>0,g=0,m=0;do{if(!l)break;var u=ga(e,l),v=u[0],p=u[1],w=u[2],x=p-w-s*v;(v||x)&&fa(e,l)&&(g+=x,m+=v);var y=l.parentNode;l=y&&y.nodeType===Node.DOCUMENT_FRAGMENT_NODE?y.host:y}while(!c&&l!==document.body||c&&(t.contains(l)||t===l));return(f&&Math.abs(g)<1||!f&&Math.abs(m)<1)&&(d=!0),d},sn=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},us=function(e){return[e.deltaX,e.deltaY]},ds=function(e){return e&&"current"in e?e.current:e},Zg=function(e,t){return e[0]===t[0]&&e[1]===t[1]},Qg=function(e){return`
|
|
143
143
|
.block-interactivity-`.concat(e,` {pointer-events: none;}
|
|
144
144
|
.allow-interactivity-`).concat(e,` {pointer-events: all;}
|
|
145
|
-
`)},em=0,wt=[];function tm(e){var t=h.useRef([]),n=h.useRef([0,0]),o=h.useRef(),r=h.useState(em++)[0],s=h.useState(ua)[0],i=h.useRef(e);h.useEffect(function(){i.current=e},[e]),h.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(r));var p=Sg([e.lockRef.current],(e.shards||[]).map(ds),!0).filter(Boolean);return p.forEach(function(w){return w.classList.add("allow-interactivity-".concat(r))}),function(){document.body.classList.remove("block-interactivity-".concat(r)),p.forEach(function(w){return w.classList.remove("allow-interactivity-".concat(r))})}}},[e.inert,e.lockRef.current,e.shards]);var l=h.useCallback(function(p,w){if("touches"in p&&p.touches.length===2||p.type==="wheel"&&p.ctrlKey)return!i.current.allowPinchZoom;var x=sn(p),y=n.current,C="deltaX"in p?p.deltaX:y[0]-x[0],S="deltaY"in p?p.deltaY:y[1]-x[1],R,N=p.target,E=Math.abs(C)>Math.abs(S)?"h":"v";if("touches"in p&&E==="h"&&N.type==="range")return!1;var b=cs(E,N);if(!b)return!0;if(b?R=E:(R=E==="v"?"h":"v",b=cs(E,N)),!b)return!1;if(!o.current&&"changedTouches"in p&&(C||S)&&(o.current=R),!R)return!0;var F=o.current||R;return Jg(F,w,p,F==="h"?C:S)},[]),c=h.useCallback(function(p){var w=p;if(!(!wt.length||wt[wt.length-1]!==s)){var x="deltaY"in w?us(w):sn(w),y=t.current.filter(function(R){return R.name===w.type&&(R.target===w.target||w.target===R.shadowParent)&&Zg(R.delta,x)})[0];if(y&&y.should){w.cancelable&&w.preventDefault();return}if(!y){var C=(i.current.shards||[]).map(ds).filter(Boolean).filter(function(R){return R.contains(w.target)}),S=C.length>0?l(w,C[0]):!i.current.noIsolation;S&&w.cancelable&&w.preventDefault()}}},[]),d=h.useCallback(function(p,w,x,y){var C={name:p,delta:w,target:x,should:y,shadowParent:nm(x)};t.current.push(C),setTimeout(function(){t.current=t.current.filter(function(S){return S!==C})},1)},[]),f=h.useCallback(function(p){n.current=sn(p),o.current=void 0},[]),g=h.useCallback(function(p){d(p.type,us(p),p.target,l(p,e.lockRef.current))},[]),m=h.useCallback(function(p){d(p.type,sn(p),p.target,l(p,e.lockRef.current))},[]);h.useEffect(function(){return wt.push(s),e.setCallbacks({onScrollCapture:g,onWheelCapture:g,onTouchMoveCapture:m}),document.addEventListener("wheel",c,xt),document.addEventListener("touchmove",c,xt),document.addEventListener("touchstart",f,xt),function(){wt=wt.filter(function(p){return p!==s}),document.removeEventListener("wheel",c,xt),document.removeEventListener("touchmove",c,xt),document.removeEventListener("touchstart",f,xt)}},[]);var u=e.removeScrollBar,v=e.inert;return h.createElement(h.Fragment,null,v?h.createElement(s,{styles:Qg(r)}):null,u?h.createElement(Bg,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function nm(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const om=Pg(ca,tm);var ma=h.forwardRef(function(e,t){return h.createElement(An,Ae({},e,{ref:t,sideCar:om}))});ma.classNames=An.classNames;var ko=["Enter"," "],rm=["ArrowDown","PageUp","Home"],pa=["ArrowUp","PageDown","End"],sm=[...rm,...pa],im={ltr:[...ko,"ArrowRight"],rtl:[...ko,"ArrowLeft"]},am={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Ut="Menu",[Lt,lm,cm]=Ri(Ut),[mt,ha]=ft(Ut,[cm,Gi,jn]),Pn=Gi(),va=jn(),[um,pt]=mt(Ut),[dm,Wt]=mt(Ut),xa=e=>{const{__scopeMenu:t,open:n=!1,children:o,dir:r,onOpenChange:s,modal:i=!0}=e,l=Pn(t),[c,d]=h.useState(null),f=h.useRef(!1),g=We(s),m=er(r);return h.useEffect(()=>{const u=()=>{f.current=!0,document.addEventListener("pointerdown",v,{capture:!0,once:!0}),document.addEventListener("pointermove",v,{capture:!0,once:!0})},v=()=>f.current=!1;return document.addEventListener("keydown",u,{capture:!0}),()=>{document.removeEventListener("keydown",u,{capture:!0}),document.removeEventListener("pointerdown",v,{capture:!0}),document.removeEventListener("pointermove",v,{capture:!0})}},[]),a.jsx(og,{...l,children:a.jsx(um,{scope:t,open:n,onOpenChange:g,content:c,onContentChange:d,children:a.jsx(dm,{scope:t,onClose:h.useCallback(()=>g(!1),[g]),isUsingKeyboardRef:f,dir:m,modal:i,children:o})})})};xa.displayName=Ut;var fm="MenuAnchor",cr=h.forwardRef((e,t)=>{const{__scopeMenu:n,...o}=e,r=Pn(n);return a.jsx(rg,{...r,...o,ref:t})});cr.displayName=fm;var ur="MenuPortal",[gm,wa]=mt(ur,{forceMount:void 0}),ya=e=>{const{__scopeMenu:t,forceMount:n,children:o,container:r}=e,s=pt(ur,t);return a.jsx(gm,{scope:t,forceMount:n,children:a.jsx(gt,{present:n||s.open,children:a.jsx(Zi,{asChild:!0,container:r,children:o})})})};ya.displayName=ur;var Se="MenuContent",[mm,dr]=mt(Se),Ca=h.forwardRef((e,t)=>{const n=wa(Se,e.__scopeMenu),{forceMount:o=n.forceMount,...r}=e,s=pt(Se,e.__scopeMenu),i=Wt(Se,e.__scopeMenu);return a.jsx(Lt.Provider,{scope:e.__scopeMenu,children:a.jsx(gt,{present:o||s.open,children:a.jsx(Lt.Slot,{scope:e.__scopeMenu,children:i.modal?a.jsx(pm,{...r,ref:t}):a.jsx(hm,{...r,ref:t})})})})}),pm=h.forwardRef((e,t)=>{const n=pt(Se,e.__scopeMenu),o=h.useRef(null),r=me(t,o);return h.useEffect(()=>{const s=o.current;if(s)return Cg(s)},[]),a.jsx(fr,{...e,ref:r,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:z(e.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),hm=h.forwardRef((e,t)=>{const n=pt(Se,e.__scopeMenu);return a.jsx(fr,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),vm=Dt("MenuContent.ScrollLock"),fr=h.forwardRef((e,t)=>{const{__scopeMenu:n,loop:o=!1,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:i,disableOutsidePointerEvents:l,onEntryFocus:c,onEscapeKeyDown:d,onPointerDownOutside:f,onFocusOutside:g,onInteractOutside:m,onDismiss:u,disableOutsideScroll:v,...p}=e,w=pt(Se,n),x=Wt(Se,n),y=Pn(n),C=va(n),S=lm(n),[R,N]=h.useState(null),E=h.useRef(null),b=me(t,E,w.onContentChange),F=h.useRef(0),k=h.useRef(""),G=h.useRef(0),q=h.useRef(null),H=h.useRef("right"),D=h.useRef(0),Y=v?ma:h.Fragment,L=v?{as:vm,allowPinchZoom:!0}:void 0,U=M=>{var W,Me;const $=k.current+M,O=S().filter(ie=>!ie.disabled),B=document.activeElement,J=(W=O.find(ie=>ie.ref.current===B))==null?void 0:W.textValue,ee=O.map(ie=>ie.textValue),ce=jm(ee,$,J),ue=(Me=O.find(ie=>ie.textValue===ce))==null?void 0:Me.ref.current;(function ie(de){k.current=de,window.clearTimeout(F.current),de!==""&&(F.current=window.setTimeout(()=>ie(""),1e3))})($),ue&&setTimeout(()=>ue.focus())};h.useEffect(()=>()=>window.clearTimeout(F.current),[]),Nd();const _=h.useCallback(M=>{var O,B;return H.current===((O=q.current)==null?void 0:O.side)&&Pm(M,(B=q.current)==null?void 0:B.area)},[]);return a.jsx(mm,{scope:n,searchRef:k,onItemEnter:h.useCallback(M=>{_(M)&&M.preventDefault()},[_]),onItemLeave:h.useCallback(M=>{var $;_(M)||(($=E.current)==null||$.focus(),N(null))},[_]),onTriggerLeave:h.useCallback(M=>{_(M)&&M.preventDefault()},[_]),pointerGraceTimerRef:G,onPointerGraceIntentChange:h.useCallback(M=>{q.current=M},[]),children:a.jsx(Y,{...L,children:a.jsx(Ni,{asChild:!0,trapped:r,onMountAutoFocus:z(s,M=>{var $;M.preventDefault(),($=E.current)==null||$.focus({preventScroll:!0})}),onUnmountAutoFocus:i,children:a.jsx(Ei,{asChild:!0,disableOutsidePointerEvents:l,onEscapeKeyDown:d,onPointerDownOutside:f,onFocusOutside:g,onInteractOutside:m,onDismiss:u,children:a.jsx(ra,{asChild:!0,...C,dir:x.dir,orientation:"vertical",loop:o,currentTabStopId:R,onCurrentTabStopIdChange:N,onEntryFocus:z(c,M=>{x.isUsingKeyboardRef.current||M.preventDefault()}),preventScrollOnEntryFocus:!0,children:a.jsx(sg,{role:"menu","aria-orientation":"vertical","data-state":Oa(w.open),"data-radix-menu-content":"",dir:x.dir,...y,...p,ref:b,style:{outline:"none",...p.style},onKeyDown:z(p.onKeyDown,M=>{const O=M.target.closest("[data-radix-menu-content]")===M.currentTarget,B=M.ctrlKey||M.altKey||M.metaKey,J=M.key.length===1;O&&(M.key==="Tab"&&M.preventDefault(),!B&&J&&U(M.key));const ee=E.current;if(M.target!==ee||!sm.includes(M.key))return;M.preventDefault();const ue=S().filter(W=>!W.disabled).map(W=>W.ref.current);pa.includes(M.key)&&ue.reverse(),Mm(ue)}),onBlur:z(e.onBlur,M=>{M.currentTarget.contains(M.target)||(window.clearTimeout(F.current),k.current="")}),onPointerMove:z(e.onPointerMove,Vt(M=>{const $=M.target,O=D.current!==M.clientX;if(M.currentTarget.contains($)&&O){const B=M.clientX>D.current?"right":"left";H.current=B,D.current=M.clientX}}))})})})})})})});Ca.displayName=Se;var xm="MenuGroup",gr=h.forwardRef((e,t)=>{const{__scopeMenu:n,...o}=e;return a.jsx(oe.div,{role:"group",...o,ref:t})});gr.displayName=xm;var wm="MenuLabel",Sa=h.forwardRef((e,t)=>{const{__scopeMenu:n,...o}=e;return a.jsx(oe.div,{...o,ref:t})});Sa.displayName=wm;var xn="MenuItem",fs="menu.itemSelect",In=h.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:o,...r}=e,s=h.useRef(null),i=Wt(xn,e.__scopeMenu),l=dr(xn,e.__scopeMenu),c=me(t,s),d=h.useRef(!1),f=()=>{const g=s.current;if(!n&&g){const m=new CustomEvent(fs,{bubbles:!0,cancelable:!0});g.addEventListener(fs,u=>o==null?void 0:o(u),{once:!0}),Ys(g,m),m.defaultPrevented?d.current=!1:i.onClose()}};return a.jsx(ba,{...r,ref:c,disabled:n,onClick:z(e.onClick,f),onPointerDown:g=>{var m;(m=e.onPointerDown)==null||m.call(e,g),d.current=!0},onPointerUp:z(e.onPointerUp,g=>{var m;d.current||(m=g.currentTarget)==null||m.click()}),onKeyDown:z(e.onKeyDown,g=>{const m=l.searchRef.current!=="";n||m&&g.key===" "||ko.includes(g.key)&&(g.currentTarget.click(),g.preventDefault())})})});In.displayName=xn;var ba=h.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:o=!1,textValue:r,...s}=e,i=dr(xn,n),l=va(n),c=h.useRef(null),d=me(t,c),[f,g]=h.useState(!1),[m,u]=h.useState("");return h.useEffect(()=>{const v=c.current;v&&u((v.textContent??"").trim())},[s.children]),a.jsx(Lt.ItemSlot,{scope:n,disabled:o,textValue:r??m,children:a.jsx(sa,{asChild:!0,...l,focusable:!o,children:a.jsx(oe.div,{role:"menuitem","data-highlighted":f?"":void 0,"aria-disabled":o||void 0,"data-disabled":o?"":void 0,...s,ref:d,onPointerMove:z(e.onPointerMove,Vt(v=>{o?i.onItemLeave(v):(i.onItemEnter(v),v.defaultPrevented||v.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:z(e.onPointerLeave,Vt(v=>i.onItemLeave(v))),onFocus:z(e.onFocus,()=>g(!0)),onBlur:z(e.onBlur,()=>g(!1))})})})}),ym="MenuCheckboxItem",Ra=h.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:o,...r}=e;return a.jsx(ja,{scope:e.__scopeMenu,checked:n,children:a.jsx(In,{role:"menuitemcheckbox","aria-checked":wn(n)?"mixed":n,...r,ref:t,"data-state":pr(n),onSelect:z(r.onSelect,()=>o==null?void 0:o(wn(n)?!0:!n),{checkForDefaultPrevented:!1})})})});Ra.displayName=ym;var _a="MenuRadioGroup",[Cm,Sm]=mt(_a,{value:void 0,onValueChange:()=>{}}),Ea=h.forwardRef((e,t)=>{const{value:n,onValueChange:o,...r}=e,s=We(o);return a.jsx(Cm,{scope:e.__scopeMenu,value:n,onValueChange:s,children:a.jsx(gr,{...r,ref:t})})});Ea.displayName=_a;var Ma="MenuRadioItem",Na=h.forwardRef((e,t)=>{const{value:n,...o}=e,r=Sm(Ma,e.__scopeMenu),s=n===r.value;return a.jsx(ja,{scope:e.__scopeMenu,checked:s,children:a.jsx(In,{role:"menuitemradio","aria-checked":s,...o,ref:t,"data-state":pr(s),onSelect:z(o.onSelect,()=>{var i;return(i=r.onValueChange)==null?void 0:i.call(r,n)},{checkForDefaultPrevented:!1})})})});Na.displayName=Ma;var mr="MenuItemIndicator",[ja,bm]=mt(mr,{checked:!1}),Aa=h.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:o,...r}=e,s=bm(mr,n);return a.jsx(gt,{present:o||wn(s.checked)||s.checked===!0,children:a.jsx(oe.span,{...r,ref:t,"data-state":pr(s.checked)})})});Aa.displayName=mr;var Rm="MenuSeparator",Pa=h.forwardRef((e,t)=>{const{__scopeMenu:n,...o}=e;return a.jsx(oe.div,{role:"separator","aria-orientation":"horizontal",...o,ref:t})});Pa.displayName=Rm;var _m="MenuArrow",Ia=h.forwardRef((e,t)=>{const{__scopeMenu:n,...o}=e,r=Pn(n);return a.jsx(ig,{...r,...o,ref:t})});Ia.displayName=_m;var Em="MenuSub",[dh,Ta]=mt(Em),Pt="MenuSubTrigger",Fa=h.forwardRef((e,t)=>{const n=pt(Pt,e.__scopeMenu),o=Wt(Pt,e.__scopeMenu),r=Ta(Pt,e.__scopeMenu),s=dr(Pt,e.__scopeMenu),i=h.useRef(null),{pointerGraceTimerRef:l,onPointerGraceIntentChange:c}=s,d={__scopeMenu:e.__scopeMenu},f=h.useCallback(()=>{i.current&&window.clearTimeout(i.current),i.current=null},[]);return h.useEffect(()=>f,[f]),h.useEffect(()=>{const g=l.current;return()=>{window.clearTimeout(g),c(null)}},[l,c]),a.jsx(cr,{asChild:!0,...d,children:a.jsx(ba,{id:r.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":r.contentId,"data-state":Oa(n.open),...e,ref:Cn(t,r.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:z(e.onPointerMove,Vt(g=>{s.onItemEnter(g),!g.defaultPrevented&&!e.disabled&&!n.open&&!i.current&&(s.onPointerGraceIntentChange(null),i.current=window.setTimeout(()=>{n.onOpenChange(!0),f()},100))})),onPointerLeave:z(e.onPointerLeave,Vt(g=>{var u,v;f();const m=(u=n.content)==null?void 0:u.getBoundingClientRect();if(m){const p=(v=n.content)==null?void 0:v.dataset.side,w=p==="right",x=w?-5:5,y=m[w?"left":"right"],C=m[w?"right":"left"];s.onPointerGraceIntentChange({area:[{x:g.clientX+x,y:g.clientY},{x:y,y:m.top},{x:C,y:m.top},{x:C,y:m.bottom},{x:y,y:m.bottom}],side:p}),window.clearTimeout(l.current),l.current=window.setTimeout(()=>s.onPointerGraceIntentChange(null),300)}else{if(s.onTriggerLeave(g),g.defaultPrevented)return;s.onPointerGraceIntentChange(null)}})),onKeyDown:z(e.onKeyDown,g=>{var u;const m=s.searchRef.current!=="";e.disabled||m&&g.key===" "||im[o.dir].includes(g.key)&&(n.onOpenChange(!0),(u=n.content)==null||u.focus(),g.preventDefault())})})})});Fa.displayName=Pt;var ka="MenuSubContent",Da=h.forwardRef((e,t)=>{const n=wa(Se,e.__scopeMenu),{forceMount:o=n.forceMount,...r}=e,s=pt(Se,e.__scopeMenu),i=Wt(Se,e.__scopeMenu),l=Ta(ka,e.__scopeMenu),c=h.useRef(null),d=me(t,c);return a.jsx(Lt.Provider,{scope:e.__scopeMenu,children:a.jsx(gt,{present:o||s.open,children:a.jsx(Lt.Slot,{scope:e.__scopeMenu,children:a.jsx(fr,{id:l.contentId,"aria-labelledby":l.triggerId,...r,ref:d,align:"start",side:i.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:f=>{var g;i.isUsingKeyboardRef.current&&((g=c.current)==null||g.focus()),f.preventDefault()},onCloseAutoFocus:f=>f.preventDefault(),onFocusOutside:z(e.onFocusOutside,f=>{f.target!==l.trigger&&s.onOpenChange(!1)}),onEscapeKeyDown:z(e.onEscapeKeyDown,f=>{i.onClose(),f.preventDefault()}),onKeyDown:z(e.onKeyDown,f=>{var u;const g=f.currentTarget.contains(f.target),m=am[i.dir].includes(f.key);g&&m&&(s.onOpenChange(!1),(u=l.trigger)==null||u.focus(),f.preventDefault())})})})})})});Da.displayName=ka;function Oa(e){return e?"open":"closed"}function wn(e){return e==="indeterminate"}function pr(e){return wn(e)?"indeterminate":e?"checked":"unchecked"}function Mm(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function Nm(e,t){return e.map((n,o)=>e[(t+o)%e.length])}function jm(e,t,n){const r=t.length>1&&Array.from(t).every(d=>d===t[0])?t[0]:t,s=n?e.indexOf(n):-1;let i=Nm(e,Math.max(s,0));r.length===1&&(i=i.filter(d=>d!==n));const c=i.find(d=>d.toLowerCase().startsWith(r.toLowerCase()));return c!==n?c:void 0}function Am(e,t){const{x:n,y:o}=e;let r=!1;for(let s=0,i=t.length-1;s<t.length;i=s++){const l=t[s],c=t[i],d=l.x,f=l.y,g=c.x,m=c.y;f>o!=m>o&&n<(g-d)*(o-f)/(m-f)+d&&(r=!r)}return r}function Pm(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return Am(n,t)}function Vt(e){return t=>t.pointerType==="mouse"?e(t):void 0}var Im=xa,Tm=cr,Fm=ya,km=Ca,Dm=gr,Om=Sa,$m=In,Lm=Ra,Vm=Ea,zm=Na,Hm=Aa,Gm=Pa,Bm=Ia,Um=Fa,Wm=Da,Tn="DropdownMenu",[Km]=ft(Tn,[ha]),he=ha(),[qm,$a]=Km(Tn),La=e=>{const{__scopeDropdownMenu:t,children:n,dir:o,open:r,defaultOpen:s,onOpenChange:i,modal:l=!0}=e,c=he(t),d=h.useRef(null),[f,g]=Sn({prop:r,defaultProp:s??!1,onChange:i,caller:Tn});return a.jsx(qm,{scope:t,triggerId:gn(),triggerRef:d,contentId:gn(),open:f,onOpenChange:g,onOpenToggle:h.useCallback(()=>g(m=>!m),[g]),modal:l,children:a.jsx(Im,{...c,open:f,onOpenChange:g,dir:o,modal:l,children:n})})};La.displayName=Tn;var Va="DropdownMenuTrigger",za=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:o=!1,...r}=e,s=$a(Va,n),i=he(n);return a.jsx(Tm,{asChild:!0,...i,children:a.jsx(oe.button,{type:"button",id:s.triggerId,"aria-haspopup":"menu","aria-expanded":s.open,"aria-controls":s.open?s.contentId:void 0,"data-state":s.open?"open":"closed","data-disabled":o?"":void 0,disabled:o,...r,ref:Cn(t,s.triggerRef),onPointerDown:z(e.onPointerDown,l=>{!o&&l.button===0&&l.ctrlKey===!1&&(s.onOpenToggle(),s.open||l.preventDefault())}),onKeyDown:z(e.onKeyDown,l=>{o||(["Enter"," "].includes(l.key)&&s.onOpenToggle(),l.key==="ArrowDown"&&s.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(l.key)&&l.preventDefault())})})})});za.displayName=Va;var Xm="DropdownMenuPortal",Ha=e=>{const{__scopeDropdownMenu:t,...n}=e,o=he(t);return a.jsx(Fm,{...o,...n})};Ha.displayName=Xm;var Ga="DropdownMenuContent",Ba=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=$a(Ga,n),s=he(n),i=h.useRef(!1);return a.jsx(km,{id:r.contentId,"aria-labelledby":r.triggerId,...s,...o,ref:t,onCloseAutoFocus:z(e.onCloseAutoFocus,l=>{var c;i.current||(c=r.triggerRef.current)==null||c.focus(),i.current=!1,l.preventDefault()}),onInteractOutside:z(e.onInteractOutside,l=>{const c=l.detail.originalEvent,d=c.button===0&&c.ctrlKey===!0,f=c.button===2||d;(!r.modal||f)&&(i.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});Ba.displayName=Ga;var Ym="DropdownMenuGroup",Jm=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=he(n);return a.jsx(Dm,{...r,...o,ref:t})});Jm.displayName=Ym;var Zm="DropdownMenuLabel",Qm=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=he(n);return a.jsx(Om,{...r,...o,ref:t})});Qm.displayName=Zm;var ep="DropdownMenuItem",tp=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=he(n);return a.jsx($m,{...r,...o,ref:t})});tp.displayName=ep;var np="DropdownMenuCheckboxItem",Ua=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=he(n);return a.jsx(Lm,{...r,...o,ref:t})});Ua.displayName=np;var op="DropdownMenuRadioGroup",rp=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=he(n);return a.jsx(Vm,{...r,...o,ref:t})});rp.displayName=op;var sp="DropdownMenuRadioItem",ip=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=he(n);return a.jsx(zm,{...r,...o,ref:t})});ip.displayName=sp;var ap="DropdownMenuItemIndicator",Wa=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=he(n);return a.jsx(Hm,{...r,...o,ref:t})});Wa.displayName=ap;var lp="DropdownMenuSeparator",cp=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=he(n);return a.jsx(Gm,{...r,...o,ref:t})});cp.displayName=lp;var up="DropdownMenuArrow",dp=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=he(n);return a.jsx(Bm,{...r,...o,ref:t})});dp.displayName=up;var fp="DropdownMenuSubTrigger",gp=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=he(n);return a.jsx(Um,{...r,...o,ref:t})});gp.displayName=fp;var mp="DropdownMenuSubContent",pp=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=he(n);return a.jsx(Wm,{...r,...o,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)"}})});pp.displayName=mp;var hp=La,vp=za,xp=Ha,wp=Ba,yp=Ua,Cp=Wa;function Sp({...e}){return a.jsx(hp,{"data-slot":"dropdown-menu",...e})}function bp({...e}){return a.jsx(vp,{"data-slot":"dropdown-menu-trigger",...e})}function Rp({className:e,sideOffset:t=4,...n}){return a.jsx(xp,{children:a.jsx(wp,{"data-slot":"dropdown-menu-content",sideOffset:t,className:ne("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 _p({className:e,children:t,checked:n,...o}){return a.jsxs(yp,{"data-slot":"dropdown-menu-checkbox-item",className:ne("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,...o,children:[a.jsx("span",{className:"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center",children:a.jsx(Cp,{children:a.jsx(ai,{className:"size-4"})})}),t]})}function hr({className:e,...t}){return a.jsx("div",{"data-slot":"table-container",className:"relative w-full overflow-x-auto",children:a.jsx("table",{"data-slot":"table",className:ne("w-full caption-bottom text-sm",e),...t})})}function Ep({className:e,...t}){return a.jsx("thead",{"data-slot":"table-header",className:ne("[&_tr]:border-b",e),...t})}function vr({className:e,...t}){return a.jsx("tbody",{"data-slot":"table-body",className:ne("[&_tr:last-child]:border-0",e),...t})}function le({className:e,...t}){return a.jsx("tr",{"data-slot":"table-row",className:ne("hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",e),...t})}function Mp({className:e,...t}){return a.jsx("th",{"data-slot":"table-head",className:ne("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 P({className:e,...t}){return a.jsx("td",{"data-slot":"table-cell",className:ne("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",e),...t})}function zt({columns:e,data:t,searchColumn:n,searchPlaceholder:o="Filter...",defaultColumnVisibility:r={},pageSize:s=25,defaultSorting:i=[]}){var w,x;const[l,c]=h.useState(i),[d,f]=h.useState([]),[g,m]=h.useState(r),[u,v]=h.useState({}),p=vd({data:t,columns:e,onSortingChange:c,onColumnFiltersChange:f,getCoreRowModel:id(),getPaginationRowModel:fd(),getSortedRowModel:gd(),getFilteredRowModel:dd(),onColumnVisibilityChange:m,onRowSelectionChange:v,initialState:{pagination:{pageSize:s}},state:{sorting:l,columnFilters:d,columnVisibility:g,rowSelection:u}});return a.jsxs("div",{className:"w-full",children:[a.jsxs("div",{className:"flex items-center py-4",children:[n&&a.jsx(bo,{placeholder:o,value:((w=p.getColumn(n))==null?void 0:w.getFilterValue())??"",onChange:y=>{var C;return(C=p.getColumn(n))==null?void 0:C.setFilterValue(y.target.value)},className:"max-w-sm"}),a.jsxs(Sp,{children:[a.jsx(bp,{asChild:!0,children:a.jsxs(ct,{variant:"outline",className:"ml-auto",children:["Columns ",a.jsx(li,{className:"ml-2 h-4 w-4"})]})}),a.jsx(Rp,{align:"end",children:p.getAllColumns().filter(y=>y.getCanHide()).map(y=>a.jsx(_p,{className:"capitalize",checked:y.getIsVisible(),onCheckedChange:C=>y.toggleVisibility(!!C),children:y.id},y.id))})]})]}),a.jsx("div",{className:"rounded-md border",children:a.jsxs(hr,{children:[a.jsx(Ep,{children:p.getHeaderGroups().map(y=>a.jsx(le,{children:y.headers.map(C=>a.jsx(Mp,{children:C.isPlaceholder?null:Hr(C.column.columnDef.header,C.getContext())},C.id))},y.id))}),a.jsx(vr,{children:(x=p.getRowModel().rows)!=null&&x.length?p.getRowModel().rows.map(y=>a.jsx(le,{"data-state":y.getIsSelected()&&"selected",children:y.getVisibleCells().map(C=>a.jsx(P,{children:Hr(C.column.columnDef.cell,C.getContext())},C.id))},y.id)):a.jsx(le,{children:a.jsx(P,{colSpan:e.length,className:"h-24 text-center",children:"No results."})})})]})}),a.jsxs("div",{className:"flex items-center justify-end space-x-2 py-4",children:[a.jsxs("div",{className:"text-muted-foreground flex-1 text-sm",children:[p.getFilteredRowModel().rows.length," row(s) total."]}),a.jsxs("div",{className:"space-x-2",children:[a.jsx(ct,{variant:"outline",size:"sm",onClick:()=>p.previousPage(),disabled:!p.getCanPreviousPage(),children:"Previous"}),a.jsx(ct,{variant:"outline",size:"sm",onClick:()=>p.nextPage(),disabled:!p.getCanNextPage(),children:"Next"})]})]})]})}function X(e,t="left"){return({column:n})=>{const o=t==="right"?"justify-end":t==="center"?"justify-center":"justify-start",r=n.getIsSorted();return a.jsx("div",{className:`flex ${o}`,children:a.jsxs(ct,{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,r==="asc"&&a.jsx(Yc,{className:"ml-1 h-3 w-3 text-muted-foreground"}),r==="desc"&&a.jsx(li,{className:"ml-1 h-3 w-3 text-muted-foreground"})]})})}}const Np=300*1e3;function Ka(e){const[t,n]=h.useState(new Map),o=h.useRef();return h.useEffect(()=>{const s=new Date().toISOString(),i=new Set(e.map(l=>l.id));n(l=>{const c=new Map(l);return e.forEach(d=>{c.set(d.id,{...d,lastSeenAt:s,disconnectedAt:void 0})}),c.forEach((d,f)=>{!i.has(f)&&!d.disconnectedAt&&c.set(f,{...d,isConnected:!1,connectionStatus:"Disconnected",disconnectedAt:s,lastActivity:d.lastActivity||s})}),c})},[e]),h.useEffect(()=>{const s=()=>{const i=Date.now();n(l=>{const c=new Map(l);return c.forEach((d,f)=>{if(d.disconnectedAt){const g=new Date(d.disconnectedAt).getTime();i-g>Np&&c.delete(f)}}),c})};return s(),o.current=setInterval(s,3e4),()=>{o.current&&clearInterval(o.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 gs(e){const t=new Date,n=new Date(e),o=t.getTime()-n.getTime(),r=Math.floor(o/1e3);if(r<60)return"just now";const s=Math.floor(r/60);if(s<60)return`${s}m ago`;const i=Math.floor(s/60);return i<24?`${i}h ago`:`${Math.floor(i/24)}d ago`}function jp(e){const t=Math.floor(e/86400),n=Math.floor(e%86400/3600),o=Math.floor(e%3600/60);return t>0?`${t}d ${n}h ${o}m`:n>0?`${n}h ${o}m`:`${o}m`}function Ap(e){return e.length<=12?e:`${e.slice(0,5)}...${e.slice(-5)}`}function Pp(e){return e.length<=42?e:`${e.slice(0,35)}.....${e.slice(-5)}`}function Ip({metrics:e}){const t=e.sessions||[],n=Ka(t),o=()=>[{accessorKey:"clientInfo",header:X("Client"),cell:({row:r})=>{const s=r.original,i=s.clientInfo?`${Pp(s.clientInfo.name)}@${s.clientInfo.version}`:"unknown";return a.jsx("div",{className:"font-mono text-sm",title:s.clientInfo?`${s.clientInfo.name}@${s.clientInfo.version}`:"unknown",children:i})}},{accessorKey:"id",header:X("Session ID"),cell:({row:r})=>a.jsx("div",{className:"font-mono text-sm",title:r.getValue("id"),children:Ap(r.getValue("id"))})},{accessorKey:"isConnected",header:X("Status"),cell:({row:r})=>{const s=r.original;return a.jsxs(ze,{variant:s.isConnected?"success":"secondary",className:"gap-1",children:[s.isConnected?a.jsx(fi,{className:"h-3 w-3"}):a.jsx(di,{className:"h-3 w-3"}),s.isConnected?"Connected":"Disconnected"]})}},{accessorKey:"connectedAt",header:X("Connected"),cell:({row:r})=>a.jsx("div",{className:"text-sm",children:gs(r.getValue("connectedAt"))})},{accessorKey:"requestCount",header:X("Requests","right"),cell:({row:r})=>a.jsx("div",{className:"text-right font-mono text-sm",children:r.getValue("requestCount")})},{accessorKey:"lastActivity",header:X("Last Activity"),cell:({row:r})=>a.jsx("div",{className:"text-sm",children:gs(r.getValue("lastActivity"))})}];return a.jsxs(He,{children:[a.jsxs(Ge,{children:[a.jsx(Be,{children:"📊 Transport Metrics"}),a.jsx(dt,{children:"Real-time connection and performance metrics for STDIO transport"})]}),a.jsxs(Ue,{className:"space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"Transport Type"}),a.jsx("p",{className:"text-sm font-mono",children:"STDIO"})]}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"Uptime"}),a.jsx("p",{className:"text-sm font-mono",children:jp(e.uptimeSeconds)})]})]}),a.jsxs(a.Fragment,{children:[a.jsx(nt,{}),a.jsxs("div",{children:[a.jsxs("h3",{className:"text-sm font-semibold text-foreground mb-3",children:["Sessions (",n.filter(r=>r.isConnected).length," active,"," ",n.filter(r=>!r.isConnected).length," disconnected)"]}),a.jsx(zt,{columns:o(),data:n,searchColumn:"id",searchPlaceholder:"Filter sessions...",pageSize:10,defaultSorting:[{id:"lastActivity",desc:!0}]})]})]})]})]})}function an(e){const t=new Date,n=new Date(e),o=t.getTime()-n.getTime(),r=Math.floor(o/1e3);if(r<60)return"just now";const s=Math.floor(r/60);if(s<60)return`${s}m ago`;const i=Math.floor(s/60);return i<24?`${i}h ago`:`${Math.floor(i/24)}d ago`}function Tp(e){const t=Math.floor(e/86400),n=Math.floor(e%86400/3600),o=Math.floor(e%3600/60);return t>0?`${t}d ${n}h ${o}m`:n>0?`${n}h ${o}m`:`${o}m`}function ln(e){return e<1e3?`${e}ms`:e<6e4?`${Math.round(e/1e3)}s`:`${Math.round(e/6e4)}m`}function Fp(e){return e.length<=12?e:`${e.slice(0,5)}...${e.slice(-5)}`}function ms(e){return e.length<=42?e:`${e.slice(0,35)}.....${e.slice(-5)}`}function kp(e){const t=new Date,n=new Date(e),o=t.getTime()-n.getTime();return Math.floor(o/6e4)<5}function Dp({metrics:e}){const t=e.sessions||[],n=Ka(t),o={streamableHttp:"Streamable HTTP"},r=()=>[{accessorKey:"clientInfo",header:X("Client"),cell:({row:l})=>{const c=l.original,d=c.clientInfo?`${ms(c.clientInfo.name)}@${c.clientInfo.version}`:"unknown";return a.jsx("div",{className:"font-mono text-sm",title:c.clientInfo?`${c.clientInfo.name}@${c.clientInfo.version}`:"unknown",children:d})}},{accessorKey:"id",header:X("Session ID"),cell:({row:l})=>a.jsx("div",{className:"font-mono text-sm",title:l.getValue("id"),children:Fp(l.getValue("id"))})},{accessorKey:"connectionStatus",header:X("Status"),cell:({row:l})=>{const c=l.original,d=c.connectionStatus||(c.isConnected?"Connected":"Disconnected");return d==="Connected"?a.jsxs(ze,{variant:"success",className:"gap-1",children:[a.jsx(fi,{className:"h-3 w-3"}),"Connected"]}):d==="Distressed"?a.jsxs(ze,{variant:"destructive",className:"gap-1",children:[a.jsx(ui,{className:"h-3 w-3"}),"Distressed ",c.pingFailures?`(${c.pingFailures} failed)`:""]}):a.jsxs(ze,{variant:"secondary",className:"gap-1",children:[a.jsx(di,{className:"h-3 w-3"}),"Disconnected"]})}},{accessorKey:"connectedAt",header:X("Connected"),cell:({row:l})=>a.jsx("div",{className:"text-sm",children:an(l.getValue("connectedAt"))})},{accessorKey:"requestCount",header:X("Requests","right"),cell:({row:l})=>a.jsx("div",{className:"text-right font-mono text-sm",children:l.getValue("requestCount")})},{accessorKey:"lastActivity",header:X("Last Activity"),cell:({row:l})=>a.jsx("div",{className:"text-sm",children:an(l.getValue("lastActivity"))})},{accessorKey:"ipAddress",header:X("IP Address"),cell:({row:l})=>a.jsx("div",{className:"font-mono text-sm",title:l.getValue("ipAddress")||"Unknown",children:l.getValue("ipAddress")||"-"})}],s=()=>[{accessorKey:"name",header:X("Client"),cell:({row:l})=>{const c=l.original,d=`${ms(c.name)}@${c.version}`;return a.jsxs("div",{children:[a.jsx("p",{className:"font-medium font-mono text-sm",title:`${c.name}@${c.version}`,children:d}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:["First seen ",an(c.firstSeen)]})]})}},{accessorKey:"requestCount",header:X("Initializations","right"),cell:({row:l})=>a.jsx("div",{className:"text-right font-mono text-sm",children:l.getValue("requestCount")})},{accessorKey:"toolCallCount",header:X("Tool Calls","right"),cell:({row:l})=>a.jsx("div",{className:"text-right font-mono text-sm",children:l.getValue("toolCallCount")})},{accessorKey:"newIpCount",header:X("New IPs","right"),cell:({row:l})=>a.jsx("div",{className:"text-right font-mono text-sm",children:l.getValue("newIpCount")})},{accessorKey:"anonCount",header:X("Anon/Auth","right"),cell:({row:l})=>{const c=l.original;return a.jsxs("div",{className:"text-right font-mono text-sm",children:[c.anonCount,"/",c.uniqueAuthCount]})}},{accessorKey:"isConnected",header:X("Status"),cell:({row:l})=>{const c=l.original;return a.jsx("div",{children:kp(c.lastSeen)?a.jsxs(ze,{variant:"success",className:"gap-1",children:[a.jsx(ii,{className:"h-3 w-3"}),"Recent"]}):a.jsxs(ze,{variant:"secondary",className:"gap-1",children:[a.jsx(ci,{className:"h-3 w-3"}),"Idle"]})})}},{accessorKey:"lastSeen",header:X("Last Seen","right"),cell:({row:l})=>a.jsx("div",{className:"text-right text-sm",children:an(l.getValue("lastSeen"))})}],i=e.clients;return a.jsxs(He,{children:[a.jsxs(Ge,{children:[a.jsx(Be,{children:"📊 Transport Metrics"}),a.jsxs(dt,{children:["Real-time connection and performance metrics for"," ",o[e.transport]||e.transport," transport"]})]}),a.jsxs(Ue,{className:"space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"Transport Type"}),a.jsx("p",{className:"text-sm font-mono",children:o[e.transport]||e.transport})]}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"Uptime"}),a.jsx("p",{className:"text-sm font-mono",children:Tp(e.uptimeSeconds)})]})]}),e.configuration&&a.jsx(a.Fragment,{children:a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium text-muted-foreground mb-2",children:"Configuration"}),a.jsx("div",{className:"grid grid-cols-1 gap-2",children:e.pings&&a.jsx("div",{className:"text-xs text-muted-foreground bg-muted/30 p-2 rounded",children:e.pings.sent>0&&a.jsxs("p",{children:[a.jsx("span",{className:"font-medium",children:"Ping Status:"})," ",e.pings.successful,"/",e.pings.sent," successful (",e.pings.sent>0?Math.round(e.pings.successful/e.pings.sent*100):0,"%)"]})})}),a.jsxs("p",{className:"text-xs text-muted-foreground mt-2",children:["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":""}`]})]})}),a.jsx(nt,{}),a.jsx("div",{children:a.jsx(hr,{children:a.jsxs(vr,{children:[a.jsxs(le,{children:[a.jsx(P,{className:"font-medium text-sm",children:"Active Connections"}),a.jsx(P,{className:"text-sm font-mono",children:e.connections.active}),a.jsx(P,{className:"font-medium text-sm",children:"Cleaned Sessions"}),a.jsx(P,{className:"text-sm font-mono",children:e.connections.cleaned??0})]}),a.jsxs(le,{children:[a.jsx(P,{className:"font-medium text-sm",children:"Total Connections"}),a.jsx(P,{className:"text-sm font-mono",children:e.connections.total}),a.jsx(P,{className:"font-medium text-sm",children:"Requests per Minute (tot/3hr/hr)"}),a.jsxs(P,{className:"text-sm font-mono",children:[e.requests.averagePerMinute,"/",e.requests.last3Hours,"/",e.requests.lastHour]})]}),a.jsxs(le,{children:[a.jsx(P,{className:"font-medium text-sm",children:"Unique IPs"}),a.jsx(P,{className:"text-sm font-mono",children:e.connections.uniqueIps??0}),a.jsx(P,{className:"font-medium text-sm",children:"Client/Server Errors (4xx/5xx)"}),a.jsxs(P,{className:"text-sm font-mono",children:[e.errors.expected,"/",e.errors.unexpected]})]}),e.sessionLifecycle&&a.jsxs(le,{children:[a.jsx(P,{className:"font-medium text-sm",children:"Sessions New/Res-fail/Del"}),a.jsxs(P,{className:"text-sm font-mono",colSpan:3,children:[e.sessionLifecycle.created,"/",e.sessionLifecycle.resumedFailed,"/",e.sessionLifecycle.deleted]})]}),e.pings&&a.jsxs(le,{children:[a.jsx(P,{className:"font-medium text-sm",children:"Pings Sent"}),a.jsx(P,{className:"text-sm font-mono",children:e.pings.sent}),a.jsx(P,{className:"font-medium text-sm",children:"Ping Success Rate"}),a.jsx(P,{className:"text-sm font-mono",children:e.pings.sent>0?`${Math.round(e.pings.successful/e.pings.sent*100)}%`:"-"})]}),e.apiMetrics&&a.jsxs(a.Fragment,{children:[a.jsxs(le,{children:[a.jsx(P,{className:"font-medium text-sm",children:"Anonymous Users"}),a.jsx(P,{className:"text-sm font-mono",children:e.apiMetrics.anonymous}),a.jsx(P,{className:"font-medium text-sm",children:"Authenticated Users"}),a.jsx(P,{className:"text-sm font-mono",children:e.apiMetrics.authenticated})]}),a.jsxs(le,{children:[a.jsx(P,{className:"font-medium text-sm",children:"401 Unauthorized Users"}),a.jsx(P,{className:"text-sm font-mono",children:e.apiMetrics.unauthorized}),a.jsx(P,{className:"font-medium text-sm",children:"403 Forbidden Users"}),a.jsx(P,{className:"text-sm font-mono",children:e.apiMetrics.forbidden})]})]}),a.jsxs(le,{children:[a.jsx(P,{className:"font-medium text-sm",children:"Gradio Success/Fail"}),a.jsx(P,{className:"text-sm font-mono",children:e.gradioMetrics?`${e.gradioMetrics.success}/${e.gradioMetrics.failure}`:"0/0"}),a.jsx(P,{className:"font-medium text-sm",children:"-"}),a.jsx(P,{className:"text-sm font-mono",children:"-"})]})]})})}),a.jsxs(a.Fragment,{children:[a.jsx(nt,{}),a.jsxs("div",{children:[a.jsxs("h3",{className:"text-sm font-semibold text-foreground mb-3",children:["Sessions (",n.filter(l=>l.isConnected).length," active,"," ",n.filter(l=>!l.isConnected).length," disconnected)"]}),a.jsx(zt,{columns:r(),data:n,searchColumn:"id",searchPlaceholder:"Filter sessions...",pageSize:10,defaultSorting:[{id:"lastActivity",desc:!0}]})]})]}),a.jsxs(a.Fragment,{children:[a.jsx(nt,{}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-sm font-semibold text-foreground mb-3",children:"Client Identities"}),a.jsx(zt,{columns:s(),data:i,searchColumn:"name",searchPlaceholder:"Filter clients...",pageSize:50,defaultSorting:[{id:"lastSeen",desc:!0}]})]})]})]})]})}function ps(e){const t=new Date,n=new Date(e),o=t.getTime()-n.getTime(),r=Math.floor(o/1e3);if(r<60)return"just now";const s=Math.floor(r/60);if(s<60)return`${s}m ago`;const i=Math.floor(s/60);return i<24?`${i}h ago`:`${Math.floor(i/24)}d ago`}function Op(e){const t=Math.floor(e/86400),n=Math.floor(e%86400/3600),o=Math.floor(e%3600/60);return t>0?`${t}d ${n}h ${o}m`:n>0?`${n}h ${o}m`:`${o}m`}function $p(e){const t=new Date,n=new Date(e),o=t.getTime()-n.getTime();return Math.floor(o/6e4)<5}function Lp(e){return e.length<=42?e:`${e.slice(0,35)}.....${e.slice(-5)}`}function Vp({metrics:e}){const t=e.clients,n=()=>[{accessorKey:"name",header:X("Client"),cell:({row:o})=>{const r=o.original,s=`${Lp(r.name)}@${r.version}`;return a.jsxs("div",{children:[a.jsx("p",{className:"font-medium font-mono text-sm",title:`${r.name}@${r.version}`,children:s}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:["First seen ",ps(r.firstSeen)]})]})}},{accessorKey:"requestCount",header:X("Initializations","right"),cell:({row:o})=>a.jsx("div",{className:"text-right font-mono text-sm",children:o.getValue("requestCount")})},{accessorKey:"toolCallCount",header:X("Tool Calls","right"),cell:({row:o})=>a.jsx("div",{className:"text-right font-mono text-sm",children:o.getValue("toolCallCount")})},{accessorKey:"newIpCount",header:X("New IPs","right"),cell:({row:o})=>a.jsx("div",{className:"text-right font-mono text-sm",children:o.getValue("newIpCount")})},{accessorKey:"anonCount",header:X("Anon/Auth","right"),cell:({row:o})=>{const r=o.original;return a.jsxs("div",{className:"text-right font-mono text-sm",children:[r.anonCount,"/",r.uniqueAuthCount]})}},{accessorKey:"isConnected",header:X("Status"),cell:({row:o})=>{const r=o.original;return a.jsx("div",{children:$p(r.lastSeen)?a.jsxs(ze,{variant:"success",className:"gap-1",children:[a.jsx(ii,{className:"h-3 w-3"}),"Recent"]}):a.jsxs(ze,{variant:"secondary",className:"gap-1",children:[a.jsx(ci,{className:"h-3 w-3"}),"Idle"]})})}},{accessorKey:"lastSeen",header:X("Last Seen","right"),cell:({row:o})=>a.jsx("div",{className:"text-right text-sm",children:ps(o.getValue("lastSeen"))})}];return a.jsxs(He,{children:[a.jsxs(Ge,{children:[a.jsx(Be,{children:"📊 Transport Metrics"}),a.jsx(dt,{children:"Real-time connection and performance metrics for Stateless HTTP JSON transport"})]}),a.jsxs(Ue,{className:"space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"Transport Type"}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("p",{className:"text-sm font-mono",children:"Stateless HTTP JSON"}),a.jsx(ze,{variant:"secondary",children:e.sessionLifecycle?"analytics":"stateless"})]})]}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"Uptime"}),a.jsx("p",{className:"text-sm font-mono",children:Op(e.uptimeSeconds)})]})]}),a.jsx(nt,{}),a.jsx("div",{children:a.jsx(hr,{children:a.jsxs(vr,{children:[a.jsxs(le,{children:[a.jsx(P,{className:"font-medium text-sm",children:"Request Count (MCP)"}),a.jsx(P,{className:"text-sm font-mono",children:e.connections.total}),a.jsx(P,{className:"font-medium text-sm",children:"Requests per Minute (tot/3hr/hr)"}),a.jsxs(P,{className:"text-sm font-mono",children:[e.requests.averagePerMinute,"/",e.requests.last3Hours,"/",e.requests.lastHour]})]}),a.jsxs(le,{children:[a.jsx(P,{className:"font-medium text-sm",children:"Unique IPs"}),a.jsx(P,{className:"text-sm font-mono",children:e.connections.uniqueIps??0}),a.jsx(P,{className:"font-medium text-sm",children:"Client/Server Errors (4xx/5xx)"}),a.jsxs(P,{className:"text-sm font-mono",children:[e.errors.expected,"/",e.errors.unexpected]})]}),(e.staticPageHits200!==void 0||e.staticPageHits405!==void 0)&&a.jsxs(le,{children:[a.jsx(P,{className:"font-medium text-sm",children:a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(tu,{className:"h-3 w-3"}),"hf.co/mcp (200/405)"]})}),a.jsxs(P,{className:"text-sm font-mono",children:[e.staticPageHits200||0,"/",e.staticPageHits405||0]}),a.jsx(P,{className:"font-medium text-sm",children:a.jsx("div",{className:"flex items-center gap-1",children:"Auth Status (Anon/Auth/401)"})}),a.jsxs(P,{className:"text-sm font-mono",children:[e.connections.anonymous,"/",e.connections.authenticated,"/",e.connections.unauthorized||0]})]}),e.apiMetrics&&a.jsxs(a.Fragment,{children:[a.jsxs(le,{children:[a.jsx(P,{className:"font-medium text-sm",children:"Tool API - Anonymous"}),a.jsx(P,{className:"text-sm font-mono",children:e.apiMetrics.anonymous}),a.jsx(P,{className:"font-medium text-sm",children:"Tool API - Authenticated"}),a.jsx(P,{className:"text-sm font-mono",children:e.apiMetrics.authenticated})]}),a.jsxs(le,{children:[a.jsx(P,{className:"font-medium text-sm",children:"Tool API - 401 Unauthorized"}),a.jsx(P,{className:"text-sm font-mono",children:e.apiMetrics.unauthorized}),a.jsx(P,{className:"font-medium text-sm",children:"Tool API - 403 Forbidden"}),a.jsx(P,{className:"text-sm font-mono",children:e.apiMetrics.forbidden})]})]}),a.jsxs(le,{children:[a.jsx(P,{className:"font-medium text-sm",children:"Gradio Success/Fail"}),a.jsx(P,{className:"text-sm font-mono",children:e.gradioMetrics?`${e.gradioMetrics.success}/${e.gradioMetrics.failure}`:"0/0"}),e.sessionLifecycle?a.jsxs(a.Fragment,{children:[a.jsx(P,{className:"font-medium text-sm",children:"Sessions New/Res-fail/Del"}),a.jsxs(P,{className:"text-sm font-mono",children:[e.sessionLifecycle.created,"/",e.sessionLifecycle.resumedFailed,"/",e.sessionLifecycle.deleted]})]}):a.jsxs(a.Fragment,{children:[a.jsx(P,{className:"font-medium text-sm",children:"-"}),a.jsx(P,{className:"text-sm font-mono",children:"-"})]})]})]})})}),a.jsxs(a.Fragment,{children:[a.jsx(nt,{}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-sm font-semibold text-foreground mb-3",children:"Client Identities"}),a.jsx(zt,{columns:n(),data:t,searchColumn:"name",searchPlaceholder:"Filter clients...",pageSize:50,defaultSorting:[{id:"lastSeen",desc:!0}]})]})]})]})]})}const zp=e=>fetch(e).then(t=>{if(!t.ok)throw new Error(`Failed to fetch: ${t.status}`);return t.json()});function Hp(){const{data:e,error:t}=It("/api/transport-metrics",zp,{refreshInterval:3e3,revalidateOnFocus:!0,revalidateOnReconnect:!0});return t?a.jsxs(He,{children:[a.jsx(Ge,{children:a.jsx(Be,{children:"📊 Transport Metrics"})}),a.jsx(Ue,{children:a.jsxs(gu,{variant:"destructive",children:[a.jsx(ui,{className:"h-4 w-4"}),a.jsx(mu,{children:"Error Loading Metrics"}),a.jsxs(pu,{children:["Failed to load transport metrics: ",t.message]})]})})]}):e?e.transport==="stdio"?a.jsx(Ip,{metrics:e}):e.isStateless?a.jsx(Vp,{metrics:e}):a.jsx(Dp,{metrics:e}):a.jsxs(He,{children:[a.jsx(Ge,{children:a.jsx(Be,{children:"📊 Transport Metrics"})}),a.jsx(Ue,{children:a.jsxs("div",{className:"animate-pulse space-y-2",children:[a.jsx("div",{className:"h-4 bg-gray-200 rounded w-3/4"}),a.jsx("div",{className:"h-4 bg-gray-200 rounded w-1/2"}),a.jsx("div",{className:"h-4 bg-gray-200 rounded w-2/3"})]})})]})}const Gp=e=>fetch(e).then(t=>{if(!t.ok)throw new Error(`Failed to fetch: ${t.status}`);return t.json()});function Bp(){const[e,t]=h.useState(!1),{data:n,error:o}=It("/api/transport-metrics",Gp,{refreshInterval:3e3,revalidateOnFocus:!0,revalidateOnReconnect:!0}),r=!n&&!o,s=(n==null?void 0:n.transport)==="stdio",i=((n==null?void 0:n.methods)||[]).map(u=>{let v=u.errors,p,w;if(u.method.startsWith("tools/call:")&&(n!=null&&n.gradioMetrics)){const C=u.method.replace("tools/call:",""),S=n.gradioMetrics.byTool;S[C]&&(p=S[C].success,w=S[C].failure,v+=w)}const x=u.count>0?v/u.count*100:0;return{method:u.method,count:u.count,errors:v,errorRate:x,averageResponseTime:u.averageResponseTime,lastCalled:u.lastCalled,gradioSuccess:p,gradioFailure:w}}),l=e?i.filter(u=>u.method.startsWith("tools/call")||u.method.startsWith("prompts/get")||u.method.startsWith("resources/read")):i,c=i.reduce((u,v)=>u+v.count,0),d=i.filter(u=>u.method.startsWith("tools/call")).reduce((u,v)=>u+v.count,0),f=i.filter(u=>u.method.startsWith("prompts/get")).reduce((u,v)=>u+v.count,0),g=i.filter(u=>u.method.startsWith("resources/read")).reduce((u,v)=>u+v.count,0),m=[{accessorKey:"method",header:X("Method"),cell:({row:u})=>{const v=u.getValue("method");return a.jsx("div",{className:"font-mono text-sm",children:v==="tools/call"?a.jsx("span",{className:"text-blue-600 dark:text-blue-400",children:"tools/call"}):v.startsWith("tools/call:")?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"text-blue-600 dark:text-blue-400",children:"tools/call:"}),a.jsx("span",{className:"text-green-600 dark:text-green-400",children:v.replace("tools/call:","")})]}):v==="prompts/get"?a.jsx("span",{className:"text-purple-600 dark:text-purple-400",children:"prompts/get"}):v.startsWith("prompts/get:")?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"text-purple-600 dark:text-purple-400",children:"prompts/get:"}),a.jsx("span",{className:"text-orange-600 dark:text-orange-400",children:v.replace("prompts/get:","")})]}):v==="resources/read"?a.jsx("span",{className:"text-cyan-600 dark:text-cyan-400",children:"resources/read"}):v.startsWith("resources/read:")?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"text-cyan-600 dark:text-cyan-400",children:"resources/read:"}),a.jsx("span",{className:"text-teal-600 dark:text-teal-400 break-all",children:v.replace("resources/read:","")})]}):v})}},{accessorKey:"count",header:X("Calls","right"),cell:({row:u})=>a.jsx("div",{className:"text-right font-mono",children:u.getValue("count").toLocaleString()})},{accessorKey:"errors",header:X("Errors","right"),cell:({row:u})=>{const v=u.getValue("errors");return a.jsx("div",{className:"text-right font-mono",children:v>0?a.jsx("span",{className:"text-red-600 dark:text-red-400",children:v}):"0"})}},{accessorKey:"gradioMetrics",header:X("Success/Failure","right"),cell:({row:u})=>{const v=u.original;return v.gradioSuccess!==void 0&&v.gradioFailure!==void 0?a.jsxs("div",{className:"text-right font-mono text-sm",children:[a.jsx("span",{className:"text-green-600 dark:text-green-400",children:v.gradioSuccess}),a.jsx("span",{className:"text-muted-foreground",children:"/"}),a.jsx("span",{className:"text-red-600 dark:text-red-400",children:v.gradioFailure})]}):a.jsx("div",{className:"text-right text-muted-foreground",children:"—"})}},{accessorKey:"errorRate",header:X("Error Rate","right"),cell:({row:u})=>{const v=u.getValue("errorRate");return a.jsx("div",{className:"text-right font-mono",children:v>0?a.jsxs("span",{className:"text-red-600 dark:text-red-400",children:[v.toFixed(1),"%"]}):"0%"})}},{accessorKey:"averageResponseTime",header:X("Avg Response","right"),cell:({row:u})=>{const v=u.getValue("averageResponseTime");return a.jsx("div",{className:"text-right font-mono",children:v?`${v.toFixed(0)}ms`:"—"})}},{accessorKey:"lastCalled",header:X("Last Called","right"),cell:({row:u})=>a.jsx("div",{className:"text-right text-sm text-muted-foreground",children:new Date(u.getValue("lastCalled")).toLocaleTimeString()})}];return a.jsxs(He,{children:[a.jsxs(Ge,{children:[a.jsx(Be,{children:"HTTP JSON Transport Statistics"}),a.jsxs(dt,{children:["MCP method call statistics and performance metrics",s?" (Empty in STDIO mode)":n!=null&&n.isStateless?"":" (Response times not available in stateful modes)"]})]}),a.jsxs(Ue,{children:[r&&a.jsx("div",{className:"flex items-center justify-center py-8",children:a.jsx("div",{className:"text-sm text-muted-foreground",children:"Loading metrics..."})}),o&&a.jsx("div",{className:"flex items-center justify-center py-8",children:a.jsxs("div",{className:"text-sm text-destructive",children:["Error loading metrics: ",o.message]})}),s&&a.jsx("div",{className:"flex items-center justify-center py-8",children:a.jsx("div",{className:"text-sm text-muted-foreground",children:"Method tracking is not available in STDIO mode. This data is only collected for HTTP-based transports."})}),n&&!s&&a.jsxs("div",{className:"space-y-4",children:[i.length>0&&a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"text-sm text-muted-foreground",children:["Showing ",l.length," method",l.length!==1?"s":""," tracked since"," ",new Date(n.startupTime).toLocaleString()]}),a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsxs("div",{className:"text-sm font-medium",children:["Total MCP Calls: ",a.jsx("span",{className:"font-mono",children:c.toLocaleString()})]}),a.jsxs("div",{className:"text-sm font-medium",children:["Tool Calls: ",a.jsx("span",{className:"font-mono",children:d.toLocaleString()})]}),a.jsxs("div",{className:"text-sm font-medium",children:["Prompt Calls: ",a.jsx("span",{className:"font-mono",children:f.toLocaleString()})]}),a.jsxs("div",{className:"text-sm font-medium",children:["Resource Reads: ",a.jsx("span",{className:"font-mono",children:g.toLocaleString()})]})]})]}),i.length>0&&a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(qo,{id:"tool-prompt-calls-filter",checked:e,onCheckedChange:u=>t(!!u)}),a.jsx("label",{htmlFor:"tool-prompt-calls-filter",className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 cursor-pointer",children:"Show only Tools/Prompts/Resources"})]}),l.length===0?a.jsx("div",{className:"flex items-center justify-center py-8",children:a.jsx("div",{className:"text-sm text-muted-foreground",children:e?"No tool, prompt, or resource calls recorded yet.":"No method calls recorded yet."})}):a.jsx(zt,{columns:m,data:l,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 hs(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 Up({isLoading:e,error:t,transportInfo:n}){const o=()=>{switch(n.transport){case"stdio":return"STDIO";case"streamableHttp":case"streamableHttpJson":return"Streamable HTTP";default:return"Unknown"}},r=()=>{switch(n.transport){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()?a.jsx("span",{className:"ml-1.5 px-1.5 py-0.5 bg-green-100 text-green-800 text-[10px] rounded-sm whitespace-nowrap",children:"JSON (stateless)"}):n.transport==="streamableHttp"?a.jsx("span",{className:"ml-1.5 px-1.5 py-0.5 bg-blue-100 text-blue-800 text-[10px] rounded-sm whitespace-nowrap",children:"Session Based"}):null;if(e)return a.jsx("div",{className:"text-center text-xs text-muted-foreground py-2",children:"Loading connection information..."});if(t)return a.jsxs("div",{className:"text-center text-xs text-destructive py-2",children:["Error: ",t]});const l=n.port||3e3,c=n.transport!=="stdio";return a.jsx("div",{className:"fixed bottom-0 left-0 w-full bg-muted/50 border-t border-border py-2 px-4",children:a.jsxs("div",{className:"max-w-[700px] mx-auto flex justify-between items-center text-xs",children:[a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("span",{className:"text-muted-foreground",children:"Using"}),a.jsx("span",{className:"font-medium text-primary",children:o()}),n.transport==="stdio"&&a.jsxs("span",{className:"text-muted-foreground flex items-center",children:["Client Info :",n.stdioClient?a.jsx("span",{className:"ml-2 flex items-center",children:a.jsxs("span",{className:"ml-1 font-medium text-green-700",children:[n.stdioClient.name," ",n.stdioClient.version]})}):a.jsx("span",{className:"ml-2 text-muted-foreground",children:" (disconnected) "})]}),c&&a.jsxs("span",{className:"text-muted-foreground flex items-center",children:["on port ",a.jsx("span",{className:"font-mono mx-1",children:l}),"at ",a.jsx("span",{className:"font-mono mx-1",children:r()}),i()]})]}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("span",{className:"text-muted-foreground",children:" Default HF Token:"}),a.jsx("span",{className:`font-mono ${hs(n).isWarning?"text-red-500":""}`,children:hs(n).text})]})]})})}var Fn="Tabs",[Wp]=ft(Fn,[jn]),qa=jn(),[Kp,xr]=Wp(Fn),Xa=h.forwardRef((e,t)=>{const{__scopeTabs:n,value:o,onValueChange:r,defaultValue:s,orientation:i="horizontal",dir:l,activationMode:c="automatic",...d}=e,f=er(l),[g,m]=Sn({prop:o,onChange:r,defaultProp:s??"",caller:Fn});return a.jsx(Kp,{scope:n,baseId:gn(),value:g,onValueChange:m,orientation:i,dir:f,activationMode:c,children:a.jsx(oe.div,{dir:f,"data-orientation":i,...d,ref:t})})});Xa.displayName=Fn;var Ya="TabsList",Ja=h.forwardRef((e,t)=>{const{__scopeTabs:n,loop:o=!0,...r}=e,s=xr(Ya,n),i=qa(n);return a.jsx(ra,{asChild:!0,...i,orientation:s.orientation,dir:s.dir,loop:o,children:a.jsx(oe.div,{role:"tablist","aria-orientation":s.orientation,...r,ref:t})})});Ja.displayName=Ya;var Za="TabsTrigger",Qa=h.forwardRef((e,t)=>{const{__scopeTabs:n,value:o,disabled:r=!1,...s}=e,i=xr(Za,n),l=qa(n),c=nl(i.baseId,o),d=ol(i.baseId,o),f=o===i.value;return a.jsx(sa,{asChild:!0,...l,focusable:!r,active:f,children:a.jsx(oe.button,{type:"button",role:"tab","aria-selected":f,"aria-controls":d,"data-state":f?"active":"inactive","data-disabled":r?"":void 0,disabled:r,id:c,...s,ref:t,onMouseDown:z(e.onMouseDown,g=>{!r&&g.button===0&&g.ctrlKey===!1?i.onValueChange(o):g.preventDefault()}),onKeyDown:z(e.onKeyDown,g=>{[" ","Enter"].includes(g.key)&&i.onValueChange(o)}),onFocus:z(e.onFocus,()=>{const g=i.activationMode!=="manual";!f&&!r&&g&&i.onValueChange(o)})})})});Qa.displayName=Za;var el="TabsContent",tl=h.forwardRef((e,t)=>{const{__scopeTabs:n,value:o,forceMount:r,children:s,...i}=e,l=xr(el,n),c=nl(l.baseId,o),d=ol(l.baseId,o),f=o===l.value,g=h.useRef(f);return h.useEffect(()=>{const m=requestAnimationFrame(()=>g.current=!1);return()=>cancelAnimationFrame(m)},[]),a.jsx(gt,{present:r||f,children:({present:m})=>a.jsx(oe.div,{"data-state":f?"active":"inactive","data-orientation":l.orientation,role:"tabpanel","aria-labelledby":c,hidden:!m,id:d,tabIndex:0,...i,ref:t,style:{...e.style,animationDuration:g.current?"0s":void 0},children:m&&s})})});tl.displayName=el;function nl(e,t){return`${e}-trigger-${t}`}function ol(e,t){return`${e}-content-${t}`}var qp=Xa,Xp=Ja,Yp=Qa,Jp=tl;function Zp({className:e,...t}){return a.jsx(qp,{"data-slot":"tabs",className:ne("flex flex-col gap-2",e),...t})}function Qp({className:e,...t}){return a.jsx(Xp,{"data-slot":"tabs-list",className:ne("bg-muted text-muted-foreground inline-flex h-9 w-fit items-center justify-center rounded-lg p-[3px]",e),...t})}function yt({className:e,...t}){return a.jsx(Yp,{"data-slot":"tabs-trigger",className:ne("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 Ct({className:e,...t}){return a.jsx(Jp,{"data-slot":"tabs-content",className:ne("flex-1 outline-none",e),...t})}const vs="ALLOW_README_INCLUDE",xs="NO_GRADIO_IMAGE_CONTENT",eh=new Intl.DateTimeFormat("en-GB",{day:"numeric",month:"long",year:"numeric",timeZone:"UTC"}).format(new Date),Do={name:"space_search",description:"Find Hugging Face Spaces using semantic search. IMPORTANT Only MCP Servers can be used with the dynamic_space toolInclude links to the Space when presenting the results.",annotations:{title:"Hugging Face Space Search"}},Oo={name:"hub_repo_search",description:"Search Hugging Face repositories with a shared query interface. You can target models, datasets, spaces, or aggregate across multiple repo types in one call. Use space_search for semantic-first discovery of Spaces. Include links to repositories in your response.",annotations:{title:"Repo Search"}},$o={name:"create_repo",description:"Create a Hugging Face model, dataset, Space, or bucket repository. name must be fully qualified, for example 'username/repo-name'.",annotations:{title:"Create Hugging Face Repository"}},Lo={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.",annotations:{title:"Paper Search"}},Vo={name:"hub_repo_details",description:"Get details for one or more Hugging Face repos (model, dataset, or space). Auto-detects type unless specified. For datasets, use dataset_structure first to discover configs, splits, sizes, and schema. Use dataset_preview only when config and split are known, unless the dataset has a single config/split.",annotations:{title:"Hub Repo Details"}},rl={name:"duplicate_space",annotations:{title:"Duplicate Hugging Face Space"}},sl={name:"space_files",annotations:{title:"Space Files List"}},zo={name:"hf_doc_search",description:`Search and Discover Hugging Face Product and Library documentation. Send an empty query to discover structure and navigation instructions. Knowledge up-to-date as at ${eh}. Combine with the Product filter to focus results.`,annotations:{title:"Hugging Face Documentation Search"}},Ho={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.",annotations:{title:"Fetch a document from the Hugging Face documentation library"}},ws=Do.name,th="model_search",yn=Oo.name,ys=$o.name,nh="model_details",Cs=Lo.name,oh="dataset_search",rh="dataset_details",Ft=Vo.name,Ss=rl.name,bs=sl.name,Rs=zo.name,_s=Ho.name,sh=new Set([th,"model-search","hf_model_search"]),ih=new Set([oh,"dataset-search","hf_dataset_search"]),ah=new Set([yn,"repo_search","repo-search","hf_repo_search"]);function lh(e){return sh.has(e)||ih.has(e)||ah.has(e)?yn:e}function Es(e){const t=new Set,n=[];let o=!1;for(const r of e){const s=lh(r);if(s===nh||s===rh){o=!0;continue}t.has(s)||(t.add(s),n.push(s))}return o&&!t.has(Ft)&&(t.add(Ft),n.push(Ft)),n}const uo=e=>fetch(e).then(t=>{if(!t.ok)throw new Error(`Failed to fetch: ${t.status}`);return t.json()});function ch(){var b,F,k,G,q,H,D,Y,L,U,_;const{data:e,error:t}=It("/api/transport",uo,{refreshInterval:3e3,revalidateOnFocus:!0,revalidateOnReconnect:!0});It("/api/sessions",uo,{refreshInterval:3e3,revalidateOnFocus:!0});const{data:n}=It("/api/settings",uo),o=((b=n==null?void 0:n.builtInTools)==null?void 0:b.includes(vs))??!1,r=((F=n==null?void 0:n.builtInTools)==null?void 0:F.includes(xs))??!1,[s,i]=h.useState(["","",""]),[l,c]=h.useState(["","",""]),[d,f]=h.useState([!1,!1,!1]),[g,m]=h.useState(!1);h.useEffect(()=>{if(n!=null&&n.spaceTools&&!g){const M=["","",""],$=["","",""],O=[!1,!1,!1];n.spaceTools.forEach((B,J)=>{J<3&&(M[J]=B.name,$[J]=B.subdomain,O[J]=!0)}),i(M),c($),f(O),m(!0)}},[n,g]);const u=!e&&!t,v=t?t.message:null,p=async(M,$)=>{try{const O=n||{builtInTools:[]},B=Es(O.builtInTools),J=$?[...B.filter(W=>W!==M),M]:B.filter(W=>W!==M),ee=Es(J),ce={...O,builtInTools:ee};cn("/api/settings",ce,!1);const ue=await fetch("/api/settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({builtInTools:ee})});if(!ue.ok)throw new Error(`Failed to update tool settings: ${ue.status}`);cn("/api/settings"),console.log(`${M} is now ${$?"enabled":"disabled"}`)}catch(O){console.error("Error updating tool settings:",O),alert(`Error updating ${M}: ${O instanceof Error?O.message:"Unknown error"}`),cn("/api/settings")}},w=async(M,$)=>{const O=[...d];O[M]=$,f(O),await C(O)},x=async(M,$)=>{const O=[...s];O[M]=$,i(O),d[M]&&await C(d)},y=async(M,$)=>{const O=[...l];O[M]=$,c(O),d[M]&&await C(d)},C=async M=>{try{const $=[];for(let B=0;B<3;B++)M[B]&&s[B]&&l[B]&&$.push({_id:`space-${B}`,name:s[B],subdomain:l[B],emoji:"🔧"});const O=await fetch("/api/settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({spaceTools:$})});if(!O.ok)throw new Error(`Failed to update space tools: ${O.status}`)}catch($){console.error("Error updating space tools:",$)}},S=async()=>{const M="https://huggingface.co/mcp";try{await navigator.clipboard.writeText(M)}catch($){console.error("Failed to copy URL:",$)}},R=()=>{window.open("https://huggingface.co/settings/mcp","_blank")},N={paper_search:{id:Cs,label:Lo.annotations.title,description:Lo.description,settings:{enabled:((k=n==null?void 0:n.builtInTools)==null?void 0:k.includes(Cs))??!0}},space_search:{id:ws,label:Do.annotations.title,description:Do.description,settings:{enabled:((G=n==null?void 0:n.builtInTools)==null?void 0:G.includes(ws))??!0}},hub_repo_search:{id:yn,label:Oo.annotations.title,description:Oo.description,settings:{enabled:((q=n==null?void 0:n.builtInTools)==null?void 0:q.includes(yn))??!0}},create_repo:{id:ys,label:$o.annotations.title,description:$o.description,settings:{enabled:((H=n==null?void 0:n.builtInTools)==null?void 0:H.includes(ys))??!0}},hub_repo_details:{id:Ft,label:Vo.annotations.title,description:Vo.description,settings:{enabled:((D=n==null?void 0:n.builtInTools)==null?void 0:D.includes(Ft))??!0}},include_readme:{id:vs,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:o}},doc_semantic_search:{id:Rs,label:zo.annotations.title,description:zo.description,settings:{enabled:((Y=n==null?void 0:n.builtInTools)==null?void 0:Y.includes(Rs))??!0}},doc_fetch:{id:_s,label:Ho.annotations.title,description:Ho.description,settings:{enabled:((L=n==null?void 0:n.builtInTools)==null?void 0:L.includes(_s))??!0}}},E={duplicate_space:{id:Ss,label:rl.annotations.title,description:"Duplicate a Hugging Face Space to your account.",settings:{enabled:((U=n==null?void 0:n.builtInTools)==null?void 0:U.includes(Ss))??!0}},space_files:{id:bs,label:sl.annotations.title,description:"List all files in a static Hugging Face Space with download URLs.",settings:{enabled:((_=n==null?void 0:n.builtInTools)==null?void 0:_.includes(bs))??!0}},no_gradio_images:{id:xs,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:r}}};return a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"min-h-screen p-4 sm:p-8 pb-20",children:a.jsx("div",{className:"max-w-4xl mx-auto",children:a.jsxs(Zp,{defaultValue:"metrics",className:"w-full",children:[a.jsxs(Qp,{className:"mb-6 w-full overflow-x-auto flex-nowrap",children:[a.jsx(yt,{value:"metrics",className:"whitespace-nowrap",children:"📊 Metrics"}),a.jsx(yt,{value:"mcp",className:"whitespace-nowrap",children:"🔧 MCP"}),!(e!=null&&e.externalApiMode)&&a.jsx(yt,{value:"search",className:"whitespace-nowrap",children:"🔍 Search"}),!(e!=null&&e.externalApiMode)&&a.jsx(yt,{value:"spaces",className:"whitespace-nowrap",children:"🚀 Spaces"}),!(e!=null&&e.externalApiMode)&&a.jsx(yt,{value:"gradio",className:"whitespace-nowrap",children:"🚀 Gradio"}),a.jsx(yt,{value:"home",className:"whitespace-nowrap",children:"🏠 Home"})]}),a.jsx(Ct,{value:"metrics",className:"mt-0",children:a.jsx(Hp,{})}),a.jsx(Ct,{value:"mcp",className:"mt-0",children:a.jsx(Bp,{})}),!(e!=null&&e.externalApiMode)&&a.jsx(Ct,{value:"search",className:"mt-0",children:a.jsx(Dr,{title:"🤗 Hugging Face Search Tools (MCP)",description:"Find and use Hugging Face and Community content.",tools:N,onToolToggle:p})}),!(e!=null&&e.externalApiMode)&&a.jsx(Ct,{value:"spaces",className:"mt-0",children:a.jsx(Dr,{title:"🤗 Hugging Face Space Tools (MCP)",description:"Manage and duplicate Hugging Face Spaces.",tools:E,onToolToggle:p})}),!(e!=null&&e.externalApiMode)&&a.jsx(Ct,{value:"gradio",className:"mt-0",children:a.jsx(du,{spaceNames:s,spaceSubdomains:l,enabledSpaces:d,onSpaceToolToggle:w,onSpaceToolNameChange:x,onSpaceToolSubdomainChange:y})}),a.jsx(Ct,{value:"home",className:"mt-0",children:a.jsxs(He,{children:[a.jsxs(Ge,{children:[a.jsx(Be,{children:"🤗 HF MCP Server"}),a.jsx(dt,{children:"Connect with AI assistants through the Model Context Protocol"})]}),a.jsxs(Ue,{className:"space-y-6",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-sm font-semibold text-foreground mb-3",children:"What's MCP?"}),a.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:"The Model Context Protocol (MCP) is an open standard that enables AI assistants to securely connect to external data sources and tools. This HF MCP Server provides access to Hugging Face's ecosystem of models, datasets, and Spaces, allowing AI assistants to search, analyze, and interact with ML resources directly."})]}),a.jsx(nt,{}),a.jsx("div",{className:"bg-blue-50 dark:bg-blue-950 border border-blue-200 dark:border-blue-800 rounded-lg p-4",children:a.jsxs("div",{className:"flex items-start space-x-3",children:[a.jsx("div",{className:"flex-shrink-0 mt-0.5",children:a.jsx("svg",{className:"h-5 w-5 text-blue-600 dark:text-blue-400",fill:"currentColor",viewBox:"0 0 20 20",children:a.jsx("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z",clipRule:"evenodd"})})}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-sm font-semibold text-blue-900 dark:text-blue-100 mb-2",children:"Tool Management Scope"}),((e==null?void 0:e.externalApiMode)||(e==null?void 0:e.transport)!=="stdio"&&!(e!=null&&e.externalApiMode))&&a.jsx("p",{className:"text-sm text-blue-700 dark:text-blue-300 leading-relaxed",children:e!=null&&e.externalApiMode?a.jsxs(a.Fragment,{children:[a.jsx("strong",{children:"External API Mode:"})," Tools are managed by an external API. Tool Selection Tabs are not available."]}):a.jsxs(a.Fragment,{children:[a.jsx("strong",{children:"Shared Mode:"})," Tool toggles in this interface affect"," ",a.jsx("strong",{children:"all connected MCP server instances"})," and control tool availability for all connected Hosts."]})})]})]})}),a.jsx(nt,{}),a.jsxs("div",{className:"flex flex-col gap-4",children:[a.jsxs(ct,{size:"xl",onClick:S,className:"w-full transition-all duration-200 active:bg-green-500 active:border-green-500 touch-manipulation",children:[a.jsx(Qc,{className:"mr-2 h-5 w-5"}),"Copy MCP URL"]}),a.jsxs(ct,{size:"xl",variant:"outline",onClick:R,className:"w-full touch-manipulation",children:[a.jsx(ou,{className:"mr-2 h-5 w-5"}),"Go to Settings"]})]})]})]})})]})})}),a.jsx(Up,{isLoading:u,error:v,transportInfo:e||{transport:"unknown"}})]})}ul.createRoot(document.getElementById("root")).render(a.jsx(h.StrictMode,{children:a.jsx(ch,{})}));
|
|
145
|
+
`)},em=0,wt=[];function tm(e){var t=h.useRef([]),n=h.useRef([0,0]),o=h.useRef(),r=h.useState(em++)[0],s=h.useState(ua)[0],i=h.useRef(e);h.useEffect(function(){i.current=e},[e]),h.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(r));var p=Sg([e.lockRef.current],(e.shards||[]).map(ds),!0).filter(Boolean);return p.forEach(function(w){return w.classList.add("allow-interactivity-".concat(r))}),function(){document.body.classList.remove("block-interactivity-".concat(r)),p.forEach(function(w){return w.classList.remove("allow-interactivity-".concat(r))})}}},[e.inert,e.lockRef.current,e.shards]);var l=h.useCallback(function(p,w){if("touches"in p&&p.touches.length===2||p.type==="wheel"&&p.ctrlKey)return!i.current.allowPinchZoom;var x=sn(p),y=n.current,C="deltaX"in p?p.deltaX:y[0]-x[0],S="deltaY"in p?p.deltaY:y[1]-x[1],R,N=p.target,E=Math.abs(C)>Math.abs(S)?"h":"v";if("touches"in p&&E==="h"&&N.type==="range")return!1;var b=cs(E,N);if(!b)return!0;if(b?R=E:(R=E==="v"?"h":"v",b=cs(E,N)),!b)return!1;if(!o.current&&"changedTouches"in p&&(C||S)&&(o.current=R),!R)return!0;var F=o.current||R;return Jg(F,w,p,F==="h"?C:S)},[]),c=h.useCallback(function(p){var w=p;if(!(!wt.length||wt[wt.length-1]!==s)){var x="deltaY"in w?us(w):sn(w),y=t.current.filter(function(R){return R.name===w.type&&(R.target===w.target||w.target===R.shadowParent)&&Zg(R.delta,x)})[0];if(y&&y.should){w.cancelable&&w.preventDefault();return}if(!y){var C=(i.current.shards||[]).map(ds).filter(Boolean).filter(function(R){return R.contains(w.target)}),S=C.length>0?l(w,C[0]):!i.current.noIsolation;S&&w.cancelable&&w.preventDefault()}}},[]),d=h.useCallback(function(p,w,x,y){var C={name:p,delta:w,target:x,should:y,shadowParent:nm(x)};t.current.push(C),setTimeout(function(){t.current=t.current.filter(function(S){return S!==C})},1)},[]),f=h.useCallback(function(p){n.current=sn(p),o.current=void 0},[]),g=h.useCallback(function(p){d(p.type,us(p),p.target,l(p,e.lockRef.current))},[]),m=h.useCallback(function(p){d(p.type,sn(p),p.target,l(p,e.lockRef.current))},[]);h.useEffect(function(){return wt.push(s),e.setCallbacks({onScrollCapture:g,onWheelCapture:g,onTouchMoveCapture:m}),document.addEventListener("wheel",c,xt),document.addEventListener("touchmove",c,xt),document.addEventListener("touchstart",f,xt),function(){wt=wt.filter(function(p){return p!==s}),document.removeEventListener("wheel",c,xt),document.removeEventListener("touchmove",c,xt),document.removeEventListener("touchstart",f,xt)}},[]);var u=e.removeScrollBar,v=e.inert;return h.createElement(h.Fragment,null,v?h.createElement(s,{styles:Qg(r)}):null,u?h.createElement(Bg,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function nm(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const om=Pg(ca,tm);var ma=h.forwardRef(function(e,t){return h.createElement(An,Ae({},e,{ref:t,sideCar:om}))});ma.classNames=An.classNames;var ko=["Enter"," "],rm=["ArrowDown","PageUp","Home"],pa=["ArrowUp","PageDown","End"],sm=[...rm,...pa],im={ltr:[...ko,"ArrowRight"],rtl:[...ko,"ArrowLeft"]},am={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Ut="Menu",[Lt,lm,cm]=Ri(Ut),[mt,ha]=ft(Ut,[cm,Gi,jn]),Pn=Gi(),va=jn(),[um,pt]=mt(Ut),[dm,Wt]=mt(Ut),xa=e=>{const{__scopeMenu:t,open:n=!1,children:o,dir:r,onOpenChange:s,modal:i=!0}=e,l=Pn(t),[c,d]=h.useState(null),f=h.useRef(!1),g=We(s),m=er(r);return h.useEffect(()=>{const u=()=>{f.current=!0,document.addEventListener("pointerdown",v,{capture:!0,once:!0}),document.addEventListener("pointermove",v,{capture:!0,once:!0})},v=()=>f.current=!1;return document.addEventListener("keydown",u,{capture:!0}),()=>{document.removeEventListener("keydown",u,{capture:!0}),document.removeEventListener("pointerdown",v,{capture:!0}),document.removeEventListener("pointermove",v,{capture:!0})}},[]),a.jsx(og,{...l,children:a.jsx(um,{scope:t,open:n,onOpenChange:g,content:c,onContentChange:d,children:a.jsx(dm,{scope:t,onClose:h.useCallback(()=>g(!1),[g]),isUsingKeyboardRef:f,dir:m,modal:i,children:o})})})};xa.displayName=Ut;var fm="MenuAnchor",cr=h.forwardRef((e,t)=>{const{__scopeMenu:n,...o}=e,r=Pn(n);return a.jsx(rg,{...r,...o,ref:t})});cr.displayName=fm;var ur="MenuPortal",[gm,wa]=mt(ur,{forceMount:void 0}),ya=e=>{const{__scopeMenu:t,forceMount:n,children:o,container:r}=e,s=pt(ur,t);return a.jsx(gm,{scope:t,forceMount:n,children:a.jsx(gt,{present:n||s.open,children:a.jsx(Zi,{asChild:!0,container:r,children:o})})})};ya.displayName=ur;var Se="MenuContent",[mm,dr]=mt(Se),Ca=h.forwardRef((e,t)=>{const n=wa(Se,e.__scopeMenu),{forceMount:o=n.forceMount,...r}=e,s=pt(Se,e.__scopeMenu),i=Wt(Se,e.__scopeMenu);return a.jsx(Lt.Provider,{scope:e.__scopeMenu,children:a.jsx(gt,{present:o||s.open,children:a.jsx(Lt.Slot,{scope:e.__scopeMenu,children:i.modal?a.jsx(pm,{...r,ref:t}):a.jsx(hm,{...r,ref:t})})})})}),pm=h.forwardRef((e,t)=>{const n=pt(Se,e.__scopeMenu),o=h.useRef(null),r=me(t,o);return h.useEffect(()=>{const s=o.current;if(s)return Cg(s)},[]),a.jsx(fr,{...e,ref:r,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:z(e.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),hm=h.forwardRef((e,t)=>{const n=pt(Se,e.__scopeMenu);return a.jsx(fr,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),vm=Dt("MenuContent.ScrollLock"),fr=h.forwardRef((e,t)=>{const{__scopeMenu:n,loop:o=!1,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:i,disableOutsidePointerEvents:l,onEntryFocus:c,onEscapeKeyDown:d,onPointerDownOutside:f,onFocusOutside:g,onInteractOutside:m,onDismiss:u,disableOutsideScroll:v,...p}=e,w=pt(Se,n),x=Wt(Se,n),y=Pn(n),C=va(n),S=lm(n),[R,N]=h.useState(null),E=h.useRef(null),b=me(t,E,w.onContentChange),F=h.useRef(0),k=h.useRef(""),G=h.useRef(0),q=h.useRef(null),H=h.useRef("right"),D=h.useRef(0),Y=v?ma:h.Fragment,L=v?{as:vm,allowPinchZoom:!0}:void 0,U=M=>{var W,Me;const $=k.current+M,O=S().filter(ie=>!ie.disabled),B=document.activeElement,J=(W=O.find(ie=>ie.ref.current===B))==null?void 0:W.textValue,ee=O.map(ie=>ie.textValue),ce=jm(ee,$,J),ue=(Me=O.find(ie=>ie.textValue===ce))==null?void 0:Me.ref.current;(function ie(de){k.current=de,window.clearTimeout(F.current),de!==""&&(F.current=window.setTimeout(()=>ie(""),1e3))})($),ue&&setTimeout(()=>ue.focus())};h.useEffect(()=>()=>window.clearTimeout(F.current),[]),Nd();const _=h.useCallback(M=>{var O,B;return H.current===((O=q.current)==null?void 0:O.side)&&Pm(M,(B=q.current)==null?void 0:B.area)},[]);return a.jsx(mm,{scope:n,searchRef:k,onItemEnter:h.useCallback(M=>{_(M)&&M.preventDefault()},[_]),onItemLeave:h.useCallback(M=>{var $;_(M)||(($=E.current)==null||$.focus(),N(null))},[_]),onTriggerLeave:h.useCallback(M=>{_(M)&&M.preventDefault()},[_]),pointerGraceTimerRef:G,onPointerGraceIntentChange:h.useCallback(M=>{q.current=M},[]),children:a.jsx(Y,{...L,children:a.jsx(Ni,{asChild:!0,trapped:r,onMountAutoFocus:z(s,M=>{var $;M.preventDefault(),($=E.current)==null||$.focus({preventScroll:!0})}),onUnmountAutoFocus:i,children:a.jsx(Ei,{asChild:!0,disableOutsidePointerEvents:l,onEscapeKeyDown:d,onPointerDownOutside:f,onFocusOutside:g,onInteractOutside:m,onDismiss:u,children:a.jsx(ra,{asChild:!0,...C,dir:x.dir,orientation:"vertical",loop:o,currentTabStopId:R,onCurrentTabStopIdChange:N,onEntryFocus:z(c,M=>{x.isUsingKeyboardRef.current||M.preventDefault()}),preventScrollOnEntryFocus:!0,children:a.jsx(sg,{role:"menu","aria-orientation":"vertical","data-state":Oa(w.open),"data-radix-menu-content":"",dir:x.dir,...y,...p,ref:b,style:{outline:"none",...p.style},onKeyDown:z(p.onKeyDown,M=>{const O=M.target.closest("[data-radix-menu-content]")===M.currentTarget,B=M.ctrlKey||M.altKey||M.metaKey,J=M.key.length===1;O&&(M.key==="Tab"&&M.preventDefault(),!B&&J&&U(M.key));const ee=E.current;if(M.target!==ee||!sm.includes(M.key))return;M.preventDefault();const ue=S().filter(W=>!W.disabled).map(W=>W.ref.current);pa.includes(M.key)&&ue.reverse(),Mm(ue)}),onBlur:z(e.onBlur,M=>{M.currentTarget.contains(M.target)||(window.clearTimeout(F.current),k.current="")}),onPointerMove:z(e.onPointerMove,Vt(M=>{const $=M.target,O=D.current!==M.clientX;if(M.currentTarget.contains($)&&O){const B=M.clientX>D.current?"right":"left";H.current=B,D.current=M.clientX}}))})})})})})})});Ca.displayName=Se;var xm="MenuGroup",gr=h.forwardRef((e,t)=>{const{__scopeMenu:n,...o}=e;return a.jsx(oe.div,{role:"group",...o,ref:t})});gr.displayName=xm;var wm="MenuLabel",Sa=h.forwardRef((e,t)=>{const{__scopeMenu:n,...o}=e;return a.jsx(oe.div,{...o,ref:t})});Sa.displayName=wm;var xn="MenuItem",fs="menu.itemSelect",In=h.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:o,...r}=e,s=h.useRef(null),i=Wt(xn,e.__scopeMenu),l=dr(xn,e.__scopeMenu),c=me(t,s),d=h.useRef(!1),f=()=>{const g=s.current;if(!n&&g){const m=new CustomEvent(fs,{bubbles:!0,cancelable:!0});g.addEventListener(fs,u=>o==null?void 0:o(u),{once:!0}),Ys(g,m),m.defaultPrevented?d.current=!1:i.onClose()}};return a.jsx(ba,{...r,ref:c,disabled:n,onClick:z(e.onClick,f),onPointerDown:g=>{var m;(m=e.onPointerDown)==null||m.call(e,g),d.current=!0},onPointerUp:z(e.onPointerUp,g=>{var m;d.current||(m=g.currentTarget)==null||m.click()}),onKeyDown:z(e.onKeyDown,g=>{const m=l.searchRef.current!=="";n||m&&g.key===" "||ko.includes(g.key)&&(g.currentTarget.click(),g.preventDefault())})})});In.displayName=xn;var ba=h.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:o=!1,textValue:r,...s}=e,i=dr(xn,n),l=va(n),c=h.useRef(null),d=me(t,c),[f,g]=h.useState(!1),[m,u]=h.useState("");return h.useEffect(()=>{const v=c.current;v&&u((v.textContent??"").trim())},[s.children]),a.jsx(Lt.ItemSlot,{scope:n,disabled:o,textValue:r??m,children:a.jsx(sa,{asChild:!0,...l,focusable:!o,children:a.jsx(oe.div,{role:"menuitem","data-highlighted":f?"":void 0,"aria-disabled":o||void 0,"data-disabled":o?"":void 0,...s,ref:d,onPointerMove:z(e.onPointerMove,Vt(v=>{o?i.onItemLeave(v):(i.onItemEnter(v),v.defaultPrevented||v.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:z(e.onPointerLeave,Vt(v=>i.onItemLeave(v))),onFocus:z(e.onFocus,()=>g(!0)),onBlur:z(e.onBlur,()=>g(!1))})})})}),ym="MenuCheckboxItem",Ra=h.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:o,...r}=e;return a.jsx(ja,{scope:e.__scopeMenu,checked:n,children:a.jsx(In,{role:"menuitemcheckbox","aria-checked":wn(n)?"mixed":n,...r,ref:t,"data-state":pr(n),onSelect:z(r.onSelect,()=>o==null?void 0:o(wn(n)?!0:!n),{checkForDefaultPrevented:!1})})})});Ra.displayName=ym;var _a="MenuRadioGroup",[Cm,Sm]=mt(_a,{value:void 0,onValueChange:()=>{}}),Ea=h.forwardRef((e,t)=>{const{value:n,onValueChange:o,...r}=e,s=We(o);return a.jsx(Cm,{scope:e.__scopeMenu,value:n,onValueChange:s,children:a.jsx(gr,{...r,ref:t})})});Ea.displayName=_a;var Ma="MenuRadioItem",Na=h.forwardRef((e,t)=>{const{value:n,...o}=e,r=Sm(Ma,e.__scopeMenu),s=n===r.value;return a.jsx(ja,{scope:e.__scopeMenu,checked:s,children:a.jsx(In,{role:"menuitemradio","aria-checked":s,...o,ref:t,"data-state":pr(s),onSelect:z(o.onSelect,()=>{var i;return(i=r.onValueChange)==null?void 0:i.call(r,n)},{checkForDefaultPrevented:!1})})})});Na.displayName=Ma;var mr="MenuItemIndicator",[ja,bm]=mt(mr,{checked:!1}),Aa=h.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:o,...r}=e,s=bm(mr,n);return a.jsx(gt,{present:o||wn(s.checked)||s.checked===!0,children:a.jsx(oe.span,{...r,ref:t,"data-state":pr(s.checked)})})});Aa.displayName=mr;var Rm="MenuSeparator",Pa=h.forwardRef((e,t)=>{const{__scopeMenu:n,...o}=e;return a.jsx(oe.div,{role:"separator","aria-orientation":"horizontal",...o,ref:t})});Pa.displayName=Rm;var _m="MenuArrow",Ia=h.forwardRef((e,t)=>{const{__scopeMenu:n,...o}=e,r=Pn(n);return a.jsx(ig,{...r,...o,ref:t})});Ia.displayName=_m;var Em="MenuSub",[dh,Ta]=mt(Em),Pt="MenuSubTrigger",Fa=h.forwardRef((e,t)=>{const n=pt(Pt,e.__scopeMenu),o=Wt(Pt,e.__scopeMenu),r=Ta(Pt,e.__scopeMenu),s=dr(Pt,e.__scopeMenu),i=h.useRef(null),{pointerGraceTimerRef:l,onPointerGraceIntentChange:c}=s,d={__scopeMenu:e.__scopeMenu},f=h.useCallback(()=>{i.current&&window.clearTimeout(i.current),i.current=null},[]);return h.useEffect(()=>f,[f]),h.useEffect(()=>{const g=l.current;return()=>{window.clearTimeout(g),c(null)}},[l,c]),a.jsx(cr,{asChild:!0,...d,children:a.jsx(ba,{id:r.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":r.contentId,"data-state":Oa(n.open),...e,ref:Cn(t,r.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:z(e.onPointerMove,Vt(g=>{s.onItemEnter(g),!g.defaultPrevented&&!e.disabled&&!n.open&&!i.current&&(s.onPointerGraceIntentChange(null),i.current=window.setTimeout(()=>{n.onOpenChange(!0),f()},100))})),onPointerLeave:z(e.onPointerLeave,Vt(g=>{var u,v;f();const m=(u=n.content)==null?void 0:u.getBoundingClientRect();if(m){const p=(v=n.content)==null?void 0:v.dataset.side,w=p==="right",x=w?-5:5,y=m[w?"left":"right"],C=m[w?"right":"left"];s.onPointerGraceIntentChange({area:[{x:g.clientX+x,y:g.clientY},{x:y,y:m.top},{x:C,y:m.top},{x:C,y:m.bottom},{x:y,y:m.bottom}],side:p}),window.clearTimeout(l.current),l.current=window.setTimeout(()=>s.onPointerGraceIntentChange(null),300)}else{if(s.onTriggerLeave(g),g.defaultPrevented)return;s.onPointerGraceIntentChange(null)}})),onKeyDown:z(e.onKeyDown,g=>{var u;const m=s.searchRef.current!=="";e.disabled||m&&g.key===" "||im[o.dir].includes(g.key)&&(n.onOpenChange(!0),(u=n.content)==null||u.focus(),g.preventDefault())})})})});Fa.displayName=Pt;var ka="MenuSubContent",Da=h.forwardRef((e,t)=>{const n=wa(Se,e.__scopeMenu),{forceMount:o=n.forceMount,...r}=e,s=pt(Se,e.__scopeMenu),i=Wt(Se,e.__scopeMenu),l=Ta(ka,e.__scopeMenu),c=h.useRef(null),d=me(t,c);return a.jsx(Lt.Provider,{scope:e.__scopeMenu,children:a.jsx(gt,{present:o||s.open,children:a.jsx(Lt.Slot,{scope:e.__scopeMenu,children:a.jsx(fr,{id:l.contentId,"aria-labelledby":l.triggerId,...r,ref:d,align:"start",side:i.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:f=>{var g;i.isUsingKeyboardRef.current&&((g=c.current)==null||g.focus()),f.preventDefault()},onCloseAutoFocus:f=>f.preventDefault(),onFocusOutside:z(e.onFocusOutside,f=>{f.target!==l.trigger&&s.onOpenChange(!1)}),onEscapeKeyDown:z(e.onEscapeKeyDown,f=>{i.onClose(),f.preventDefault()}),onKeyDown:z(e.onKeyDown,f=>{var u;const g=f.currentTarget.contains(f.target),m=am[i.dir].includes(f.key);g&&m&&(s.onOpenChange(!1),(u=l.trigger)==null||u.focus(),f.preventDefault())})})})})})});Da.displayName=ka;function Oa(e){return e?"open":"closed"}function wn(e){return e==="indeterminate"}function pr(e){return wn(e)?"indeterminate":e?"checked":"unchecked"}function Mm(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function Nm(e,t){return e.map((n,o)=>e[(t+o)%e.length])}function jm(e,t,n){const r=t.length>1&&Array.from(t).every(d=>d===t[0])?t[0]:t,s=n?e.indexOf(n):-1;let i=Nm(e,Math.max(s,0));r.length===1&&(i=i.filter(d=>d!==n));const c=i.find(d=>d.toLowerCase().startsWith(r.toLowerCase()));return c!==n?c:void 0}function Am(e,t){const{x:n,y:o}=e;let r=!1;for(let s=0,i=t.length-1;s<t.length;i=s++){const l=t[s],c=t[i],d=l.x,f=l.y,g=c.x,m=c.y;f>o!=m>o&&n<(g-d)*(o-f)/(m-f)+d&&(r=!r)}return r}function Pm(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return Am(n,t)}function Vt(e){return t=>t.pointerType==="mouse"?e(t):void 0}var Im=xa,Tm=cr,Fm=ya,km=Ca,Dm=gr,Om=Sa,$m=In,Lm=Ra,Vm=Ea,zm=Na,Hm=Aa,Gm=Pa,Bm=Ia,Um=Fa,Wm=Da,Tn="DropdownMenu",[Km]=ft(Tn,[ha]),he=ha(),[qm,$a]=Km(Tn),La=e=>{const{__scopeDropdownMenu:t,children:n,dir:o,open:r,defaultOpen:s,onOpenChange:i,modal:l=!0}=e,c=he(t),d=h.useRef(null),[f,g]=Sn({prop:r,defaultProp:s??!1,onChange:i,caller:Tn});return a.jsx(qm,{scope:t,triggerId:gn(),triggerRef:d,contentId:gn(),open:f,onOpenChange:g,onOpenToggle:h.useCallback(()=>g(m=>!m),[g]),modal:l,children:a.jsx(Im,{...c,open:f,onOpenChange:g,dir:o,modal:l,children:n})})};La.displayName=Tn;var Va="DropdownMenuTrigger",za=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:o=!1,...r}=e,s=$a(Va,n),i=he(n);return a.jsx(Tm,{asChild:!0,...i,children:a.jsx(oe.button,{type:"button",id:s.triggerId,"aria-haspopup":"menu","aria-expanded":s.open,"aria-controls":s.open?s.contentId:void 0,"data-state":s.open?"open":"closed","data-disabled":o?"":void 0,disabled:o,...r,ref:Cn(t,s.triggerRef),onPointerDown:z(e.onPointerDown,l=>{!o&&l.button===0&&l.ctrlKey===!1&&(s.onOpenToggle(),s.open||l.preventDefault())}),onKeyDown:z(e.onKeyDown,l=>{o||(["Enter"," "].includes(l.key)&&s.onOpenToggle(),l.key==="ArrowDown"&&s.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(l.key)&&l.preventDefault())})})})});za.displayName=Va;var Xm="DropdownMenuPortal",Ha=e=>{const{__scopeDropdownMenu:t,...n}=e,o=he(t);return a.jsx(Fm,{...o,...n})};Ha.displayName=Xm;var Ga="DropdownMenuContent",Ba=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=$a(Ga,n),s=he(n),i=h.useRef(!1);return a.jsx(km,{id:r.contentId,"aria-labelledby":r.triggerId,...s,...o,ref:t,onCloseAutoFocus:z(e.onCloseAutoFocus,l=>{var c;i.current||(c=r.triggerRef.current)==null||c.focus(),i.current=!1,l.preventDefault()}),onInteractOutside:z(e.onInteractOutside,l=>{const c=l.detail.originalEvent,d=c.button===0&&c.ctrlKey===!0,f=c.button===2||d;(!r.modal||f)&&(i.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});Ba.displayName=Ga;var Ym="DropdownMenuGroup",Jm=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=he(n);return a.jsx(Dm,{...r,...o,ref:t})});Jm.displayName=Ym;var Zm="DropdownMenuLabel",Qm=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=he(n);return a.jsx(Om,{...r,...o,ref:t})});Qm.displayName=Zm;var ep="DropdownMenuItem",tp=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=he(n);return a.jsx($m,{...r,...o,ref:t})});tp.displayName=ep;var np="DropdownMenuCheckboxItem",Ua=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=he(n);return a.jsx(Lm,{...r,...o,ref:t})});Ua.displayName=np;var op="DropdownMenuRadioGroup",rp=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=he(n);return a.jsx(Vm,{...r,...o,ref:t})});rp.displayName=op;var sp="DropdownMenuRadioItem",ip=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=he(n);return a.jsx(zm,{...r,...o,ref:t})});ip.displayName=sp;var ap="DropdownMenuItemIndicator",Wa=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=he(n);return a.jsx(Hm,{...r,...o,ref:t})});Wa.displayName=ap;var lp="DropdownMenuSeparator",cp=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=he(n);return a.jsx(Gm,{...r,...o,ref:t})});cp.displayName=lp;var up="DropdownMenuArrow",dp=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=he(n);return a.jsx(Bm,{...r,...o,ref:t})});dp.displayName=up;var fp="DropdownMenuSubTrigger",gp=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=he(n);return a.jsx(Um,{...r,...o,ref:t})});gp.displayName=fp;var mp="DropdownMenuSubContent",pp=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=he(n);return a.jsx(Wm,{...r,...o,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)"}})});pp.displayName=mp;var hp=La,vp=za,xp=Ha,wp=Ba,yp=Ua,Cp=Wa;function Sp({...e}){return a.jsx(hp,{"data-slot":"dropdown-menu",...e})}function bp({...e}){return a.jsx(vp,{"data-slot":"dropdown-menu-trigger",...e})}function Rp({className:e,sideOffset:t=4,...n}){return a.jsx(xp,{children:a.jsx(wp,{"data-slot":"dropdown-menu-content",sideOffset:t,className:ne("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 _p({className:e,children:t,checked:n,...o}){return a.jsxs(yp,{"data-slot":"dropdown-menu-checkbox-item",className:ne("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,...o,children:[a.jsx("span",{className:"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center",children:a.jsx(Cp,{children:a.jsx(ai,{className:"size-4"})})}),t]})}function hr({className:e,...t}){return a.jsx("div",{"data-slot":"table-container",className:"relative w-full overflow-x-auto",children:a.jsx("table",{"data-slot":"table",className:ne("w-full caption-bottom text-sm",e),...t})})}function Ep({className:e,...t}){return a.jsx("thead",{"data-slot":"table-header",className:ne("[&_tr]:border-b",e),...t})}function vr({className:e,...t}){return a.jsx("tbody",{"data-slot":"table-body",className:ne("[&_tr:last-child]:border-0",e),...t})}function le({className:e,...t}){return a.jsx("tr",{"data-slot":"table-row",className:ne("hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",e),...t})}function Mp({className:e,...t}){return a.jsx("th",{"data-slot":"table-head",className:ne("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 P({className:e,...t}){return a.jsx("td",{"data-slot":"table-cell",className:ne("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",e),...t})}function zt({columns:e,data:t,searchColumn:n,searchPlaceholder:o="Filter...",defaultColumnVisibility:r={},pageSize:s=25,defaultSorting:i=[]}){var w,x;const[l,c]=h.useState(i),[d,f]=h.useState([]),[g,m]=h.useState(r),[u,v]=h.useState({}),p=vd({data:t,columns:e,onSortingChange:c,onColumnFiltersChange:f,getCoreRowModel:id(),getPaginationRowModel:fd(),getSortedRowModel:gd(),getFilteredRowModel:dd(),onColumnVisibilityChange:m,onRowSelectionChange:v,initialState:{pagination:{pageSize:s}},state:{sorting:l,columnFilters:d,columnVisibility:g,rowSelection:u}});return a.jsxs("div",{className:"w-full",children:[a.jsxs("div",{className:"flex items-center py-4",children:[n&&a.jsx(bo,{placeholder:o,value:((w=p.getColumn(n))==null?void 0:w.getFilterValue())??"",onChange:y=>{var C;return(C=p.getColumn(n))==null?void 0:C.setFilterValue(y.target.value)},className:"max-w-sm"}),a.jsxs(Sp,{children:[a.jsx(bp,{asChild:!0,children:a.jsxs(ct,{variant:"outline",className:"ml-auto",children:["Columns ",a.jsx(li,{className:"ml-2 h-4 w-4"})]})}),a.jsx(Rp,{align:"end",children:p.getAllColumns().filter(y=>y.getCanHide()).map(y=>a.jsx(_p,{className:"capitalize",checked:y.getIsVisible(),onCheckedChange:C=>y.toggleVisibility(!!C),children:y.id},y.id))})]})]}),a.jsx("div",{className:"rounded-md border",children:a.jsxs(hr,{children:[a.jsx(Ep,{children:p.getHeaderGroups().map(y=>a.jsx(le,{children:y.headers.map(C=>a.jsx(Mp,{children:C.isPlaceholder?null:Hr(C.column.columnDef.header,C.getContext())},C.id))},y.id))}),a.jsx(vr,{children:(x=p.getRowModel().rows)!=null&&x.length?p.getRowModel().rows.map(y=>a.jsx(le,{"data-state":y.getIsSelected()&&"selected",children:y.getVisibleCells().map(C=>a.jsx(P,{children:Hr(C.column.columnDef.cell,C.getContext())},C.id))},y.id)):a.jsx(le,{children:a.jsx(P,{colSpan:e.length,className:"h-24 text-center",children:"No results."})})})]})}),a.jsxs("div",{className:"flex items-center justify-end space-x-2 py-4",children:[a.jsxs("div",{className:"text-muted-foreground flex-1 text-sm",children:[p.getFilteredRowModel().rows.length," row(s) total."]}),a.jsxs("div",{className:"space-x-2",children:[a.jsx(ct,{variant:"outline",size:"sm",onClick:()=>p.previousPage(),disabled:!p.getCanPreviousPage(),children:"Previous"}),a.jsx(ct,{variant:"outline",size:"sm",onClick:()=>p.nextPage(),disabled:!p.getCanNextPage(),children:"Next"})]})]})]})}function X(e,t="left"){return({column:n})=>{const o=t==="right"?"justify-end":t==="center"?"justify-center":"justify-start",r=n.getIsSorted();return a.jsx("div",{className:`flex ${o}`,children:a.jsxs(ct,{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,r==="asc"&&a.jsx(Yc,{className:"ml-1 h-3 w-3 text-muted-foreground"}),r==="desc"&&a.jsx(li,{className:"ml-1 h-3 w-3 text-muted-foreground"})]})})}}const Np=300*1e3;function Ka(e){const[t,n]=h.useState(new Map),o=h.useRef();return h.useEffect(()=>{const s=new Date().toISOString(),i=new Set(e.map(l=>l.id));n(l=>{const c=new Map(l);return e.forEach(d=>{c.set(d.id,{...d,lastSeenAt:s,disconnectedAt:void 0})}),c.forEach((d,f)=>{!i.has(f)&&!d.disconnectedAt&&c.set(f,{...d,isConnected:!1,connectionStatus:"Disconnected",disconnectedAt:s,lastActivity:d.lastActivity||s})}),c})},[e]),h.useEffect(()=>{const s=()=>{const i=Date.now();n(l=>{const c=new Map(l);return c.forEach((d,f)=>{if(d.disconnectedAt){const g=new Date(d.disconnectedAt).getTime();i-g>Np&&c.delete(f)}}),c})};return s(),o.current=setInterval(s,3e4),()=>{o.current&&clearInterval(o.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 gs(e){const t=new Date,n=new Date(e),o=t.getTime()-n.getTime(),r=Math.floor(o/1e3);if(r<60)return"just now";const s=Math.floor(r/60);if(s<60)return`${s}m ago`;const i=Math.floor(s/60);return i<24?`${i}h ago`:`${Math.floor(i/24)}d ago`}function jp(e){const t=Math.floor(e/86400),n=Math.floor(e%86400/3600),o=Math.floor(e%3600/60);return t>0?`${t}d ${n}h ${o}m`:n>0?`${n}h ${o}m`:`${o}m`}function Ap(e){return e.length<=12?e:`${e.slice(0,5)}...${e.slice(-5)}`}function Pp(e){return e.length<=42?e:`${e.slice(0,35)}.....${e.slice(-5)}`}function Ip({metrics:e}){const t=e.sessions||[],n=Ka(t),o=()=>[{accessorKey:"clientInfo",header:X("Client"),cell:({row:r})=>{const s=r.original,i=s.clientInfo?`${Pp(s.clientInfo.name)}@${s.clientInfo.version}`:"unknown";return a.jsx("div",{className:"font-mono text-sm",title:s.clientInfo?`${s.clientInfo.name}@${s.clientInfo.version}`:"unknown",children:i})}},{accessorKey:"id",header:X("Session ID"),cell:({row:r})=>a.jsx("div",{className:"font-mono text-sm",title:r.getValue("id"),children:Ap(r.getValue("id"))})},{accessorKey:"isConnected",header:X("Status"),cell:({row:r})=>{const s=r.original;return a.jsxs(ze,{variant:s.isConnected?"success":"secondary",className:"gap-1",children:[s.isConnected?a.jsx(fi,{className:"h-3 w-3"}):a.jsx(di,{className:"h-3 w-3"}),s.isConnected?"Connected":"Disconnected"]})}},{accessorKey:"connectedAt",header:X("Connected"),cell:({row:r})=>a.jsx("div",{className:"text-sm",children:gs(r.getValue("connectedAt"))})},{accessorKey:"requestCount",header:X("Requests","right"),cell:({row:r})=>a.jsx("div",{className:"text-right font-mono text-sm",children:r.getValue("requestCount")})},{accessorKey:"lastActivity",header:X("Last Activity"),cell:({row:r})=>a.jsx("div",{className:"text-sm",children:gs(r.getValue("lastActivity"))})}];return a.jsxs(He,{children:[a.jsxs(Ge,{children:[a.jsx(Be,{children:"📊 Transport Metrics"}),a.jsx(dt,{children:"Real-time connection and performance metrics for STDIO transport"})]}),a.jsxs(Ue,{className:"space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"Transport Type"}),a.jsx("p",{className:"text-sm font-mono",children:"STDIO"})]}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"Uptime"}),a.jsx("p",{className:"text-sm font-mono",children:jp(e.uptimeSeconds)})]})]}),a.jsxs(a.Fragment,{children:[a.jsx(nt,{}),a.jsxs("div",{children:[a.jsxs("h3",{className:"text-sm font-semibold text-foreground mb-3",children:["Sessions (",n.filter(r=>r.isConnected).length," active,"," ",n.filter(r=>!r.isConnected).length," disconnected)"]}),a.jsx(zt,{columns:o(),data:n,searchColumn:"id",searchPlaceholder:"Filter sessions...",pageSize:10,defaultSorting:[{id:"lastActivity",desc:!0}]})]})]})]})]})}function an(e){const t=new Date,n=new Date(e),o=t.getTime()-n.getTime(),r=Math.floor(o/1e3);if(r<60)return"just now";const s=Math.floor(r/60);if(s<60)return`${s}m ago`;const i=Math.floor(s/60);return i<24?`${i}h ago`:`${Math.floor(i/24)}d ago`}function Tp(e){const t=Math.floor(e/86400),n=Math.floor(e%86400/3600),o=Math.floor(e%3600/60);return t>0?`${t}d ${n}h ${o}m`:n>0?`${n}h ${o}m`:`${o}m`}function ln(e){return e<1e3?`${e}ms`:e<6e4?`${Math.round(e/1e3)}s`:`${Math.round(e/6e4)}m`}function Fp(e){return e.length<=12?e:`${e.slice(0,5)}...${e.slice(-5)}`}function ms(e){return e.length<=42?e:`${e.slice(0,35)}.....${e.slice(-5)}`}function kp(e){const t=new Date,n=new Date(e),o=t.getTime()-n.getTime();return Math.floor(o/6e4)<5}function Dp({metrics:e}){const t=e.sessions||[],n=Ka(t),o={streamableHttp:"Streamable HTTP"},r=()=>[{accessorKey:"clientInfo",header:X("Client"),cell:({row:l})=>{const c=l.original,d=c.clientInfo?`${ms(c.clientInfo.name)}@${c.clientInfo.version}`:"unknown";return a.jsx("div",{className:"font-mono text-sm",title:c.clientInfo?`${c.clientInfo.name}@${c.clientInfo.version}`:"unknown",children:d})}},{accessorKey:"id",header:X("Session ID"),cell:({row:l})=>a.jsx("div",{className:"font-mono text-sm",title:l.getValue("id"),children:Fp(l.getValue("id"))})},{accessorKey:"connectionStatus",header:X("Status"),cell:({row:l})=>{const c=l.original,d=c.connectionStatus||(c.isConnected?"Connected":"Disconnected");return d==="Connected"?a.jsxs(ze,{variant:"success",className:"gap-1",children:[a.jsx(fi,{className:"h-3 w-3"}),"Connected"]}):d==="Distressed"?a.jsxs(ze,{variant:"destructive",className:"gap-1",children:[a.jsx(ui,{className:"h-3 w-3"}),"Distressed ",c.pingFailures?`(${c.pingFailures} failed)`:""]}):a.jsxs(ze,{variant:"secondary",className:"gap-1",children:[a.jsx(di,{className:"h-3 w-3"}),"Disconnected"]})}},{accessorKey:"connectedAt",header:X("Connected"),cell:({row:l})=>a.jsx("div",{className:"text-sm",children:an(l.getValue("connectedAt"))})},{accessorKey:"requestCount",header:X("Requests","right"),cell:({row:l})=>a.jsx("div",{className:"text-right font-mono text-sm",children:l.getValue("requestCount")})},{accessorKey:"lastActivity",header:X("Last Activity"),cell:({row:l})=>a.jsx("div",{className:"text-sm",children:an(l.getValue("lastActivity"))})},{accessorKey:"ipAddress",header:X("IP Address"),cell:({row:l})=>a.jsx("div",{className:"font-mono text-sm",title:l.getValue("ipAddress")||"Unknown",children:l.getValue("ipAddress")||"-"})}],s=()=>[{accessorKey:"name",header:X("Client"),cell:({row:l})=>{const c=l.original,d=`${ms(c.name)}@${c.version}`;return a.jsxs("div",{children:[a.jsx("p",{className:"font-medium font-mono text-sm",title:`${c.name}@${c.version}`,children:d}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:["First seen ",an(c.firstSeen)]})]})}},{accessorKey:"requestCount",header:X("Initializations","right"),cell:({row:l})=>a.jsx("div",{className:"text-right font-mono text-sm",children:l.getValue("requestCount")})},{accessorKey:"toolCallCount",header:X("Tool Calls","right"),cell:({row:l})=>a.jsx("div",{className:"text-right font-mono text-sm",children:l.getValue("toolCallCount")})},{accessorKey:"newIpCount",header:X("New IPs","right"),cell:({row:l})=>a.jsx("div",{className:"text-right font-mono text-sm",children:l.getValue("newIpCount")})},{accessorKey:"anonCount",header:X("Anon/Auth","right"),cell:({row:l})=>{const c=l.original;return a.jsxs("div",{className:"text-right font-mono text-sm",children:[c.anonCount,"/",c.uniqueAuthCount]})}},{accessorKey:"isConnected",header:X("Status"),cell:({row:l})=>{const c=l.original;return a.jsx("div",{children:kp(c.lastSeen)?a.jsxs(ze,{variant:"success",className:"gap-1",children:[a.jsx(ii,{className:"h-3 w-3"}),"Recent"]}):a.jsxs(ze,{variant:"secondary",className:"gap-1",children:[a.jsx(ci,{className:"h-3 w-3"}),"Idle"]})})}},{accessorKey:"lastSeen",header:X("Last Seen","right"),cell:({row:l})=>a.jsx("div",{className:"text-right text-sm",children:an(l.getValue("lastSeen"))})}],i=e.clients;return a.jsxs(He,{children:[a.jsxs(Ge,{children:[a.jsx(Be,{children:"📊 Transport Metrics"}),a.jsxs(dt,{children:["Real-time connection and performance metrics for"," ",o[e.transport]||e.transport," transport"]})]}),a.jsxs(Ue,{className:"space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"Transport Type"}),a.jsx("p",{className:"text-sm font-mono",children:o[e.transport]||e.transport})]}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"Uptime"}),a.jsx("p",{className:"text-sm font-mono",children:Tp(e.uptimeSeconds)})]})]}),e.configuration&&a.jsx(a.Fragment,{children:a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium text-muted-foreground mb-2",children:"Configuration"}),a.jsx("div",{className:"grid grid-cols-1 gap-2",children:e.pings&&a.jsx("div",{className:"text-xs text-muted-foreground bg-muted/30 p-2 rounded",children:e.pings.sent>0&&a.jsxs("p",{children:[a.jsx("span",{className:"font-medium",children:"Ping Status:"})," ",e.pings.successful,"/",e.pings.sent," successful (",e.pings.sent>0?Math.round(e.pings.successful/e.pings.sent*100):0,"%)"]})})}),a.jsxs("p",{className:"text-xs text-muted-foreground mt-2",children:["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":""}`]})]})}),a.jsx(nt,{}),a.jsx("div",{children:a.jsx(hr,{children:a.jsxs(vr,{children:[a.jsxs(le,{children:[a.jsx(P,{className:"font-medium text-sm",children:"Active Connections"}),a.jsx(P,{className:"text-sm font-mono",children:e.connections.active}),a.jsx(P,{className:"font-medium text-sm",children:"Cleaned Sessions"}),a.jsx(P,{className:"text-sm font-mono",children:e.connections.cleaned??0})]}),a.jsxs(le,{children:[a.jsx(P,{className:"font-medium text-sm",children:"Total Connections"}),a.jsx(P,{className:"text-sm font-mono",children:e.connections.total}),a.jsx(P,{className:"font-medium text-sm",children:"Requests per Minute (tot/3hr/hr)"}),a.jsxs(P,{className:"text-sm font-mono",children:[e.requests.averagePerMinute,"/",e.requests.last3Hours,"/",e.requests.lastHour]})]}),a.jsxs(le,{children:[a.jsx(P,{className:"font-medium text-sm",children:"Unique IPs"}),a.jsx(P,{className:"text-sm font-mono",children:e.connections.uniqueIps??0}),a.jsx(P,{className:"font-medium text-sm",children:"Client/Server Errors (4xx/5xx)"}),a.jsxs(P,{className:"text-sm font-mono",children:[e.errors.expected,"/",e.errors.unexpected]})]}),e.sessionLifecycle&&a.jsxs(le,{children:[a.jsx(P,{className:"font-medium text-sm",children:"Sessions New/Res-fail/Del"}),a.jsxs(P,{className:"text-sm font-mono",colSpan:3,children:[e.sessionLifecycle.created,"/",e.sessionLifecycle.resumedFailed,"/",e.sessionLifecycle.deleted]})]}),e.pings&&a.jsxs(le,{children:[a.jsx(P,{className:"font-medium text-sm",children:"Pings Sent"}),a.jsx(P,{className:"text-sm font-mono",children:e.pings.sent}),a.jsx(P,{className:"font-medium text-sm",children:"Ping Success Rate"}),a.jsx(P,{className:"text-sm font-mono",children:e.pings.sent>0?`${Math.round(e.pings.successful/e.pings.sent*100)}%`:"-"})]}),e.apiMetrics&&a.jsxs(a.Fragment,{children:[a.jsxs(le,{children:[a.jsx(P,{className:"font-medium text-sm",children:"Anonymous Users"}),a.jsx(P,{className:"text-sm font-mono",children:e.apiMetrics.anonymous}),a.jsx(P,{className:"font-medium text-sm",children:"Authenticated Users"}),a.jsx(P,{className:"text-sm font-mono",children:e.apiMetrics.authenticated})]}),a.jsxs(le,{children:[a.jsx(P,{className:"font-medium text-sm",children:"401 Unauthorized Users"}),a.jsx(P,{className:"text-sm font-mono",children:e.apiMetrics.unauthorized}),a.jsx(P,{className:"font-medium text-sm",children:"403 Forbidden Users"}),a.jsx(P,{className:"text-sm font-mono",children:e.apiMetrics.forbidden})]})]}),a.jsxs(le,{children:[a.jsx(P,{className:"font-medium text-sm",children:"Gradio Success/Fail"}),a.jsx(P,{className:"text-sm font-mono",children:e.gradioMetrics?`${e.gradioMetrics.success}/${e.gradioMetrics.failure}`:"0/0"}),a.jsx(P,{className:"font-medium text-sm",children:"-"}),a.jsx(P,{className:"text-sm font-mono",children:"-"})]})]})})}),a.jsxs(a.Fragment,{children:[a.jsx(nt,{}),a.jsxs("div",{children:[a.jsxs("h3",{className:"text-sm font-semibold text-foreground mb-3",children:["Sessions (",n.filter(l=>l.isConnected).length," active,"," ",n.filter(l=>!l.isConnected).length," disconnected)"]}),a.jsx(zt,{columns:r(),data:n,searchColumn:"id",searchPlaceholder:"Filter sessions...",pageSize:10,defaultSorting:[{id:"lastActivity",desc:!0}]})]})]}),a.jsxs(a.Fragment,{children:[a.jsx(nt,{}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-sm font-semibold text-foreground mb-3",children:"Client Identities"}),a.jsx(zt,{columns:s(),data:i,searchColumn:"name",searchPlaceholder:"Filter clients...",pageSize:50,defaultSorting:[{id:"lastSeen",desc:!0}]})]})]})]})]})}function ps(e){const t=new Date,n=new Date(e),o=t.getTime()-n.getTime(),r=Math.floor(o/1e3);if(r<60)return"just now";const s=Math.floor(r/60);if(s<60)return`${s}m ago`;const i=Math.floor(s/60);return i<24?`${i}h ago`:`${Math.floor(i/24)}d ago`}function Op(e){const t=Math.floor(e/86400),n=Math.floor(e%86400/3600),o=Math.floor(e%3600/60);return t>0?`${t}d ${n}h ${o}m`:n>0?`${n}h ${o}m`:`${o}m`}function $p(e){const t=new Date,n=new Date(e),o=t.getTime()-n.getTime();return Math.floor(o/6e4)<5}function Lp(e){return e.length<=42?e:`${e.slice(0,35)}.....${e.slice(-5)}`}function Vp({metrics:e}){const t=e.clients,n=()=>[{accessorKey:"name",header:X("Client"),cell:({row:o})=>{const r=o.original,s=`${Lp(r.name)}@${r.version}`;return a.jsxs("div",{children:[a.jsx("p",{className:"font-medium font-mono text-sm",title:`${r.name}@${r.version}`,children:s}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:["First seen ",ps(r.firstSeen)]})]})}},{accessorKey:"requestCount",header:X("Initializations","right"),cell:({row:o})=>a.jsx("div",{className:"text-right font-mono text-sm",children:o.getValue("requestCount")})},{accessorKey:"toolCallCount",header:X("Tool Calls","right"),cell:({row:o})=>a.jsx("div",{className:"text-right font-mono text-sm",children:o.getValue("toolCallCount")})},{accessorKey:"newIpCount",header:X("New IPs","right"),cell:({row:o})=>a.jsx("div",{className:"text-right font-mono text-sm",children:o.getValue("newIpCount")})},{accessorKey:"anonCount",header:X("Anon/Auth","right"),cell:({row:o})=>{const r=o.original;return a.jsxs("div",{className:"text-right font-mono text-sm",children:[r.anonCount,"/",r.uniqueAuthCount]})}},{accessorKey:"isConnected",header:X("Status"),cell:({row:o})=>{const r=o.original;return a.jsx("div",{children:$p(r.lastSeen)?a.jsxs(ze,{variant:"success",className:"gap-1",children:[a.jsx(ii,{className:"h-3 w-3"}),"Recent"]}):a.jsxs(ze,{variant:"secondary",className:"gap-1",children:[a.jsx(ci,{className:"h-3 w-3"}),"Idle"]})})}},{accessorKey:"lastSeen",header:X("Last Seen","right"),cell:({row:o})=>a.jsx("div",{className:"text-right text-sm",children:ps(o.getValue("lastSeen"))})}];return a.jsxs(He,{children:[a.jsxs(Ge,{children:[a.jsx(Be,{children:"📊 Transport Metrics"}),a.jsx(dt,{children:"Real-time connection and performance metrics for Stateless HTTP JSON transport"})]}),a.jsxs(Ue,{className:"space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"Transport Type"}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("p",{className:"text-sm font-mono",children:"Stateless HTTP JSON"}),a.jsx(ze,{variant:"secondary",children:e.sessionLifecycle?"analytics":"stateless"})]})]}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"Uptime"}),a.jsx("p",{className:"text-sm font-mono",children:Op(e.uptimeSeconds)})]})]}),a.jsx(nt,{}),a.jsx("div",{children:a.jsx(hr,{children:a.jsxs(vr,{children:[a.jsxs(le,{children:[a.jsx(P,{className:"font-medium text-sm",children:"Request Count (MCP)"}),a.jsx(P,{className:"text-sm font-mono",children:e.requests.total}),a.jsx(P,{className:"font-medium text-sm",children:"Requests per Minute (tot/3hr/hr)"}),a.jsxs(P,{className:"text-sm font-mono",children:[e.requests.averagePerMinute,"/",e.requests.last3Hours,"/",e.requests.lastHour]})]}),a.jsxs(le,{children:[a.jsx(P,{className:"font-medium text-sm",children:"Unique IPs"}),a.jsx(P,{className:"text-sm font-mono",children:e.connections.uniqueIps??0}),a.jsx(P,{className:"font-medium text-sm",children:"Client/Server Errors (4xx/5xx)"}),a.jsxs(P,{className:"text-sm font-mono",children:[e.errors.expected,"/",e.errors.unexpected]})]}),(e.staticPageHits200!==void 0||e.staticPageHits405!==void 0)&&a.jsxs(le,{children:[a.jsx(P,{className:"font-medium text-sm",children:a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(tu,{className:"h-3 w-3"}),"hf.co/mcp (200/405)"]})}),a.jsxs(P,{className:"text-sm font-mono",children:[e.staticPageHits200||0,"/",e.staticPageHits405||0]}),a.jsx(P,{className:"font-medium text-sm",children:a.jsx("div",{className:"flex items-center gap-1",children:"Auth Status (Anon/Auth/401)"})}),a.jsxs(P,{className:"text-sm font-mono",children:[e.connections.anonymous,"/",e.connections.authenticated,"/",e.connections.unauthorized||0]})]}),e.apiMetrics&&a.jsxs(a.Fragment,{children:[a.jsxs(le,{children:[a.jsx(P,{className:"font-medium text-sm",children:"Tool API - Anonymous"}),a.jsx(P,{className:"text-sm font-mono",children:e.apiMetrics.anonymous}),a.jsx(P,{className:"font-medium text-sm",children:"Tool API - Authenticated"}),a.jsx(P,{className:"text-sm font-mono",children:e.apiMetrics.authenticated})]}),a.jsxs(le,{children:[a.jsx(P,{className:"font-medium text-sm",children:"Tool API - 401 Unauthorized"}),a.jsx(P,{className:"text-sm font-mono",children:e.apiMetrics.unauthorized}),a.jsx(P,{className:"font-medium text-sm",children:"Tool API - 403 Forbidden"}),a.jsx(P,{className:"text-sm font-mono",children:e.apiMetrics.forbidden})]})]}),a.jsxs(le,{children:[a.jsx(P,{className:"font-medium text-sm",children:"Gradio Success/Fail"}),a.jsx(P,{className:"text-sm font-mono",children:e.gradioMetrics?`${e.gradioMetrics.success}/${e.gradioMetrics.failure}`:"0/0"}),e.sessionLifecycle?a.jsxs(a.Fragment,{children:[a.jsx(P,{className:"font-medium text-sm",children:"Sessions New/Res-fail/Del"}),a.jsxs(P,{className:"text-sm font-mono",children:[e.sessionLifecycle.created,"/",e.sessionLifecycle.resumedFailed,"/",e.sessionLifecycle.deleted]})]}):a.jsxs(a.Fragment,{children:[a.jsx(P,{className:"font-medium text-sm",children:"-"}),a.jsx(P,{className:"text-sm font-mono",children:"-"})]})]})]})})}),a.jsxs(a.Fragment,{children:[a.jsx(nt,{}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-sm font-semibold text-foreground mb-3",children:"Client Identities"}),a.jsx(zt,{columns:n(),data:t,searchColumn:"name",searchPlaceholder:"Filter clients...",pageSize:50,defaultSorting:[{id:"lastSeen",desc:!0}]})]})]})]})]})}const zp=e=>fetch(e).then(t=>{if(!t.ok)throw new Error(`Failed to fetch: ${t.status}`);return t.json()});function Hp(){const{data:e,error:t}=It("/api/transport-metrics",zp,{refreshInterval:3e3,revalidateOnFocus:!0,revalidateOnReconnect:!0});return t?a.jsxs(He,{children:[a.jsx(Ge,{children:a.jsx(Be,{children:"📊 Transport Metrics"})}),a.jsx(Ue,{children:a.jsxs(gu,{variant:"destructive",children:[a.jsx(ui,{className:"h-4 w-4"}),a.jsx(mu,{children:"Error Loading Metrics"}),a.jsxs(pu,{children:["Failed to load transport metrics: ",t.message]})]})})]}):e?e.transport==="stdio"?a.jsx(Ip,{metrics:e}):e.isStateless?a.jsx(Vp,{metrics:e}):a.jsx(Dp,{metrics:e}):a.jsxs(He,{children:[a.jsx(Ge,{children:a.jsx(Be,{children:"📊 Transport Metrics"})}),a.jsx(Ue,{children:a.jsxs("div",{className:"animate-pulse space-y-2",children:[a.jsx("div",{className:"h-4 bg-gray-200 rounded w-3/4"}),a.jsx("div",{className:"h-4 bg-gray-200 rounded w-1/2"}),a.jsx("div",{className:"h-4 bg-gray-200 rounded w-2/3"})]})})]})}const Gp=e=>fetch(e).then(t=>{if(!t.ok)throw new Error(`Failed to fetch: ${t.status}`);return t.json()});function Bp(){const[e,t]=h.useState(!1),{data:n,error:o}=It("/api/transport-metrics",Gp,{refreshInterval:3e3,revalidateOnFocus:!0,revalidateOnReconnect:!0}),r=!n&&!o,s=(n==null?void 0:n.transport)==="stdio",i=((n==null?void 0:n.methods)||[]).map(u=>{let v=u.errors,p,w;if(u.method.startsWith("tools/call:")&&(n!=null&&n.gradioMetrics)){const C=u.method.replace("tools/call:",""),S=n.gradioMetrics.byTool;S[C]&&(p=S[C].success,w=S[C].failure,v+=w)}const x=u.count>0?v/u.count*100:0;return{method:u.method,count:u.count,errors:v,errorRate:x,averageResponseTime:u.averageResponseTime,lastCalled:u.lastCalled,gradioSuccess:p,gradioFailure:w}}),l=e?i.filter(u=>u.method.startsWith("tools/call")||u.method.startsWith("prompts/get")||u.method.startsWith("resources/read")):i,c=i.reduce((u,v)=>u+v.count,0),d=i.filter(u=>u.method.startsWith("tools/call")).reduce((u,v)=>u+v.count,0),f=i.filter(u=>u.method.startsWith("prompts/get")).reduce((u,v)=>u+v.count,0),g=i.filter(u=>u.method.startsWith("resources/read")).reduce((u,v)=>u+v.count,0),m=[{accessorKey:"method",header:X("Method"),cell:({row:u})=>{const v=u.getValue("method");return a.jsx("div",{className:"font-mono text-sm",children:v==="tools/call"?a.jsx("span",{className:"text-blue-600 dark:text-blue-400",children:"tools/call"}):v.startsWith("tools/call:")?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"text-blue-600 dark:text-blue-400",children:"tools/call:"}),a.jsx("span",{className:"text-green-600 dark:text-green-400",children:v.replace("tools/call:","")})]}):v==="prompts/get"?a.jsx("span",{className:"text-purple-600 dark:text-purple-400",children:"prompts/get"}):v.startsWith("prompts/get:")?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"text-purple-600 dark:text-purple-400",children:"prompts/get:"}),a.jsx("span",{className:"text-orange-600 dark:text-orange-400",children:v.replace("prompts/get:","")})]}):v==="resources/read"?a.jsx("span",{className:"text-cyan-600 dark:text-cyan-400",children:"resources/read"}):v.startsWith("resources/read:")?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"text-cyan-600 dark:text-cyan-400",children:"resources/read:"}),a.jsx("span",{className:"text-teal-600 dark:text-teal-400 break-all",children:v.replace("resources/read:","")})]}):v})}},{accessorKey:"count",header:X("Calls","right"),cell:({row:u})=>a.jsx("div",{className:"text-right font-mono",children:u.getValue("count").toLocaleString()})},{accessorKey:"errors",header:X("Errors","right"),cell:({row:u})=>{const v=u.getValue("errors");return a.jsx("div",{className:"text-right font-mono",children:v>0?a.jsx("span",{className:"text-red-600 dark:text-red-400",children:v}):"0"})}},{accessorKey:"gradioMetrics",header:X("Success/Failure","right"),cell:({row:u})=>{const v=u.original;return v.gradioSuccess!==void 0&&v.gradioFailure!==void 0?a.jsxs("div",{className:"text-right font-mono text-sm",children:[a.jsx("span",{className:"text-green-600 dark:text-green-400",children:v.gradioSuccess}),a.jsx("span",{className:"text-muted-foreground",children:"/"}),a.jsx("span",{className:"text-red-600 dark:text-red-400",children:v.gradioFailure})]}):a.jsx("div",{className:"text-right text-muted-foreground",children:"—"})}},{accessorKey:"errorRate",header:X("Error Rate","right"),cell:({row:u})=>{const v=u.getValue("errorRate");return a.jsx("div",{className:"text-right font-mono",children:v>0?a.jsxs("span",{className:"text-red-600 dark:text-red-400",children:[v.toFixed(1),"%"]}):"0%"})}},{accessorKey:"averageResponseTime",header:X("Avg Response","right"),cell:({row:u})=>{const v=u.getValue("averageResponseTime");return a.jsx("div",{className:"text-right font-mono",children:v?`${v.toFixed(0)}ms`:"—"})}},{accessorKey:"lastCalled",header:X("Last Called","right"),cell:({row:u})=>a.jsx("div",{className:"text-right text-sm text-muted-foreground",children:new Date(u.getValue("lastCalled")).toLocaleTimeString()})}];return a.jsxs(He,{children:[a.jsxs(Ge,{children:[a.jsx(Be,{children:"HTTP JSON Transport Statistics"}),a.jsxs(dt,{children:["MCP method call statistics and performance metrics",s?" (Empty in STDIO mode)":n!=null&&n.isStateless?"":" (Response times not available in stateful modes)"]})]}),a.jsxs(Ue,{children:[r&&a.jsx("div",{className:"flex items-center justify-center py-8",children:a.jsx("div",{className:"text-sm text-muted-foreground",children:"Loading metrics..."})}),o&&a.jsx("div",{className:"flex items-center justify-center py-8",children:a.jsxs("div",{className:"text-sm text-destructive",children:["Error loading metrics: ",o.message]})}),s&&a.jsx("div",{className:"flex items-center justify-center py-8",children:a.jsx("div",{className:"text-sm text-muted-foreground",children:"Method tracking is not available in STDIO mode. This data is only collected for HTTP-based transports."})}),n&&!s&&a.jsxs("div",{className:"space-y-4",children:[i.length>0&&a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"text-sm text-muted-foreground",children:["Showing ",l.length," method",l.length!==1?"s":""," tracked since"," ",new Date(n.startupTime).toLocaleString()]}),a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsxs("div",{className:"text-sm font-medium",children:["Total MCP Calls: ",a.jsx("span",{className:"font-mono",children:c.toLocaleString()})]}),a.jsxs("div",{className:"text-sm font-medium",children:["Tool Calls: ",a.jsx("span",{className:"font-mono",children:d.toLocaleString()})]}),a.jsxs("div",{className:"text-sm font-medium",children:["Prompt Calls: ",a.jsx("span",{className:"font-mono",children:f.toLocaleString()})]}),a.jsxs("div",{className:"text-sm font-medium",children:["Resource Reads: ",a.jsx("span",{className:"font-mono",children:g.toLocaleString()})]})]})]}),i.length>0&&a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(qo,{id:"tool-prompt-calls-filter",checked:e,onCheckedChange:u=>t(!!u)}),a.jsx("label",{htmlFor:"tool-prompt-calls-filter",className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 cursor-pointer",children:"Show only Tools/Prompts/Resources"})]}),l.length===0?a.jsx("div",{className:"flex items-center justify-center py-8",children:a.jsx("div",{className:"text-sm text-muted-foreground",children:e?"No tool, prompt, or resource calls recorded yet.":"No method calls recorded yet."})}):a.jsx(zt,{columns:m,data:l,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 hs(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 Up({isLoading:e,error:t,transportInfo:n}){const o=()=>{switch(n.transport){case"stdio":return"STDIO";case"streamableHttp":case"streamableHttpJson":return"Streamable HTTP";default:return"Unknown"}},r=()=>{switch(n.transport){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()?a.jsx("span",{className:"ml-1.5 px-1.5 py-0.5 bg-green-100 text-green-800 text-[10px] rounded-sm whitespace-nowrap",children:"JSON (stateless)"}):n.transport==="streamableHttp"?a.jsx("span",{className:"ml-1.5 px-1.5 py-0.5 bg-blue-100 text-blue-800 text-[10px] rounded-sm whitespace-nowrap",children:"Session Based"}):null;if(e)return a.jsx("div",{className:"text-center text-xs text-muted-foreground py-2",children:"Loading connection information..."});if(t)return a.jsxs("div",{className:"text-center text-xs text-destructive py-2",children:["Error: ",t]});const l=n.port||3e3,c=n.transport!=="stdio";return a.jsx("div",{className:"fixed bottom-0 left-0 w-full bg-muted/50 border-t border-border py-2 px-4",children:a.jsxs("div",{className:"max-w-[700px] mx-auto flex justify-between items-center text-xs",children:[a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("span",{className:"text-muted-foreground",children:"Using"}),a.jsx("span",{className:"font-medium text-primary",children:o()}),n.transport==="stdio"&&a.jsxs("span",{className:"text-muted-foreground flex items-center",children:["Client Info :",n.stdioClient?a.jsx("span",{className:"ml-2 flex items-center",children:a.jsxs("span",{className:"ml-1 font-medium text-green-700",children:[n.stdioClient.name," ",n.stdioClient.version]})}):a.jsx("span",{className:"ml-2 text-muted-foreground",children:" (disconnected) "})]}),c&&a.jsxs("span",{className:"text-muted-foreground flex items-center",children:["on port ",a.jsx("span",{className:"font-mono mx-1",children:l}),"at ",a.jsx("span",{className:"font-mono mx-1",children:r()}),i()]})]}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("span",{className:"text-muted-foreground",children:" Default HF Token:"}),a.jsx("span",{className:`font-mono ${hs(n).isWarning?"text-red-500":""}`,children:hs(n).text})]})]})})}var Fn="Tabs",[Wp]=ft(Fn,[jn]),qa=jn(),[Kp,xr]=Wp(Fn),Xa=h.forwardRef((e,t)=>{const{__scopeTabs:n,value:o,onValueChange:r,defaultValue:s,orientation:i="horizontal",dir:l,activationMode:c="automatic",...d}=e,f=er(l),[g,m]=Sn({prop:o,onChange:r,defaultProp:s??"",caller:Fn});return a.jsx(Kp,{scope:n,baseId:gn(),value:g,onValueChange:m,orientation:i,dir:f,activationMode:c,children:a.jsx(oe.div,{dir:f,"data-orientation":i,...d,ref:t})})});Xa.displayName=Fn;var Ya="TabsList",Ja=h.forwardRef((e,t)=>{const{__scopeTabs:n,loop:o=!0,...r}=e,s=xr(Ya,n),i=qa(n);return a.jsx(ra,{asChild:!0,...i,orientation:s.orientation,dir:s.dir,loop:o,children:a.jsx(oe.div,{role:"tablist","aria-orientation":s.orientation,...r,ref:t})})});Ja.displayName=Ya;var Za="TabsTrigger",Qa=h.forwardRef((e,t)=>{const{__scopeTabs:n,value:o,disabled:r=!1,...s}=e,i=xr(Za,n),l=qa(n),c=nl(i.baseId,o),d=ol(i.baseId,o),f=o===i.value;return a.jsx(sa,{asChild:!0,...l,focusable:!r,active:f,children:a.jsx(oe.button,{type:"button",role:"tab","aria-selected":f,"aria-controls":d,"data-state":f?"active":"inactive","data-disabled":r?"":void 0,disabled:r,id:c,...s,ref:t,onMouseDown:z(e.onMouseDown,g=>{!r&&g.button===0&&g.ctrlKey===!1?i.onValueChange(o):g.preventDefault()}),onKeyDown:z(e.onKeyDown,g=>{[" ","Enter"].includes(g.key)&&i.onValueChange(o)}),onFocus:z(e.onFocus,()=>{const g=i.activationMode!=="manual";!f&&!r&&g&&i.onValueChange(o)})})})});Qa.displayName=Za;var el="TabsContent",tl=h.forwardRef((e,t)=>{const{__scopeTabs:n,value:o,forceMount:r,children:s,...i}=e,l=xr(el,n),c=nl(l.baseId,o),d=ol(l.baseId,o),f=o===l.value,g=h.useRef(f);return h.useEffect(()=>{const m=requestAnimationFrame(()=>g.current=!1);return()=>cancelAnimationFrame(m)},[]),a.jsx(gt,{present:r||f,children:({present:m})=>a.jsx(oe.div,{"data-state":f?"active":"inactive","data-orientation":l.orientation,role:"tabpanel","aria-labelledby":c,hidden:!m,id:d,tabIndex:0,...i,ref:t,style:{...e.style,animationDuration:g.current?"0s":void 0},children:m&&s})})});tl.displayName=el;function nl(e,t){return`${e}-trigger-${t}`}function ol(e,t){return`${e}-content-${t}`}var qp=Xa,Xp=Ja,Yp=Qa,Jp=tl;function Zp({className:e,...t}){return a.jsx(qp,{"data-slot":"tabs",className:ne("flex flex-col gap-2",e),...t})}function Qp({className:e,...t}){return a.jsx(Xp,{"data-slot":"tabs-list",className:ne("bg-muted text-muted-foreground inline-flex h-9 w-fit items-center justify-center rounded-lg p-[3px]",e),...t})}function yt({className:e,...t}){return a.jsx(Yp,{"data-slot":"tabs-trigger",className:ne("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 Ct({className:e,...t}){return a.jsx(Jp,{"data-slot":"tabs-content",className:ne("flex-1 outline-none",e),...t})}const vs="ALLOW_README_INCLUDE",xs="NO_GRADIO_IMAGE_CONTENT",eh=new Intl.DateTimeFormat("en-GB",{day:"numeric",month:"long",year:"numeric",timeZone:"UTC"}).format(new Date),Do={name:"space_search",description:"Find Hugging Face Spaces using semantic search. IMPORTANT Only MCP Servers can be used with the dynamic_space toolInclude links to the Space when presenting the results.",annotations:{title:"Hugging Face Space Search"}},Oo={name:"hub_repo_search",description:"Search Hugging Face repositories with a shared query interface. You can target models, datasets, spaces, or aggregate across multiple repo types in one call. Use space_search for semantic-first discovery of Spaces. Include links to repositories in your response.",annotations:{title:"Repo Search"}},$o={name:"create_repo",description:"Create a Hugging Face model, dataset, Space, or bucket repository. name must be fully qualified, for example 'username/repo-name'.",annotations:{title:"Create Hugging Face Repository"}},Lo={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.",annotations:{title:"Paper Search"}},Vo={name:"hub_repo_details",description:"Get details for one or more Hugging Face repos (model, dataset, or space). Auto-detects type unless specified. For datasets, use dataset_structure first to discover configs, splits, sizes, and schema. Use dataset_preview only when config and split are known, unless the dataset has a single config/split.",annotations:{title:"Hub Repo Details"}},rl={name:"duplicate_space",annotations:{title:"Duplicate Hugging Face Space"}},sl={name:"space_files",annotations:{title:"Space Files List"}},zo={name:"hf_doc_search",description:`Search and Discover Hugging Face Product and Library documentation. Send an empty query to discover structure and navigation instructions. Knowledge up-to-date as at ${eh}. Combine with the Product filter to focus results.`,annotations:{title:"Hugging Face Documentation Search"}},Ho={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.",annotations:{title:"Fetch a document from the Hugging Face documentation library"}},ws=Do.name,th="model_search",yn=Oo.name,ys=$o.name,nh="model_details",Cs=Lo.name,oh="dataset_search",rh="dataset_details",Ft=Vo.name,Ss=rl.name,bs=sl.name,Rs=zo.name,_s=Ho.name,sh=new Set([th,"model-search","hf_model_search"]),ih=new Set([oh,"dataset-search","hf_dataset_search"]),ah=new Set([yn,"repo_search","repo-search","hf_repo_search"]);function lh(e){return sh.has(e)||ih.has(e)||ah.has(e)?yn:e}function Es(e){const t=new Set,n=[];let o=!1;for(const r of e){const s=lh(r);if(s===nh||s===rh){o=!0;continue}t.has(s)||(t.add(s),n.push(s))}return o&&!t.has(Ft)&&(t.add(Ft),n.push(Ft)),n}const uo=e=>fetch(e).then(t=>{if(!t.ok)throw new Error(`Failed to fetch: ${t.status}`);return t.json()});function ch(){var b,F,k,G,q,H,D,Y,L,U,_;const{data:e,error:t}=It("/api/transport",uo,{refreshInterval:3e3,revalidateOnFocus:!0,revalidateOnReconnect:!0});It("/api/sessions",uo,{refreshInterval:3e3,revalidateOnFocus:!0});const{data:n}=It("/api/settings",uo),o=((b=n==null?void 0:n.builtInTools)==null?void 0:b.includes(vs))??!1,r=((F=n==null?void 0:n.builtInTools)==null?void 0:F.includes(xs))??!1,[s,i]=h.useState(["","",""]),[l,c]=h.useState(["","",""]),[d,f]=h.useState([!1,!1,!1]),[g,m]=h.useState(!1);h.useEffect(()=>{if(n!=null&&n.spaceTools&&!g){const M=["","",""],$=["","",""],O=[!1,!1,!1];n.spaceTools.forEach((B,J)=>{J<3&&(M[J]=B.name,$[J]=B.subdomain,O[J]=!0)}),i(M),c($),f(O),m(!0)}},[n,g]);const u=!e&&!t,v=t?t.message:null,p=async(M,$)=>{try{const O=n||{builtInTools:[]},B=Es(O.builtInTools),J=$?[...B.filter(W=>W!==M),M]:B.filter(W=>W!==M),ee=Es(J),ce={...O,builtInTools:ee};cn("/api/settings",ce,!1);const ue=await fetch("/api/settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({builtInTools:ee})});if(!ue.ok)throw new Error(`Failed to update tool settings: ${ue.status}`);cn("/api/settings"),console.log(`${M} is now ${$?"enabled":"disabled"}`)}catch(O){console.error("Error updating tool settings:",O),alert(`Error updating ${M}: ${O instanceof Error?O.message:"Unknown error"}`),cn("/api/settings")}},w=async(M,$)=>{const O=[...d];O[M]=$,f(O),await C(O)},x=async(M,$)=>{const O=[...s];O[M]=$,i(O),d[M]&&await C(d)},y=async(M,$)=>{const O=[...l];O[M]=$,c(O),d[M]&&await C(d)},C=async M=>{try{const $=[];for(let B=0;B<3;B++)M[B]&&s[B]&&l[B]&&$.push({_id:`space-${B}`,name:s[B],subdomain:l[B],emoji:"🔧"});const O=await fetch("/api/settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({spaceTools:$})});if(!O.ok)throw new Error(`Failed to update space tools: ${O.status}`)}catch($){console.error("Error updating space tools:",$)}},S=async()=>{const M="https://huggingface.co/mcp";try{await navigator.clipboard.writeText(M)}catch($){console.error("Failed to copy URL:",$)}},R=()=>{window.open("https://huggingface.co/settings/mcp","_blank")},N={paper_search:{id:Cs,label:Lo.annotations.title,description:Lo.description,settings:{enabled:((k=n==null?void 0:n.builtInTools)==null?void 0:k.includes(Cs))??!0}},space_search:{id:ws,label:Do.annotations.title,description:Do.description,settings:{enabled:((G=n==null?void 0:n.builtInTools)==null?void 0:G.includes(ws))??!0}},hub_repo_search:{id:yn,label:Oo.annotations.title,description:Oo.description,settings:{enabled:((q=n==null?void 0:n.builtInTools)==null?void 0:q.includes(yn))??!0}},create_repo:{id:ys,label:$o.annotations.title,description:$o.description,settings:{enabled:((H=n==null?void 0:n.builtInTools)==null?void 0:H.includes(ys))??!0}},hub_repo_details:{id:Ft,label:Vo.annotations.title,description:Vo.description,settings:{enabled:((D=n==null?void 0:n.builtInTools)==null?void 0:D.includes(Ft))??!0}},include_readme:{id:vs,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:o}},doc_semantic_search:{id:Rs,label:zo.annotations.title,description:zo.description,settings:{enabled:((Y=n==null?void 0:n.builtInTools)==null?void 0:Y.includes(Rs))??!0}},doc_fetch:{id:_s,label:Ho.annotations.title,description:Ho.description,settings:{enabled:((L=n==null?void 0:n.builtInTools)==null?void 0:L.includes(_s))??!0}}},E={duplicate_space:{id:Ss,label:rl.annotations.title,description:"Duplicate a Hugging Face Space to your account.",settings:{enabled:((U=n==null?void 0:n.builtInTools)==null?void 0:U.includes(Ss))??!0}},space_files:{id:bs,label:sl.annotations.title,description:"List all files in a static Hugging Face Space with download URLs.",settings:{enabled:((_=n==null?void 0:n.builtInTools)==null?void 0:_.includes(bs))??!0}},no_gradio_images:{id:xs,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:r}}};return a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"min-h-screen p-4 sm:p-8 pb-20",children:a.jsx("div",{className:"max-w-4xl mx-auto",children:a.jsxs(Zp,{defaultValue:"metrics",className:"w-full",children:[a.jsxs(Qp,{className:"mb-6 w-full overflow-x-auto flex-nowrap",children:[a.jsx(yt,{value:"metrics",className:"whitespace-nowrap",children:"📊 Metrics"}),a.jsx(yt,{value:"mcp",className:"whitespace-nowrap",children:"🔧 MCP"}),!(e!=null&&e.externalApiMode)&&a.jsx(yt,{value:"search",className:"whitespace-nowrap",children:"🔍 Search"}),!(e!=null&&e.externalApiMode)&&a.jsx(yt,{value:"spaces",className:"whitespace-nowrap",children:"🚀 Spaces"}),!(e!=null&&e.externalApiMode)&&a.jsx(yt,{value:"gradio",className:"whitespace-nowrap",children:"🚀 Gradio"}),a.jsx(yt,{value:"home",className:"whitespace-nowrap",children:"🏠 Home"})]}),a.jsx(Ct,{value:"metrics",className:"mt-0",children:a.jsx(Hp,{})}),a.jsx(Ct,{value:"mcp",className:"mt-0",children:a.jsx(Bp,{})}),!(e!=null&&e.externalApiMode)&&a.jsx(Ct,{value:"search",className:"mt-0",children:a.jsx(Dr,{title:"🤗 Hugging Face Search Tools (MCP)",description:"Find and use Hugging Face and Community content.",tools:N,onToolToggle:p})}),!(e!=null&&e.externalApiMode)&&a.jsx(Ct,{value:"spaces",className:"mt-0",children:a.jsx(Dr,{title:"🤗 Hugging Face Space Tools (MCP)",description:"Manage and duplicate Hugging Face Spaces.",tools:E,onToolToggle:p})}),!(e!=null&&e.externalApiMode)&&a.jsx(Ct,{value:"gradio",className:"mt-0",children:a.jsx(du,{spaceNames:s,spaceSubdomains:l,enabledSpaces:d,onSpaceToolToggle:w,onSpaceToolNameChange:x,onSpaceToolSubdomainChange:y})}),a.jsx(Ct,{value:"home",className:"mt-0",children:a.jsxs(He,{children:[a.jsxs(Ge,{children:[a.jsx(Be,{children:"🤗 HF MCP Server"}),a.jsx(dt,{children:"Connect with AI assistants through the Model Context Protocol"})]}),a.jsxs(Ue,{className:"space-y-6",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-sm font-semibold text-foreground mb-3",children:"What's MCP?"}),a.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:"The Model Context Protocol (MCP) is an open standard that enables AI assistants to securely connect to external data sources and tools. This HF MCP Server provides access to Hugging Face's ecosystem of models, datasets, and Spaces, allowing AI assistants to search, analyze, and interact with ML resources directly."})]}),a.jsx(nt,{}),a.jsx("div",{className:"bg-blue-50 dark:bg-blue-950 border border-blue-200 dark:border-blue-800 rounded-lg p-4",children:a.jsxs("div",{className:"flex items-start space-x-3",children:[a.jsx("div",{className:"flex-shrink-0 mt-0.5",children:a.jsx("svg",{className:"h-5 w-5 text-blue-600 dark:text-blue-400",fill:"currentColor",viewBox:"0 0 20 20",children:a.jsx("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z",clipRule:"evenodd"})})}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-sm font-semibold text-blue-900 dark:text-blue-100 mb-2",children:"Tool Management Scope"}),((e==null?void 0:e.externalApiMode)||(e==null?void 0:e.transport)!=="stdio"&&!(e!=null&&e.externalApiMode))&&a.jsx("p",{className:"text-sm text-blue-700 dark:text-blue-300 leading-relaxed",children:e!=null&&e.externalApiMode?a.jsxs(a.Fragment,{children:[a.jsx("strong",{children:"External API Mode:"})," Tools are managed by an external API. Tool Selection Tabs are not available."]}):a.jsxs(a.Fragment,{children:[a.jsx("strong",{children:"Shared Mode:"})," Tool toggles in this interface affect"," ",a.jsx("strong",{children:"all connected MCP server instances"})," and control tool availability for all connected Hosts."]})})]})]})}),a.jsx(nt,{}),a.jsxs("div",{className:"flex flex-col gap-4",children:[a.jsxs(ct,{size:"xl",onClick:S,className:"w-full transition-all duration-200 active:bg-green-500 active:border-green-500 touch-manipulation",children:[a.jsx(Qc,{className:"mr-2 h-5 w-5"}),"Copy MCP URL"]}),a.jsxs(ct,{size:"xl",variant:"outline",onClick:R,className:"w-full touch-manipulation",children:[a.jsx(ou,{className:"mr-2 h-5 w-5"}),"Go to Settings"]})]})]})]})})]})})}),a.jsx(Up,{isLoading:u,error:v,transportInfo:e||{transport:"unknown"}})]})}ul.createRoot(document.getElementById("root")).render(a.jsx(h.StrictMode,{children:a.jsx(ch,{})}));
|
package/dist/web/index.html
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<link rel="icon" type="image/svg+xml" href="/assets/hf-logo-DbjPOSLw.svg" />
|
|
6
6
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
7
|
<title>HF MCP Server</title>
|
|
8
|
-
<script type="module" crossorigin src="/assets/main-
|
|
8
|
+
<script type="module" crossorigin src="/assets/main-CvlQJc_z.js"></script>
|
|
9
9
|
<link rel="modulepreload" crossorigin href="/assets/index-6v2EFRjb.js">
|
|
10
10
|
<link rel="stylesheet" crossorigin href="/assets/index-B-ZWsJmT.css">
|
|
11
11
|
</head>
|