@mcp-use/inspector 0.9.0 → 0.9.1-canary.1
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/client/assets/{browser-BwGIHdu_.js → browser-B7GyC5Dk.js} +3 -3
- package/dist/client/assets/{display-A5IEINAP-a27o7vy2.js → display-A5IEINAP-Mi61AdT9.js} +2 -2
- package/dist/client/assets/{embeddings-CiSBpYxK.js → embeddings-HgHdHH12.js} +1 -1
- package/dist/client/assets/{index-BcGM93mv.js → index-BiLY8HWN.js} +1 -1
- package/dist/client/assets/{index-BkqaguWr.js → index-COckpbSM.js} +1 -1
- package/dist/client/assets/{index-Dy6u0jar.js → index-CUBkdPCm.js} +1 -1
- package/dist/client/assets/{index-BlcOpmOB.js → index-CVxzpWYY.js} +1 -1
- package/dist/client/assets/{index-B7PZGsrC.js → index-D6062iNT.js} +1 -1
- package/dist/client/assets/{index-d3Zt9XHn.js → index-DdLEVZyw.js} +1 -1
- package/dist/client/assets/{index-CxUUmVDP.js → index-F_9Gh2r-.js} +1 -1
- package/dist/client/assets/{index-BhqX5HqA.js → index-XQXTimKU.js} +5 -5
- package/dist/client/assets/{winston-xjUcWGo7.js → winston-D-dUQpnn.js} +1 -1
- package/dist/client/index.html +2 -2
- package/package.json +2 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/winston-
|
|
2
|
-
var Hne=Object.defineProperty;var Vne=(e,t,n)=>t in e?Hne(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Um=(e,t,n)=>Vne(e,typeof t!="symbol"?t+"":t,n);function Gne(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const a in r)if(a!=="default"&&!(a in e)){const i=Object.getOwnPropertyDescriptor(r,a);i&&Object.defineProperty(e,a,i.get?i:{enumerable:!0,get:()=>r[a]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))r(a);new MutationObserver(a=>{for(const i of a)if(i.type==="childList")for(const s of i.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&r(s)}).observe(document,{childList:!0,subtree:!0});function n(a){const i={};return a.integrity&&(i.integrity=a.integrity),a.referrerPolicy&&(i.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?i.credentials="include":a.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(a){if(a.ep)return;a.ep=!0;const i=n(a);fetch(a.href,i)}})();function Au(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function wPe(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var t=e.default;if(typeof t=="function"){var n=function r(){var a=!1;try{a=this instanceof r}catch{}return a?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(r){var a=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,a.get?a:{enumerable:!0,get:function(){return e[r]}})}),n}var Vw={exports:{}},Md={};var cM;function Wne(){if(cM)return Md;cM=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(r,a,i){var s=null;if(i!==void 0&&(s=""+i),a.key!==void 0&&(s=""+a.key),"key"in a){i={};for(var c in a)c!=="key"&&(i[c]=a[c])}else i=a;return a=i.ref,{$$typeof:e,type:r,key:s,ref:a!==void 0?a:null,props:i}}return Md.Fragment=t,Md.jsx=n,Md.jsxs=n,Md}var uM;function Kne(){return uM||(uM=1,Vw.exports=Wne()),Vw.exports}var m=Kne();const Yne="modulepreload",Zne=function(e){return"/inspector/"+e},dM={},Za=function(t,n,r){let a=Promise.resolve();if(n&&n.length>0){let u=function(d){return Promise.all(d.map(p=>Promise.resolve(p).then(h=>({status:"fulfilled",value:h}),h=>({status:"rejected",reason:h}))))};document.getElementsByTagName("link");const s=document.querySelector("meta[property=csp-nonce]"),c=s?.nonce||s?.getAttribute("nonce");a=u(n.map(d=>{if(d=Zne(d),d in dM)return;dM[d]=!0;const p=d.endsWith(".css"),h=p?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${d}"]${h}`))return;const v=document.createElement("link");if(v.rel=p?"stylesheet":Yne,p||(v.as="script"),v.crossOrigin="",v.href=d,c&&v.setAttribute("nonce",c),document.head.appendChild(v),p)return new Promise((y,E)=>{v.addEventListener("load",y),v.addEventListener("error",()=>E(new Error(`Unable to preload CSS for ${d}`)))})}))}function i(s){const c=new Event("vite:preloadError",{cancelable:!0});if(c.payload=s,window.dispatchEvent(c),!c.defaultPrevented)throw s}return a.then(s=>{for(const c of s||[])c.status==="rejected"&&i(c.reason);return t().catch(i)})};var Xne=Object.defineProperty,Ge=(e,t)=>Xne(e,"name",{value:t,configurable:!0}),fM=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,n)=>(typeof require<"u"?require:t)[n]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')}),wc={};async function eH(){if(typeof process<"u")try{const e=await Za(()=>import("./__vite-browser-external-DFygW7-s.js").then(n=>n.o),[]),t=await Za(()=>import("./path-C9FudP8b.js").then(n=>n.p),[]);return{fs:e.default,path:t.default}}catch{return{fs:null,path:null}}return{fs:null,path:null}}Ge(eH,"getNodeModules");var ta=null;function tH(){if(typeof fM<"u")try{ta=fM("winston")}catch{}}Ge(tH,"loadWinstonSync");async function nH(){return ta||(ta=await Za(()=>import("./winston-xjUcWGo7.js").then(e=>e.w),__vite__mapDeps([0,1,2,3,4]))),ta}Ge(nH,"getWinston");var XR="mcp-use";function _g(){try{return typeof navigator<"u"&&navigator.userAgent?.includes("Cloudflare-Workers")||typeof globalThis.EdgeRuntime<"u"||typeof globalThis.Deno<"u"?!1:typeof process<"u"&&!0&&typeof __dirname<"u"}catch{return!1}}Ge(_g,"isNodeJSEnvironment");var au,Jne=(au=class{_level;name;constructor(t=XR,n="info"){this.name=t,this._level=n}shouldLog(t){const n=["error","warn","info","http","verbose","debug","silly"],r=n.indexOf(this._level);return n.indexOf(t)<=r}formatMessage(t,n){return`${new Date().toLocaleTimeString("en-US",{hour12:!1})} [${this.name}] ${t}: ${n}`}error(t){this.shouldLog("error")&&console.error(this.formatMessage("error",t))}warn(t){this.shouldLog("warn")&&console.warn(this.formatMessage("warn",t))}info(t){this.shouldLog("info")&&console.info(this.formatMessage("info",t))}debug(t){this.shouldLog("debug")&&console.debug(this.formatMessage("debug",t))}http(t){this.shouldLog("http")&&console.log(this.formatMessage("http",t))}verbose(t){this.shouldLog("verbose")&&console.log(this.formatMessage("verbose",t))}silly(t){this.shouldLog("silly")&&console.log(this.formatMessage("silly",t))}get level(){return this._level}set level(t){this._level=t}},Ge(au,"SimpleConsoleLogger"),au);function Qh(e){switch((typeof process<"u"&&wc?e:void 0)?.trim()){case"2":return"debug";case"1":return"info";default:return"info"}}Ge(Qh,"resolveLevel");var ro,rH=(ro=class{static get(t=XR){if(!_g()){if(!this.simpleInstances[t]){const n=typeof process<"u"&&wc?.DEBUG||void 0;this.simpleInstances[t]=new Jne(t,Qh(n))}return this.simpleInstances[t]}if(!this.instances[t]){if(!ta)throw new Error("Winston not loaded - call Logger.configure() first");const{createLogger:n,format:r}=ta,{combine:a,timestamp:i,label:s,colorize:c,splat:u}=r;this.instances[t]=n({level:Qh(wc.DEBUG),format:a(c(),u(),s({label:t}),i({format:"HH:mm:ss"}),this.getFormatter()),transports:[]})}return this.instances[t]}static getFormatter(){if(!ta)throw new Error("Winston not loaded");const{format:t}=ta,{printf:n}=t,r=n(({level:s,message:c,label:u,timestamp:d})=>`${d} [${u}] ${s}: ${c}`),a=n(({level:s,message:c,label:u,timestamp:d})=>`${d} [${u}] ${s.toUpperCase()}: ${c}`),i=n(({level:s,message:c,label:u,timestamp:d})=>`${d} [${u}] ${s.toUpperCase()}: ${c}`);switch(this.currentFormat){case"minimal":return r;case"detailed":return a;case"emoji":return i;default:return r}}static async configure(t={}){const{level:n,console:r=!0,file:a,format:i="minimal"}=t,s=typeof process<"u"&&wc?.DEBUG||void 0,c=n??Qh(s);if(this.currentFormat=i,!_g()){Object.values(this.simpleInstances).forEach(_=>{_.level=c});return}if(await nH(),!ta)throw new Error("Failed to load winston");const u=this.get();u.level=c;const d=u;if(d.clear(),r&&d.add(new ta.transports.Console),a){const{fs:_,path:S}=await eH();if(_&&S){const w=S.dirname(S.resolve(a));_.existsSync(w)||_.mkdirSync(w,{recursive:!0}),d.add(new ta.transports.File({filename:a}))}}const{format:p}=ta,{combine:h,timestamp:v,label:y,colorize:E,splat:x}=p;Object.values(this.instances).forEach(_=>{_&&"format"in _&&(_.level=c,_.format=h(E(),x(),y({label:XR}),v({format:"HH:mm:ss"}),this.getFormatter()))})}static setDebug(t){let n;t===2||t===!0?n="debug":n="info",Object.values(this.simpleInstances).forEach(r=>{r.level=n}),Object.values(this.instances).forEach(r=>{r&&(r.level=n)}),typeof process<"u"&&wc&&(wc.DEBUG=t?t===!0?"2":String(t):"0")}static setFormat(t){this.currentFormat=t,this.configure({format:t})}},Ge(ro,"Logger"),Um(ro,"instances",{}),Um(ro,"simpleInstances",{}),Um(ro,"currentFormat","minimal"),ro);_g()&&(tH(),ta&&rH.configure());var Le=rH.get();const aH=Object.freeze({status:"aborted"});function me(e,t,n){function r(c,u){if(c._zod||Object.defineProperty(c,"_zod",{value:{def:u,constr:s,traits:new Set},enumerable:!1}),c._zod.traits.has(e))return;c._zod.traits.add(e),t(c,u);const d=s.prototype,p=Object.keys(d);for(let h=0;h<p.length;h++){const v=p[h];v in c||(c[v]=d[v].bind(c))}}const a=n?.Parent??Object;class i extends a{}Object.defineProperty(i,"name",{value:e});function s(c){var u;const d=n?.Parent?new i:this;r(d,c),(u=d._zod).deferred??(u.deferred=[]);for(const p of d._zod.deferred)p();return d}return Object.defineProperty(s,"init",{value:r}),Object.defineProperty(s,Symbol.hasInstance,{value:c=>n?.Parent&&c instanceof n.Parent?!0:c?._zod?.traits?.has(e)}),Object.defineProperty(s,"name",{value:e}),s}const iH=Symbol("zod_brand");class il extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class fv extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const xg={};function Tr(e){return e&&Object.assign(xg,e),xg}function Qne(e){return e}function ere(e){return e}function tre(e){}function nre(e){throw new Error}function rre(e){}function Zk(e){const t=Object.values(e).filter(r=>typeof r=="number");return Object.entries(e).filter(([r,a])=>t.indexOf(+r)===-1).map(([r,a])=>a)}function Pe(e,t="|"){return e.map(n=>ht(n)).join(t)}function Tg(e,t){return typeof t=="bigint"?t.toString():t}function Zf(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function Tl(e){return e==null}function pv(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function oH(e,t){const n=(e.toString().split(".")[1]||"").length,r=t.toString();let a=(r.split(".")[1]||"").length;if(a===0&&/\d?e-\d?/.test(r)){const u=r.match(/\d?e-(\d?)/);u?.[1]&&(a=Number.parseInt(u[1]))}const i=n>a?n:a,s=Number.parseInt(e.toFixed(i).replace(".","")),c=Number.parseInt(t.toFixed(i).replace(".",""));return s%c/10**i}const pM=Symbol("evaluating");function $t(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==pM)return r===void 0&&(r=pM,r=n()),r},set(a){Object.defineProperty(e,t,{value:a})},configurable:!0})}function are(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function ms(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function bo(...e){const t={};for(const n of e){const r=Object.getOwnPropertyDescriptors(n);Object.assign(t,r)}return Object.defineProperties({},t)}function ire(e){return bo(e._zod.def)}function ore(e,t){return t?t.reduce((n,r)=>n?.[r],e):e}function sre(e){const t=Object.keys(e),n=t.map(r=>e[r]);return Promise.all(n).then(r=>{const a={};for(let i=0;i<t.length;i++)a[t[i]]=r[i];return a})}function lre(e=10){const t="abcdefghijklmnopqrstuvwxyz";let n="";for(let r=0;r<e;r++)n+=t[Math.floor(Math.random()*t.length)];return n}function JR(e){return JSON.stringify(e)}function sH(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const Xk="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function hu(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const lH=Zf(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function dl(e){if(hu(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const n=t.prototype;return!(hu(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function mv(e){return dl(e)?{...e}:Array.isArray(e)?[...e]:e}function cre(e){let t=0;for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&t++;return t}const ure=e=>{const t=typeof e;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(e)?"array":e===null?"null":e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?"promise":typeof Map<"u"&&e instanceof Map?"map":typeof Set<"u"&&e instanceof Set?"set":typeof Date<"u"&&e instanceof Date?"date":typeof File<"u"&&e instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${t}`)}},Rg=new Set(["string","number","symbol"]),cH=new Set(["string","number","bigint","boolean","symbol","undefined"]);function co(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function $a(e,t,n){const r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function Ce(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function dre(e){let t;return new Proxy({},{get(n,r,a){return t??(t=e()),Reflect.get(t,r,a)},set(n,r,a,i){return t??(t=e()),Reflect.set(t,r,a,i)},has(n,r){return t??(t=e()),Reflect.has(t,r)},deleteProperty(n,r){return t??(t=e()),Reflect.deleteProperty(t,r)},ownKeys(n){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(n,r){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,r)},defineProperty(n,r,a){return t??(t=e()),Reflect.defineProperty(t,r,a)}})}function ht(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function uH(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const dH={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},fH={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function pH(e,t){const n=e._zod.def,r=bo(e._zod.def,{get shape(){const a={};for(const i in t){if(!(i in n.shape))throw new Error(`Unrecognized key: "${i}"`);t[i]&&(a[i]=n.shape[i])}return ms(this,"shape",a),a},checks:[]});return $a(e,r)}function mH(e,t){const n=e._zod.def,r=bo(e._zod.def,{get shape(){const a={...e._zod.def.shape};for(const i in t){if(!(i in n.shape))throw new Error(`Unrecognized key: "${i}"`);t[i]&&delete a[i]}return ms(this,"shape",a),a},checks:[]});return $a(e,r)}function hH(e,t){if(!dl(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0)throw new Error("Object schemas containing refinements cannot be extended. Use `.safeExtend()` instead.");const a=bo(e._zod.def,{get shape(){const i={...e._zod.def.shape,...t};return ms(this,"shape",i),i},checks:[]});return $a(e,a)}function gH(e,t){if(!dl(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n={...e._zod.def,get shape(){const r={...e._zod.def.shape,...t};return ms(this,"shape",r),r},checks:e._zod.def.checks};return $a(e,n)}function vH(e,t){const n=bo(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t._zod.def.shape};return ms(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:[]});return $a(e,n)}function bH(e,t,n){const r=bo(t._zod.def,{get shape(){const a=t._zod.def.shape,i={...a};if(n)for(const s in n){if(!(s in a))throw new Error(`Unrecognized key: "${s}"`);n[s]&&(i[s]=e?new e({type:"optional",innerType:a[s]}):a[s])}else for(const s in a)i[s]=e?new e({type:"optional",innerType:a[s]}):a[s];return ms(this,"shape",i),i},checks:[]});return $a(t,r)}function yH(e,t,n){const r=bo(t._zod.def,{get shape(){const a=t._zod.def.shape,i={...a};if(n)for(const s in n){if(!(s in i))throw new Error(`Unrecognized key: "${s}"`);n[s]&&(i[s]=new e({type:"nonoptional",innerType:a[s]}))}else for(const s in a)i[s]=new e({type:"nonoptional",innerType:a[s]});return ms(this,"shape",i),i},checks:[]});return $a(t,r)}function Qs(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function Xa(e,t){return t.map(n=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(e),n})}function Kd(e){return typeof e=="string"?e:e?.message}function ni(e,t,n){const r={...e,path:e.path??[]};if(!e.message){const a=Kd(e.inst?._zod.def?.error?.(e))??Kd(t?.error?.(e))??Kd(n.customError?.(e))??Kd(n.localeError?.(e))??"Invalid input";r.message=a}return delete r.inst,delete r.continue,t?.reportInput||delete r.input,r}function hv(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}function gv(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function gu(...e){const[t,n,r]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:r}:{...t}}function fre(e){return Object.entries(e).filter(([t,n])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function wH(e){const t=atob(e),n=new Uint8Array(t.length);for(let r=0;r<t.length;r++)n[r]=t.charCodeAt(r);return n}function SH(e){let t="";for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t)}function pre(e){const t=e.replace(/-/g,"+").replace(/_/g,"/"),n="=".repeat((4-t.length%4)%4);return wH(t+n)}function mre(e){return SH(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function hre(e){const t=e.replace(/^0x/,"");if(t.length%2!==0)throw new Error("Invalid hex string length");const n=new Uint8Array(t.length/2);for(let r=0;r<t.length;r+=2)n[r/2]=Number.parseInt(t.slice(r,r+2),16);return n}function gre(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}class vre{constructor(...t){}}const EH=Object.freeze(Object.defineProperty({__proto__:null,BIGINT_FORMAT_RANGES:fH,Class:vre,NUMBER_FORMAT_RANGES:dH,aborted:Qs,allowsEval:lH,assert:rre,assertEqual:Qne,assertIs:tre,assertNever:nre,assertNotEqual:ere,assignProp:ms,base64ToUint8Array:wH,base64urlToUint8Array:pre,cached:Zf,captureStackTrace:Xk,cleanEnum:fre,cleanRegex:pv,clone:$a,cloneDef:ire,createTransparentProxy:dre,defineLazy:$t,esc:JR,escapeRegex:co,extend:hH,finalizeIssue:ni,floatSafeRemainder:oH,getElementAtPath:ore,getEnumValues:Zk,getLengthableOrigin:gv,getParsedType:ure,getSizableOrigin:hv,hexToUint8Array:hre,isObject:hu,isPlainObject:dl,issue:gu,joinValues:Pe,jsonStringifyReplacer:Tg,merge:vH,mergeDefs:bo,normalizeParams:Ce,nullish:Tl,numKeys:cre,objectClone:are,omit:mH,optionalKeys:uH,partial:bH,pick:pH,prefixIssues:Xa,primitiveTypes:cH,promiseAllObject:sre,propertyKeyTypes:Rg,randomString:lre,required:yH,safeExtend:gH,shallowClone:mv,slugify:sH,stringifyPrimitive:ht,uint8ArrayToBase64:SH,uint8ArrayToBase64url:mre,uint8ArrayToHex:gre,unwrapMessage:Kd},Symbol.toStringTag,{value:"Module"})),_H=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,Tg,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Jk=me("$ZodError",_H),oa=me("$ZodError",_H,{Parent:Error});function Qk(e,t=n=>n.message){const n={},r=[];for(const a of e.issues)a.path.length>0?(n[a.path[0]]=n[a.path[0]]||[],n[a.path[0]].push(t(a))):r.push(t(a));return{formErrors:r,fieldErrors:n}}function eC(e,t=n=>n.message){const n={_errors:[]},r=a=>{for(const i of a.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(s=>r({issues:s}));else if(i.code==="invalid_key")r({issues:i.issues});else if(i.code==="invalid_element")r({issues:i.issues});else if(i.path.length===0)n._errors.push(t(i));else{let s=n,c=0;for(;c<i.path.length;){const u=i.path[c];c===i.path.length-1?(s[u]=s[u]||{_errors:[]},s[u]._errors.push(t(i))):s[u]=s[u]||{_errors:[]},s=s[u],c++}}};return r(e),n}function xH(e,t=n=>n.message){const n={errors:[]},r=(a,i=[])=>{var s,c;for(const u of a.issues)if(u.code==="invalid_union"&&u.errors.length)u.errors.map(d=>r({issues:d},u.path));else if(u.code==="invalid_key")r({issues:u.issues},u.path);else if(u.code==="invalid_element")r({issues:u.issues},u.path);else{const d=[...i,...u.path];if(d.length===0){n.errors.push(t(u));continue}let p=n,h=0;for(;h<d.length;){const v=d[h],y=h===d.length-1;typeof v=="string"?(p.properties??(p.properties={}),(s=p.properties)[v]??(s[v]={errors:[]}),p=p.properties[v]):(p.items??(p.items=[]),(c=p.items)[v]??(c[v]={errors:[]}),p=p.items[v]),y&&p.errors.push(t(u)),h++}}};return r(e),n}function TH(e){const t=[],n=e.map(r=>typeof r=="object"?r.key:r);for(const r of n)typeof r=="number"?t.push(`[${r}]`):typeof r=="symbol"?t.push(`[${JSON.stringify(String(r))}]`):/[^\w$]/.test(r)?t.push(`[${JSON.stringify(r)}]`):(t.length&&t.push("."),t.push(r));return t.join("")}function RH(e){const t=[],n=[...e.issues].sort((r,a)=>(r.path??[]).length-(a.path??[]).length);for(const r of n)t.push(`✖ ${r.message}`),r.path?.length&&t.push(` → at ${TH(r.path)}`);return t.join(`
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/winston-D-dUQpnn.js","assets/util-t-trnxQI.js","assets/__vite-browser-external-DFygW7-s.js","assets/index-DRz5BQNA.js","assets/path-C9FudP8b.js","assets/index-F_9Gh2r-.js","assets/index-COckpbSM.js","assets/index-CVxzpWYY.js","assets/embeddings-HgHdHH12.js","assets/index-DdLEVZyw.js","assets/index-CUBkdPCm.js","assets/browser-B7GyC5Dk.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
var Hne=Object.defineProperty;var Vne=(e,t,n)=>t in e?Hne(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Um=(e,t,n)=>Vne(e,typeof t!="symbol"?t+"":t,n);function Gne(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const a in r)if(a!=="default"&&!(a in e)){const i=Object.getOwnPropertyDescriptor(r,a);i&&Object.defineProperty(e,a,i.get?i:{enumerable:!0,get:()=>r[a]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))r(a);new MutationObserver(a=>{for(const i of a)if(i.type==="childList")for(const s of i.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&r(s)}).observe(document,{childList:!0,subtree:!0});function n(a){const i={};return a.integrity&&(i.integrity=a.integrity),a.referrerPolicy&&(i.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?i.credentials="include":a.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(a){if(a.ep)return;a.ep=!0;const i=n(a);fetch(a.href,i)}})();function Au(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function wPe(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var t=e.default;if(typeof t=="function"){var n=function r(){var a=!1;try{a=this instanceof r}catch{}return a?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(r){var a=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,a.get?a:{enumerable:!0,get:function(){return e[r]}})}),n}var Vw={exports:{}},Md={};var cM;function Wne(){if(cM)return Md;cM=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(r,a,i){var s=null;if(i!==void 0&&(s=""+i),a.key!==void 0&&(s=""+a.key),"key"in a){i={};for(var c in a)c!=="key"&&(i[c]=a[c])}else i=a;return a=i.ref,{$$typeof:e,type:r,key:s,ref:a!==void 0?a:null,props:i}}return Md.Fragment=t,Md.jsx=n,Md.jsxs=n,Md}var uM;function Kne(){return uM||(uM=1,Vw.exports=Wne()),Vw.exports}var m=Kne();const Yne="modulepreload",Zne=function(e){return"/inspector/"+e},dM={},Za=function(t,n,r){let a=Promise.resolve();if(n&&n.length>0){let u=function(d){return Promise.all(d.map(p=>Promise.resolve(p).then(h=>({status:"fulfilled",value:h}),h=>({status:"rejected",reason:h}))))};document.getElementsByTagName("link");const s=document.querySelector("meta[property=csp-nonce]"),c=s?.nonce||s?.getAttribute("nonce");a=u(n.map(d=>{if(d=Zne(d),d in dM)return;dM[d]=!0;const p=d.endsWith(".css"),h=p?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${d}"]${h}`))return;const v=document.createElement("link");if(v.rel=p?"stylesheet":Yne,p||(v.as="script"),v.crossOrigin="",v.href=d,c&&v.setAttribute("nonce",c),document.head.appendChild(v),p)return new Promise((y,E)=>{v.addEventListener("load",y),v.addEventListener("error",()=>E(new Error(`Unable to preload CSS for ${d}`)))})}))}function i(s){const c=new Event("vite:preloadError",{cancelable:!0});if(c.payload=s,window.dispatchEvent(c),!c.defaultPrevented)throw s}return a.then(s=>{for(const c of s||[])c.status==="rejected"&&i(c.reason);return t().catch(i)})};var Xne=Object.defineProperty,Ge=(e,t)=>Xne(e,"name",{value:t,configurable:!0}),fM=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,n)=>(typeof require<"u"?require:t)[n]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')}),wc={};async function eH(){if(typeof process<"u")try{const e=await Za(()=>import("./__vite-browser-external-DFygW7-s.js").then(n=>n.o),[]),t=await Za(()=>import("./path-C9FudP8b.js").then(n=>n.p),[]);return{fs:e.default,path:t.default}}catch{return{fs:null,path:null}}return{fs:null,path:null}}Ge(eH,"getNodeModules");var ta=null;function tH(){if(typeof fM<"u")try{ta=fM("winston")}catch{}}Ge(tH,"loadWinstonSync");async function nH(){return ta||(ta=await Za(()=>import("./winston-D-dUQpnn.js").then(e=>e.w),__vite__mapDeps([0,1,2,3,4]))),ta}Ge(nH,"getWinston");var XR="mcp-use";function _g(){try{return typeof navigator<"u"&&navigator.userAgent?.includes("Cloudflare-Workers")||typeof globalThis.EdgeRuntime<"u"||typeof globalThis.Deno<"u"?!1:typeof process<"u"&&!0&&typeof __dirname<"u"}catch{return!1}}Ge(_g,"isNodeJSEnvironment");var au,Jne=(au=class{_level;name;constructor(t=XR,n="info"){this.name=t,this._level=n}shouldLog(t){const n=["error","warn","info","http","verbose","debug","silly"],r=n.indexOf(this._level);return n.indexOf(t)<=r}formatMessage(t,n){return`${new Date().toLocaleTimeString("en-US",{hour12:!1})} [${this.name}] ${t}: ${n}`}error(t){this.shouldLog("error")&&console.error(this.formatMessage("error",t))}warn(t){this.shouldLog("warn")&&console.warn(this.formatMessage("warn",t))}info(t){this.shouldLog("info")&&console.info(this.formatMessage("info",t))}debug(t){this.shouldLog("debug")&&console.debug(this.formatMessage("debug",t))}http(t){this.shouldLog("http")&&console.log(this.formatMessage("http",t))}verbose(t){this.shouldLog("verbose")&&console.log(this.formatMessage("verbose",t))}silly(t){this.shouldLog("silly")&&console.log(this.formatMessage("silly",t))}get level(){return this._level}set level(t){this._level=t}},Ge(au,"SimpleConsoleLogger"),au);function Qh(e){switch((typeof process<"u"&&wc?e:void 0)?.trim()){case"2":return"debug";case"1":return"info";default:return"info"}}Ge(Qh,"resolveLevel");var ro,rH=(ro=class{static get(t=XR){if(!_g()){if(!this.simpleInstances[t]){const n=typeof process<"u"&&wc?.DEBUG||void 0;this.simpleInstances[t]=new Jne(t,Qh(n))}return this.simpleInstances[t]}if(!this.instances[t]){if(!ta)throw new Error("Winston not loaded - call Logger.configure() first");const{createLogger:n,format:r}=ta,{combine:a,timestamp:i,label:s,colorize:c,splat:u}=r;this.instances[t]=n({level:Qh(wc.DEBUG),format:a(c(),u(),s({label:t}),i({format:"HH:mm:ss"}),this.getFormatter()),transports:[]})}return this.instances[t]}static getFormatter(){if(!ta)throw new Error("Winston not loaded");const{format:t}=ta,{printf:n}=t,r=n(({level:s,message:c,label:u,timestamp:d})=>`${d} [${u}] ${s}: ${c}`),a=n(({level:s,message:c,label:u,timestamp:d})=>`${d} [${u}] ${s.toUpperCase()}: ${c}`),i=n(({level:s,message:c,label:u,timestamp:d})=>`${d} [${u}] ${s.toUpperCase()}: ${c}`);switch(this.currentFormat){case"minimal":return r;case"detailed":return a;case"emoji":return i;default:return r}}static async configure(t={}){const{level:n,console:r=!0,file:a,format:i="minimal"}=t,s=typeof process<"u"&&wc?.DEBUG||void 0,c=n??Qh(s);if(this.currentFormat=i,!_g()){Object.values(this.simpleInstances).forEach(_=>{_.level=c});return}if(await nH(),!ta)throw new Error("Failed to load winston");const u=this.get();u.level=c;const d=u;if(d.clear(),r&&d.add(new ta.transports.Console),a){const{fs:_,path:S}=await eH();if(_&&S){const w=S.dirname(S.resolve(a));_.existsSync(w)||_.mkdirSync(w,{recursive:!0}),d.add(new ta.transports.File({filename:a}))}}const{format:p}=ta,{combine:h,timestamp:v,label:y,colorize:E,splat:x}=p;Object.values(this.instances).forEach(_=>{_&&"format"in _&&(_.level=c,_.format=h(E(),x(),y({label:XR}),v({format:"HH:mm:ss"}),this.getFormatter()))})}static setDebug(t){let n;t===2||t===!0?n="debug":n="info",Object.values(this.simpleInstances).forEach(r=>{r.level=n}),Object.values(this.instances).forEach(r=>{r&&(r.level=n)}),typeof process<"u"&&wc&&(wc.DEBUG=t?t===!0?"2":String(t):"0")}static setFormat(t){this.currentFormat=t,this.configure({format:t})}},Ge(ro,"Logger"),Um(ro,"instances",{}),Um(ro,"simpleInstances",{}),Um(ro,"currentFormat","minimal"),ro);_g()&&(tH(),ta&&rH.configure());var Le=rH.get();const aH=Object.freeze({status:"aborted"});function me(e,t,n){function r(c,u){if(c._zod||Object.defineProperty(c,"_zod",{value:{def:u,constr:s,traits:new Set},enumerable:!1}),c._zod.traits.has(e))return;c._zod.traits.add(e),t(c,u);const d=s.prototype,p=Object.keys(d);for(let h=0;h<p.length;h++){const v=p[h];v in c||(c[v]=d[v].bind(c))}}const a=n?.Parent??Object;class i extends a{}Object.defineProperty(i,"name",{value:e});function s(c){var u;const d=n?.Parent?new i:this;r(d,c),(u=d._zod).deferred??(u.deferred=[]);for(const p of d._zod.deferred)p();return d}return Object.defineProperty(s,"init",{value:r}),Object.defineProperty(s,Symbol.hasInstance,{value:c=>n?.Parent&&c instanceof n.Parent?!0:c?._zod?.traits?.has(e)}),Object.defineProperty(s,"name",{value:e}),s}const iH=Symbol("zod_brand");class il extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class fv extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const xg={};function Tr(e){return e&&Object.assign(xg,e),xg}function Qne(e){return e}function ere(e){return e}function tre(e){}function nre(e){throw new Error}function rre(e){}function Zk(e){const t=Object.values(e).filter(r=>typeof r=="number");return Object.entries(e).filter(([r,a])=>t.indexOf(+r)===-1).map(([r,a])=>a)}function Pe(e,t="|"){return e.map(n=>ht(n)).join(t)}function Tg(e,t){return typeof t=="bigint"?t.toString():t}function Zf(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function Tl(e){return e==null}function pv(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function oH(e,t){const n=(e.toString().split(".")[1]||"").length,r=t.toString();let a=(r.split(".")[1]||"").length;if(a===0&&/\d?e-\d?/.test(r)){const u=r.match(/\d?e-(\d?)/);u?.[1]&&(a=Number.parseInt(u[1]))}const i=n>a?n:a,s=Number.parseInt(e.toFixed(i).replace(".","")),c=Number.parseInt(t.toFixed(i).replace(".",""));return s%c/10**i}const pM=Symbol("evaluating");function $t(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==pM)return r===void 0&&(r=pM,r=n()),r},set(a){Object.defineProperty(e,t,{value:a})},configurable:!0})}function are(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function ms(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function bo(...e){const t={};for(const n of e){const r=Object.getOwnPropertyDescriptors(n);Object.assign(t,r)}return Object.defineProperties({},t)}function ire(e){return bo(e._zod.def)}function ore(e,t){return t?t.reduce((n,r)=>n?.[r],e):e}function sre(e){const t=Object.keys(e),n=t.map(r=>e[r]);return Promise.all(n).then(r=>{const a={};for(let i=0;i<t.length;i++)a[t[i]]=r[i];return a})}function lre(e=10){const t="abcdefghijklmnopqrstuvwxyz";let n="";for(let r=0;r<e;r++)n+=t[Math.floor(Math.random()*t.length)];return n}function JR(e){return JSON.stringify(e)}function sH(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const Xk="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function hu(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const lH=Zf(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function dl(e){if(hu(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const n=t.prototype;return!(hu(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function mv(e){return dl(e)?{...e}:Array.isArray(e)?[...e]:e}function cre(e){let t=0;for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&t++;return t}const ure=e=>{const t=typeof e;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(e)?"array":e===null?"null":e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?"promise":typeof Map<"u"&&e instanceof Map?"map":typeof Set<"u"&&e instanceof Set?"set":typeof Date<"u"&&e instanceof Date?"date":typeof File<"u"&&e instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${t}`)}},Rg=new Set(["string","number","symbol"]),cH=new Set(["string","number","bigint","boolean","symbol","undefined"]);function co(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function $a(e,t,n){const r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function Ce(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function dre(e){let t;return new Proxy({},{get(n,r,a){return t??(t=e()),Reflect.get(t,r,a)},set(n,r,a,i){return t??(t=e()),Reflect.set(t,r,a,i)},has(n,r){return t??(t=e()),Reflect.has(t,r)},deleteProperty(n,r){return t??(t=e()),Reflect.deleteProperty(t,r)},ownKeys(n){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(n,r){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,r)},defineProperty(n,r,a){return t??(t=e()),Reflect.defineProperty(t,r,a)}})}function ht(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function uH(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const dH={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},fH={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function pH(e,t){const n=e._zod.def,r=bo(e._zod.def,{get shape(){const a={};for(const i in t){if(!(i in n.shape))throw new Error(`Unrecognized key: "${i}"`);t[i]&&(a[i]=n.shape[i])}return ms(this,"shape",a),a},checks:[]});return $a(e,r)}function mH(e,t){const n=e._zod.def,r=bo(e._zod.def,{get shape(){const a={...e._zod.def.shape};for(const i in t){if(!(i in n.shape))throw new Error(`Unrecognized key: "${i}"`);t[i]&&delete a[i]}return ms(this,"shape",a),a},checks:[]});return $a(e,r)}function hH(e,t){if(!dl(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0)throw new Error("Object schemas containing refinements cannot be extended. Use `.safeExtend()` instead.");const a=bo(e._zod.def,{get shape(){const i={...e._zod.def.shape,...t};return ms(this,"shape",i),i},checks:[]});return $a(e,a)}function gH(e,t){if(!dl(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n={...e._zod.def,get shape(){const r={...e._zod.def.shape,...t};return ms(this,"shape",r),r},checks:e._zod.def.checks};return $a(e,n)}function vH(e,t){const n=bo(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t._zod.def.shape};return ms(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:[]});return $a(e,n)}function bH(e,t,n){const r=bo(t._zod.def,{get shape(){const a=t._zod.def.shape,i={...a};if(n)for(const s in n){if(!(s in a))throw new Error(`Unrecognized key: "${s}"`);n[s]&&(i[s]=e?new e({type:"optional",innerType:a[s]}):a[s])}else for(const s in a)i[s]=e?new e({type:"optional",innerType:a[s]}):a[s];return ms(this,"shape",i),i},checks:[]});return $a(t,r)}function yH(e,t,n){const r=bo(t._zod.def,{get shape(){const a=t._zod.def.shape,i={...a};if(n)for(const s in n){if(!(s in i))throw new Error(`Unrecognized key: "${s}"`);n[s]&&(i[s]=new e({type:"nonoptional",innerType:a[s]}))}else for(const s in a)i[s]=new e({type:"nonoptional",innerType:a[s]});return ms(this,"shape",i),i},checks:[]});return $a(t,r)}function Qs(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function Xa(e,t){return t.map(n=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(e),n})}function Kd(e){return typeof e=="string"?e:e?.message}function ni(e,t,n){const r={...e,path:e.path??[]};if(!e.message){const a=Kd(e.inst?._zod.def?.error?.(e))??Kd(t?.error?.(e))??Kd(n.customError?.(e))??Kd(n.localeError?.(e))??"Invalid input";r.message=a}return delete r.inst,delete r.continue,t?.reportInput||delete r.input,r}function hv(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}function gv(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function gu(...e){const[t,n,r]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:r}:{...t}}function fre(e){return Object.entries(e).filter(([t,n])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function wH(e){const t=atob(e),n=new Uint8Array(t.length);for(let r=0;r<t.length;r++)n[r]=t.charCodeAt(r);return n}function SH(e){let t="";for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t)}function pre(e){const t=e.replace(/-/g,"+").replace(/_/g,"/"),n="=".repeat((4-t.length%4)%4);return wH(t+n)}function mre(e){return SH(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function hre(e){const t=e.replace(/^0x/,"");if(t.length%2!==0)throw new Error("Invalid hex string length");const n=new Uint8Array(t.length/2);for(let r=0;r<t.length;r+=2)n[r/2]=Number.parseInt(t.slice(r,r+2),16);return n}function gre(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}class vre{constructor(...t){}}const EH=Object.freeze(Object.defineProperty({__proto__:null,BIGINT_FORMAT_RANGES:fH,Class:vre,NUMBER_FORMAT_RANGES:dH,aborted:Qs,allowsEval:lH,assert:rre,assertEqual:Qne,assertIs:tre,assertNever:nre,assertNotEqual:ere,assignProp:ms,base64ToUint8Array:wH,base64urlToUint8Array:pre,cached:Zf,captureStackTrace:Xk,cleanEnum:fre,cleanRegex:pv,clone:$a,cloneDef:ire,createTransparentProxy:dre,defineLazy:$t,esc:JR,escapeRegex:co,extend:hH,finalizeIssue:ni,floatSafeRemainder:oH,getElementAtPath:ore,getEnumValues:Zk,getLengthableOrigin:gv,getParsedType:ure,getSizableOrigin:hv,hexToUint8Array:hre,isObject:hu,isPlainObject:dl,issue:gu,joinValues:Pe,jsonStringifyReplacer:Tg,merge:vH,mergeDefs:bo,normalizeParams:Ce,nullish:Tl,numKeys:cre,objectClone:are,omit:mH,optionalKeys:uH,partial:bH,pick:pH,prefixIssues:Xa,primitiveTypes:cH,promiseAllObject:sre,propertyKeyTypes:Rg,randomString:lre,required:yH,safeExtend:gH,shallowClone:mv,slugify:sH,stringifyPrimitive:ht,uint8ArrayToBase64:SH,uint8ArrayToBase64url:mre,uint8ArrayToHex:gre,unwrapMessage:Kd},Symbol.toStringTag,{value:"Module"})),_H=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,Tg,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Jk=me("$ZodError",_H),oa=me("$ZodError",_H,{Parent:Error});function Qk(e,t=n=>n.message){const n={},r=[];for(const a of e.issues)a.path.length>0?(n[a.path[0]]=n[a.path[0]]||[],n[a.path[0]].push(t(a))):r.push(t(a));return{formErrors:r,fieldErrors:n}}function eC(e,t=n=>n.message){const n={_errors:[]},r=a=>{for(const i of a.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(s=>r({issues:s}));else if(i.code==="invalid_key")r({issues:i.issues});else if(i.code==="invalid_element")r({issues:i.issues});else if(i.path.length===0)n._errors.push(t(i));else{let s=n,c=0;for(;c<i.path.length;){const u=i.path[c];c===i.path.length-1?(s[u]=s[u]||{_errors:[]},s[u]._errors.push(t(i))):s[u]=s[u]||{_errors:[]},s=s[u],c++}}};return r(e),n}function xH(e,t=n=>n.message){const n={errors:[]},r=(a,i=[])=>{var s,c;for(const u of a.issues)if(u.code==="invalid_union"&&u.errors.length)u.errors.map(d=>r({issues:d},u.path));else if(u.code==="invalid_key")r({issues:u.issues},u.path);else if(u.code==="invalid_element")r({issues:u.issues},u.path);else{const d=[...i,...u.path];if(d.length===0){n.errors.push(t(u));continue}let p=n,h=0;for(;h<d.length;){const v=d[h],y=h===d.length-1;typeof v=="string"?(p.properties??(p.properties={}),(s=p.properties)[v]??(s[v]={errors:[]}),p=p.properties[v]):(p.items??(p.items=[]),(c=p.items)[v]??(c[v]={errors:[]}),p=p.items[v]),y&&p.errors.push(t(u)),h++}}};return r(e),n}function TH(e){const t=[],n=e.map(r=>typeof r=="object"?r.key:r);for(const r of n)typeof r=="number"?t.push(`[${r}]`):typeof r=="symbol"?t.push(`[${JSON.stringify(String(r))}]`):/[^\w$]/.test(r)?t.push(`[${JSON.stringify(r)}]`):(t.length&&t.push("."),t.push(r));return t.join("")}function RH(e){const t=[],n=[...e.issues].sort((r,a)=>(r.path??[]).length-(a.path??[]).length);for(const r of n)t.push(`✖ ${r.message}`),r.path?.length&&t.push(` → at ${TH(r.path)}`);return t.join(`
|
|
3
3
|
`)}const Xf=e=>(t,n,r,a)=>{const i=r?Object.assign(r,{async:!1}):{async:!1},s=t._zod.run({value:n,issues:[]},i);if(s instanceof Promise)throw new il;if(s.issues.length){const c=new(a?.Err??e)(s.issues.map(u=>ni(u,i,Tr())));throw Xk(c,a?.callee),c}return s.value},QR=Xf(oa),Jf=e=>async(t,n,r,a)=>{const i=r?Object.assign(r,{async:!0}):{async:!0};let s=t._zod.run({value:n,issues:[]},i);if(s instanceof Promise&&(s=await s),s.issues.length){const c=new(a?.Err??e)(s.issues.map(u=>ni(u,i,Tr())));throw Xk(c,a?.callee),c}return s.value},eN=Jf(oa),Qf=e=>(t,n,r)=>{const a=r?{...r,async:!1}:{async:!1},i=t._zod.run({value:n,issues:[]},a);if(i instanceof Promise)throw new il;return i.issues.length?{success:!1,error:new(e??Jk)(i.issues.map(s=>ni(s,a,Tr())))}:{success:!0,data:i.value}},tC=Qf(oa),ep=e=>async(t,n,r)=>{const a=r?Object.assign(r,{async:!0}):{async:!0};let i=t._zod.run({value:n,issues:[]},a);return i instanceof Promise&&(i=await i),i.issues.length?{success:!1,error:new e(i.issues.map(s=>ni(s,a,Tr())))}:{success:!0,data:i.value}},NH=ep(oa),nC=e=>(t,n,r)=>{const a=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Xf(e)(t,n,a)},bre=nC(oa),rC=e=>(t,n,r)=>Xf(e)(t,n,r),yre=rC(oa),aC=e=>async(t,n,r)=>{const a=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Jf(e)(t,n,a)},wre=aC(oa),iC=e=>async(t,n,r)=>Jf(e)(t,n,r),Sre=iC(oa),oC=e=>(t,n,r)=>{const a=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Qf(e)(t,n,a)},Ere=oC(oa),sC=e=>(t,n,r)=>Qf(e)(t,n,r),_re=sC(oa),lC=e=>async(t,n,r)=>{const a=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return ep(e)(t,n,a)},xre=lC(oa),cC=e=>async(t,n,r)=>ep(e)(t,n,r),Tre=cC(oa),kH=/^[cC][^\s-]{8,}$/,CH=/^[0-9a-z]+$/,AH=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,IH=/^[0-9a-vA-V]{20}$/,OH=/^[A-Za-z0-9]{27}$/,DH=/^[a-zA-Z0-9_-]{21}$/,$H=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Rre=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,LH=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,vu=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Nre=vu(4),kre=vu(6),Cre=vu(7),MH=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Are=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,Ire=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,jH=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,Ore=jH,Dre=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,$re="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function PH(){return new RegExp($re,"u")}const UH=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,zH=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,FH=e=>{const t=co(e??":");return new RegExp(`^(?:[0-9A-F]{2}${t}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${t}){5}[0-9a-f]{2}$`)},BH=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,qH=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,HH=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,uC=/^[A-Za-z0-9_-]*$/,VH=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,GH=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,WH=/^\+(?:[0-9]){6,14}[0-9]$/,KH="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",YH=new RegExp(`^${KH}$`);function ZH(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function XH(e){return new RegExp(`^${ZH(e)}$`)}function JH(e){const t=ZH({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const r=`${t}(?:${n.join("|")})`;return new RegExp(`^${KH}T(?:${r})$`)}const QH=e=>{const t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},e5=/^-?\d+n?$/,t5=/^-?\d+$/,n5=/^-?\d+(?:\.\d+)?/,r5=/^(?:true|false)$/i,a5=/^null$/i,i5=/^undefined$/i,o5=/^[^A-Z]*$/,s5=/^[^a-z]*$/,l5=/^[0-9a-fA-F]*$/;function tp(e,t){return new RegExp(`^[A-Za-z0-9+/]{${e}}${t}$`)}function np(e){return new RegExp(`^[A-Za-z0-9_-]{${e}}$`)}const Lre=/^[0-9a-fA-F]{32}$/,Mre=tp(22,"=="),jre=np(22),Pre=/^[0-9a-fA-F]{40}$/,Ure=tp(27,"="),zre=np(27),Fre=/^[0-9a-fA-F]{64}$/,Bre=tp(43,"="),qre=np(43),Hre=/^[0-9a-fA-F]{96}$/,Vre=tp(64,""),Gre=np(64),Wre=/^[0-9a-fA-F]{128}$/,Kre=tp(86,"=="),Yre=np(86),dC=Object.freeze(Object.defineProperty({__proto__:null,base64:HH,base64url:uC,bigint:e5,boolean:r5,browserEmail:Dre,cidrv4:BH,cidrv6:qH,cuid:kH,cuid2:CH,date:YH,datetime:JH,domain:GH,duration:$H,e164:WH,email:MH,emoji:PH,extendedDuration:Rre,guid:LH,hex:l5,hostname:VH,html5Email:Are,idnEmail:Ore,integer:t5,ipv4:UH,ipv6:zH,ksuid:OH,lowercase:o5,mac:FH,md5_base64:Mre,md5_base64url:jre,md5_hex:Lre,nanoid:DH,null:a5,number:n5,rfc5322Email:Ire,sha1_base64:Ure,sha1_base64url:zre,sha1_hex:Pre,sha256_base64:Bre,sha256_base64url:qre,sha256_hex:Fre,sha384_base64:Vre,sha384_base64url:Gre,sha384_hex:Hre,sha512_base64:Kre,sha512_base64url:Yre,sha512_hex:Wre,string:QH,time:XH,ulid:AH,undefined:i5,unicodeEmail:jH,uppercase:s5,uuid:vu,uuid4:Nre,uuid6:kre,uuid7:Cre,xid:IH},Symbol.toStringTag,{value:"Module"})),Tn=me("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),c5={number:"number",bigint:"bigint",object:"date"},fC=me("$ZodCheckLessThan",(e,t)=>{Tn.init(e,t);const n=c5[typeof t.value];e._zod.onattach.push(r=>{const a=r._zod.bag,i=(t.inclusive?a.maximum:a.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<i&&(t.inclusive?a.maximum=t.value:a.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:"too_big",maximum:t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),pC=me("$ZodCheckGreaterThan",(e,t)=>{Tn.init(e,t);const n=c5[typeof t.value];e._zod.onattach.push(r=>{const a=r._zod.bag,i=(t.inclusive?a.minimum:a.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>i&&(t.inclusive?a.minimum=t.value:a.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:"too_small",minimum:t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),u5=me("$ZodCheckMultipleOf",(e,t)=>{Tn.init(e,t),e._zod.onattach.push(n=>{var r;(r=n._zod.bag).multipleOf??(r.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?n.value%t.value===BigInt(0):oH(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),d5=me("$ZodCheckNumberFormat",(e,t)=>{Tn.init(e,t),t.format=t.format||"float64";const n=t.format?.includes("int"),r=n?"int":"number",[a,i]=dH[t.format];e._zod.onattach.push(s=>{const c=s._zod.bag;c.format=t.format,c.minimum=a,c.maximum=i,n&&(c.pattern=t5)}),e._zod.check=s=>{const c=s.value;if(n){if(!Number.isInteger(c)){s.issues.push({expected:r,format:t.format,code:"invalid_type",continue:!1,input:c,inst:e});return}if(!Number.isSafeInteger(c)){c>0?s.issues.push({input:c,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,continue:!t.abort}):s.issues.push({input:c,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,continue:!t.abort});return}}c<a&&s.issues.push({origin:"number",input:c,code:"too_small",minimum:a,inclusive:!0,inst:e,continue:!t.abort}),c>i&&s.issues.push({origin:"number",input:c,code:"too_big",maximum:i,inst:e})}}),f5=me("$ZodCheckBigIntFormat",(e,t)=>{Tn.init(e,t);const[n,r]=fH[t.format];e._zod.onattach.push(a=>{const i=a._zod.bag;i.format=t.format,i.minimum=n,i.maximum=r}),e._zod.check=a=>{const i=a.value;i<n&&a.issues.push({origin:"bigint",input:i,code:"too_small",minimum:n,inclusive:!0,inst:e,continue:!t.abort}),i>r&&a.issues.push({origin:"bigint",input:i,code:"too_big",maximum:r,inst:e})}}),p5=me("$ZodCheckMaxSize",(e,t)=>{var n;Tn.init(e,t),(n=e._zod.def).when??(n.when=r=>{const a=r.value;return!Tl(a)&&a.size!==void 0}),e._zod.onattach.push(r=>{const a=r._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<a&&(r._zod.bag.maximum=t.maximum)}),e._zod.check=r=>{const a=r.value;a.size<=t.maximum||r.issues.push({origin:hv(a),code:"too_big",maximum:t.maximum,inclusive:!0,input:a,inst:e,continue:!t.abort})}}),m5=me("$ZodCheckMinSize",(e,t)=>{var n;Tn.init(e,t),(n=e._zod.def).when??(n.when=r=>{const a=r.value;return!Tl(a)&&a.size!==void 0}),e._zod.onattach.push(r=>{const a=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>a&&(r._zod.bag.minimum=t.minimum)}),e._zod.check=r=>{const a=r.value;a.size>=t.minimum||r.issues.push({origin:hv(a),code:"too_small",minimum:t.minimum,inclusive:!0,input:a,inst:e,continue:!t.abort})}}),h5=me("$ZodCheckSizeEquals",(e,t)=>{var n;Tn.init(e,t),(n=e._zod.def).when??(n.when=r=>{const a=r.value;return!Tl(a)&&a.size!==void 0}),e._zod.onattach.push(r=>{const a=r._zod.bag;a.minimum=t.size,a.maximum=t.size,a.size=t.size}),e._zod.check=r=>{const a=r.value,i=a.size;if(i===t.size)return;const s=i>t.size;r.issues.push({origin:hv(a),...s?{code:"too_big",maximum:t.size}:{code:"too_small",minimum:t.size},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),g5=me("$ZodCheckMaxLength",(e,t)=>{var n;Tn.init(e,t),(n=e._zod.def).when??(n.when=r=>{const a=r.value;return!Tl(a)&&a.length!==void 0}),e._zod.onattach.push(r=>{const a=r._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<a&&(r._zod.bag.maximum=t.maximum)}),e._zod.check=r=>{const a=r.value;if(a.length<=t.maximum)return;const s=gv(a);r.issues.push({origin:s,code:"too_big",maximum:t.maximum,inclusive:!0,input:a,inst:e,continue:!t.abort})}}),v5=me("$ZodCheckMinLength",(e,t)=>{var n;Tn.init(e,t),(n=e._zod.def).when??(n.when=r=>{const a=r.value;return!Tl(a)&&a.length!==void 0}),e._zod.onattach.push(r=>{const a=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>a&&(r._zod.bag.minimum=t.minimum)}),e._zod.check=r=>{const a=r.value;if(a.length>=t.minimum)return;const s=gv(a);r.issues.push({origin:s,code:"too_small",minimum:t.minimum,inclusive:!0,input:a,inst:e,continue:!t.abort})}}),b5=me("$ZodCheckLengthEquals",(e,t)=>{var n;Tn.init(e,t),(n=e._zod.def).when??(n.when=r=>{const a=r.value;return!Tl(a)&&a.length!==void 0}),e._zod.onattach.push(r=>{const a=r._zod.bag;a.minimum=t.length,a.maximum=t.length,a.length=t.length}),e._zod.check=r=>{const a=r.value,i=a.length;if(i===t.length)return;const s=gv(a),c=i>t.length;r.issues.push({origin:s,...c?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),rp=me("$ZodCheckStringFormat",(e,t)=>{var n,r;Tn.init(e,t),e._zod.onattach.push(a=>{const i=a._zod.bag;i.format=t.format,t.pattern&&(i.patterns??(i.patterns=new Set),i.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=a=>{t.pattern.lastIndex=0,!t.pattern.test(a.value)&&a.issues.push({origin:"string",code:"invalid_format",format:t.format,input:a.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),y5=me("$ZodCheckRegex",(e,t)=>{rp.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),w5=me("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=o5),rp.init(e,t)}),S5=me("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=s5),rp.init(e,t)}),E5=me("$ZodCheckIncludes",(e,t)=>{Tn.init(e,t);const n=co(t.includes),r=new RegExp(typeof t.position=="number"?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(a=>{const i=a._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(r)}),e._zod.check=a=>{a.value.includes(t.includes,t.position)||a.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:a.value,inst:e,continue:!t.abort})}}),_5=me("$ZodCheckStartsWith",(e,t)=>{Tn.init(e,t);const n=new RegExp(`^${co(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{const a=r._zod.bag;a.patterns??(a.patterns=new Set),a.patterns.add(n)}),e._zod.check=r=>{r.value.startsWith(t.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),x5=me("$ZodCheckEndsWith",(e,t)=>{Tn.init(e,t);const n=new RegExp(`.*${co(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{const a=r._zod.bag;a.patterns??(a.patterns=new Set),a.patterns.add(n)}),e._zod.check=r=>{r.value.endsWith(t.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}});function mM(e,t,n){e.issues.length&&t.issues.push(...Xa(n,e.issues))}const T5=me("$ZodCheckProperty",(e,t)=>{Tn.init(e,t),e._zod.check=n=>{const r=t.schema._zod.run({value:n.value[t.property],issues:[]},{});if(r instanceof Promise)return r.then(a=>mM(a,n,t.property));mM(r,n,t.property)}}),R5=me("$ZodCheckMimeType",(e,t)=>{Tn.init(e,t);const n=new Set(t.mime);e._zod.onattach.push(r=>{r._zod.bag.mime=t.mime}),e._zod.check=r=>{n.has(r.value.type)||r.issues.push({code:"invalid_value",values:t.mime,input:r.value.type,inst:e,continue:!t.abort})}}),N5=me("$ZodCheckOverwrite",(e,t)=>{Tn.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class k5{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const r=t.split(`
|
|
4
4
|
`).filter(s=>s),a=Math.min(...r.map(s=>s.length-s.trimStart().length)),i=r.map(s=>s.slice(a)).map(s=>" ".repeat(this.indent*2)+s);for(const s of i)this.content.push(s)}compile(){const t=Function,n=this?.args,a=[...(this?.content??[""]).map(i=>` ${i}`)];return new t(...n,a.join(`
|
|
5
5
|
`))}}const C5={major:4,minor:1,patch:13},yt=me("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=C5;const r=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&r.unshift(e);for(const a of r)for(const i of a._zod.onattach)i(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const a=(s,c,u)=>{let d=Qs(s),p;for(const h of c){if(h._zod.def.when){if(!h._zod.def.when(s))continue}else if(d)continue;const v=s.issues.length,y=h._zod.check(s);if(y instanceof Promise&&u?.async===!1)throw new il;if(p||y instanceof Promise)p=(p??Promise.resolve()).then(async()=>{await y,s.issues.length!==v&&(d||(d=Qs(s,v)))});else{if(s.issues.length===v)continue;d||(d=Qs(s,v))}}return p?p.then(()=>s):s},i=(s,c,u)=>{if(Qs(s))return s.aborted=!0,s;const d=a(c,r,u);if(d instanceof Promise){if(u.async===!1)throw new il;return d.then(p=>e._zod.parse(p,u))}return e._zod.parse(d,u)};e._zod.run=(s,c)=>{if(c.skipChecks)return e._zod.parse(s,c);if(c.direction==="backward"){const d=e._zod.parse({value:s.value,issues:[]},{...c,skipChecks:!0});return d instanceof Promise?d.then(p=>i(p,s,c)):i(d,s,c)}const u=e._zod.parse(s,c);if(u instanceof Promise){if(c.async===!1)throw new il;return u.then(d=>a(d,r,c))}return a(u,r,c)}}e["~standard"]={validate:a=>{try{const i=tC(e,a);return i.success?{value:i.data}:{issues:i.error?.issues}}catch{return NH(e,a).then(s=>s.success?{value:s.data}:{issues:s.error?.issues})}},vendor:"zod",version:1}}),ap=me("$ZodString",(e,t)=>{yt.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??QH(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value=="string"||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}}),fn=me("$ZodStringFormat",(e,t)=>{rp.init(e,t),ap.init(e,t)}),A5=me("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=LH),fn.init(e,t)}),I5=me("$ZodUUID",(e,t)=>{if(t.version){const r={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(r===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=vu(r))}else t.pattern??(t.pattern=vu());fn.init(e,t)}),O5=me("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=MH),fn.init(e,t)}),D5=me("$ZodURL",(e,t)=>{fn.init(e,t),e._zod.check=n=>{try{const r=n.value.trim(),a=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(a.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(a.protocol.endsWith(":")?a.protocol.slice(0,-1):a.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=a.href:n.value=r;return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),$5=me("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=PH()),fn.init(e,t)}),L5=me("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=DH),fn.init(e,t)}),M5=me("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=kH),fn.init(e,t)}),j5=me("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=CH),fn.init(e,t)}),P5=me("$ZodULID",(e,t)=>{t.pattern??(t.pattern=AH),fn.init(e,t)}),U5=me("$ZodXID",(e,t)=>{t.pattern??(t.pattern=IH),fn.init(e,t)}),z5=me("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=OH),fn.init(e,t)}),F5=me("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=JH(t)),fn.init(e,t)}),B5=me("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=YH),fn.init(e,t)}),q5=me("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=XH(t)),fn.init(e,t)}),H5=me("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=$H),fn.init(e,t)}),V5=me("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=UH),fn.init(e,t),e._zod.bag.format="ipv4"}),G5=me("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=zH),fn.init(e,t),e._zod.bag.format="ipv6",e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}}),W5=me("$ZodMAC",(e,t)=>{t.pattern??(t.pattern=FH(t.delimiter)),fn.init(e,t),e._zod.bag.format="mac"}),K5=me("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=BH),fn.init(e,t)}),Y5=me("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=qH),fn.init(e,t),e._zod.check=n=>{const r=n.value.split("/");try{if(r.length!==2)throw new Error;const[a,i]=r;if(!i)throw new Error;const s=Number(i);if(`${s}`!==i)throw new Error;if(s<0||s>128)throw new Error;new URL(`http://[${a}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}});function mC(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const Z5=me("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=HH),fn.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=n=>{mC(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});function X5(e){if(!uC.test(e))return!1;const t=e.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return mC(n)}const J5=me("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=uC),fn.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=n=>{X5(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),Q5=me("$ZodE164",(e,t)=>{t.pattern??(t.pattern=WH),fn.init(e,t)});function eV(e,t=null){try{const n=e.split(".");if(n.length!==3)return!1;const[r]=n;if(!r)return!1;const a=JSON.parse(atob(r));return!("typ"in a&&a?.typ!=="JWT"||!a.alg||t&&(!("alg"in a)||a.alg!==t))}catch{return!1}}const tV=me("$ZodJWT",(e,t)=>{fn.init(e,t),e._zod.check=n=>{eV(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),nV=me("$ZodCustomStringFormat",(e,t)=>{fn.init(e,t),e._zod.check=n=>{t.fn(n.value)||n.issues.push({code:"invalid_format",format:t.format,input:n.value,inst:e,continue:!t.abort})}}),hC=me("$ZodNumber",(e,t)=>{yt.init(e,t),e._zod.pattern=e._zod.bag.pattern??n5,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}const a=n.value;if(typeof a=="number"&&!Number.isNaN(a)&&Number.isFinite(a))return n;const i=typeof a=="number"?Number.isNaN(a)?"NaN":Number.isFinite(a)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:a,inst:e,...i?{received:i}:{}}),n}}),rV=me("$ZodNumberFormat",(e,t)=>{d5.init(e,t),hC.init(e,t)}),gC=me("$ZodBoolean",(e,t)=>{yt.init(e,t),e._zod.pattern=r5,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}const a=n.value;return typeof a=="boolean"||n.issues.push({expected:"boolean",code:"invalid_type",input:a,inst:e}),n}}),vC=me("$ZodBigInt",(e,t)=>{yt.init(e,t),e._zod.pattern=e5,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=BigInt(n.value)}catch{}return typeof n.value=="bigint"||n.issues.push({expected:"bigint",code:"invalid_type",input:n.value,inst:e}),n}}),aV=me("$ZodBigIntFormat",(e,t)=>{f5.init(e,t),vC.init(e,t)}),iV=me("$ZodSymbol",(e,t)=>{yt.init(e,t),e._zod.parse=(n,r)=>{const a=n.value;return typeof a=="symbol"||n.issues.push({expected:"symbol",code:"invalid_type",input:a,inst:e}),n}}),oV=me("$ZodUndefined",(e,t)=>{yt.init(e,t),e._zod.pattern=i5,e._zod.values=new Set([void 0]),e._zod.optin="optional",e._zod.optout="optional",e._zod.parse=(n,r)=>{const a=n.value;return typeof a>"u"||n.issues.push({expected:"undefined",code:"invalid_type",input:a,inst:e}),n}}),sV=me("$ZodNull",(e,t)=>{yt.init(e,t),e._zod.pattern=a5,e._zod.values=new Set([null]),e._zod.parse=(n,r)=>{const a=n.value;return a===null||n.issues.push({expected:"null",code:"invalid_type",input:a,inst:e}),n}}),lV=me("$ZodAny",(e,t)=>{yt.init(e,t),e._zod.parse=n=>n}),cV=me("$ZodUnknown",(e,t)=>{yt.init(e,t),e._zod.parse=n=>n}),uV=me("$ZodNever",(e,t)=>{yt.init(e,t),e._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)}),dV=me("$ZodVoid",(e,t)=>{yt.init(e,t),e._zod.parse=(n,r)=>{const a=n.value;return typeof a>"u"||n.issues.push({expected:"void",code:"invalid_type",input:a,inst:e}),n}}),fV=me("$ZodDate",(e,t)=>{yt.init(e,t),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=new Date(n.value)}catch{}const a=n.value,i=a instanceof Date;return i&&!Number.isNaN(a.getTime())||n.issues.push({expected:"date",code:"invalid_type",input:a,...i?{received:"Invalid Date"}:{},inst:e}),n}});function hM(e,t,n){e.issues.length&&t.issues.push(...Xa(n,e.issues)),t.value[n]=e.value}const pV=me("$ZodArray",(e,t)=>{yt.init(e,t),e._zod.parse=(n,r)=>{const a=n.value;if(!Array.isArray(a))return n.issues.push({expected:"array",code:"invalid_type",input:a,inst:e}),n;n.value=Array(a.length);const i=[];for(let s=0;s<a.length;s++){const c=a[s],u=t.element._zod.run({value:c,issues:[]},r);u instanceof Promise?i.push(u.then(d=>hM(d,n,s))):hM(u,n,s)}return i.length?Promise.all(i).then(()=>n):n}});function Ng(e,t,n,r){e.issues.length&&t.issues.push(...Xa(n,e.issues)),e.value===void 0?n in r&&(t.value[n]=void 0):t.value[n]=e.value}function mV(e){const t=Object.keys(e.shape);for(const r of t)if(!e.shape?.[r]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${r}": expected a Zod schema`);const n=uH(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function hV(e,t,n,r,a,i){const s=[],c=a.keySet,u=a.catchall._zod,d=u.def.type;for(const p in t){if(c.has(p))continue;if(d==="never"){s.push(p);continue}const h=u.run({value:t[p],issues:[]},r);h instanceof Promise?e.push(h.then(v=>Ng(v,n,p,t))):Ng(h,n,p,t)}return s.length&&n.issues.push({code:"unrecognized_keys",keys:s,input:t,inst:i}),e.length?Promise.all(e).then(()=>n):n}const gV=me("$ZodObject",(e,t)=>{if(yt.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){const c=t.shape;Object.defineProperty(t,"shape",{get:()=>{const u={...c};return Object.defineProperty(t,"shape",{value:u}),u}})}const r=Zf(()=>mV(t));$t(e._zod,"propValues",()=>{const c=t.shape,u={};for(const d in c){const p=c[d]._zod;if(p.values){u[d]??(u[d]=new Set);for(const h of p.values)u[d].add(h)}}return u});const a=hu,i=t.catchall;let s;e._zod.parse=(c,u)=>{s??(s=r.value);const d=c.value;if(!a(d))return c.issues.push({expected:"object",code:"invalid_type",input:d,inst:e}),c;c.value={};const p=[],h=s.shape;for(const v of s.keys){const E=h[v]._zod.run({value:d[v],issues:[]},u);E instanceof Promise?p.push(E.then(x=>Ng(x,c,v,d))):Ng(E,c,v,d)}return i?hV(p,d,c,u,r.value,e):p.length?Promise.all(p).then(()=>c):c}}),vV=me("$ZodObjectJIT",(e,t)=>{gV.init(e,t);const n=e._zod.parse,r=Zf(()=>mV(t)),a=v=>{const y=new k5(["shape","payload","ctx"]),E=r.value,x=T=>{const k=JR(T);return`shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`};y.write("const input = payload.value;");const _=Object.create(null);let S=0;for(const T of E.keys)_[T]=`key_${S++}`;y.write("const newResult = {};");for(const T of E.keys){const k=_[T],N=JR(T);y.write(`const ${k} = ${x(T)};`),y.write(`
|
|
@@ -41,7 +41,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
41
41
|
<p>You can close this window or <a href="#" onclick="window.close(); return false;">click here to close</a>.</p>
|
|
42
42
|
<pre style="font-size: 0.8em; color: #555; margin-top: 20px; white-space: pre-wrap;">${d instanceof Error?d.stack:""}</pre>
|
|
43
43
|
</div>
|
|
44
|
-
`}catch(h){console.error(`${i} Could not display error in callback window:`,h)}u&&localStorage.removeItem(u),s&&(localStorage.removeItem(s.getKey("code_verifier")),localStorage.removeItem(s.getKey("last_auth_url")))}}Ge(tI,"onMcpAuthorization");var uS={exports:{}},bt={};var oP;function gde(){if(oP)return bt;oP=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),i=Symbol.for("react.consumer"),s=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),d=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),h=Symbol.for("react.activity"),v=Symbol.iterator;function y(P){return P===null||typeof P!="object"?null:(P=v&&P[v]||P["@@iterator"],typeof P=="function"?P:null)}var E={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},x=Object.assign,_={};function S(P,B,j){this.props=P,this.context=B,this.refs=_,this.updater=j||E}S.prototype.isReactComponent={},S.prototype.setState=function(P,B){if(typeof P!="object"&&typeof P!="function"&&P!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,P,B,"setState")},S.prototype.forceUpdate=function(P){this.updater.enqueueForceUpdate(this,P,"forceUpdate")};function w(){}w.prototype=S.prototype;function T(P,B,j){this.props=P,this.context=B,this.refs=_,this.updater=j||E}var k=T.prototype=new w;k.constructor=T,x(k,S.prototype),k.isPureReactComponent=!0;var N=Array.isArray;function A(){}var C={H:null,A:null,T:null,S:null},O=Object.prototype.hasOwnProperty;function L(P,B,j){var $=j.ref;return{$$typeof:e,type:P,key:B,ref:$!==void 0?$:null,props:j}}function F(P,B){return L(P.type,B,P.props)}function z(P){return typeof P=="object"&&P!==null&&P.$$typeof===e}function K(P){var B={"=":"=0",":":"=2"};return"$"+P.replace(/[=:]/g,function(j){return B[j]})}var ee=/\/+/g;function J(P,B){return typeof P=="object"&&P!==null&&P.key!=null?K(""+P.key):B.toString(36)}function le(P){switch(P.status){case"fulfilled":return P.value;case"rejected":throw P.reason;default:switch(typeof P.status=="string"?P.then(A,A):(P.status="pending",P.then(function(B){P.status==="pending"&&(P.status="fulfilled",P.value=B)},function(B){P.status==="pending"&&(P.status="rejected",P.reason=B)})),P.status){case"fulfilled":return P.value;case"rejected":throw P.reason}}throw P}function q(P,B,j,$,U){var H=typeof P;(H==="undefined"||H==="boolean")&&(P=null);var W=!1;if(P===null)W=!0;else switch(H){case"bigint":case"string":case"number":W=!0;break;case"object":switch(P.$$typeof){case e:case t:W=!0;break;case p:return W=P._init,q(W(P._payload),B,j,$,U)}}if(W)return U=U(P),W=$===""?"."+J(P,0):$,N(U)?(j="",W!=null&&(j=W.replace(ee,"$&/")+"/"),q(U,B,j,"",function(ue){return ue})):U!=null&&(z(U)&&(U=F(U,j+(U.key==null||P&&P.key===U.key?"":(""+U.key).replace(ee,"$&/")+"/")+W)),B.push(U)),1;W=0;var X=$===""?".":$+":";if(N(P))for(var de=0;de<P.length;de++)$=P[de],H=X+J($,de),W+=q($,B,j,H,U);else if(de=y(P),typeof de=="function")for(P=de.call(P),de=0;!($=P.next()).done;)$=$.value,H=X+J($,de++),W+=q($,B,j,H,U);else if(H==="object"){if(typeof P.then=="function")return q(le(P),B,j,$,U);throw B=String(P),Error("Objects are not valid as a React child (found: "+(B==="[object Object]"?"object with keys {"+Object.keys(P).join(", ")+"}":B)+"). If you meant to render a collection of children, use an array instead.")}return W}function Z(P,B,j){if(P==null)return P;var $=[],U=0;return q(P,$,"","",function(H){return B.call(j,H,U++)}),$}function G(P){if(P._status===-1){var B=P._result;B=B(),B.then(function(j){(P._status===0||P._status===-1)&&(P._status=1,P._result=j)},function(j){(P._status===0||P._status===-1)&&(P._status=2,P._result=j)}),P._status===-1&&(P._status=0,P._result=B)}if(P._status===1)return P._result.default;throw P._result}var ie=typeof reportError=="function"?reportError:function(P){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var B=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof P=="object"&&P!==null&&typeof P.message=="string"?String(P.message):String(P),error:P});if(!window.dispatchEvent(B))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",P);return}console.error(P)},te={map:Z,forEach:function(P,B,j){Z(P,function(){B.apply(this,arguments)},j)},count:function(P){var B=0;return Z(P,function(){B++}),B},toArray:function(P){return Z(P,function(B){return B})||[]},only:function(P){if(!z(P))throw Error("React.Children.only expected to receive a single React element child.");return P}};return bt.Activity=h,bt.Children=te,bt.Component=S,bt.Fragment=n,bt.Profiler=a,bt.PureComponent=T,bt.StrictMode=r,bt.Suspense=u,bt.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=C,bt.__COMPILER_RUNTIME={__proto__:null,c:function(P){return C.H.useMemoCache(P)}},bt.cache=function(P){return function(){return P.apply(null,arguments)}},bt.cacheSignal=function(){return null},bt.cloneElement=function(P,B,j){if(P==null)throw Error("The argument must be a React element, but you passed "+P+".");var $=x({},P.props),U=P.key;if(B!=null)for(H in B.key!==void 0&&(U=""+B.key),B)!O.call(B,H)||H==="key"||H==="__self"||H==="__source"||H==="ref"&&B.ref===void 0||($[H]=B[H]);var H=arguments.length-2;if(H===1)$.children=j;else if(1<H){for(var W=Array(H),X=0;X<H;X++)W[X]=arguments[X+2];$.children=W}return L(P.type,U,$)},bt.createContext=function(P){return P={$$typeof:s,_currentValue:P,_currentValue2:P,_threadCount:0,Provider:null,Consumer:null},P.Provider=P,P.Consumer={$$typeof:i,_context:P},P},bt.createElement=function(P,B,j){var $,U={},H=null;if(B!=null)for($ in B.key!==void 0&&(H=""+B.key),B)O.call(B,$)&&$!=="key"&&$!=="__self"&&$!=="__source"&&(U[$]=B[$]);var W=arguments.length-2;if(W===1)U.children=j;else if(1<W){for(var X=Array(W),de=0;de<W;de++)X[de]=arguments[de+2];U.children=X}if(P&&P.defaultProps)for($ in W=P.defaultProps,W)U[$]===void 0&&(U[$]=W[$]);return L(P,H,U)},bt.createRef=function(){return{current:null}},bt.forwardRef=function(P){return{$$typeof:c,render:P}},bt.isValidElement=z,bt.lazy=function(P){return{$$typeof:p,_payload:{_status:-1,_result:P},_init:G}},bt.memo=function(P,B){return{$$typeof:d,type:P,compare:B===void 0?null:B}},bt.startTransition=function(P){var B=C.T,j={};C.T=j;try{var $=P(),U=C.S;U!==null&&U(j,$),typeof $=="object"&&$!==null&&typeof $.then=="function"&&$.then(A,ie)}catch(H){ie(H)}finally{B!==null&&j.types!==null&&(B.types=j.types),C.T=B}},bt.unstable_useCacheRefresh=function(){return C.H.useCacheRefresh()},bt.use=function(P){return C.H.use(P)},bt.useActionState=function(P,B,j){return C.H.useActionState(P,B,j)},bt.useCallback=function(P,B){return C.H.useCallback(P,B)},bt.useContext=function(P){return C.H.useContext(P)},bt.useDebugValue=function(){},bt.useDeferredValue=function(P,B){return C.H.useDeferredValue(P,B)},bt.useEffect=function(P,B){return C.H.useEffect(P,B)},bt.useEffectEvent=function(P){return C.H.useEffectEvent(P)},bt.useId=function(){return C.H.useId()},bt.useImperativeHandle=function(P,B,j){return C.H.useImperativeHandle(P,B,j)},bt.useInsertionEffect=function(P,B){return C.H.useInsertionEffect(P,B)},bt.useLayoutEffect=function(P,B){return C.H.useLayoutEffect(P,B)},bt.useMemo=function(P,B){return C.H.useMemo(P,B)},bt.useOptimistic=function(P,B){return C.H.useOptimistic(P,B)},bt.useReducer=function(P,B,j){return C.H.useReducer(P,B,j)},bt.useRef=function(P){return C.H.useRef(P)},bt.useState=function(P){return C.H.useState(P)},bt.useSyncExternalStore=function(P,B,j){return C.H.useSyncExternalStore(P,B,j)},bt.useTransition=function(){return C.H.useTransition()},bt.version="19.2.0",bt}var sP;function nI(){return sP||(sP=1,uS.exports=gde()),uS.exports}var b=nI();const se=Au(b),Pv=Gne({__proto__:null,default:se},[b]);function kN(e,t){if(!e)throw new Error(t)}Ge(kN,"assert");var vde=3e3,bde=5e3;function rI(e){const{url:t,enabled:n=!0,clientName:r,clientUri:a,callbackUrl:i=typeof window<"u"?Dc(new URL("/oauth/callback",window.location.origin).toString()):"/oauth/callback",storageKeyPrefix:s="mcp:auth",clientConfig:c={},customHeaders:u={},debug:d=!1,autoRetry:p=!1,autoReconnect:h=vde,transportType:v="auto",preventAutoAuth:y=!1,useRedirectFlow:E=!1,onPopupWindow:x,timeout:_=3e4,sseReadTimeout:S=3e5,wrapTransport:w,onNotification:T,samplingCallback:k}=e,[N,A]=b.useState("discovering"),[C,O]=b.useState([]),[L,F]=b.useState([]),[z,K]=b.useState([]),[ee,J]=b.useState([]),[le,q]=b.useState(),[Z,G]=b.useState(),[ie,te]=b.useState(void 0),[P,B]=b.useState([]),[j,$]=b.useState(void 0),U=b.useRef(null),H=b.useRef(null),W=b.useRef(!1),X=b.useRef(!0),de=b.useRef(0),ue=b.useRef(null),Y=b.useRef(N),Q=b.useRef(h),oe=b.useRef(null);b.useEffect(()=>{Y.current=N,Q.current=h},[N,h]);const ae=b.useCallback((Oe,Me,...dt)=>{const Bt=dt.length>0?`${Me} ${dt.map(De=>JSON.stringify(De)).join(" ")}`:Me;console[Oe](`[useMcp] ${Bt}`),X.current&&B(De=>[...De.slice(-100),{level:Oe,message:Bt,timestamp:Date.now()}])},[]),Re=b.useCallback(async(Oe=!1)=>{if(Oe||ae("info","Disconnecting..."),W.current=!1,ue.current&&clearTimeout(ue.current),ue.current=null,U.current)try{await U.current.closeSession("inspector-server")}catch(Me){Oe||ae("warn","Error closing session:",Me)}U.current=null,X.current&&!Oe&&(A("discovering"),O([]),F([]),K([]),J([]),te(void 0),$(void 0))},[ae]),Ae=b.useCallback((Oe,Me)=>{if(ae("error",Oe,Me??""),X.current){A("failed"),te(Oe);const dt=H.current?.getLastAttemptedAuthUrl();dt&&($(dt),ae("info","Manual authentication URL may be available.",dt))}W.current=!1},[ae]),Ye=b.useCallback(async()=>{if(!n||!t){ae("debug",n?"No server URL provided, skipping connection.":"Connection disabled via enabled flag.");return}if(W.current){ae("debug","Connection attempt already in progress.");return}if(!X.current){ae("debug","Connect called after unmount, aborting.");return}W.current=!0,de.current+=1,te(void 0),$(void 0),oe.current=null,A("discovering"),ae("info",`Connecting attempt #${de.current} to ${t}...`),H.current||(H.current=new ag(t,{storageKeyPrefix:s,clientName:r,clientUri:a,callbackUrl:i,preventAutoAuth:y,useRedirectFlow:E,onPopupWindow:x}),ae("debug","BrowserOAuthClientProvider initialized in connect.")),U.current||(U.current=new hde,ae("debug","BrowserMCPClient initialized in connect."));const Oe=Ge(async(dt,Bt=!1)=>{ae("info",`Attempting connection with transport: ${dt}`);try{const De="inspector-server",ke={url:t,transport:dt==="sse"?"http":dt};if(u&&Object.keys(u).length>0&&(ke.headers=u),H.current){const Ct=await H.current.tokens();Ct?.access_token&&(ke.headers={...ke.headers,Authorization:`Bearer ${Ct.access_token}`})}U.current.addServer(De,{...ke,authProvider:H.current,clientOptions:c,samplingCallback:k,wrapTransport:w?Ct=>(console.log("[useMcp] Applying transport wrapper for server:",De,"url:",t),w(Ct,t)):void 0});const Fe=await U.current.createSession(De,!1);T&&Fe.on("notification",T),await Fe.initialize(),ae("info","✅ Successfully connected to MCP server"),ae("info","Server info:",Fe.connector.serverInfo),ae("info","Server capabilities:",Fe.connector.serverCapabilities),console.log("[useMcp] Server info:",Fe.connector.serverInfo),console.log("[useMcp] Server capabilities:",Fe.connector.serverCapabilities),A("ready"),oe.current=dt,O(Fe.connector.tools||[]);const vt=await Fe.connector.listAllResources();F(vt.resources||[]);const gt=await Fe.connector.listPrompts();J(gt.prompts||[]);const Lt=Fe.connector.serverInfo,qt=Fe.connector.serverCapabilities;return Lt&&(console.log("[useMcp] Server info:",Lt),q(Lt)),qt&&(console.log("[useMcp] Server capabilities:",qt),G(qt)),"success"}catch(De){const ke=De?.message||String(De);if(De.code===401||ke.includes("401")||ke.includes("Unauthorized")){if(H.current){ae("info","Authentication required. OAuth provider available.");try{const{auth:Fe}=await Za(async()=>{const{auth:gt}=await Promise.resolve().then(()=>Jj);return{auth:gt}},void 0),vt=new URL(t).origin;Fe(H.current,{serverUrl:vt}).catch(()=>{}),setTimeout(()=>{if(X.current){const gt=H.current?.getLastAttemptedAuthUrl();gt?($(gt),ae("info","Manual authentication URL available:",gt)):ae("warn","Could not generate authentication URL")}},100)}catch(Fe){ae("warn","Error generating auth URL:",Fe)}return X.current&&A("pending_auth"),W.current=!1,"auth_redirect"}return u&&Object.keys(u).length>0?(Ae("Authentication failed: Server returned 401 Unauthorized. Check your Authorization header value is correct."),"failed"):(Ae("Authentication required: Server returned 401 Unauthorized. Add an Authorization header in the Custom Headers section (e.g., Authorization: Bearer YOUR_API_KEY)."),"failed")}return Ae(ke,De),"failed"}},"tryConnectWithTransport");let Me="failed";if(v==="sse")ae("debug","Using SSE-only transport mode"),Me=await Oe("sse");else if(v==="http")ae("debug","Using HTTP-only transport mode"),Me=await Oe("http");else{ae("debug","Using auto transport mode (HTTP with SSE fallback)");const dt=await Oe("http");dt==="fallback"&&X.current&&Y.current!=="authenticating"?(ae("info","HTTP failed, attempting SSE fallback..."),Me=await Oe("sse")):Me=dt}(Me==="success"||Me==="failed"||Me==="auth_redirect")&&(W.current=!1),ae("debug",`Connection sequence finished with status: ${Me}`)},[ae,Ae,Re,t,s,r,a,i,c.name,c.version,u,v,y,E,x,n,_,S]),Ee=b.useCallback(async(Oe,Me,dt)=>{if(Y.current!=="ready"||!U.current)throw new Error(`MCP client is not ready (current state: ${N}). Cannot call tool "${Oe}".`);ae("info",`Calling tool: ${Oe}`,Me);try{const De=U.current.getSession("inspector-server");if(!De)throw new Error("No active session found");const ke=await De.connector.callTool(Oe,Me||{},dt);return ae("info",`Tool "${Oe}" call successful:`,ke),ke}catch(Bt){throw ae("error",`Tool "${Oe}" call failed:`,Bt),Bt}},[N]),Ne=b.useCallback(()=>{Y.current==="failed"?(ae("info","Retry requested..."),Ye()):ae("warn",`Retry called but state is not 'failed' (state: ${Y.current}). Ignoring.`)},[ae,Ye]),ze=b.useCallback(async()=>{ae("info","Manual authentication requested...");const Oe=Y.current;if(Oe==="failed")ae("info","Attempting to reconnect and authenticate via retry..."),Ne();else if(Oe==="pending_auth"){ae("info","Proceeding with authentication from pending state...");try{kN(H.current,"Auth Provider not available for manual auth"),kN(t,"Server URL is required for authentication"),ae("info","Clearing all OAuth state and initiating fresh flow...");const Me=`${s}:${H.current.serverUrlHash}`;Object.keys(localStorage).forEach(ke=>{ke.startsWith(Me)&&(ae("debug",`Removing stale OAuth key: ${ke}`),localStorage.removeItem(ke)),ke.startsWith(`${s}:state_`)&&(ae("debug",`Removing orphaned state: ${ke}`),localStorage.removeItem(ke))}),A("authenticating");const dt=new ag(t,{storageKeyPrefix:s,clientName:r,clientUri:a,callbackUrl:i,preventAutoAuth:!1,useRedirectFlow:E,onPopupWindow:x});H.current=dt,ae("info","Triggering fresh OAuth authorization...");const{auth:Bt}=await Za(async()=>{const{auth:ke}=await Promise.resolve().then(()=>Jj);return{auth:ke}},void 0),De=new URL(t).origin;Bt(dt,{serverUrl:De}).catch(ke=>{ae("info","OAuth flow initiated:",ke?.message||"Redirecting...")})}catch(Me){if(!X.current)return;A("pending_auth"),ae("error",`Manual authentication failed: ${Me instanceof Error?Me.message:String(Me)}`)}}else if(Oe==="authenticating"){ae("warn","Already attempting authentication. Check for blocked popups or wait for timeout.");const Me=H.current?.getLastAttemptedAuthUrl();Me&&!j&&($(Me),ae("info","Manual authentication URL retrieved:",Me))}else ae("info",`Client not in a state requiring manual authentication trigger (state: ${Oe}). If needed, try disconnecting and reconnecting.`)},[ae,Ne,j,t,E,x,s,r,a,i]),he=b.useCallback(()=>{if(H.current){const Oe=H.current.clearStorage();ae("info",`Cleared ${Oe} item(s) from localStorage for ${t}.`),$(void 0),Re()}else ae("warn","Auth provider not initialized, cannot clear storage.")},[t,ae,Re]),je=b.useCallback(async()=>{if(Y.current!=="ready"||!U.current)throw new Error(`MCP client is not ready (current state: ${N}). Cannot list resources.`);ae("info","Listing resources");try{const Me=U.current.getSession("inspector-server");if(!Me)throw new Error("No active session found");const dt=await Me.connector.listAllResources();F(dt.resources||[]),ae("info","Resources listed successfully")}catch(Oe){throw ae("error","List resources failed:",Oe),Oe}},[N]),Ze=b.useCallback(async Oe=>{if(Y.current!=="ready"||!U.current)throw new Error(`MCP client is not ready (current state: ${N}). Cannot read resource.`);ae("info",`Reading resource: ${Oe}`);try{const dt=U.current.getSession("inspector-server");if(!dt)throw new Error("No active session found");const Bt=await dt.connector.readResource(Oe);return ae("info","Resource read successful:",Bt),Bt}catch(Me){throw ae("error","Resource read failed:",Me),Me}},[N]),Se=b.useCallback(async()=>{if(Y.current!=="ready"||!U.current)throw new Error(`MCP client is not ready (current state: ${N}). Cannot list prompts.`);ae("info","Listing prompts");try{const Me=U.current.getSession("inspector-server");if(!Me)throw new Error("No active session found");const dt=await Me.connector.listPrompts();J(dt.prompts||[]),ae("info","Prompts listed successfully")}catch(Oe){throw ae("error","List prompts failed:",Oe),Oe}},[N]),ot=b.useCallback(async(Oe,Me)=>{if(Y.current!=="ready"||!U.current)throw new Error(`MCP client is not ready (current state: ${N}). Cannot get prompt.`);ae("info",`Getting prompt: ${Oe}`,Me);try{const Bt=U.current.getSession("inspector-server");if(!Bt)throw new Error("No active session found");const De=await Bt.connector.getPrompt(Oe,Me||{});return ae("info",`Prompt "${Oe}" retrieved successfully:`,De),De}catch(dt){throw ae("error",`Prompt "${Oe}" retrieval failed:`,dt),dt}},[N]),ut=b.useRef(Ye),tt=b.useRef(Ae);return b.useEffect(()=>{ut.current=Ye,tt.current=Ae}),b.useEffect(()=>{const Oe=Ge(Me=>{Me.origin===window.location.origin&&Me.data?.type==="mcp_auth_callback"&&(ae("info","Received auth callback message.",Me.data),ue.current&&clearTimeout(ue.current),ue.current=null,Me.data.success?(ae("info","Authentication successful via popup. Reconnecting client..."),W.current&&ae("debug","Connection attempt already in progress, resetting flag to allow reconnection."),W.current=!1,setTimeout(()=>{X.current&&(ae("debug","Initiating reconnection after successful auth callback."),ut.current())},100)):tt.current(`Authentication failed in callback: ${Me.data.error||"Unknown reason."}`))},"messageHandler");return window.addEventListener("message",Oe),ae("debug","Auth callback message listener added."),()=>{window.removeEventListener("message",Oe),ae("debug","Auth callback message listener removed."),ue.current&&clearTimeout(ue.current)}},[ae]),b.useEffect(()=>(X.current=!0,!n||!t?(ae("debug",n?"No server URL provided, skipping connection.":"Connection disabled via enabled flag."),A("discovering"),()=>{X.current=!1}):(ae("debug","useMcp mounted, initiating connection."),de.current=0,(!H.current||H.current.serverUrl!==t)&&(H.current=new ag(t,{storageKeyPrefix:s,clientName:r,clientUri:a,callbackUrl:i,preventAutoAuth:y,useRedirectFlow:E,onPopupWindow:x}),ae("debug","BrowserOAuthClientProvider initialized/updated on mount/option change.")),Ye(),()=>{X.current=!1,ae("debug","useMcp unmounting, disconnecting."),Re(!0)})),[t,n,s,i,r,a,c.name,c.version,E]),b.useEffect(()=>{let Oe=null;if(N==="failed"&&p&&de.current>0){const Me=typeof p=="number"?p:bde;ae("info",`Connection failed, auto-retrying in ${Me}ms...`),Oe=setTimeout(()=>{X.current&&Y.current==="failed"&&Ne()},Me)}return()=>{Oe&&clearTimeout(Oe)}},[N,p,Ne,ae]),{state:N,tools:C,resources:L,resourceTemplates:z,prompts:ee,serverInfo:le,capabilities:Z,error:ie,log:P,authUrl:j,client:U.current,callTool:Ee,readResource:Ze,listResources:je,listPrompts:Se,getPrompt:ot,retry:Ne,disconnect:Re,authenticate:ze,clearStorage:he}}Ge(rI,"useMcp");var mu,yde=(mu=class extends se.Component{constructor(t){super(t),this.state={hasError:!1,error:null}}static getDerivedStateFromError(t){return{hasError:!0,error:t}}componentDidCatch(t,n){console.error("Widget Error:",t,n)}render(){return this.state.hasError?se.createElement("div",{className:"p-4 border border-red-500 bg-red-50 text-red-900 rounded-md dark:bg-red-900/20 dark:text-red-100"},se.createElement("h3",{className:"font-bold mb-2"},"Widget Error"),se.createElement("pre",{className:"text-sm whitespace-pre-wrap"},this.state.error?.message)):this.props.children}},Ge(mu,"ErrorBoundary"),mu),df="openai:set_globals";function qa(e){return b.useSyncExternalStore(t=>{const n=Ge(r=>{r.detail.globals[e]!==void 0&&t()},"handleSetGlobal");return typeof window<"u"&&window.addEventListener(df,n),()=>{typeof window<"u"&&window.removeEventListener(df,n)}},()=>typeof window<"u"&&window.openai?window.openai[e]:void 0)}Ge(qa,"useOpenAiGlobal");function Ou(e){const[t,n]=b.useState(()=>typeof window<"u"&&!!window.openai);b.useEffect(()=>{if(typeof window<"u"&&window.openai){n(!0);return}const O=setInterval(()=>{typeof window<"u"&&window.openai&&(n(!0),clearInterval(O))},100),L=Ge(()=>{typeof window<"u"&&window.openai&&(n(!0),clearInterval(O))},"handleSetGlobals");typeof window<"u"&&window.addEventListener(df,L);const F=setTimeout(()=>{clearInterval(O),typeof window<"u"&&window.removeEventListener(df,L)},5e3);return()=>{clearInterval(O),clearTimeout(F),typeof window<"u"&&window.removeEventListener(df,L)}},[]);const r=b.useMemo(()=>t?"openai":"mcp-ui",[t]),a=typeof window<"u"?window.location.search:"",i=b.useMemo(()=>{const O=new URLSearchParams(a);return O.has("mcpUseParams")?JSON.parse(O.get("mcpUseParams")):{toolInput:{},toolOutput:{},toolId:""}},[a]),s=r==="openai"?qa("toolInput"):i.toolInput,c=r==="openai"?qa("toolOutput"):i.toolOutput,u=qa("toolResponseMetadata"),d=qa("widgetState"),p=qa("theme"),h=qa("displayMode"),v=qa("safeArea"),y=qa("maxHeight"),E=qa("userAgent"),x=qa("locale"),_=b.useMemo(()=>typeof window<"u"&&window.__mcpPublicUrl?window.__mcpPublicUrl.replace(/\/mcp-use\/public$/,""):"",[]),[S,w]=b.useState(null);b.useEffect(()=>{d!==void 0&&w(d)},[d]);const T=b.useCallback(async(O,L)=>{if(!window.openai?.callTool)throw new Error("window.openai.callTool is not available");return window.openai.callTool(O,L)},[]),k=b.useCallback(async O=>{if(!window.openai?.sendFollowUpMessage)throw new Error("window.openai.sendFollowUpMessage is not available");return window.openai.sendFollowUpMessage({prompt:O})},[]),N=b.useCallback(O=>{if(!window.openai?.openExternal)throw new Error("window.openai.openExternal is not available");window.openai.openExternal({href:O})},[]),A=b.useCallback(async O=>{if(!window.openai?.requestDisplayMode)throw new Error("window.openai.requestDisplayMode is not available");return window.openai.requestDisplayMode({mode:O})},[]),C=b.useCallback(async O=>{if(!window.openai?.setWidgetState)throw new Error("window.openai.setWidgetState is not available");const F=typeof O=="function"?O(d!==void 0?d:S):O;return w(F),window.openai.setWidgetState(F)},[d,S]);return{props:s||e||{},output:c??null,metadata:u??null,state:S,setState:C,theme:p||"light",displayMode:h||"inline",safeArea:v||{insets:{top:0,bottom:0,left:0,right:0}},maxHeight:y||600,userAgent:E||{device:{type:"desktop"},capabilities:{hover:!0,touch:!1}},locale:x||"en",mcp_url:_,callTool:T,sendFollowUpMessage:k,openExternal:N,requestDisplayMode:A,isAvailable:t}}Ge(Ou,"useWidget");function wde(e){const{props:t}=Ou(e);return t}Ge(wde,"useWidgetProps");function Sde(){const{theme:e}=Ou();return e}Ge(Sde,"useWidgetTheme");function Ede(e){const{state:t,setState:n}=Ou();return b.useEffect(()=>{t===null&&e!==void 0&&window.openai?.setWidgetState&&n(e)},[]),[t,n]}Ge(Ede,"useWidgetState");var lP=Ge(({children:e})=>{const{theme:t,isAvailable:n}=Ou();console.log("theme",t);const[r,a]=b.useState(()=>typeof window>"u"?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light");b.useEffect(()=>{if(typeof window>"u")return;const s=window.matchMedia("(prefers-color-scheme: dark)"),c=Ge(u=>{a(u.matches?"dark":"light")},"handleChange");return s.addEventListener("change",c),()=>s.removeEventListener("change",c)},[]);const i=n?t:r;return b.useLayoutEffect(()=>{typeof document>"u"||(i==="dark"?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark"))},[i]),se.createElement(se.Fragment,null,e)},"ThemeProvider");function Z8({children:e,className:t="",position:n="top-right",attachTo:r,showLabels:a=!0,debugger:i=!1,viewControls:s=!1}){const{props:c,output:u,metadata:d,state:p,theme:h,displayMode:v,safeArea:y,maxHeight:E,userAgent:x,locale:_,isAvailable:S,callTool:w,sendFollowUpMessage:T,openExternal:k,requestDisplayMode:N,setState:A}=Ou(),[C,O]=b.useState(!1),[L,F]=b.useState(!1),z=b.useRef(null),K=b.useRef(null),[ee,J]=b.useState([]),[le,q]=b.useState(""),[Z,G]=b.useState("get-my-city"),[ie,te]=b.useState("{}"),[P,B]=b.useState("Test follow-up message"),[j,$]=b.useState("https://docs.mcp-use.com"),U=v==="fullscreen"&&S,H=v==="pip"&&S,W=typeof window<"u"&&window.location.pathname.includes("/inspector/api/dev-widget/");b.useEffect(()=>{const Se=setTimeout(()=>{if(typeof window<"u"&&window.openai)try{const ot=Object.keys(window.openai);J(ot)}catch{J([])}else J([])},100);return()=>{clearTimeout(Se)}},[]);const X=h==="dark",de=Ge(()=>{const Se=["absolute","z-[1000]","flex","gap-2","transition-opacity","duration-200","ease-in-out",C?"opacity-100":"opacity-0",C?"pointer-events-auto":"pointer-events-none"];switch(n){case"top-left":return[...Se,"top-4","left-4"];case"top-center":return[...Se,"top-4","left-1/2","-translate-x-1/2"];case"top-right":return[...Se,"top-4","right-4"];case"center-left":return[...Se,"top-1/2","left-4","-translate-y-1/2"];case"center-right":return[...Se,"top-1/2","right-4","-translate-y-1/2"];case"bottom-left":return[...Se,"bottom-4","left-4"];case"bottom-center":return[...Se,"bottom-4","left-1/2","-translate-x-1/2"];case"bottom-right":return[...Se,"bottom-4","right-4"];default:return[...Se,"top-4","right-4"]}},"getPositionClasses"),ue=Ge(()=>{const ot=y?.insets?.top?Math.max(16,y.insets.top+8):16,ut=y?.insets?.right?Math.max(16,y.insets.right+8):16,tt=y?.insets?.bottom?Math.max(16,y.insets.bottom+8):16,Oe=y?.insets?.left?Math.max(16,y.insets.left+8):16,Me={};switch(n){case"top-left":Me.top=`${ot}px`,Me.left=`${Oe}px`;break;case"top-center":Me.top=`${ot}px`;break;case"top-right":Me.top=`${ot}px`,Me.right=`${ut}px`;break;case"center-left":Me.left=`${Oe}px`;break;case"center-right":Me.right=`${ut}px`;break;case"bottom-left":Me.bottom=`${tt}px`,Me.left=`${Oe}px`;break;case"bottom-center":Me.bottom=`${tt}px`;break;case"bottom-right":Me.bottom=`${tt}px`,Me.right=`${ut}px`;break;default:Me.top=`${ot}px`,Me.right=`${ut}px`;break}return Me},"getPositionOffsetStyles");b.useEffect(()=>{if(!r)return;const Se=Ge(()=>O(!0),"handleMouseEnter"),ot=Ge(()=>O(!1),"handleMouseLeave");return r.addEventListener("mouseenter",Se),r.addEventListener("mouseleave",ot),()=>{r.removeEventListener("mouseenter",Se),r.removeEventListener("mouseleave",ot)}},[r]),b.useEffect(()=>{if(!L)return;const Se=Ge(ot=>{K.current&&!K.current.contains(ot.target)&&F(!1)},"handleClickOutside");return document.addEventListener("mousedown",Se),()=>{document.removeEventListener("mousedown",Se)}},[L]),b.useEffect(()=>(L?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[L]);const Y=Ge(()=>{F(!L)},"handleToggleOverlay"),Q=Ge(async()=>{try{q("Calling tool...");const Se=ie.trim()?JSON.parse(ie):{},ot=await w(Z,Se);q(`Success: ${JSON.stringify(ot,null,2)}`)}catch(Se){q(`Error: ${Se.message}`)}},"handleCallTool"),oe=Ge(async()=>{try{q("Sending follow-up message..."),await T(P),q("Follow-up message sent successfully")}catch(Se){q(`Error: ${Se.message}`)}},"handleSendFollowUpMessage"),ae=Ge(()=>{try{k(j),q(`Opened external link: ${j}`)}catch(Se){q(`Error: ${Se.message}`)}},"handleOpenExternal"),Re=Ge(async Se=>{try{q(`Requesting display mode: ${Se}...`);const ot=await N(Se);q(`Display mode granted: ${ot.mode}`)}catch(ot){q(`Error: ${ot.message}`)}},"handleRequestDisplayMode"),Ae=Ge(async()=>{try{const Se=p?{...p,debugTimestamp:new Date().toISOString()}:{debugTimestamp:new Date().toISOString()};q("Setting state..."),await A(Se),q(`State updated: ${JSON.stringify(Se,null,2)}`)}catch(Se){q(`Error: ${Se.message}`)}},"handleSetState"),Ye=Ge(async()=>{try{await N("fullscreen")}catch(Se){console.error("Failed to go fullscreen:",Se)}},"handleFullscreen"),Ee=Ge(async()=>{try{await N("pip")}catch(Se){console.error("Failed to go pip:",Se)}},"handlePip"),Ne=Ge(()=>{const Se=["absolute","px-2","py-1","bg-black/90","text-white","rounded","text-xs","whitespace-nowrap","pointer-events-none","transition-opacity","duration-200","ease-in-out"];switch(n){case"top-right":return[...Se,"top-full","right-0","mt-2"];case"top-left":return[...Se,"top-full","left-0","mt-2"];case"top-center":return[...Se,"top-full","left-1/2","-translate-x-1/2","mt-2"];case"bottom-right":return[...Se,"bottom-full","right-0","mb-2"];case"bottom-left":return[...Se,"bottom-full","left-0","mb-2"];case"bottom-center":return[...Se,"bottom-full","left-1/2","-translate-x-1/2","mb-2"];case"center-left":return[...Se,"left-full","top-1/2","-translate-y-1/2","ml-2"];case"center-right":return[...Se,"right-full","top-1/2","-translate-y-1/2","mr-2"];default:return[...Se,"top-full","right-0","mt-2"]}},"getTooltipClasses"),ze=Ge(({onClick:Se,label:ot,children:ut})=>{const[tt,Oe]=b.useState(!1),Me=Ne();return se.createElement("button",{className:`p-2 ${X?"bg-white/10 hover:bg-white/20":"bg-black/70 hover:bg-black/90"} text-white border-none rounded-lg cursor-pointer flex items-center justify-center w-8 h-8 transition-colors duration-200 backdrop-blur-md ${X?"shadow-[0_2px_8px_rgba(0,0,0,0.3)]":"shadow-[0_2px_8px_rgba(0,0,0,0.2)]"} relative`,onMouseEnter:()=>Oe(!0),onMouseLeave:()=>Oe(!1),onClick:Se,"aria-label":ot},se.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"block"},ut),a&&se.createElement("span",{className:`${Me.join(" ")} ${tt?"opacity-100":"opacity-0"}`},ot))},"IconButton"),he=Ge(Se=>{if(Se===null)return"null";if(Se===void 0)return"undefined";if(typeof Se=="object")try{return JSON.stringify(Se,null,2)}catch{return String(Se)}return String(Se)},"formatValue"),je=Ge(Se=>Se?`${Se.device?.type||"unknown"}`:"N/A","formatUserAgent"),Ze=Ge(Se=>{if(!Se?.insets)return"N/A";const{top:ot,bottom:ut,left:tt,right:Oe}=Se.insets;return`T:${ot} B:${ut} L:${tt} R:${Oe}`},"formatSafeArea");return se.createElement(se.Fragment,null,se.createElement("div",{ref:z,className:`${t} relative h-fit`,onMouseEnter:()=>!r&&O(!0),onMouseLeave:()=>!r&&O(!1)},se.createElement("div",{className:de().join(" "),style:ue()},!W&&se.createElement(se.Fragment,null,!U&&!H&&se.createElement(se.Fragment,null,(s===!0||s==="fullscreen")&&se.createElement(ze,{onClick:Ye,label:"Fullscreen"},se.createElement("path",{d:"M15 3h6v6"}),se.createElement("path",{d:"m21 3-7 7"}),se.createElement("path",{d:"m3 21 7-7"}),se.createElement("path",{d:"M9 21H3v-6"})),(s===!0||s==="pip")&&se.createElement(ze,{onClick:Ee,label:"Picture in Picture"},se.createElement("path",{d:"M21 9V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v10c0 1.1.9 2 2 2h4"}),se.createElement("rect",{width:"10",height:"7",x:"12",y:"13",rx:"2"}))),i&&se.createElement(ze,{onClick:Y,label:"Debug Info"},se.createElement("path",{d:"M12 20v-9"}),se.createElement("path",{d:"M14 7a4 4 0 0 1 4 4v3a6 6 0 0 1-12 0v-3a4 4 0 0 1 4-4z"}),se.createElement("path",{d:"M14.12 3.88 16 2"}),se.createElement("path",{d:"M21 21a4 4 0 0 0-3.81-4"}),se.createElement("path",{d:"M21 5a4 4 0 0 1-3.55 3.97"}),se.createElement("path",{d:"M22 13h-4"}),se.createElement("path",{d:"M3 21a4 4 0 0 1 3.81-4"}),se.createElement("path",{d:"M3 5a4 4 0 0 0 3.55 3.97"}),se.createElement("path",{d:"M6 13H2"}),se.createElement("path",{d:"m8 2 1.88 1.88"}),se.createElement("path",{d:"M9 7.13V6a3 3 0 1 1 6 0v1.13"})))),e),L&&i&&se.createElement("div",{ref:K,className:"fixed inset-0 bg-black text-white font-mono text-xs z-[10000] overflow-auto p-4",onClick:Se=>{Se.target===K.current&&F(!1)}},se.createElement("button",{onClick:()=>F(!1),className:"absolute top-4 right-4 bg-white/10 text-white border-none rounded w-8 h-8 cursor-pointer flex items-center justify-center text-lg leading-none","aria-label":"Close"},"×"),se.createElement("div",{className:"max-w-[1200px] mx-auto pt-10"},se.createElement("h1",{className:"text-lg font-bold mb-4 border-b border-gray-700 pb-2"},"Debug Info"),se.createElement("table",{className:"w-full border-collapse border-spacing-0"},se.createElement("tbody",null,se.createElement("tr",{className:"border-b border-gray-700"},se.createElement("td",{className:"p-2 font-bold w-[200px] align-top"},"Props"),se.createElement("td",{className:"p-2 whitespace-pre-wrap break-all"},he(c))),se.createElement("tr",{className:"border-b border-gray-700"},se.createElement("td",{className:"p-2 font-bold w-[200px] align-top"},"Output"),se.createElement("td",{className:"p-2 whitespace-pre-wrap break-all"},he(u))),se.createElement("tr",{className:"border-b border-gray-700"},se.createElement("td",{className:"p-2 font-bold w-[200px] align-top"},"Metadata"),se.createElement("td",{className:"p-2 whitespace-pre-wrap break-all"},he(d))),se.createElement("tr",{className:"border-b border-gray-700"},se.createElement("td",{className:"p-2 font-bold w-[200px] align-top"},"State"),se.createElement("td",{className:"p-2 whitespace-pre-wrap break-all"},he(p))),se.createElement("tr",{className:"border-b border-gray-700"},se.createElement("td",{className:"p-2 font-bold w-[200px] align-top"},"Theme"),se.createElement("td",{className:"p-2"},h)),se.createElement("tr",{className:"border-b border-gray-700"},se.createElement("td",{className:"p-2 font-bold w-[200px] align-top"},"Display Mode"),se.createElement("td",{className:"p-2"},v)),se.createElement("tr",{className:"border-b border-gray-700"},se.createElement("td",{className:"p-2 font-bold w-[200px] align-top"},"Locale"),se.createElement("td",{className:"p-2"},_)),se.createElement("tr",{className:"border-b border-gray-700"},se.createElement("td",{className:"p-2 font-bold w-[200px] align-top"},"Max Height"),se.createElement("td",{className:"p-2"},E,"px")),se.createElement("tr",{className:"border-b border-gray-700"},se.createElement("td",{className:"p-2 font-bold w-[200px] align-top"},"User Agent"),se.createElement("td",{className:"p-2"},je(x))),se.createElement("tr",{className:"border-b border-gray-700"},se.createElement("td",{className:"p-2 font-bold w-[200px] align-top"},"Safe Area"),se.createElement("td",{className:"p-2"},Ze(y))),se.createElement("tr",{className:"border-b border-gray-700"},se.createElement("td",{className:"p-2 font-bold w-[200px] align-top"},"API Available"),se.createElement("td",{className:"p-2"},S?"Yes":"No")),se.createElement("tr",{className:"border-b border-gray-700"},se.createElement("td",{className:"p-2 font-bold w-[200px] align-top"},"window.openai Keys"),se.createElement("td",{className:"p-2"},ee.length>0?ee.join(", "):"N/A")))),se.createElement("h2",{className:"text-base font-bold mt-8 mb-4 border-b border-gray-700 pb-2"},"Actions"),se.createElement("div",{className:"flex flex-col gap-3"},se.createElement("div",{className:"flex gap-2 items-center"},se.createElement("input",{type:"text",value:Z,onChange:Se=>G(Se.target.value),placeholder:"Tool name",className:"py-1.5 px-2 bg-[#1a1a1a] text-white border border-gray-700 rounded font-mono text-xs w-[150px]"}),se.createElement("input",{type:"text",value:ie,onChange:Se=>te(Se.target.value),placeholder:'{"key": "value"}',className:"py-1.5 px-2 bg-[#1a1a1a] text-white border border-gray-700 rounded font-mono text-xs flex-1"}),se.createElement("button",{onClick:Q,className:"py-1.5 px-3 bg-gray-800 text-white border border-gray-600 rounded cursor-pointer font-mono text-xs"},"Call Tool")),se.createElement("div",{className:"flex gap-2 items-center"},se.createElement("input",{type:"text",value:P,onChange:Se=>B(Se.target.value),placeholder:"Follow-up message",className:"py-1.5 px-2 bg-[#1a1a1a] text-white border border-gray-700 rounded font-mono text-xs flex-1"}),se.createElement("button",{onClick:oe,className:"py-1.5 px-3 bg-gray-800 text-white border border-gray-600 rounded cursor-pointer font-mono text-xs"},"Send Follow-Up")),se.createElement("div",{className:"flex gap-2 items-center"},se.createElement("input",{type:"text",value:j,onChange:Se=>$(Se.target.value),placeholder:"External URL",className:"py-1.5 px-2 bg-[#1a1a1a] text-white border border-gray-700 rounded font-mono text-xs flex-1"}),se.createElement("button",{onClick:ae,className:"py-1.5 px-3 bg-gray-800 text-white border border-gray-600 rounded cursor-pointer font-mono text-xs"},"Open Link")),se.createElement("div",{className:"flex gap-2 items-center"},se.createElement("span",{className:"w-[150px] text-xs"},"Display Mode:"),se.createElement("button",{onClick:()=>Re("inline"),className:"py-1.5 px-3 bg-gray-800 text-white border border-gray-600 rounded cursor-pointer font-mono text-xs flex-1"},"Inline"),se.createElement("button",{onClick:()=>Re("pip"),className:"py-1.5 px-3 bg-gray-800 text-white border border-gray-600 rounded cursor-pointer font-mono text-xs flex-1"},"PiP"),se.createElement("button",{onClick:()=>Re("fullscreen"),className:"py-1.5 px-3 bg-gray-800 text-white border border-gray-600 rounded cursor-pointer font-mono text-xs flex-1"},"Fullscreen")),se.createElement("div",{className:"flex gap-2 items-center"},se.createElement("button",{onClick:Ae,className:"py-1.5 px-3 bg-gray-800 text-white border border-gray-600 rounded cursor-pointer font-mono text-xs"},"Set State (Add Timestamp)")),le&&se.createElement("div",{className:"mt-2 p-2 bg-[#1a1a1a] border border-gray-700 rounded whitespace-pre-wrap break-all text-[11px] max-h-[200px] overflow-auto"},se.createElement("div",{className:"font-bold mb-1 text-gray-400"},"Result:"),le,se.createElement("button",{onClick:()=>q(""),className:"mt-2 py-1 px-2 bg-gray-800 text-white border border-gray-600 rounded cursor-pointer font-mono text-[11px]"},"Clear"))))))}Ge(Z8,"WidgetControls");function X8(){if(typeof window>"u")return"/";const t=window.location.pathname.match(/^(\/inspector\/api\/dev-widget\/[^/]+)/);return t?t[1]:"/"}Ge(X8,"getBasename");var _de=150,xde=5;function Tde({children:e,debugger:t=!1,viewControls:n=!1,autoSize:r=!1}){const a=X8(),i=b.useRef(null),s=b.useRef(0),c=b.useRef(null),u=b.useRef(!1),[d,p]=b.useState(null),[h,v]=b.useState(null),[y,E]=b.useState(!0);b.useEffect(()=>{let w=!0;return(async()=>{try{const T=await Za(()=>import("./index-B7PZGsrC.js"),[]);w&&(p(()=>T.BrowserRouter),E(!1))}catch{w&&(v(new Error(`❌ react-router-dom not installed!
|
|
44
|
+
`}catch(h){console.error(`${i} Could not display error in callback window:`,h)}u&&localStorage.removeItem(u),s&&(localStorage.removeItem(s.getKey("code_verifier")),localStorage.removeItem(s.getKey("last_auth_url")))}}Ge(tI,"onMcpAuthorization");var uS={exports:{}},bt={};var oP;function gde(){if(oP)return bt;oP=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),i=Symbol.for("react.consumer"),s=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),d=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),h=Symbol.for("react.activity"),v=Symbol.iterator;function y(P){return P===null||typeof P!="object"?null:(P=v&&P[v]||P["@@iterator"],typeof P=="function"?P:null)}var E={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},x=Object.assign,_={};function S(P,B,j){this.props=P,this.context=B,this.refs=_,this.updater=j||E}S.prototype.isReactComponent={},S.prototype.setState=function(P,B){if(typeof P!="object"&&typeof P!="function"&&P!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,P,B,"setState")},S.prototype.forceUpdate=function(P){this.updater.enqueueForceUpdate(this,P,"forceUpdate")};function w(){}w.prototype=S.prototype;function T(P,B,j){this.props=P,this.context=B,this.refs=_,this.updater=j||E}var k=T.prototype=new w;k.constructor=T,x(k,S.prototype),k.isPureReactComponent=!0;var N=Array.isArray;function A(){}var C={H:null,A:null,T:null,S:null},O=Object.prototype.hasOwnProperty;function L(P,B,j){var $=j.ref;return{$$typeof:e,type:P,key:B,ref:$!==void 0?$:null,props:j}}function F(P,B){return L(P.type,B,P.props)}function z(P){return typeof P=="object"&&P!==null&&P.$$typeof===e}function K(P){var B={"=":"=0",":":"=2"};return"$"+P.replace(/[=:]/g,function(j){return B[j]})}var ee=/\/+/g;function J(P,B){return typeof P=="object"&&P!==null&&P.key!=null?K(""+P.key):B.toString(36)}function le(P){switch(P.status){case"fulfilled":return P.value;case"rejected":throw P.reason;default:switch(typeof P.status=="string"?P.then(A,A):(P.status="pending",P.then(function(B){P.status==="pending"&&(P.status="fulfilled",P.value=B)},function(B){P.status==="pending"&&(P.status="rejected",P.reason=B)})),P.status){case"fulfilled":return P.value;case"rejected":throw P.reason}}throw P}function q(P,B,j,$,U){var H=typeof P;(H==="undefined"||H==="boolean")&&(P=null);var W=!1;if(P===null)W=!0;else switch(H){case"bigint":case"string":case"number":W=!0;break;case"object":switch(P.$$typeof){case e:case t:W=!0;break;case p:return W=P._init,q(W(P._payload),B,j,$,U)}}if(W)return U=U(P),W=$===""?"."+J(P,0):$,N(U)?(j="",W!=null&&(j=W.replace(ee,"$&/")+"/"),q(U,B,j,"",function(ue){return ue})):U!=null&&(z(U)&&(U=F(U,j+(U.key==null||P&&P.key===U.key?"":(""+U.key).replace(ee,"$&/")+"/")+W)),B.push(U)),1;W=0;var X=$===""?".":$+":";if(N(P))for(var de=0;de<P.length;de++)$=P[de],H=X+J($,de),W+=q($,B,j,H,U);else if(de=y(P),typeof de=="function")for(P=de.call(P),de=0;!($=P.next()).done;)$=$.value,H=X+J($,de++),W+=q($,B,j,H,U);else if(H==="object"){if(typeof P.then=="function")return q(le(P),B,j,$,U);throw B=String(P),Error("Objects are not valid as a React child (found: "+(B==="[object Object]"?"object with keys {"+Object.keys(P).join(", ")+"}":B)+"). If you meant to render a collection of children, use an array instead.")}return W}function Z(P,B,j){if(P==null)return P;var $=[],U=0;return q(P,$,"","",function(H){return B.call(j,H,U++)}),$}function G(P){if(P._status===-1){var B=P._result;B=B(),B.then(function(j){(P._status===0||P._status===-1)&&(P._status=1,P._result=j)},function(j){(P._status===0||P._status===-1)&&(P._status=2,P._result=j)}),P._status===-1&&(P._status=0,P._result=B)}if(P._status===1)return P._result.default;throw P._result}var ie=typeof reportError=="function"?reportError:function(P){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var B=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof P=="object"&&P!==null&&typeof P.message=="string"?String(P.message):String(P),error:P});if(!window.dispatchEvent(B))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",P);return}console.error(P)},te={map:Z,forEach:function(P,B,j){Z(P,function(){B.apply(this,arguments)},j)},count:function(P){var B=0;return Z(P,function(){B++}),B},toArray:function(P){return Z(P,function(B){return B})||[]},only:function(P){if(!z(P))throw Error("React.Children.only expected to receive a single React element child.");return P}};return bt.Activity=h,bt.Children=te,bt.Component=S,bt.Fragment=n,bt.Profiler=a,bt.PureComponent=T,bt.StrictMode=r,bt.Suspense=u,bt.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=C,bt.__COMPILER_RUNTIME={__proto__:null,c:function(P){return C.H.useMemoCache(P)}},bt.cache=function(P){return function(){return P.apply(null,arguments)}},bt.cacheSignal=function(){return null},bt.cloneElement=function(P,B,j){if(P==null)throw Error("The argument must be a React element, but you passed "+P+".");var $=x({},P.props),U=P.key;if(B!=null)for(H in B.key!==void 0&&(U=""+B.key),B)!O.call(B,H)||H==="key"||H==="__self"||H==="__source"||H==="ref"&&B.ref===void 0||($[H]=B[H]);var H=arguments.length-2;if(H===1)$.children=j;else if(1<H){for(var W=Array(H),X=0;X<H;X++)W[X]=arguments[X+2];$.children=W}return L(P.type,U,$)},bt.createContext=function(P){return P={$$typeof:s,_currentValue:P,_currentValue2:P,_threadCount:0,Provider:null,Consumer:null},P.Provider=P,P.Consumer={$$typeof:i,_context:P},P},bt.createElement=function(P,B,j){var $,U={},H=null;if(B!=null)for($ in B.key!==void 0&&(H=""+B.key),B)O.call(B,$)&&$!=="key"&&$!=="__self"&&$!=="__source"&&(U[$]=B[$]);var W=arguments.length-2;if(W===1)U.children=j;else if(1<W){for(var X=Array(W),de=0;de<W;de++)X[de]=arguments[de+2];U.children=X}if(P&&P.defaultProps)for($ in W=P.defaultProps,W)U[$]===void 0&&(U[$]=W[$]);return L(P,H,U)},bt.createRef=function(){return{current:null}},bt.forwardRef=function(P){return{$$typeof:c,render:P}},bt.isValidElement=z,bt.lazy=function(P){return{$$typeof:p,_payload:{_status:-1,_result:P},_init:G}},bt.memo=function(P,B){return{$$typeof:d,type:P,compare:B===void 0?null:B}},bt.startTransition=function(P){var B=C.T,j={};C.T=j;try{var $=P(),U=C.S;U!==null&&U(j,$),typeof $=="object"&&$!==null&&typeof $.then=="function"&&$.then(A,ie)}catch(H){ie(H)}finally{B!==null&&j.types!==null&&(B.types=j.types),C.T=B}},bt.unstable_useCacheRefresh=function(){return C.H.useCacheRefresh()},bt.use=function(P){return C.H.use(P)},bt.useActionState=function(P,B,j){return C.H.useActionState(P,B,j)},bt.useCallback=function(P,B){return C.H.useCallback(P,B)},bt.useContext=function(P){return C.H.useContext(P)},bt.useDebugValue=function(){},bt.useDeferredValue=function(P,B){return C.H.useDeferredValue(P,B)},bt.useEffect=function(P,B){return C.H.useEffect(P,B)},bt.useEffectEvent=function(P){return C.H.useEffectEvent(P)},bt.useId=function(){return C.H.useId()},bt.useImperativeHandle=function(P,B,j){return C.H.useImperativeHandle(P,B,j)},bt.useInsertionEffect=function(P,B){return C.H.useInsertionEffect(P,B)},bt.useLayoutEffect=function(P,B){return C.H.useLayoutEffect(P,B)},bt.useMemo=function(P,B){return C.H.useMemo(P,B)},bt.useOptimistic=function(P,B){return C.H.useOptimistic(P,B)},bt.useReducer=function(P,B,j){return C.H.useReducer(P,B,j)},bt.useRef=function(P){return C.H.useRef(P)},bt.useState=function(P){return C.H.useState(P)},bt.useSyncExternalStore=function(P,B,j){return C.H.useSyncExternalStore(P,B,j)},bt.useTransition=function(){return C.H.useTransition()},bt.version="19.2.0",bt}var sP;function nI(){return sP||(sP=1,uS.exports=gde()),uS.exports}var b=nI();const se=Au(b),Pv=Gne({__proto__:null,default:se},[b]);function kN(e,t){if(!e)throw new Error(t)}Ge(kN,"assert");var vde=3e3,bde=5e3;function rI(e){const{url:t,enabled:n=!0,clientName:r,clientUri:a,callbackUrl:i=typeof window<"u"?Dc(new URL("/oauth/callback",window.location.origin).toString()):"/oauth/callback",storageKeyPrefix:s="mcp:auth",clientConfig:c={},customHeaders:u={},debug:d=!1,autoRetry:p=!1,autoReconnect:h=vde,transportType:v="auto",preventAutoAuth:y=!1,useRedirectFlow:E=!1,onPopupWindow:x,timeout:_=3e4,sseReadTimeout:S=3e5,wrapTransport:w,onNotification:T,samplingCallback:k}=e,[N,A]=b.useState("discovering"),[C,O]=b.useState([]),[L,F]=b.useState([]),[z,K]=b.useState([]),[ee,J]=b.useState([]),[le,q]=b.useState(),[Z,G]=b.useState(),[ie,te]=b.useState(void 0),[P,B]=b.useState([]),[j,$]=b.useState(void 0),U=b.useRef(null),H=b.useRef(null),W=b.useRef(!1),X=b.useRef(!0),de=b.useRef(0),ue=b.useRef(null),Y=b.useRef(N),Q=b.useRef(h),oe=b.useRef(null);b.useEffect(()=>{Y.current=N,Q.current=h},[N,h]);const ae=b.useCallback((Oe,Me,...dt)=>{const Bt=dt.length>0?`${Me} ${dt.map(De=>JSON.stringify(De)).join(" ")}`:Me;console[Oe](`[useMcp] ${Bt}`),X.current&&B(De=>[...De.slice(-100),{level:Oe,message:Bt,timestamp:Date.now()}])},[]),Re=b.useCallback(async(Oe=!1)=>{if(Oe||ae("info","Disconnecting..."),W.current=!1,ue.current&&clearTimeout(ue.current),ue.current=null,U.current)try{await U.current.closeSession("inspector-server")}catch(Me){Oe||ae("warn","Error closing session:",Me)}U.current=null,X.current&&!Oe&&(A("discovering"),O([]),F([]),K([]),J([]),te(void 0),$(void 0))},[ae]),Ae=b.useCallback((Oe,Me)=>{if(ae("error",Oe,Me??""),X.current){A("failed"),te(Oe);const dt=H.current?.getLastAttemptedAuthUrl();dt&&($(dt),ae("info","Manual authentication URL may be available.",dt))}W.current=!1},[ae]),Ye=b.useCallback(async()=>{if(!n||!t){ae("debug",n?"No server URL provided, skipping connection.":"Connection disabled via enabled flag.");return}if(W.current){ae("debug","Connection attempt already in progress.");return}if(!X.current){ae("debug","Connect called after unmount, aborting.");return}W.current=!0,de.current+=1,te(void 0),$(void 0),oe.current=null,A("discovering"),ae("info",`Connecting attempt #${de.current} to ${t}...`),H.current||(H.current=new ag(t,{storageKeyPrefix:s,clientName:r,clientUri:a,callbackUrl:i,preventAutoAuth:y,useRedirectFlow:E,onPopupWindow:x}),ae("debug","BrowserOAuthClientProvider initialized in connect.")),U.current||(U.current=new hde,ae("debug","BrowserMCPClient initialized in connect."));const Oe=Ge(async(dt,Bt=!1)=>{ae("info",`Attempting connection with transport: ${dt}`);try{const De="inspector-server",ke={url:t,transport:dt==="sse"?"http":dt};if(u&&Object.keys(u).length>0&&(ke.headers=u),H.current){const Ct=await H.current.tokens();Ct?.access_token&&(ke.headers={...ke.headers,Authorization:`Bearer ${Ct.access_token}`})}U.current.addServer(De,{...ke,authProvider:H.current,clientOptions:c,samplingCallback:k,wrapTransport:w?Ct=>(console.log("[useMcp] Applying transport wrapper for server:",De,"url:",t),w(Ct,t)):void 0});const Fe=await U.current.createSession(De,!1);T&&Fe.on("notification",T),await Fe.initialize(),ae("info","✅ Successfully connected to MCP server"),ae("info","Server info:",Fe.connector.serverInfo),ae("info","Server capabilities:",Fe.connector.serverCapabilities),console.log("[useMcp] Server info:",Fe.connector.serverInfo),console.log("[useMcp] Server capabilities:",Fe.connector.serverCapabilities),A("ready"),oe.current=dt,O(Fe.connector.tools||[]);const vt=await Fe.connector.listAllResources();F(vt.resources||[]);const gt=await Fe.connector.listPrompts();J(gt.prompts||[]);const Lt=Fe.connector.serverInfo,qt=Fe.connector.serverCapabilities;return Lt&&(console.log("[useMcp] Server info:",Lt),q(Lt)),qt&&(console.log("[useMcp] Server capabilities:",qt),G(qt)),"success"}catch(De){const ke=De?.message||String(De);if(De.code===401||ke.includes("401")||ke.includes("Unauthorized")){if(H.current){ae("info","Authentication required. OAuth provider available.");try{const{auth:Fe}=await Za(async()=>{const{auth:gt}=await Promise.resolve().then(()=>Jj);return{auth:gt}},void 0),vt=new URL(t).origin;Fe(H.current,{serverUrl:vt}).catch(()=>{}),setTimeout(()=>{if(X.current){const gt=H.current?.getLastAttemptedAuthUrl();gt?($(gt),ae("info","Manual authentication URL available:",gt)):ae("warn","Could not generate authentication URL")}},100)}catch(Fe){ae("warn","Error generating auth URL:",Fe)}return X.current&&A("pending_auth"),W.current=!1,"auth_redirect"}return u&&Object.keys(u).length>0?(Ae("Authentication failed: Server returned 401 Unauthorized. Check your Authorization header value is correct."),"failed"):(Ae("Authentication required: Server returned 401 Unauthorized. Add an Authorization header in the Custom Headers section (e.g., Authorization: Bearer YOUR_API_KEY)."),"failed")}return Ae(ke,De),"failed"}},"tryConnectWithTransport");let Me="failed";if(v==="sse")ae("debug","Using SSE-only transport mode"),Me=await Oe("sse");else if(v==="http")ae("debug","Using HTTP-only transport mode"),Me=await Oe("http");else{ae("debug","Using auto transport mode (HTTP with SSE fallback)");const dt=await Oe("http");dt==="fallback"&&X.current&&Y.current!=="authenticating"?(ae("info","HTTP failed, attempting SSE fallback..."),Me=await Oe("sse")):Me=dt}(Me==="success"||Me==="failed"||Me==="auth_redirect")&&(W.current=!1),ae("debug",`Connection sequence finished with status: ${Me}`)},[ae,Ae,Re,t,s,r,a,i,c.name,c.version,u,v,y,E,x,n,_,S]),Ee=b.useCallback(async(Oe,Me,dt)=>{if(Y.current!=="ready"||!U.current)throw new Error(`MCP client is not ready (current state: ${N}). Cannot call tool "${Oe}".`);ae("info",`Calling tool: ${Oe}`,Me);try{const De=U.current.getSession("inspector-server");if(!De)throw new Error("No active session found");const ke=await De.connector.callTool(Oe,Me||{},dt);return ae("info",`Tool "${Oe}" call successful:`,ke),ke}catch(Bt){throw ae("error",`Tool "${Oe}" call failed:`,Bt),Bt}},[N]),Ne=b.useCallback(()=>{Y.current==="failed"?(ae("info","Retry requested..."),Ye()):ae("warn",`Retry called but state is not 'failed' (state: ${Y.current}). Ignoring.`)},[ae,Ye]),ze=b.useCallback(async()=>{ae("info","Manual authentication requested...");const Oe=Y.current;if(Oe==="failed")ae("info","Attempting to reconnect and authenticate via retry..."),Ne();else if(Oe==="pending_auth"){ae("info","Proceeding with authentication from pending state...");try{kN(H.current,"Auth Provider not available for manual auth"),kN(t,"Server URL is required for authentication"),ae("info","Clearing all OAuth state and initiating fresh flow...");const Me=`${s}:${H.current.serverUrlHash}`;Object.keys(localStorage).forEach(ke=>{ke.startsWith(Me)&&(ae("debug",`Removing stale OAuth key: ${ke}`),localStorage.removeItem(ke)),ke.startsWith(`${s}:state_`)&&(ae("debug",`Removing orphaned state: ${ke}`),localStorage.removeItem(ke))}),A("authenticating");const dt=new ag(t,{storageKeyPrefix:s,clientName:r,clientUri:a,callbackUrl:i,preventAutoAuth:!1,useRedirectFlow:E,onPopupWindow:x});H.current=dt,ae("info","Triggering fresh OAuth authorization...");const{auth:Bt}=await Za(async()=>{const{auth:ke}=await Promise.resolve().then(()=>Jj);return{auth:ke}},void 0),De=new URL(t).origin;Bt(dt,{serverUrl:De}).catch(ke=>{ae("info","OAuth flow initiated:",ke?.message||"Redirecting...")})}catch(Me){if(!X.current)return;A("pending_auth"),ae("error",`Manual authentication failed: ${Me instanceof Error?Me.message:String(Me)}`)}}else if(Oe==="authenticating"){ae("warn","Already attempting authentication. Check for blocked popups or wait for timeout.");const Me=H.current?.getLastAttemptedAuthUrl();Me&&!j&&($(Me),ae("info","Manual authentication URL retrieved:",Me))}else ae("info",`Client not in a state requiring manual authentication trigger (state: ${Oe}). If needed, try disconnecting and reconnecting.`)},[ae,Ne,j,t,E,x,s,r,a,i]),he=b.useCallback(()=>{if(H.current){const Oe=H.current.clearStorage();ae("info",`Cleared ${Oe} item(s) from localStorage for ${t}.`),$(void 0),Re()}else ae("warn","Auth provider not initialized, cannot clear storage.")},[t,ae,Re]),je=b.useCallback(async()=>{if(Y.current!=="ready"||!U.current)throw new Error(`MCP client is not ready (current state: ${N}). Cannot list resources.`);ae("info","Listing resources");try{const Me=U.current.getSession("inspector-server");if(!Me)throw new Error("No active session found");const dt=await Me.connector.listAllResources();F(dt.resources||[]),ae("info","Resources listed successfully")}catch(Oe){throw ae("error","List resources failed:",Oe),Oe}},[N]),Ze=b.useCallback(async Oe=>{if(Y.current!=="ready"||!U.current)throw new Error(`MCP client is not ready (current state: ${N}). Cannot read resource.`);ae("info",`Reading resource: ${Oe}`);try{const dt=U.current.getSession("inspector-server");if(!dt)throw new Error("No active session found");const Bt=await dt.connector.readResource(Oe);return ae("info","Resource read successful:",Bt),Bt}catch(Me){throw ae("error","Resource read failed:",Me),Me}},[N]),Se=b.useCallback(async()=>{if(Y.current!=="ready"||!U.current)throw new Error(`MCP client is not ready (current state: ${N}). Cannot list prompts.`);ae("info","Listing prompts");try{const Me=U.current.getSession("inspector-server");if(!Me)throw new Error("No active session found");const dt=await Me.connector.listPrompts();J(dt.prompts||[]),ae("info","Prompts listed successfully")}catch(Oe){throw ae("error","List prompts failed:",Oe),Oe}},[N]),ot=b.useCallback(async(Oe,Me)=>{if(Y.current!=="ready"||!U.current)throw new Error(`MCP client is not ready (current state: ${N}). Cannot get prompt.`);ae("info",`Getting prompt: ${Oe}`,Me);try{const Bt=U.current.getSession("inspector-server");if(!Bt)throw new Error("No active session found");const De=await Bt.connector.getPrompt(Oe,Me||{});return ae("info",`Prompt "${Oe}" retrieved successfully:`,De),De}catch(dt){throw ae("error",`Prompt "${Oe}" retrieval failed:`,dt),dt}},[N]),ut=b.useRef(Ye),tt=b.useRef(Ae);return b.useEffect(()=>{ut.current=Ye,tt.current=Ae}),b.useEffect(()=>{const Oe=Ge(Me=>{Me.origin===window.location.origin&&Me.data?.type==="mcp_auth_callback"&&(ae("info","Received auth callback message.",Me.data),ue.current&&clearTimeout(ue.current),ue.current=null,Me.data.success?(ae("info","Authentication successful via popup. Reconnecting client..."),W.current&&ae("debug","Connection attempt already in progress, resetting flag to allow reconnection."),W.current=!1,setTimeout(()=>{X.current&&(ae("debug","Initiating reconnection after successful auth callback."),ut.current())},100)):tt.current(`Authentication failed in callback: ${Me.data.error||"Unknown reason."}`))},"messageHandler");return window.addEventListener("message",Oe),ae("debug","Auth callback message listener added."),()=>{window.removeEventListener("message",Oe),ae("debug","Auth callback message listener removed."),ue.current&&clearTimeout(ue.current)}},[ae]),b.useEffect(()=>(X.current=!0,!n||!t?(ae("debug",n?"No server URL provided, skipping connection.":"Connection disabled via enabled flag."),A("discovering"),()=>{X.current=!1}):(ae("debug","useMcp mounted, initiating connection."),de.current=0,(!H.current||H.current.serverUrl!==t)&&(H.current=new ag(t,{storageKeyPrefix:s,clientName:r,clientUri:a,callbackUrl:i,preventAutoAuth:y,useRedirectFlow:E,onPopupWindow:x}),ae("debug","BrowserOAuthClientProvider initialized/updated on mount/option change.")),Ye(),()=>{X.current=!1,ae("debug","useMcp unmounting, disconnecting."),Re(!0)})),[t,n,s,i,r,a,c.name,c.version,E]),b.useEffect(()=>{let Oe=null;if(N==="failed"&&p&&de.current>0){const Me=typeof p=="number"?p:bde;ae("info",`Connection failed, auto-retrying in ${Me}ms...`),Oe=setTimeout(()=>{X.current&&Y.current==="failed"&&Ne()},Me)}return()=>{Oe&&clearTimeout(Oe)}},[N,p,Ne,ae]),{state:N,tools:C,resources:L,resourceTemplates:z,prompts:ee,serverInfo:le,capabilities:Z,error:ie,log:P,authUrl:j,client:U.current,callTool:Ee,readResource:Ze,listResources:je,listPrompts:Se,getPrompt:ot,retry:Ne,disconnect:Re,authenticate:ze,clearStorage:he}}Ge(rI,"useMcp");var mu,yde=(mu=class extends se.Component{constructor(t){super(t),this.state={hasError:!1,error:null}}static getDerivedStateFromError(t){return{hasError:!0,error:t}}componentDidCatch(t,n){console.error("Widget Error:",t,n)}render(){return this.state.hasError?se.createElement("div",{className:"p-4 border border-red-500 bg-red-50 text-red-900 rounded-md dark:bg-red-900/20 dark:text-red-100"},se.createElement("h3",{className:"font-bold mb-2"},"Widget Error"),se.createElement("pre",{className:"text-sm whitespace-pre-wrap"},this.state.error?.message)):this.props.children}},Ge(mu,"ErrorBoundary"),mu),df="openai:set_globals";function qa(e){return b.useSyncExternalStore(t=>{const n=Ge(r=>{r.detail.globals[e]!==void 0&&t()},"handleSetGlobal");return typeof window<"u"&&window.addEventListener(df,n),()=>{typeof window<"u"&&window.removeEventListener(df,n)}},()=>typeof window<"u"&&window.openai?window.openai[e]:void 0)}Ge(qa,"useOpenAiGlobal");function Ou(e){const[t,n]=b.useState(()=>typeof window<"u"&&!!window.openai);b.useEffect(()=>{if(typeof window<"u"&&window.openai){n(!0);return}const O=setInterval(()=>{typeof window<"u"&&window.openai&&(n(!0),clearInterval(O))},100),L=Ge(()=>{typeof window<"u"&&window.openai&&(n(!0),clearInterval(O))},"handleSetGlobals");typeof window<"u"&&window.addEventListener(df,L);const F=setTimeout(()=>{clearInterval(O),typeof window<"u"&&window.removeEventListener(df,L)},5e3);return()=>{clearInterval(O),clearTimeout(F),typeof window<"u"&&window.removeEventListener(df,L)}},[]);const r=b.useMemo(()=>t?"openai":"mcp-ui",[t]),a=typeof window<"u"?window.location.search:"",i=b.useMemo(()=>{const O=new URLSearchParams(a);return O.has("mcpUseParams")?JSON.parse(O.get("mcpUseParams")):{toolInput:{},toolOutput:{},toolId:""}},[a]),s=r==="openai"?qa("toolInput"):i.toolInput,c=r==="openai"?qa("toolOutput"):i.toolOutput,u=qa("toolResponseMetadata"),d=qa("widgetState"),p=qa("theme"),h=qa("displayMode"),v=qa("safeArea"),y=qa("maxHeight"),E=qa("userAgent"),x=qa("locale"),_=b.useMemo(()=>typeof window<"u"&&window.__mcpPublicUrl?window.__mcpPublicUrl.replace(/\/mcp-use\/public$/,""):"",[]),[S,w]=b.useState(null);b.useEffect(()=>{d!==void 0&&w(d)},[d]);const T=b.useCallback(async(O,L)=>{if(!window.openai?.callTool)throw new Error("window.openai.callTool is not available");return window.openai.callTool(O,L)},[]),k=b.useCallback(async O=>{if(!window.openai?.sendFollowUpMessage)throw new Error("window.openai.sendFollowUpMessage is not available");return window.openai.sendFollowUpMessage({prompt:O})},[]),N=b.useCallback(O=>{if(!window.openai?.openExternal)throw new Error("window.openai.openExternal is not available");window.openai.openExternal({href:O})},[]),A=b.useCallback(async O=>{if(!window.openai?.requestDisplayMode)throw new Error("window.openai.requestDisplayMode is not available");return window.openai.requestDisplayMode({mode:O})},[]),C=b.useCallback(async O=>{if(!window.openai?.setWidgetState)throw new Error("window.openai.setWidgetState is not available");const F=typeof O=="function"?O(d!==void 0?d:S):O;return w(F),window.openai.setWidgetState(F)},[d,S]);return{props:s||e||{},output:c??null,metadata:u??null,state:S,setState:C,theme:p||"light",displayMode:h||"inline",safeArea:v||{insets:{top:0,bottom:0,left:0,right:0}},maxHeight:y||600,userAgent:E||{device:{type:"desktop"},capabilities:{hover:!0,touch:!1}},locale:x||"en",mcp_url:_,callTool:T,sendFollowUpMessage:k,openExternal:N,requestDisplayMode:A,isAvailable:t}}Ge(Ou,"useWidget");function wde(e){const{props:t}=Ou(e);return t}Ge(wde,"useWidgetProps");function Sde(){const{theme:e}=Ou();return e}Ge(Sde,"useWidgetTheme");function Ede(e){const{state:t,setState:n}=Ou();return b.useEffect(()=>{t===null&&e!==void 0&&window.openai?.setWidgetState&&n(e)},[]),[t,n]}Ge(Ede,"useWidgetState");var lP=Ge(({children:e})=>{const{theme:t,isAvailable:n}=Ou();console.log("theme",t);const[r,a]=b.useState(()=>typeof window>"u"?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light");b.useEffect(()=>{if(typeof window>"u")return;const s=window.matchMedia("(prefers-color-scheme: dark)"),c=Ge(u=>{a(u.matches?"dark":"light")},"handleChange");return s.addEventListener("change",c),()=>s.removeEventListener("change",c)},[]);const i=n?t:r;return b.useLayoutEffect(()=>{typeof document>"u"||(i==="dark"?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark"))},[i]),se.createElement(se.Fragment,null,e)},"ThemeProvider");function Z8({children:e,className:t="",position:n="top-right",attachTo:r,showLabels:a=!0,debugger:i=!1,viewControls:s=!1}){const{props:c,output:u,metadata:d,state:p,theme:h,displayMode:v,safeArea:y,maxHeight:E,userAgent:x,locale:_,isAvailable:S,callTool:w,sendFollowUpMessage:T,openExternal:k,requestDisplayMode:N,setState:A}=Ou(),[C,O]=b.useState(!1),[L,F]=b.useState(!1),z=b.useRef(null),K=b.useRef(null),[ee,J]=b.useState([]),[le,q]=b.useState(""),[Z,G]=b.useState("get-my-city"),[ie,te]=b.useState("{}"),[P,B]=b.useState("Test follow-up message"),[j,$]=b.useState("https://docs.mcp-use.com"),U=v==="fullscreen"&&S,H=v==="pip"&&S,W=typeof window<"u"&&window.location.pathname.includes("/inspector/api/dev-widget/");b.useEffect(()=>{const Se=setTimeout(()=>{if(typeof window<"u"&&window.openai)try{const ot=Object.keys(window.openai);J(ot)}catch{J([])}else J([])},100);return()=>{clearTimeout(Se)}},[]);const X=h==="dark",de=Ge(()=>{const Se=["absolute","z-[1000]","flex","gap-2","transition-opacity","duration-200","ease-in-out",C?"opacity-100":"opacity-0",C?"pointer-events-auto":"pointer-events-none"];switch(n){case"top-left":return[...Se,"top-4","left-4"];case"top-center":return[...Se,"top-4","left-1/2","-translate-x-1/2"];case"top-right":return[...Se,"top-4","right-4"];case"center-left":return[...Se,"top-1/2","left-4","-translate-y-1/2"];case"center-right":return[...Se,"top-1/2","right-4","-translate-y-1/2"];case"bottom-left":return[...Se,"bottom-4","left-4"];case"bottom-center":return[...Se,"bottom-4","left-1/2","-translate-x-1/2"];case"bottom-right":return[...Se,"bottom-4","right-4"];default:return[...Se,"top-4","right-4"]}},"getPositionClasses"),ue=Ge(()=>{const ot=y?.insets?.top?Math.max(16,y.insets.top+8):16,ut=y?.insets?.right?Math.max(16,y.insets.right+8):16,tt=y?.insets?.bottom?Math.max(16,y.insets.bottom+8):16,Oe=y?.insets?.left?Math.max(16,y.insets.left+8):16,Me={};switch(n){case"top-left":Me.top=`${ot}px`,Me.left=`${Oe}px`;break;case"top-center":Me.top=`${ot}px`;break;case"top-right":Me.top=`${ot}px`,Me.right=`${ut}px`;break;case"center-left":Me.left=`${Oe}px`;break;case"center-right":Me.right=`${ut}px`;break;case"bottom-left":Me.bottom=`${tt}px`,Me.left=`${Oe}px`;break;case"bottom-center":Me.bottom=`${tt}px`;break;case"bottom-right":Me.bottom=`${tt}px`,Me.right=`${ut}px`;break;default:Me.top=`${ot}px`,Me.right=`${ut}px`;break}return Me},"getPositionOffsetStyles");b.useEffect(()=>{if(!r)return;const Se=Ge(()=>O(!0),"handleMouseEnter"),ot=Ge(()=>O(!1),"handleMouseLeave");return r.addEventListener("mouseenter",Se),r.addEventListener("mouseleave",ot),()=>{r.removeEventListener("mouseenter",Se),r.removeEventListener("mouseleave",ot)}},[r]),b.useEffect(()=>{if(!L)return;const Se=Ge(ot=>{K.current&&!K.current.contains(ot.target)&&F(!1)},"handleClickOutside");return document.addEventListener("mousedown",Se),()=>{document.removeEventListener("mousedown",Se)}},[L]),b.useEffect(()=>(L?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[L]);const Y=Ge(()=>{F(!L)},"handleToggleOverlay"),Q=Ge(async()=>{try{q("Calling tool...");const Se=ie.trim()?JSON.parse(ie):{},ot=await w(Z,Se);q(`Success: ${JSON.stringify(ot,null,2)}`)}catch(Se){q(`Error: ${Se.message}`)}},"handleCallTool"),oe=Ge(async()=>{try{q("Sending follow-up message..."),await T(P),q("Follow-up message sent successfully")}catch(Se){q(`Error: ${Se.message}`)}},"handleSendFollowUpMessage"),ae=Ge(()=>{try{k(j),q(`Opened external link: ${j}`)}catch(Se){q(`Error: ${Se.message}`)}},"handleOpenExternal"),Re=Ge(async Se=>{try{q(`Requesting display mode: ${Se}...`);const ot=await N(Se);q(`Display mode granted: ${ot.mode}`)}catch(ot){q(`Error: ${ot.message}`)}},"handleRequestDisplayMode"),Ae=Ge(async()=>{try{const Se=p?{...p,debugTimestamp:new Date().toISOString()}:{debugTimestamp:new Date().toISOString()};q("Setting state..."),await A(Se),q(`State updated: ${JSON.stringify(Se,null,2)}`)}catch(Se){q(`Error: ${Se.message}`)}},"handleSetState"),Ye=Ge(async()=>{try{await N("fullscreen")}catch(Se){console.error("Failed to go fullscreen:",Se)}},"handleFullscreen"),Ee=Ge(async()=>{try{await N("pip")}catch(Se){console.error("Failed to go pip:",Se)}},"handlePip"),Ne=Ge(()=>{const Se=["absolute","px-2","py-1","bg-black/90","text-white","rounded","text-xs","whitespace-nowrap","pointer-events-none","transition-opacity","duration-200","ease-in-out"];switch(n){case"top-right":return[...Se,"top-full","right-0","mt-2"];case"top-left":return[...Se,"top-full","left-0","mt-2"];case"top-center":return[...Se,"top-full","left-1/2","-translate-x-1/2","mt-2"];case"bottom-right":return[...Se,"bottom-full","right-0","mb-2"];case"bottom-left":return[...Se,"bottom-full","left-0","mb-2"];case"bottom-center":return[...Se,"bottom-full","left-1/2","-translate-x-1/2","mb-2"];case"center-left":return[...Se,"left-full","top-1/2","-translate-y-1/2","ml-2"];case"center-right":return[...Se,"right-full","top-1/2","-translate-y-1/2","mr-2"];default:return[...Se,"top-full","right-0","mt-2"]}},"getTooltipClasses"),ze=Ge(({onClick:Se,label:ot,children:ut})=>{const[tt,Oe]=b.useState(!1),Me=Ne();return se.createElement("button",{className:`p-2 ${X?"bg-white/10 hover:bg-white/20":"bg-black/70 hover:bg-black/90"} text-white border-none rounded-lg cursor-pointer flex items-center justify-center w-8 h-8 transition-colors duration-200 backdrop-blur-md ${X?"shadow-[0_2px_8px_rgba(0,0,0,0.3)]":"shadow-[0_2px_8px_rgba(0,0,0,0.2)]"} relative`,onMouseEnter:()=>Oe(!0),onMouseLeave:()=>Oe(!1),onClick:Se,"aria-label":ot},se.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"block"},ut),a&&se.createElement("span",{className:`${Me.join(" ")} ${tt?"opacity-100":"opacity-0"}`},ot))},"IconButton"),he=Ge(Se=>{if(Se===null)return"null";if(Se===void 0)return"undefined";if(typeof Se=="object")try{return JSON.stringify(Se,null,2)}catch{return String(Se)}return String(Se)},"formatValue"),je=Ge(Se=>Se?`${Se.device?.type||"unknown"}`:"N/A","formatUserAgent"),Ze=Ge(Se=>{if(!Se?.insets)return"N/A";const{top:ot,bottom:ut,left:tt,right:Oe}=Se.insets;return`T:${ot} B:${ut} L:${tt} R:${Oe}`},"formatSafeArea");return se.createElement(se.Fragment,null,se.createElement("div",{ref:z,className:`${t} relative h-fit`,onMouseEnter:()=>!r&&O(!0),onMouseLeave:()=>!r&&O(!1)},se.createElement("div",{className:de().join(" "),style:ue()},!W&&se.createElement(se.Fragment,null,!U&&!H&&se.createElement(se.Fragment,null,(s===!0||s==="fullscreen")&&se.createElement(ze,{onClick:Ye,label:"Fullscreen"},se.createElement("path",{d:"M15 3h6v6"}),se.createElement("path",{d:"m21 3-7 7"}),se.createElement("path",{d:"m3 21 7-7"}),se.createElement("path",{d:"M9 21H3v-6"})),(s===!0||s==="pip")&&se.createElement(ze,{onClick:Ee,label:"Picture in Picture"},se.createElement("path",{d:"M21 9V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v10c0 1.1.9 2 2 2h4"}),se.createElement("rect",{width:"10",height:"7",x:"12",y:"13",rx:"2"}))),i&&se.createElement(ze,{onClick:Y,label:"Debug Info"},se.createElement("path",{d:"M12 20v-9"}),se.createElement("path",{d:"M14 7a4 4 0 0 1 4 4v3a6 6 0 0 1-12 0v-3a4 4 0 0 1 4-4z"}),se.createElement("path",{d:"M14.12 3.88 16 2"}),se.createElement("path",{d:"M21 21a4 4 0 0 0-3.81-4"}),se.createElement("path",{d:"M21 5a4 4 0 0 1-3.55 3.97"}),se.createElement("path",{d:"M22 13h-4"}),se.createElement("path",{d:"M3 21a4 4 0 0 1 3.81-4"}),se.createElement("path",{d:"M3 5a4 4 0 0 0 3.55 3.97"}),se.createElement("path",{d:"M6 13H2"}),se.createElement("path",{d:"m8 2 1.88 1.88"}),se.createElement("path",{d:"M9 7.13V6a3 3 0 1 1 6 0v1.13"})))),e),L&&i&&se.createElement("div",{ref:K,className:"fixed inset-0 bg-black text-white font-mono text-xs z-[10000] overflow-auto p-4",onClick:Se=>{Se.target===K.current&&F(!1)}},se.createElement("button",{onClick:()=>F(!1),className:"absolute top-4 right-4 bg-white/10 text-white border-none rounded w-8 h-8 cursor-pointer flex items-center justify-center text-lg leading-none","aria-label":"Close"},"×"),se.createElement("div",{className:"max-w-[1200px] mx-auto pt-10"},se.createElement("h1",{className:"text-lg font-bold mb-4 border-b border-gray-700 pb-2"},"Debug Info"),se.createElement("table",{className:"w-full border-collapse border-spacing-0"},se.createElement("tbody",null,se.createElement("tr",{className:"border-b border-gray-700"},se.createElement("td",{className:"p-2 font-bold w-[200px] align-top"},"Props"),se.createElement("td",{className:"p-2 whitespace-pre-wrap break-all"},he(c))),se.createElement("tr",{className:"border-b border-gray-700"},se.createElement("td",{className:"p-2 font-bold w-[200px] align-top"},"Output"),se.createElement("td",{className:"p-2 whitespace-pre-wrap break-all"},he(u))),se.createElement("tr",{className:"border-b border-gray-700"},se.createElement("td",{className:"p-2 font-bold w-[200px] align-top"},"Metadata"),se.createElement("td",{className:"p-2 whitespace-pre-wrap break-all"},he(d))),se.createElement("tr",{className:"border-b border-gray-700"},se.createElement("td",{className:"p-2 font-bold w-[200px] align-top"},"State"),se.createElement("td",{className:"p-2 whitespace-pre-wrap break-all"},he(p))),se.createElement("tr",{className:"border-b border-gray-700"},se.createElement("td",{className:"p-2 font-bold w-[200px] align-top"},"Theme"),se.createElement("td",{className:"p-2"},h)),se.createElement("tr",{className:"border-b border-gray-700"},se.createElement("td",{className:"p-2 font-bold w-[200px] align-top"},"Display Mode"),se.createElement("td",{className:"p-2"},v)),se.createElement("tr",{className:"border-b border-gray-700"},se.createElement("td",{className:"p-2 font-bold w-[200px] align-top"},"Locale"),se.createElement("td",{className:"p-2"},_)),se.createElement("tr",{className:"border-b border-gray-700"},se.createElement("td",{className:"p-2 font-bold w-[200px] align-top"},"Max Height"),se.createElement("td",{className:"p-2"},E,"px")),se.createElement("tr",{className:"border-b border-gray-700"},se.createElement("td",{className:"p-2 font-bold w-[200px] align-top"},"User Agent"),se.createElement("td",{className:"p-2"},je(x))),se.createElement("tr",{className:"border-b border-gray-700"},se.createElement("td",{className:"p-2 font-bold w-[200px] align-top"},"Safe Area"),se.createElement("td",{className:"p-2"},Ze(y))),se.createElement("tr",{className:"border-b border-gray-700"},se.createElement("td",{className:"p-2 font-bold w-[200px] align-top"},"API Available"),se.createElement("td",{className:"p-2"},S?"Yes":"No")),se.createElement("tr",{className:"border-b border-gray-700"},se.createElement("td",{className:"p-2 font-bold w-[200px] align-top"},"window.openai Keys"),se.createElement("td",{className:"p-2"},ee.length>0?ee.join(", "):"N/A")))),se.createElement("h2",{className:"text-base font-bold mt-8 mb-4 border-b border-gray-700 pb-2"},"Actions"),se.createElement("div",{className:"flex flex-col gap-3"},se.createElement("div",{className:"flex gap-2 items-center"},se.createElement("input",{type:"text",value:Z,onChange:Se=>G(Se.target.value),placeholder:"Tool name",className:"py-1.5 px-2 bg-[#1a1a1a] text-white border border-gray-700 rounded font-mono text-xs w-[150px]"}),se.createElement("input",{type:"text",value:ie,onChange:Se=>te(Se.target.value),placeholder:'{"key": "value"}',className:"py-1.5 px-2 bg-[#1a1a1a] text-white border border-gray-700 rounded font-mono text-xs flex-1"}),se.createElement("button",{onClick:Q,className:"py-1.5 px-3 bg-gray-800 text-white border border-gray-600 rounded cursor-pointer font-mono text-xs"},"Call Tool")),se.createElement("div",{className:"flex gap-2 items-center"},se.createElement("input",{type:"text",value:P,onChange:Se=>B(Se.target.value),placeholder:"Follow-up message",className:"py-1.5 px-2 bg-[#1a1a1a] text-white border border-gray-700 rounded font-mono text-xs flex-1"}),se.createElement("button",{onClick:oe,className:"py-1.5 px-3 bg-gray-800 text-white border border-gray-600 rounded cursor-pointer font-mono text-xs"},"Send Follow-Up")),se.createElement("div",{className:"flex gap-2 items-center"},se.createElement("input",{type:"text",value:j,onChange:Se=>$(Se.target.value),placeholder:"External URL",className:"py-1.5 px-2 bg-[#1a1a1a] text-white border border-gray-700 rounded font-mono text-xs flex-1"}),se.createElement("button",{onClick:ae,className:"py-1.5 px-3 bg-gray-800 text-white border border-gray-600 rounded cursor-pointer font-mono text-xs"},"Open Link")),se.createElement("div",{className:"flex gap-2 items-center"},se.createElement("span",{className:"w-[150px] text-xs"},"Display Mode:"),se.createElement("button",{onClick:()=>Re("inline"),className:"py-1.5 px-3 bg-gray-800 text-white border border-gray-600 rounded cursor-pointer font-mono text-xs flex-1"},"Inline"),se.createElement("button",{onClick:()=>Re("pip"),className:"py-1.5 px-3 bg-gray-800 text-white border border-gray-600 rounded cursor-pointer font-mono text-xs flex-1"},"PiP"),se.createElement("button",{onClick:()=>Re("fullscreen"),className:"py-1.5 px-3 bg-gray-800 text-white border border-gray-600 rounded cursor-pointer font-mono text-xs flex-1"},"Fullscreen")),se.createElement("div",{className:"flex gap-2 items-center"},se.createElement("button",{onClick:Ae,className:"py-1.5 px-3 bg-gray-800 text-white border border-gray-600 rounded cursor-pointer font-mono text-xs"},"Set State (Add Timestamp)")),le&&se.createElement("div",{className:"mt-2 p-2 bg-[#1a1a1a] border border-gray-700 rounded whitespace-pre-wrap break-all text-[11px] max-h-[200px] overflow-auto"},se.createElement("div",{className:"font-bold mb-1 text-gray-400"},"Result:"),le,se.createElement("button",{onClick:()=>q(""),className:"mt-2 py-1 px-2 bg-gray-800 text-white border border-gray-600 rounded cursor-pointer font-mono text-[11px]"},"Clear"))))))}Ge(Z8,"WidgetControls");function X8(){if(typeof window>"u")return"/";const t=window.location.pathname.match(/^(\/inspector\/api\/dev-widget\/[^/]+)/);return t?t[1]:"/"}Ge(X8,"getBasename");var _de=150,xde=5;function Tde({children:e,debugger:t=!1,viewControls:n=!1,autoSize:r=!1}){const a=X8(),i=b.useRef(null),s=b.useRef(0),c=b.useRef(null),u=b.useRef(!1),[d,p]=b.useState(null),[h,v]=b.useState(null),[y,E]=b.useState(!0);b.useEffect(()=>{let w=!0;return(async()=>{try{const T=await Za(()=>import("./index-D6062iNT.js"),[]);w&&(p(()=>T.BrowserRouter),E(!1))}catch{w&&(v(new Error(`❌ react-router-dom not installed!
|
|
45
45
|
|
|
46
46
|
To use MCP widgets with McpUseProvider, you need to install:
|
|
47
47
|
|
|
@@ -130,7 +130,7 @@ import(${JSON.stringify(t.entry.module)});`:" ";return b.createElement(b.Fragmen
|
|
|
130
130
|
`)},gU=function(){var e=parseInt(document.body.getAttribute(Yc)||"0",10);return isFinite(e)?e:0},Jve=function(){b.useEffect(function(){return document.body.setAttribute(Yc,(gU()+1).toString()),function(){var e=gU()-1;e<=0?document.body.removeAttribute(Yc):document.body.setAttribute(Yc,e.toString())}},[])},Qve=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,a=r===void 0?"margin":r;Jve();var i=b.useMemo(function(){return Yve(a)},[a]);return b.createElement(Zve,{styles:Xve(i,!t,a,n?"":"!important")})},JN=!1;if(typeof window<"u")try{var zh=Object.defineProperty({},"passive",{get:function(){return JN=!0,!0}});window.addEventListener("test",zh,zh),window.removeEventListener("test",zh,zh)}catch{JN=!1}var vc=JN?{passive:!1}:!1,ebe=function(e){return e.tagName==="TEXTAREA"},TK=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!ebe(e)&&n[t]==="visible")},tbe=function(e){return TK(e,"overflowY")},nbe=function(e){return TK(e,"overflowX")},vU=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var a=RK(e,r);if(a){var i=NK(e,r),s=i[1],c=i[2];if(s>c)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},rbe=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},abe=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},RK=function(e,t){return e==="v"?tbe(t):nbe(t)},NK=function(e,t){return e==="v"?rbe(t):abe(t)},ibe=function(e,t){return e==="h"&&t==="rtl"?-1:1},obe=function(e,t,n,r,a){var i=ibe(e,window.getComputedStyle(t).direction),s=i*r,c=n.target,u=t.contains(c),d=!1,p=s>0,h=0,v=0;do{if(!c)break;var y=NK(e,c),E=y[0],x=y[1],_=y[2],S=x-_-i*E;(E||S)&&RK(e,c)&&(h+=S,v+=E);var w=c.parentNode;c=w&&w.nodeType===Node.DOCUMENT_FRAGMENT_NODE?w.host:w}while(!u&&c!==document.body||u&&(t.contains(c)||t===c));return(p&&Math.abs(h)<1||!p&&Math.abs(v)<1)&&(d=!0),d},Fh=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},bU=function(e){return[e.deltaX,e.deltaY]},yU=function(e){return e&&"current"in e?e.current:e},sbe=function(e,t){return e[0]===t[0]&&e[1]===t[1]},lbe=function(e){return`
|
|
131
131
|
.block-interactivity-`.concat(e,` {pointer-events: none;}
|
|
132
132
|
.allow-interactivity-`).concat(e,` {pointer-events: all;}
|
|
133
|
-
`)},cbe=0,bc=[];function ube(e){var t=b.useRef([]),n=b.useRef([0,0]),r=b.useRef(),a=b.useState(cbe++)[0],i=b.useState(xK)[0],s=b.useRef(e);b.useEffect(function(){s.current=e},[e]),b.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(a));var x=Ive([e.lockRef.current],(e.shards||[]).map(yU),!0).filter(Boolean);return x.forEach(function(_){return _.classList.add("allow-interactivity-".concat(a))}),function(){document.body.classList.remove("block-interactivity-".concat(a)),x.forEach(function(_){return _.classList.remove("allow-interactivity-".concat(a))})}}},[e.inert,e.lockRef.current,e.shards]);var c=b.useCallback(function(x,_){if("touches"in x&&x.touches.length===2||x.type==="wheel"&&x.ctrlKey)return!s.current.allowPinchZoom;var S=Fh(x),w=n.current,T="deltaX"in x?x.deltaX:w[0]-S[0],k="deltaY"in x?x.deltaY:w[1]-S[1],N,A=x.target,C=Math.abs(T)>Math.abs(k)?"h":"v";if("touches"in x&&C==="h"&&A.type==="range")return!1;var O=vU(C,A);if(!O)return!0;if(O?N=C:(N=C==="v"?"h":"v",O=vU(C,A)),!O)return!1;if(!r.current&&"changedTouches"in x&&(T||k)&&(r.current=N),!N)return!0;var L=r.current||N;return obe(L,_,x,L==="h"?T:k)},[]),u=b.useCallback(function(x){var _=x;if(!(!bc.length||bc[bc.length-1]!==i)){var S="deltaY"in _?bU(_):Fh(_),w=t.current.filter(function(N){return N.name===_.type&&(N.target===_.target||_.target===N.shadowParent)&&sbe(N.delta,S)})[0];if(w&&w.should){_.cancelable&&_.preventDefault();return}if(!w){var T=(s.current.shards||[]).map(yU).filter(Boolean).filter(function(N){return N.contains(_.target)}),k=T.length>0?c(_,T[0]):!s.current.noIsolation;k&&_.cancelable&&_.preventDefault()}}},[]),d=b.useCallback(function(x,_,S,w){var T={name:x,delta:_,target:S,should:w,shadowParent:dbe(S)};t.current.push(T),setTimeout(function(){t.current=t.current.filter(function(k){return k!==T})},1)},[]),p=b.useCallback(function(x){n.current=Fh(x),r.current=void 0},[]),h=b.useCallback(function(x){d(x.type,bU(x),x.target,c(x,e.lockRef.current))},[]),v=b.useCallback(function(x){d(x.type,Fh(x),x.target,c(x,e.lockRef.current))},[]);b.useEffect(function(){return bc.push(i),e.setCallbacks({onScrollCapture:h,onWheelCapture:h,onTouchMoveCapture:v}),document.addEventListener("wheel",u,vc),document.addEventListener("touchmove",u,vc),document.addEventListener("touchstart",p,vc),function(){bc=bc.filter(function(x){return x!==i}),document.removeEventListener("wheel",u,vc),document.removeEventListener("touchmove",u,vc),document.removeEventListener("touchstart",p,vc)}},[]);var y=e.removeScrollBar,E=e.inert;return b.createElement(b.Fragment,null,E?b.createElement(i,{styles:lbe(a)}):null,y?b.createElement(Qve,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function dbe(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const fbe=zve(_K,ube);var vp=b.forwardRef(function(e,t){return b.createElement(nb,gi({},e,{ref:t,sideCar:fbe}))});vp.classNames=nb.classNames;var QN=["Enter"," "],pbe=["ArrowDown","PageUp","Home"],kK=["ArrowUp","PageDown","End"],mbe=[...pbe,...kK],hbe={ltr:[...QN,"ArrowRight"],rtl:[...QN,"ArrowLeft"]},gbe={ltr:["ArrowLeft"],rtl:["ArrowRight"]},bp="Menu",[Lf,vbe,bbe]=II(bp),[Al,CK]=oi(bp,[bbe,bs,hK]),rb=bs(),AK=hK(),[ybe,Il]=Al(bp),[wbe,yp]=Al(bp),IK=e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:a,onOpenChange:i,modal:s=!0}=e,c=rb(t),[u,d]=b.useState(null),p=b.useRef(!1),h=Ti(i),v=OI(a);return b.useEffect(()=>{const y=()=>{p.current=!0,document.addEventListener("pointerdown",E,{capture:!0,once:!0}),document.addEventListener("pointermove",E,{capture:!0,once:!0})},E=()=>p.current=!1;return document.addEventListener("keydown",y,{capture:!0}),()=>{document.removeEventListener("keydown",y,{capture:!0}),document.removeEventListener("pointerdown",E,{capture:!0}),document.removeEventListener("pointermove",E,{capture:!0})}},[]),m.jsx(Jv,{...c,children:m.jsx(ybe,{scope:t,open:n,onOpenChange:h,content:u,onContentChange:d,children:m.jsx(wbe,{scope:t,onClose:b.useCallback(()=>h(!1),[h]),isUsingKeyboardRef:p,dir:v,modal:s,children:r})})})};IK.displayName=bp;var Sbe="MenuAnchor",BI=b.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,a=rb(n);return m.jsx(hp,{...a,...r,ref:t})});BI.displayName=Sbe;var qI="MenuPortal",[Ebe,OK]=Al(qI,{forceMount:void 0}),DK=e=>{const{__scopeMenu:t,forceMount:n,children:r,container:a}=e,i=Il(qI,t);return m.jsx(Ebe,{scope:t,forceMount:n,children:m.jsx(ua,{present:n||i.open,children:m.jsx(Bu,{asChild:!0,container:a,children:r})})})};DK.displayName=qI;var Ia="MenuContent",[_be,HI]=Al(Ia),$K=b.forwardRef((e,t)=>{const n=OK(Ia,e.__scopeMenu),{forceMount:r=n.forceMount,...a}=e,i=Il(Ia,e.__scopeMenu),s=yp(Ia,e.__scopeMenu);return m.jsx(Lf.Provider,{scope:e.__scopeMenu,children:m.jsx(ua,{present:r||i.open,children:m.jsx(Lf.Slot,{scope:e.__scopeMenu,children:s.modal?m.jsx(xbe,{...a,ref:t}):m.jsx(Tbe,{...a,ref:t})})})})}),xbe=b.forwardRef((e,t)=>{const n=Il(Ia,e.__scopeMenu),r=b.useRef(null),a=Ft(t,r);return b.useEffect(()=>{const i=r.current;if(i)return tb(i)},[]),m.jsx(VI,{...e,ref:a,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:He(e.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),Tbe=b.forwardRef((e,t)=>{const n=Il(Ia,e.__scopeMenu);return m.jsx(VI,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),Rbe=hl("MenuContent.ScrollLock"),VI=b.forwardRef((e,t)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:a,onOpenAutoFocus:i,onCloseAutoFocus:s,disableOutsidePointerEvents:c,onEntryFocus:u,onEscapeKeyDown:d,onPointerDownOutside:p,onFocusOutside:h,onInteractOutside:v,onDismiss:y,disableOutsideScroll:E,...x}=e,_=Il(Ia,n),S=yp(Ia,n),w=rb(n),T=AK(n),k=vbe(n),[N,A]=b.useState(null),C=b.useRef(null),O=Ft(t,C,_.onContentChange),L=b.useRef(0),F=b.useRef(""),z=b.useRef(0),K=b.useRef(null),ee=b.useRef("right"),J=b.useRef(0),le=E?vp:b.Fragment,q=E?{as:Rbe,allowPinchZoom:!0}:void 0,Z=ie=>{const te=F.current+ie,P=k().filter(W=>!W.disabled),B=document.activeElement,j=P.find(W=>W.ref.current===B)?.textValue,$=P.map(W=>W.textValue),U=Pbe($,te,j),H=P.find(W=>W.textValue===U)?.ref.current;(function W(X){F.current=X,window.clearTimeout(L.current),X!==""&&(L.current=window.setTimeout(()=>W(""),1e3))})(te),H&&setTimeout(()=>H.focus())};b.useEffect(()=>()=>window.clearTimeout(L.current),[]),Wv();const G=b.useCallback(ie=>ee.current===K.current?.side&&zbe(ie,K.current?.area),[]);return m.jsx(_be,{scope:n,searchRef:F,onItemEnter:b.useCallback(ie=>{G(ie)&&ie.preventDefault()},[G]),onItemLeave:b.useCallback(ie=>{G(ie)||(C.current?.focus(),A(null))},[G]),onTriggerLeave:b.useCallback(ie=>{G(ie)&&ie.preventDefault()},[G]),pointerGraceTimerRef:z,onPointerGraceIntentChange:b.useCallback(ie=>{K.current=ie},[]),children:m.jsx(le,{...q,children:m.jsx(pp,{asChild:!0,trapped:a,onMountAutoFocus:He(i,ie=>{ie.preventDefault(),C.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:s,children:m.jsx(Uu,{asChild:!0,disableOutsidePointerEvents:c,onEscapeKeyDown:d,onPointerDownOutside:p,onFocusOutside:h,onInteractOutside:v,onDismiss:y,children:m.jsx(Rve,{asChild:!0,...T,dir:S.dir,orientation:"vertical",loop:r,currentTabStopId:N,onCurrentTabStopIdChange:A,onEntryFocus:He(u,ie=>{S.isUsingKeyboardRef.current||ie.preventDefault()}),preventScrollOnEntryFocus:!0,children:m.jsx(Qv,{role:"menu","aria-orientation":"vertical","data-state":ZK(_.open),"data-radix-menu-content":"",dir:S.dir,...w,...x,ref:O,style:{outline:"none",...x.style},onKeyDown:He(x.onKeyDown,ie=>{const P=ie.target.closest("[data-radix-menu-content]")===ie.currentTarget,B=ie.ctrlKey||ie.altKey||ie.metaKey,j=ie.key.length===1;P&&(ie.key==="Tab"&&ie.preventDefault(),!B&&j&&Z(ie.key));const $=C.current;if(ie.target!==$||!mbe.includes(ie.key))return;ie.preventDefault();const H=k().filter(W=>!W.disabled).map(W=>W.ref.current);kK.includes(ie.key)&&H.reverse(),Mbe(H)}),onBlur:He(e.onBlur,ie=>{ie.currentTarget.contains(ie.target)||(window.clearTimeout(L.current),F.current="")}),onPointerMove:He(e.onPointerMove,Mf(ie=>{const te=ie.target,P=J.current!==ie.clientX;if(ie.currentTarget.contains(te)&&P){const B=ie.clientX>J.current?"right":"left";ee.current=B,J.current=ie.clientX}}))})})})})})})});$K.displayName=Ia;var Nbe="MenuGroup",GI=b.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return m.jsx(Et.div,{role:"group",...r,ref:t})});GI.displayName=Nbe;var kbe="MenuLabel",LK=b.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return m.jsx(Et.div,{...r,ref:t})});LK.displayName=kbe;var Jg="MenuItem",wU="menu.itemSelect",ab=b.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:r,...a}=e,i=b.useRef(null),s=yp(Jg,e.__scopeMenu),c=HI(Jg,e.__scopeMenu),u=Ft(t,i),d=b.useRef(!1),p=()=>{const h=i.current;if(!n&&h){const v=new CustomEvent(wU,{bubbles:!0,cancelable:!0});h.addEventListener(wU,y=>r?.(y),{once:!0}),q7(h,v),v.defaultPrevented?d.current=!1:s.onClose()}};return m.jsx(MK,{...a,ref:u,disabled:n,onClick:He(e.onClick,p),onPointerDown:h=>{e.onPointerDown?.(h),d.current=!0},onPointerUp:He(e.onPointerUp,h=>{d.current||h.currentTarget?.click()}),onKeyDown:He(e.onKeyDown,h=>{const v=c.searchRef.current!=="";n||v&&h.key===" "||QN.includes(h.key)&&(h.currentTarget.click(),h.preventDefault())})})});ab.displayName=Jg;var MK=b.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:r=!1,textValue:a,...i}=e,s=HI(Jg,n),c=AK(n),u=b.useRef(null),d=Ft(t,u),[p,h]=b.useState(!1),[v,y]=b.useState("");return b.useEffect(()=>{const E=u.current;E&&y((E.textContent??"").trim())},[i.children]),m.jsx(Lf.ItemSlot,{scope:n,disabled:r,textValue:a??v,children:m.jsx(Nve,{asChild:!0,...c,focusable:!r,children:m.jsx(Et.div,{role:"menuitem","data-highlighted":p?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...i,ref:d,onPointerMove:He(e.onPointerMove,Mf(E=>{r?s.onItemLeave(E):(s.onItemEnter(E),E.defaultPrevented||E.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:He(e.onPointerLeave,Mf(E=>s.onItemLeave(E))),onFocus:He(e.onFocus,()=>h(!0)),onBlur:He(e.onBlur,()=>h(!1))})})})}),Cbe="MenuCheckboxItem",jK=b.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:r,...a}=e;return m.jsx(BK,{scope:e.__scopeMenu,checked:n,children:m.jsx(ab,{role:"menuitemcheckbox","aria-checked":Qg(n)?"mixed":n,...a,ref:t,"data-state":KI(n),onSelect:He(a.onSelect,()=>r?.(Qg(n)?!0:!n),{checkForDefaultPrevented:!1})})})});jK.displayName=Cbe;var PK="MenuRadioGroup",[Abe,Ibe]=Al(PK,{value:void 0,onValueChange:()=>{}}),UK=b.forwardRef((e,t)=>{const{value:n,onValueChange:r,...a}=e,i=Ti(r);return m.jsx(Abe,{scope:e.__scopeMenu,value:n,onValueChange:i,children:m.jsx(GI,{...a,ref:t})})});UK.displayName=PK;var zK="MenuRadioItem",FK=b.forwardRef((e,t)=>{const{value:n,...r}=e,a=Ibe(zK,e.__scopeMenu),i=n===a.value;return m.jsx(BK,{scope:e.__scopeMenu,checked:i,children:m.jsx(ab,{role:"menuitemradio","aria-checked":i,...r,ref:t,"data-state":KI(i),onSelect:He(r.onSelect,()=>a.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});FK.displayName=zK;var WI="MenuItemIndicator",[BK,Obe]=Al(WI,{checked:!1}),qK=b.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:r,...a}=e,i=Obe(WI,n);return m.jsx(ua,{present:r||Qg(i.checked)||i.checked===!0,children:m.jsx(Et.span,{...a,ref:t,"data-state":KI(i.checked)})})});qK.displayName=WI;var Dbe="MenuSeparator",HK=b.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return m.jsx(Et.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})});HK.displayName=Dbe;var $be="MenuArrow",VK=b.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,a=rb(n);return m.jsx(eb,{...a,...r,ref:t})});VK.displayName=$be;var Lbe="MenuSub",[mUe,GK]=Al(Lbe),ef="MenuSubTrigger",WK=b.forwardRef((e,t)=>{const n=Il(ef,e.__scopeMenu),r=yp(ef,e.__scopeMenu),a=GK(ef,e.__scopeMenu),i=HI(ef,e.__scopeMenu),s=b.useRef(null),{pointerGraceTimerRef:c,onPointerGraceIntentChange:u}=i,d={__scopeMenu:e.__scopeMenu},p=b.useCallback(()=>{s.current&&window.clearTimeout(s.current),s.current=null},[]);return b.useEffect(()=>p,[p]),b.useEffect(()=>{const h=c.current;return()=>{window.clearTimeout(h),u(null)}},[c,u]),m.jsx(BI,{asChild:!0,...d,children:m.jsx(MK,{id:a.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":a.contentId,"data-state":ZK(n.open),...e,ref:xi(t,a.onTriggerChange),onClick:h=>{e.onClick?.(h),!(e.disabled||h.defaultPrevented)&&(h.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:He(e.onPointerMove,Mf(h=>{i.onItemEnter(h),!h.defaultPrevented&&!e.disabled&&!n.open&&!s.current&&(i.onPointerGraceIntentChange(null),s.current=window.setTimeout(()=>{n.onOpenChange(!0),p()},100))})),onPointerLeave:He(e.onPointerLeave,Mf(h=>{p();const v=n.content?.getBoundingClientRect();if(v){const y=n.content?.dataset.side,E=y==="right",x=E?-5:5,_=v[E?"left":"right"],S=v[E?"right":"left"];i.onPointerGraceIntentChange({area:[{x:h.clientX+x,y:h.clientY},{x:_,y:v.top},{x:S,y:v.top},{x:S,y:v.bottom},{x:_,y:v.bottom}],side:y}),window.clearTimeout(c.current),c.current=window.setTimeout(()=>i.onPointerGraceIntentChange(null),300)}else{if(i.onTriggerLeave(h),h.defaultPrevented)return;i.onPointerGraceIntentChange(null)}})),onKeyDown:He(e.onKeyDown,h=>{const v=i.searchRef.current!=="";e.disabled||v&&h.key===" "||hbe[r.dir].includes(h.key)&&(n.onOpenChange(!0),n.content?.focus(),h.preventDefault())})})})});WK.displayName=ef;var KK="MenuSubContent",YK=b.forwardRef((e,t)=>{const n=OK(Ia,e.__scopeMenu),{forceMount:r=n.forceMount,...a}=e,i=Il(Ia,e.__scopeMenu),s=yp(Ia,e.__scopeMenu),c=GK(KK,e.__scopeMenu),u=b.useRef(null),d=Ft(t,u);return m.jsx(Lf.Provider,{scope:e.__scopeMenu,children:m.jsx(ua,{present:r||i.open,children:m.jsx(Lf.Slot,{scope:e.__scopeMenu,children:m.jsx(VI,{id:c.contentId,"aria-labelledby":c.triggerId,...a,ref:d,align:"start",side:s.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:p=>{s.isUsingKeyboardRef.current&&u.current?.focus(),p.preventDefault()},onCloseAutoFocus:p=>p.preventDefault(),onFocusOutside:He(e.onFocusOutside,p=>{p.target!==c.trigger&&i.onOpenChange(!1)}),onEscapeKeyDown:He(e.onEscapeKeyDown,p=>{s.onClose(),p.preventDefault()}),onKeyDown:He(e.onKeyDown,p=>{const h=p.currentTarget.contains(p.target),v=gbe[s.dir].includes(p.key);h&&v&&(i.onOpenChange(!1),c.trigger?.focus(),p.preventDefault())})})})})})});YK.displayName=KK;function ZK(e){return e?"open":"closed"}function Qg(e){return e==="indeterminate"}function KI(e){return Qg(e)?"indeterminate":e?"checked":"unchecked"}function Mbe(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function jbe(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function Pbe(e,t,n){const a=t.length>1&&Array.from(t).every(d=>d===t[0])?t[0]:t,i=n?e.indexOf(n):-1;let s=jbe(e,Math.max(i,0));a.length===1&&(s=s.filter(d=>d!==n));const u=s.find(d=>d.toLowerCase().startsWith(a.toLowerCase()));return u!==n?u:void 0}function Ube(e,t){const{x:n,y:r}=e;let a=!1;for(let i=0,s=t.length-1;i<t.length;s=i++){const c=t[i],u=t[s],d=c.x,p=c.y,h=u.x,v=u.y;p>r!=v>r&&n<(h-d)*(r-p)/(v-p)+d&&(a=!a)}return a}function zbe(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return Ube(n,t)}function Mf(e){return t=>t.pointerType==="mouse"?e(t):void 0}var Fbe=IK,Bbe=BI,qbe=DK,Hbe=$K,Vbe=GI,Gbe=LK,Wbe=ab,Kbe=jK,Ybe=UK,Zbe=FK,Xbe=qK,Jbe=HK,Qbe=VK,eye=WK,tye=YK,ib="DropdownMenu",[nye]=oi(ib,[CK]),Cr=CK(),[rye,XK]=nye(ib),JK=e=>{const{__scopeDropdownMenu:t,children:n,dir:r,open:a,defaultOpen:i,onOpenChange:s,modal:c=!0}=e,u=Cr(t),d=b.useRef(null),[p,h]=fo({prop:a,defaultProp:i??!1,onChange:s,caller:ib});return m.jsx(rye,{scope:t,triggerId:fr(),triggerRef:d,contentId:fr(),open:p,onOpenChange:h,onOpenToggle:b.useCallback(()=>h(v=>!v),[h]),modal:c,children:m.jsx(Fbe,{...u,open:p,onOpenChange:h,dir:r,modal:c,children:n})})};JK.displayName=ib;var QK="DropdownMenuTrigger",eY=b.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...a}=e,i=XK(QK,n),s=Cr(n);return m.jsx(Bbe,{asChild:!0,...s,children:m.jsx(Et.button,{type:"button",id:i.triggerId,"aria-haspopup":"menu","aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":i.open?"open":"closed","data-disabled":r?"":void 0,disabled:r,...a,ref:xi(t,i.triggerRef),onPointerDown:He(e.onPointerDown,c=>{!r&&c.button===0&&c.ctrlKey===!1&&(i.onOpenToggle(),i.open||c.preventDefault())}),onKeyDown:He(e.onKeyDown,c=>{r||(["Enter"," "].includes(c.key)&&i.onOpenToggle(),c.key==="ArrowDown"&&i.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(c.key)&&c.preventDefault())})})})});eY.displayName=QK;var aye="DropdownMenuPortal",tY=e=>{const{__scopeDropdownMenu:t,...n}=e,r=Cr(t);return m.jsx(qbe,{...r,...n})};tY.displayName=aye;var nY="DropdownMenuContent",rY=b.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=XK(nY,n),i=Cr(n),s=b.useRef(!1);return m.jsx(Hbe,{id:a.contentId,"aria-labelledby":a.triggerId,...i,...r,ref:t,onCloseAutoFocus:He(e.onCloseAutoFocus,c=>{s.current||a.triggerRef.current?.focus(),s.current=!1,c.preventDefault()}),onInteractOutside:He(e.onInteractOutside,c=>{const u=c.detail.originalEvent,d=u.button===0&&u.ctrlKey===!0,p=u.button===2||d;(!a.modal||p)&&(s.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)"}})});rY.displayName=nY;var iye="DropdownMenuGroup",oye=b.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=Cr(n);return m.jsx(Vbe,{...a,...r,ref:t})});oye.displayName=iye;var sye="DropdownMenuLabel",aY=b.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=Cr(n);return m.jsx(Gbe,{...a,...r,ref:t})});aY.displayName=sye;var lye="DropdownMenuItem",iY=b.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=Cr(n);return m.jsx(Wbe,{...a,...r,ref:t})});iY.displayName=lye;var cye="DropdownMenuCheckboxItem",oY=b.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=Cr(n);return m.jsx(Kbe,{...a,...r,ref:t})});oY.displayName=cye;var uye="DropdownMenuRadioGroup",dye=b.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=Cr(n);return m.jsx(Ybe,{...a,...r,ref:t})});dye.displayName=uye;var fye="DropdownMenuRadioItem",sY=b.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=Cr(n);return m.jsx(Zbe,{...a,...r,ref:t})});sY.displayName=fye;var pye="DropdownMenuItemIndicator",mye=b.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=Cr(n);return m.jsx(Xbe,{...a,...r,ref:t})});mye.displayName=pye;var hye="DropdownMenuSeparator",lY=b.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=Cr(n);return m.jsx(Jbe,{...a,...r,ref:t})});lY.displayName=hye;var gye="DropdownMenuArrow",vye=b.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=Cr(n);return m.jsx(Qbe,{...a,...r,ref:t})});vye.displayName=gye;var bye="DropdownMenuSubTrigger",cY=b.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=Cr(n);return m.jsx(eye,{...a,...r,ref:t})});cY.displayName=bye;var yye="DropdownMenuSubContent",uY=b.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=Cr(n);return m.jsx(tye,{...a,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});uY.displayName=yye;var wye=JK,Sye=eY,Eye=tY,dY=rY,fY=aY,pY=iY,_ye=oY,xye=sY,mY=lY,Tye=cY,Rye=uY;const ek=wye,tk=Sye;Tye.displayName;Rye.displayName;function ev({ref:e,className:t,sideOffset:n=4,...r}){return m.jsx(Eye,{children:m.jsx(dY,{ref:e,sideOffset:n,className:$e("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md","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",t),...r})})}ev.displayName=dY.displayName;function so({ref:e,className:t,inset:n,...r}){return m.jsx(pY,{ref:e,className:$e("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",n&&"pl-8",t),...r})}so.displayName=pY.displayName;_ye.displayName;xye.displayName;function nk({ref:e,className:t,inset:n,...r}){return m.jsx(fY,{ref:e,className:$e("px-2 py-1.5 text-sm font-semibold",n&&"pl-8",t),...r})}nk.displayName=fY.displayName;function tf({ref:e,className:t,...n}){return m.jsx(mY,{ref:e,className:$e("-mx-1 my-1 h-px bg-muted",t),...n})}tf.displayName=mY.displayName;var Nye=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],So=Nye.reduce((e,t)=>{const n=T7(`Primitive.${t}`),r=b.forwardRef((a,i)=>{const{asChild:s,...c}=a,u=s?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),m.jsx(u,{...c,ref:i})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),kye="Label",hY=b.forwardRef((e,t)=>m.jsx(So.label,{...e,ref:t,onMouseDown:n=>{n.target.closest("button, input, select, textarea")||(e.onMouseDown?.(n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));hY.displayName=kye;var Cye=hY;function yn({className:e,...t}){return m.jsx(Cye,{"data-slot":"label",className:$e("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",e),...t})}function ob({message:e,className:t="",vertical:n,noBorder:r}){return m.jsx("div",{className:$e(`mt-2 rounded-md p-6 ${t}`,!r&&"border"),children:m.jsxs("p",{className:$e("text-sm text-muted-foreground flex items-center gap-4",n&&"flex-col"),children:[m.jsx("svg",{width:"40",height:"40",viewBox:"0 0 273 273",version:"1.1",xmlns:"http://www.w3.org/2000/svg",className:"flex-shrink-0",children:m.jsx("g",{stroke:"none",strokeWidth:"1",fill:"none",fillRule:"evenodd",children:m.jsxs("g",{transform:"translate(5.320900, 5.320900)",fillRule:"nonzero",className:"stroke-black dark:stroke-white",strokeWidth:"4",children:[m.jsx("path",{d:"M49.953025,-2.10854389 C63.26892,-2.21867124 76.6185256,2.70621155 86.9019463,12.6653164 L86.9019463,12.6653164 L87.505627,13.2592944 C97.5154947,23.2654892 102.640454,36.3074513 102.880738,49.4222247 C103.08932,77.4533067 113.877287,105.391753 135.242867,126.757333 C156.613383,148.127849 184.559216,158.914875 212.568138,159.119313 L212.568138,159.119313 L213.212264,159.134159 C225.843948,159.517566 238.363557,164.434972 248.121998,173.886137 L248.121998,173.886137 L248.725621,174.480088 C258.982114,184.732164 264.11035,198.171134 264.11035,211.6101 C264.11035,225.04592 258.984514,238.481745 248.732867,248.732867 C238.592792,258.872942 225.336706,263.997882 212.046872,264.107794 C198.731075,264.21792 185.381569,259.293085 175.098248,249.334078 L175.098248,249.334078 L174.494602,248.740134 C163.75802,238.008189 158.640853,223.784027 159.143413,209.719372 C158.258245,182.640933 147.489786,155.83332 126.828333,135.171867 C106.351297,114.694831 79.8363505,103.934873 53.0237258,102.891841 L53.0237258,102.891841 L52.2811438,102.865674 C38.4791718,103.347421 24.5325234,98.4328111 13.8776628,88.1140866 L13.8776628,88.1140866 L13.2739843,87.5201168 C3.12895117,77.3789607 -1.9984796,64.1195994 -2.10841888,50.8264755 C-2.21854669,37.5105567 2.70635908,24.1609269 12.6655135,13.8774565 L12.6655135,13.8774565 L13.2594878,13.2737797 C23.4005926,3.12880025 36.659927,-1.99860507 49.953025,-2.10854389 Z"}),m.jsx("circle",{cx:"50",cy:"212.0001",r:"52.5"}),m.jsx("circle",{cx:"212.0001",cy:"50",r:"52.5"})]})})}),e]})})}function gY({className:e,color:t,children:n,grayscaled:r=!1}){const a=b.useMemo(()=>{if(t){const h=t.split("(")[1].split(")")[0].trim().split(/\s+/);return Number.parseFloat(h[1]||"0")}return r?0:.2},[t,r]),i=b.useMemo(()=>{if(t){const h=t.split("(")[1].split(")")[0].trim().split(/\s+/);return Number.parseFloat(h[0]||"0.5")}return r?.3:.4},[t,r]),s=b.useMemo(()=>{if(t){const h=t.split("(")[1].split(")")[0].trim().split(/\s+/);return Number.parseFloat(h[2]||"0")}return Math.floor(Math.random()*360)},[t]),c=b.useMemo(()=>t||`oklch(${Math.min(i,1)} ${a} ${s})`,[s,a,i]),u=b.useMemo(()=>`oklch(${Math.min(i*2,1)} ${a} ${s})`,[s,a,i,t]),d=b.useMemo(()=>Math.floor(Math.random()*360),[s]),p=b.useMemo(()=>"1000%",[]);return m.jsx("section",{className:$e("relative w-full h-full overflow-hidden",e),style:{background:`${u}`},children:m.jsxs("div",{className:"isolate relative w-full h-full",children:[m.jsx("div",{className:"noise w-full h-full",style:{background:`linear-gradient(${d}deg, ${c}, transparent), url(https://grainy-gradients.vercel.app/noise.svg)`,filter:`contrast(120%) brightness(${p})`}}),n&&m.jsx("div",{className:"relative z-10 w-full h-full",children:n})]})})}function YI(e){const t=b.useRef({value:e,previous:e});return b.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var sb="Switch",[Aye]=oi(sb),[Iye,Oye]=Aye(sb),vY=b.forwardRef((e,t)=>{const{__scopeSwitch:n,name:r,checked:a,defaultChecked:i,required:s,disabled:c,value:u="on",onCheckedChange:d,form:p,...h}=e,[v,y]=b.useState(null),E=Ft(t,T=>y(T)),x=b.useRef(!1),_=v?p||!!v.closest("form"):!0,[S,w]=fo({prop:a,defaultProp:i??!1,onChange:d,caller:sb});return m.jsxs(Iye,{scope:n,checked:S,disabled:c,children:[m.jsx(Et.button,{type:"button",role:"switch","aria-checked":S,"aria-required":s,"data-state":SY(S),"data-disabled":c?"":void 0,disabled:c,value:u,...h,ref:E,onClick:He(e.onClick,T=>{w(k=>!k),_&&(x.current=T.isPropagationStopped(),x.current||T.stopPropagation())})}),_&&m.jsx(wY,{control:v,bubbles:!x.current,name:r,value:u,checked:S,required:s,disabled:c,form:p,style:{transform:"translateX(-100%)"}})]})});vY.displayName=sb;var bY="SwitchThumb",yY=b.forwardRef((e,t)=>{const{__scopeSwitch:n,...r}=e,a=Oye(bY,n);return m.jsx(Et.span,{"data-state":SY(a.checked),"data-disabled":a.disabled?"":void 0,...r,ref:t})});yY.displayName=bY;var Dye="SwitchBubbleInput",wY=b.forwardRef(({__scopeSwitch:e,control:t,checked:n,bubbles:r=!0,...a},i)=>{const s=b.useRef(null),c=Ft(s,i),u=YI(n),d=UI(t);return b.useEffect(()=>{const p=s.current;if(!p)return;const h=window.HTMLInputElement.prototype,y=Object.getOwnPropertyDescriptor(h,"checked").set;if(u!==n&&y){const E=new Event("click",{bubbles:r});y.call(p,n),p.dispatchEvent(E)}},[u,n,r]),m.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...a,tabIndex:-1,ref:c,style:{...a.style,...d,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});wY.displayName=Dye;function SY(e){return e?"checked":"unchecked"}var EY=vY,$ye=yY;function lb({ref:e,className:t,...n}){return m.jsx(EY,{className:$e("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",t),...n,ref:e,children:m.jsx($ye,{className:$e("pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})})}lb.displayName=EY.displayName;var _Y=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),Lye="VisuallyHidden",xY=b.forwardRef((e,t)=>m.jsx(Et.span,{...e,ref:t,style:{..._Y,...e.style}}));xY.displayName=Lye;var Mye=xY,[cb]=oi("Tooltip",[bs]),ub=bs(),TY="TooltipProvider",jye=700,rk="tooltip.open",[Pye,ZI]=cb(TY),RY=e=>{const{__scopeTooltip:t,delayDuration:n=jye,skipDelayDuration:r=300,disableHoverableContent:a=!1,children:i}=e,s=b.useRef(!0),c=b.useRef(!1),u=b.useRef(0);return b.useEffect(()=>{const d=u.current;return()=>window.clearTimeout(d)},[]),m.jsx(Pye,{scope:t,isOpenDelayedRef:s,delayDuration:n,onOpen:b.useCallback(()=>{window.clearTimeout(u.current),s.current=!1},[]),onClose:b.useCallback(()=>{window.clearTimeout(u.current),u.current=window.setTimeout(()=>s.current=!0,r)},[r]),isPointerInTransitRef:c,onPointerInTransitChange:b.useCallback(d=>{c.current=d},[]),disableHoverableContent:a,children:i})};RY.displayName=TY;var jf="Tooltip",[Uye,wp]=cb(jf),NY=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:a,onOpenChange:i,disableHoverableContent:s,delayDuration:c}=e,u=ZI(jf,e.__scopeTooltip),d=ub(t),[p,h]=b.useState(null),v=fr(),y=b.useRef(0),E=s??u.disableHoverableContent,x=c??u.delayDuration,_=b.useRef(!1),[S,w]=fo({prop:r,defaultProp:a??!1,onChange:C=>{C?(u.onOpen(),document.dispatchEvent(new CustomEvent(rk))):u.onClose(),i?.(C)},caller:jf}),T=b.useMemo(()=>S?_.current?"delayed-open":"instant-open":"closed",[S]),k=b.useCallback(()=>{window.clearTimeout(y.current),y.current=0,_.current=!1,w(!0)},[w]),N=b.useCallback(()=>{window.clearTimeout(y.current),y.current=0,w(!1)},[w]),A=b.useCallback(()=>{window.clearTimeout(y.current),y.current=window.setTimeout(()=>{_.current=!0,w(!0),y.current=0},x)},[x,w]);return b.useEffect(()=>()=>{y.current&&(window.clearTimeout(y.current),y.current=0)},[]),m.jsx(Jv,{...d,children:m.jsx(Uye,{scope:t,contentId:v,open:S,stateAttribute:T,trigger:p,onTriggerChange:h,onTriggerEnter:b.useCallback(()=>{u.isOpenDelayedRef.current?A():k()},[u.isOpenDelayedRef,A,k]),onTriggerLeave:b.useCallback(()=>{E?N():(window.clearTimeout(y.current),y.current=0)},[N,E]),onOpen:k,onClose:N,disableHoverableContent:E,children:n})})};NY.displayName=jf;var ak="TooltipTrigger",kY=b.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,a=wp(ak,n),i=ZI(ak,n),s=ub(n),c=b.useRef(null),u=Ft(t,c,a.onTriggerChange),d=b.useRef(!1),p=b.useRef(!1),h=b.useCallback(()=>d.current=!1,[]);return b.useEffect(()=>()=>document.removeEventListener("pointerup",h),[h]),m.jsx(hp,{asChild:!0,...s,children:m.jsx(Et.button,{"aria-describedby":a.open?a.contentId:void 0,"data-state":a.stateAttribute,...r,ref:u,onPointerMove:He(e.onPointerMove,v=>{v.pointerType!=="touch"&&!p.current&&!i.isPointerInTransitRef.current&&(a.onTriggerEnter(),p.current=!0)}),onPointerLeave:He(e.onPointerLeave,()=>{a.onTriggerLeave(),p.current=!1}),onPointerDown:He(e.onPointerDown,()=>{a.open&&a.onClose(),d.current=!0,document.addEventListener("pointerup",h,{once:!0})}),onFocus:He(e.onFocus,()=>{d.current||a.onOpen()}),onBlur:He(e.onBlur,a.onClose),onClick:He(e.onClick,a.onClose)})})});kY.displayName=ak;var XI="TooltipPortal",[zye,Fye]=cb(XI,{forceMount:void 0}),CY=e=>{const{__scopeTooltip:t,forceMount:n,children:r,container:a}=e,i=wp(XI,t);return m.jsx(zye,{scope:t,forceMount:n,children:m.jsx(ua,{present:n||i.open,children:m.jsx(Bu,{asChild:!0,container:a,children:r})})})};CY.displayName=XI;var xu="TooltipContent",AY=b.forwardRef((e,t)=>{const n=Fye(xu,e.__scopeTooltip),{forceMount:r=n.forceMount,side:a="top",...i}=e,s=wp(xu,e.__scopeTooltip);return m.jsx(ua,{present:r||s.open,children:s.disableHoverableContent?m.jsx(IY,{side:a,...i,ref:t}):m.jsx(Bye,{side:a,...i,ref:t})})}),Bye=b.forwardRef((e,t)=>{const n=wp(xu,e.__scopeTooltip),r=ZI(xu,e.__scopeTooltip),a=b.useRef(null),i=Ft(t,a),[s,c]=b.useState(null),{trigger:u,onClose:d}=n,p=a.current,{onPointerInTransitChange:h}=r,v=b.useCallback(()=>{c(null),h(!1)},[h]),y=b.useCallback((E,x)=>{const _=E.currentTarget,S={x:E.clientX,y:E.clientY},w=Gye(S,_.getBoundingClientRect()),T=Wye(S,w),k=Kye(x.getBoundingClientRect()),N=Zye([...T,...k]);c(N),h(!0)},[h]);return b.useEffect(()=>()=>v(),[v]),b.useEffect(()=>{if(u&&p){const E=_=>y(_,p),x=_=>y(_,u);return u.addEventListener("pointerleave",E),p.addEventListener("pointerleave",x),()=>{u.removeEventListener("pointerleave",E),p.removeEventListener("pointerleave",x)}}},[u,p,y,v]),b.useEffect(()=>{if(s){const E=x=>{const _=x.target,S={x:x.clientX,y:x.clientY},w=u?.contains(_)||p?.contains(_),T=!Yye(S,s);w?v():T&&(v(),d())};return document.addEventListener("pointermove",E),()=>document.removeEventListener("pointermove",E)}},[u,p,s,d,v]),m.jsx(IY,{...e,ref:i})}),[qye,Hye]=cb(jf,{isInside:!1}),Vye=The("TooltipContent"),IY=b.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":a,onEscapeKeyDown:i,onPointerDownOutside:s,...c}=e,u=wp(xu,n),d=ub(n),{onClose:p}=u;return b.useEffect(()=>(document.addEventListener(rk,p),()=>document.removeEventListener(rk,p)),[p]),b.useEffect(()=>{if(u.trigger){const h=v=>{v.target?.contains(u.trigger)&&p()};return window.addEventListener("scroll",h,{capture:!0}),()=>window.removeEventListener("scroll",h,{capture:!0})}},[u.trigger,p]),m.jsx(Uu,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:s,onFocusOutside:h=>h.preventDefault(),onDismiss:p,children:m.jsxs(Qv,{"data-state":u.stateAttribute,...d,...c,ref:t,style:{...c.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[m.jsx(Vye,{children:r}),m.jsx(qye,{scope:n,isInside:!0,children:m.jsx(Mye,{id:u.contentId,role:"tooltip",children:a||r})})]})})});AY.displayName=xu;var OY="TooltipArrow",DY=b.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,a=ub(n);return Hye(OY,n).isInside?null:m.jsx(eb,{...a,...r,ref:t})});DY.displayName=OY;function Gye(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),a=Math.abs(t.right-e.x),i=Math.abs(t.left-e.x);switch(Math.min(n,r,a,i)){case i:return"left";case a:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function Wye(e,t,n=5){const r=[];switch(t){case"top":r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function Kye(e){const{top:t,right:n,bottom:r,left:a}=e;return[{x:a,y:t},{x:n,y:t},{x:n,y:r},{x:a,y:r}]}function Yye(e,t){const{x:n,y:r}=e;let a=!1;for(let i=0,s=t.length-1;i<t.length;s=i++){const c=t[i],u=t[s],d=c.x,p=c.y,h=u.x,v=u.y;p>r!=v>r&&n<(h-d)*(r-p)/(v-p)+d&&(a=!a)}return a}function Zye(e){const t=e.slice();return t.sort((n,r)=>n.x<r.x?-1:n.x>r.x?1:n.y<r.y?-1:n.y>r.y?1:0),Xye(t)}function Xye(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r<e.length;r++){const a=e[r];for(;t.length>=2;){const i=t[t.length-1],s=t[t.length-2];if((i.x-s.x)*(a.y-s.y)>=(i.y-s.y)*(a.x-s.x))t.pop();else break}t.push(a)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const a=e[r];for(;n.length>=2;){const i=n[n.length-1],s=n[n.length-2];if((i.x-s.x)*(a.y-s.y)>=(i.y-s.y)*(a.x-s.x))n.pop();else break}n.push(a)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var Jye=RY,Qye=NY,ewe=kY,twe=CY,nwe=AY,rwe=DY;function $Y({delayDuration:e=0,...t}){return m.jsx(Jye,{"data-slot":"tooltip-provider",delayDuration:e,...t})}function ln({...e}){return m.jsx($Y,{children:m.jsx(Qye,{"data-slot":"tooltip",...e})})}function cn({...e}){return m.jsx(ewe,{"data-slot":"tooltip-trigger",...e})}function un({className:e,sideOffset:t=0,children:n,...r}){return m.jsx(twe,{children:m.jsxs(nwe,{"data-slot":"tooltip-content",sideOffset:t,className:$e("bg-foreground text-background animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-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 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",e),...r,children:[n,m.jsx(rwe,{className:"bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}class awe{name="mcp_inspector_open";properties;constructor(t){this.properties={server_url:t.serverUrl,connection_count:t.connectionCount}}}class SU{name="mcp_tool_execution";properties;constructor(t){this.properties={tool_name:t.toolName,server_id:t.serverId,success:t.success,duration:t.duration,error:t.error}}}class EU{name="mcp_resource_read";properties;constructor(t){this.properties={resource_uri:t.resourceUri,server_id:t.serverId,success:t.success,error:t.error}}}class _U{name="mcp_prompt_call";properties;constructor(t){this.properties={prompt_name:t.promptName,server_id:t.serverId,success:t.success,error:t.error}}}class xU{name="mcp_chat_message";properties;constructor(t){this.properties={server_id:t.serverId,provider:t.provider,model:t.model,message_count:t.messageCount,tool_calls_count:t.toolCallsCount,success:t.success,execution_mode:t.executionMode,duration:t.duration,error:t.error}}}class iwe{name="mcp_server_added";properties;constructor(t){this.properties={server_id:t.serverId,server_url:t.serverUrl,connection_type:t.connectionType,via_proxy:t.viaProxy}}}class owe{name="mcp_server_removed";properties;constructor(t){this.properties={server_id:t.serverId}}}class swe{name="mcp_command_palette_open";properties;constructor(t){this.properties={trigger:t.trigger}}}class lwe{name="mcp_tool_saved";properties;constructor(t){this.properties={tool_name:t.toolName,server_id:t.serverId}}}function $S(){try{return"0.9.0"}catch{return"0.0.0"}}var cwe={};function LS(){try{return typeof window<"u"&&typeof document<"u"}catch{return!1}}class TU{endpoint;timeout;constructor(t,n=3e3){this.endpoint=t,this.timeout=n}async logEvent(t){try{const n=new AbortController,r=setTimeout(()=>n.abort(),this.timeout),a=await fetch(this.endpoint,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t),signal:n.signal});if(clearTimeout(r),!a.ok)throw new Error(`HTTP error! status: ${a.status}`)}catch{}}}function Ko(e){return`mcp_inspector_telemetry_${e}`}class er{static instance=null;POSTHOG_PROXY_URL="/inspector/api/tel/posthog";SCARF_PROXY_URL="/inspector/api/tel/scarf";UNKNOWN_USER_ID="UNKNOWN_USER_ID";_currUserId=null;_posthogClient=null;_scarfClient=null;_source="inspector";constructor(){const t=LS(),n=this.isTelemetryDisabled();if(this._source=this.getStoredSource()||"inspector",n)this._posthogClient=null,this._scarfClient=null;else if(!t)this._posthogClient=null,this._scarfClient=null;else{try{this._posthogClient=new TU(this.POSTHOG_PROXY_URL,3e3)}catch{this._posthogClient=null}try{this._scarfClient=new TU(this.SCARF_PROXY_URL,3e3)}catch{this._scarfClient=null}}}isTelemetryDisabled(){return typeof localStorage<"u"&&localStorage.getItem(Ko("disabled"))==="true"||typeof process<"u"&&cwe?.MCP_USE_ANONYMIZED_TELEMETRY==="false"}getStoredSource(){return typeof localStorage<"u"?localStorage.getItem(Ko("source")):null}static getInstance(){return er.instance||(er.instance=new er),er.instance}setSource(t){this._source=t,typeof localStorage<"u"&&localStorage.setItem(Ko("source"),t)}getSource(){return this._source}get userId(){if(this._currUserId)return this._currUserId;if(!LS())return this._currUserId=this.UNKNOWN_USER_ID,this._currUserId;try{const t=localStorage.getItem(Ko("user_id"));if(t)this._currUserId=t;else{const n=this.generateUserId();localStorage.setItem(Ko("user_id"),n),this._currUserId=n}this.trackPackageDownload({triggered_by:"user_id_property"}).catch(()=>{})}catch{this._currUserId=this.UNKNOWN_USER_ID}return this._currUserId}generateUserId(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{const n=Math.random()*16|0;return(t==="x"?n:n&3|8).toString(16)})}async capture(t){if(!(!this._posthogClient&&!this._scarfClient)){if(this._posthogClient)try{const n={event:t.name,user_id:this.userId,properties:{...t.properties,mcp_use_version:$S(),language:"typescript",source:this._source,package:"inspector"}};await this._posthogClient.logEvent(n)}catch{}if(this._scarfClient)try{const n={};n.mcp_use_version=$S(),n.user_id=this.userId,n.event=t.name,n.language="typescript",n.source=this._source,n.package="inspector",await this._scarfClient.logEvent(n)}catch{}}}async trackPackageDownload(t){if(this._scarfClient&&LS())try{const n=$S();let r=!1,a=!1;const i=localStorage.getItem(Ko("download_version"));if(i?n>i&&(r=!0,a=!1,localStorage.setItem(Ko("download_version"),n)):(r=!0,a=!0,localStorage.setItem(Ko("download_version"),n)),r){const s={...t||{}};s.mcp_use_version=n,s.user_id=this.userId,s.event="package_download",s.first_download=a,s.language="typescript",s.source=this._source,s.package="inspector",await this._scarfClient.logEvent(s)}}catch{}}async trackInspectorOpen(t){const n=new awe(t);await this.capture(n)}}const LY=b.createContext(null);function JI(){const e=b.use(LY);if(!e)throw new Error("useMcpContext must be used within a McpProvider");return e}function uwe({url:e,name:t,proxyConfig:n,transportType:r,connectionId:a,onUpdate:i,onRemove:s}){const c=typeof window<"u"?new URL("/inspector/oauth/callback",window.location.origin).toString():"/inspector/oauth/callback";let u=e,d={};if(n?.proxyAddress){const F=new URL(n.proxyAddress),z=new URL(e);u=`${F.origin}${F.pathname}${z.pathname}${z.search}`,d["X-Target-URL"]=e}n?.customHeaders&&(d={...d,...n.customHeaders});const p=b.useRef(null),[h,v]=b.useState(!1),y=b.useRef(!1);b.useEffect(()=>{typeof window<"u"&&!y.current&&(y.current=!0,Za(()=>import("./transport-wrapper-browser-BI4dDu3b.js"),[]).then(F=>{p.current=F.wrapTransportForLogging,v(!0),console.log("[McpContext] Transport wrapper loaded")}).catch(F=>{console.error("[McpContext] Failed to load transport wrapper:",F)}))},[]);const E=b.useMemo(()=>{if(!(!h||!p.current))return(F,z)=>{const K=a;return console.log("[McpContext] Applying transport wrapper, serverId:",K,"from connector:",z),p.current(F,K)}},[h,a]),x=`mcp-inspector-notifications-${a}`,_=500,[S,w]=b.useState([]);b.useEffect(()=>{try{const F=localStorage.getItem(x);if(F){const z=JSON.parse(F);Array.isArray(z)&&w(z)}}catch(F){console.error("Failed to load notifications from localStorage:",F)}},[x]),b.useEffect(()=>{try{localStorage.setItem(x,JSON.stringify(S))}catch(F){console.error("Failed to save notifications to localStorage:",F)}},[S,x]);const T=b.useCallback(F=>{w(z=>z.map(K=>K.id===F?{...K,read:!0}:K))},[]),k=b.useCallback(()=>{w(F=>F.map(z=>({...z,read:!0})))},[]),N=b.useCallback(()=>{w([])},[]),A=b.useCallback(F=>{w(z=>{const K=[F,...z];return K.length>_?K.slice(0,_):K})},[]),C=rI({url:u,callbackUrl:c,customHeaders:Object.keys(d).length>0?d:void 0,transportType:r||"http",preventAutoAuth:!0,useRedirectFlow:!0,enabled:h,wrapTransport:E,onNotification:F=>{A({id:globalThis.crypto.randomUUID(),method:F.method,params:F.params,timestamp:Date.now(),read:!1})}}),O=b.useRef(i),L=b.useRef(null);return b.useEffect(()=>{O.current=i},[i]),b.useEffect(()=>{if(typeof queueMicrotask<"u")queueMicrotask(()=>{C.state==="ready"&&C.serverInfo&&console.log("[McpContext] Server info available:",C.serverInfo);const F=S.filter(ee=>!ee.read).length,z={id:a,url:e,name:C.serverInfo?.name||t,state:C.state,tools:C.tools,resources:C.resources,prompts:C.prompts,error:C.error??null,authUrl:C.authUrl??null,customHeaders:d,transportType:r,proxyConfig:n,serverInfo:C.serverInfo,capabilities:C.capabilities,notifications:S,unreadNotificationCount:F,markNotificationRead:T,markAllNotificationsRead:k,clearNotifications:N,callTool:C.callTool,readResource:C.readResource,listPrompts:C.listPrompts,getPrompt:C.getPrompt,authenticate:C.authenticate,retry:C.retry,clearStorage:C.clearStorage,disconnect:C.disconnect,client:C.client},K=L.current;(!K||K.state!==z.state||K.error!==z.error||K.authUrl!==z.authUrl||K.name!==z.name||K.tools.length!==z.tools.length||K.resources.length!==z.resources.length||K.prompts.length!==z.prompts.length||K.serverInfo!==z.serverInfo||K.capabilities!==z.capabilities||K.notifications.length!==z.notifications.length||K.unreadNotificationCount!==z.unreadNotificationCount||!K.client)&&(L.current=z,O.current(z))});else{const F=S.filter(ee=>!ee.read).length,z={id:a,url:e,name:C.serverInfo?.name||t,state:C.state,tools:C.tools,resources:C.resources,prompts:C.prompts,error:C.error??null,authUrl:C.authUrl??null,customHeaders:d,transportType:r,proxyConfig:n,serverInfo:C.serverInfo,capabilities:C.capabilities,notifications:S,unreadNotificationCount:F,markNotificationRead:T,markAllNotificationsRead:k,clearNotifications:N,callTool:C.callTool,readResource:C.readResource,listPrompts:C.listPrompts,getPrompt:C.getPrompt,authenticate:C.authenticate,retry:C.retry,clearStorage:C.clearStorage,disconnect:C.disconnect,client:C.client},K=L.current;(!K||K.state!==z.state||K.error!==z.error||K.authUrl!==z.authUrl||K.name!==z.name||K.tools.length!==z.tools.length||K.resources.length!==z.resources.length||K.prompts.length!==z.prompts.length||K.serverInfo!==z.serverInfo||K.capabilities!==z.capabilities||K.notifications.length!==z.notifications.length||K.unreadNotificationCount!==z.unreadNotificationCount||!K.client)&&(L.current=z,O.current(z))}},[e,t,r,n,d,a,C.state,C.tools,C.resources,C.prompts,C.error,C.authUrl,C.serverInfo,C.capabilities,C.client,S,T,k,N,C.callTool,C.readResource,C.listPrompts,C.getPrompt,C.authenticate,C.retry,C.clearStorage]),null}function dwe({children:e}){const[t,n]=b.useState([]),[r,a]=b.useState(!1),[i,s]=b.useState(!0),[c,u]=b.useState([]);b.useEffect(()=>{try{const _=localStorage.getItem("mcp-inspector-connections");if(_){const w=JSON.parse(_);Array.isArray(w)&&(u(w),n(w.map(T=>({id:T.id||T.url,url:T.url,name:T.name||"MCP Server",state:"discovering",tools:[],resources:[],prompts:[],error:null,authUrl:null,customHeaders:T.proxyConfig?.customHeaders,transportType:T.transportType,proxyConfig:T.proxyConfig,notifications:[],unreadNotificationCount:0,markNotificationRead:()=>{},markAllNotificationsRead:()=>{},clearNotifications:()=>{},callTool:async()=>{},readResource:async()=>{},listPrompts:async()=>{},getPrompt:async()=>{},authenticate:()=>{},retry:()=>{},clearStorage:()=>{},disconnect:()=>{},client:null}))))}const S=localStorage.getItem("mcp-inspector-auto-connect");S!==null&&s(S==="true")}catch(_){console.error("Failed to load connections from localStorage:",_)}finally{a(!0)}},[]),b.useEffect(()=>{r&&localStorage.setItem("mcp-inspector-connections",JSON.stringify(c))},[c,r]),b.useEffect(()=>{r&&localStorage.setItem("mcp-inspector-auto-connect",String(i))},[i,r]);const d=b.useCallback((_,S,w,T)=>{const k=c.find(C=>C.url===_),N=t.find(C=>C.url===_);if(k&&N){if(JSON.stringify(k.proxyConfig)!==JSON.stringify(w)&&w){u(O=>O.filter(L=>L.url!==_)),n(O=>O.filter(L=>L.url!==_)),setTimeout(()=>{const O={id:_,url:_,name:S||k.name||"MCP Server",proxyConfig:w,transportType:T||k.transportType};u(L=>[...L,O]),n(L=>[...L,{id:_,url:_,name:S||k.name||"MCP Server",state:"connecting",tools:[],resources:[],prompts:[],error:null,authUrl:null,customHeaders:w?.customHeaders,transportType:T||k.transportType,proxyConfig:w,notifications:[],unreadNotificationCount:0,markNotificationRead:()=>{},markAllNotificationsRead:()=>{},clearNotifications:()=>{},callTool:async()=>{},readResource:async()=>{},listPrompts:async()=>{},getPrompt:async()=>{},authenticate:()=>{},retry:()=>{},clearStorage:()=>{},disconnect:()=>{},client:null}])},10);return}return}if(k&&!N){(w||T)&&u(C=>C.map(O=>O.url===_?{...O,proxyConfig:w||O.proxyConfig,transportType:T||O.transportType,name:S||O.name}:O)),n(C=>[...C,{id:k.id||_,url:_,name:S||k.name||"MCP Server",state:"connecting",tools:[],resources:[],prompts:[],error:null,authUrl:null,customHeaders:w?.customHeaders||k.proxyConfig?.customHeaders,transportType:T||k.transportType,proxyConfig:w||k.proxyConfig,notifications:[],unreadNotificationCount:0,markNotificationRead:()=>{},markAllNotificationsRead:()=>{},clearNotifications:()=>{},callTool:async()=>{},readResource:async()=>{},listPrompts:async()=>{},getPrompt:async()=>{},authenticate:()=>{},retry:()=>{},clearStorage:()=>{},disconnect:()=>{},client:null}]);return}const A={id:_,url:_,name:S||"MCP Server",proxyConfig:w,transportType:T};u(C=>[...C,A]),n(C=>[...C,{id:_,url:_,name:S||"MCP Server",state:"connecting",tools:[],resources:[],prompts:[],error:null,authUrl:null,customHeaders:w?.customHeaders,transportType:T,proxyConfig:w,notifications:[],unreadNotificationCount:0,markNotificationRead:()=>{},markAllNotificationsRead:()=>{},clearNotifications:()=>{},callTool:async()=>{},readResource:async()=>{},listPrompts:async()=>{},getPrompt:async()=>{},authenticate:()=>{},retry:()=>{},clearStorage:()=>{},disconnect:()=>{},client:null}])},[c,t]),p=b.useCallback(_=>{const S=t.find(T=>T.id===_);S&&(console.log(`[McpContext] Cleaning up connection: ${_}`),S.disconnect&&(console.log(`[McpContext] Disconnecting from server: ${_}`),S.disconnect()),S.clearStorage&&(console.log(`[McpContext] Clearing OAuth storage for connection: ${_}`),S.clearStorage())),u(T=>T.filter(k=>k.id!==_)),n(T=>T.filter(k=>k.id!==_));const w=localStorage.getItem("mcp-inspector-connections");if(w)try{const k=JSON.parse(w).filter(N=>(N.id||N.url)!==_);localStorage.setItem("mcp-inspector-connections",JSON.stringify(k))}catch(T){console.error("Failed to update localStorage on remove:",T)}er.getInstance().capture(new owe({serverId:_}))},[t]),h=b.useCallback((_,S)=>{u(w=>w.map(T=>T.id===_||T.url===_?{...T,...S}:T)),n(w=>w.map(T=>T.id===_?{...T,...S}:T))},[]),v=b.useCallback(_=>{n(S=>{const w=S.findIndex(N=>N.id===_.id);if(w===-1)return S;const T=S[w];if(T.state===_.state&&T.tools===_.tools&&T.resources===_.resources&&T.prompts===_.prompts&&T.error===_.error&&T.serverInfo===_.serverInfo&&T.client===_.client&&T.notifications===_.notifications&&T.unreadNotificationCount===_.unreadNotificationCount)return S;const k=[...S];return k[w]=_,k})},[]),y=b.useCallback(_=>{console.log("Connect requested for:",_)},[]),E=b.useCallback(_=>{console.log("Disconnect requested for:",_)},[]),x=b.useMemo(()=>({connections:t,addConnection:d,removeConnection:p,updateConnectionConfig:h,autoConnect:i,setAutoConnect:s,connectServer:y,disconnectServer:E,configLoaded:r}),[t,d,p,h,i,y,E,r]);return m.jsxs(LY.Provider,{value:x,children:[e,r&&i&&c.map(_=>{const S=`${_.id||_.url}-${_.proxyConfig?.proxyAddress?"proxy":"direct"}`;return console.warn("[McpContext] Rendering McpConnectionWrapper with key:",S,"proxyConfig:",_.proxyConfig),m.jsx(uwe,{url:_.url,name:_.name,proxyConfig:_.proxyConfig,transportType:_.transportType,connectionId:_.id||_.url,onUpdate:v,onRemove:()=>p(_.id||_.url)},S)})]})}const fwe=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),pwe=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase()),RU=e=>{const t=pwe(e);return t.charAt(0).toUpperCase()+t.slice(1)},MY=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim(),mwe=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};var hwe={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const gwe=b.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:a="",children:i,iconNode:s,...c},u)=>b.createElement("svg",{ref:u,...hwe,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:MY("lucide",a),...!i&&!mwe(c)&&{"aria-hidden":"true"},...c},[...s.map(([d,p])=>b.createElement(d,p)),...Array.isArray(i)?i:[i]]));const it=(e,t)=>{const n=b.forwardRef(({className:r,...a},i)=>b.createElement(gwe,{ref:i,iconNode:t,className:MY(`lucide-${fwe(RU(e))}`,`lucide-${e}`,r),...a}));return n.displayName=RU(e),n};const vwe=[["path",{d:"M12 17V3",key:"1cwfxf"}],["path",{d:"m6 11 6 6 6-6",key:"12ii2o"}],["path",{d:"M19 21H5",key:"150jfl"}]],bwe=it("arrow-down-to-line",vwe);const ywe=[["path",{d:"m18 9-6-6-6 6",key:"kcunyi"}],["path",{d:"M12 3v14",key:"7cf3v8"}],["path",{d:"M5 21h14",key:"11awu3"}]],wwe=it("arrow-up-from-line",ywe);const Swe=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],Ewe=it("arrow-up",Swe);const _we=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]],QI=it("bell",_we);const xwe=[["path",{d:"m11 10 3 3",key:"fzmg1i"}],["path",{d:"M6.5 21A3.5 3.5 0 1 0 3 17.5a2.62 2.62 0 0 1-.708 1.792A1 1 0 0 0 3 21z",key:"p4q2r7"}],["path",{d:"M9.969 17.031 21.378 5.624a1 1 0 0 0-3.002-3.002L6.967 14.031",key:"wy6l02"}]],jY=it("brush",xwe);const Twe=[["path",{d:"M12 20v-9",key:"1qisl0"}],["path",{d:"M14 7a4 4 0 0 1 4 4v3a6 6 0 0 1-12 0v-3a4 4 0 0 1 4-4z",key:"uouzyp"}],["path",{d:"M14.12 3.88 16 2",key:"qol33r"}],["path",{d:"M21 21a4 4 0 0 0-3.81-4",key:"1b0z45"}],["path",{d:"M21 5a4 4 0 0 1-3.55 3.97",key:"5cxbf6"}],["path",{d:"M22 13h-4",key:"1jl80f"}],["path",{d:"M3 21a4 4 0 0 1 3.81-4",key:"1fjd4g"}],["path",{d:"M3 5a4 4 0 0 0 3.55 3.97",key:"1d7oge"}],["path",{d:"M6 13H2",key:"82j7cp"}],["path",{d:"m8 2 1.88 1.88",key:"fmnt4t"}],["path",{d:"M9 7.13V6a3 3 0 1 1 6 0v1.13",key:"1vgav8"}]],Rwe=it("bug",Twe);const Nwe=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Da=it("check",Nwe);const kwe=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Ol=it("chevron-down",kwe);const Cwe=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],e1=it("chevron-left",Cwe);const Awe=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Iwe=it("chevron-right",Awe);const Owe=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],Dwe=it("chevron-up",Owe);const $we=[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]],Lwe=it("chevrons-up-down",$we);const Mwe=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}]],NU=it("circle-minus",Mwe);const jwe=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Tu=it("clock",jwe);const Pwe=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],PY=it("code",Pwe);const Uwe=[["path",{d:"M11 10.27 7 3.34",key:"16pf9h"}],["path",{d:"m11 13.73-4 6.93",key:"794ttg"}],["path",{d:"M12 22v-2",key:"1osdcq"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M14 12h8",key:"4f43i9"}],["path",{d:"m17 20.66-1-1.73",key:"eq3orb"}],["path",{d:"m17 3.34-1 1.73",key:"2wel8s"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"m20.66 17-1.73-1",key:"sg0v6f"}],["path",{d:"m20.66 7-1.73 1",key:"1ow05n"}],["path",{d:"m3.34 17 1.73-1",key:"nuk764"}],["path",{d:"m3.34 7 1.73 1",key:"1ulond"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["circle",{cx:"12",cy:"12",r:"8",key:"46899m"}]],zwe=it("cog",Uwe);const Fwe=[["path",{d:"M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3",key:"11bfej"}]],Bwe=it("command",Fwe);const qwe=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],Br=it("copy",qwe);const Hwe=[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]],db=it("database",Hwe);const Vwe=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],t1=it("download",Vwe);const Gwe=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]],Wwe=it("ellipsis-vertical",Gwe);const Kwe=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],kU=it("external-link",Kwe);const Ywe=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],UY=it("eye-off",Ywe);const Zwe=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],ik=it("eye",Zwe);const Xwe=[["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z",key:"1mlx9k"}]],Jwe=it("file-code",Xwe);const Qwe=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["circle",{cx:"10",cy:"12",r:"2",key:"737tya"}],["path",{d:"m20 17-1.296-1.296a2.41 2.41 0 0 0-3.408 0L9 22",key:"wt3hpn"}]],eSe=it("file-image",Qwe);const tSe=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],n1=it("file-text",tSe);const nSe=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}]],rSe=it("file",nSe);const aSe=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],iSe=it("folder-open",aSe);const oSe=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],sSe=it("globe",oSe);const lSe=[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]],cSe=it("grip-vertical",lSe);const uSe=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]],tv=it("history",uSe);const dSe=[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]],zY=it("key",dSe);const fSe=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],vl=it("loader-circle",fSe);const pSe=[["path",{d:"M8 3H5a2 2 0 0 0-2 2v3",key:"1dcmit"}],["path",{d:"M21 8V5a2 2 0 0 0-2-2h-3",key:"1e4gt3"}],["path",{d:"M3 16v3a2 2 0 0 0 2 2h3",key:"wsl5sc"}],["path",{d:"M16 21h3a2 2 0 0 0 2-2v-3",key:"18trek"}]],r1=it("maximize",pSe);const mSe=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]],hSe=it("maximize-2",mSe);const gSe=[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}]],vSe=it("message-circle",gSe);const bSe=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]],Pf=it("message-square",bSe);const ySe=[["path",{d:"M8 3v3a2 2 0 0 1-2 2H3",key:"hohbtr"}],["path",{d:"M21 8h-3a2 2 0 0 1-2-2V3",key:"5jw1f3"}],["path",{d:"M3 16h3a2 2 0 0 1 2 2v3",key:"198tvr"}],["path",{d:"M16 21v-3a2 2 0 0 1 2-2h3",key:"ph8mxp"}]],wSe=it("minimize",ySe);const SSe=[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]],CU=it("monitor",SSe);const ESe=[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]],_Se=it("moon",ESe);const xSe=[["path",{d:"M2 10h6V4",key:"zwrco"}],["path",{d:"m2 4 6 6",key:"ug085t"}],["path",{d:"M21 10V7a2 2 0 0 0-2-2h-7",key:"git5jr"}],["path",{d:"M3 14v2a2 2 0 0 0 2 2h3",key:"1f7fh3"}],["rect",{x:"12",y:"14",width:"10",height:"7",rx:"1",key:"1wjs3o"}]],TSe=it("picture-in-picture",xSe);const RSe=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],FY=it("play",RSe);const NSe=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],BY=it("plus",NSe);const kSe=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],AU=it("rotate-ccw",kSe);const CSe=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]],a1=it("save",CSe);const ASe=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],fb=it("search",ASe);const ISe=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],OSe=it("send",ISe);const DSe=[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]],$Se=it("server",DSe);const LSe=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],Zc=it("settings",LSe);const MSe=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]],jSe=it("shield",MSe);const PSe=[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]],USe=it("square-pen",PSe);const zSe=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 4h.01",key:"1ujb9j"}],["path",{d:"M20 12h.01",key:"1ykeid"}],["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M4 12h.01",key:"158zrr"}],["path",{d:"M17.657 6.343h.01",key:"31pqzk"}],["path",{d:"M17.657 17.657h.01",key:"jehnf4"}],["path",{d:"M6.343 17.657h.01",key:"gdk6ow"}],["path",{d:"M6.343 6.343h.01",key:"1uurf0"}]],FSe=it("sun-dim",zSe);const BSe=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],MS=it("terminal",BSe);const qSe=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],bl=it("trash-2",qSe);const HSe=[["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],VSe=it("trash",HSe);const GSe=[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]],yl=it("wrench",GSe);const WSe=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],qu=it("x",WSe);const KSe=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],Uf=it("zap",KSe);function YSe(e){if(typeof document>"u")return;let t=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",t.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}const ZSe=e=>{switch(e){case"success":return QSe;case"info":return tEe;case"warning":return eEe;case"error":return nEe;default:return null}},XSe=Array(12).fill(0),JSe=({visible:e,className:t})=>se.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},se.createElement("div",{className:"sonner-spinner"},XSe.map((n,r)=>se.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${r}`})))),QSe=se.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},se.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),eEe=se.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},se.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),tEe=se.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},se.createElement("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 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),nEe=se.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},se.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),rEe=se.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},se.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),se.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),aEe=()=>{const[e,t]=se.useState(document.hidden);return se.useEffect(()=>{const n=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",n),()=>window.removeEventListener("visibilitychange",n)},[]),e};let ok=1;class iEe{constructor(){this.subscribe=t=>(this.subscribers.push(t),()=>{const n=this.subscribers.indexOf(t);this.subscribers.splice(n,1)}),this.publish=t=>{this.subscribers.forEach(n=>n(t))},this.addToast=t=>{this.publish(t),this.toasts=[...this.toasts,t]},this.create=t=>{var n;const{message:r,...a}=t,i=typeof t?.id=="number"||((n=t.id)==null?void 0:n.length)>0?t.id:ok++,s=this.toasts.find(u=>u.id===i),c=t.dismissible===void 0?!0:t.dismissible;return this.dismissedToasts.has(i)&&this.dismissedToasts.delete(i),s?this.toasts=this.toasts.map(u=>u.id===i?(this.publish({...u,...t,id:i,title:r}),{...u,...t,id:i,dismissible:c,title:r}):u):this.addToast({title:r,...a,dismissible:c,id:i}),i},this.dismiss=t=>(t?(this.dismissedToasts.add(t),requestAnimationFrame(()=>this.subscribers.forEach(n=>n({id:t,dismiss:!0})))):this.toasts.forEach(n=>{this.subscribers.forEach(r=>r({id:n.id,dismiss:!0}))}),t),this.message=(t,n)=>this.create({...n,message:t}),this.error=(t,n)=>this.create({...n,message:t,type:"error"}),this.success=(t,n)=>this.create({...n,type:"success",message:t}),this.info=(t,n)=>this.create({...n,type:"info",message:t}),this.warning=(t,n)=>this.create({...n,type:"warning",message:t}),this.loading=(t,n)=>this.create({...n,type:"loading",message:t}),this.promise=(t,n)=>{if(!n)return;let r;n.loading!==void 0&&(r=this.create({...n,promise:t,type:"loading",message:n.loading,description:typeof n.description!="function"?n.description:void 0}));const a=Promise.resolve(t instanceof Function?t():t);let i=r!==void 0,s;const c=a.then(async d=>{if(s=["resolve",d],se.isValidElement(d))i=!1,this.create({id:r,type:"default",message:d});else if(sEe(d)&&!d.ok){i=!1;const h=typeof n.error=="function"?await n.error(`HTTP error! status: ${d.status}`):n.error,v=typeof n.description=="function"?await n.description(`HTTP error! status: ${d.status}`):n.description,E=typeof h=="object"&&!se.isValidElement(h)?h:{message:h};this.create({id:r,type:"error",description:v,...E})}else if(d instanceof Error){i=!1;const h=typeof n.error=="function"?await n.error(d):n.error,v=typeof n.description=="function"?await n.description(d):n.description,E=typeof h=="object"&&!se.isValidElement(h)?h:{message:h};this.create({id:r,type:"error",description:v,...E})}else if(n.success!==void 0){i=!1;const h=typeof n.success=="function"?await n.success(d):n.success,v=typeof n.description=="function"?await n.description(d):n.description,E=typeof h=="object"&&!se.isValidElement(h)?h:{message:h};this.create({id:r,type:"success",description:v,...E})}}).catch(async d=>{if(s=["reject",d],n.error!==void 0){i=!1;const p=typeof n.error=="function"?await n.error(d):n.error,h=typeof n.description=="function"?await n.description(d):n.description,y=typeof p=="object"&&!se.isValidElement(p)?p:{message:p};this.create({id:r,type:"error",description:h,...y})}}).finally(()=>{i&&(this.dismiss(r),r=void 0),n.finally==null||n.finally.call(n)}),u=()=>new Promise((d,p)=>c.then(()=>s[0]==="reject"?p(s[1]):d(s[1])).catch(p));return typeof r!="string"&&typeof r!="number"?{unwrap:u}:Object.assign(r,{unwrap:u})},this.custom=(t,n)=>{const r=n?.id||ok++;return this.create({jsx:t(r),id:r,...n}),r},this.getActiveToasts=()=>this.toasts.filter(t=>!this.dismissedToasts.has(t.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}}const Ur=new iEe,oEe=(e,t)=>{const n=t?.id||ok++;return Ur.addToast({title:e,...t,id:n}),n},sEe=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",lEe=oEe,cEe=()=>Ur.toasts,uEe=()=>Ur.getActiveToasts(),sn=Object.assign(lEe,{success:Ur.success,info:Ur.info,warning:Ur.warning,error:Ur.error,custom:Ur.custom,message:Ur.message,promise:Ur.promise,dismiss:Ur.dismiss,loading:Ur.loading},{getHistory:cEe,getToasts:uEe});YSe("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");function Bh(e){return e.label!==void 0}const dEe=3,fEe="24px",pEe="16px",IU=4e3,mEe=356,hEe=14,gEe=45,vEe=200;function mi(...e){return e.filter(Boolean).join(" ")}function bEe(e){const[t,n]=e.split("-"),r=[];return t&&r.push(t),n&&r.push(n),r}const yEe=e=>{var t,n,r,a,i,s,c,u,d;const{invert:p,toast:h,unstyled:v,interacting:y,setHeights:E,visibleToasts:x,heights:_,index:S,toasts:w,expanded:T,removeToast:k,defaultRichColors:N,closeButton:A,style:C,cancelButtonStyle:O,actionButtonStyle:L,className:F="",descriptionClassName:z="",duration:K,position:ee,gap:J,expandByDefault:le,classNames:q,icons:Z,closeButtonAriaLabel:G="Close toast"}=e,[ie,te]=se.useState(null),[P,B]=se.useState(null),[j,$]=se.useState(!1),[U,H]=se.useState(!1),[W,X]=se.useState(!1),[de,ue]=se.useState(!1),[Y,Q]=se.useState(!1),[oe,ae]=se.useState(0),[Re,Ae]=se.useState(0),Ye=se.useRef(h.duration||K||IU),Ee=se.useRef(null),Ne=se.useRef(null),ze=S===0,he=S+1<=x,je=h.type,Ze=h.dismissible!==!1,Se=h.className||"",ot=h.descriptionClassName||"",ut=se.useMemo(()=>_.findIndex(ct=>ct.toastId===h.id)||0,[_,h.id]),tt=se.useMemo(()=>{var ct;return(ct=h.closeButton)!=null?ct:A},[h.closeButton,A]),Oe=se.useMemo(()=>h.duration||K||IU,[h.duration,K]),Me=se.useRef(0),dt=se.useRef(0),Bt=se.useRef(0),De=se.useRef(null),[ke,Fe]=ee.split("-"),vt=se.useMemo(()=>_.reduce((ct,Kt,an)=>an>=ut?ct:ct+Kt.height,0),[_,ut]),gt=aEe(),Lt=h.invert||p,qt=je==="loading";dt.current=se.useMemo(()=>ut*J+vt,[ut,vt]),se.useEffect(()=>{Ye.current=Oe},[Oe]),se.useEffect(()=>{$(!0)},[]),se.useEffect(()=>{const ct=Ne.current;if(ct){const Kt=ct.getBoundingClientRect().height;return Ae(Kt),E(an=>[{toastId:h.id,height:Kt,position:h.position},...an]),()=>E(an=>an.filter(Dn=>Dn.toastId!==h.id))}},[E,h.id]),se.useLayoutEffect(()=>{if(!j)return;const ct=Ne.current,Kt=ct.style.height;ct.style.height="auto";const an=ct.getBoundingClientRect().height;ct.style.height=Kt,Ae(an),E(Dn=>Dn.find(gn=>gn.toastId===h.id)?Dn.map(gn=>gn.toastId===h.id?{...gn,height:an}:gn):[{toastId:h.id,height:an,position:h.position},...Dn])},[j,h.title,h.description,E,h.id,h.jsx,h.action,h.cancel]);const Ct=se.useCallback(()=>{H(!0),ae(dt.current),E(ct=>ct.filter(Kt=>Kt.toastId!==h.id)),setTimeout(()=>{k(h)},vEe)},[h,k,E,dt]);se.useEffect(()=>{if(h.promise&&je==="loading"||h.duration===1/0||h.type==="loading")return;let ct;return T||y||gt?(()=>{if(Bt.current<Me.current){const Dn=new Date().getTime()-Me.current;Ye.current=Ye.current-Dn}Bt.current=new Date().getTime()})():(()=>{Ye.current!==1/0&&(Me.current=new Date().getTime(),ct=setTimeout(()=>{h.onAutoClose==null||h.onAutoClose.call(h,h),Ct()},Ye.current))})(),()=>clearTimeout(ct)},[T,y,h,je,gt,Ct]),se.useEffect(()=>{h.delete&&(Ct(),h.onDismiss==null||h.onDismiss.call(h,h))},[Ct,h.delete]);function Pt(){var ct;if(Z?.loading){var Kt;return se.createElement("div",{className:mi(q?.loader,h==null||(Kt=h.classNames)==null?void 0:Kt.loader,"sonner-loader"),"data-visible":je==="loading"},Z.loading)}return se.createElement(JSe,{className:mi(q?.loader,h==null||(ct=h.classNames)==null?void 0:ct.loader),visible:je==="loading"})}const pn=h.icon||Z?.[je]||ZSe(je);var Rn,en;return se.createElement("li",{tabIndex:0,ref:Ne,className:mi(F,Se,q?.toast,h==null||(t=h.classNames)==null?void 0:t.toast,q?.default,q?.[je],h==null||(n=h.classNames)==null?void 0:n[je]),"data-sonner-toast":"","data-rich-colors":(Rn=h.richColors)!=null?Rn:N,"data-styled":!(h.jsx||h.unstyled||v),"data-mounted":j,"data-promise":!!h.promise,"data-swiped":Y,"data-removed":U,"data-visible":he,"data-y-position":ke,"data-x-position":Fe,"data-index":S,"data-front":ze,"data-swiping":W,"data-dismissible":Ze,"data-type":je,"data-invert":Lt,"data-swipe-out":de,"data-swipe-direction":P,"data-expanded":!!(T||le&&j),"data-testid":h.testId,style:{"--index":S,"--toasts-before":S,"--z-index":w.length-S,"--offset":`${U?oe:dt.current}px`,"--initial-height":le?"auto":`${Re}px`,...C,...h.style},onDragEnd:()=>{X(!1),te(null),De.current=null},onPointerDown:ct=>{ct.button!==2&&(qt||!Ze||(Ee.current=new Date,ae(dt.current),ct.target.setPointerCapture(ct.pointerId),ct.target.tagName!=="BUTTON"&&(X(!0),De.current={x:ct.clientX,y:ct.clientY})))},onPointerUp:()=>{var ct,Kt,an;if(de||!Ze)return;De.current=null;const Dn=Number(((ct=Ne.current)==null?void 0:ct.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),li=Number(((Kt=Ne.current)==null?void 0:Kt.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),gn=new Date().getTime()-((an=Ee.current)==null?void 0:an.getTime()),ne=ie==="x"?Dn:li,pe=Math.abs(ne)/gn;if(Math.abs(ne)>=gEe||pe>.11){ae(dt.current),h.onDismiss==null||h.onDismiss.call(h,h),B(ie==="x"?Dn>0?"right":"left":li>0?"down":"up"),Ct(),ue(!0);return}else{var be,Ie;(be=Ne.current)==null||be.style.setProperty("--swipe-amount-x","0px"),(Ie=Ne.current)==null||Ie.style.setProperty("--swipe-amount-y","0px")}Q(!1),X(!1),te(null)},onPointerMove:ct=>{var Kt,an,Dn;if(!De.current||!Ze||((Kt=window.getSelection())==null?void 0:Kt.toString().length)>0)return;const gn=ct.clientY-De.current.y,ne=ct.clientX-De.current.x;var pe;const be=(pe=e.swipeDirections)!=null?pe:bEe(ee);!ie&&(Math.abs(ne)>1||Math.abs(gn)>1)&&te(Math.abs(ne)>Math.abs(gn)?"x":"y");let Ie={x:0,y:0};const Ue=Ve=>1/(1.5+Math.abs(Ve)/20);if(ie==="y"){if(be.includes("top")||be.includes("bottom"))if(be.includes("top")&&gn<0||be.includes("bottom")&&gn>0)Ie.y=gn;else{const Ve=gn*Ue(gn);Ie.y=Math.abs(Ve)<Math.abs(gn)?Ve:gn}}else if(ie==="x"&&(be.includes("left")||be.includes("right")))if(be.includes("left")&&ne<0||be.includes("right")&&ne>0)Ie.x=ne;else{const Ve=ne*Ue(ne);Ie.x=Math.abs(Ve)<Math.abs(ne)?Ve:ne}(Math.abs(Ie.x)>0||Math.abs(Ie.y)>0)&&Q(!0),(an=Ne.current)==null||an.style.setProperty("--swipe-amount-x",`${Ie.x}px`),(Dn=Ne.current)==null||Dn.style.setProperty("--swipe-amount-y",`${Ie.y}px`)}},tt&&!h.jsx&&je!=="loading"?se.createElement("button",{"aria-label":G,"data-disabled":qt,"data-close-button":!0,onClick:qt||!Ze?()=>{}:()=>{Ct(),h.onDismiss==null||h.onDismiss.call(h,h)},className:mi(q?.closeButton,h==null||(r=h.classNames)==null?void 0:r.closeButton)},(en=Z?.close)!=null?en:rEe):null,(je||h.icon||h.promise)&&h.icon!==null&&(Z?.[je]!==null||h.icon)?se.createElement("div",{"data-icon":"",className:mi(q?.icon,h==null||(a=h.classNames)==null?void 0:a.icon)},h.promise||h.type==="loading"&&!h.icon?h.icon||Pt():null,h.type!=="loading"?pn:null):null,se.createElement("div",{"data-content":"",className:mi(q?.content,h==null||(i=h.classNames)==null?void 0:i.content)},se.createElement("div",{"data-title":"",className:mi(q?.title,h==null||(s=h.classNames)==null?void 0:s.title)},h.jsx?h.jsx:typeof h.title=="function"?h.title():h.title),h.description?se.createElement("div",{"data-description":"",className:mi(z,ot,q?.description,h==null||(c=h.classNames)==null?void 0:c.description)},typeof h.description=="function"?h.description():h.description):null),se.isValidElement(h.cancel)?h.cancel:h.cancel&&Bh(h.cancel)?se.createElement("button",{"data-button":!0,"data-cancel":!0,style:h.cancelButtonStyle||O,onClick:ct=>{Bh(h.cancel)&&Ze&&(h.cancel.onClick==null||h.cancel.onClick.call(h.cancel,ct),Ct())},className:mi(q?.cancelButton,h==null||(u=h.classNames)==null?void 0:u.cancelButton)},h.cancel.label):null,se.isValidElement(h.action)?h.action:h.action&&Bh(h.action)?se.createElement("button",{"data-button":!0,"data-action":!0,style:h.actionButtonStyle||L,onClick:ct=>{Bh(h.action)&&(h.action.onClick==null||h.action.onClick.call(h.action,ct),!ct.defaultPrevented&&Ct())},className:mi(q?.actionButton,h==null||(d=h.classNames)==null?void 0:d.actionButton)},h.action.label):null)};function OU(){if(typeof window>"u"||typeof document>"u")return"ltr";const e=document.documentElement.getAttribute("dir");return e==="auto"||!e?window.getComputedStyle(document.documentElement).direction:e}function wEe(e,t){const n={};return[e,t].forEach((r,a)=>{const i=a===1,s=i?"--mobile-offset":"--offset",c=i?pEe:fEe;function u(d){["top","right","bottom","left"].forEach(p=>{n[`${s}-${p}`]=typeof d=="number"?`${d}px`:d})}typeof r=="number"||typeof r=="string"?u(r):typeof r=="object"?["top","right","bottom","left"].forEach(d=>{r[d]===void 0?n[`${s}-${d}`]=c:n[`${s}-${d}`]=typeof r[d]=="number"?`${r[d]}px`:r[d]}):u(c)}),n}const SEe=se.forwardRef(function(t,n){const{id:r,invert:a,position:i="bottom-right",hotkey:s=["altKey","KeyT"],expand:c,closeButton:u,className:d,offset:p,mobileOffset:h,theme:v="light",richColors:y,duration:E,style:x,visibleToasts:_=dEe,toastOptions:S,dir:w=OU(),gap:T=hEe,icons:k,containerAriaLabel:N="Notifications"}=t,[A,C]=se.useState([]),O=se.useMemo(()=>r?A.filter(j=>j.toasterId===r):A.filter(j=>!j.toasterId),[A,r]),L=se.useMemo(()=>Array.from(new Set([i].concat(O.filter(j=>j.position).map(j=>j.position)))),[O,i]),[F,z]=se.useState([]),[K,ee]=se.useState(!1),[J,le]=se.useState(!1),[q,Z]=se.useState(v!=="system"?v:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),G=se.useRef(null),ie=s.join("+").replace(/Key/g,"").replace(/Digit/g,""),te=se.useRef(null),P=se.useRef(!1),B=se.useCallback(j=>{C($=>{var U;return(U=$.find(H=>H.id===j.id))!=null&&U.delete||Ur.dismiss(j.id),$.filter(({id:H})=>H!==j.id)})},[]);return se.useEffect(()=>Ur.subscribe(j=>{if(j.dismiss){requestAnimationFrame(()=>{C($=>$.map(U=>U.id===j.id?{...U,delete:!0}:U))});return}setTimeout(()=>{_7.flushSync(()=>{C($=>{const U=$.findIndex(H=>H.id===j.id);return U!==-1?[...$.slice(0,U),{...$[U],...j},...$.slice(U+1)]:[j,...$]})})})}),[A]),se.useEffect(()=>{if(v!=="system"){Z(v);return}if(v==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?Z("dark"):Z("light")),typeof window>"u")return;const j=window.matchMedia("(prefers-color-scheme: dark)");try{j.addEventListener("change",({matches:$})=>{Z($?"dark":"light")})}catch{j.addListener(({matches:U})=>{try{Z(U?"dark":"light")}catch(H){console.error(H)}})}},[v]),se.useEffect(()=>{A.length<=1&&ee(!1)},[A]),se.useEffect(()=>{const j=$=>{var U;if(s.every(X=>$[X]||$.code===X)){var W;ee(!0),(W=G.current)==null||W.focus()}$.code==="Escape"&&(document.activeElement===G.current||(U=G.current)!=null&&U.contains(document.activeElement))&&ee(!1)};return document.addEventListener("keydown",j),()=>document.removeEventListener("keydown",j)},[s]),se.useEffect(()=>{if(G.current)return()=>{te.current&&(te.current.focus({preventScroll:!0}),te.current=null,P.current=!1)}},[G.current]),se.createElement("section",{ref:n,"aria-label":`${N} ${ie}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},L.map((j,$)=>{var U;const[H,W]=j.split("-");return O.length?se.createElement("ol",{key:j,dir:w==="auto"?OU():w,tabIndex:-1,ref:G,className:d,"data-sonner-toaster":!0,"data-sonner-theme":q,"data-y-position":H,"data-x-position":W,style:{"--front-toast-height":`${((U=F[0])==null?void 0:U.height)||0}px`,"--width":`${mEe}px`,"--gap":`${T}px`,...x,...wEe(p,h)},onBlur:X=>{P.current&&!X.currentTarget.contains(X.relatedTarget)&&(P.current=!1,te.current&&(te.current.focus({preventScroll:!0}),te.current=null))},onFocus:X=>{X.target instanceof HTMLElement&&X.target.dataset.dismissible==="false"||P.current||(P.current=!0,te.current=X.relatedTarget)},onMouseEnter:()=>ee(!0),onMouseMove:()=>ee(!0),onMouseLeave:()=>{J||ee(!1)},onDragEnd:()=>ee(!1),onPointerDown:X=>{X.target instanceof HTMLElement&&X.target.dataset.dismissible==="false"||le(!0)},onPointerUp:()=>le(!1)},O.filter(X=>!X.position&&$===0||X.position===j).map((X,de)=>{var ue,Y;return se.createElement(yEe,{key:X.id,icons:k,index:de,toast:X,defaultRichColors:y,duration:(ue=S?.duration)!=null?ue:E,className:S?.className,descriptionClassName:S?.descriptionClassName,invert:a,visibleToasts:_,closeButton:(Y=S?.closeButton)!=null?Y:u,interacting:J,position:j,style:S?.style,unstyled:S?.unstyled,classNames:S?.classNames,cancelButtonStyle:S?.cancelButtonStyle,actionButtonStyle:S?.actionButtonStyle,closeButtonAriaLabel:S?.closeButtonAriaLabel,removeToast:B,toasts:O.filter(Q=>Q.position==X.position),heights:F.filter(Q=>Q.position==X.position),setHeights:z,expandByDefault:c,gap:T,expanded:K,swipeDirections:t.swipeDirections})})):null}))});var pb="Dialog",[qY]=oi(pb),[EEe,si]=qY(pb),HY=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:a,onOpenChange:i,modal:s=!0}=e,c=b.useRef(null),u=b.useRef(null),[d,p]=fo({prop:r,defaultProp:a??!1,onChange:i,caller:pb});return m.jsx(EEe,{scope:t,triggerRef:c,contentRef:u,contentId:fr(),titleId:fr(),descriptionId:fr(),open:d,onOpenChange:p,onOpenToggle:b.useCallback(()=>p(h=>!h),[p]),modal:s,children:n})};HY.displayName=pb;var VY="DialogTrigger",GY=b.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,a=si(VY,n),i=Ft(t,a.triggerRef);return m.jsx(Et.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.contentId,"data-state":s1(a.open),...r,ref:i,onClick:He(e.onClick,a.onOpenToggle)})});GY.displayName=VY;var i1="DialogPortal",[_Ee,WY]=qY(i1,{forceMount:void 0}),KY=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:a}=e,i=si(i1,t);return m.jsx(_Ee,{scope:t,forceMount:n,children:b.Children.map(r,s=>m.jsx(ua,{present:n||i.open,children:m.jsx(Bu,{asChild:!0,container:a,children:s})}))})};KY.displayName=i1;var nv="DialogOverlay",YY=b.forwardRef((e,t)=>{const n=WY(nv,e.__scopeDialog),{forceMount:r=n.forceMount,...a}=e,i=si(nv,e.__scopeDialog);return i.modal?m.jsx(ua,{present:r||i.open,children:m.jsx(TEe,{...a,ref:t})}):null});YY.displayName=nv;var xEe=hl("DialogOverlay.RemoveScroll"),TEe=b.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,a=si(nv,n);return m.jsx(vp,{as:xEe,allowPinchZoom:!0,shards:[a.contentRef],children:m.jsx(Et.div,{"data-state":s1(a.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),wl="DialogContent",ZY=b.forwardRef((e,t)=>{const n=WY(wl,e.__scopeDialog),{forceMount:r=n.forceMount,...a}=e,i=si(wl,e.__scopeDialog);return m.jsx(ua,{present:r||i.open,children:i.modal?m.jsx(REe,{...a,ref:t}):m.jsx(NEe,{...a,ref:t})})});ZY.displayName=wl;var REe=b.forwardRef((e,t)=>{const n=si(wl,e.__scopeDialog),r=b.useRef(null),a=Ft(t,n.contentRef,r);return b.useEffect(()=>{const i=r.current;if(i)return tb(i)},[]),m.jsx(XY,{...e,ref:a,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:He(e.onCloseAutoFocus,i=>{i.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:He(e.onPointerDownOutside,i=>{const s=i.detail.originalEvent,c=s.button===0&&s.ctrlKey===!0;(s.button===2||c)&&i.preventDefault()}),onFocusOutside:He(e.onFocusOutside,i=>i.preventDefault())})}),NEe=b.forwardRef((e,t)=>{const n=si(wl,e.__scopeDialog),r=b.useRef(!1),a=b.useRef(!1);return m.jsx(XY,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{e.onCloseAutoFocus?.(i),i.defaultPrevented||(r.current||n.triggerRef.current?.focus(),i.preventDefault()),r.current=!1,a.current=!1},onInteractOutside:i=>{e.onInteractOutside?.(i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(a.current=!0));const s=i.target;n.triggerRef.current?.contains(s)&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&a.current&&i.preventDefault()}})}),XY=b.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:a,onCloseAutoFocus:i,...s}=e,c=si(wl,n),u=b.useRef(null),d=Ft(t,u);return Wv(),m.jsxs(m.Fragment,{children:[m.jsx(pp,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:a,onUnmountAutoFocus:i,children:m.jsx(Uu,{role:"dialog",id:c.contentId,"aria-describedby":c.descriptionId,"aria-labelledby":c.titleId,"data-state":s1(c.open),...s,ref:d,onDismiss:()=>c.onOpenChange(!1)})}),m.jsxs(m.Fragment,{children:[m.jsx(kEe,{titleId:c.titleId}),m.jsx(AEe,{contentRef:u,descriptionId:c.descriptionId})]})]})}),o1="DialogTitle",JY=b.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,a=si(o1,n);return m.jsx(Et.h2,{id:a.titleId,...r,ref:t})});JY.displayName=o1;var QY="DialogDescription",eZ=b.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,a=si(QY,n);return m.jsx(Et.p,{id:a.descriptionId,...r,ref:t})});eZ.displayName=QY;var tZ="DialogClose",nZ=b.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,a=si(tZ,n);return m.jsx(Et.button,{type:"button",...r,ref:t,onClick:He(e.onClick,()=>a.onOpenChange(!1))})});nZ.displayName=tZ;function s1(e){return e?"open":"closed"}var rZ="DialogTitleWarning",[hUe,aZ]=yhe(rZ,{contentName:wl,titleName:o1,docsSlug:"dialog"}),kEe=({titleId:e})=>{const t=aZ(rZ),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
|
|
133
|
+
`)},cbe=0,bc=[];function ube(e){var t=b.useRef([]),n=b.useRef([0,0]),r=b.useRef(),a=b.useState(cbe++)[0],i=b.useState(xK)[0],s=b.useRef(e);b.useEffect(function(){s.current=e},[e]),b.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(a));var x=Ive([e.lockRef.current],(e.shards||[]).map(yU),!0).filter(Boolean);return x.forEach(function(_){return _.classList.add("allow-interactivity-".concat(a))}),function(){document.body.classList.remove("block-interactivity-".concat(a)),x.forEach(function(_){return _.classList.remove("allow-interactivity-".concat(a))})}}},[e.inert,e.lockRef.current,e.shards]);var c=b.useCallback(function(x,_){if("touches"in x&&x.touches.length===2||x.type==="wheel"&&x.ctrlKey)return!s.current.allowPinchZoom;var S=Fh(x),w=n.current,T="deltaX"in x?x.deltaX:w[0]-S[0],k="deltaY"in x?x.deltaY:w[1]-S[1],N,A=x.target,C=Math.abs(T)>Math.abs(k)?"h":"v";if("touches"in x&&C==="h"&&A.type==="range")return!1;var O=vU(C,A);if(!O)return!0;if(O?N=C:(N=C==="v"?"h":"v",O=vU(C,A)),!O)return!1;if(!r.current&&"changedTouches"in x&&(T||k)&&(r.current=N),!N)return!0;var L=r.current||N;return obe(L,_,x,L==="h"?T:k)},[]),u=b.useCallback(function(x){var _=x;if(!(!bc.length||bc[bc.length-1]!==i)){var S="deltaY"in _?bU(_):Fh(_),w=t.current.filter(function(N){return N.name===_.type&&(N.target===_.target||_.target===N.shadowParent)&&sbe(N.delta,S)})[0];if(w&&w.should){_.cancelable&&_.preventDefault();return}if(!w){var T=(s.current.shards||[]).map(yU).filter(Boolean).filter(function(N){return N.contains(_.target)}),k=T.length>0?c(_,T[0]):!s.current.noIsolation;k&&_.cancelable&&_.preventDefault()}}},[]),d=b.useCallback(function(x,_,S,w){var T={name:x,delta:_,target:S,should:w,shadowParent:dbe(S)};t.current.push(T),setTimeout(function(){t.current=t.current.filter(function(k){return k!==T})},1)},[]),p=b.useCallback(function(x){n.current=Fh(x),r.current=void 0},[]),h=b.useCallback(function(x){d(x.type,bU(x),x.target,c(x,e.lockRef.current))},[]),v=b.useCallback(function(x){d(x.type,Fh(x),x.target,c(x,e.lockRef.current))},[]);b.useEffect(function(){return bc.push(i),e.setCallbacks({onScrollCapture:h,onWheelCapture:h,onTouchMoveCapture:v}),document.addEventListener("wheel",u,vc),document.addEventListener("touchmove",u,vc),document.addEventListener("touchstart",p,vc),function(){bc=bc.filter(function(x){return x!==i}),document.removeEventListener("wheel",u,vc),document.removeEventListener("touchmove",u,vc),document.removeEventListener("touchstart",p,vc)}},[]);var y=e.removeScrollBar,E=e.inert;return b.createElement(b.Fragment,null,E?b.createElement(i,{styles:lbe(a)}):null,y?b.createElement(Qve,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function dbe(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const fbe=zve(_K,ube);var vp=b.forwardRef(function(e,t){return b.createElement(nb,gi({},e,{ref:t,sideCar:fbe}))});vp.classNames=nb.classNames;var QN=["Enter"," "],pbe=["ArrowDown","PageUp","Home"],kK=["ArrowUp","PageDown","End"],mbe=[...pbe,...kK],hbe={ltr:[...QN,"ArrowRight"],rtl:[...QN,"ArrowLeft"]},gbe={ltr:["ArrowLeft"],rtl:["ArrowRight"]},bp="Menu",[Lf,vbe,bbe]=II(bp),[Al,CK]=oi(bp,[bbe,bs,hK]),rb=bs(),AK=hK(),[ybe,Il]=Al(bp),[wbe,yp]=Al(bp),IK=e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:a,onOpenChange:i,modal:s=!0}=e,c=rb(t),[u,d]=b.useState(null),p=b.useRef(!1),h=Ti(i),v=OI(a);return b.useEffect(()=>{const y=()=>{p.current=!0,document.addEventListener("pointerdown",E,{capture:!0,once:!0}),document.addEventListener("pointermove",E,{capture:!0,once:!0})},E=()=>p.current=!1;return document.addEventListener("keydown",y,{capture:!0}),()=>{document.removeEventListener("keydown",y,{capture:!0}),document.removeEventListener("pointerdown",E,{capture:!0}),document.removeEventListener("pointermove",E,{capture:!0})}},[]),m.jsx(Jv,{...c,children:m.jsx(ybe,{scope:t,open:n,onOpenChange:h,content:u,onContentChange:d,children:m.jsx(wbe,{scope:t,onClose:b.useCallback(()=>h(!1),[h]),isUsingKeyboardRef:p,dir:v,modal:s,children:r})})})};IK.displayName=bp;var Sbe="MenuAnchor",BI=b.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,a=rb(n);return m.jsx(hp,{...a,...r,ref:t})});BI.displayName=Sbe;var qI="MenuPortal",[Ebe,OK]=Al(qI,{forceMount:void 0}),DK=e=>{const{__scopeMenu:t,forceMount:n,children:r,container:a}=e,i=Il(qI,t);return m.jsx(Ebe,{scope:t,forceMount:n,children:m.jsx(ua,{present:n||i.open,children:m.jsx(Bu,{asChild:!0,container:a,children:r})})})};DK.displayName=qI;var Ia="MenuContent",[_be,HI]=Al(Ia),$K=b.forwardRef((e,t)=>{const n=OK(Ia,e.__scopeMenu),{forceMount:r=n.forceMount,...a}=e,i=Il(Ia,e.__scopeMenu),s=yp(Ia,e.__scopeMenu);return m.jsx(Lf.Provider,{scope:e.__scopeMenu,children:m.jsx(ua,{present:r||i.open,children:m.jsx(Lf.Slot,{scope:e.__scopeMenu,children:s.modal?m.jsx(xbe,{...a,ref:t}):m.jsx(Tbe,{...a,ref:t})})})})}),xbe=b.forwardRef((e,t)=>{const n=Il(Ia,e.__scopeMenu),r=b.useRef(null),a=Ft(t,r);return b.useEffect(()=>{const i=r.current;if(i)return tb(i)},[]),m.jsx(VI,{...e,ref:a,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:He(e.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),Tbe=b.forwardRef((e,t)=>{const n=Il(Ia,e.__scopeMenu);return m.jsx(VI,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),Rbe=hl("MenuContent.ScrollLock"),VI=b.forwardRef((e,t)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:a,onOpenAutoFocus:i,onCloseAutoFocus:s,disableOutsidePointerEvents:c,onEntryFocus:u,onEscapeKeyDown:d,onPointerDownOutside:p,onFocusOutside:h,onInteractOutside:v,onDismiss:y,disableOutsideScroll:E,...x}=e,_=Il(Ia,n),S=yp(Ia,n),w=rb(n),T=AK(n),k=vbe(n),[N,A]=b.useState(null),C=b.useRef(null),O=Ft(t,C,_.onContentChange),L=b.useRef(0),F=b.useRef(""),z=b.useRef(0),K=b.useRef(null),ee=b.useRef("right"),J=b.useRef(0),le=E?vp:b.Fragment,q=E?{as:Rbe,allowPinchZoom:!0}:void 0,Z=ie=>{const te=F.current+ie,P=k().filter(W=>!W.disabled),B=document.activeElement,j=P.find(W=>W.ref.current===B)?.textValue,$=P.map(W=>W.textValue),U=Pbe($,te,j),H=P.find(W=>W.textValue===U)?.ref.current;(function W(X){F.current=X,window.clearTimeout(L.current),X!==""&&(L.current=window.setTimeout(()=>W(""),1e3))})(te),H&&setTimeout(()=>H.focus())};b.useEffect(()=>()=>window.clearTimeout(L.current),[]),Wv();const G=b.useCallback(ie=>ee.current===K.current?.side&&zbe(ie,K.current?.area),[]);return m.jsx(_be,{scope:n,searchRef:F,onItemEnter:b.useCallback(ie=>{G(ie)&&ie.preventDefault()},[G]),onItemLeave:b.useCallback(ie=>{G(ie)||(C.current?.focus(),A(null))},[G]),onTriggerLeave:b.useCallback(ie=>{G(ie)&&ie.preventDefault()},[G]),pointerGraceTimerRef:z,onPointerGraceIntentChange:b.useCallback(ie=>{K.current=ie},[]),children:m.jsx(le,{...q,children:m.jsx(pp,{asChild:!0,trapped:a,onMountAutoFocus:He(i,ie=>{ie.preventDefault(),C.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:s,children:m.jsx(Uu,{asChild:!0,disableOutsidePointerEvents:c,onEscapeKeyDown:d,onPointerDownOutside:p,onFocusOutside:h,onInteractOutside:v,onDismiss:y,children:m.jsx(Rve,{asChild:!0,...T,dir:S.dir,orientation:"vertical",loop:r,currentTabStopId:N,onCurrentTabStopIdChange:A,onEntryFocus:He(u,ie=>{S.isUsingKeyboardRef.current||ie.preventDefault()}),preventScrollOnEntryFocus:!0,children:m.jsx(Qv,{role:"menu","aria-orientation":"vertical","data-state":ZK(_.open),"data-radix-menu-content":"",dir:S.dir,...w,...x,ref:O,style:{outline:"none",...x.style},onKeyDown:He(x.onKeyDown,ie=>{const P=ie.target.closest("[data-radix-menu-content]")===ie.currentTarget,B=ie.ctrlKey||ie.altKey||ie.metaKey,j=ie.key.length===1;P&&(ie.key==="Tab"&&ie.preventDefault(),!B&&j&&Z(ie.key));const $=C.current;if(ie.target!==$||!mbe.includes(ie.key))return;ie.preventDefault();const H=k().filter(W=>!W.disabled).map(W=>W.ref.current);kK.includes(ie.key)&&H.reverse(),Mbe(H)}),onBlur:He(e.onBlur,ie=>{ie.currentTarget.contains(ie.target)||(window.clearTimeout(L.current),F.current="")}),onPointerMove:He(e.onPointerMove,Mf(ie=>{const te=ie.target,P=J.current!==ie.clientX;if(ie.currentTarget.contains(te)&&P){const B=ie.clientX>J.current?"right":"left";ee.current=B,J.current=ie.clientX}}))})})})})})})});$K.displayName=Ia;var Nbe="MenuGroup",GI=b.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return m.jsx(Et.div,{role:"group",...r,ref:t})});GI.displayName=Nbe;var kbe="MenuLabel",LK=b.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return m.jsx(Et.div,{...r,ref:t})});LK.displayName=kbe;var Jg="MenuItem",wU="menu.itemSelect",ab=b.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:r,...a}=e,i=b.useRef(null),s=yp(Jg,e.__scopeMenu),c=HI(Jg,e.__scopeMenu),u=Ft(t,i),d=b.useRef(!1),p=()=>{const h=i.current;if(!n&&h){const v=new CustomEvent(wU,{bubbles:!0,cancelable:!0});h.addEventListener(wU,y=>r?.(y),{once:!0}),q7(h,v),v.defaultPrevented?d.current=!1:s.onClose()}};return m.jsx(MK,{...a,ref:u,disabled:n,onClick:He(e.onClick,p),onPointerDown:h=>{e.onPointerDown?.(h),d.current=!0},onPointerUp:He(e.onPointerUp,h=>{d.current||h.currentTarget?.click()}),onKeyDown:He(e.onKeyDown,h=>{const v=c.searchRef.current!=="";n||v&&h.key===" "||QN.includes(h.key)&&(h.currentTarget.click(),h.preventDefault())})})});ab.displayName=Jg;var MK=b.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:r=!1,textValue:a,...i}=e,s=HI(Jg,n),c=AK(n),u=b.useRef(null),d=Ft(t,u),[p,h]=b.useState(!1),[v,y]=b.useState("");return b.useEffect(()=>{const E=u.current;E&&y((E.textContent??"").trim())},[i.children]),m.jsx(Lf.ItemSlot,{scope:n,disabled:r,textValue:a??v,children:m.jsx(Nve,{asChild:!0,...c,focusable:!r,children:m.jsx(Et.div,{role:"menuitem","data-highlighted":p?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...i,ref:d,onPointerMove:He(e.onPointerMove,Mf(E=>{r?s.onItemLeave(E):(s.onItemEnter(E),E.defaultPrevented||E.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:He(e.onPointerLeave,Mf(E=>s.onItemLeave(E))),onFocus:He(e.onFocus,()=>h(!0)),onBlur:He(e.onBlur,()=>h(!1))})})})}),Cbe="MenuCheckboxItem",jK=b.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:r,...a}=e;return m.jsx(BK,{scope:e.__scopeMenu,checked:n,children:m.jsx(ab,{role:"menuitemcheckbox","aria-checked":Qg(n)?"mixed":n,...a,ref:t,"data-state":KI(n),onSelect:He(a.onSelect,()=>r?.(Qg(n)?!0:!n),{checkForDefaultPrevented:!1})})})});jK.displayName=Cbe;var PK="MenuRadioGroup",[Abe,Ibe]=Al(PK,{value:void 0,onValueChange:()=>{}}),UK=b.forwardRef((e,t)=>{const{value:n,onValueChange:r,...a}=e,i=Ti(r);return m.jsx(Abe,{scope:e.__scopeMenu,value:n,onValueChange:i,children:m.jsx(GI,{...a,ref:t})})});UK.displayName=PK;var zK="MenuRadioItem",FK=b.forwardRef((e,t)=>{const{value:n,...r}=e,a=Ibe(zK,e.__scopeMenu),i=n===a.value;return m.jsx(BK,{scope:e.__scopeMenu,checked:i,children:m.jsx(ab,{role:"menuitemradio","aria-checked":i,...r,ref:t,"data-state":KI(i),onSelect:He(r.onSelect,()=>a.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});FK.displayName=zK;var WI="MenuItemIndicator",[BK,Obe]=Al(WI,{checked:!1}),qK=b.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:r,...a}=e,i=Obe(WI,n);return m.jsx(ua,{present:r||Qg(i.checked)||i.checked===!0,children:m.jsx(Et.span,{...a,ref:t,"data-state":KI(i.checked)})})});qK.displayName=WI;var Dbe="MenuSeparator",HK=b.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return m.jsx(Et.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})});HK.displayName=Dbe;var $be="MenuArrow",VK=b.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,a=rb(n);return m.jsx(eb,{...a,...r,ref:t})});VK.displayName=$be;var Lbe="MenuSub",[mUe,GK]=Al(Lbe),ef="MenuSubTrigger",WK=b.forwardRef((e,t)=>{const n=Il(ef,e.__scopeMenu),r=yp(ef,e.__scopeMenu),a=GK(ef,e.__scopeMenu),i=HI(ef,e.__scopeMenu),s=b.useRef(null),{pointerGraceTimerRef:c,onPointerGraceIntentChange:u}=i,d={__scopeMenu:e.__scopeMenu},p=b.useCallback(()=>{s.current&&window.clearTimeout(s.current),s.current=null},[]);return b.useEffect(()=>p,[p]),b.useEffect(()=>{const h=c.current;return()=>{window.clearTimeout(h),u(null)}},[c,u]),m.jsx(BI,{asChild:!0,...d,children:m.jsx(MK,{id:a.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":a.contentId,"data-state":ZK(n.open),...e,ref:xi(t,a.onTriggerChange),onClick:h=>{e.onClick?.(h),!(e.disabled||h.defaultPrevented)&&(h.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:He(e.onPointerMove,Mf(h=>{i.onItemEnter(h),!h.defaultPrevented&&!e.disabled&&!n.open&&!s.current&&(i.onPointerGraceIntentChange(null),s.current=window.setTimeout(()=>{n.onOpenChange(!0),p()},100))})),onPointerLeave:He(e.onPointerLeave,Mf(h=>{p();const v=n.content?.getBoundingClientRect();if(v){const y=n.content?.dataset.side,E=y==="right",x=E?-5:5,_=v[E?"left":"right"],S=v[E?"right":"left"];i.onPointerGraceIntentChange({area:[{x:h.clientX+x,y:h.clientY},{x:_,y:v.top},{x:S,y:v.top},{x:S,y:v.bottom},{x:_,y:v.bottom}],side:y}),window.clearTimeout(c.current),c.current=window.setTimeout(()=>i.onPointerGraceIntentChange(null),300)}else{if(i.onTriggerLeave(h),h.defaultPrevented)return;i.onPointerGraceIntentChange(null)}})),onKeyDown:He(e.onKeyDown,h=>{const v=i.searchRef.current!=="";e.disabled||v&&h.key===" "||hbe[r.dir].includes(h.key)&&(n.onOpenChange(!0),n.content?.focus(),h.preventDefault())})})})});WK.displayName=ef;var KK="MenuSubContent",YK=b.forwardRef((e,t)=>{const n=OK(Ia,e.__scopeMenu),{forceMount:r=n.forceMount,...a}=e,i=Il(Ia,e.__scopeMenu),s=yp(Ia,e.__scopeMenu),c=GK(KK,e.__scopeMenu),u=b.useRef(null),d=Ft(t,u);return m.jsx(Lf.Provider,{scope:e.__scopeMenu,children:m.jsx(ua,{present:r||i.open,children:m.jsx(Lf.Slot,{scope:e.__scopeMenu,children:m.jsx(VI,{id:c.contentId,"aria-labelledby":c.triggerId,...a,ref:d,align:"start",side:s.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:p=>{s.isUsingKeyboardRef.current&&u.current?.focus(),p.preventDefault()},onCloseAutoFocus:p=>p.preventDefault(),onFocusOutside:He(e.onFocusOutside,p=>{p.target!==c.trigger&&i.onOpenChange(!1)}),onEscapeKeyDown:He(e.onEscapeKeyDown,p=>{s.onClose(),p.preventDefault()}),onKeyDown:He(e.onKeyDown,p=>{const h=p.currentTarget.contains(p.target),v=gbe[s.dir].includes(p.key);h&&v&&(i.onOpenChange(!1),c.trigger?.focus(),p.preventDefault())})})})})})});YK.displayName=KK;function ZK(e){return e?"open":"closed"}function Qg(e){return e==="indeterminate"}function KI(e){return Qg(e)?"indeterminate":e?"checked":"unchecked"}function Mbe(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function jbe(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function Pbe(e,t,n){const a=t.length>1&&Array.from(t).every(d=>d===t[0])?t[0]:t,i=n?e.indexOf(n):-1;let s=jbe(e,Math.max(i,0));a.length===1&&(s=s.filter(d=>d!==n));const u=s.find(d=>d.toLowerCase().startsWith(a.toLowerCase()));return u!==n?u:void 0}function Ube(e,t){const{x:n,y:r}=e;let a=!1;for(let i=0,s=t.length-1;i<t.length;s=i++){const c=t[i],u=t[s],d=c.x,p=c.y,h=u.x,v=u.y;p>r!=v>r&&n<(h-d)*(r-p)/(v-p)+d&&(a=!a)}return a}function zbe(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return Ube(n,t)}function Mf(e){return t=>t.pointerType==="mouse"?e(t):void 0}var Fbe=IK,Bbe=BI,qbe=DK,Hbe=$K,Vbe=GI,Gbe=LK,Wbe=ab,Kbe=jK,Ybe=UK,Zbe=FK,Xbe=qK,Jbe=HK,Qbe=VK,eye=WK,tye=YK,ib="DropdownMenu",[nye]=oi(ib,[CK]),Cr=CK(),[rye,XK]=nye(ib),JK=e=>{const{__scopeDropdownMenu:t,children:n,dir:r,open:a,defaultOpen:i,onOpenChange:s,modal:c=!0}=e,u=Cr(t),d=b.useRef(null),[p,h]=fo({prop:a,defaultProp:i??!1,onChange:s,caller:ib});return m.jsx(rye,{scope:t,triggerId:fr(),triggerRef:d,contentId:fr(),open:p,onOpenChange:h,onOpenToggle:b.useCallback(()=>h(v=>!v),[h]),modal:c,children:m.jsx(Fbe,{...u,open:p,onOpenChange:h,dir:r,modal:c,children:n})})};JK.displayName=ib;var QK="DropdownMenuTrigger",eY=b.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...a}=e,i=XK(QK,n),s=Cr(n);return m.jsx(Bbe,{asChild:!0,...s,children:m.jsx(Et.button,{type:"button",id:i.triggerId,"aria-haspopup":"menu","aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":i.open?"open":"closed","data-disabled":r?"":void 0,disabled:r,...a,ref:xi(t,i.triggerRef),onPointerDown:He(e.onPointerDown,c=>{!r&&c.button===0&&c.ctrlKey===!1&&(i.onOpenToggle(),i.open||c.preventDefault())}),onKeyDown:He(e.onKeyDown,c=>{r||(["Enter"," "].includes(c.key)&&i.onOpenToggle(),c.key==="ArrowDown"&&i.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(c.key)&&c.preventDefault())})})})});eY.displayName=QK;var aye="DropdownMenuPortal",tY=e=>{const{__scopeDropdownMenu:t,...n}=e,r=Cr(t);return m.jsx(qbe,{...r,...n})};tY.displayName=aye;var nY="DropdownMenuContent",rY=b.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=XK(nY,n),i=Cr(n),s=b.useRef(!1);return m.jsx(Hbe,{id:a.contentId,"aria-labelledby":a.triggerId,...i,...r,ref:t,onCloseAutoFocus:He(e.onCloseAutoFocus,c=>{s.current||a.triggerRef.current?.focus(),s.current=!1,c.preventDefault()}),onInteractOutside:He(e.onInteractOutside,c=>{const u=c.detail.originalEvent,d=u.button===0&&u.ctrlKey===!0,p=u.button===2||d;(!a.modal||p)&&(s.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)"}})});rY.displayName=nY;var iye="DropdownMenuGroup",oye=b.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=Cr(n);return m.jsx(Vbe,{...a,...r,ref:t})});oye.displayName=iye;var sye="DropdownMenuLabel",aY=b.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=Cr(n);return m.jsx(Gbe,{...a,...r,ref:t})});aY.displayName=sye;var lye="DropdownMenuItem",iY=b.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=Cr(n);return m.jsx(Wbe,{...a,...r,ref:t})});iY.displayName=lye;var cye="DropdownMenuCheckboxItem",oY=b.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=Cr(n);return m.jsx(Kbe,{...a,...r,ref:t})});oY.displayName=cye;var uye="DropdownMenuRadioGroup",dye=b.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=Cr(n);return m.jsx(Ybe,{...a,...r,ref:t})});dye.displayName=uye;var fye="DropdownMenuRadioItem",sY=b.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=Cr(n);return m.jsx(Zbe,{...a,...r,ref:t})});sY.displayName=fye;var pye="DropdownMenuItemIndicator",mye=b.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=Cr(n);return m.jsx(Xbe,{...a,...r,ref:t})});mye.displayName=pye;var hye="DropdownMenuSeparator",lY=b.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=Cr(n);return m.jsx(Jbe,{...a,...r,ref:t})});lY.displayName=hye;var gye="DropdownMenuArrow",vye=b.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=Cr(n);return m.jsx(Qbe,{...a,...r,ref:t})});vye.displayName=gye;var bye="DropdownMenuSubTrigger",cY=b.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=Cr(n);return m.jsx(eye,{...a,...r,ref:t})});cY.displayName=bye;var yye="DropdownMenuSubContent",uY=b.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=Cr(n);return m.jsx(tye,{...a,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});uY.displayName=yye;var wye=JK,Sye=eY,Eye=tY,dY=rY,fY=aY,pY=iY,_ye=oY,xye=sY,mY=lY,Tye=cY,Rye=uY;const ek=wye,tk=Sye;Tye.displayName;Rye.displayName;function ev({ref:e,className:t,sideOffset:n=4,...r}){return m.jsx(Eye,{children:m.jsx(dY,{ref:e,sideOffset:n,className:$e("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md","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",t),...r})})}ev.displayName=dY.displayName;function so({ref:e,className:t,inset:n,...r}){return m.jsx(pY,{ref:e,className:$e("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",n&&"pl-8",t),...r})}so.displayName=pY.displayName;_ye.displayName;xye.displayName;function nk({ref:e,className:t,inset:n,...r}){return m.jsx(fY,{ref:e,className:$e("px-2 py-1.5 text-sm font-semibold",n&&"pl-8",t),...r})}nk.displayName=fY.displayName;function tf({ref:e,className:t,...n}){return m.jsx(mY,{ref:e,className:$e("-mx-1 my-1 h-px bg-muted",t),...n})}tf.displayName=mY.displayName;var Nye=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],So=Nye.reduce((e,t)=>{const n=T7(`Primitive.${t}`),r=b.forwardRef((a,i)=>{const{asChild:s,...c}=a,u=s?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),m.jsx(u,{...c,ref:i})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),kye="Label",hY=b.forwardRef((e,t)=>m.jsx(So.label,{...e,ref:t,onMouseDown:n=>{n.target.closest("button, input, select, textarea")||(e.onMouseDown?.(n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));hY.displayName=kye;var Cye=hY;function yn({className:e,...t}){return m.jsx(Cye,{"data-slot":"label",className:$e("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",e),...t})}function ob({message:e,className:t="",vertical:n,noBorder:r}){return m.jsx("div",{className:$e(`mt-2 rounded-md p-6 ${t}`,!r&&"border"),children:m.jsxs("p",{className:$e("text-sm text-muted-foreground flex items-center gap-4",n&&"flex-col"),children:[m.jsx("svg",{width:"40",height:"40",viewBox:"0 0 273 273",version:"1.1",xmlns:"http://www.w3.org/2000/svg",className:"flex-shrink-0",children:m.jsx("g",{stroke:"none",strokeWidth:"1",fill:"none",fillRule:"evenodd",children:m.jsxs("g",{transform:"translate(5.320900, 5.320900)",fillRule:"nonzero",className:"stroke-black dark:stroke-white",strokeWidth:"4",children:[m.jsx("path",{d:"M49.953025,-2.10854389 C63.26892,-2.21867124 76.6185256,2.70621155 86.9019463,12.6653164 L86.9019463,12.6653164 L87.505627,13.2592944 C97.5154947,23.2654892 102.640454,36.3074513 102.880738,49.4222247 C103.08932,77.4533067 113.877287,105.391753 135.242867,126.757333 C156.613383,148.127849 184.559216,158.914875 212.568138,159.119313 L212.568138,159.119313 L213.212264,159.134159 C225.843948,159.517566 238.363557,164.434972 248.121998,173.886137 L248.121998,173.886137 L248.725621,174.480088 C258.982114,184.732164 264.11035,198.171134 264.11035,211.6101 C264.11035,225.04592 258.984514,238.481745 248.732867,248.732867 C238.592792,258.872942 225.336706,263.997882 212.046872,264.107794 C198.731075,264.21792 185.381569,259.293085 175.098248,249.334078 L175.098248,249.334078 L174.494602,248.740134 C163.75802,238.008189 158.640853,223.784027 159.143413,209.719372 C158.258245,182.640933 147.489786,155.83332 126.828333,135.171867 C106.351297,114.694831 79.8363505,103.934873 53.0237258,102.891841 L53.0237258,102.891841 L52.2811438,102.865674 C38.4791718,103.347421 24.5325234,98.4328111 13.8776628,88.1140866 L13.8776628,88.1140866 L13.2739843,87.5201168 C3.12895117,77.3789607 -1.9984796,64.1195994 -2.10841888,50.8264755 C-2.21854669,37.5105567 2.70635908,24.1609269 12.6655135,13.8774565 L12.6655135,13.8774565 L13.2594878,13.2737797 C23.4005926,3.12880025 36.659927,-1.99860507 49.953025,-2.10854389 Z"}),m.jsx("circle",{cx:"50",cy:"212.0001",r:"52.5"}),m.jsx("circle",{cx:"212.0001",cy:"50",r:"52.5"})]})})}),e]})})}function gY({className:e,color:t,children:n,grayscaled:r=!1}){const a=b.useMemo(()=>{if(t){const h=t.split("(")[1].split(")")[0].trim().split(/\s+/);return Number.parseFloat(h[1]||"0")}return r?0:.2},[t,r]),i=b.useMemo(()=>{if(t){const h=t.split("(")[1].split(")")[0].trim().split(/\s+/);return Number.parseFloat(h[0]||"0.5")}return r?.3:.4},[t,r]),s=b.useMemo(()=>{if(t){const h=t.split("(")[1].split(")")[0].trim().split(/\s+/);return Number.parseFloat(h[2]||"0")}return Math.floor(Math.random()*360)},[t]),c=b.useMemo(()=>t||`oklch(${Math.min(i,1)} ${a} ${s})`,[s,a,i]),u=b.useMemo(()=>`oklch(${Math.min(i*2,1)} ${a} ${s})`,[s,a,i,t]),d=b.useMemo(()=>Math.floor(Math.random()*360),[s]),p=b.useMemo(()=>"1000%",[]);return m.jsx("section",{className:$e("relative w-full h-full overflow-hidden",e),style:{background:`${u}`},children:m.jsxs("div",{className:"isolate relative w-full h-full",children:[m.jsx("div",{className:"noise w-full h-full",style:{background:`linear-gradient(${d}deg, ${c}, transparent), url(https://grainy-gradients.vercel.app/noise.svg)`,filter:`contrast(120%) brightness(${p})`}}),n&&m.jsx("div",{className:"relative z-10 w-full h-full",children:n})]})})}function YI(e){const t=b.useRef({value:e,previous:e});return b.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var sb="Switch",[Aye]=oi(sb),[Iye,Oye]=Aye(sb),vY=b.forwardRef((e,t)=>{const{__scopeSwitch:n,name:r,checked:a,defaultChecked:i,required:s,disabled:c,value:u="on",onCheckedChange:d,form:p,...h}=e,[v,y]=b.useState(null),E=Ft(t,T=>y(T)),x=b.useRef(!1),_=v?p||!!v.closest("form"):!0,[S,w]=fo({prop:a,defaultProp:i??!1,onChange:d,caller:sb});return m.jsxs(Iye,{scope:n,checked:S,disabled:c,children:[m.jsx(Et.button,{type:"button",role:"switch","aria-checked":S,"aria-required":s,"data-state":SY(S),"data-disabled":c?"":void 0,disabled:c,value:u,...h,ref:E,onClick:He(e.onClick,T=>{w(k=>!k),_&&(x.current=T.isPropagationStopped(),x.current||T.stopPropagation())})}),_&&m.jsx(wY,{control:v,bubbles:!x.current,name:r,value:u,checked:S,required:s,disabled:c,form:p,style:{transform:"translateX(-100%)"}})]})});vY.displayName=sb;var bY="SwitchThumb",yY=b.forwardRef((e,t)=>{const{__scopeSwitch:n,...r}=e,a=Oye(bY,n);return m.jsx(Et.span,{"data-state":SY(a.checked),"data-disabled":a.disabled?"":void 0,...r,ref:t})});yY.displayName=bY;var Dye="SwitchBubbleInput",wY=b.forwardRef(({__scopeSwitch:e,control:t,checked:n,bubbles:r=!0,...a},i)=>{const s=b.useRef(null),c=Ft(s,i),u=YI(n),d=UI(t);return b.useEffect(()=>{const p=s.current;if(!p)return;const h=window.HTMLInputElement.prototype,y=Object.getOwnPropertyDescriptor(h,"checked").set;if(u!==n&&y){const E=new Event("click",{bubbles:r});y.call(p,n),p.dispatchEvent(E)}},[u,n,r]),m.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...a,tabIndex:-1,ref:c,style:{...a.style,...d,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});wY.displayName=Dye;function SY(e){return e?"checked":"unchecked"}var EY=vY,$ye=yY;function lb({ref:e,className:t,...n}){return m.jsx(EY,{className:$e("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",t),...n,ref:e,children:m.jsx($ye,{className:$e("pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})})}lb.displayName=EY.displayName;var _Y=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),Lye="VisuallyHidden",xY=b.forwardRef((e,t)=>m.jsx(Et.span,{...e,ref:t,style:{..._Y,...e.style}}));xY.displayName=Lye;var Mye=xY,[cb]=oi("Tooltip",[bs]),ub=bs(),TY="TooltipProvider",jye=700,rk="tooltip.open",[Pye,ZI]=cb(TY),RY=e=>{const{__scopeTooltip:t,delayDuration:n=jye,skipDelayDuration:r=300,disableHoverableContent:a=!1,children:i}=e,s=b.useRef(!0),c=b.useRef(!1),u=b.useRef(0);return b.useEffect(()=>{const d=u.current;return()=>window.clearTimeout(d)},[]),m.jsx(Pye,{scope:t,isOpenDelayedRef:s,delayDuration:n,onOpen:b.useCallback(()=>{window.clearTimeout(u.current),s.current=!1},[]),onClose:b.useCallback(()=>{window.clearTimeout(u.current),u.current=window.setTimeout(()=>s.current=!0,r)},[r]),isPointerInTransitRef:c,onPointerInTransitChange:b.useCallback(d=>{c.current=d},[]),disableHoverableContent:a,children:i})};RY.displayName=TY;var jf="Tooltip",[Uye,wp]=cb(jf),NY=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:a,onOpenChange:i,disableHoverableContent:s,delayDuration:c}=e,u=ZI(jf,e.__scopeTooltip),d=ub(t),[p,h]=b.useState(null),v=fr(),y=b.useRef(0),E=s??u.disableHoverableContent,x=c??u.delayDuration,_=b.useRef(!1),[S,w]=fo({prop:r,defaultProp:a??!1,onChange:C=>{C?(u.onOpen(),document.dispatchEvent(new CustomEvent(rk))):u.onClose(),i?.(C)},caller:jf}),T=b.useMemo(()=>S?_.current?"delayed-open":"instant-open":"closed",[S]),k=b.useCallback(()=>{window.clearTimeout(y.current),y.current=0,_.current=!1,w(!0)},[w]),N=b.useCallback(()=>{window.clearTimeout(y.current),y.current=0,w(!1)},[w]),A=b.useCallback(()=>{window.clearTimeout(y.current),y.current=window.setTimeout(()=>{_.current=!0,w(!0),y.current=0},x)},[x,w]);return b.useEffect(()=>()=>{y.current&&(window.clearTimeout(y.current),y.current=0)},[]),m.jsx(Jv,{...d,children:m.jsx(Uye,{scope:t,contentId:v,open:S,stateAttribute:T,trigger:p,onTriggerChange:h,onTriggerEnter:b.useCallback(()=>{u.isOpenDelayedRef.current?A():k()},[u.isOpenDelayedRef,A,k]),onTriggerLeave:b.useCallback(()=>{E?N():(window.clearTimeout(y.current),y.current=0)},[N,E]),onOpen:k,onClose:N,disableHoverableContent:E,children:n})})};NY.displayName=jf;var ak="TooltipTrigger",kY=b.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,a=wp(ak,n),i=ZI(ak,n),s=ub(n),c=b.useRef(null),u=Ft(t,c,a.onTriggerChange),d=b.useRef(!1),p=b.useRef(!1),h=b.useCallback(()=>d.current=!1,[]);return b.useEffect(()=>()=>document.removeEventListener("pointerup",h),[h]),m.jsx(hp,{asChild:!0,...s,children:m.jsx(Et.button,{"aria-describedby":a.open?a.contentId:void 0,"data-state":a.stateAttribute,...r,ref:u,onPointerMove:He(e.onPointerMove,v=>{v.pointerType!=="touch"&&!p.current&&!i.isPointerInTransitRef.current&&(a.onTriggerEnter(),p.current=!0)}),onPointerLeave:He(e.onPointerLeave,()=>{a.onTriggerLeave(),p.current=!1}),onPointerDown:He(e.onPointerDown,()=>{a.open&&a.onClose(),d.current=!0,document.addEventListener("pointerup",h,{once:!0})}),onFocus:He(e.onFocus,()=>{d.current||a.onOpen()}),onBlur:He(e.onBlur,a.onClose),onClick:He(e.onClick,a.onClose)})})});kY.displayName=ak;var XI="TooltipPortal",[zye,Fye]=cb(XI,{forceMount:void 0}),CY=e=>{const{__scopeTooltip:t,forceMount:n,children:r,container:a}=e,i=wp(XI,t);return m.jsx(zye,{scope:t,forceMount:n,children:m.jsx(ua,{present:n||i.open,children:m.jsx(Bu,{asChild:!0,container:a,children:r})})})};CY.displayName=XI;var xu="TooltipContent",AY=b.forwardRef((e,t)=>{const n=Fye(xu,e.__scopeTooltip),{forceMount:r=n.forceMount,side:a="top",...i}=e,s=wp(xu,e.__scopeTooltip);return m.jsx(ua,{present:r||s.open,children:s.disableHoverableContent?m.jsx(IY,{side:a,...i,ref:t}):m.jsx(Bye,{side:a,...i,ref:t})})}),Bye=b.forwardRef((e,t)=>{const n=wp(xu,e.__scopeTooltip),r=ZI(xu,e.__scopeTooltip),a=b.useRef(null),i=Ft(t,a),[s,c]=b.useState(null),{trigger:u,onClose:d}=n,p=a.current,{onPointerInTransitChange:h}=r,v=b.useCallback(()=>{c(null),h(!1)},[h]),y=b.useCallback((E,x)=>{const _=E.currentTarget,S={x:E.clientX,y:E.clientY},w=Gye(S,_.getBoundingClientRect()),T=Wye(S,w),k=Kye(x.getBoundingClientRect()),N=Zye([...T,...k]);c(N),h(!0)},[h]);return b.useEffect(()=>()=>v(),[v]),b.useEffect(()=>{if(u&&p){const E=_=>y(_,p),x=_=>y(_,u);return u.addEventListener("pointerleave",E),p.addEventListener("pointerleave",x),()=>{u.removeEventListener("pointerleave",E),p.removeEventListener("pointerleave",x)}}},[u,p,y,v]),b.useEffect(()=>{if(s){const E=x=>{const _=x.target,S={x:x.clientX,y:x.clientY},w=u?.contains(_)||p?.contains(_),T=!Yye(S,s);w?v():T&&(v(),d())};return document.addEventListener("pointermove",E),()=>document.removeEventListener("pointermove",E)}},[u,p,s,d,v]),m.jsx(IY,{...e,ref:i})}),[qye,Hye]=cb(jf,{isInside:!1}),Vye=The("TooltipContent"),IY=b.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":a,onEscapeKeyDown:i,onPointerDownOutside:s,...c}=e,u=wp(xu,n),d=ub(n),{onClose:p}=u;return b.useEffect(()=>(document.addEventListener(rk,p),()=>document.removeEventListener(rk,p)),[p]),b.useEffect(()=>{if(u.trigger){const h=v=>{v.target?.contains(u.trigger)&&p()};return window.addEventListener("scroll",h,{capture:!0}),()=>window.removeEventListener("scroll",h,{capture:!0})}},[u.trigger,p]),m.jsx(Uu,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:s,onFocusOutside:h=>h.preventDefault(),onDismiss:p,children:m.jsxs(Qv,{"data-state":u.stateAttribute,...d,...c,ref:t,style:{...c.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[m.jsx(Vye,{children:r}),m.jsx(qye,{scope:n,isInside:!0,children:m.jsx(Mye,{id:u.contentId,role:"tooltip",children:a||r})})]})})});AY.displayName=xu;var OY="TooltipArrow",DY=b.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,a=ub(n);return Hye(OY,n).isInside?null:m.jsx(eb,{...a,...r,ref:t})});DY.displayName=OY;function Gye(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),a=Math.abs(t.right-e.x),i=Math.abs(t.left-e.x);switch(Math.min(n,r,a,i)){case i:return"left";case a:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function Wye(e,t,n=5){const r=[];switch(t){case"top":r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function Kye(e){const{top:t,right:n,bottom:r,left:a}=e;return[{x:a,y:t},{x:n,y:t},{x:n,y:r},{x:a,y:r}]}function Yye(e,t){const{x:n,y:r}=e;let a=!1;for(let i=0,s=t.length-1;i<t.length;s=i++){const c=t[i],u=t[s],d=c.x,p=c.y,h=u.x,v=u.y;p>r!=v>r&&n<(h-d)*(r-p)/(v-p)+d&&(a=!a)}return a}function Zye(e){const t=e.slice();return t.sort((n,r)=>n.x<r.x?-1:n.x>r.x?1:n.y<r.y?-1:n.y>r.y?1:0),Xye(t)}function Xye(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r<e.length;r++){const a=e[r];for(;t.length>=2;){const i=t[t.length-1],s=t[t.length-2];if((i.x-s.x)*(a.y-s.y)>=(i.y-s.y)*(a.x-s.x))t.pop();else break}t.push(a)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const a=e[r];for(;n.length>=2;){const i=n[n.length-1],s=n[n.length-2];if((i.x-s.x)*(a.y-s.y)>=(i.y-s.y)*(a.x-s.x))n.pop();else break}n.push(a)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var Jye=RY,Qye=NY,ewe=kY,twe=CY,nwe=AY,rwe=DY;function $Y({delayDuration:e=0,...t}){return m.jsx(Jye,{"data-slot":"tooltip-provider",delayDuration:e,...t})}function ln({...e}){return m.jsx($Y,{children:m.jsx(Qye,{"data-slot":"tooltip",...e})})}function cn({...e}){return m.jsx(ewe,{"data-slot":"tooltip-trigger",...e})}function un({className:e,sideOffset:t=0,children:n,...r}){return m.jsx(twe,{children:m.jsxs(nwe,{"data-slot":"tooltip-content",sideOffset:t,className:$e("bg-foreground text-background animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-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 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",e),...r,children:[n,m.jsx(rwe,{className:"bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}class awe{name="mcp_inspector_open";properties;constructor(t){this.properties={server_url:t.serverUrl,connection_count:t.connectionCount}}}class SU{name="mcp_tool_execution";properties;constructor(t){this.properties={tool_name:t.toolName,server_id:t.serverId,success:t.success,duration:t.duration,error:t.error}}}class EU{name="mcp_resource_read";properties;constructor(t){this.properties={resource_uri:t.resourceUri,server_id:t.serverId,success:t.success,error:t.error}}}class _U{name="mcp_prompt_call";properties;constructor(t){this.properties={prompt_name:t.promptName,server_id:t.serverId,success:t.success,error:t.error}}}class xU{name="mcp_chat_message";properties;constructor(t){this.properties={server_id:t.serverId,provider:t.provider,model:t.model,message_count:t.messageCount,tool_calls_count:t.toolCallsCount,success:t.success,execution_mode:t.executionMode,duration:t.duration,error:t.error}}}class iwe{name="mcp_server_added";properties;constructor(t){this.properties={server_id:t.serverId,server_url:t.serverUrl,connection_type:t.connectionType,via_proxy:t.viaProxy}}}class owe{name="mcp_server_removed";properties;constructor(t){this.properties={server_id:t.serverId}}}class swe{name="mcp_command_palette_open";properties;constructor(t){this.properties={trigger:t.trigger}}}class lwe{name="mcp_tool_saved";properties;constructor(t){this.properties={tool_name:t.toolName,server_id:t.serverId}}}function $S(){try{return"0.9.1-canary.1"}catch{return"0.0.0"}}var cwe={};function LS(){try{return typeof window<"u"&&typeof document<"u"}catch{return!1}}class TU{endpoint;timeout;constructor(t,n=3e3){this.endpoint=t,this.timeout=n}async logEvent(t){try{const n=new AbortController,r=setTimeout(()=>n.abort(),this.timeout),a=await fetch(this.endpoint,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t),signal:n.signal});if(clearTimeout(r),!a.ok)throw new Error(`HTTP error! status: ${a.status}`)}catch{}}}function Ko(e){return`mcp_inspector_telemetry_${e}`}class er{static instance=null;POSTHOG_PROXY_URL="/inspector/api/tel/posthog";SCARF_PROXY_URL="/inspector/api/tel/scarf";UNKNOWN_USER_ID="UNKNOWN_USER_ID";_currUserId=null;_posthogClient=null;_scarfClient=null;_source="inspector";constructor(){const t=LS(),n=this.isTelemetryDisabled();if(this._source=this.getStoredSource()||"inspector",n)this._posthogClient=null,this._scarfClient=null;else if(!t)this._posthogClient=null,this._scarfClient=null;else{try{this._posthogClient=new TU(this.POSTHOG_PROXY_URL,3e3)}catch{this._posthogClient=null}try{this._scarfClient=new TU(this.SCARF_PROXY_URL,3e3)}catch{this._scarfClient=null}}}isTelemetryDisabled(){return typeof localStorage<"u"&&localStorage.getItem(Ko("disabled"))==="true"||typeof process<"u"&&cwe?.MCP_USE_ANONYMIZED_TELEMETRY==="false"}getStoredSource(){return typeof localStorage<"u"?localStorage.getItem(Ko("source")):null}static getInstance(){return er.instance||(er.instance=new er),er.instance}setSource(t){this._source=t,typeof localStorage<"u"&&localStorage.setItem(Ko("source"),t)}getSource(){return this._source}get userId(){if(this._currUserId)return this._currUserId;if(!LS())return this._currUserId=this.UNKNOWN_USER_ID,this._currUserId;try{const t=localStorage.getItem(Ko("user_id"));if(t)this._currUserId=t;else{const n=this.generateUserId();localStorage.setItem(Ko("user_id"),n),this._currUserId=n}this.trackPackageDownload({triggered_by:"user_id_property"}).catch(()=>{})}catch{this._currUserId=this.UNKNOWN_USER_ID}return this._currUserId}generateUserId(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{const n=Math.random()*16|0;return(t==="x"?n:n&3|8).toString(16)})}async capture(t){if(!(!this._posthogClient&&!this._scarfClient)){if(this._posthogClient)try{const n={event:t.name,user_id:this.userId,properties:{...t.properties,mcp_use_version:$S(),language:"typescript",source:this._source,package:"inspector"}};await this._posthogClient.logEvent(n)}catch{}if(this._scarfClient)try{const n={};n.mcp_use_version=$S(),n.user_id=this.userId,n.event=t.name,n.language="typescript",n.source=this._source,n.package="inspector",await this._scarfClient.logEvent(n)}catch{}}}async trackPackageDownload(t){if(this._scarfClient&&LS())try{const n=$S();let r=!1,a=!1;const i=localStorage.getItem(Ko("download_version"));if(i?n>i&&(r=!0,a=!1,localStorage.setItem(Ko("download_version"),n)):(r=!0,a=!0,localStorage.setItem(Ko("download_version"),n)),r){const s={...t||{}};s.mcp_use_version=n,s.user_id=this.userId,s.event="package_download",s.first_download=a,s.language="typescript",s.source=this._source,s.package="inspector",await this._scarfClient.logEvent(s)}}catch{}}async trackInspectorOpen(t){const n=new awe(t);await this.capture(n)}}const LY=b.createContext(null);function JI(){const e=b.use(LY);if(!e)throw new Error("useMcpContext must be used within a McpProvider");return e}function uwe({url:e,name:t,proxyConfig:n,transportType:r,connectionId:a,onUpdate:i,onRemove:s}){const c=typeof window<"u"?new URL("/inspector/oauth/callback",window.location.origin).toString():"/inspector/oauth/callback";let u=e,d={};if(n?.proxyAddress){const F=new URL(n.proxyAddress),z=new URL(e);u=`${F.origin}${F.pathname}${z.pathname}${z.search}`,d["X-Target-URL"]=e}n?.customHeaders&&(d={...d,...n.customHeaders});const p=b.useRef(null),[h,v]=b.useState(!1),y=b.useRef(!1);b.useEffect(()=>{typeof window<"u"&&!y.current&&(y.current=!0,Za(()=>import("./transport-wrapper-browser-BI4dDu3b.js"),[]).then(F=>{p.current=F.wrapTransportForLogging,v(!0),console.log("[McpContext] Transport wrapper loaded")}).catch(F=>{console.error("[McpContext] Failed to load transport wrapper:",F)}))},[]);const E=b.useMemo(()=>{if(!(!h||!p.current))return(F,z)=>{const K=a;return console.log("[McpContext] Applying transport wrapper, serverId:",K,"from connector:",z),p.current(F,K)}},[h,a]),x=`mcp-inspector-notifications-${a}`,_=500,[S,w]=b.useState([]);b.useEffect(()=>{try{const F=localStorage.getItem(x);if(F){const z=JSON.parse(F);Array.isArray(z)&&w(z)}}catch(F){console.error("Failed to load notifications from localStorage:",F)}},[x]),b.useEffect(()=>{try{localStorage.setItem(x,JSON.stringify(S))}catch(F){console.error("Failed to save notifications to localStorage:",F)}},[S,x]);const T=b.useCallback(F=>{w(z=>z.map(K=>K.id===F?{...K,read:!0}:K))},[]),k=b.useCallback(()=>{w(F=>F.map(z=>({...z,read:!0})))},[]),N=b.useCallback(()=>{w([])},[]),A=b.useCallback(F=>{w(z=>{const K=[F,...z];return K.length>_?K.slice(0,_):K})},[]),C=rI({url:u,callbackUrl:c,customHeaders:Object.keys(d).length>0?d:void 0,transportType:r||"http",preventAutoAuth:!0,useRedirectFlow:!0,enabled:h,wrapTransport:E,onNotification:F=>{A({id:globalThis.crypto.randomUUID(),method:F.method,params:F.params,timestamp:Date.now(),read:!1})}}),O=b.useRef(i),L=b.useRef(null);return b.useEffect(()=>{O.current=i},[i]),b.useEffect(()=>{if(typeof queueMicrotask<"u")queueMicrotask(()=>{C.state==="ready"&&C.serverInfo&&console.log("[McpContext] Server info available:",C.serverInfo);const F=S.filter(ee=>!ee.read).length,z={id:a,url:e,name:C.serverInfo?.name||t,state:C.state,tools:C.tools,resources:C.resources,prompts:C.prompts,error:C.error??null,authUrl:C.authUrl??null,customHeaders:d,transportType:r,proxyConfig:n,serverInfo:C.serverInfo,capabilities:C.capabilities,notifications:S,unreadNotificationCount:F,markNotificationRead:T,markAllNotificationsRead:k,clearNotifications:N,callTool:C.callTool,readResource:C.readResource,listPrompts:C.listPrompts,getPrompt:C.getPrompt,authenticate:C.authenticate,retry:C.retry,clearStorage:C.clearStorage,disconnect:C.disconnect,client:C.client},K=L.current;(!K||K.state!==z.state||K.error!==z.error||K.authUrl!==z.authUrl||K.name!==z.name||K.tools.length!==z.tools.length||K.resources.length!==z.resources.length||K.prompts.length!==z.prompts.length||K.serverInfo!==z.serverInfo||K.capabilities!==z.capabilities||K.notifications.length!==z.notifications.length||K.unreadNotificationCount!==z.unreadNotificationCount||!K.client)&&(L.current=z,O.current(z))});else{const F=S.filter(ee=>!ee.read).length,z={id:a,url:e,name:C.serverInfo?.name||t,state:C.state,tools:C.tools,resources:C.resources,prompts:C.prompts,error:C.error??null,authUrl:C.authUrl??null,customHeaders:d,transportType:r,proxyConfig:n,serverInfo:C.serverInfo,capabilities:C.capabilities,notifications:S,unreadNotificationCount:F,markNotificationRead:T,markAllNotificationsRead:k,clearNotifications:N,callTool:C.callTool,readResource:C.readResource,listPrompts:C.listPrompts,getPrompt:C.getPrompt,authenticate:C.authenticate,retry:C.retry,clearStorage:C.clearStorage,disconnect:C.disconnect,client:C.client},K=L.current;(!K||K.state!==z.state||K.error!==z.error||K.authUrl!==z.authUrl||K.name!==z.name||K.tools.length!==z.tools.length||K.resources.length!==z.resources.length||K.prompts.length!==z.prompts.length||K.serverInfo!==z.serverInfo||K.capabilities!==z.capabilities||K.notifications.length!==z.notifications.length||K.unreadNotificationCount!==z.unreadNotificationCount||!K.client)&&(L.current=z,O.current(z))}},[e,t,r,n,d,a,C.state,C.tools,C.resources,C.prompts,C.error,C.authUrl,C.serverInfo,C.capabilities,C.client,S,T,k,N,C.callTool,C.readResource,C.listPrompts,C.getPrompt,C.authenticate,C.retry,C.clearStorage]),null}function dwe({children:e}){const[t,n]=b.useState([]),[r,a]=b.useState(!1),[i,s]=b.useState(!0),[c,u]=b.useState([]);b.useEffect(()=>{try{const _=localStorage.getItem("mcp-inspector-connections");if(_){const w=JSON.parse(_);Array.isArray(w)&&(u(w),n(w.map(T=>({id:T.id||T.url,url:T.url,name:T.name||"MCP Server",state:"discovering",tools:[],resources:[],prompts:[],error:null,authUrl:null,customHeaders:T.proxyConfig?.customHeaders,transportType:T.transportType,proxyConfig:T.proxyConfig,notifications:[],unreadNotificationCount:0,markNotificationRead:()=>{},markAllNotificationsRead:()=>{},clearNotifications:()=>{},callTool:async()=>{},readResource:async()=>{},listPrompts:async()=>{},getPrompt:async()=>{},authenticate:()=>{},retry:()=>{},clearStorage:()=>{},disconnect:()=>{},client:null}))))}const S=localStorage.getItem("mcp-inspector-auto-connect");S!==null&&s(S==="true")}catch(_){console.error("Failed to load connections from localStorage:",_)}finally{a(!0)}},[]),b.useEffect(()=>{r&&localStorage.setItem("mcp-inspector-connections",JSON.stringify(c))},[c,r]),b.useEffect(()=>{r&&localStorage.setItem("mcp-inspector-auto-connect",String(i))},[i,r]);const d=b.useCallback((_,S,w,T)=>{const k=c.find(C=>C.url===_),N=t.find(C=>C.url===_);if(k&&N){if(JSON.stringify(k.proxyConfig)!==JSON.stringify(w)&&w){u(O=>O.filter(L=>L.url!==_)),n(O=>O.filter(L=>L.url!==_)),setTimeout(()=>{const O={id:_,url:_,name:S||k.name||"MCP Server",proxyConfig:w,transportType:T||k.transportType};u(L=>[...L,O]),n(L=>[...L,{id:_,url:_,name:S||k.name||"MCP Server",state:"connecting",tools:[],resources:[],prompts:[],error:null,authUrl:null,customHeaders:w?.customHeaders,transportType:T||k.transportType,proxyConfig:w,notifications:[],unreadNotificationCount:0,markNotificationRead:()=>{},markAllNotificationsRead:()=>{},clearNotifications:()=>{},callTool:async()=>{},readResource:async()=>{},listPrompts:async()=>{},getPrompt:async()=>{},authenticate:()=>{},retry:()=>{},clearStorage:()=>{},disconnect:()=>{},client:null}])},10);return}return}if(k&&!N){(w||T)&&u(C=>C.map(O=>O.url===_?{...O,proxyConfig:w||O.proxyConfig,transportType:T||O.transportType,name:S||O.name}:O)),n(C=>[...C,{id:k.id||_,url:_,name:S||k.name||"MCP Server",state:"connecting",tools:[],resources:[],prompts:[],error:null,authUrl:null,customHeaders:w?.customHeaders||k.proxyConfig?.customHeaders,transportType:T||k.transportType,proxyConfig:w||k.proxyConfig,notifications:[],unreadNotificationCount:0,markNotificationRead:()=>{},markAllNotificationsRead:()=>{},clearNotifications:()=>{},callTool:async()=>{},readResource:async()=>{},listPrompts:async()=>{},getPrompt:async()=>{},authenticate:()=>{},retry:()=>{},clearStorage:()=>{},disconnect:()=>{},client:null}]);return}const A={id:_,url:_,name:S||"MCP Server",proxyConfig:w,transportType:T};u(C=>[...C,A]),n(C=>[...C,{id:_,url:_,name:S||"MCP Server",state:"connecting",tools:[],resources:[],prompts:[],error:null,authUrl:null,customHeaders:w?.customHeaders,transportType:T,proxyConfig:w,notifications:[],unreadNotificationCount:0,markNotificationRead:()=>{},markAllNotificationsRead:()=>{},clearNotifications:()=>{},callTool:async()=>{},readResource:async()=>{},listPrompts:async()=>{},getPrompt:async()=>{},authenticate:()=>{},retry:()=>{},clearStorage:()=>{},disconnect:()=>{},client:null}])},[c,t]),p=b.useCallback(_=>{const S=t.find(T=>T.id===_);S&&(console.log(`[McpContext] Cleaning up connection: ${_}`),S.disconnect&&(console.log(`[McpContext] Disconnecting from server: ${_}`),S.disconnect()),S.clearStorage&&(console.log(`[McpContext] Clearing OAuth storage for connection: ${_}`),S.clearStorage())),u(T=>T.filter(k=>k.id!==_)),n(T=>T.filter(k=>k.id!==_));const w=localStorage.getItem("mcp-inspector-connections");if(w)try{const k=JSON.parse(w).filter(N=>(N.id||N.url)!==_);localStorage.setItem("mcp-inspector-connections",JSON.stringify(k))}catch(T){console.error("Failed to update localStorage on remove:",T)}er.getInstance().capture(new owe({serverId:_}))},[t]),h=b.useCallback((_,S)=>{u(w=>w.map(T=>T.id===_||T.url===_?{...T,...S}:T)),n(w=>w.map(T=>T.id===_?{...T,...S}:T))},[]),v=b.useCallback(_=>{n(S=>{const w=S.findIndex(N=>N.id===_.id);if(w===-1)return S;const T=S[w];if(T.state===_.state&&T.tools===_.tools&&T.resources===_.resources&&T.prompts===_.prompts&&T.error===_.error&&T.serverInfo===_.serverInfo&&T.client===_.client&&T.notifications===_.notifications&&T.unreadNotificationCount===_.unreadNotificationCount)return S;const k=[...S];return k[w]=_,k})},[]),y=b.useCallback(_=>{console.log("Connect requested for:",_)},[]),E=b.useCallback(_=>{console.log("Disconnect requested for:",_)},[]),x=b.useMemo(()=>({connections:t,addConnection:d,removeConnection:p,updateConnectionConfig:h,autoConnect:i,setAutoConnect:s,connectServer:y,disconnectServer:E,configLoaded:r}),[t,d,p,h,i,y,E,r]);return m.jsxs(LY.Provider,{value:x,children:[e,r&&i&&c.map(_=>{const S=`${_.id||_.url}-${_.proxyConfig?.proxyAddress?"proxy":"direct"}`;return console.warn("[McpContext] Rendering McpConnectionWrapper with key:",S,"proxyConfig:",_.proxyConfig),m.jsx(uwe,{url:_.url,name:_.name,proxyConfig:_.proxyConfig,transportType:_.transportType,connectionId:_.id||_.url,onUpdate:v,onRemove:()=>p(_.id||_.url)},S)})]})}const fwe=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),pwe=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase()),RU=e=>{const t=pwe(e);return t.charAt(0).toUpperCase()+t.slice(1)},MY=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim(),mwe=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};var hwe={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const gwe=b.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:a="",children:i,iconNode:s,...c},u)=>b.createElement("svg",{ref:u,...hwe,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:MY("lucide",a),...!i&&!mwe(c)&&{"aria-hidden":"true"},...c},[...s.map(([d,p])=>b.createElement(d,p)),...Array.isArray(i)?i:[i]]));const it=(e,t)=>{const n=b.forwardRef(({className:r,...a},i)=>b.createElement(gwe,{ref:i,iconNode:t,className:MY(`lucide-${fwe(RU(e))}`,`lucide-${e}`,r),...a}));return n.displayName=RU(e),n};const vwe=[["path",{d:"M12 17V3",key:"1cwfxf"}],["path",{d:"m6 11 6 6 6-6",key:"12ii2o"}],["path",{d:"M19 21H5",key:"150jfl"}]],bwe=it("arrow-down-to-line",vwe);const ywe=[["path",{d:"m18 9-6-6-6 6",key:"kcunyi"}],["path",{d:"M12 3v14",key:"7cf3v8"}],["path",{d:"M5 21h14",key:"11awu3"}]],wwe=it("arrow-up-from-line",ywe);const Swe=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],Ewe=it("arrow-up",Swe);const _we=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]],QI=it("bell",_we);const xwe=[["path",{d:"m11 10 3 3",key:"fzmg1i"}],["path",{d:"M6.5 21A3.5 3.5 0 1 0 3 17.5a2.62 2.62 0 0 1-.708 1.792A1 1 0 0 0 3 21z",key:"p4q2r7"}],["path",{d:"M9.969 17.031 21.378 5.624a1 1 0 0 0-3.002-3.002L6.967 14.031",key:"wy6l02"}]],jY=it("brush",xwe);const Twe=[["path",{d:"M12 20v-9",key:"1qisl0"}],["path",{d:"M14 7a4 4 0 0 1 4 4v3a6 6 0 0 1-12 0v-3a4 4 0 0 1 4-4z",key:"uouzyp"}],["path",{d:"M14.12 3.88 16 2",key:"qol33r"}],["path",{d:"M21 21a4 4 0 0 0-3.81-4",key:"1b0z45"}],["path",{d:"M21 5a4 4 0 0 1-3.55 3.97",key:"5cxbf6"}],["path",{d:"M22 13h-4",key:"1jl80f"}],["path",{d:"M3 21a4 4 0 0 1 3.81-4",key:"1fjd4g"}],["path",{d:"M3 5a4 4 0 0 0 3.55 3.97",key:"1d7oge"}],["path",{d:"M6 13H2",key:"82j7cp"}],["path",{d:"m8 2 1.88 1.88",key:"fmnt4t"}],["path",{d:"M9 7.13V6a3 3 0 1 1 6 0v1.13",key:"1vgav8"}]],Rwe=it("bug",Twe);const Nwe=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Da=it("check",Nwe);const kwe=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Ol=it("chevron-down",kwe);const Cwe=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],e1=it("chevron-left",Cwe);const Awe=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Iwe=it("chevron-right",Awe);const Owe=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],Dwe=it("chevron-up",Owe);const $we=[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]],Lwe=it("chevrons-up-down",$we);const Mwe=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}]],NU=it("circle-minus",Mwe);const jwe=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Tu=it("clock",jwe);const Pwe=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],PY=it("code",Pwe);const Uwe=[["path",{d:"M11 10.27 7 3.34",key:"16pf9h"}],["path",{d:"m11 13.73-4 6.93",key:"794ttg"}],["path",{d:"M12 22v-2",key:"1osdcq"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M14 12h8",key:"4f43i9"}],["path",{d:"m17 20.66-1-1.73",key:"eq3orb"}],["path",{d:"m17 3.34-1 1.73",key:"2wel8s"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"m20.66 17-1.73-1",key:"sg0v6f"}],["path",{d:"m20.66 7-1.73 1",key:"1ow05n"}],["path",{d:"m3.34 17 1.73-1",key:"nuk764"}],["path",{d:"m3.34 7 1.73 1",key:"1ulond"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["circle",{cx:"12",cy:"12",r:"8",key:"46899m"}]],zwe=it("cog",Uwe);const Fwe=[["path",{d:"M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3",key:"11bfej"}]],Bwe=it("command",Fwe);const qwe=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],Br=it("copy",qwe);const Hwe=[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]],db=it("database",Hwe);const Vwe=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],t1=it("download",Vwe);const Gwe=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]],Wwe=it("ellipsis-vertical",Gwe);const Kwe=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],kU=it("external-link",Kwe);const Ywe=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],UY=it("eye-off",Ywe);const Zwe=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],ik=it("eye",Zwe);const Xwe=[["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z",key:"1mlx9k"}]],Jwe=it("file-code",Xwe);const Qwe=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["circle",{cx:"10",cy:"12",r:"2",key:"737tya"}],["path",{d:"m20 17-1.296-1.296a2.41 2.41 0 0 0-3.408 0L9 22",key:"wt3hpn"}]],eSe=it("file-image",Qwe);const tSe=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],n1=it("file-text",tSe);const nSe=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}]],rSe=it("file",nSe);const aSe=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],iSe=it("folder-open",aSe);const oSe=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],sSe=it("globe",oSe);const lSe=[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]],cSe=it("grip-vertical",lSe);const uSe=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]],tv=it("history",uSe);const dSe=[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]],zY=it("key",dSe);const fSe=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],vl=it("loader-circle",fSe);const pSe=[["path",{d:"M8 3H5a2 2 0 0 0-2 2v3",key:"1dcmit"}],["path",{d:"M21 8V5a2 2 0 0 0-2-2h-3",key:"1e4gt3"}],["path",{d:"M3 16v3a2 2 0 0 0 2 2h3",key:"wsl5sc"}],["path",{d:"M16 21h3a2 2 0 0 0 2-2v-3",key:"18trek"}]],r1=it("maximize",pSe);const mSe=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]],hSe=it("maximize-2",mSe);const gSe=[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}]],vSe=it("message-circle",gSe);const bSe=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]],Pf=it("message-square",bSe);const ySe=[["path",{d:"M8 3v3a2 2 0 0 1-2 2H3",key:"hohbtr"}],["path",{d:"M21 8h-3a2 2 0 0 1-2-2V3",key:"5jw1f3"}],["path",{d:"M3 16h3a2 2 0 0 1 2 2v3",key:"198tvr"}],["path",{d:"M16 21v-3a2 2 0 0 1 2-2h3",key:"ph8mxp"}]],wSe=it("minimize",ySe);const SSe=[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]],CU=it("monitor",SSe);const ESe=[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]],_Se=it("moon",ESe);const xSe=[["path",{d:"M2 10h6V4",key:"zwrco"}],["path",{d:"m2 4 6 6",key:"ug085t"}],["path",{d:"M21 10V7a2 2 0 0 0-2-2h-7",key:"git5jr"}],["path",{d:"M3 14v2a2 2 0 0 0 2 2h3",key:"1f7fh3"}],["rect",{x:"12",y:"14",width:"10",height:"7",rx:"1",key:"1wjs3o"}]],TSe=it("picture-in-picture",xSe);const RSe=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],FY=it("play",RSe);const NSe=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],BY=it("plus",NSe);const kSe=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],AU=it("rotate-ccw",kSe);const CSe=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]],a1=it("save",CSe);const ASe=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],fb=it("search",ASe);const ISe=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],OSe=it("send",ISe);const DSe=[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]],$Se=it("server",DSe);const LSe=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],Zc=it("settings",LSe);const MSe=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]],jSe=it("shield",MSe);const PSe=[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]],USe=it("square-pen",PSe);const zSe=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 4h.01",key:"1ujb9j"}],["path",{d:"M20 12h.01",key:"1ykeid"}],["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M4 12h.01",key:"158zrr"}],["path",{d:"M17.657 6.343h.01",key:"31pqzk"}],["path",{d:"M17.657 17.657h.01",key:"jehnf4"}],["path",{d:"M6.343 17.657h.01",key:"gdk6ow"}],["path",{d:"M6.343 6.343h.01",key:"1uurf0"}]],FSe=it("sun-dim",zSe);const BSe=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],MS=it("terminal",BSe);const qSe=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],bl=it("trash-2",qSe);const HSe=[["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],VSe=it("trash",HSe);const GSe=[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]],yl=it("wrench",GSe);const WSe=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],qu=it("x",WSe);const KSe=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],Uf=it("zap",KSe);function YSe(e){if(typeof document>"u")return;let t=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",t.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}const ZSe=e=>{switch(e){case"success":return QSe;case"info":return tEe;case"warning":return eEe;case"error":return nEe;default:return null}},XSe=Array(12).fill(0),JSe=({visible:e,className:t})=>se.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},se.createElement("div",{className:"sonner-spinner"},XSe.map((n,r)=>se.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${r}`})))),QSe=se.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},se.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),eEe=se.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},se.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),tEe=se.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},se.createElement("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 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),nEe=se.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},se.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),rEe=se.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},se.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),se.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),aEe=()=>{const[e,t]=se.useState(document.hidden);return se.useEffect(()=>{const n=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",n),()=>window.removeEventListener("visibilitychange",n)},[]),e};let ok=1;class iEe{constructor(){this.subscribe=t=>(this.subscribers.push(t),()=>{const n=this.subscribers.indexOf(t);this.subscribers.splice(n,1)}),this.publish=t=>{this.subscribers.forEach(n=>n(t))},this.addToast=t=>{this.publish(t),this.toasts=[...this.toasts,t]},this.create=t=>{var n;const{message:r,...a}=t,i=typeof t?.id=="number"||((n=t.id)==null?void 0:n.length)>0?t.id:ok++,s=this.toasts.find(u=>u.id===i),c=t.dismissible===void 0?!0:t.dismissible;return this.dismissedToasts.has(i)&&this.dismissedToasts.delete(i),s?this.toasts=this.toasts.map(u=>u.id===i?(this.publish({...u,...t,id:i,title:r}),{...u,...t,id:i,dismissible:c,title:r}):u):this.addToast({title:r,...a,dismissible:c,id:i}),i},this.dismiss=t=>(t?(this.dismissedToasts.add(t),requestAnimationFrame(()=>this.subscribers.forEach(n=>n({id:t,dismiss:!0})))):this.toasts.forEach(n=>{this.subscribers.forEach(r=>r({id:n.id,dismiss:!0}))}),t),this.message=(t,n)=>this.create({...n,message:t}),this.error=(t,n)=>this.create({...n,message:t,type:"error"}),this.success=(t,n)=>this.create({...n,type:"success",message:t}),this.info=(t,n)=>this.create({...n,type:"info",message:t}),this.warning=(t,n)=>this.create({...n,type:"warning",message:t}),this.loading=(t,n)=>this.create({...n,type:"loading",message:t}),this.promise=(t,n)=>{if(!n)return;let r;n.loading!==void 0&&(r=this.create({...n,promise:t,type:"loading",message:n.loading,description:typeof n.description!="function"?n.description:void 0}));const a=Promise.resolve(t instanceof Function?t():t);let i=r!==void 0,s;const c=a.then(async d=>{if(s=["resolve",d],se.isValidElement(d))i=!1,this.create({id:r,type:"default",message:d});else if(sEe(d)&&!d.ok){i=!1;const h=typeof n.error=="function"?await n.error(`HTTP error! status: ${d.status}`):n.error,v=typeof n.description=="function"?await n.description(`HTTP error! status: ${d.status}`):n.description,E=typeof h=="object"&&!se.isValidElement(h)?h:{message:h};this.create({id:r,type:"error",description:v,...E})}else if(d instanceof Error){i=!1;const h=typeof n.error=="function"?await n.error(d):n.error,v=typeof n.description=="function"?await n.description(d):n.description,E=typeof h=="object"&&!se.isValidElement(h)?h:{message:h};this.create({id:r,type:"error",description:v,...E})}else if(n.success!==void 0){i=!1;const h=typeof n.success=="function"?await n.success(d):n.success,v=typeof n.description=="function"?await n.description(d):n.description,E=typeof h=="object"&&!se.isValidElement(h)?h:{message:h};this.create({id:r,type:"success",description:v,...E})}}).catch(async d=>{if(s=["reject",d],n.error!==void 0){i=!1;const p=typeof n.error=="function"?await n.error(d):n.error,h=typeof n.description=="function"?await n.description(d):n.description,y=typeof p=="object"&&!se.isValidElement(p)?p:{message:p};this.create({id:r,type:"error",description:h,...y})}}).finally(()=>{i&&(this.dismiss(r),r=void 0),n.finally==null||n.finally.call(n)}),u=()=>new Promise((d,p)=>c.then(()=>s[0]==="reject"?p(s[1]):d(s[1])).catch(p));return typeof r!="string"&&typeof r!="number"?{unwrap:u}:Object.assign(r,{unwrap:u})},this.custom=(t,n)=>{const r=n?.id||ok++;return this.create({jsx:t(r),id:r,...n}),r},this.getActiveToasts=()=>this.toasts.filter(t=>!this.dismissedToasts.has(t.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}}const Ur=new iEe,oEe=(e,t)=>{const n=t?.id||ok++;return Ur.addToast({title:e,...t,id:n}),n},sEe=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",lEe=oEe,cEe=()=>Ur.toasts,uEe=()=>Ur.getActiveToasts(),sn=Object.assign(lEe,{success:Ur.success,info:Ur.info,warning:Ur.warning,error:Ur.error,custom:Ur.custom,message:Ur.message,promise:Ur.promise,dismiss:Ur.dismiss,loading:Ur.loading},{getHistory:cEe,getToasts:uEe});YSe("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");function Bh(e){return e.label!==void 0}const dEe=3,fEe="24px",pEe="16px",IU=4e3,mEe=356,hEe=14,gEe=45,vEe=200;function mi(...e){return e.filter(Boolean).join(" ")}function bEe(e){const[t,n]=e.split("-"),r=[];return t&&r.push(t),n&&r.push(n),r}const yEe=e=>{var t,n,r,a,i,s,c,u,d;const{invert:p,toast:h,unstyled:v,interacting:y,setHeights:E,visibleToasts:x,heights:_,index:S,toasts:w,expanded:T,removeToast:k,defaultRichColors:N,closeButton:A,style:C,cancelButtonStyle:O,actionButtonStyle:L,className:F="",descriptionClassName:z="",duration:K,position:ee,gap:J,expandByDefault:le,classNames:q,icons:Z,closeButtonAriaLabel:G="Close toast"}=e,[ie,te]=se.useState(null),[P,B]=se.useState(null),[j,$]=se.useState(!1),[U,H]=se.useState(!1),[W,X]=se.useState(!1),[de,ue]=se.useState(!1),[Y,Q]=se.useState(!1),[oe,ae]=se.useState(0),[Re,Ae]=se.useState(0),Ye=se.useRef(h.duration||K||IU),Ee=se.useRef(null),Ne=se.useRef(null),ze=S===0,he=S+1<=x,je=h.type,Ze=h.dismissible!==!1,Se=h.className||"",ot=h.descriptionClassName||"",ut=se.useMemo(()=>_.findIndex(ct=>ct.toastId===h.id)||0,[_,h.id]),tt=se.useMemo(()=>{var ct;return(ct=h.closeButton)!=null?ct:A},[h.closeButton,A]),Oe=se.useMemo(()=>h.duration||K||IU,[h.duration,K]),Me=se.useRef(0),dt=se.useRef(0),Bt=se.useRef(0),De=se.useRef(null),[ke,Fe]=ee.split("-"),vt=se.useMemo(()=>_.reduce((ct,Kt,an)=>an>=ut?ct:ct+Kt.height,0),[_,ut]),gt=aEe(),Lt=h.invert||p,qt=je==="loading";dt.current=se.useMemo(()=>ut*J+vt,[ut,vt]),se.useEffect(()=>{Ye.current=Oe},[Oe]),se.useEffect(()=>{$(!0)},[]),se.useEffect(()=>{const ct=Ne.current;if(ct){const Kt=ct.getBoundingClientRect().height;return Ae(Kt),E(an=>[{toastId:h.id,height:Kt,position:h.position},...an]),()=>E(an=>an.filter(Dn=>Dn.toastId!==h.id))}},[E,h.id]),se.useLayoutEffect(()=>{if(!j)return;const ct=Ne.current,Kt=ct.style.height;ct.style.height="auto";const an=ct.getBoundingClientRect().height;ct.style.height=Kt,Ae(an),E(Dn=>Dn.find(gn=>gn.toastId===h.id)?Dn.map(gn=>gn.toastId===h.id?{...gn,height:an}:gn):[{toastId:h.id,height:an,position:h.position},...Dn])},[j,h.title,h.description,E,h.id,h.jsx,h.action,h.cancel]);const Ct=se.useCallback(()=>{H(!0),ae(dt.current),E(ct=>ct.filter(Kt=>Kt.toastId!==h.id)),setTimeout(()=>{k(h)},vEe)},[h,k,E,dt]);se.useEffect(()=>{if(h.promise&&je==="loading"||h.duration===1/0||h.type==="loading")return;let ct;return T||y||gt?(()=>{if(Bt.current<Me.current){const Dn=new Date().getTime()-Me.current;Ye.current=Ye.current-Dn}Bt.current=new Date().getTime()})():(()=>{Ye.current!==1/0&&(Me.current=new Date().getTime(),ct=setTimeout(()=>{h.onAutoClose==null||h.onAutoClose.call(h,h),Ct()},Ye.current))})(),()=>clearTimeout(ct)},[T,y,h,je,gt,Ct]),se.useEffect(()=>{h.delete&&(Ct(),h.onDismiss==null||h.onDismiss.call(h,h))},[Ct,h.delete]);function Pt(){var ct;if(Z?.loading){var Kt;return se.createElement("div",{className:mi(q?.loader,h==null||(Kt=h.classNames)==null?void 0:Kt.loader,"sonner-loader"),"data-visible":je==="loading"},Z.loading)}return se.createElement(JSe,{className:mi(q?.loader,h==null||(ct=h.classNames)==null?void 0:ct.loader),visible:je==="loading"})}const pn=h.icon||Z?.[je]||ZSe(je);var Rn,en;return se.createElement("li",{tabIndex:0,ref:Ne,className:mi(F,Se,q?.toast,h==null||(t=h.classNames)==null?void 0:t.toast,q?.default,q?.[je],h==null||(n=h.classNames)==null?void 0:n[je]),"data-sonner-toast":"","data-rich-colors":(Rn=h.richColors)!=null?Rn:N,"data-styled":!(h.jsx||h.unstyled||v),"data-mounted":j,"data-promise":!!h.promise,"data-swiped":Y,"data-removed":U,"data-visible":he,"data-y-position":ke,"data-x-position":Fe,"data-index":S,"data-front":ze,"data-swiping":W,"data-dismissible":Ze,"data-type":je,"data-invert":Lt,"data-swipe-out":de,"data-swipe-direction":P,"data-expanded":!!(T||le&&j),"data-testid":h.testId,style:{"--index":S,"--toasts-before":S,"--z-index":w.length-S,"--offset":`${U?oe:dt.current}px`,"--initial-height":le?"auto":`${Re}px`,...C,...h.style},onDragEnd:()=>{X(!1),te(null),De.current=null},onPointerDown:ct=>{ct.button!==2&&(qt||!Ze||(Ee.current=new Date,ae(dt.current),ct.target.setPointerCapture(ct.pointerId),ct.target.tagName!=="BUTTON"&&(X(!0),De.current={x:ct.clientX,y:ct.clientY})))},onPointerUp:()=>{var ct,Kt,an;if(de||!Ze)return;De.current=null;const Dn=Number(((ct=Ne.current)==null?void 0:ct.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),li=Number(((Kt=Ne.current)==null?void 0:Kt.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),gn=new Date().getTime()-((an=Ee.current)==null?void 0:an.getTime()),ne=ie==="x"?Dn:li,pe=Math.abs(ne)/gn;if(Math.abs(ne)>=gEe||pe>.11){ae(dt.current),h.onDismiss==null||h.onDismiss.call(h,h),B(ie==="x"?Dn>0?"right":"left":li>0?"down":"up"),Ct(),ue(!0);return}else{var be,Ie;(be=Ne.current)==null||be.style.setProperty("--swipe-amount-x","0px"),(Ie=Ne.current)==null||Ie.style.setProperty("--swipe-amount-y","0px")}Q(!1),X(!1),te(null)},onPointerMove:ct=>{var Kt,an,Dn;if(!De.current||!Ze||((Kt=window.getSelection())==null?void 0:Kt.toString().length)>0)return;const gn=ct.clientY-De.current.y,ne=ct.clientX-De.current.x;var pe;const be=(pe=e.swipeDirections)!=null?pe:bEe(ee);!ie&&(Math.abs(ne)>1||Math.abs(gn)>1)&&te(Math.abs(ne)>Math.abs(gn)?"x":"y");let Ie={x:0,y:0};const Ue=Ve=>1/(1.5+Math.abs(Ve)/20);if(ie==="y"){if(be.includes("top")||be.includes("bottom"))if(be.includes("top")&&gn<0||be.includes("bottom")&&gn>0)Ie.y=gn;else{const Ve=gn*Ue(gn);Ie.y=Math.abs(Ve)<Math.abs(gn)?Ve:gn}}else if(ie==="x"&&(be.includes("left")||be.includes("right")))if(be.includes("left")&&ne<0||be.includes("right")&&ne>0)Ie.x=ne;else{const Ve=ne*Ue(ne);Ie.x=Math.abs(Ve)<Math.abs(ne)?Ve:ne}(Math.abs(Ie.x)>0||Math.abs(Ie.y)>0)&&Q(!0),(an=Ne.current)==null||an.style.setProperty("--swipe-amount-x",`${Ie.x}px`),(Dn=Ne.current)==null||Dn.style.setProperty("--swipe-amount-y",`${Ie.y}px`)}},tt&&!h.jsx&&je!=="loading"?se.createElement("button",{"aria-label":G,"data-disabled":qt,"data-close-button":!0,onClick:qt||!Ze?()=>{}:()=>{Ct(),h.onDismiss==null||h.onDismiss.call(h,h)},className:mi(q?.closeButton,h==null||(r=h.classNames)==null?void 0:r.closeButton)},(en=Z?.close)!=null?en:rEe):null,(je||h.icon||h.promise)&&h.icon!==null&&(Z?.[je]!==null||h.icon)?se.createElement("div",{"data-icon":"",className:mi(q?.icon,h==null||(a=h.classNames)==null?void 0:a.icon)},h.promise||h.type==="loading"&&!h.icon?h.icon||Pt():null,h.type!=="loading"?pn:null):null,se.createElement("div",{"data-content":"",className:mi(q?.content,h==null||(i=h.classNames)==null?void 0:i.content)},se.createElement("div",{"data-title":"",className:mi(q?.title,h==null||(s=h.classNames)==null?void 0:s.title)},h.jsx?h.jsx:typeof h.title=="function"?h.title():h.title),h.description?se.createElement("div",{"data-description":"",className:mi(z,ot,q?.description,h==null||(c=h.classNames)==null?void 0:c.description)},typeof h.description=="function"?h.description():h.description):null),se.isValidElement(h.cancel)?h.cancel:h.cancel&&Bh(h.cancel)?se.createElement("button",{"data-button":!0,"data-cancel":!0,style:h.cancelButtonStyle||O,onClick:ct=>{Bh(h.cancel)&&Ze&&(h.cancel.onClick==null||h.cancel.onClick.call(h.cancel,ct),Ct())},className:mi(q?.cancelButton,h==null||(u=h.classNames)==null?void 0:u.cancelButton)},h.cancel.label):null,se.isValidElement(h.action)?h.action:h.action&&Bh(h.action)?se.createElement("button",{"data-button":!0,"data-action":!0,style:h.actionButtonStyle||L,onClick:ct=>{Bh(h.action)&&(h.action.onClick==null||h.action.onClick.call(h.action,ct),!ct.defaultPrevented&&Ct())},className:mi(q?.actionButton,h==null||(d=h.classNames)==null?void 0:d.actionButton)},h.action.label):null)};function OU(){if(typeof window>"u"||typeof document>"u")return"ltr";const e=document.documentElement.getAttribute("dir");return e==="auto"||!e?window.getComputedStyle(document.documentElement).direction:e}function wEe(e,t){const n={};return[e,t].forEach((r,a)=>{const i=a===1,s=i?"--mobile-offset":"--offset",c=i?pEe:fEe;function u(d){["top","right","bottom","left"].forEach(p=>{n[`${s}-${p}`]=typeof d=="number"?`${d}px`:d})}typeof r=="number"||typeof r=="string"?u(r):typeof r=="object"?["top","right","bottom","left"].forEach(d=>{r[d]===void 0?n[`${s}-${d}`]=c:n[`${s}-${d}`]=typeof r[d]=="number"?`${r[d]}px`:r[d]}):u(c)}),n}const SEe=se.forwardRef(function(t,n){const{id:r,invert:a,position:i="bottom-right",hotkey:s=["altKey","KeyT"],expand:c,closeButton:u,className:d,offset:p,mobileOffset:h,theme:v="light",richColors:y,duration:E,style:x,visibleToasts:_=dEe,toastOptions:S,dir:w=OU(),gap:T=hEe,icons:k,containerAriaLabel:N="Notifications"}=t,[A,C]=se.useState([]),O=se.useMemo(()=>r?A.filter(j=>j.toasterId===r):A.filter(j=>!j.toasterId),[A,r]),L=se.useMemo(()=>Array.from(new Set([i].concat(O.filter(j=>j.position).map(j=>j.position)))),[O,i]),[F,z]=se.useState([]),[K,ee]=se.useState(!1),[J,le]=se.useState(!1),[q,Z]=se.useState(v!=="system"?v:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),G=se.useRef(null),ie=s.join("+").replace(/Key/g,"").replace(/Digit/g,""),te=se.useRef(null),P=se.useRef(!1),B=se.useCallback(j=>{C($=>{var U;return(U=$.find(H=>H.id===j.id))!=null&&U.delete||Ur.dismiss(j.id),$.filter(({id:H})=>H!==j.id)})},[]);return se.useEffect(()=>Ur.subscribe(j=>{if(j.dismiss){requestAnimationFrame(()=>{C($=>$.map(U=>U.id===j.id?{...U,delete:!0}:U))});return}setTimeout(()=>{_7.flushSync(()=>{C($=>{const U=$.findIndex(H=>H.id===j.id);return U!==-1?[...$.slice(0,U),{...$[U],...j},...$.slice(U+1)]:[j,...$]})})})}),[A]),se.useEffect(()=>{if(v!=="system"){Z(v);return}if(v==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?Z("dark"):Z("light")),typeof window>"u")return;const j=window.matchMedia("(prefers-color-scheme: dark)");try{j.addEventListener("change",({matches:$})=>{Z($?"dark":"light")})}catch{j.addListener(({matches:U})=>{try{Z(U?"dark":"light")}catch(H){console.error(H)}})}},[v]),se.useEffect(()=>{A.length<=1&&ee(!1)},[A]),se.useEffect(()=>{const j=$=>{var U;if(s.every(X=>$[X]||$.code===X)){var W;ee(!0),(W=G.current)==null||W.focus()}$.code==="Escape"&&(document.activeElement===G.current||(U=G.current)!=null&&U.contains(document.activeElement))&&ee(!1)};return document.addEventListener("keydown",j),()=>document.removeEventListener("keydown",j)},[s]),se.useEffect(()=>{if(G.current)return()=>{te.current&&(te.current.focus({preventScroll:!0}),te.current=null,P.current=!1)}},[G.current]),se.createElement("section",{ref:n,"aria-label":`${N} ${ie}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},L.map((j,$)=>{var U;const[H,W]=j.split("-");return O.length?se.createElement("ol",{key:j,dir:w==="auto"?OU():w,tabIndex:-1,ref:G,className:d,"data-sonner-toaster":!0,"data-sonner-theme":q,"data-y-position":H,"data-x-position":W,style:{"--front-toast-height":`${((U=F[0])==null?void 0:U.height)||0}px`,"--width":`${mEe}px`,"--gap":`${T}px`,...x,...wEe(p,h)},onBlur:X=>{P.current&&!X.currentTarget.contains(X.relatedTarget)&&(P.current=!1,te.current&&(te.current.focus({preventScroll:!0}),te.current=null))},onFocus:X=>{X.target instanceof HTMLElement&&X.target.dataset.dismissible==="false"||P.current||(P.current=!0,te.current=X.relatedTarget)},onMouseEnter:()=>ee(!0),onMouseMove:()=>ee(!0),onMouseLeave:()=>{J||ee(!1)},onDragEnd:()=>ee(!1),onPointerDown:X=>{X.target instanceof HTMLElement&&X.target.dataset.dismissible==="false"||le(!0)},onPointerUp:()=>le(!1)},O.filter(X=>!X.position&&$===0||X.position===j).map((X,de)=>{var ue,Y;return se.createElement(yEe,{key:X.id,icons:k,index:de,toast:X,defaultRichColors:y,duration:(ue=S?.duration)!=null?ue:E,className:S?.className,descriptionClassName:S?.descriptionClassName,invert:a,visibleToasts:_,closeButton:(Y=S?.closeButton)!=null?Y:u,interacting:J,position:j,style:S?.style,unstyled:S?.unstyled,classNames:S?.classNames,cancelButtonStyle:S?.cancelButtonStyle,actionButtonStyle:S?.actionButtonStyle,closeButtonAriaLabel:S?.closeButtonAriaLabel,removeToast:B,toasts:O.filter(Q=>Q.position==X.position),heights:F.filter(Q=>Q.position==X.position),setHeights:z,expandByDefault:c,gap:T,expanded:K,swipeDirections:t.swipeDirections})})):null}))});var pb="Dialog",[qY]=oi(pb),[EEe,si]=qY(pb),HY=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:a,onOpenChange:i,modal:s=!0}=e,c=b.useRef(null),u=b.useRef(null),[d,p]=fo({prop:r,defaultProp:a??!1,onChange:i,caller:pb});return m.jsx(EEe,{scope:t,triggerRef:c,contentRef:u,contentId:fr(),titleId:fr(),descriptionId:fr(),open:d,onOpenChange:p,onOpenToggle:b.useCallback(()=>p(h=>!h),[p]),modal:s,children:n})};HY.displayName=pb;var VY="DialogTrigger",GY=b.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,a=si(VY,n),i=Ft(t,a.triggerRef);return m.jsx(Et.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.contentId,"data-state":s1(a.open),...r,ref:i,onClick:He(e.onClick,a.onOpenToggle)})});GY.displayName=VY;var i1="DialogPortal",[_Ee,WY]=qY(i1,{forceMount:void 0}),KY=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:a}=e,i=si(i1,t);return m.jsx(_Ee,{scope:t,forceMount:n,children:b.Children.map(r,s=>m.jsx(ua,{present:n||i.open,children:m.jsx(Bu,{asChild:!0,container:a,children:s})}))})};KY.displayName=i1;var nv="DialogOverlay",YY=b.forwardRef((e,t)=>{const n=WY(nv,e.__scopeDialog),{forceMount:r=n.forceMount,...a}=e,i=si(nv,e.__scopeDialog);return i.modal?m.jsx(ua,{present:r||i.open,children:m.jsx(TEe,{...a,ref:t})}):null});YY.displayName=nv;var xEe=hl("DialogOverlay.RemoveScroll"),TEe=b.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,a=si(nv,n);return m.jsx(vp,{as:xEe,allowPinchZoom:!0,shards:[a.contentRef],children:m.jsx(Et.div,{"data-state":s1(a.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),wl="DialogContent",ZY=b.forwardRef((e,t)=>{const n=WY(wl,e.__scopeDialog),{forceMount:r=n.forceMount,...a}=e,i=si(wl,e.__scopeDialog);return m.jsx(ua,{present:r||i.open,children:i.modal?m.jsx(REe,{...a,ref:t}):m.jsx(NEe,{...a,ref:t})})});ZY.displayName=wl;var REe=b.forwardRef((e,t)=>{const n=si(wl,e.__scopeDialog),r=b.useRef(null),a=Ft(t,n.contentRef,r);return b.useEffect(()=>{const i=r.current;if(i)return tb(i)},[]),m.jsx(XY,{...e,ref:a,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:He(e.onCloseAutoFocus,i=>{i.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:He(e.onPointerDownOutside,i=>{const s=i.detail.originalEvent,c=s.button===0&&s.ctrlKey===!0;(s.button===2||c)&&i.preventDefault()}),onFocusOutside:He(e.onFocusOutside,i=>i.preventDefault())})}),NEe=b.forwardRef((e,t)=>{const n=si(wl,e.__scopeDialog),r=b.useRef(!1),a=b.useRef(!1);return m.jsx(XY,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{e.onCloseAutoFocus?.(i),i.defaultPrevented||(r.current||n.triggerRef.current?.focus(),i.preventDefault()),r.current=!1,a.current=!1},onInteractOutside:i=>{e.onInteractOutside?.(i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(a.current=!0));const s=i.target;n.triggerRef.current?.contains(s)&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&a.current&&i.preventDefault()}})}),XY=b.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:a,onCloseAutoFocus:i,...s}=e,c=si(wl,n),u=b.useRef(null),d=Ft(t,u);return Wv(),m.jsxs(m.Fragment,{children:[m.jsx(pp,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:a,onUnmountAutoFocus:i,children:m.jsx(Uu,{role:"dialog",id:c.contentId,"aria-describedby":c.descriptionId,"aria-labelledby":c.titleId,"data-state":s1(c.open),...s,ref:d,onDismiss:()=>c.onOpenChange(!1)})}),m.jsxs(m.Fragment,{children:[m.jsx(kEe,{titleId:c.titleId}),m.jsx(AEe,{contentRef:u,descriptionId:c.descriptionId})]})]})}),o1="DialogTitle",JY=b.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,a=si(o1,n);return m.jsx(Et.h2,{id:a.titleId,...r,ref:t})});JY.displayName=o1;var QY="DialogDescription",eZ=b.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,a=si(QY,n);return m.jsx(Et.p,{id:a.descriptionId,...r,ref:t})});eZ.displayName=QY;var tZ="DialogClose",nZ=b.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,a=si(tZ,n);return m.jsx(Et.button,{type:"button",...r,ref:t,onClick:He(e.onClick,()=>a.onOpenChange(!1))})});nZ.displayName=tZ;function s1(e){return e?"open":"closed"}var rZ="DialogTitleWarning",[hUe,aZ]=yhe(rZ,{contentName:wl,titleName:o1,docsSlug:"dialog"}),kEe=({titleId:e})=>{const t=aZ(rZ),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
|
|
134
134
|
|
|
135
135
|
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
136
136
|
|
|
@@ -1611,7 +1611,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
1611
1611
|
<\/script>
|
|
1612
1612
|
</body>
|
|
1613
1613
|
</html>`,KQ=1,uq=2,YQ=3,dq=4,ZQ=5,fq=Symbol.for("quilt.threads.serialize"),YMe=Symbol.for("quilt.threads.transferable");class ZMe extends AbortController{constructor(...t){super();const n=t.find(r=>r.aborted);if(n)this.abort(n.reason);else{const r=i=>this.abort(i.target.reason),a={signal:this.signal};for(const i of t)i.addEventListener("abort",r,a)}}}class pq extends Error{constructor(){super("You attempted to call a function on a closed thread.")}}let XMe="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";function XQ(e=21){let t="",n=crypto.getRandomValues(new Uint8Array(e));for(let r=0;r<e;r++)t+=XMe[63&n[r]];return t}var af,kc,of,wg,qk,JQ;class JMe{constructor(){Ya(this,qk),Ya(this,af,new Map),Ya(this,kc,new Map),Ya(this,of,new Map),Ya(this,wg,new WeakMap)}get(t){return _n(this,kc).get(t)}release(t){const n=_n(this,kc).get(t);return n&&(_n(this,kc).delete(t),_n(this,af).delete(n)),!!n}serialize(t){let n=_n(this,af).get(t);return n==null&&(n=XQ(),_n(this,af).set(t,n),_n(this,kc).set(n,t)),n}deserialize(t,n){var r,a;let i=(r=_n(this,of).get(t))==null?void 0:r.deref();return i||(i=(...s)=>{if(!_n(this,of).has(t))throw new Error("You attempted to call a function that was already revoked.");return n.call((c,u,d)=>{n.messages.send([YQ,c,t,u],d)},s)},(a=cr(this,qk,JQ).call(this,n))==null||a.register(i,t),_n(this,of).set(t,new WeakRef(i)),i)}}af=new WeakMap,kc=new WeakMap,of=new WeakMap,wg=new WeakMap,qk=new WeakSet,JQ=function(e){let t=_n(this,wg).get(e);if(!(typeof FinalizationRegistry>"u"))return t||(t=new FinalizationRegistry(n=>{e.messages.send([ZQ,n])}),_n(this,wg).set(e,t)),t};function QMe(e){return e!=null&&(Symbol.asyncIterator in e||Symbol.iterator in e)&&typeof e.next=="function"}function mq(e){if(e==null||typeof e!="object")return!1;const t=Object.getPrototypeOf(e);return t==null||t===Object.prototype}const VR="_@f",hq="_@i";var _f,xf,Ra,Sg,Jo;class eje{constructor(t){Ya(this,Ra),Ya(this,_f),Ya(this,xf),Fk(this,_f,t?.serialize),Fk(this,xf,t?.deserialize)}serialize(t,n,r){return cr(this,Ra,Sg).call(this,t,n,r)}deserialize(t,n){return cr(this,Ra,Jo).call(this,t,n)}}_f=new WeakMap,xf=new WeakMap,Ra=new WeakSet,Sg=function(e,t,n,r=new Map,a=!1){if(e==null)return e;if(r.has(e))return r.get(e);if(r.set(e,void 0),typeof e=="object"){if(_n(this,_f)&&!a){const c=_n(this,_f).call(this,e,u=>cr(this,Ra,Sg).call(this,u,t,n,r,!0),t,n);if(c!==void 0)return r.set(e,c),c}if(e[YMe])return n?.push(e),r.set(e,e),e;const i=c=>cr(this,Ra,Sg).call(this,c,t,n,r);if(typeof e[fq]=="function"){const c=e[fq]({serialize:i});return r.set(e,c),c}if(Array.isArray(e)){const c=e.map(u=>i(u));return r.set(e,c),c}if(e instanceof Map){const c=[...e.entries()].map(([d,p])=>[i(d),i(p)]),u=new Map(c);return r.set(e,u),u}if(e instanceof Set){const c=[...e].map(d=>i(d)),u=new Set(c);return r.set(e,u),u}const s=QMe(e);if(mq(e)||s){const c={};for(const u of Object.keys(e))c[u]=i(e[u]);return s&&(c.next??(c.next=i(e.next.bind(e))),c.return??(c.return=i(e.return.bind(e))),c.throw??(c.throw=i(e.throw.bind(e))),c[hq]=!0),r.set(e,c),c}}if(typeof e=="function"){const i=t.functions.serialize(e,t,n),s={[VR]:i};return r.set(e,s),s}return r.set(e,e),e},Jo=function(e,t,n=!1){if(e==null)return e;if(typeof e=="object"){if(_n(this,xf)&&!n){const a=_n(this,xf).call(this,e,i=>cr(this,Ra,Jo).call(this,i,t,!0),t);if(a!==void 0)return a}if(e==null)return e;if(Array.isArray(e))return e.map(a=>cr(this,Ra,Jo).call(this,a,t));if(e instanceof Map)return new Map([...e].map(([a,i])=>[cr(this,Ra,Jo).call(this,a,t),cr(this,Ra,Jo).call(this,i,t)]));if(e instanceof Set)return new Set([...e].map(a=>cr(this,Ra,Jo).call(this,a,t)));if(VR in e)return t.functions.deserialize(e[VR],t);if(!mq(e))return e;const r={};for(const a of Object.keys(e))a===hq?r[Symbol.asyncIterator]=()=>r:r[a]=cr(this,Ra,Jo).call(this,e[a],t);return r}return e};var Cc,al,Qo,Hk,QQ,Vk,eee;class tje{constructor(t,{imports:n,exports:r,functions:a=new JMe,serialization:i=new eje,signal:s}={}){Ya(this,Qo),Ya(this,Cc),Ya(this,al,new Map);var c,u,d,p;this.messages=t,Fk(this,Cc,s?new ZMe(s):new AbortController),this.exports=r??{},this.imports=nje(cr(this,Qo,QQ).bind(this),n),this.functions=a,this.serialization=i,(u=(c=this.functions).start)==null||u.call(c,this),(p=(d=this.serialization).start)==null||p.call(d,this),this.signal.addEventListener("abort",()=>{for(const h of _n(this,al).keys())cr(this,Qo,Vk).call(this,h,void 0,new pq);_n(this,al).clear()},{once:!0}),t.listen(async h=>{if(!(Array.isArray(h)&&typeof h[0]=="number"))return;const v=h;switch(v[0]){case KQ:{const[,y,E,x]=v,_=this.exports[E]??(()=>{throw new Error(`No '${E}' method is exported from this thread`)});await cr(this,Qo,Hk).call(this,_,x,(S,w,T)=>{this.messages.send([uq,y,S,w],T)});break}case YQ:{const[,y,E,x]=v,_=this.functions.get(E,this)??rje;await cr(this,Qo,Hk).call(this,_,x,(S,w,T)=>{this.messages.send([dq,y,S,w],T)});break}case uq:case dq:{cr(this,Qo,Vk).call(this,...v.slice(1));break}case ZQ:{const y=v[1];this.functions.release(y,this);break}}},{signal:this.signal})}get signal(){return _n(this,Cc).signal}get closed(){return _n(this,Cc).signal.aborted}close(){_n(this,Cc).abort()}call(t,n){if(this.closed)return Promise.reject(new pq);const r=[],a=this.serialization.serialize(n,this,r),i=XQ(),s=cr(this,Qo,eee).call(this,i);return t(i,a,r),s}}Cc=new WeakMap,al=new WeakMap,Qo=new WeakSet,Hk=async function(e,t,n){try{const r=this.functions.call?await this.functions.call(e,t,this):await e(...this.serialization.deserialize(t,this)),a=[],i=this.serialization.serialize(r,this,a);n(i,void 0,a)}catch(r){n(void 0,this.serialization.serialize(r,this))}},QQ=function(e){return(...t)=>{try{if(typeof e!="string"&&typeof e!="number")throw new Error(`Can’t call a symbol method on a thread: ${e.toString()}`);return this.call((n,r,a)=>{this.messages.send([KQ,n,e,r],a)},t)}catch(n){return Promise.reject(n)}}},Vk=function(...e){const t=e[0],n=_n(this,al).get(t);n&&(n(...e),_n(this,al).delete(t))},eee=function(e){const t=new Promise((n,r)=>{_n(this,al).set(e,(a,i,s)=>{s==null?n(this.serialization.deserialize(i,this)):r(this.serialization.deserialize(s,this))})});return Object.defineProperty(t,Symbol.asyncIterator,{async*value(){const n=await t;Object.defineProperty(n,Symbol.asyncIterator,{value:()=>n}),yield*n}}),t};function nje(e,t){let n;if(t==null){if(typeof Proxy!="function")throw new Error("You must pass an array of callable methods in environments without Proxies.");const r=new Map;n=new Proxy({},{get(a,i){if(r.has(i))return r.get(i);const s=e(i);return r.set(i,s),s}})}else{n={};for(const r of t)Object.defineProperty(n,r,{value:e(r),writable:!1,configurable:!0,enumerable:!0})}return n}function rje(){throw new Error("You attempted to call a function that is not stored. It may have already been released.")}const aje="quilt.threads.ping",gq="quilt.threads.pong";function ije(e,{targetOrigin:t="*"}={}){let n=!1;const r=function(i,s){e.postMessage(i,t,s)},a=new Promise(i=>{const s=new AbortController;globalThis.window.addEventListener("message",c=>{c.source===e&&c.data===gq&&(n=!0,s.abort(),i())},{signal:s.signal}),s.signal.addEventListener("abort",()=>i(),{once:!0}),r(aje)});return{send(i,s){return n?r(i,s):a.then(()=>{if(n)return r(i,s)})},listen(i,{signal:s}){self.addEventListener("message",c=>{c.source===e&&c.data!==gq&&i(c.data)},{signal:s})}}}class oje extends tje{constructor(t,{targetOrigin:n="*",...r}={}){super(ije(t.contentWindow,{targetOrigin:n}),r),this.iframe=t}}const tee=se.forwardRef(({content:e,children:t,...n},r)=>m.jsx("span",{ref:r,...n,children:e||t}));tee.displayName="UIText";const nee=se.forwardRef(({label:e,onPress:t,onClick:n,children:r,...a},i)=>m.jsx("button",{ref:i,onClick:s=>{t&&t(),n&&n(s)},style:{padding:"8px 16px",backgroundColor:"#007bff",color:"white",border:"none",borderRadius:"4px",cursor:"pointer"},...a,children:e||r}));nee.displayName="UIButton";const ree=se.forwardRef(({direction:e="vertical",spacing:t="8",align:n="stretch",justify:r="flex-start",children:a,...i},s)=>m.jsx("div",{ref:s,style:{display:"flex",flexDirection:e==="horizontal"?"row":"column",gap:`${t}px`,alignItems:n,justifyContent:r},...i,children:a}));ree.displayName="UIStack";const aee=se.forwardRef(({src:e,alt:t,width:n,height:r,children:a,...i},s)=>m.jsx("img",{ref:s,src:e,alt:t,width:n,height:r,style:{maxWidth:"100%",height:"auto",borderRadius:"8px",boxShadow:"0 2px 8px rgba(0, 0, 0, 0.1)"},...i}));aee.displayName="UIImage";const vO={name:"basic",elements:[{tagName:"ui-text",component:tee,propMapping:{content:"content"},eventMapping:{}},{tagName:"ui-button",component:nee,propMapping:{label:"label"},eventMapping:{press:"onPress"}},{tagName:"ui-stack",component:ree,propMapping:{direction:"direction",spacing:"spacing",align:"align",justify:"justify"},eventMapping:{}},{tagName:"ui-image",component:aee,propMapping:{src:"src",alt:"alt",width:"width",height:"height"},eventMapping:{}}]},sje=({receiver:e})=>{const t=b.useRef(null);return b.useEffect(()=>{if(t.current)return e.connect(t.current),()=>{e.disconnect()}},[e]),m.jsx("div",{ref:t,"data-testid":"standard-dom-renderer-container"})},lje=({resource:e,library:t,remoteElements:n=[],onUIAction:r})=>{const a=b.useRef(null),i=b.useRef(null),[s,c]=b.useState(null),u=b.useMemo(()=>(e.mimeType||"").includes("framework=react")?"react":"webcomponents",[e.mimeType]),d=`${t?.name}-${u}`,{receiver:p,components:h}=b.useMemo(()=>{switch(u){case"react":{const y=new UMe,E=t||vO,x=new Map;return E&&E.elements.forEach(_=>{const S=VMe(_.component);x.set(_.tagName,S)}),{receiver:y,components:x}}case"webcomponents":default:return{receiver:new zMe,components:null}}},[e,t,n]);b.useEffect(()=>{function y(E){var x;if(a.current&&E.source===a.current.contentWindow){const _=E.data;if(!_)return;(x=r?.(_))==null||x.catch(S=>{console.error("Error handling UI action result in RemoteDOMResourceRenderer:",S)})}}return window.addEventListener("message",y),()=>window.removeEventListener("message",y)},[r]),b.useEffect(()=>{const y=i.current;return i.current=null,()=>{y?.close()}},[d]);const v=()=>{const y=a.current;if(!y||i.current)return;const E=new oje(y);i.current=E;const{code:x,error:_}=AMe(e);if(_){c(_);return}if(x&&p!=null&&p.connection){const S={code:x,remoteElements:n,useReactRenderer:u==="react",componentLibrary:t?.name};E.imports.render(S,p.connection).catch(w=>console.error("Error calling remote render:",w))}};return s?m.jsx("p",{className:"text-red-500",children:s}):m.jsxs(m.Fragment,{children:[m.jsx("iframe",{ref:a,srcDoc:KMe,sandbox:"allow-scripts",style:{display:"none"},title:"Remote DOM Sandbox",onLoad:v},d),u==="react"&&h?m.jsx(WMe,{receiver:p,components:h}):m.jsx(sje,{receiver:p})]})};function cje(e){var t;if(e.contentType)return e.contentType;if(e.mimeType==="text/html")return"rawHtml";if(e.mimeType==="text/uri-list")return"externalUrl";if((t=e.mimeType)!=null&&t.startsWith("application/vnd.mcp-ui.remote-dom"))return"remoteDom"}const bO=e=>{const{resource:t,onUIAction:n,supportedContentTypes:r,htmlProps:a,remoteDomProps:i}=e,s=cje(t);if(r&&s&&!r.includes(s))return m.jsxs("p",{className:"text-red-500",children:["Unsupported content type: ",s,"."]});switch(s){case"rawHtml":case"externalUrl":return m.jsx(BQ,{resource:t,onUIAction:n,...a});case"remoteDom":return m.jsx(lje,{resource:t,onUIAction:n,library:i?.library||vO,...i});default:return m.jsx("p",{className:"text-red-500",children:"Unsupported resource type."})}};bO.displayName="UIResourceRenderer";const uje={tagName:"ui-button",remoteAttributes:["label"],remoteEvents:["click","press"]},dje={tagName:"ui-text",remoteAttributes:["content"]},fje={tagName:"ui-stack",remoteAttributes:["direction","spacing","align","justify"]},pje={tagName:"ui-image",remoteAttributes:["src","alt","width","height"]},mje=b.memo(({resource:e})=>{const t=async n=>(n.type==="tool"||n.type==="prompt"||(n.type==="link"?n.payload.url&&window.open(n.payload.url,"_blank"):n.type==="intent"||n.type),{status:"Action received"});return e.uri?.startsWith("ui://")?m.jsx("div",{className:"my-4 p-0 border h-[350px] rounded-2xl border-zinc-200 overflow-hidden bg-card",children:m.jsx(bO,{resource:e,onUIAction:t,htmlProps:{style:{maxWidth:"100%",height:"100%",overflow:"auto"},autoResizeIframe:!0,sandboxPermissions:"allow-scripts allow-same-origin allow-forms allow-popups allow-popups-to-escape-sandbox"}})}):null});function vq({toolName:e,toolArgs:t,result:n,serverId:r,readResource:a}){const[i,s]=b.useState(null),c=b.useMemo(()=>{if(typeof n=="string")try{return JSON.parse(n)}catch(h){return console.error("[ToolResultRenderer] Failed to parse result:",h),n}return n},[n]),u=b.useMemo(()=>!!(c?.content&&Array.isArray(c.content)&&c.content.some(h=>h.type==="resource"&&h.resource?.uri?.startsWith("ui://")&&h.resource?.mimeType==="text/html+skybridge")),[c]),d=b.useMemo(()=>u&&c.content.find(v=>v.type==="resource"&&v.resource?.uri?.startsWith("ui://")&&v.resource?.mimeType==="text/html+skybridge")?.resource||null,[u,c]);if(b.useEffect(()=>{(()=>{d&&s(d)})()},[d]),u&&i&&r&&a)return m.jsx(fO,{componentUrl:i.uri,toolName:e,toolArgs:t,toolResult:c,serverId:r,readResource:a,noWrapper:!0,className:"my-4",showConsole:!1});if(u&&!i)return m.jsx("div",{className:"my-4 p-4 bg-blue-50/30 dark:bg-blue-950/20 border border-blue-200/50 dark:border-blue-800/50 rounded-lg",children:m.jsx("p",{className:"text-sm text-blue-600 dark:text-blue-400",children:"Loading component..."})});const p=[];if(c?.content&&Array.isArray(c.content))for(const h of c.content)h.type==="resource"&&h.resource?.uri?.startsWith("ui://")&&h.resource?.mimeType!=="text/html+skybridge"&&p.push(h.resource);return p.length>0?m.jsx(m.Fragment,{children:p.map(h=>m.jsx(mje,{resource:h},`${e}-mcp-ui-${h.uri}`))}):null}function hje({content:e,timestamp:t}){return!e||e.length===0?null:m.jsx("div",{className:"flex items-start gap-3 justify-end group/user-message",children:m.jsxs("div",{className:"flex-1 min-w-0 flex flex-col items-end",children:[m.jsx("div",{className:"bg-zinc-200 dark:bg-zinc-800 text-primary rounded-3xl px-4 py-2 max-w-[80%] break-words",children:m.jsx("p",{className:"text-base leading-7 font-sans text-start break-words",children:e})}),t&&m.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:new Date(t).toLocaleTimeString()})]})})}const gje=b.memo(({messages:e,isLoading:t,serverId:n,readResource:r})=>{const a=b.useRef(null);b.useEffect(()=>{e.length>0&&a.current&&a.current.scrollIntoView({behavior:t?"auto":"smooth",block:"start"})},[e.length,t]);const i=t&&(()=>{if(e.length===0)return!0;const c=e[e.length-1];if(c.role==="user")return!0;if(c.role==="assistant"){const u=typeof c.content=="string"?c.content:Array.isArray(c.content)?c.content.map(p=>typeof p=="string"?p:p.text||JSON.stringify(p)).join(""):JSON.stringify(c.content);return!(u&&u.trim().length>0)}return!1})(),s=c=>{if(!t)return!1;const u=e[e.length-1];return c.id===u.id&&u.role==="assistant"};return m.jsxs("div",{className:"space-y-6 max-w-3xl mx-auto px-2",children:[e.map(c=>{const u=typeof c.content=="string"?c.content:Array.isArray(c.content)?c.content.map(d=>typeof d=="string"?d:d.text||JSON.stringify(d)).join(""):JSON.stringify(c.content);return c.role==="user"?m.jsx(hje,{content:u,timestamp:c.timestamp},c.id):c.role==="assistant"?m.jsx("div",{className:"space-y-4",children:c.parts&&c.parts.length>0?c.parts.map((d,p)=>{const h=d.type==="text"?`${c.id}-text-${p}-${d.text?.slice(0,20)}`:`${c.id}-tool-${d.toolInvocation?.toolName}-${p}`;return d.type==="text"?m.jsx(eq,{content:d.text||"",timestamp:p===c.parts.length-1?c.timestamp:void 0,_isStreaming:s(c)},h):d.type==="tool-invocation"&&d.toolInvocation?m.jsxs("div",{children:[m.jsx(tq,{toolName:d.toolInvocation.toolName,args:d.toolInvocation.args,result:d.toolInvocation.result,state:d.toolInvocation.result?"result":"call"}),d.toolInvocation.result&&m.jsx(vq,{toolName:d.toolInvocation.toolName,toolArgs:d.toolInvocation.args,result:d.toolInvocation.result,serverId:n,readResource:r})]},h):null}):m.jsxs(m.Fragment,{children:[m.jsx(eq,{content:u,timestamp:c.timestamp,_isStreaming:s(c)}),c.toolCalls&&c.toolCalls.length>0&&m.jsx("div",{className:"space-y-2",children:c.toolCalls.map(d=>{const p=`${c.id}-${d.toolName}-${JSON.stringify(d.args).slice(0,50)}`;return m.jsxs("div",{children:[m.jsx(tq,{toolName:d.toolName,args:d.args,result:d.result,state:d.result?"result":"call"}),d.result&&m.jsx(vq,{toolName:d.toolName,toolArgs:d.args,result:d.result,serverId:n,readResource:r})]},p)})})]})},c.id):null}),i&&m.jsx("div",{className:"flex items-start gap-3",children:m.jsx("div",{className:"flex-1",children:m.jsx("div",{className:"rounded-lg p-4 max-w-fit",children:m.jsx("div",{className:"flex items-center gap-2",children:m.jsx("span",{className:"text-sm",children:m.jsx(oke,{duration:2,spread:1,children:"Thinking..."})})})})})}),m.jsx("div",{ref:a})]})});function iee(e){let t=0;for(let n=0;n<e.length;n++){const r=e.charCodeAt(n);t=(t<<5)-t+r,t=t&t}return Math.abs(t).toString(16)}function vje({mcpServerUrl:e,llmConfig:t,authConfig:n,isConnected:r}){const[a,i]=b.useState([]),[s,c]=b.useState(!1),u=b.useCallback(async p=>{if(!p.trim()||!t||!r)return;const h={id:`user-${Date.now()}`,role:"user",content:p.trim(),timestamp:Date.now()};i(v=>[...v,h]),c(!0);try{let v=n;if(n?.type==="oauth")try{const k="mcp:auth",N=iee(e),A=`${k}_${N}_tokens`,C=localStorage.getItem(A);if(C){const O=JSON.parse(C);v={...n,oauthTokens:O}}else console.warn("No OAuth tokens found in localStorage for key:",A)}catch(k){console.warn("Failed to retrieve OAuth tokens:",k)}const y=await fetch("/inspector/api/chat/stream",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mcpServerUrl:e,llmConfig:t,authConfig:v,messages:[...a,h].map(k=>({role:k.role,content:k.content}))})});if(!y.ok)throw new Error(`HTTP error! status: ${y.status}`);const E=`assistant-${Date.now()}`;let x="";const _=[];i(k=>[...k,{id:E,role:"assistant",content:"",timestamp:Date.now(),parts:[]}]);const S=y.body?.getReader(),w=new TextDecoder;if(!S)throw new Error("No response body");let T="";for(;;){const{done:k,value:N}=await S.read();if(k)break;T+=w.decode(N,{stream:!0});const A=T.split(`
|
|
1614
|
-
`);T=A.pop()||"";for(const C of A)if(C.trim()&&C.startsWith("data: "))try{const O=JSON.parse(C.slice(6));if(console.log("[Client received event]",O.type,O.toolName||O.content?.slice?.(0,30)),O.type==="message")console.log("[Message started]",O.id);else if(O.type==="text"){x+=O.content;const L=_[_.length-1];L&&L.type==="text"?L.text=x:_.push({type:"text",text:x}),console.log("[Parts after text]",_.length,"parts, text length:",x.length),i(F=>F.map(z=>z.id===E?{...z,parts:[..._]}:z))}else if(O.type==="tool-call")x&&(x=""),_.push({type:"tool-invocation",toolInvocation:{toolName:O.toolName,args:O.args,state:"pending"}}),console.log("[Parts after tool-call]",_.length,"parts, tool:",O.toolName),i(L=>L.map(F=>F.id===E?{...F,parts:[..._]}:F));else if(O.type==="tool-result"){const L=_.find(F=>F.type==="tool-invocation"&&F.toolInvocation?.toolName===O.toolName&&!F.toolInvocation?.result);L&&L.toolInvocation?(L.toolInvocation.result=O.result,L.toolInvocation.state="result",console.log("[Parts after tool-result]",_.length,"parts, updated:",O.toolName),i(F=>F.map(z=>z.id===E?{...z,parts:[..._]}:z))):console.warn("[tool-result] Could not find matching tool part for",O.toolName)}else if(O.type==="done")console.log("[Done] Final parts:",_.length),i(L=>L.map(F=>F.id===E?{...F,parts:[..._],content:""}:F));else if(O.type==="error")throw new Error(O.message||"Streaming error")}catch(O){console.error("Failed to parse streaming event:",O,C)}}}catch(v){let y="Unknown error occurred";if(v instanceof Error){y=v.message;const x=v;x.status&&(y=`HTTP ${x.status}: ${y}`),(x.code===401||y.includes("401")||y.includes("Unauthorized"))&&(y="Authentication failed (401). Check your Authorization header in the connection settings.")}const E={id:`error-${Date.now()}`,role:"assistant",content:`Error: ${y}`,timestamp:Date.now()};i(x=>[...x,E])}finally{c(!1)}},[t,r,e,a,n]),d=b.useCallback(()=>{i([])},[]);return{messages:a,isLoading:s,sendMessage:u,clearMessages:d}}function bje({connection:e,llmConfig:t,isConnected:n,readResource:r}){const[a,i]=b.useState([]),[s,c]=b.useState(!1),u=b.useRef(null),d=b.useRef(null),p=b.useRef(null),h=b.useCallback(async y=>{if(!y.trim()||!t||!n)return;const E={id:`user-${Date.now()}`,role:"user",content:y.trim(),timestamp:Date.now()};i(S=>[...S,E]),c(!0),u.current=new AbortController;const x=Date.now();let _=0;try{const S=`assistant-${Date.now()}`;let w="";const T=[];if(i(k=>[...k,{id:S,role:"assistant",content:"",timestamp:Date.now(),parts:[]}]),!p.current||p.current.provider!==t.provider||p.current.model!==t.model||p.current.apiKey!==t.apiKey){let k;if(t.provider==="openai"){const{ChatOpenAI:N}=await Za(async()=>{const{ChatOpenAI:A}=await import("./index-CxUUmVDP.js");return{ChatOpenAI:A}},__vite__mapDeps([5,6,3,7,8]));k=new N({model:t.model,apiKey:t.apiKey})}else if(t.provider==="anthropic"){const{ChatAnthropic:N}=await Za(async()=>{const{ChatAnthropic:A}=await import("./index-d3Zt9XHn.js");return{ChatAnthropic:A}},__vite__mapDeps([9,6,3]));k=new N({model:t.model,apiKey:t.apiKey})}else if(t.provider==="google"){const{ChatGoogleGenerativeAI:N}=await Za(async()=>{const{ChatGoogleGenerativeAI:A}=await import("./index-Dy6u0jar.js");return{ChatGoogleGenerativeAI:A}},__vite__mapDeps([10,6,3,8]));k=new N({model:t.model,apiKey:t.apiKey})}else throw new Error(`Unsupported LLM provider: ${t.provider}`);p.current={instance:k,provider:t.provider,model:t.model,apiKey:t.apiKey}}if(!d.current||d.current.llm!==p.current.instance){const{MCPAgent:k}=await Za(async()=>{const{MCPAgent:N}=await import("./browser-BwGIHdu_.js");return{MCPAgent:N}},__vite__mapDeps([11,7,6,3,2,4,8]));d.current=new k({llm:p.current.instance,client:e.client,memoryEnabled:!0,systemPrompt:"You are a helpful assistant with access to MCP tools, prompts, and resources. Help users interact with the MCP server."}),await d.current.initialize()}else console.log("[useChatMessagesClientSide] Reusing existing agent. History length:",d.current.conversationHistory?.length);for await(const k of d.current.streamEvents(y,10,!1,void 0)){if(u.current?.signal.aborted)break;if(k.event==="on_chat_model_stream"&&k.data?.chunk?.text){const N=k.data.chunk.text;if(typeof N=="string"&&N.length>0){w+=N;const A=T[T.length-1];A&&A.type==="text"?A.text=w:T.push({type:"text",text:w}),i(C=>C.map(O=>O.id===S?{...O,parts:[...T]}:O))}}else if(k.event==="on_tool_start"){w&&(w="");let N={};k.data?.input?N=k.data.input:k.data?.tool_input?N=k.data.tool_input:k.data&&(N=k.data),console.log("[useChatMessagesClientSide] on_tool_start:",{toolName:k.name,eventData:k.data,extractedArgs:N}),_++,T.push({type:"tool-invocation",toolInvocation:{toolName:k.name||"unknown",args:N,state:"pending"}}),i(A=>A.map(C=>C.id===S?{...C,parts:[...T]}:C))}else if(k.event==="on_tool_end"){const N=T.find(A=>A.type==="tool-invocation"&&A.toolInvocation?.toolName===k.name&&!A.toolInvocation?.result);if(console.log("[useChatMessagesClientSide] on_tool_end event:",{toolName:k.name,hasToolPart:!!N,output:k.data?.output}),N&&N.toolInvocation){let A=k.data?.output;if(A?.kwargs?.content&&typeof A.kwargs.content=="string")try{A=JSON.parse(A.kwargs.content)}catch(O){console.warn("[useChatMessagesClientSide] Failed to parse kwargs.content:",O),A=A.kwargs.content}else if(A?.content&&typeof A.content=="string")try{A=JSON.parse(A.content)}catch{A=A.content}N.toolInvocation.result=A,N.toolInvocation.state="result";const C=A?._meta?.["openai/outputTemplate"];if(console.log("[useChatMessagesClientSide] Tool result:",{toolName:k.name,hasMeta:!!A?._meta,hasStructuredContent:!!A?.structuredContent,appsSdkUri:C}),C&&typeof C=="string"&&r){console.log("[useChatMessagesClientSide] Detected Apps SDK component, fetching resource:",C);try{const O=await r(C);console.log("[useChatMessagesClientSide] Resource fetched:",O);const L=A?.structuredContent||null;if(O?.contents&&Array.isArray(O.contents)){const F=O.contents.map(K=>({type:"resource",resource:K}));console.log("[useChatMessagesClientSide] Created MCP resources:",F);const z={...A,content:[...A.content||[],...F],structuredContent:L};N.toolInvocation.result=z,console.log("[useChatMessagesClientSide] Updated result with resources")}else console.warn("[useChatMessagesClientSide] No contents in resourceData:",O)}catch(O){console.error("Failed to fetch Apps SDK resource:",O)}}i(O=>O.map(L=>L.id===S?{...L,parts:[...T]}:L))}}}i(k=>k.map(N=>N.id===S?{...N,parts:[...T],content:""}:N)),t&&er.getInstance().capture(new xU({serverId:e.url,provider:t.provider,model:t.model,messageCount:a.length+1,toolCallsCount:_,success:!0,executionMode:"client-side",duration:Date.now()-x})).catch(()=>{})}catch(S){console.error("Client-side agent error:",S);let w="Unknown error occurred";if(S instanceof Error){w=S.message;const k=S;k.status&&(w=`HTTP ${k.status}: ${w}`),(k.code===401||w.includes("401")||w.includes("Unauthorized"))&&(w="Authentication failed (401). Check your Authorization header in the connection settings.")}t&&er.getInstance().capture(new xU({serverId:e.url,provider:t.provider,model:t.model,messageCount:a.length+1,toolCallsCount:_,success:!1,executionMode:"client-side",duration:Date.now()-x,error:w})).catch(()=>{});const T={id:`error-${Date.now()}`,role:"assistant",content:`Error: ${w}`,timestamp:Date.now()};i(k=>[...k,T])}finally{c(!1),u.current=null}},[e,t,n,a,r]),v=b.useCallback(()=>{i([]),d.current&&d.current.clearConversationHistory()},[]);return{messages:a,isLoading:s,sendMessage:h,clearMessages:v}}const bq={openai:"gpt-4o",anthropic:"claude-haiku-4-5-20251001",google:"gemini-2.5-flash"};function yje({mcpServerUrl:e}){const[t,n]=b.useState(null),[r,a]=b.useState(null),[i,s]=b.useState(!1),[c,u]=b.useState("openai"),[d,p]=b.useState(""),[h,v]=b.useState(bq.openai),y=b.useCallback(()=>{const L=localStorage.getItem("mcp-inspector-api-keys");if(L)try{return JSON.parse(L)}catch(F){return console.error("Failed to load API keys:",F),{}}return{}},[]),E=b.useCallback(L=>{localStorage.setItem("mcp-inspector-api-keys",JSON.stringify(L))},[]),[x,_]=b.useState("none"),[S,w]=b.useState(""),[T,k]=b.useState(""),[N,A]=b.useState("");b.useEffect(()=>{const L=localStorage.getItem("mcp-inspector-llm-config"),F=y();if(L)try{const z=JSON.parse(L);n(z),u(z.provider),p(F[z.provider]||z.apiKey||""),v(z.model)}catch(z){console.error("Failed to load LLM config:",z)}},[y]),b.useEffect(()=>{const L=localStorage.getItem("mcp-inspector-auth-config");if(L)try{const F=JSON.parse(L);a(F),_(F.type),F.username&&w(F.username),F.password&&k(F.password),F.token&&A(F.token)}catch(F){console.error("Failed to load auth config:",F)}else try{const F="mcp:auth",z=iee(e),K=`${F}_${z}_tokens`;localStorage.getItem(K)&&(a({type:"oauth"}),_("oauth"))}catch(F){console.error("Failed to check for OAuth tokens:",F)}},[e]),b.useEffect(()=>{v(bq[c]);const L=y();p(L[c]||"")},[c,y]);const C=b.useCallback(()=>{if(!d.trim())return;const L=y();L[c]=d,E(L);const F={provider:c,apiKey:d,model:h},z={type:x,...x==="basic"&&{username:S.trim(),password:T.trim()},...x==="bearer"&&{token:N.trim()}};n(F),a(z),localStorage.setItem("mcp-inspector-llm-config",JSON.stringify(F)),localStorage.setItem("mcp-inspector-auth-config",JSON.stringify(z)),s(!1)},[c,d,h,x,S,T,N,y,E]),O=b.useCallback(()=>{n(null),a(null);const L=y();delete L[c],E(L),p(""),w(""),k(""),A(""),_("none"),localStorage.removeItem("mcp-inspector-llm-config"),localStorage.removeItem("mcp-inspector-auth-config")},[c,y,E]);return{llmConfig:t,authConfig:r,configDialogOpen:i,setConfigDialogOpen:s,tempProvider:c,setTempProvider:u,tempApiKey:d,setTempApiKey:p,tempModel:h,setTempModel:v,tempAuthType:x,saveLLMConfig:C,clearConfig:O}}function wje({connection:e,isConnected:t,useClientSide:n=!0,readResource:r}){const[a,i]=b.useState(""),s=b.useRef(null),{llmConfig:c,authConfig:u,configDialogOpen:d,setConfigDialogOpen:p,tempProvider:h,setTempProvider:v,tempApiKey:y,setTempApiKey:E,tempModel:x,setTempModel:_,saveLLMConfig:S,clearConfig:w}=yje({mcpServerUrl:e.url}),T={connection:e,llmConfig:c,isConnected:t,readResource:r},k=vje({mcpServerUrl:e.url,llmConfig:c,authConfig:u,isConnected:t}),N=bje(T),{messages:A,isLoading:C,sendMessage:O,clearMessages:L}=n?N:k;yJ({onNewChat:L}),b.useEffect(()=>{c&&A.length===0&&s.current&&s.current.focus()},[c,A.length]),b.useEffect(()=>{!C&&A.length>0&&s.current&&s.current.focus()},[C,A.length]);const F=b.useCallback(()=>{a.trim()&&(O(a),i(""))},[a,O]),z=b.useCallback(ee=>{ee.key==="Enter"&&!ee.shiftKey&&(ee.preventDefault(),F())},[F]),K=b.useCallback(()=>{w(),L()},[w,L]);return c&&A.length===0?m.jsxs("div",{className:"flex flex-col h-full",children:[m.jsx("div",{className:"absolute top-4 right-4 z-10",children:m.jsx(Lk,{open:d,onOpenChange:p,tempProvider:h,tempModel:x,tempApiKey:y,onProviderChange:v,onModelChange:_,onApiKeyChange:E,onSave:S,onClear:K,showClearButton:!0,buttonLabel:"Change API Key"})}),m.jsx(ake,{mcpServerUrl:e.url,inputValue:a,isConnected:t,isLoading:C,textareaRef:s,llmConfig:c,onInputChange:i,onKeyDown:z,onSubmit:ee=>{ee.preventDefault(),F()},onConfigDialogOpenChange:p})]}):m.jsxs("div",{className:"flex flex-col h-full relative",children:[m.jsx(tke,{llmConfig:c,hasMessages:A.length>0,configDialogOpen:d,onConfigDialogOpenChange:p,onClearChat:L,tempProvider:h,tempModel:x,tempApiKey:y,onProviderChange:v,onModelChange:_,onApiKeyChange:E,onSaveConfig:S,onClearConfig:K}),m.jsx("div",{className:"flex-1 overflow-y-auto p-2 sm:p-4 pt-[80px] sm:pt-[100px]",children:c?m.jsx(gje,{messages:A,isLoading:C,serverId:e.url,readResource:r}):m.jsx(ike,{onConfigureClick:()=>p(!0)})}),c&&m.jsx(nke,{inputValue:a,isConnected:t,isLoading:C,textareaRef:s,onInputChange:i,onKeyDown:z,onSendMessage:F})]})}const Db=b.createContext(null);Db.displayName="PanelGroupContext";const On={group:"data-panel-group",groupDirection:"data-panel-group-direction",groupId:"data-panel-group-id",panel:"data-panel",panelCollapsible:"data-panel-collapsible",panelId:"data-panel-id",panelSize:"data-panel-size",resizeHandle:"data-resize-handle",resizeHandleActive:"data-resize-handle-active",resizeHandleEnabled:"data-panel-resize-handle-enabled",resizeHandleId:"data-panel-resize-handle-id",resizeHandleState:"data-resize-handle-state"},yO=10,cl=b.useLayoutEffect,yq=Pv.useId,Sje=typeof yq=="function"?yq:()=>null;let Eje=0;function wO(e=null){const t=Sje(),n=b.useRef(e||t||null);return n.current===null&&(n.current=""+Eje++),e??n.current}function oee({children:e,className:t="",collapsedSize:n,collapsible:r,defaultSize:a,forwardedRef:i,id:s,maxSize:c,minSize:u,onCollapse:d,onExpand:p,onResize:h,order:v,style:y,tagName:E="div",...x}){const _=b.useContext(Db);if(_===null)throw Error("Panel components must be rendered within a PanelGroup container");const{collapsePanel:S,expandPanel:w,getPanelSize:T,getPanelStyle:k,groupId:N,isPanelCollapsed:A,reevaluatePanelConstraints:C,registerPanel:O,resizePanel:L,unregisterPanel:F}=_,z=wO(s),K=b.useRef({callbacks:{onCollapse:d,onExpand:p,onResize:h},constraints:{collapsedSize:n,collapsible:r,defaultSize:a,maxSize:c,minSize:u},id:z,idIsFromProps:s!==void 0,order:v});b.useRef({didLogMissingDefaultSizeWarning:!1}),cl(()=>{const{callbacks:J,constraints:le}=K.current,q={...le};K.current.id=z,K.current.idIsFromProps=s!==void 0,K.current.order=v,J.onCollapse=d,J.onExpand=p,J.onResize=h,le.collapsedSize=n,le.collapsible=r,le.defaultSize=a,le.maxSize=c,le.minSize=u,(q.collapsedSize!==le.collapsedSize||q.collapsible!==le.collapsible||q.maxSize!==le.maxSize||q.minSize!==le.minSize)&&C(K.current,q)}),cl(()=>{const J=K.current;return O(J),()=>{F(J)}},[v,z,O,F]),b.useImperativeHandle(i,()=>({collapse:()=>{S(K.current)},expand:J=>{w(K.current,J)},getId(){return z},getSize(){return T(K.current)},isCollapsed(){return A(K.current)},isExpanded(){return!A(K.current)},resize:J=>{L(K.current,J)}}),[S,w,T,A,z,L]);const ee=k(K.current,a);return b.createElement(E,{...x,children:e,className:t,id:z,style:{...ee,...y},[On.groupId]:N,[On.panel]:"",[On.panelCollapsible]:r||void 0,[On.panelId]:z,[On.panelSize]:parseFloat(""+ee.flexGrow).toFixed(1)})}const see=b.forwardRef((e,t)=>b.createElement(oee,{...e,forwardedRef:t}));oee.displayName="Panel";see.displayName="forwardRef(Panel)";let Gk=null,Eg=-1,ns=null;function _je(e,t,n){const r=(t&fee)!==0,a=(t&pee)!==0,i=(t&mee)!==0,s=(t&hee)!==0;if(t){if(r)return i?"se-resize":s?"ne-resize":"e-resize";if(a)return i?"sw-resize":s?"nw-resize":"w-resize";if(i)return"s-resize";if(s)return"n-resize"}switch(e){case"horizontal":return"ew-resize";case"intersection":return"move";case"vertical":return"ns-resize"}}function xje(){ns!==null&&(document.head.removeChild(ns),Gk=null,ns=null,Eg=-1)}function GR(e,t,n){var r,a;const i=_je(e,t);if(Gk!==i){if(Gk=i,ns===null&&(ns=document.createElement("style"),document.head.appendChild(ns)),Eg>=0){var s;(s=ns.sheet)===null||s===void 0||s.removeRule(Eg)}Eg=(r=(a=ns.sheet)===null||a===void 0?void 0:a.insertRule(`*{cursor: ${i} !important;}`))!==null&&r!==void 0?r:-1}}function lee(e){return e.type==="keydown"}function cee(e){return e.type.startsWith("pointer")}function uee(e){return e.type.startsWith("mouse")}function $b(e){if(cee(e)){if(e.isPrimary)return{x:e.clientX,y:e.clientY}}else if(uee(e))return{x:e.clientX,y:e.clientY};return{x:1/0,y:1/0}}function Tje(){if(typeof matchMedia=="function")return matchMedia("(pointer:coarse)").matches?"coarse":"fine"}function Rje(e,t,n){return e.x<t.x+t.width&&e.x+e.width>t.x&&e.y<t.y+t.height&&e.y+e.height>t.y}function Nje(e,t){if(e===t)throw new Error("Cannot compare node with itself");const n={a:Eq(e),b:Eq(t)};let r;for(;n.a.at(-1)===n.b.at(-1);)e=n.a.pop(),t=n.b.pop(),r=e;xt(r,"Stacking order can only be calculated for elements with a common ancestor");const a={a:Sq(wq(n.a)),b:Sq(wq(n.b))};if(a.a===a.b){const i=r.childNodes,s={a:n.a.at(-1),b:n.b.at(-1)};let c=i.length;for(;c--;){const u=i[c];if(u===s.a)return 1;if(u===s.b)return-1}}return Math.sign(a.a-a.b)}const kje=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function Cje(e){var t;const n=getComputedStyle((t=dee(e))!==null&&t!==void 0?t:e).display;return n==="flex"||n==="inline-flex"}function Aje(e){const t=getComputedStyle(e);return!!(t.position==="fixed"||t.zIndex!=="auto"&&(t.position!=="static"||Cje(e))||+t.opacity<1||"transform"in t&&t.transform!=="none"||"webkitTransform"in t&&t.webkitTransform!=="none"||"mixBlendMode"in t&&t.mixBlendMode!=="normal"||"filter"in t&&t.filter!=="none"||"webkitFilter"in t&&t.webkitFilter!=="none"||"isolation"in t&&t.isolation==="isolate"||kje.test(t.willChange)||t.webkitOverflowScrolling==="touch")}function wq(e){let t=e.length;for(;t--;){const n=e[t];if(xt(n,"Missing node"),Aje(n))return n}return null}function Sq(e){return e&&Number(getComputedStyle(e).zIndex)||0}function Eq(e){const t=[];for(;e;)t.push(e),e=dee(e);return t}function dee(e){const{parentNode:t}=e;return t&&t instanceof ShadowRoot?t.host:t}const fee=1,pee=2,mee=4,hee=8,Ije=Tje()==="coarse";let ei=[],nu=!1,rs=new Map,Lb=new Map;const Kf=new Set;function Oje(e,t,n,r,a){var i;const{ownerDocument:s}=t,c={direction:n,element:t,hitAreaMargins:r,setResizeHandlerState:a},u=(i=rs.get(s))!==null&&i!==void 0?i:0;return rs.set(s,u+1),Kf.add(c),uv(),function(){var p;Lb.delete(e),Kf.delete(c);const h=(p=rs.get(s))!==null&&p!==void 0?p:1;if(rs.set(s,h-1),uv(),h===1&&rs.delete(s),ei.includes(c)){const v=ei.indexOf(c);v>=0&&ei.splice(v,1),Mb(),a("up",!0,null)}}}function Dje(e){const{target:t}=e,{x:n,y:r}=$b(e);nu=!0,SO({target:t,x:n,y:r}),uv(),ei.length>0&&(dv("down",e),Mb(),e.preventDefault(),gee(t)||e.stopImmediatePropagation())}function WR(e){const{x:t,y:n}=$b(e);if(nu&&e.type!=="pointerleave"&&e.buttons===0&&(nu=!1,dv("up",e)),!nu){const{target:r}=e;SO({target:r,x:t,y:n})}dv("move",e),Mb(),ei.length>0&&e.preventDefault()}function KR(e){const{target:t}=e,{x:n,y:r}=$b(e);Lb.clear(),nu=!1,ei.length>0&&(e.preventDefault(),gee(t)||e.stopImmediatePropagation()),dv("up",e),SO({target:t,x:n,y:r}),Mb(),uv()}function gee(e){let t=e;for(;t;){if(t.hasAttribute(On.resizeHandle))return!0;t=t.parentElement}return!1}function SO({target:e,x:t,y:n}){ei.splice(0);let r=null;(e instanceof HTMLElement||e instanceof SVGElement)&&(r=e),Kf.forEach(a=>{const{element:i,hitAreaMargins:s}=a,c=i.getBoundingClientRect(),{bottom:u,left:d,right:p,top:h}=c,v=Ije?s.coarse:s.fine;if(t>=d-v&&t<=p+v&&n>=h-v&&n<=u+v){if(r!==null&&document.contains(r)&&i!==r&&!i.contains(r)&&!r.contains(i)&&Nje(r,i)>0){let E=r,x=!1;for(;E&&!E.contains(i);){if(Rje(E.getBoundingClientRect(),c)){x=!0;break}E=E.parentElement}if(x)return}ei.push(a)}})}function YR(e,t){Lb.set(e,t)}function Mb(){let e=!1,t=!1;ei.forEach(r=>{const{direction:a}=r;a==="horizontal"?e=!0:t=!0});let n=0;Lb.forEach(r=>{n|=r}),e&&t?GR("intersection",n):e?GR("horizontal",n):t?GR("vertical",n):xje()}let ZR;function uv(){var e;(e=ZR)===null||e===void 0||e.abort(),ZR=new AbortController;const t={capture:!0,signal:ZR.signal};Kf.size&&(nu?(ei.length>0&&rs.forEach((n,r)=>{const{body:a}=r;n>0&&(a.addEventListener("contextmenu",KR,t),a.addEventListener("pointerleave",WR,t),a.addEventListener("pointermove",WR,t))}),rs.forEach((n,r)=>{const{body:a}=r;a.addEventListener("pointerup",KR,t),a.addEventListener("pointercancel",KR,t)})):rs.forEach((n,r)=>{const{body:a}=r;n>0&&(a.addEventListener("pointerdown",Dje,t),a.addEventListener("pointermove",WR,t))}))}function dv(e,t){Kf.forEach(n=>{const{setResizeHandlerState:r}=n,a=ei.includes(n);r(e,a,t)})}function $je(){const[e,t]=b.useState(0);return b.useCallback(()=>t(n=>n+1),[])}function xt(e,t){if(!e)throw console.error(t),Error(t)}function xl(e,t,n=yO){return e.toFixed(n)===t.toFixed(n)?0:e>t?1:-1}function ao(e,t,n=yO){return xl(e,t,n)===0}function na(e,t,n){return xl(e,t,n)===0}function Lje(e,t,n){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++){const a=e[r],i=t[r];if(!na(a,i,n))return!1}return!0}function Bc({panelConstraints:e,panelIndex:t,size:n}){const r=e[t];xt(r!=null,`Panel constraints not found for index ${t}`);let{collapsedSize:a=0,collapsible:i,maxSize:s=100,minSize:c=0}=r;if(xl(n,c)<0)if(i){const u=(a+c)/2;xl(n,u)<0?n=a:n=c}else n=c;return n=Math.min(s,n),n=parseFloat(n.toFixed(yO)),n}function sf({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:a,trigger:i}){if(na(e,0))return t;const s=[...t],[c,u]=r;xt(c!=null,"Invalid first pivot index"),xt(u!=null,"Invalid second pivot index");let d=0;if(i==="keyboard"){{const h=e<0?u:c,v=n[h];xt(v,`Panel constraints not found for index ${h}`);const{collapsedSize:y=0,collapsible:E,minSize:x=0}=v;if(E){const _=t[h];if(xt(_!=null,`Previous layout not found for panel index ${h}`),na(_,y)){const S=x-_;xl(S,Math.abs(e))>0&&(e=e<0?0-S:S)}}}{const h=e<0?c:u,v=n[h];xt(v,`No panel constraints found for index ${h}`);const{collapsedSize:y=0,collapsible:E,minSize:x=0}=v;if(E){const _=t[h];if(xt(_!=null,`Previous layout not found for panel index ${h}`),na(_,x)){const S=_-y;xl(S,Math.abs(e))>0&&(e=e<0?0-S:S)}}}}{const h=e<0?1:-1;let v=e<0?u:c,y=0;for(;;){const x=t[v];xt(x!=null,`Previous layout not found for panel index ${v}`);const S=Bc({panelConstraints:n,panelIndex:v,size:100})-x;if(y+=S,v+=h,v<0||v>=n.length)break}const E=Math.min(Math.abs(e),Math.abs(y));e=e<0?0-E:E}{let v=e<0?c:u;for(;v>=0&&v<n.length;){const y=Math.abs(e)-Math.abs(d),E=t[v];xt(E!=null,`Previous layout not found for panel index ${v}`);const x=E-y,_=Bc({panelConstraints:n,panelIndex:v,size:x});if(!na(E,_)&&(d+=E-_,s[v]=_,d.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?v--:v++}}if(Lje(a,s))return a;{const h=e<0?u:c,v=t[h];xt(v!=null,`Previous layout not found for panel index ${h}`);const y=v+d,E=Bc({panelConstraints:n,panelIndex:h,size:y});if(s[h]=E,!na(E,y)){let x=y-E,S=e<0?u:c;for(;S>=0&&S<n.length;){const w=s[S];xt(w!=null,`Previous layout not found for panel index ${S}`);const T=w+x,k=Bc({panelConstraints:n,panelIndex:S,size:T});if(na(w,k)||(x-=k-w,s[S]=k),na(x,0))break;e>0?S--:S++}}}const p=s.reduce((h,v)=>v+h,0);return na(p,100)?s:a}function Mje({layout:e,panelsArray:t,pivotIndices:n}){let r=0,a=100,i=0,s=0;const c=n[0];xt(c!=null,"No pivot index found"),t.forEach((h,v)=>{const{constraints:y}=h,{maxSize:E=100,minSize:x=0}=y;v===c?(r=x,a=E):(i+=x,s+=E)});const u=Math.min(a,100-i),d=Math.max(r,100-s),p=e[c];return{valueMax:u,valueMin:d,valueNow:p}}function Yf(e,t=document){return Array.from(t.querySelectorAll(`[${On.resizeHandleId}][data-panel-group-id="${e}"]`))}function vee(e,t,n=document){const a=Yf(e,n).findIndex(i=>i.getAttribute(On.resizeHandleId)===t);return a??null}function bee(e,t,n){const r=vee(e,t,n);return r!=null?[r,r+1]:[-1,-1]}function jje(e){return e instanceof HTMLElement?!0:typeof e=="object"&&e!==null&&"tagName"in e&&"getAttribute"in e}function yee(e,t=document){if(jje(t)&&t.dataset.panelGroupId==e)return t;const n=t.querySelector(`[data-panel-group][data-panel-group-id="${e}"]`);return n||null}function jb(e,t=document){const n=t.querySelector(`[${On.resizeHandleId}="${e}"]`);return n||null}function Pje(e,t,n,r=document){var a,i,s,c;const u=jb(t,r),d=Yf(e,r),p=u?d.indexOf(u):-1,h=(a=(i=n[p])===null||i===void 0?void 0:i.id)!==null&&a!==void 0?a:null,v=(s=(c=n[p+1])===null||c===void 0?void 0:c.id)!==null&&s!==void 0?s:null;return[h,v]}function Uje({committedValuesRef:e,eagerValuesRef:t,groupId:n,layout:r,panelDataArray:a,panelGroupElement:i,setLayout:s}){b.useRef({didWarnAboutMissingResizeHandle:!1}),cl(()=>{if(!i)return;const c=Yf(n,i);for(let u=0;u<a.length-1;u++){const{valueMax:d,valueMin:p,valueNow:h}=Mje({layout:r,panelsArray:a,pivotIndices:[u,u+1]}),v=c[u];if(v!=null){const y=a[u];xt(y,`No panel data found for index "${u}"`),v.setAttribute("aria-controls",y.id),v.setAttribute("aria-valuemax",""+Math.round(d)),v.setAttribute("aria-valuemin",""+Math.round(p)),v.setAttribute("aria-valuenow",h!=null?""+Math.round(h):"")}}return()=>{c.forEach((u,d)=>{u.removeAttribute("aria-controls"),u.removeAttribute("aria-valuemax"),u.removeAttribute("aria-valuemin"),u.removeAttribute("aria-valuenow")})}},[n,r,a,i]),b.useEffect(()=>{if(!i)return;const c=t.current;xt(c,"Eager values not found");const{panelDataArray:u}=c,d=yee(n,i);xt(d!=null,`No group found for id "${n}"`);const p=Yf(n,i);xt(p,`No resize handles found for group id "${n}"`);const h=p.map(v=>{const y=v.getAttribute(On.resizeHandleId);xt(y,"Resize handle element has no handle id attribute");const[E,x]=Pje(n,y,u,i);if(E==null||x==null)return()=>{};const _=S=>{if(!S.defaultPrevented)switch(S.key){case"Enter":{S.preventDefault();const w=u.findIndex(T=>T.id===E);if(w>=0){const T=u[w];xt(T,`No panel data found for index ${w}`);const k=r[w],{collapsedSize:N=0,collapsible:A,minSize:C=0}=T.constraints;if(k!=null&&A){const O=sf({delta:na(k,N)?C-N:N-k,initialLayout:r,panelConstraints:u.map(L=>L.constraints),pivotIndices:bee(n,y,i),prevLayout:r,trigger:"keyboard"});r!==O&&s(O)}}break}}};return v.addEventListener("keydown",_),()=>{v.removeEventListener("keydown",_)}});return()=>{h.forEach(v=>v())}},[i,e,t,n,r,a,s])}function _q(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function wee(e,t){const n=e==="horizontal",{x:r,y:a}=$b(t);return n?r:a}function zje(e,t,n,r,a){const i=n==="horizontal",s=jb(t,a);xt(s,`No resize handle element found for id "${t}"`);const c=s.getAttribute(On.groupId);xt(c,"Resize handle element has no group id attribute");let{initialCursorPosition:u}=r;const d=wee(n,e),p=yee(c,a);xt(p,`No group element found for id "${c}"`);const h=p.getBoundingClientRect(),v=i?h.width:h.height;return(d-u)/v*100}function Fje(e,t,n,r,a,i){if(lee(e)){const s=n==="horizontal";let c=0;e.shiftKey?c=100:a!=null?c=a:c=10;let u=0;switch(e.key){case"ArrowDown":u=s?0:c;break;case"ArrowLeft":u=s?-c:0;break;case"ArrowRight":u=s?c:0;break;case"ArrowUp":u=s?0:-c;break;case"End":u=100;break;case"Home":u=-100;break}return u}else return r==null?0:zje(e,t,n,r,i)}function Bje({panelDataArray:e}){const t=Array(e.length),n=e.map(i=>i.constraints);let r=0,a=100;for(let i=0;i<e.length;i++){const s=n[i];xt(s,`Panel constraints not found for index ${i}`);const{defaultSize:c}=s;c!=null&&(r++,t[i]=c,a-=c)}for(let i=0;i<e.length;i++){const s=n[i];xt(s,`Panel constraints not found for index ${i}`);const{defaultSize:c}=s;if(c!=null)continue;const u=e.length-r,d=a/u;r++,t[i]=d,a-=d}return t}function yc(e,t,n){t.forEach((r,a)=>{const i=e[a];xt(i,`Panel data not found for index ${a}`);const{callbacks:s,constraints:c,id:u}=i,{collapsedSize:d=0,collapsible:p}=c,h=n[u];if(h==null||r!==h){n[u]=r;const{onCollapse:v,onExpand:y,onResize:E}=s;E&&E(r,h),p&&(v||y)&&(y&&(h==null||ao(h,d))&&!ao(r,d)&&y(),v&&(h==null||!ao(h,d))&&ao(r,d)&&v())}})}function Jh(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n])return!1;return!0}function qje({defaultSize:e,dragState:t,layout:n,panelData:r,panelIndex:a,precision:i=3}){const s=n[a];let c;return s==null?c=e!=null?e.toFixed(i):"1":r.length===1?c="1":c=s.toFixed(i),{flexBasis:0,flexGrow:c,flexShrink:1,overflow:"hidden",pointerEvents:t!==null?"none":void 0}}function Hje(e,t=10){let n=null;return(...a)=>{n!==null&&clearTimeout(n),n=setTimeout(()=>{e(...a)},t)}}function xq(e){try{if(typeof localStorage<"u")e.getItem=t=>localStorage.getItem(t),e.setItem=(t,n)=>{localStorage.setItem(t,n)};else throw new Error("localStorage not supported in this environment")}catch(t){console.error(t),e.getItem=()=>null,e.setItem=()=>{}}}function See(e){return`react-resizable-panels:${e}`}function Eee(e){return e.map(t=>{const{constraints:n,id:r,idIsFromProps:a,order:i}=t;return a?r:i?`${i}:${JSON.stringify(n)}`:JSON.stringify(n)}).sort((t,n)=>t.localeCompare(n)).join(",")}function _ee(e,t){try{const n=See(e),r=t.getItem(n);if(r){const a=JSON.parse(r);if(typeof a=="object"&&a!=null)return a}}catch{}return null}function Vje(e,t,n){var r,a;const i=(r=_ee(e,n))!==null&&r!==void 0?r:{},s=Eee(t);return(a=i[s])!==null&&a!==void 0?a:null}function Gje(e,t,n,r,a){var i;const s=See(e),c=Eee(t),u=(i=_ee(e,a))!==null&&i!==void 0?i:{};u[c]={expandToSizes:Object.fromEntries(n.entries()),layout:r};try{a.setItem(s,JSON.stringify(u))}catch(d){console.error(d)}}function Tq({layout:e,panelConstraints:t}){const n=[...e],r=n.reduce((i,s)=>i+s,0);if(n.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${n.map(i=>`${i}%`).join(", ")}`);if(!na(r,100)&&n.length>0)for(let i=0;i<t.length;i++){const s=n[i];xt(s!=null,`No layout data found for index ${i}`);const c=100/r*s;n[i]=c}let a=0;for(let i=0;i<t.length;i++){const s=n[i];xt(s!=null,`No layout data found for index ${i}`);const c=Bc({panelConstraints:t,panelIndex:i,size:s});s!=c&&(a+=s-c,n[i]=c)}if(!na(a,0))for(let i=0;i<t.length;i++){const s=n[i];xt(s!=null,`No layout data found for index ${i}`);const c=s+a,u=Bc({panelConstraints:t,panelIndex:i,size:c});if(s!==u&&(a-=u-s,n[i]=u,na(a,0)))break}return n}const Wje=100,lf={getItem:e=>(xq(lf),lf.getItem(e)),setItem:(e,t)=>{xq(lf),lf.setItem(e,t)}},Rq={};function xee({autoSaveId:e=null,children:t,className:n="",direction:r,forwardedRef:a,id:i=null,onLayout:s=null,keyboardResizeBy:c=null,storage:u=lf,style:d,tagName:p="div",...h}){const v=wO(i),y=b.useRef(null),[E,x]=b.useState(null),[_,S]=b.useState([]),w=$je(),T=b.useRef({}),k=b.useRef(new Map),N=b.useRef(0),A=b.useRef({autoSaveId:e,direction:r,dragState:E,id:v,keyboardResizeBy:c,onLayout:s,storage:u}),C=b.useRef({layout:_,panelDataArray:[],panelDataArrayChanged:!1});b.useRef({didLogIdAndOrderWarning:!1,didLogPanelConstraintsWarning:!1,prevPanelIds:[]}),b.useImperativeHandle(a,()=>({getId:()=>A.current.id,getLayout:()=>{const{layout:j}=C.current;return j},setLayout:j=>{const{onLayout:$}=A.current,{layout:U,panelDataArray:H}=C.current,W=Tq({layout:j,panelConstraints:H.map(X=>X.constraints)});_q(U,W)||(S(W),C.current.layout=W,$&&$(W),yc(H,W,T.current))}}),[]),cl(()=>{A.current.autoSaveId=e,A.current.direction=r,A.current.dragState=E,A.current.id=v,A.current.onLayout=s,A.current.storage=u}),Uje({committedValuesRef:A,eagerValuesRef:C,groupId:v,layout:_,panelDataArray:C.current.panelDataArray,setLayout:S,panelGroupElement:y.current}),b.useEffect(()=>{const{panelDataArray:j}=C.current;if(e){if(_.length===0||_.length!==j.length)return;let $=Rq[e];$==null&&($=Hje(Gje,Wje),Rq[e]=$);const U=[...j],H=new Map(k.current);$(e,U,H,_,u)}},[e,_,u]),b.useEffect(()=>{});const O=b.useCallback(j=>{const{onLayout:$}=A.current,{layout:U,panelDataArray:H}=C.current;if(j.constraints.collapsible){const W=H.map(Y=>Y.constraints),{collapsedSize:X=0,panelSize:de,pivotIndices:ue}=Ws(H,j,U);if(xt(de!=null,`Panel size not found for panel "${j.id}"`),!ao(de,X)){k.current.set(j.id,de);const Q=Ac(H,j)===H.length-1?de-X:X-de,oe=sf({delta:Q,initialLayout:U,panelConstraints:W,pivotIndices:ue,prevLayout:U,trigger:"imperative-api"});Jh(U,oe)||(S(oe),C.current.layout=oe,$&&$(oe),yc(H,oe,T.current))}}},[]),L=b.useCallback((j,$)=>{const{onLayout:U}=A.current,{layout:H,panelDataArray:W}=C.current;if(j.constraints.collapsible){const X=W.map(ae=>ae.constraints),{collapsedSize:de=0,panelSize:ue=0,minSize:Y=0,pivotIndices:Q}=Ws(W,j,H),oe=$??Y;if(ao(ue,de)){const ae=k.current.get(j.id),Re=ae!=null&&ae>=oe?ae:oe,Ye=Ac(W,j)===W.length-1?ue-Re:Re-ue,Ee=sf({delta:Ye,initialLayout:H,panelConstraints:X,pivotIndices:Q,prevLayout:H,trigger:"imperative-api"});Jh(H,Ee)||(S(Ee),C.current.layout=Ee,U&&U(Ee),yc(W,Ee,T.current))}}},[]),F=b.useCallback(j=>{const{layout:$,panelDataArray:U}=C.current,{panelSize:H}=Ws(U,j,$);return xt(H!=null,`Panel size not found for panel "${j.id}"`),H},[]),z=b.useCallback((j,$)=>{const{panelDataArray:U}=C.current,H=Ac(U,j);return qje({defaultSize:$,dragState:E,layout:_,panelData:U,panelIndex:H})},[E,_]),K=b.useCallback(j=>{const{layout:$,panelDataArray:U}=C.current,{collapsedSize:H=0,collapsible:W,panelSize:X}=Ws(U,j,$);return xt(X!=null,`Panel size not found for panel "${j.id}"`),W===!0&&ao(X,H)},[]),ee=b.useCallback(j=>{const{layout:$,panelDataArray:U}=C.current,{collapsedSize:H=0,collapsible:W,panelSize:X}=Ws(U,j,$);return xt(X!=null,`Panel size not found for panel "${j.id}"`),!W||xl(X,H)>0},[]),J=b.useCallback(j=>{const{panelDataArray:$}=C.current;$.push(j),$.sort((U,H)=>{const W=U.order,X=H.order;return W==null&&X==null?0:W==null?-1:X==null?1:W-X}),C.current.panelDataArrayChanged=!0,w()},[w]);cl(()=>{if(C.current.panelDataArrayChanged){C.current.panelDataArrayChanged=!1;const{autoSaveId:j,onLayout:$,storage:U}=A.current,{layout:H,panelDataArray:W}=C.current;let X=null;if(j){const ue=Vje(j,W,U);ue&&(k.current=new Map(Object.entries(ue.expandToSizes)),X=ue.layout)}X==null&&(X=Bje({panelDataArray:W}));const de=Tq({layout:X,panelConstraints:W.map(ue=>ue.constraints)});_q(H,de)||(S(de),C.current.layout=de,$&&$(de),yc(W,de,T.current))}}),cl(()=>{const j=C.current;return()=>{j.layout=[]}},[]);const le=b.useCallback(j=>{let $=!1;const U=y.current;return U&&window.getComputedStyle(U,null).getPropertyValue("direction")==="rtl"&&($=!0),function(W){W.preventDefault();const X=y.current;if(!X)return()=>null;const{direction:de,dragState:ue,id:Y,keyboardResizeBy:Q,onLayout:oe}=A.current,{layout:ae,panelDataArray:Re}=C.current,{initialLayout:Ae}=ue??{},Ye=bee(Y,j,X);let Ee=Fje(W,j,de,ue,Q,X);const Ne=de==="horizontal";Ne&&$&&(Ee=-Ee);const ze=Re.map(Ze=>Ze.constraints),he=sf({delta:Ee,initialLayout:Ae??ae,panelConstraints:ze,pivotIndices:Ye,prevLayout:ae,trigger:lee(W)?"keyboard":"mouse-or-touch"}),je=!Jh(ae,he);(cee(W)||uee(W))&&N.current!=Ee&&(N.current=Ee,!je&&Ee!==0?Ne?YR(j,Ee<0?fee:pee):YR(j,Ee<0?mee:hee):YR(j,0)),je&&(S(he),C.current.layout=he,oe&&oe(he),yc(Re,he,T.current))}},[]),q=b.useCallback((j,$)=>{const{onLayout:U}=A.current,{layout:H,panelDataArray:W}=C.current,X=W.map(ae=>ae.constraints),{panelSize:de,pivotIndices:ue}=Ws(W,j,H);xt(de!=null,`Panel size not found for panel "${j.id}"`);const Q=Ac(W,j)===W.length-1?de-$:$-de,oe=sf({delta:Q,initialLayout:H,panelConstraints:X,pivotIndices:ue,prevLayout:H,trigger:"imperative-api"});Jh(H,oe)||(S(oe),C.current.layout=oe,U&&U(oe),yc(W,oe,T.current))},[]),Z=b.useCallback((j,$)=>{const{layout:U,panelDataArray:H}=C.current,{collapsedSize:W=0,collapsible:X}=$,{collapsedSize:de=0,collapsible:ue,maxSize:Y=100,minSize:Q=0}=j.constraints,{panelSize:oe}=Ws(H,j,U);oe!=null&&(X&&ue&&ao(oe,W)?ao(W,de)||q(j,de):oe<Q?q(j,Q):oe>Y&&q(j,Y))},[q]),G=b.useCallback((j,$)=>{const{direction:U}=A.current,{layout:H}=C.current;if(!y.current)return;const W=jb(j,y.current);xt(W,`Drag handle element not found for id "${j}"`);const X=wee(U,$);x({dragHandleId:j,dragHandleRect:W.getBoundingClientRect(),initialCursorPosition:X,initialLayout:H})},[]),ie=b.useCallback(()=>{x(null)},[]),te=b.useCallback(j=>{const{panelDataArray:$}=C.current,U=Ac($,j);U>=0&&($.splice(U,1),delete T.current[j.id],C.current.panelDataArrayChanged=!0,w())},[w]),P=b.useMemo(()=>({collapsePanel:O,direction:r,dragState:E,expandPanel:L,getPanelSize:F,getPanelStyle:z,groupId:v,isPanelCollapsed:K,isPanelExpanded:ee,reevaluatePanelConstraints:Z,registerPanel:J,registerResizeHandle:le,resizePanel:q,startDragging:G,stopDragging:ie,unregisterPanel:te,panelGroupElement:y.current}),[O,E,r,L,F,z,v,K,ee,Z,J,le,q,G,ie,te]),B={display:"flex",flexDirection:r==="horizontal"?"row":"column",height:"100%",overflow:"hidden",width:"100%"};return b.createElement(Db.Provider,{value:P},b.createElement(p,{...h,children:t,className:n,id:i,ref:y,style:{...B,...d},[On.group]:"",[On.groupDirection]:r,[On.groupId]:v}))}const Tee=b.forwardRef((e,t)=>b.createElement(xee,{...e,forwardedRef:t}));xee.displayName="PanelGroup";Tee.displayName="forwardRef(PanelGroup)";function Ac(e,t){return e.findIndex(n=>n===t||n.id===t.id)}function Ws(e,t,n){const r=Ac(e,t),i=r===e.length-1?[r-1,r]:[r,r+1],s=n[r];return{...t.constraints,panelSize:s,pivotIndices:i}}function Kje({disabled:e,handleId:t,resizeHandler:n,panelGroupElement:r}){b.useEffect(()=>{if(e||n==null||r==null)return;const a=jb(t,r);if(a==null)return;const i=s=>{if(!s.defaultPrevented)switch(s.key){case"ArrowDown":case"ArrowLeft":case"ArrowRight":case"ArrowUp":case"End":case"Home":{s.preventDefault(),n(s);break}case"F6":{s.preventDefault();const c=a.getAttribute(On.groupId);xt(c,`No group element found for id "${c}"`);const u=Yf(c,r),d=vee(c,t,r);xt(d!==null,`No resize element found for id "${t}"`);const p=s.shiftKey?d>0?d-1:u.length-1:d+1<u.length?d+1:0;u[p].focus();break}}};return a.addEventListener("keydown",i),()=>{a.removeEventListener("keydown",i)}},[r,e,t,n])}function Ree({children:e=null,className:t="",disabled:n=!1,hitAreaMargins:r,id:a,onBlur:i,onClick:s,onDragging:c,onFocus:u,onPointerDown:d,onPointerUp:p,style:h={},tabIndex:v=0,tagName:y="div",...E}){var x,_;const S=b.useRef(null),w=b.useRef({onClick:s,onDragging:c,onPointerDown:d,onPointerUp:p});b.useEffect(()=>{w.current.onClick=s,w.current.onDragging=c,w.current.onPointerDown=d,w.current.onPointerUp=p});const T=b.useContext(Db);if(T===null)throw Error("PanelResizeHandle components must be rendered within a PanelGroup container");const{direction:k,groupId:N,registerResizeHandle:A,startDragging:C,stopDragging:O,panelGroupElement:L}=T,F=wO(a),[z,K]=b.useState("inactive"),[ee,J]=b.useState(!1),[le,q]=b.useState(null),Z=b.useRef({state:z});cl(()=>{Z.current.state=z}),b.useEffect(()=>{if(n)q(null);else{const P=A(F);q(()=>P)}},[n,F,A]);const G=(x=r?.coarse)!==null&&x!==void 0?x:15,ie=(_=r?.fine)!==null&&_!==void 0?_:5;b.useEffect(()=>{if(n||le==null)return;const P=S.current;xt(P,"Element ref not attached");let B=!1;return Oje(F,P,k,{coarse:G,fine:ie},($,U,H)=>{if(!U){K("inactive");return}switch($){case"down":{K("drag"),B=!1,xt(H,'Expected event to be defined for "down" action'),C(F,H);const{onDragging:W,onPointerDown:X}=w.current;W?.(!0),X?.();break}case"move":{const{state:W}=Z.current;B=!0,W!=="drag"&&K("hover"),xt(H,'Expected event to be defined for "move" action'),le(H);break}case"up":{K("hover"),O();const{onClick:W,onDragging:X,onPointerUp:de}=w.current;X?.(!1),de?.(),B||W?.();break}}})},[G,k,n,ie,A,F,le,C,O]),Kje({disabled:n,handleId:F,resizeHandler:le,panelGroupElement:L});const te={touchAction:"none",userSelect:"none"};return b.createElement(y,{...E,children:e,className:t,id:a,onBlur:()=>{J(!1),i?.()},onFocus:()=>{J(!0),u?.()},ref:S,role:"separator",style:{...te,...h},tabIndex:v,[On.groupDirection]:k,[On.groupId]:N,[On.resizeHandle]:"",[On.resizeHandleActive]:z==="drag"?"pointer":ee?"keyboard":void 0,[On.resizeHandleEnabled]:!n,[On.resizeHandleId]:F,[On.resizeHandleState]:z})}Ree.displayName="PanelResizeHandle";function ti({className:e,...t}){return m.jsx(Tee,{"data-slot":"resizable-panel-group",className:$e("flex h-full w-full data-[panel-group-direction=vertical]:flex-col",e),...t})}function Vn({...e}){return m.jsx(see,{"data-slot":"resizable-panel",...e})}function lo({withHandle:e,className:t,...n}){return m.jsx(Ree,{"data-slot":"resizable-handle",className:$e("bg-border focus-visible:ring-ring relative flex w-px items-center justify-center after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:ring-1 focus-visible:ring-offset-1 focus-visible:outline-hidden data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:translate-x-0 data-[panel-group-direction=vertical]:after:-translate-y-1/2 [&[data-panel-group-direction=vertical]>div]:rotate-90",t),...n,children:e&&m.jsx("div",{className:"bg-border z-10 flex h-4 w-3 items-center justify-center rounded-xs border",children:m.jsx(cSe,{className:"size-2.5"})})})}function EO({className:e,...t}){return m.jsx("kbd",{"data-slot":"kbd",className:$e("bg-muted text-muted-foreground pointer-events-none inline-flex h-5 w-fit min-w-5 items-center justify-center gap-1 rounded-sm px-1 font-sans text-xs font-medium select-none","[&_svg:not([class*='size-'])]:size-3","[[data-slot=tooltip-content]_&]:bg-background/20 [[data-slot=tooltip-content]_&]:text-background dark:[[data-slot=tooltip-content]_&]:bg-background/10",e),...t})}function Yje({isSearchExpanded:e,searchQuery:t,filteredNotificationsCount:n,notificationsCount:r,onSearchExpand:a,onSearchChange:i,onSearchBlur:s,onClearAll:c,searchInputRef:u}){return m.jsxs("div",{className:"flex flex-row items-center justify-between p-4 sm:p-4 py-3 gap-2",children:[m.jsx("div",{className:"flex items-center gap-2 flex-1",children:e?m.jsx(Hn,{ref:u,placeholder:"Search notifications...",value:t,onChange:d=>i(d.target.value),onBlur:s,className:"h-8 border-gray-300 dark:border-zinc-600"}):m.jsxs(m.Fragment,{children:[m.jsx("h2",{className:"text-lg font-medium text-gray-900 dark:text-gray-100",children:"Notifications"}),m.jsx(Hr,{className:"bg-zinc-500/20 text-zinc-600 dark:text-zinc-400 border-transparent",variant:"outline",children:n}),m.jsxs(ln,{children:[m.jsx(cn,{asChild:!0,children:m.jsx(Be,{variant:"ghost",size:"sm",onClick:a,className:"h-8 w-8 p-0",children:m.jsx(fb,{className:"h-4 w-4"})})}),m.jsxs(un,{side:"bottom",className:"flex gap-2",children:["Search",m.jsx(EO,{children:"F"})]})]})]})}),m.jsx("div",{className:"flex items-center gap-2",children:m.jsxs(ln,{children:[m.jsx(cn,{asChild:!0,children:m.jsx(Be,{variant:"ghost",size:"sm",onClick:c,disabled:r===0,className:"h-8 w-8 p-0",children:m.jsx(bl,{className:"h-4 w-4"})})}),m.jsx(un,{side:"bottom",children:"Clear all"})]})})]})}function Ku({id:e,isSelected:t,isFocused:n,icon:r,title:a,description:i,metadata:s,onClick:c,className:u}){return m.jsx("button",{id:e,type:"button",onClick:c,className:$e("w-full text-left cursor-pointer p-2 sm:p-4 border-b dark:border-zinc-700 hover:bg-gray-50 dark:hover:bg-zinc-800/50 transition-colors group",t&&"bg-zinc-50 dark:bg-zinc-800 border-l-4 border-l-zinc-500",n&&"ring-2 ring-zinc-500 dark:ring-zinc-400 ring-inset",u),children:m.jsxs("div",{className:"flex items-start gap-2 sm:gap-3",children:[r&&m.jsx("div",{className:"flex-shrink-0 mt-1",children:m.jsx("div",{className:$e("p-2.5 rounded-full transition-colors",t?"bg-zinc-500 dark:bg-zinc-100/80 text-zinc-100 dark:text-zinc-900":"bg-gray-100 dark:bg-zinc-700 text-gray-600 dark:text-gray-400 group-hover:bg-gray-200 dark:group-hover:bg-zinc-600"),children:r})}),m.jsxs("div",{className:"flex-1 min-w-0",children:[m.jsx("div",{className:"flex items-center gap-2 mb-1",children:m.jsx("h3",{className:$e("font-medium truncate font-mono text-sm"),children:a})}),i&&m.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 line-clamp-2",children:i})]})]})})}function Zje({notifications:e,selectedNotification:t,onNotificationSelect:n,focusedIndex:r,formatRelativeTime:a,listRef:i}){return e.length===0?m.jsx("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:m.jsx(ob,{vertical:!0,noBorder:!0,message:"No notifications yet"})}):m.jsx("div",{ref:i,className:"overflow-y-auto flex-1 overscroll-contain",children:e.map((s,c)=>m.jsx(Ku,{id:`notification-${s.id}`,isSelected:t?.id===s.id,isFocused:r===c,title:m.jsxs("span",{className:"flex items-center gap-3",children:[s.method,!s.read&&m.jsx("span",{className:"size-1.5 block rounded-full bg-orange-500"})]}),description:(()=>{const u=a(s.timestamp),d=s.params&&Object.keys(s.params).length>0?Object.keys(s.params).length:0,p=d>0?` | ${d} param${d>1?"s":""}`:"";return u+p})(),onClick:()=>n(s)},s.id))})}function Xje({notification:e,previewMode:t,onTogglePreview:n,onCopy:r,onDownload:a,onFullscreen:i,isCopied:s=!1,onClose:c}){return e?m.jsxs("div",{className:"flex flex-col h-full",children:[m.jsxs("div",{className:"flex-shrink-0 px-4 py-3 border-b border-gray-200 dark:border-zinc-700 flex items-center justify-between",children:[m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsxs("div",{className:"flex items-center gap-1",children:[m.jsx(Tu,{className:"h-3 w-3 text-gray-400"}),m.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:new Date(e.timestamp).toLocaleTimeString()})]}),m.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:e.formatRelativeTime(e.timestamp)})]}),m.jsxs("div",{className:"flex items-center gap-1",children:[m.jsxs(Be,{variant:"ghost",size:"sm",onClick:n,className:t?"":"text-purple-600 dark:text-purple-400",children:[t?m.jsx(PY,{className:"h-4 w-4 mr-1"}):m.jsx(jY,{className:"h-4 w-4 mr-1"}),t?"JSON":"Formatted"]}),m.jsx(Be,{variant:"ghost",size:"sm",onClick:r,children:s?m.jsx(Da,{className:"h-4 w-4"}):m.jsx(Br,{className:"h-4 w-4"})}),m.jsx(Be,{variant:"ghost",size:"sm",onClick:a,children:m.jsx(t1,{className:"h-4 w-4"})}),m.jsx(Be,{variant:"ghost",size:"sm",onClick:i,children:m.jsx(r1,{className:"h-4 w-4"})}),c&&m.jsx(Be,{variant:"ghost",size:"sm",onClick:c,children:m.jsx(qu,{className:"h-4 w-4"})})]})]}),m.jsx("div",{className:"flex-1 overflow-y-auto",children:m.jsx("div",{className:"px-4 pt-4",children:m.jsx(Zn,{data:{method:e.method,timestamp:e.timestamp,read:e.read,params:e.params},filename:`notification-${e.method.replace(/[^a-zA-Z0-9]/g,"-")}-${Date.now()}.json`})})})]}):m.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[m.jsx(QI,{className:"h-12 w-12 text-gray-400 dark:text-gray-600 mb-3"}),m.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"Select a notification to view details"})]})}function Nq(e){const n=Date.now()-e,r=Math.floor(n/1e3),a=Math.floor(r/60),i=Math.floor(a/60),s=Math.floor(i/24);return r<60?"just now":a<60?`${a}m ago`:i<24?`${i}h ago`:s<7?`${s}d ago`:new Date(e).toLocaleDateString()}function Jje({notifications:e,unreadCount:t,markNotificationRead:n,markAllNotificationsRead:r,clearNotifications:a,serverId:i,isConnected:s}){const[c,u]=b.useState(null),[d,p]=b.useState(""),[h,v]=b.useState(-1),[y,E]=b.useState(!0),[x,_]=b.useState(!1),[S,w]=b.useState(!0),[T,k]=b.useState(!1),N=b.useRef(null),A=b.useRef(null),C=b.useRef(null),O=b.useRef(!1);b.useEffect(()=>{y&&e.length>0&&N.current&&!O.current&&(N.current.scrollTop=0)},[e.length,y]),b.useEffect(()=>{const Z=N.current;if(!Z)return;const G=()=>{Z.scrollTop>0&&(O.current=!0,E(!1))};return Z.addEventListener("scroll",G),()=>Z.removeEventListener("scroll",G)},[]),b.useEffect(()=>{e.length===0&&(O.current=!1,E(!0))},[e.length]),b.useEffect(()=>{c&&!c.read&&n(c.id)},[c,n]),b.useEffect(()=>{x&&C.current&&C.current.focus()},[x]);const L=b.useCallback(()=>{d.trim()||_(!1)},[d]),F=b.useMemo(()=>{if(!d.trim())return e;const Z=d.toLowerCase();return e.filter(G=>G.method.toLowerCase().includes(Z)||JSON.stringify(G.params||{}).toLowerCase().includes(Z))},[e,d]);b.useEffect(()=>{v(-1)},[d]),b.useEffect(()=>{const Z=G=>{const ie=G.target;if(ie.tagName==="INPUT"||ie.tagName==="TEXTAREA"||ie.contentEditable==="true"||G.metaKey||G.ctrlKey||G.altKey)return;const P=F;if(G.key==="ArrowDown")G.preventDefault(),v(B=>{const j=B+1;return j>=P.length?0:j});else if(G.key==="ArrowUp")G.preventDefault(),v(B=>{const j=B-1;return j<0?P.length-1:j});else if(G.key==="Enter"&&h>=0){G.preventDefault();const B=F[h];B&&z(B)}};return document.addEventListener("keydown",Z),()=>document.removeEventListener("keydown",Z)},[h,F]),b.useEffect(()=>{if(h>=0){const Z=`notification-${F[h]?.id}`,G=document.getElementById(Z);G&&G.scrollIntoView({behavior:"smooth",block:"nearest"})}},[h,F]);const z=b.useCallback(Z=>{u(Z)},[]),K=b.useCallback(()=>{window.confirm("Are you sure you want to clear all notifications? This cannot be undone.")&&(a(),u(null))},[a]),ee=b.useCallback(async()=>{if(c)try{await navigator.clipboard.writeText(JSON.stringify({method:c.method,timestamp:c.timestamp,read:c.read,params:c.params},null,2)),k(!0),setTimeout(()=>k(!1),2e3)}catch(Z){console.error("[NotificationsTab] Failed to copy notification:",Z)}},[c]),J=b.useCallback(()=>{if(c)try{const Z=new globalThis.Blob([JSON.stringify({method:c.method,timestamp:c.timestamp,read:c.read,params:c.params},null,2)],{type:"application/json"}),G=URL.createObjectURL(Z),ie=document.createElement("a");ie.href=G,ie.download=`notification-${Date.now()}.json`,document.body.appendChild(ie),ie.click(),document.body.removeChild(ie),URL.revokeObjectURL(G)}catch(Z){console.error("[NotificationsTab] Failed to download notification:",Z)}},[c]),le=b.useCallback(async()=>{if(A.current)try{document.fullscreenElement?await document.exitFullscreen():await A.current.requestFullscreen()}catch(Z){console.error("[NotificationsTab] Failed to toggle fullscreen:",Z)}},[]),q=c?{method:c.method,params:c.params,timestamp:c.timestamp,read:c.read,formatRelativeTime:Nq}:null;return s?m.jsxs(ti,{direction:"horizontal",className:"h-full",children:[m.jsx(Vn,{defaultSize:40,minSize:30,children:m.jsx(ti,{direction:"vertical",className:"h-full border-r dark:border-zinc-700",children:m.jsxs(Vn,{defaultSize:75,minSize:30,children:[m.jsx(Yje,{isSearchExpanded:x,searchQuery:d,filteredNotificationsCount:F.length,notificationsCount:e.length,onSearchExpand:()=>_(!0),onSearchChange:p,onSearchBlur:L,onClearAll:K,searchInputRef:C}),m.jsx("div",{className:"flex flex-col h-full",children:m.jsx(Zje,{notifications:F,selectedNotification:c,onNotificationSelect:z,focusedIndex:h,formatRelativeTime:Nq,listRef:N})})]})})}),m.jsx(lo,{}),m.jsx(Vn,{defaultSize:60,minSize:40,children:m.jsx("div",{ref:A,className:"h-full bg-white dark:bg-zinc-900",children:m.jsx(Xje,{notification:q,previewMode:S,onTogglePreview:()=>w(!S),onCopy:ee,onDownload:J,onFullscreen:le,onClose:()=>u(null),isCopied:T})})})]}):m.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[m.jsx(QI,{className:"h-12 w-12 text-gray-400 dark:text-gray-600 mb-3"}),m.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"Not connected to server"})]})}function Nee({activeTab:e,isSearchExpanded:t,searchQuery:n,primaryTabTitle:r,secondaryTabTitle:a,primaryCount:i,secondaryCount:s,secondaryIcon:c,primaryIcon:u,searchPlaceholder:d="Search...",onSearchExpand:p,onSearchChange:h,onSearchBlur:v,onTabSwitch:y,searchInputRef:E,primaryTabName:x}){const _=e===x;return m.jsxs("div",{className:"flex flex-row items-center justify-between p-4 sm:p-4 py-3 gap-2",children:[m.jsx("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:t?m.jsx(Hn,{ref:E,placeholder:d,value:n,onChange:S=>h(S.target.value),onBlur:v,className:"h-8 border-gray-300 dark:border-zinc-600"}):m.jsxs(m.Fragment,{children:[m.jsx("h2",{className:"text-lg font-medium text-gray-900 dark:text-gray-100",children:_?r:a}),_&&m.jsxs(m.Fragment,{children:[m.jsx(Hr,{className:"bg-zinc-500/20 text-zinc-600 dark:text-zinc-400 border-transparent",variant:"outline",children:i}),m.jsxs(ln,{children:[m.jsx(cn,{asChild:!0,children:m.jsx(Be,{variant:"ghost",size:"sm",onClick:p,className:"h-8 w-8 p-0",children:m.jsx(fb,{className:"h-4 w-4"})})}),m.jsxs(un,{side:"bottom",className:"flex gap-2",children:["Search",m.jsx(EO,{children:"F"})]})]})]})]})}),m.jsxs(Be,{variant:"ghost",size:"sm",onClick:y,className:"gap-2 flex-shrink-0",children:[_?m.jsx(c,{}):m.jsx(u,{}),m.jsx("span",{className:"hidden sm:inline",children:_?a:r}),_&&s>0&&m.jsx(Hr,{className:"bg-purple-500/20 text-purple-600 dark:text-purple-400 border-transparent",variant:"outline",children:s})]})]})}function kq({prompts:e,selectedPrompt:t,onPromptSelect:n,focusedIndex:r}){return e.length===0?m.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[m.jsx(Pf,{className:"h-12 w-12 text-gray-400 dark:text-gray-600 mb-3"}),m.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"No prompts available"})]}):m.jsx("div",{className:"overflow-y-auto flex-1 border-r dark:border-zinc-700 overscroll-contain",children:e.map((a,i)=>m.jsx(Ku,{id:`prompt-${a.name}`,isSelected:t?.name===a.name,isFocused:r===i,icon:m.jsx(Pf,{className:"h-4 w-4"}),title:a.name,description:a.description,metadata:a.arguments&&a.arguments.length>0&&m.jsxs(Hr,{variant:"outline",className:"text-xs border-gray-300 dark:border-zinc-600 text-gray-600 dark:text-gray-400",children:[a.arguments.length," args"]}),onClick:()=>n(a)},a.name))})}function Cq({activeTab:e,isSearchExpanded:t,searchQuery:n,filteredPromptsCount:r,savedPromptsCount:a,onSearchExpand:i,onSearchChange:s,onSearchBlur:c,onTabSwitch:u,searchInputRef:d}){return m.jsx(Nee,{activeTab:e,isSearchExpanded:t,searchQuery:n,primaryTabName:"prompts",secondaryTabName:"saved",primaryTabTitle:"Prompts",secondaryTabTitle:"History",primaryCount:r,secondaryCount:a,primaryIcon:Pf,secondaryIcon:Tu,searchPlaceholder:"Search prompts...",onSearchExpand:i,onSearchChange:s,onSearchBlur:c,onTabSwitch:u,searchInputRef:d})}function Aq({savedPrompts:e,selectedPrompt:t,onLoadPrompt:n,onDeletePrompt:r,focusedIndex:a}){return e.length===0?m.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[m.jsx(Tu,{className:"h-12 w-12 text-gray-400 dark:text-gray-600 mb-3"}),m.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"No history"}),m.jsx("p",{className:"text-sm text-gray-400 dark:text-gray-500 mt-1",children:"Prompts you execute will appear here"})]}):m.jsx("div",{className:"overflow-y-auto flex-1 border-r dark:border-zinc-700 overscroll-contain",children:e.map((i,s)=>m.jsx(Ku,{id:`saved-prompt-${i.id}`,isSelected:t?.id===i.id,isFocused:a===s,icon:m.jsx(Tu,{className:"h-4 w-4"}),title:i.name,description:`${i.promptName} - ${new Date(i.savedAt).toLocaleString()}`,onClick:()=>n(i)},i.id))})}function Qje({selectedPrompt:e,promptArgs:t,onArgChange:n}){const r=e?.arguments||[];if(!(r.length>0))return m.jsx("div",{className:"flex items-center justify-center h-32 text-gray-500 dark:text-gray-400 text-sm",children:"No arguments required"});const i=s=>{const c=s.name,u=t[c],d=typeof u=="string"?u:JSON.stringify(u);return s.type==="boolean"?m.jsxs("div",{className:"space-y-2",children:[m.jsxs(yn,{htmlFor:c,className:"text-sm font-medium",children:[c,s.required&&m.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),m.jsxs("div",{className:"flex items-center space-x-2",children:[m.jsx("input",{id:c,type:"checkbox",checked:!!u,onChange:p=>n(c,p.target.checked),className:"rounded","aria-label":`Toggle ${c}`}),m.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400",children:s.description})]})]},c):s.type==="number"?m.jsxs("div",{className:"space-y-2",children:[m.jsxs(yn,{htmlFor:c,className:"text-sm font-medium",children:[c,s.required&&m.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),m.jsx(Hn,{id:c,type:"number",value:Number(u)||0,onChange:p=>n(c,Number(p.target.value)),placeholder:s.description||`Enter ${c}`}),s.description&&m.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:s.description})]},c):s.type==="array"||s.type==="object"?m.jsxs("div",{className:"space-y-2",children:[m.jsxs(yn,{htmlFor:c,className:"text-sm font-medium",children:[c,s.required&&m.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),m.jsx(xb,{id:c,value:d,onChange:p=>{try{const h=JSON.parse(p.target.value);n(c,h)}catch{n(c,p.target.value)}},placeholder:s.description||`Enter ${c} as JSON`,className:"font-mono text-sm min-h-[100px]"}),s.description&&m.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:s.description})]},c):m.jsxs("div",{className:"space-y-2",children:[m.jsxs(yn,{htmlFor:c,className:"text-sm font-medium",children:[c,s.required&&m.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),m.jsx(Hn,{id:c,value:d,onChange:p=>n(c,p.target.value),placeholder:s.description||`Enter ${c}`}),s.description&&m.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:s.description})]},c)};return m.jsx("div",{className:"space-y-4",children:r.map(s=>i(s))})}function Iq({selectedPrompt:e,promptArgs:t,isExecuting:n,isConnected:r,onArgChange:a,onExecute:i,onSave:s}){return e?m.jsxs("div",{className:"flex flex-col h-full",children:[m.jsx("div",{className:"flex-shrink-0 p-3 sm:p-6 pt-3 pb-4 pr-3",children:m.jsxs("div",{children:[m.jsxs("div",{className:"flex flex-row items-center justify-between mb-0 gap-2",children:[m.jsx("h3",{className:"text-base sm:text-lg font-semibold",children:e.name}),m.jsxs("div",{className:"flex gap-2 flex-shrink-0",children:[m.jsx(Be,{onClick:i,disabled:n||!r,size:"sm",className:"lg:size-default",children:n?m.jsxs(m.Fragment,{children:[m.jsx(vo,{className:"mr-2"}),m.jsx("span",{className:"hidden sm:inline",children:"Executing..."})]}):m.jsxs(m.Fragment,{children:[m.jsx(FY,{className:"h-4 w-4 sm:mr-2"}),m.jsx("span",{className:"hidden sm:inline",children:"Execute"})]})}),m.jsxs(Be,{variant:"outline",onClick:s,disabled:n,size:"sm",className:"lg:size-default gap-2",children:[m.jsx(a1,{className:"h-4 w-4"}),m.jsx("span",{className:"hidden sm:inline",children:"Save"})]})]})]}),e.description&&m.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 leading-relaxed mt-2",children:e.description})]})}),m.jsx("div",{className:"flex-1 overflow-y-auto px-3 sm:px-6 pb-4 pr-3",children:m.jsx(Qje,{selectedPrompt:e,promptArgs:t,onArgChange:a})})]}):m.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[m.jsx("p",{className:"text-gray-500 dark:text-gray-400 mb-2",children:"Select a prompt to get started"}),m.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500",children:"Choose a prompt from the list to view its details and execute it"})]})}function Oq({results:e,copiedResult:t,onCopy:n}){return m.jsx("div",{className:"flex flex-col h-full bg-white dark:bg-black border-t dark:border-zinc-700",children:m.jsx("div",{className:"flex-1 overflow-y-auto h-full",children:e.length>0?m.jsx("div",{className:"space-y-4 flex-1 h-full",children:e.map((r,a)=>m.jsxs("div",{className:"space-y-0 flex-1 h-full flex flex-col",children:[m.jsxs("div",{className:"flex items-center gap-2 px-4 pt-2 border-b border-gray-200 dark:border-zinc-600 pb-2",children:[m.jsx("h3",{className:"text-sm font-medium",children:"Response"}),m.jsxs("div",{className:"flex items-center gap-1",children:[m.jsx(Tu,{className:"h-3 w-3 text-gray-400"}),m.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:new Date(r.timestamp).toLocaleTimeString()})]}),r.duration!==void 0&&m.jsxs("div",{className:"flex items-center gap-1",children:[m.jsx(Uf,{className:"h-3 w-3 text-gray-400"}),m.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:[r.duration,"ms"]})]}),m.jsx("div",{className:"flex gap-2 ml-auto",children:m.jsx(Be,{variant:"ghost",size:"sm",onClick:()=>n(a,r.result),className:"h-6 px-2",children:t===a?m.jsx(Da,{className:"h-4 w-4"}):m.jsx(Br,{className:"h-4 w-4"})})})]}),r.error?m.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded p-3 mx-4",children:[m.jsx("p",{className:"text-red-800 dark:text-red-300 font-medium",children:"Error:"}),m.jsx("p",{className:"text-red-700 dark:text-red-400 text-sm",children:r.error})]}):m.jsx("div",{className:"px-4 pt-4",children:m.jsx(Zn,{data:r.result,filename:`prompt-result-${r.promptName}-${Date.now()}.json`})})]},a))}):m.jsx("div",{className:"flex items-center justify-center h-full",children:m.jsx("div",{className:"text-center",children:m.jsx(ob,{vertical:!0,noBorder:!0,message:"No Results yet"})})})})})}function _O({serverIds:e,onCountChange:t,onClearRef:n}={}){const[r,a]=b.useState([]),i=b.useRef(null),[s,c]=b.useState(new Set),[u]=b.useState(""),d=y=>{c(E=>{const x=new Set(E);return x.has(y)?x.delete(y):x.add(y),x})},p=async()=>{a([]),c(new Set),t?.(0);try{const y=new URLSearchParams;e&&e.length>0&&y.set("serverIds",e.join(","));const E=await fetch(`/inspector/api/rpc/log?${y.toString()}`,{method:"DELETE"});E.ok||console.warn("[RPC Logger] Failed to clear server buffer:",E.status)}catch(y){console.warn("[RPC Logger] Error clearing server buffer:",y)}},h=b.useMemo(()=>!e||e.length===0?"":[...e].sort().join(","),[e]);b.useEffect(()=>(n&&(n.current=p),()=>{n&&(n.current=null)}),[n,p]),b.useEffect(()=>{t?.(r.length)},[r.length,t]),b.useEffect(()=>{let y=null;try{const E=new URLSearchParams;E.set("replay","3"),E.set("_t",Date.now().toString()),e&&e.length>0&&E.set("serverIds",e.join(","));const x=`/inspector/api/rpc/stream?${E.toString()}`;console.log("[RPC Logger] Connecting to SSE stream:",x),y=new globalThis.EventSource(x),y.onopen=()=>{console.log("[RPC Logger] SSE connection opened")},y.onmessage=_=>{try{const S=JSON.parse(_.data);if(!S||S.type!=="rpc")return;const{serverId:w,direction:T,message:k,timestamp:N}=S,A=k,C=typeof A?.method=="string"?A.method:A?.result!==void 0?"result":A?.error!==void 0?"error":"unknown",O={id:`${N??Date.now()}-${Math.random().toString(36).slice(2)}`,serverId:typeof w=="string"?w:"unknown",direction:typeof T=="string"?T.toUpperCase():"",method:C,timestamp:N??new Date().toISOString(),payload:k};console.log("[RPC Logger] Received RPC event:",{method:C,direction:T,serverId:w}),a(L=>{const F=[O,...L].slice(0,1e3);return t?.(F.length),F})}catch(S){console.error("[RPC Logger] Error parsing SSE message:",S)}},y.onerror=_=>{console.error("[RPC Logger] SSE connection error:",_);try{y?.close()}catch{}}}catch(E){console.error("[RPC Logger] Failed to create SSE connection:",E)}return()=>{try{y?.close(),console.log("[RPC Logger] SSE connection closed")}catch{}}},[h]);const v=b.useMemo(()=>{let y=r;if(e&&e.length>0){const E=new Set(e);y=y.filter(x=>E.has(x.serverId))}if(u.trim()){const E=u.toLowerCase();y=y.filter(x=>x.serverId.toLowerCase().includes(E)||x.method.toLowerCase().includes(E)||x.direction.toLowerCase().includes(E)||JSON.stringify(x.payload).toLowerCase().includes(E))}return y},[r,u,e]);return m.jsx("div",{className:"flex h-full min-h-0 flex-col overflow-hidden",children:m.jsx("div",{ref:i,className:"flex-1 min-h-0 overflow-y-auto",children:v.length===0?m.jsxs("div",{className:"text-center py-8",children:[m.jsx("div",{className:"text-xs text-muted-foreground",children:"No messages yet"}),m.jsx("div",{className:"text-[10px] text-muted-foreground mt-1",children:"JSON-RPC messages will appear here"})]}):v.map(y=>{const E=s.has(y.id);return m.jsxs("div",{className:"group hover:bg-muted/50 transition-all duration-200 overflow-hidden",children:[m.jsxs("div",{className:"px-3 py-2 flex items-center gap-2 cursor-pointer hover:bg-muted/50 transition-colors",onClick:()=>d(y.id),children:[m.jsx("div",{className:"flex-shrink-0",children:E?m.jsx(Ol,{className:"h-3 w-3 text-muted-foreground transition-transform"}):m.jsx(Iwe,{className:"h-3 w-3 text-muted-foreground transition-transform"})}),m.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[m.jsx("span",{className:"text-muted-foreground font-mono text-xs",children:new Date(y.timestamp).toLocaleTimeString()}),m.jsx("span",{className:`flex items-center justify-center px-1 py-0.5 rounded ${y.direction==="RECEIVE"?"bg-blue-500/10 text-blue-600 dark:text-blue-400":"bg-green-500/10 text-green-600 dark:text-green-400"}`,title:y.direction==="RECEIVE"?"Incoming":"Outgoing",children:y.direction==="RECEIVE"?m.jsx(bwe,{className:"h-3 w-3"}):m.jsx(wwe,{className:"h-3 w-3"})}),m.jsx("span",{className:"text-xs font-mono text-foreground truncate",children:y.method})]})]}),E&&m.jsx("div",{className:"border-t bg-muted/20",children:m.jsx("div",{className:"p-3",children:m.jsx("div",{className:"max-h-[40vh] overflow-auto rounded-sm bg-background/60 p-2",children:m.jsx(Zn,{data:y.payload})})})})]},y.id)})})})}const Dq="mcp-inspector-saved-prompts";function kee({ref:e,prompts:t,callPrompt:n,serverId:r,isConnected:a}){const[i,s]=b.useState(null),[c,u]=b.useState(null),{selectedPromptName:d,setSelectedPromptName:p}=Tp(),[h,v]=b.useState({}),[y,E]=b.useState([]),[x,_]=b.useState(!1),[S,w]=b.useState(null),[T,k]=b.useState(""),[N,A]=b.useState("prompts"),[C,O]=b.useState([]),[L,F]=b.useState(!1),[z,K]=b.useState(""),[ee,J]=b.useState(!1),[le,q]=b.useState(-1),Z=b.useRef(null),[G,ie]=b.useState(!1),[te,P]=b.useState("list"),[B,j]=b.useState(0),[$,U]=b.useState(!0),H=b.useRef(null),W=b.useRef(null);b.useEffect(()=>{const Ee=()=>{ie(window.innerWidth<1024)};return Ee(),window.addEventListener("resize",Ee),()=>window.removeEventListener("resize",Ee)},[]),b.useEffect(()=>{P(i?"detail":"list")},[i]),b.useEffect(()=>{G&&y.length>0&&!x&&P("response")},[y,x,G]),b.useImperativeHandle(e,()=>({focusSearch:()=>{J(!0),setTimeout(()=>{Z.current&&Z.current.focus()},0)},blurSearch:()=>{k(""),J(!1),Z.current&&Z.current.blur()}})),b.useEffect(()=>{try{const Ee=localStorage.getItem(Dq);if(Ee){const Ne=JSON.parse(Ee);O(Ne)}}catch(Ee){console.error("[PromptsTab] Failed to load saved prompts:",Ee)}},[]);const X=b.useCallback(Ee=>{try{localStorage.setItem(Dq,JSON.stringify(Ee))}catch(Ne){console.error("[PromptsTab] Failed to save prompts:",Ne)}},[]);b.useEffect(()=>{ee&&Z.current&&Z.current.focus()},[ee]);const de=b.useCallback(()=>{T.trim()||J(!1)},[T]),ue=b.useMemo(()=>{if(!T.trim())return t;const Ee=T.toLowerCase();return t.filter(Ne=>Ne.name.toLowerCase().includes(Ee)||Ne.description?.toLowerCase().includes(Ee))},[t,T]),Y=b.useCallback(Ee=>{s(Ee);const Ne={};Ee.arguments&&Ee.arguments.forEach(ze=>{ze.default!==void 0?Ne[ze.name]=ze.default:ze.type==="string"?Ne[ze.name]="":ze.type==="number"?Ne[ze.name]=0:ze.type==="boolean"?Ne[ze.name]=!1:ze.type==="array"?Ne[ze.name]=[]:ze.type==="object"&&(Ne[ze.name]={})}),v(Ne)},[]),Q=b.useCallback(Ee=>{const Ne=t.find(ze=>ze.name===Ee.promptName);Ne&&(s(Ne),v(Ee.args),u(Ee))},[t]);b.useEffect(()=>{q(-1)},[T,N]),b.useEffect(()=>{const Ee=Ne=>{const ze=Ne.target;if(ze.tagName==="INPUT"||ze.tagName==="TEXTAREA"||ze.contentEditable==="true"||Ne.metaKey||Ne.ctrlKey||Ne.altKey)return;const je=N==="prompts"?ue:C;if(Ne.key==="ArrowDown")Ne.preventDefault(),q(Ze=>{const Se=Ze+1;return Se>=je.length?0:Se});else if(Ne.key==="ArrowUp")Ne.preventDefault(),q(Ze=>{const Se=Ze-1;return Se<0?je.length-1:Se});else if(Ne.key==="Enter"&&le>=0)if(Ne.preventDefault(),N==="prompts"){const Ze=ue[le];Ze&&Y(Ze)}else{const Ze=C[le];Ze&&Q(Ze)}};return document.addEventListener("keydown",Ee),()=>document.removeEventListener("keydown",Ee)},[le,ue,C,N,Y,Q]),b.useEffect(()=>{if(le>=0){const Ee=N==="prompts"?`prompt-${ue[le]?.name}`:`saved-prompt-${C[le]?.id}`,Ne=document.getElementById(Ee);Ne&&Ne.scrollIntoView({behavior:"smooth",block:"nearest"})}},[le,ue,C,N]),b.useEffect(()=>{if(console.warn("[PromptsTab] Auto-selection effect triggered:",{selectedPromptName:d,promptsCount:t.length,currentSelectedPrompt:i?.name}),d&&t.length>0){const Ee=t.find(Ne=>Ne.name===d);if(console.warn("[PromptsTab] Prompt lookup result:",{selectedPromptName:d,promptFound:!!Ee,promptName:Ee?.name,shouldSelect:Ee&&i?.name!==Ee.name}),Ee&&i?.name!==Ee.name){console.warn("[PromptsTab] Selecting prompt:",Ee.name),p(null);const Ne=setTimeout(()=>{Y(Ee);const ze=document.getElementById(`prompt-${Ee.name}`);ze&&(console.warn("[PromptsTab] Scrolling to prompt element"),ze.scrollIntoView({behavior:"smooth",block:"nearest"}))},100);return()=>clearTimeout(Ne)}}},[d,t,i,Y,p]);const oe=b.useCallback((Ee,Ne)=>{v(ze=>({...ze,[Ee]:Ne}))},[]),ae=b.useCallback(async()=>{if(!i||x)return;_(!0);const Ee=Date.now();try{const Ne=await n(i.name,h),ze=Date.now()-Ee;er.getInstance().capture(new _U({promptName:i.name,serverId:r,success:!0})).catch(()=>{}),E(je=>[{promptName:i.name,args:h,result:Ne,timestamp:Ee,duration:ze},...je])}catch(Ne){er.getInstance().capture(new _U({promptName:i.name,serverId:r,success:!1,error:Ne instanceof Error?Ne.message:"Unknown error"})).catch(()=>{});const he={promptName:i.name,args:h,result:null,error:Ne instanceof Error?Ne.message:String(Ne),timestamp:Ee,duration:Date.now()-Ee};E(je=>[he,...je])}finally{_(!1)}},[i,h,x,n,r]),Re=b.useCallback(async(Ee,Ne)=>{try{await navigator.clipboard.writeText(JSON.stringify(Ne,null,2)),w(Ee),setTimeout(()=>w(null),2e3)}catch(ze){console.error("[PromptsTab] Failed to copy result:",ze)}},[]),Ae=b.useCallback(()=>{i&&(K(""),F(!0))},[i]),Ye=b.useCallback(Ee=>{X(C.filter(Ne=>Ne.id!==Ee)),c?.id===Ee&&u(null)},[C,X,c]);return G?m.jsxs("div",{className:"h-full flex flex-col overflow-hidden relative bg-background",children:[te!=="list"&&m.jsxs("div",{className:"flex items-center gap-2 p-2 border-b shrink-0 bg-background z-10",children:[m.jsx(Be,{variant:"ghost",size:"sm",onClick:()=>{te==="response"?P("detail"):(s(null),P("list"))},className:"p-0 h-8 w-8",children:m.jsx(e1,{className:"h-4 w-4"})}),m.jsxs("div",{className:"flex items-center text-sm font-medium",children:[m.jsx("button",{onClick:()=>{s(null),P("list")},className:"text-muted-foreground hover:text-foreground hover:underline cursor-pointer",children:"Prompts"}),te!=="list"&&m.jsxs(m.Fragment,{children:[m.jsx("span",{className:"mx-2 text-muted-foreground",children:"/"}),m.jsx("button",{onClick:()=>{te==="response"&&P("detail")},className:te==="detail"?"text-foreground hover:underline":te==="response"?"text-muted-foreground hover:text-foreground hover:underline cursor-pointer":"text-muted-foreground",children:"Execute"})]}),te==="response"&&m.jsxs(m.Fragment,{children:[m.jsx("span",{className:"mx-2 text-muted-foreground",children:"/"}),m.jsx("span",{className:"text-foreground",children:"Response"})]})]})]}),m.jsx("div",{className:"flex-1 relative overflow-hidden",children:m.jsxs(bb,{initial:!1,mode:"popLayout",children:[te==="list"&&m.jsxs(qr.div,{initial:{x:"-100%"},animate:{x:0},exit:{x:"-100%"},transition:{type:"spring",stiffness:300,damping:30},className:"absolute inset-0 flex flex-col bg-background z-0",children:[m.jsx(Cq,{activeTab:N,isSearchExpanded:ee,searchQuery:T,filteredPromptsCount:ue.length,savedPromptsCount:C.length,onSearchExpand:()=>J(!0),onSearchChange:k,onSearchBlur:de,onTabSwitch:()=>A(N==="prompts"?"saved":"prompts"),searchInputRef:Z}),N==="prompts"?m.jsx(kq,{prompts:ue,selectedPrompt:i,onPromptSelect:Y,focusedIndex:le}):m.jsx(Aq,{savedPrompts:C,selectedPrompt:c,onLoadPrompt:Q,onDeletePrompt:Ye,focusedIndex:le})]},"list"),te==="detail"&&m.jsx(qr.div,{initial:{x:"100%"},animate:{x:0},exit:{x:"-100%"},transition:{type:"spring",stiffness:300,damping:30},className:"absolute inset-0 bg-background z-10",children:m.jsx(Iq,{selectedPrompt:i,promptArgs:h,isExecuting:x,isConnected:a,onArgChange:oe,onExecute:ae,onSave:Ae})},"detail"),te==="response"&&m.jsx(qr.div,{initial:{x:"100%"},animate:{x:0},exit:{x:"100%"},transition:{type:"spring",stiffness:300,damping:30},className:"absolute inset-0 bg-background z-20",children:m.jsx(Oq,{results:y,copiedResult:S,onCopy:Re})},"response")]})})]}):m.jsxs(ti,{direction:"horizontal",className:"h-full",children:[m.jsx(Vn,{defaultSize:33,className:"flex flex-col h-full relative",children:m.jsxs(ti,{direction:"vertical",className:"h-full border-r dark:border-zinc-700",children:[m.jsx(Vn,{defaultSize:75,minSize:30,children:m.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[m.jsx(Cq,{activeTab:N,isSearchExpanded:ee,searchQuery:T,filteredPromptsCount:ue.length,savedPromptsCount:C.length,onSearchExpand:()=>J(!0),onSearchChange:k,onSearchBlur:de,onTabSwitch:()=>A(N==="prompts"?"saved":"prompts"),searchInputRef:Z}),N==="prompts"?m.jsx(kq,{prompts:ue,selectedPrompt:i,onPromptSelect:Y,focusedIndex:le}):m.jsx(Aq,{savedPrompts:C,selectedPrompt:c,onLoadPrompt:Q,onDeletePrompt:Ye,focusedIndex:le})]})}),m.jsx(lo,{withHandle:!0}),m.jsxs(Vn,{ref:H,defaultSize:0,collapsible:!0,minSize:5,collapsedSize:5,onCollapse:()=>U(!0),onExpand:()=>U(!1),className:"flex flex-col border-t dark:border-zinc-700",children:[m.jsxs("div",{className:"group flex items-center justify-between p-3 shrink-0 cursor-pointer hover:bg-muted/50 transition-colors",onClick:Ee=>{Ee.preventDefault(),Ee.stopPropagation(),$?(H.current?.resize(25),U(!1)):(H.current?.resize(5),U(!0))},children:[m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx("h3",{className:"text-sm font-medium",children:"RPC Messages"}),B>0&&m.jsx(Hr,{variant:"secondary",className:"bg-zinc-500/20 text-zinc-600 dark:text-zinc-400 border-transparent",children:B}),B>0&&!$&&m.jsx(Be,{variant:"ghost",size:"sm",onClick:Ee=>{Ee.preventDefault(),Ee.stopPropagation(),W.current?.()},className:"h-6 w-6 p-0",title:"Clear all messages",children:m.jsx(bl,{className:"h-3.5 w-3.5"})})]}),m.jsx(Ol,{className:`h-4 w-4 text-muted-foreground transition-transform ${$?"rotate-180":""}`})]}),!$&&m.jsx("div",{className:"flex-1 overflow-hidden min-h-0",children:m.jsx(_O,{serverIds:[r],onCountChange:j,onClearRef:W})})]})]})}),m.jsx(lo,{withHandle:!0}),m.jsx(Vn,{defaultSize:67,children:m.jsxs(ti,{direction:"vertical",children:[m.jsx(Vn,{defaultSize:40,children:m.jsx(Iq,{selectedPrompt:i,promptArgs:h,isExecuting:x,isConnected:a,onArgChange:oe,onExecute:ae,onSave:Ae})}),m.jsx(lo,{withHandle:!0}),m.jsx(Vn,{defaultSize:50,children:m.jsx("div",{className:"flex flex-col h-full",children:m.jsx(Oq,{results:y,copiedResult:S,onCopy:Re})})})]})})]})}kee.displayName="PromptsTab";function ru(e){if(!e?.mimeType)return!1;const t=e.mimeType.toLowerCase();return t==="text/html"||t==="text/html+skybridge"||t==="text/uri-list"||t.startsWith("application/vnd.mcp-ui.remote-dom")}function ePe(e){return{uri:e.uri,mimeType:e.mimeType,text:e.text,blob:e.blob}}function Cee({resource:e,onUIAction:t,className:n}){const r=async i=>t?.(i),a=ePe(e);return m.jsx("div",{className:n,children:m.jsx(bO,{resource:a,onUIAction:r,htmlProps:{autoResizeIframe:{width:!0,height:!0},style:{width:"100%",minHeight:"200px"},sandboxPermissions:"allow-scripts allow-same-origin allow-forms allow-popups allow-popups-to-escape-sandbox"},remoteDomProps:{remoteElements:[dje,uje,fje,pje],library:vO}})})}function $q({result:e,isLoading:t,previewMode:n,serverId:r,readResource:a,onTogglePreview:i,onCopy:s,onDownload:c,onFullscreen:u,isCopied:d=!1}){let p=[],h;if(e?.resourceAnnotations&&(p=Object.keys(e.resourceAnnotations).filter(x=>x.startsWith("openai/")),h=e.resourceAnnotations["openai/outputTemplate"]),e?.result?.contents?.[0]?._meta){const x=e.result.contents[0]._meta,_=Object.keys(x).filter(S=>S.startsWith("openai/"));_.length>0&&(p=[...p,..._]),!h&&x["openai/outputTemplate"]&&(h=x["openai/outputTemplate"]),!h&&e.uri&&e.uri.startsWith("ui://widget/")&&(h=e.uri)}const v=!!(p.length>0&&h&&typeof h=="string"&&r&&a);if(t)return m.jsx("div",{className:"flex absolute left-0 top-0 items-center justify-center w-full h-full",children:m.jsx(vo,{className:"size-5"})});if(!e)return m.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[m.jsx("p",{className:"text-gray-500 dark:text-gray-400 mb-2",children:"Select a resource to view its contents"}),m.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500",children:"Choose a resource from the list to see its data"})]});if(e.error)return m.jsx("div",{className:"p-4",children:m.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded p-3",children:[m.jsx("p",{className:"text-red-800 dark:text-red-300 font-medium",children:"Error:"}),m.jsx("p",{className:"text-red-700 dark:text-red-400 text-sm",children:e.error})]})});const y=e?.result?.contents&&Array.isArray(e.result.contents)&&e.result.contents.some(x=>x.mimeType&&ru(x)),E=y?e.result.contents.filter(x=>x.mimeType&&ru(x)):[];return m.jsxs("div",{className:"flex flex-col h-full",children:[m.jsxs("div",{className:"flex-shrink-0 px-4 py-3 border-b border-gray-200 dark:border-zinc-700 flex items-center justify-between",children:[m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsxs("div",{className:"flex items-center gap-1",children:[m.jsx(Tu,{className:"h-3 w-3 text-gray-400"}),m.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:new Date(e.timestamp).toLocaleTimeString()})]}),(()=>{const x=e?.duration??e.result?.duration??e.result?.metrics?.durationMs;return x!==void 0?m.jsxs("div",{className:"flex items-center gap-1",children:[m.jsx(Uf,{className:"h-3 w-3 text-gray-400"}),m.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:[x,"ms"]})]}):null})(),y&&m.jsx(Hr,{variant:"outline",className:"text-xs bg-purple-50 dark:bg-purple-900/20 border-none border-purple-200 dark:border-purple-800/50 text-purple-600 dark:text-purple-400",children:"MCP UI"}),v&&m.jsx(Hr,{variant:"outline",className:"text-xs bg-blue-50 dark:bg-blue-900/20 border-none border-blue-200 dark:border-blue-800/50 text-blue-600 dark:text-blue-400",children:"OpenAI Widget"})]}),m.jsxs("div",{className:"flex items-center gap-1",children:[(y||v)&&m.jsxs(Be,{variant:"ghost",size:"sm",onClick:i,className:n?"":"text-purple-600 dark:text-purple-400",children:[n?m.jsx(PY,{className:"h-4 w-4 mr-1"}):m.jsx(jY,{className:"h-4 w-4 mr-1"}),n?"JSON":v?"Component":"Preview"]}),m.jsx(Be,{variant:"ghost",size:"sm",onClick:s,children:d?m.jsx(Da,{className:"h-4 w-4"}):m.jsx(Br,{className:"h-4 w-4"})}),m.jsx(Be,{variant:"ghost",size:"sm",onClick:c,children:m.jsx(t1,{className:"h-4 w-4"})}),m.jsx(Be,{variant:"ghost",size:"sm",onClick:u,children:m.jsx(r1,{className:"h-4 w-4"})})]})]}),m.jsx("div",{className:"flex-1 overflow-y-auto",children:v&&r&&a&&h?n?m.jsx("div",{className:"flex-1 h-full",children:m.jsx(fO,{componentUrl:h,toolName:e.uri,toolArgs:{},toolResult:e.result,serverId:r,readResource:a,className:"w-full h-full relative flex p-4"})}):m.jsx("div",{className:"px-4 pt-4",children:m.jsx(Zn,{data:e.result,filename:`resource-${e.uri.replace(/[^a-zA-Z0-9]/g,"-")}-${Date.now()}.json`})}):y?n?m.jsxs("div",{className:"space-y-0 h-full",children:[E.map((x,_)=>m.jsx("div",{className:"mx-0 size-full",children:m.jsx("div",{className:"w-full h-full",children:m.jsx(Cee,{resource:x,className:"w-full h-full"})})},`mcp-ui-${x.uri||`resource-${Date.now()}-${Math.random()}`}`)),(()=>{if(e.result.contents&&Array.isArray(e.result.contents)){const x=e.result.contents.filter(_=>!(_.mimeType&&ru(_)));if(x.length>0)return m.jsx("div",{className:"px-4",children:m.jsx(Zn,{data:x,filename:`resource-${e.uri.replace(/[^a-zA-Z0-9]/g,"-")}-non-ui-${Date.now()}.json`})})}return null})()]}):m.jsx("div",{className:"px-4 pt-4",children:m.jsx(Zn,{data:e.result,filename:`resource-${e.uri.replace(/[^a-zA-Z0-9]/g,"-")}-mcp-ui-${Date.now()}.json`})}):m.jsx("div",{className:"px-4 pt-4",children:m.jsx(Zn,{data:e.result,filename:`resource-${e.uri.replace(/[^a-zA-Z0-9]/g,"-")}-${Date.now()}.json`})})})]})}function tPe(e,t){if(!e&&!t)return m.jsx(rSe,{className:"h-5 w-5"});const n=(e||t||"").toLowerCase();return n.includes("image")?m.jsx(eSe,{className:"h-5 w-5"}):n.includes("json")||n.includes("javascript")||n.includes("typescript")?m.jsx(Jwe,{className:"h-5 w-5"}):n.includes("html")||n.includes("xml")?m.jsx(sSe,{className:"h-5 w-5"}):n.includes("database")||n.includes("sql")?m.jsx(db,{className:"h-5 w-5"}):m.jsx(n1,{className:"h-5 w-5"})}function Lq({resources:e,selectedResource:t,onResourceSelect:n,focusedIndex:r}){return e.length===0?m.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[m.jsx(db,{className:"h-12 w-12 text-gray-400 dark:text-gray-600 mb-3"}),m.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"No resources available"})]}):m.jsx("div",{className:"overflow-y-auto flex-1 overscroll-contain",children:e.map((a,i)=>{const s=tPe(a.mimeType,a.uri),c=[a.description,a.mimeType&&m.jsx("span",{className:"font-mono",children:a.mimeType},"mime")].filter(Boolean);return m.jsx(Ku,{id:`resource-${a.uri}`,isSelected:t?.uri===a.uri,isFocused:r===i,icon:s,title:a.name,description:c.length>0?m.jsxs("span",{className:"flex flex-col gap-1",children:[a.description&&m.jsx("span",{children:a.description}),a.mimeType&&m.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-500 font-mono",children:a.mimeType})]}):void 0,onClick:()=>n(a)},a.uri)})})}function Mq({isSearchExpanded:e,searchQuery:t,filteredResourcesCount:n,onSearchExpand:r,onSearchChange:a,onSearchBlur:i,searchInputRef:s}){return m.jsx("div",{className:"flex flex-row items-center justify-between p-4 sm:p-4 py-3 gap-2",children:m.jsx("div",{className:"flex items-center gap-2 flex-1",children:e?m.jsx(Hn,{ref:s,placeholder:"Search resources...",value:t,onChange:c=>a(c.target.value),onBlur:i,className:"h-8 border-gray-300 dark:border-zinc-600"}):m.jsxs(m.Fragment,{children:[m.jsx("h2",{className:"text-lg font-medium text-gray-900 dark:text-gray-100",children:"Resources"}),m.jsx(Hr,{className:"bg-zinc-500/20 text-zinc-600 dark:text-zinc-400 border-transparent",variant:"outline",children:n}),m.jsxs(ln,{children:[m.jsx(cn,{asChild:!0,children:m.jsx(Be,{variant:"ghost",size:"sm",onClick:r,className:"h-8 w-8 p-0",children:m.jsx(fb,{className:"h-4 w-4"})})}),m.jsxs(un,{side:"bottom",className:"flex gap-2",children:["Search",m.jsx(EO,{children:"F"})]})]})]})})})}function Aee({ref:e,resources:t,readResource:n,serverId:r,isConnected:a}){const[i,s]=b.useState(null),{selectedResourceUri:c,setSelectedResourceUri:u}=Tp(),[d,p]=b.useState(null),[h,v]=b.useState(!1),[y,E]=b.useState(""),[x]=b.useState("resources"),[_,S]=b.useState(!0),[w,T]=b.useState(!1),[k,N]=b.useState(-1),[A,C]=b.useState(!1),O=b.useRef(null),L=b.useRef(null),[F,z]=b.useState(!1),[K,ee]=b.useState("list"),[J,le]=b.useState(0),[q,Z]=b.useState(!0),G=b.useRef(null),ie=b.useRef(null);b.useEffect(()=>{const H=()=>{z(window.innerWidth<1024)};return H(),window.addEventListener("resize",H),()=>window.removeEventListener("resize",H)},[]),b.useEffect(()=>{ee(i?"detail":"list")},[i]),b.useImperativeHandle(e,()=>({focusSearch:()=>{T(!0),setTimeout(()=>{O.current&&O.current.focus()},0)},blurSearch:()=>{E(""),T(!1),O.current&&O.current.blur()}})),b.useEffect(()=>{w&&O.current&&O.current.focus()},[w]);const te=b.useCallback(()=>{y.trim()||T(!1)},[y]),P=b.useMemo(()=>{if(!y)return t;const H=y.toLowerCase();return t.filter(W=>W.name.toLowerCase().includes(H)||W.description?.toLowerCase().includes(H)||W.uri.toLowerCase().includes(H))},[t,y]),B=b.useCallback(async H=>{if(s(H),a){v(!0);const W=Date.now();try{const X=await n(H.uri);er.getInstance().capture(new EU({resourceUri:H.uri,serverId:r,success:!0})).catch(()=>{}),p({uri:H.uri,result:X,timestamp:W,resourceAnnotations:H.annotations})}catch(X){er.getInstance().capture(new EU({resourceUri:H.uri,serverId:r,success:!1,error:X instanceof Error?X.message:"Unknown error"})).catch(()=>{}),p({uri:H.uri,result:null,error:X instanceof Error?X.message:"Unknown error",timestamp:W,resourceAnnotations:H.annotations})}finally{v(!1)}}},[n,r,a]);b.useEffect(()=>{N(-1)},[y,x]),b.useEffect(()=>{const H=W=>{const X=W.target;if(X.tagName==="INPUT"||X.tagName==="TEXTAREA"||X.contentEditable==="true"||W.metaKey||W.ctrlKey||W.altKey)return;const ue=P;if(W.key==="ArrowDown")W.preventDefault(),N(Y=>{const Q=Y+1;return Q>=ue.length?0:Q});else if(W.key==="ArrowUp")W.preventDefault(),N(Y=>{const Q=Y-1;return Q<0?ue.length-1:Q});else if(W.key==="Enter"&&k>=0){W.preventDefault();const Y=P[k];Y&&B(Y)}};return document.addEventListener("keydown",H),()=>document.removeEventListener("keydown",H)},[k,P,B]),b.useEffect(()=>{if(k>=0){const H=`resource-${P[k]?.uri}`,W=document.getElementById(H);W&&W.scrollIntoView({behavior:"smooth",block:"nearest"})}},[k,P]),b.useEffect(()=>{if(c&&t.length>0){const H=t.find(W=>W.uri===c);H&&i?.uri!==H.uri&&(u(null),setTimeout(()=>{B(H);const W=document.getElementById(`resource-${H.uri}`);W&&W.scrollIntoView({behavior:"smooth",block:"nearest"})},100))}},[c,t,i,B,u]);const j=b.useCallback(async()=>{if(d)try{await navigator.clipboard.writeText(JSON.stringify(d.result,null,2)),C(!0),setTimeout(()=>C(!1),2e3)}catch(H){console.error("[ResourcesTab] Failed to copy result:",H)}},[d]),$=b.useCallback(()=>{if(d)try{const H=new globalThis.Blob([JSON.stringify(d.result,null,2)],{type:"application/json"}),W=URL.createObjectURL(H),X=document.createElement("a");X.href=W,X.download=`resource-${Date.now()}.json`,document.body.appendChild(X),X.click(),document.body.removeChild(X),URL.revokeObjectURL(W)}catch(H){console.error("[ResourcesTab] Failed to download result:",H)}},[d]),U=b.useCallback(async()=>{if(L.current)try{document.fullscreenElement?await document.exitFullscreen():await L.current.requestFullscreen()}catch(H){console.error("[ResourcesTab] Failed to toggle fullscreen:",H)}},[]);return F?m.jsxs("div",{className:"h-full flex flex-col overflow-hidden relative bg-background",children:[K!=="list"&&m.jsxs("div",{className:"flex items-center gap-2 p-2 border-b shrink-0 bg-background z-10",children:[m.jsx(Be,{variant:"ghost",size:"sm",onClick:()=>{s(null),ee("list")},className:"p-0 h-8 w-8",children:m.jsx(e1,{className:"h-4 w-4"})}),m.jsxs("div",{className:"flex items-center text-sm font-medium",children:[m.jsx("button",{onClick:()=>{s(null),ee("list")},className:"text-muted-foreground hover:text-foreground hover:underline cursor-pointer",children:"Resources"}),K==="detail"&&m.jsxs(m.Fragment,{children:[m.jsx("span",{className:"mx-2 text-muted-foreground",children:"/"}),m.jsx("span",{className:"text-foreground",children:"Content"})]})]})]}),m.jsx("div",{className:"flex-1 relative overflow-hidden",children:m.jsxs(bb,{initial:!1,mode:"popLayout",children:[K==="list"&&m.jsxs(qr.div,{initial:{x:"-100%"},animate:{x:0},exit:{x:"-100%"},transition:{type:"spring",stiffness:300,damping:30},className:"absolute inset-0 flex flex-col bg-background z-0",children:[m.jsx(Mq,{activeTab:x,isSearchExpanded:w,searchQuery:y,filteredResourcesCount:P.length,onSearchExpand:()=>T(!0),onSearchChange:E,onSearchBlur:te,onTabSwitch:()=>{},searchInputRef:O}),m.jsx("div",{className:"flex flex-col h-full",children:m.jsx(Lq,{resources:P,selectedResource:i,onResourceSelect:B,focusedIndex:k})})]},"list"),K==="detail"&&m.jsx(qr.div,{initial:{x:"100%"},animate:{x:0},exit:{x:"100%"},transition:{type:"spring",stiffness:300,damping:30},className:"absolute inset-0 bg-white dark:bg-zinc-900 z-10",children:m.jsx("div",{ref:L,className:"h-full",children:m.jsx($q,{result:d,isLoading:h,previewMode:_,serverId:r,readResource:n,onTogglePreview:()=>S(!_),onCopy:j,onDownload:$,onFullscreen:U,isCopied:A})})},"detail")]})})]}):m.jsxs(ti,{direction:"horizontal",className:"h-full",children:[m.jsx(Vn,{defaultSize:25,children:m.jsxs(ti,{direction:"vertical",className:"h-full border-r dark:border-zinc-700",children:[m.jsx(Vn,{defaultSize:75,minSize:30,children:m.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[m.jsx(Mq,{activeTab:x,isSearchExpanded:w,searchQuery:y,filteredResourcesCount:P.length,onSearchExpand:()=>T(!0),onSearchChange:E,onSearchBlur:te,onTabSwitch:()=>{},searchInputRef:O}),m.jsx(Lq,{resources:P,selectedResource:i,onResourceSelect:B,focusedIndex:k})]})}),m.jsx(lo,{withHandle:!0}),m.jsxs(Vn,{ref:G,defaultSize:0,collapsible:!0,minSize:5,collapsedSize:5,onCollapse:()=>Z(!0),onExpand:()=>Z(!1),className:"flex flex-col border-t dark:border-zinc-700",children:[m.jsxs("div",{className:"group flex items-center justify-between p-3 shrink-0 cursor-pointer hover:bg-muted/50 transition-colors",onClick:H=>{H.preventDefault(),H.stopPropagation(),q?(G.current?.resize(25),Z(!1)):(G.current?.resize(5),Z(!0))},children:[m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx("h3",{className:"text-sm font-medium",children:"RPC Messages"}),J>0&&m.jsx(Hr,{variant:"secondary",className:"bg-zinc-500/20 text-zinc-600 dark:text-zinc-400 border-transparent",children:J}),J>0&&!q&&m.jsx(Be,{variant:"ghost",size:"sm",onClick:H=>{H.preventDefault(),H.stopPropagation(),ie.current?.()},className:"h-6 w-6 p-0",title:"Clear all messages",children:m.jsx(bl,{className:"h-3.5 w-3.5"})})]}),m.jsx(Ol,{className:`h-4 w-4 text-muted-foreground transition-transform ${q?"":"rotate-180"}`})]}),!q&&m.jsx("div",{className:"flex-1 overflow-hidden min-h-0",children:m.jsx(_O,{serverIds:[r],onCountChange:le,onClearRef:ie})})]})]})}),m.jsx(lo,{}),m.jsx(Vn,{defaultSize:50,children:m.jsx(ti,{direction:"vertical",children:m.jsx(Vn,{defaultSize:70,children:m.jsx("div",{ref:L,className:"h-full bg-white dark:bg-zinc-900",children:m.jsx($q,{result:d,isLoading:h,previewMode:_,serverId:r,readResource:n,onTogglePreview:()=>S(!_),onCopy:j,onDownload:$,onFullscreen:U,isCopied:A})})})})})]})}Aee.displayName="ResourcesTab";function jq({savedRequests:e,selectedRequest:t,onLoadRequest:n,onDeleteRequest:r,focusedIndex:a}){if(e.length===0)return m.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[m.jsx(db,{className:"h-12 w-12 text-gray-400 dark:text-gray-600 mb-3"}),m.jsx("p",{className:"text-gray-500 dark:text-gray-400 mb-2",children:"No saved requests yet"}),m.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500",children:"Execute a tool and click Save to store requests"})]});const i=(s,c)=>{s.stopPropagation(),c()};return m.jsx("div",{className:"overflow-y-auto flex-1 border-r dark:border-zinc-700 overscroll-contain",children:e.map((s,c)=>m.jsxs("div",{className:"relative group",children:[m.jsx(Ku,{id:`saved-${s.id}`,isSelected:t?.id===s.id,isFocused:a===c,icon:m.jsx(tv,{className:"h-4 w-4"}),title:s.name,description:s.toolName,metadata:m.jsx("div",{className:"flex flex-col gap-1",children:m.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500",children:new Date(s.savedAt).toLocaleString()})}),onClick:()=>n(s)}),m.jsx("div",{className:"absolute top-1/2 right-2 -translate-y-1/2 opacity-0 group-hover:opacity-100 transition-opacity z-10",children:m.jsxs(ln,{children:[m.jsx(cn,{asChild:!0,children:m.jsx(Be,{variant:"secondary",size:"sm",onClick:u=>i(u,()=>r(s.id)),className:"h-8 w-8 p-0",children:m.jsx(bl,{className:"h-4 w-4"})})}),m.jsx(un,{children:m.jsx("p",{children:"Delete saved request"})})]})})]},s.id))})}function Pq({isOpen:e,requestName:t,defaultPlaceholder:n,onRequestNameChange:r,onSave:a,onCancel:i}){return e?m.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",onClick:i,children:m.jsxs("div",{className:"bg-white dark:bg-zinc-800 rounded-lg p-6 w-[400px] shadow-xl border border-gray-200 dark:border-zinc-700",onClick:s=>s.stopPropagation(),children:[m.jsx("h3",{className:"text-lg font-semibold mb-4 text-gray-900 dark:text-gray-100",children:"Save Request"}),m.jsxs("div",{className:"space-y-4",children:[m.jsxs("div",{children:[m.jsx(yn,{htmlFor:"request-name",children:"Request Name (optional)"}),m.jsx(Hn,{id:"request-name",value:t,onChange:s=>r(s.target.value),placeholder:n,className:"mt-2",onKeyDown:s=>{s.key==="Enter"&&a()},autoFocus:!0})]}),m.jsxs("div",{className:"flex justify-end gap-2",children:[m.jsx(Be,{variant:"outline",onClick:i,children:"Cancel"}),m.jsxs(Be,{onClick:a,children:[m.jsx(a1,{className:"h-4 w-4 mr-2"}),"Save"]})]})]})]})}):null}function Iee(e,t){if(!e?.$ref)return e;const n=e.$ref;if(n.startsWith("#/")){const r=n.substring(2).split("/");let a=t;for(const i of r)if(a&&typeof a=="object"&&i in a)a=a[i];else return console.warn(`Could not resolve $ref: ${n}`),e;return a}return e}function nPe(e,t){if(e.anyOf&&Array.isArray(e.anyOf)){const n=e.anyOf.find(r=>r.type!=="null");if(n)return{...Iee(n,t),nullable:!0}}return e}function rPe(e){return Array.isArray(e.enum)?e.enum:null}function aPe({selectedTool:e,toolArgs:t,onArgChange:n}){const r=e?.inputSchema?.properties||{},a=e?.inputSchema?.required||[];return Object.keys(r).length>0?m.jsx("div",{className:"space-y-4",children:Object.entries(r).map(([s,c])=>{const u=e?.inputSchema||{};let d=nPe(c,u);d=Iee(d,u);const p=rPe(d),h=d.type==="string"&&p!==null,v=d;v.required=a.includes(s);const y=t[s];let E="";return y!=null&&(typeof y=="string"?E=y:typeof y=="object"&&y!==null?E=JSON.stringify(y,null,2):E=String(y)),v.type==="object"||v.type==="array"?m.jsxs("div",{className:"space-y-2",children:[m.jsxs(yn,{htmlFor:s,className:"text-sm font-medium",children:[s,v?.required&&m.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),m.jsx(xb,{id:s,value:E,onChange:_=>n(s,_.target.value),placeholder:v?.description||`Enter ${s}`,className:"min-h-[100px]"}),v?.description&&m.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:v.description})]},s):h&&p?m.jsxs("div",{className:"space-y-2",children:[m.jsxs(yn,{htmlFor:s,className:"text-sm font-medium",children:[s,v.required&&m.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),m.jsxs(Xc,{value:String(t[s]||""),onValueChange:_=>n(s,_),children:[m.jsx(Qc,{id:s,className:"w-full",children:m.jsx(Jc,{placeholder:v.description||"Select an option"})}),m.jsx(eu,{children:p.map((_,S)=>m.jsx(Wa,{value:_,children:v.enumNames?.[S]||_},_))})]}),v.description&&m.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:v.description})]},s):m.jsxs("div",{className:"space-y-2",children:[m.jsxs(yn,{htmlFor:s,className:"text-sm font-medium",children:[s,v?.required&&m.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),m.jsx(Hn,{id:s,value:E,onChange:_=>n(s,_.target.value),placeholder:v?.description||`Enter ${s}`}),v?.description&&m.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:v.description})]},s)})}):m.jsx("div",{className:"flex items-center justify-center h-32 text-gray-500 dark:text-gray-400 text-sm",children:"No parameters required"})}function Uq({selectedTool:e,toolArgs:t,isExecuting:n,isConnected:r,onArgChange:a,onExecute:i,onSave:s}){return b.useEffect(()=>{const c=u=>{(u.metaKey||u.ctrlKey)&&u.key==="Enter"&&e&&!n&&r&&(u.preventDefault(),i())};return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[e,n,r,i]),e?m.jsxs("div",{className:"flex flex-col h-full",children:[m.jsx("div",{className:"flex-shrink-0 p-3 sm:p-5 pt-3 sm:pt-4 pb-4 sm:pr-4",children:m.jsxs("div",{children:[m.jsxs("div",{className:"flex flex-row items-center justify-between mb-0 gap-2",children:[m.jsx("h3",{className:"text-base sm:text-lg font-semibold",children:e.name}),m.jsxs("div",{className:"flex gap-2 flex-shrink-0",children:[m.jsxs(Be,{variant:"outline",onClick:s,disabled:n,size:"sm",className:"lg:size-default gap-2",children:[m.jsx(a1,{className:"h-4 w-4"}),m.jsx("span",{className:"hidden sm:inline",children:"Save"})]}),m.jsx(Be,{onClick:i,disabled:n||!r,size:"sm",className:"lg:size-default pr-1! gap-0",children:n?m.jsxs(m.Fragment,{children:[m.jsx(vo,{className:"mr-2"}),m.jsx("span",{className:"hidden sm:inline",children:"Executing..."})]}):m.jsxs(m.Fragment,{children:[m.jsx(FY,{className:"h-4 w-4 sm:mr-2"}),m.jsx("span",{className:"hidden sm:inline",children:"Execute"}),m.jsx("span",{className:"hidden sm:inline text-[12px] border text-zinc-300 p-1 rounded-full border-zinc-300 dark:text-zinc-600 dark:border-zinc-500 ml-2",children:"⌘↵"})]})})]})]}),e.description&&m.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 leading-relaxed mt-2",children:e.description})]})}),m.jsx("div",{className:"flex-1 overflow-y-auto px-3 sm:px-6 pb-4 pr-3",children:m.jsx(aPe,{selectedTool:e,toolArgs:t,onArgChange:a})})]}):m.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[m.jsx("p",{className:"text-gray-500 dark:text-gray-400 mb-2",children:"Select a tool to get started"}),m.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500",children:"Choose a tool from the list to view its details and execute it"})]})}function zq(e){const n=Date.now()-e,r=Math.floor(n/1e3),a=Math.floor(r/60),i=Math.floor(a/60),s=Math.floor(i/24);return r<10?"now":r<60?`${r}s ago`:a<60?`${a}m ago`:i<24?`${i}h ago`:`${s}d ago`}function iPe(e){try{return JSON.parse(e),!0}catch{return!1}}function oPe({content:e}){return!Array.isArray(e)||e.length===0?m.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:"No content"}):m.jsx("div",{className:"space-y-4",children:e.map((t,n)=>{if(t.type==="text"){const r=t.text||"";if(iPe(r))try{const a=JSON.parse(r);return m.jsxs("div",{className:"space-y-2",children:[m.jsx("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:"Text Content (JSON)"}),m.jsx(Zn,{data:a,filename:`content-${n}.json`})]},n)}catch{}return m.jsxs("div",{className:"space-y-2",children:[m.jsx("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:"Text Content"}),m.jsx("div",{className:"bg-gray-50 dark:bg-zinc-900 rounded-lg p-3 font-mono text-sm whitespace-pre-wrap break-words",children:r})]},n)}if(t.type==="image")return m.jsxs("div",{className:"space-y-2",children:[m.jsx("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:"Image Content"}),m.jsxs("div",{className:"bg-gray-50 dark:bg-zinc-900 rounded-lg p-3",children:[m.jsx("img",{src:`data:${t.mimeType||"image/png"};base64,${t.data}`,alt:"Result",className:"max-w-full rounded"}),t.annotations&&m.jsx("div",{className:"mt-2 text-xs text-gray-500 dark:text-gray-400",children:m.jsx(Zn,{data:t.annotations,filename:`image-annotations-${n}.json`})})]})]},n);if(t.type==="audio")return m.jsxs("div",{className:"space-y-2",children:[m.jsx("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:"Audio Content"}),m.jsxs("div",{className:"bg-gray-50 dark:bg-zinc-900 rounded-lg p-3",children:[m.jsx("audio",{controls:!0,src:`data:${t.mimeType||"audio/wav"};base64,${t.data}`,className:"w-full"}),t.annotations&&m.jsx("div",{className:"mt-2 text-xs text-gray-500 dark:text-gray-400",children:m.jsx(Zn,{data:t.annotations,filename:`audio-annotations-${n}.json`})})]})]},n);if(t.type==="resource_link")return m.jsxs("div",{className:"space-y-2",children:[m.jsx("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:"Resource Link"}),m.jsxs("div",{className:"bg-gray-50 dark:bg-zinc-900 rounded-lg p-3 space-y-2",children:[m.jsxs("div",{className:"font-mono text-sm break-all",children:[m.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:"URI:"})," ",t.uri]}),t.name&&m.jsxs("div",{className:"text-sm",children:[m.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:"Name:"})," ",t.name]}),t.description&&m.jsxs("div",{className:"text-sm",children:[m.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:"Description:"})," ",t.description]}),t.mimeType&&m.jsxs("div",{className:"text-sm",children:[m.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:"MIME Type:"})," ",t.mimeType]}),t.annotations&&m.jsxs("div",{className:"mt-2",children:[m.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:"Annotations:"}),m.jsx(Zn,{data:t.annotations,filename:`resource-link-annotations-${n}.json`})]})]})]},n);if(t.type==="resource"){const r=t.resource||{};return m.jsxs("div",{className:"space-y-2",children:[m.jsx("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:"Embedded Resource"}),m.jsxs("div",{className:"bg-gray-50 dark:bg-zinc-900 rounded-lg p-3 space-y-2",children:[m.jsxs("div",{className:"font-mono text-sm break-all",children:[m.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:"URI:"})," ",r.uri]}),r.mimeType&&m.jsxs("div",{className:"text-sm",children:[m.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:"MIME Type:"})," ",r.mimeType]}),r.text&&m.jsxs("div",{children:[m.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:"Content:"}),m.jsx("div",{className:"bg-white dark:bg-black rounded p-2 font-mono text-sm whitespace-pre-wrap break-words max-h-60 overflow-y-auto",children:r.text})]}),r.blob&&m.jsxs("div",{className:"text-sm text-gray-600 dark:text-gray-400",children:["[Binary content: ",r.blob.length||0," bytes]"]}),r.annotations&&m.jsxs("div",{className:"mt-2",children:[m.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:"Annotations:"}),m.jsx(Zn,{data:r.annotations,filename:`resource-annotations-${n}.json`})]})]})]},n)}return m.jsxs("div",{className:"space-y-2",children:[m.jsxs("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:["Unknown Content Type: ",t.type||"N/A"]}),m.jsx(Zn,{data:t,filename:`content-${n}.json`})]},n)})})}function Fq({results:e,copiedResult:t,previewMode:n,serverId:r,readResource:a,onCopy:i,onTogglePreview:s,onMaximize:c,isMaximized:u=!1}){const[d,p]=b.useState(0),[h,v]=b.useState(""),[y,E]=b.useState(!0),x=e[0],_=x?e.filter(J=>J.toolName===x.toolName):[],S=_[d]||_[0],w=e.findIndex(J=>J===S);b.useEffect(()=>{_.length>0&&d>=_.length&&p(0)},[_.length,d]),b.useEffect(()=>{const J=()=>{S&&v(zq(S.timestamp))};J();const le=setInterval(J,1e3);return()=>clearInterval(le)},[S]);const T=b.useMemo(()=>S?.args,[S?.timestamp,d]),k=b.useMemo(()=>S?.result,[S?.timestamp,d]),N=b.useCallback(J=>a(J),[a]);if(e.length===0)return m.jsx("div",{className:"flex flex-col h-full bg-white dark:bg-black border-t dark:border-zinc-700",children:m.jsx("div",{className:"flex-1 overflow-y-auto h-full",children:m.jsx("div",{className:"flex items-center justify-center h-full",children:m.jsx("div",{className:"text-center",children:m.jsx(ob,{vertical:!0,noBorder:!0,message:"No Results yet"})})})})});const A=S.toolMeta?.["openai/outputTemplate"],C=!!(A&&typeof A=="string"&&S.appsSdkResource),O=A,L=S.result?.content||[],F=L.filter(J=>J.type==="resource"&&ru(J.resource)),z=F.length>0,K=!!(L&&L.length>0||S.result?.structuredContent),ee=!z&&!C&&K;return m.jsx("div",{className:"flex flex-col h-full bg-white dark:bg-black border-t dark:border-zinc-700",children:m.jsx("div",{className:"flex-1 overflow-y-auto h-full",children:m.jsxs("div",{className:"space-y-0 flex-1 h-full flex flex-col",children:[m.jsxs("div",{className:`flex items-center gap-2 px-4 pt-2 ${z||C||ee?"border-b border-gray-200 dark:border-zinc-600 pb-2":""}`,children:[m.jsx("h3",{className:"text-sm font-medium hidden sm:block",children:"Response"}),S.duration!==void 0&&m.jsxs("div",{className:"hidden sm:flex items-center gap-1",children:[m.jsx(Uf,{className:"h-3 w-3 text-gray-400"}),m.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:[S.duration,"ms"]})]}),C&&m.jsxs("div",{className:"flex items-center gap-4 sm:ml-4",children:[m.jsxs("span",{className:"hidden sm:inline text-xs text-gray-500 dark:text-gray-400",children:["URI: ",O||"No URI"]}),m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx("button",{onClick:()=>s(),className:`text-xs font-medium ${n?"text-black dark:text-white":"text-zinc-500 dark:text-zinc-400"}`,children:"Component"}),m.jsx("span",{className:"text-xs text-zinc-400",children:"|"}),m.jsx("button",{onClick:()=>s(),className:`text-xs font-medium ${n?"text-zinc-500 dark:text-zinc-400":"text-black dark:text-white"}`,children:"Raw JSON"})]})]}),z&&!C&&m.jsxs("div",{className:"flex items-center gap-4 sm:ml-4",children:[m.jsxs("span",{className:"hidden sm:inline text-xs text-gray-500 dark:text-gray-400",children:["URI: ",F[0]?.resource?.uri||"No URI"]}),m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx("button",{onClick:()=>s(),className:`text-xs font-medium ${n?"text-black dark:text-white":"text-zinc-500 dark:text-zinc-400"}`,children:"Preview"}),m.jsx("span",{className:"text-xs text-zinc-400",children:"|"}),m.jsx("button",{onClick:()=>s(),className:`text-xs font-medium ${n?"text-zinc-500 dark:text-zinc-400":"text-black dark:text-white"}`,children:"JSON"})]})]}),ee&&m.jsxs("div",{className:"flex items-center gap-2 sm:ml-4",children:[m.jsx("button",{onClick:()=>E(!0),className:`text-xs font-medium ${y?"text-black dark:text-white":"text-zinc-500 dark:text-zinc-400"}`,children:"Formatted"}),m.jsx("span",{className:"text-xs text-zinc-400",children:"|"}),m.jsx("button",{onClick:()=>E(!1),className:`text-xs font-medium ${y?"text-zinc-500 dark:text-zinc-400":"text-black dark:text-white"}`,children:"Raw"})]}),m.jsxs("div",{className:"ml-auto flex items-center gap-1",children:[(C||z)&&c&&m.jsx(Be,{variant:"ghost",size:"sm",onClick:c,title:u?"Restore":"Maximize",children:u?m.jsx(wSe,{className:"h-4 w-4"}):m.jsx(r1,{className:"h-4 w-4"})}),_.length>1&&m.jsxs(Xc,{value:d.toString(),onValueChange:J=>p(parseInt(J)),children:[m.jsx(Qc,{size:"sm",className:"w-[140px] h-8 text-xs",children:m.jsx(Jc,{children:m.jsxs("div",{className:"flex items-center gap-1",children:[m.jsx(tv,{className:"h-3 w-3"}),m.jsx("span",{children:h})]})})}),m.jsx(eu,{children:_.map((J,le)=>m.jsx(Wa,{value:le.toString(),children:m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx(tv,{className:"h-3 w-3"}),m.jsx("span",{children:zq(J.timestamp)}),m.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",new Date(J.timestamp).toLocaleTimeString(),")"]})]})},le))})]}),m.jsx(Be,{variant:"ghost",size:"sm",onClick:()=>i(w,S.result),children:t===w?m.jsx(Da,{className:"h-4 w-4"}):m.jsx(Br,{className:"h-4 w-4"})})]})]}),S.error?m.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded p-3 mx-4",children:[m.jsx("p",{className:"text-red-800 dark:text-red-300 font-medium",children:"Error:"}),m.jsx("p",{className:"text-red-700 dark:text-red-400 text-sm",children:S.error})]}):(()=>{if(C){const J=S.appsSdkResource;return J.isLoading?m.jsx(m.Fragment,{}):J.error?m.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded p-3 mx-4",children:[m.jsx("p",{className:"text-red-800 dark:text-red-300 font-medium",children:"Resource Error:"}),m.jsx("p",{className:"text-red-700 dark:text-red-400 text-sm",children:J.error})]}):n?m.jsx("div",{className:"flex-1",children:m.jsx(fO,{componentUrl:O,toolName:S.toolName,toolArgs:T,toolResult:k,serverId:r,readResource:N,className:"w-full h-full relative p-4"})}):m.jsx("div",{className:"px-4 pt-4",children:m.jsx(Zn,{data:S.result,filename:`tool-result-${S.toolName}-${Date.now()}.json`})})}if(z)return n?m.jsxs("div",{className:"space-y-0 h-full",children:[F.map((J,le)=>m.jsx("div",{className:"mx-0 size-full",children:m.jsx(Cee,{resource:J.resource,onUIAction:q=>{},className:"w-full h-full relative"})},le)),L.filter(J=>!(J.type==="resource"&&ru(J.resource))).length>0&&m.jsx("div",{className:"px-4",children:m.jsx(Zn,{data:L.filter(J=>!(J.type==="resource"&&ru(J.resource))),filename:`tool-result-${S.toolName}-non-ui-${Date.now()}.json`})})]}):m.jsx("div",{className:"px-4 pt-4",children:m.jsx(Zn,{data:S.result,filename:`tool-result-${S.toolName}-mcp-ui-${Date.now()}.json`})});if(ee&&y){const J=S.result?.structuredContent;return m.jsxs("div",{className:"px-4 pt-4 space-y-4",children:[J&&m.jsxs("div",{className:"space-y-2",children:[m.jsx("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:"Structured Content"}),m.jsx(Zn,{data:J,filename:`structured-content-${S.toolName}-${Date.now()}.json`})]}),L&&L.length>0&&m.jsx(oPe,{content:L}),!J&&(!L||L.length===0)&&m.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:"No content to display"})]})}return m.jsx("div",{className:"px-4 pt-4",children:m.jsx(Zn,{data:S.result,filename:`tool-result-${S.toolName}-${Date.now()}.json`})})})()]})})})}function Bq({tools:e,selectedTool:t,onToolSelect:n,focusedIndex:r}){return e.length===0?m.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[m.jsx(yl,{className:"h-12 w-12 text-gray-400 dark:text-gray-600 mb-3"}),m.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"No tools available"})]}):m.jsx("div",{className:"overflow-y-auto flex-1 overscroll-contain",children:e.map((a,i)=>m.jsx(Ku,{id:`tool-${a.name}`,isSelected:t?.name===a.name,isFocused:r===i,icon:m.jsx(yl,{className:"h-4 w-4"}),title:a.name,description:a.description,metadata:a.inputSchema?.properties&&m.jsxs(Hr,{variant:"outline",className:"text-xs border-gray-300 dark:border-zinc-600 text-gray-600 dark:text-gray-400",children:[Object.keys(a.inputSchema.properties).length," params"]}),onClick:()=>n(a)},a.name))})}function qq({activeTab:e,isSearchExpanded:t,searchQuery:n,filteredToolsCount:r,savedRequestsCount:a,onSearchExpand:i,onSearchChange:s,onSearchBlur:c,onTabSwitch:u,searchInputRef:d}){return m.jsx(Nee,{activeTab:e,isSearchExpanded:t,searchQuery:n,primaryTabName:"tools",secondaryTabName:"saved",primaryTabTitle:"Tools",secondaryTabTitle:"Saved",primaryCount:r,secondaryCount:a,primaryIcon:yl,secondaryIcon:db,searchPlaceholder:"Search tools...",onSearchExpand:i,onSearchChange:s,onSearchBlur:c,onTabSwitch:u,searchInputRef:d})}const Hq="mcp-inspector-saved-requests";function Oee({ref:e,tools:t,callTool:n,readResource:r,serverId:a,isConnected:i}){const[s,c]=b.useState(null),[u,d]=b.useState(null),{selectedToolName:p,setSelectedToolName:h}=Tp(),[v,y]=b.useState({}),[E,x]=b.useState([]),[_,S]=b.useState(!1),[w,T]=b.useState(null),[k,N]=b.useState(""),[A,C]=b.useState("tools"),[O,L]=b.useState([]),[F,z]=b.useState(!1),[K,ee]=b.useState(""),[J,le]=b.useState(!0),[q,Z]=b.useState(!1),[G,ie]=b.useState(-1),te=b.useRef(null),[P,B]=b.useState(!1),[j,$]=b.useState("list"),[U,H]=b.useState(!1),[W,X]=b.useState(0),[de,ue]=b.useState(!0),[Y,Q]=b.useState(void 0),oe=b.useRef(null),ae=b.useRef(null),Re=b.useRef(null),Ae=b.useRef(null),Ye=b.useRef(null);b.useEffect(()=>{const De=()=>{B(window.innerWidth<1024)};return De(),window.addEventListener("resize",De),()=>window.removeEventListener("resize",De)},[]),b.useEffect(()=>{$(s?"detail":"list")},[s]),b.useEffect(()=>{P&&E.length>0&&!_&&$("response")},[E,_,P]),b.useImperativeHandle(e,()=>({focusSearch:()=>{Z(!0),setTimeout(()=>{te.current&&te.current.focus()},0)},blurSearch:()=>{N(""),Z(!1),te.current&&te.current.blur()}})),b.useEffect(()=>{try{const De=localStorage.getItem(Hq);De&&L(JSON.parse(De))}catch(De){console.error("[ToolsTab] Failed to load saved requests:",De)}},[]);const Ee=b.useCallback(De=>{try{localStorage.setItem(Hq,JSON.stringify(De)),L(De)}catch(ke){console.error("[ToolsTab] Failed to save requests:",ke)}},[]),Ne=b.useMemo(()=>{if(!k.trim())return t;const De=k.toLowerCase();return t.filter(ke=>ke.name.toLowerCase().includes(De)||ke.description?.toLowerCase().includes(De))},[t,k]),ze=b.useCallback(De=>{c(De);const ke={};De.inputSchema?.properties&&Object.entries(De.inputSchema.properties).forEach(([Fe,vt])=>{const gt=vt;gt.default!==void 0?ke[Fe]=gt.default:gt.type==="string"?ke[Fe]="":gt.type==="number"?ke[Fe]=0:gt.type==="boolean"?ke[Fe]=!1:gt.type==="array"?ke[Fe]="[]":gt.type==="object"&&(ke[Fe]="{}")}),y(ke)},[]),he=b.useCallback(De=>{const ke=t.find(Fe=>Fe.name===De.toolName);ke&&(c(ke),y(De.args),d(De))},[t]);b.useEffect(()=>{q&&te.current&&te.current.focus()},[q]);const je=b.useCallback(()=>{k.trim()||Z(!1)},[k]);b.useEffect(()=>{A!=="tools"&&Z(!1)},[A]),b.useEffect(()=>{ie(-1)},[k,A]),b.useEffect(()=>{const De=ke=>{const Fe=ke.target;if(Fe.tagName==="INPUT"||Fe.tagName==="TEXTAREA"||Fe.contentEditable==="true"||ke.metaKey||ke.ctrlKey||ke.altKey)return;const gt=A==="tools"?Ne:O;if(ke.key==="ArrowDown")ke.preventDefault(),ie(Lt=>{const qt=Lt+1;return qt>=gt.length?0:qt});else if(ke.key==="ArrowUp")ke.preventDefault(),ie(Lt=>{const qt=Lt-1;return qt<0?gt.length-1:qt});else if(ke.key==="Enter"&&G>=0)if(ke.preventDefault(),A==="tools"){const Lt=Ne[G];Lt&&ze(Lt)}else{const Lt=O[G];Lt&&he(Lt)}};return document.addEventListener("keydown",De),()=>document.removeEventListener("keydown",De)},[G,Ne,O,A,ze,he]),b.useEffect(()=>{if(G>=0){const De=A==="tools"?`tool-${Ne[G]?.name}`:`saved-${O[G]?.id}`,ke=document.getElementById(De);ke&&ke.scrollIntoView({behavior:"smooth",block:"nearest"})}},[G,Ne,O,A]),b.useEffect(()=>{if(p&&t.length>0){const De=t.find(ke=>ke.name===p);if(De&&s?.name!==De.name){h(null);const ke=setTimeout(()=>{ze(De);const Fe=document.getElementById(`tool-${De.name}`);Fe&&Fe.scrollIntoView({behavior:"smooth",block:"nearest"})},100);return()=>clearTimeout(ke)}}},[p,t,s,ze,h]);const Ze=b.useCallback((De,ke)=>{y(Fe=>{const vt={...Fe};if(s?.inputSchema?.properties?.[De]){const Lt=s.inputSchema.properties[De].type;if(Lt==="object"||Lt==="array")vt[De]=ke;else if(Lt==="string")vt[De]=ke;else try{vt[De]=JSON.parse(ke)}catch{vt[De]=ke}}else vt[De]=ke;return vt})},[s]),Se=b.useCallback(async()=>{if(!s||_)return;S(!0);const De=Date.now();try{const ke={...v};s.inputSchema?.properties&&Object.entries(s.inputSchema.properties).forEach(([Pt,pn])=>{const en=pn.type,ct=ke[Pt];if((en==="object"||en==="array")&&typeof ct=="string")try{ke[Pt]=JSON.parse(ct)}catch{}});const Fe=await n(s.name,ke,{timeout:6e5,resetTimeoutOnProgress:!0}),vt=Date.now()-De;er.getInstance().capture(new SU({toolName:s.name,serverId:a,success:!0,duration:vt})).catch(()=>{});const Lt=s?._meta||s?.metadata,qt=Lt?.["openai/outputTemplate"];let Ct;if(qt&&typeof qt=="string"){const Pt={toolName:s.name,args:v,result:Fe,timestamp:De,duration:vt,toolMeta:Lt,appsSdkResource:{uri:qt,resourceData:null,isLoading:!0}};x([Pt]);try{const pn=await r(qt);let Rn=null;if(Fe?.structuredContent)Rn=Fe.structuredContent;else if(Array.isArray(Fe)&&Fe[0]){const en=Fe[0];en.output?.value?.structuredContent?Rn=en.output.value.structuredContent:en.structuredContent?Rn=en.structuredContent:en.output?.value&&(Rn=en.output.value)}Rn||(Rn=Fe),Ct={uri:qt,resourceData:{...pn,structuredContent:Rn},isLoading:!1}}catch(pn){Ct={uri:qt,resourceData:null,isLoading:!1,error:pn instanceof Error?pn.message:String(pn)}}x(pn=>pn.map((Rn,en)=>en===0?{...Rn,appsSdkResource:Ct}:Rn))}else x(Pt=>[{toolName:s.name,args:v,result:Fe,timestamp:De,duration:vt,toolMeta:Lt},...Pt])}catch(ke){const Fe=Date.now()-De;er.getInstance().capture(new SU({toolName:s.name,serverId:a,success:!1,duration:Fe,error:ke instanceof Error?ke.message:String(ke)})).catch(()=>{});const gt=s?._meta||s?.metadata,Lt={toolName:s.name,args:v,result:null,error:ke instanceof Error?ke.message:String(ke),timestamp:De,duration:Fe,toolMeta:gt},qt=gt?.["openai/outputTemplate"];x(qt?[Lt]:Ct=>[Lt,...Ct])}finally{S(!1)}},[s,v,_,n,r,a]),ot=b.useCallback(async(De,ke)=>{try{await navigator.clipboard.writeText(JSON.stringify(ke,null,2)),T(De),setTimeout(()=>T(null),2e3)}catch(Fe){console.error("[ToolsTab] Failed to copy result:",Fe)}},[]),ut=b.useCallback(De=>{x(ke=>ke.filter((Fe,vt)=>vt!==De))},[]),tt=b.useCallback(De=>{const ke=E[De];if(ke){const Fe=window.open("","_blank","width=800,height=600");Fe&&(Fe.document.write(`
|
|
1614
|
+
`);T=A.pop()||"";for(const C of A)if(C.trim()&&C.startsWith("data: "))try{const O=JSON.parse(C.slice(6));if(console.log("[Client received event]",O.type,O.toolName||O.content?.slice?.(0,30)),O.type==="message")console.log("[Message started]",O.id);else if(O.type==="text"){x+=O.content;const L=_[_.length-1];L&&L.type==="text"?L.text=x:_.push({type:"text",text:x}),console.log("[Parts after text]",_.length,"parts, text length:",x.length),i(F=>F.map(z=>z.id===E?{...z,parts:[..._]}:z))}else if(O.type==="tool-call")x&&(x=""),_.push({type:"tool-invocation",toolInvocation:{toolName:O.toolName,args:O.args,state:"pending"}}),console.log("[Parts after tool-call]",_.length,"parts, tool:",O.toolName),i(L=>L.map(F=>F.id===E?{...F,parts:[..._]}:F));else if(O.type==="tool-result"){const L=_.find(F=>F.type==="tool-invocation"&&F.toolInvocation?.toolName===O.toolName&&!F.toolInvocation?.result);L&&L.toolInvocation?(L.toolInvocation.result=O.result,L.toolInvocation.state="result",console.log("[Parts after tool-result]",_.length,"parts, updated:",O.toolName),i(F=>F.map(z=>z.id===E?{...z,parts:[..._]}:z))):console.warn("[tool-result] Could not find matching tool part for",O.toolName)}else if(O.type==="done")console.log("[Done] Final parts:",_.length),i(L=>L.map(F=>F.id===E?{...F,parts:[..._],content:""}:F));else if(O.type==="error")throw new Error(O.message||"Streaming error")}catch(O){console.error("Failed to parse streaming event:",O,C)}}}catch(v){let y="Unknown error occurred";if(v instanceof Error){y=v.message;const x=v;x.status&&(y=`HTTP ${x.status}: ${y}`),(x.code===401||y.includes("401")||y.includes("Unauthorized"))&&(y="Authentication failed (401). Check your Authorization header in the connection settings.")}const E={id:`error-${Date.now()}`,role:"assistant",content:`Error: ${y}`,timestamp:Date.now()};i(x=>[...x,E])}finally{c(!1)}},[t,r,e,a,n]),d=b.useCallback(()=>{i([])},[]);return{messages:a,isLoading:s,sendMessage:u,clearMessages:d}}function bje({connection:e,llmConfig:t,isConnected:n,readResource:r}){const[a,i]=b.useState([]),[s,c]=b.useState(!1),u=b.useRef(null),d=b.useRef(null),p=b.useRef(null),h=b.useCallback(async y=>{if(!y.trim()||!t||!n)return;const E={id:`user-${Date.now()}`,role:"user",content:y.trim(),timestamp:Date.now()};i(S=>[...S,E]),c(!0),u.current=new AbortController;const x=Date.now();let _=0;try{const S=`assistant-${Date.now()}`;let w="";const T=[];if(i(k=>[...k,{id:S,role:"assistant",content:"",timestamp:Date.now(),parts:[]}]),!p.current||p.current.provider!==t.provider||p.current.model!==t.model||p.current.apiKey!==t.apiKey){let k;if(t.provider==="openai"){const{ChatOpenAI:N}=await Za(async()=>{const{ChatOpenAI:A}=await import("./index-F_9Gh2r-.js");return{ChatOpenAI:A}},__vite__mapDeps([5,6,3,7,8]));k=new N({model:t.model,apiKey:t.apiKey})}else if(t.provider==="anthropic"){const{ChatAnthropic:N}=await Za(async()=>{const{ChatAnthropic:A}=await import("./index-DdLEVZyw.js");return{ChatAnthropic:A}},__vite__mapDeps([9,6,3]));k=new N({model:t.model,apiKey:t.apiKey})}else if(t.provider==="google"){const{ChatGoogleGenerativeAI:N}=await Za(async()=>{const{ChatGoogleGenerativeAI:A}=await import("./index-CUBkdPCm.js");return{ChatGoogleGenerativeAI:A}},__vite__mapDeps([10,6,3,8]));k=new N({model:t.model,apiKey:t.apiKey})}else throw new Error(`Unsupported LLM provider: ${t.provider}`);p.current={instance:k,provider:t.provider,model:t.model,apiKey:t.apiKey}}if(!d.current||d.current.llm!==p.current.instance){const{MCPAgent:k}=await Za(async()=>{const{MCPAgent:N}=await import("./browser-B7GyC5Dk.js");return{MCPAgent:N}},__vite__mapDeps([11,7,6,3,2,4,8]));d.current=new k({llm:p.current.instance,client:e.client,memoryEnabled:!0,systemPrompt:"You are a helpful assistant with access to MCP tools, prompts, and resources. Help users interact with the MCP server."}),await d.current.initialize()}else console.log("[useChatMessagesClientSide] Reusing existing agent. History length:",d.current.conversationHistory?.length);for await(const k of d.current.streamEvents(y,10,!1,void 0)){if(u.current?.signal.aborted)break;if(k.event==="on_chat_model_stream"&&k.data?.chunk?.text){const N=k.data.chunk.text;if(typeof N=="string"&&N.length>0){w+=N;const A=T[T.length-1];A&&A.type==="text"?A.text=w:T.push({type:"text",text:w}),i(C=>C.map(O=>O.id===S?{...O,parts:[...T]}:O))}}else if(k.event==="on_tool_start"){w&&(w="");let N={};k.data?.input?N=k.data.input:k.data?.tool_input?N=k.data.tool_input:k.data&&(N=k.data),console.log("[useChatMessagesClientSide] on_tool_start:",{toolName:k.name,eventData:k.data,extractedArgs:N}),_++,T.push({type:"tool-invocation",toolInvocation:{toolName:k.name||"unknown",args:N,state:"pending"}}),i(A=>A.map(C=>C.id===S?{...C,parts:[...T]}:C))}else if(k.event==="on_tool_end"){const N=T.find(A=>A.type==="tool-invocation"&&A.toolInvocation?.toolName===k.name&&!A.toolInvocation?.result);if(console.log("[useChatMessagesClientSide] on_tool_end event:",{toolName:k.name,hasToolPart:!!N,output:k.data?.output}),N&&N.toolInvocation){let A=k.data?.output;if(A?.kwargs?.content&&typeof A.kwargs.content=="string")try{A=JSON.parse(A.kwargs.content)}catch(O){console.warn("[useChatMessagesClientSide] Failed to parse kwargs.content:",O),A=A.kwargs.content}else if(A?.content&&typeof A.content=="string")try{A=JSON.parse(A.content)}catch{A=A.content}N.toolInvocation.result=A,N.toolInvocation.state="result";const C=A?._meta?.["openai/outputTemplate"];if(console.log("[useChatMessagesClientSide] Tool result:",{toolName:k.name,hasMeta:!!A?._meta,hasStructuredContent:!!A?.structuredContent,appsSdkUri:C}),C&&typeof C=="string"&&r){console.log("[useChatMessagesClientSide] Detected Apps SDK component, fetching resource:",C);try{const O=await r(C);console.log("[useChatMessagesClientSide] Resource fetched:",O);const L=A?.structuredContent||null;if(O?.contents&&Array.isArray(O.contents)){const F=O.contents.map(K=>({type:"resource",resource:K}));console.log("[useChatMessagesClientSide] Created MCP resources:",F);const z={...A,content:[...A.content||[],...F],structuredContent:L};N.toolInvocation.result=z,console.log("[useChatMessagesClientSide] Updated result with resources")}else console.warn("[useChatMessagesClientSide] No contents in resourceData:",O)}catch(O){console.error("Failed to fetch Apps SDK resource:",O)}}i(O=>O.map(L=>L.id===S?{...L,parts:[...T]}:L))}}}i(k=>k.map(N=>N.id===S?{...N,parts:[...T],content:""}:N)),t&&er.getInstance().capture(new xU({serverId:e.url,provider:t.provider,model:t.model,messageCount:a.length+1,toolCallsCount:_,success:!0,executionMode:"client-side",duration:Date.now()-x})).catch(()=>{})}catch(S){console.error("Client-side agent error:",S);let w="Unknown error occurred";if(S instanceof Error){w=S.message;const k=S;k.status&&(w=`HTTP ${k.status}: ${w}`),(k.code===401||w.includes("401")||w.includes("Unauthorized"))&&(w="Authentication failed (401). Check your Authorization header in the connection settings.")}t&&er.getInstance().capture(new xU({serverId:e.url,provider:t.provider,model:t.model,messageCount:a.length+1,toolCallsCount:_,success:!1,executionMode:"client-side",duration:Date.now()-x,error:w})).catch(()=>{});const T={id:`error-${Date.now()}`,role:"assistant",content:`Error: ${w}`,timestamp:Date.now()};i(k=>[...k,T])}finally{c(!1),u.current=null}},[e,t,n,a,r]),v=b.useCallback(()=>{i([]),d.current&&d.current.clearConversationHistory()},[]);return{messages:a,isLoading:s,sendMessage:h,clearMessages:v}}const bq={openai:"gpt-4o",anthropic:"claude-haiku-4-5-20251001",google:"gemini-2.5-flash"};function yje({mcpServerUrl:e}){const[t,n]=b.useState(null),[r,a]=b.useState(null),[i,s]=b.useState(!1),[c,u]=b.useState("openai"),[d,p]=b.useState(""),[h,v]=b.useState(bq.openai),y=b.useCallback(()=>{const L=localStorage.getItem("mcp-inspector-api-keys");if(L)try{return JSON.parse(L)}catch(F){return console.error("Failed to load API keys:",F),{}}return{}},[]),E=b.useCallback(L=>{localStorage.setItem("mcp-inspector-api-keys",JSON.stringify(L))},[]),[x,_]=b.useState("none"),[S,w]=b.useState(""),[T,k]=b.useState(""),[N,A]=b.useState("");b.useEffect(()=>{const L=localStorage.getItem("mcp-inspector-llm-config"),F=y();if(L)try{const z=JSON.parse(L);n(z),u(z.provider),p(F[z.provider]||z.apiKey||""),v(z.model)}catch(z){console.error("Failed to load LLM config:",z)}},[y]),b.useEffect(()=>{const L=localStorage.getItem("mcp-inspector-auth-config");if(L)try{const F=JSON.parse(L);a(F),_(F.type),F.username&&w(F.username),F.password&&k(F.password),F.token&&A(F.token)}catch(F){console.error("Failed to load auth config:",F)}else try{const F="mcp:auth",z=iee(e),K=`${F}_${z}_tokens`;localStorage.getItem(K)&&(a({type:"oauth"}),_("oauth"))}catch(F){console.error("Failed to check for OAuth tokens:",F)}},[e]),b.useEffect(()=>{v(bq[c]);const L=y();p(L[c]||"")},[c,y]);const C=b.useCallback(()=>{if(!d.trim())return;const L=y();L[c]=d,E(L);const F={provider:c,apiKey:d,model:h},z={type:x,...x==="basic"&&{username:S.trim(),password:T.trim()},...x==="bearer"&&{token:N.trim()}};n(F),a(z),localStorage.setItem("mcp-inspector-llm-config",JSON.stringify(F)),localStorage.setItem("mcp-inspector-auth-config",JSON.stringify(z)),s(!1)},[c,d,h,x,S,T,N,y,E]),O=b.useCallback(()=>{n(null),a(null);const L=y();delete L[c],E(L),p(""),w(""),k(""),A(""),_("none"),localStorage.removeItem("mcp-inspector-llm-config"),localStorage.removeItem("mcp-inspector-auth-config")},[c,y,E]);return{llmConfig:t,authConfig:r,configDialogOpen:i,setConfigDialogOpen:s,tempProvider:c,setTempProvider:u,tempApiKey:d,setTempApiKey:p,tempModel:h,setTempModel:v,tempAuthType:x,saveLLMConfig:C,clearConfig:O}}function wje({connection:e,isConnected:t,useClientSide:n=!0,readResource:r}){const[a,i]=b.useState(""),s=b.useRef(null),{llmConfig:c,authConfig:u,configDialogOpen:d,setConfigDialogOpen:p,tempProvider:h,setTempProvider:v,tempApiKey:y,setTempApiKey:E,tempModel:x,setTempModel:_,saveLLMConfig:S,clearConfig:w}=yje({mcpServerUrl:e.url}),T={connection:e,llmConfig:c,isConnected:t,readResource:r},k=vje({mcpServerUrl:e.url,llmConfig:c,authConfig:u,isConnected:t}),N=bje(T),{messages:A,isLoading:C,sendMessage:O,clearMessages:L}=n?N:k;yJ({onNewChat:L}),b.useEffect(()=>{c&&A.length===0&&s.current&&s.current.focus()},[c,A.length]),b.useEffect(()=>{!C&&A.length>0&&s.current&&s.current.focus()},[C,A.length]);const F=b.useCallback(()=>{a.trim()&&(O(a),i(""))},[a,O]),z=b.useCallback(ee=>{ee.key==="Enter"&&!ee.shiftKey&&(ee.preventDefault(),F())},[F]),K=b.useCallback(()=>{w(),L()},[w,L]);return c&&A.length===0?m.jsxs("div",{className:"flex flex-col h-full",children:[m.jsx("div",{className:"absolute top-4 right-4 z-10",children:m.jsx(Lk,{open:d,onOpenChange:p,tempProvider:h,tempModel:x,tempApiKey:y,onProviderChange:v,onModelChange:_,onApiKeyChange:E,onSave:S,onClear:K,showClearButton:!0,buttonLabel:"Change API Key"})}),m.jsx(ake,{mcpServerUrl:e.url,inputValue:a,isConnected:t,isLoading:C,textareaRef:s,llmConfig:c,onInputChange:i,onKeyDown:z,onSubmit:ee=>{ee.preventDefault(),F()},onConfigDialogOpenChange:p})]}):m.jsxs("div",{className:"flex flex-col h-full relative",children:[m.jsx(tke,{llmConfig:c,hasMessages:A.length>0,configDialogOpen:d,onConfigDialogOpenChange:p,onClearChat:L,tempProvider:h,tempModel:x,tempApiKey:y,onProviderChange:v,onModelChange:_,onApiKeyChange:E,onSaveConfig:S,onClearConfig:K}),m.jsx("div",{className:"flex-1 overflow-y-auto p-2 sm:p-4 pt-[80px] sm:pt-[100px]",children:c?m.jsx(gje,{messages:A,isLoading:C,serverId:e.url,readResource:r}):m.jsx(ike,{onConfigureClick:()=>p(!0)})}),c&&m.jsx(nke,{inputValue:a,isConnected:t,isLoading:C,textareaRef:s,onInputChange:i,onKeyDown:z,onSendMessage:F})]})}const Db=b.createContext(null);Db.displayName="PanelGroupContext";const On={group:"data-panel-group",groupDirection:"data-panel-group-direction",groupId:"data-panel-group-id",panel:"data-panel",panelCollapsible:"data-panel-collapsible",panelId:"data-panel-id",panelSize:"data-panel-size",resizeHandle:"data-resize-handle",resizeHandleActive:"data-resize-handle-active",resizeHandleEnabled:"data-panel-resize-handle-enabled",resizeHandleId:"data-panel-resize-handle-id",resizeHandleState:"data-resize-handle-state"},yO=10,cl=b.useLayoutEffect,yq=Pv.useId,Sje=typeof yq=="function"?yq:()=>null;let Eje=0;function wO(e=null){const t=Sje(),n=b.useRef(e||t||null);return n.current===null&&(n.current=""+Eje++),e??n.current}function oee({children:e,className:t="",collapsedSize:n,collapsible:r,defaultSize:a,forwardedRef:i,id:s,maxSize:c,minSize:u,onCollapse:d,onExpand:p,onResize:h,order:v,style:y,tagName:E="div",...x}){const _=b.useContext(Db);if(_===null)throw Error("Panel components must be rendered within a PanelGroup container");const{collapsePanel:S,expandPanel:w,getPanelSize:T,getPanelStyle:k,groupId:N,isPanelCollapsed:A,reevaluatePanelConstraints:C,registerPanel:O,resizePanel:L,unregisterPanel:F}=_,z=wO(s),K=b.useRef({callbacks:{onCollapse:d,onExpand:p,onResize:h},constraints:{collapsedSize:n,collapsible:r,defaultSize:a,maxSize:c,minSize:u},id:z,idIsFromProps:s!==void 0,order:v});b.useRef({didLogMissingDefaultSizeWarning:!1}),cl(()=>{const{callbacks:J,constraints:le}=K.current,q={...le};K.current.id=z,K.current.idIsFromProps=s!==void 0,K.current.order=v,J.onCollapse=d,J.onExpand=p,J.onResize=h,le.collapsedSize=n,le.collapsible=r,le.defaultSize=a,le.maxSize=c,le.minSize=u,(q.collapsedSize!==le.collapsedSize||q.collapsible!==le.collapsible||q.maxSize!==le.maxSize||q.minSize!==le.minSize)&&C(K.current,q)}),cl(()=>{const J=K.current;return O(J),()=>{F(J)}},[v,z,O,F]),b.useImperativeHandle(i,()=>({collapse:()=>{S(K.current)},expand:J=>{w(K.current,J)},getId(){return z},getSize(){return T(K.current)},isCollapsed(){return A(K.current)},isExpanded(){return!A(K.current)},resize:J=>{L(K.current,J)}}),[S,w,T,A,z,L]);const ee=k(K.current,a);return b.createElement(E,{...x,children:e,className:t,id:z,style:{...ee,...y},[On.groupId]:N,[On.panel]:"",[On.panelCollapsible]:r||void 0,[On.panelId]:z,[On.panelSize]:parseFloat(""+ee.flexGrow).toFixed(1)})}const see=b.forwardRef((e,t)=>b.createElement(oee,{...e,forwardedRef:t}));oee.displayName="Panel";see.displayName="forwardRef(Panel)";let Gk=null,Eg=-1,ns=null;function _je(e,t,n){const r=(t&fee)!==0,a=(t&pee)!==0,i=(t&mee)!==0,s=(t&hee)!==0;if(t){if(r)return i?"se-resize":s?"ne-resize":"e-resize";if(a)return i?"sw-resize":s?"nw-resize":"w-resize";if(i)return"s-resize";if(s)return"n-resize"}switch(e){case"horizontal":return"ew-resize";case"intersection":return"move";case"vertical":return"ns-resize"}}function xje(){ns!==null&&(document.head.removeChild(ns),Gk=null,ns=null,Eg=-1)}function GR(e,t,n){var r,a;const i=_je(e,t);if(Gk!==i){if(Gk=i,ns===null&&(ns=document.createElement("style"),document.head.appendChild(ns)),Eg>=0){var s;(s=ns.sheet)===null||s===void 0||s.removeRule(Eg)}Eg=(r=(a=ns.sheet)===null||a===void 0?void 0:a.insertRule(`*{cursor: ${i} !important;}`))!==null&&r!==void 0?r:-1}}function lee(e){return e.type==="keydown"}function cee(e){return e.type.startsWith("pointer")}function uee(e){return e.type.startsWith("mouse")}function $b(e){if(cee(e)){if(e.isPrimary)return{x:e.clientX,y:e.clientY}}else if(uee(e))return{x:e.clientX,y:e.clientY};return{x:1/0,y:1/0}}function Tje(){if(typeof matchMedia=="function")return matchMedia("(pointer:coarse)").matches?"coarse":"fine"}function Rje(e,t,n){return e.x<t.x+t.width&&e.x+e.width>t.x&&e.y<t.y+t.height&&e.y+e.height>t.y}function Nje(e,t){if(e===t)throw new Error("Cannot compare node with itself");const n={a:Eq(e),b:Eq(t)};let r;for(;n.a.at(-1)===n.b.at(-1);)e=n.a.pop(),t=n.b.pop(),r=e;xt(r,"Stacking order can only be calculated for elements with a common ancestor");const a={a:Sq(wq(n.a)),b:Sq(wq(n.b))};if(a.a===a.b){const i=r.childNodes,s={a:n.a.at(-1),b:n.b.at(-1)};let c=i.length;for(;c--;){const u=i[c];if(u===s.a)return 1;if(u===s.b)return-1}}return Math.sign(a.a-a.b)}const kje=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function Cje(e){var t;const n=getComputedStyle((t=dee(e))!==null&&t!==void 0?t:e).display;return n==="flex"||n==="inline-flex"}function Aje(e){const t=getComputedStyle(e);return!!(t.position==="fixed"||t.zIndex!=="auto"&&(t.position!=="static"||Cje(e))||+t.opacity<1||"transform"in t&&t.transform!=="none"||"webkitTransform"in t&&t.webkitTransform!=="none"||"mixBlendMode"in t&&t.mixBlendMode!=="normal"||"filter"in t&&t.filter!=="none"||"webkitFilter"in t&&t.webkitFilter!=="none"||"isolation"in t&&t.isolation==="isolate"||kje.test(t.willChange)||t.webkitOverflowScrolling==="touch")}function wq(e){let t=e.length;for(;t--;){const n=e[t];if(xt(n,"Missing node"),Aje(n))return n}return null}function Sq(e){return e&&Number(getComputedStyle(e).zIndex)||0}function Eq(e){const t=[];for(;e;)t.push(e),e=dee(e);return t}function dee(e){const{parentNode:t}=e;return t&&t instanceof ShadowRoot?t.host:t}const fee=1,pee=2,mee=4,hee=8,Ije=Tje()==="coarse";let ei=[],nu=!1,rs=new Map,Lb=new Map;const Kf=new Set;function Oje(e,t,n,r,a){var i;const{ownerDocument:s}=t,c={direction:n,element:t,hitAreaMargins:r,setResizeHandlerState:a},u=(i=rs.get(s))!==null&&i!==void 0?i:0;return rs.set(s,u+1),Kf.add(c),uv(),function(){var p;Lb.delete(e),Kf.delete(c);const h=(p=rs.get(s))!==null&&p!==void 0?p:1;if(rs.set(s,h-1),uv(),h===1&&rs.delete(s),ei.includes(c)){const v=ei.indexOf(c);v>=0&&ei.splice(v,1),Mb(),a("up",!0,null)}}}function Dje(e){const{target:t}=e,{x:n,y:r}=$b(e);nu=!0,SO({target:t,x:n,y:r}),uv(),ei.length>0&&(dv("down",e),Mb(),e.preventDefault(),gee(t)||e.stopImmediatePropagation())}function WR(e){const{x:t,y:n}=$b(e);if(nu&&e.type!=="pointerleave"&&e.buttons===0&&(nu=!1,dv("up",e)),!nu){const{target:r}=e;SO({target:r,x:t,y:n})}dv("move",e),Mb(),ei.length>0&&e.preventDefault()}function KR(e){const{target:t}=e,{x:n,y:r}=$b(e);Lb.clear(),nu=!1,ei.length>0&&(e.preventDefault(),gee(t)||e.stopImmediatePropagation()),dv("up",e),SO({target:t,x:n,y:r}),Mb(),uv()}function gee(e){let t=e;for(;t;){if(t.hasAttribute(On.resizeHandle))return!0;t=t.parentElement}return!1}function SO({target:e,x:t,y:n}){ei.splice(0);let r=null;(e instanceof HTMLElement||e instanceof SVGElement)&&(r=e),Kf.forEach(a=>{const{element:i,hitAreaMargins:s}=a,c=i.getBoundingClientRect(),{bottom:u,left:d,right:p,top:h}=c,v=Ije?s.coarse:s.fine;if(t>=d-v&&t<=p+v&&n>=h-v&&n<=u+v){if(r!==null&&document.contains(r)&&i!==r&&!i.contains(r)&&!r.contains(i)&&Nje(r,i)>0){let E=r,x=!1;for(;E&&!E.contains(i);){if(Rje(E.getBoundingClientRect(),c)){x=!0;break}E=E.parentElement}if(x)return}ei.push(a)}})}function YR(e,t){Lb.set(e,t)}function Mb(){let e=!1,t=!1;ei.forEach(r=>{const{direction:a}=r;a==="horizontal"?e=!0:t=!0});let n=0;Lb.forEach(r=>{n|=r}),e&&t?GR("intersection",n):e?GR("horizontal",n):t?GR("vertical",n):xje()}let ZR;function uv(){var e;(e=ZR)===null||e===void 0||e.abort(),ZR=new AbortController;const t={capture:!0,signal:ZR.signal};Kf.size&&(nu?(ei.length>0&&rs.forEach((n,r)=>{const{body:a}=r;n>0&&(a.addEventListener("contextmenu",KR,t),a.addEventListener("pointerleave",WR,t),a.addEventListener("pointermove",WR,t))}),rs.forEach((n,r)=>{const{body:a}=r;a.addEventListener("pointerup",KR,t),a.addEventListener("pointercancel",KR,t)})):rs.forEach((n,r)=>{const{body:a}=r;n>0&&(a.addEventListener("pointerdown",Dje,t),a.addEventListener("pointermove",WR,t))}))}function dv(e,t){Kf.forEach(n=>{const{setResizeHandlerState:r}=n,a=ei.includes(n);r(e,a,t)})}function $je(){const[e,t]=b.useState(0);return b.useCallback(()=>t(n=>n+1),[])}function xt(e,t){if(!e)throw console.error(t),Error(t)}function xl(e,t,n=yO){return e.toFixed(n)===t.toFixed(n)?0:e>t?1:-1}function ao(e,t,n=yO){return xl(e,t,n)===0}function na(e,t,n){return xl(e,t,n)===0}function Lje(e,t,n){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++){const a=e[r],i=t[r];if(!na(a,i,n))return!1}return!0}function Bc({panelConstraints:e,panelIndex:t,size:n}){const r=e[t];xt(r!=null,`Panel constraints not found for index ${t}`);let{collapsedSize:a=0,collapsible:i,maxSize:s=100,minSize:c=0}=r;if(xl(n,c)<0)if(i){const u=(a+c)/2;xl(n,u)<0?n=a:n=c}else n=c;return n=Math.min(s,n),n=parseFloat(n.toFixed(yO)),n}function sf({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:a,trigger:i}){if(na(e,0))return t;const s=[...t],[c,u]=r;xt(c!=null,"Invalid first pivot index"),xt(u!=null,"Invalid second pivot index");let d=0;if(i==="keyboard"){{const h=e<0?u:c,v=n[h];xt(v,`Panel constraints not found for index ${h}`);const{collapsedSize:y=0,collapsible:E,minSize:x=0}=v;if(E){const _=t[h];if(xt(_!=null,`Previous layout not found for panel index ${h}`),na(_,y)){const S=x-_;xl(S,Math.abs(e))>0&&(e=e<0?0-S:S)}}}{const h=e<0?c:u,v=n[h];xt(v,`No panel constraints found for index ${h}`);const{collapsedSize:y=0,collapsible:E,minSize:x=0}=v;if(E){const _=t[h];if(xt(_!=null,`Previous layout not found for panel index ${h}`),na(_,x)){const S=_-y;xl(S,Math.abs(e))>0&&(e=e<0?0-S:S)}}}}{const h=e<0?1:-1;let v=e<0?u:c,y=0;for(;;){const x=t[v];xt(x!=null,`Previous layout not found for panel index ${v}`);const S=Bc({panelConstraints:n,panelIndex:v,size:100})-x;if(y+=S,v+=h,v<0||v>=n.length)break}const E=Math.min(Math.abs(e),Math.abs(y));e=e<0?0-E:E}{let v=e<0?c:u;for(;v>=0&&v<n.length;){const y=Math.abs(e)-Math.abs(d),E=t[v];xt(E!=null,`Previous layout not found for panel index ${v}`);const x=E-y,_=Bc({panelConstraints:n,panelIndex:v,size:x});if(!na(E,_)&&(d+=E-_,s[v]=_,d.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?v--:v++}}if(Lje(a,s))return a;{const h=e<0?u:c,v=t[h];xt(v!=null,`Previous layout not found for panel index ${h}`);const y=v+d,E=Bc({panelConstraints:n,panelIndex:h,size:y});if(s[h]=E,!na(E,y)){let x=y-E,S=e<0?u:c;for(;S>=0&&S<n.length;){const w=s[S];xt(w!=null,`Previous layout not found for panel index ${S}`);const T=w+x,k=Bc({panelConstraints:n,panelIndex:S,size:T});if(na(w,k)||(x-=k-w,s[S]=k),na(x,0))break;e>0?S--:S++}}}const p=s.reduce((h,v)=>v+h,0);return na(p,100)?s:a}function Mje({layout:e,panelsArray:t,pivotIndices:n}){let r=0,a=100,i=0,s=0;const c=n[0];xt(c!=null,"No pivot index found"),t.forEach((h,v)=>{const{constraints:y}=h,{maxSize:E=100,minSize:x=0}=y;v===c?(r=x,a=E):(i+=x,s+=E)});const u=Math.min(a,100-i),d=Math.max(r,100-s),p=e[c];return{valueMax:u,valueMin:d,valueNow:p}}function Yf(e,t=document){return Array.from(t.querySelectorAll(`[${On.resizeHandleId}][data-panel-group-id="${e}"]`))}function vee(e,t,n=document){const a=Yf(e,n).findIndex(i=>i.getAttribute(On.resizeHandleId)===t);return a??null}function bee(e,t,n){const r=vee(e,t,n);return r!=null?[r,r+1]:[-1,-1]}function jje(e){return e instanceof HTMLElement?!0:typeof e=="object"&&e!==null&&"tagName"in e&&"getAttribute"in e}function yee(e,t=document){if(jje(t)&&t.dataset.panelGroupId==e)return t;const n=t.querySelector(`[data-panel-group][data-panel-group-id="${e}"]`);return n||null}function jb(e,t=document){const n=t.querySelector(`[${On.resizeHandleId}="${e}"]`);return n||null}function Pje(e,t,n,r=document){var a,i,s,c;const u=jb(t,r),d=Yf(e,r),p=u?d.indexOf(u):-1,h=(a=(i=n[p])===null||i===void 0?void 0:i.id)!==null&&a!==void 0?a:null,v=(s=(c=n[p+1])===null||c===void 0?void 0:c.id)!==null&&s!==void 0?s:null;return[h,v]}function Uje({committedValuesRef:e,eagerValuesRef:t,groupId:n,layout:r,panelDataArray:a,panelGroupElement:i,setLayout:s}){b.useRef({didWarnAboutMissingResizeHandle:!1}),cl(()=>{if(!i)return;const c=Yf(n,i);for(let u=0;u<a.length-1;u++){const{valueMax:d,valueMin:p,valueNow:h}=Mje({layout:r,panelsArray:a,pivotIndices:[u,u+1]}),v=c[u];if(v!=null){const y=a[u];xt(y,`No panel data found for index "${u}"`),v.setAttribute("aria-controls",y.id),v.setAttribute("aria-valuemax",""+Math.round(d)),v.setAttribute("aria-valuemin",""+Math.round(p)),v.setAttribute("aria-valuenow",h!=null?""+Math.round(h):"")}}return()=>{c.forEach((u,d)=>{u.removeAttribute("aria-controls"),u.removeAttribute("aria-valuemax"),u.removeAttribute("aria-valuemin"),u.removeAttribute("aria-valuenow")})}},[n,r,a,i]),b.useEffect(()=>{if(!i)return;const c=t.current;xt(c,"Eager values not found");const{panelDataArray:u}=c,d=yee(n,i);xt(d!=null,`No group found for id "${n}"`);const p=Yf(n,i);xt(p,`No resize handles found for group id "${n}"`);const h=p.map(v=>{const y=v.getAttribute(On.resizeHandleId);xt(y,"Resize handle element has no handle id attribute");const[E,x]=Pje(n,y,u,i);if(E==null||x==null)return()=>{};const _=S=>{if(!S.defaultPrevented)switch(S.key){case"Enter":{S.preventDefault();const w=u.findIndex(T=>T.id===E);if(w>=0){const T=u[w];xt(T,`No panel data found for index ${w}`);const k=r[w],{collapsedSize:N=0,collapsible:A,minSize:C=0}=T.constraints;if(k!=null&&A){const O=sf({delta:na(k,N)?C-N:N-k,initialLayout:r,panelConstraints:u.map(L=>L.constraints),pivotIndices:bee(n,y,i),prevLayout:r,trigger:"keyboard"});r!==O&&s(O)}}break}}};return v.addEventListener("keydown",_),()=>{v.removeEventListener("keydown",_)}});return()=>{h.forEach(v=>v())}},[i,e,t,n,r,a,s])}function _q(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function wee(e,t){const n=e==="horizontal",{x:r,y:a}=$b(t);return n?r:a}function zje(e,t,n,r,a){const i=n==="horizontal",s=jb(t,a);xt(s,`No resize handle element found for id "${t}"`);const c=s.getAttribute(On.groupId);xt(c,"Resize handle element has no group id attribute");let{initialCursorPosition:u}=r;const d=wee(n,e),p=yee(c,a);xt(p,`No group element found for id "${c}"`);const h=p.getBoundingClientRect(),v=i?h.width:h.height;return(d-u)/v*100}function Fje(e,t,n,r,a,i){if(lee(e)){const s=n==="horizontal";let c=0;e.shiftKey?c=100:a!=null?c=a:c=10;let u=0;switch(e.key){case"ArrowDown":u=s?0:c;break;case"ArrowLeft":u=s?-c:0;break;case"ArrowRight":u=s?c:0;break;case"ArrowUp":u=s?0:-c;break;case"End":u=100;break;case"Home":u=-100;break}return u}else return r==null?0:zje(e,t,n,r,i)}function Bje({panelDataArray:e}){const t=Array(e.length),n=e.map(i=>i.constraints);let r=0,a=100;for(let i=0;i<e.length;i++){const s=n[i];xt(s,`Panel constraints not found for index ${i}`);const{defaultSize:c}=s;c!=null&&(r++,t[i]=c,a-=c)}for(let i=0;i<e.length;i++){const s=n[i];xt(s,`Panel constraints not found for index ${i}`);const{defaultSize:c}=s;if(c!=null)continue;const u=e.length-r,d=a/u;r++,t[i]=d,a-=d}return t}function yc(e,t,n){t.forEach((r,a)=>{const i=e[a];xt(i,`Panel data not found for index ${a}`);const{callbacks:s,constraints:c,id:u}=i,{collapsedSize:d=0,collapsible:p}=c,h=n[u];if(h==null||r!==h){n[u]=r;const{onCollapse:v,onExpand:y,onResize:E}=s;E&&E(r,h),p&&(v||y)&&(y&&(h==null||ao(h,d))&&!ao(r,d)&&y(),v&&(h==null||!ao(h,d))&&ao(r,d)&&v())}})}function Jh(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n])return!1;return!0}function qje({defaultSize:e,dragState:t,layout:n,panelData:r,panelIndex:a,precision:i=3}){const s=n[a];let c;return s==null?c=e!=null?e.toFixed(i):"1":r.length===1?c="1":c=s.toFixed(i),{flexBasis:0,flexGrow:c,flexShrink:1,overflow:"hidden",pointerEvents:t!==null?"none":void 0}}function Hje(e,t=10){let n=null;return(...a)=>{n!==null&&clearTimeout(n),n=setTimeout(()=>{e(...a)},t)}}function xq(e){try{if(typeof localStorage<"u")e.getItem=t=>localStorage.getItem(t),e.setItem=(t,n)=>{localStorage.setItem(t,n)};else throw new Error("localStorage not supported in this environment")}catch(t){console.error(t),e.getItem=()=>null,e.setItem=()=>{}}}function See(e){return`react-resizable-panels:${e}`}function Eee(e){return e.map(t=>{const{constraints:n,id:r,idIsFromProps:a,order:i}=t;return a?r:i?`${i}:${JSON.stringify(n)}`:JSON.stringify(n)}).sort((t,n)=>t.localeCompare(n)).join(",")}function _ee(e,t){try{const n=See(e),r=t.getItem(n);if(r){const a=JSON.parse(r);if(typeof a=="object"&&a!=null)return a}}catch{}return null}function Vje(e,t,n){var r,a;const i=(r=_ee(e,n))!==null&&r!==void 0?r:{},s=Eee(t);return(a=i[s])!==null&&a!==void 0?a:null}function Gje(e,t,n,r,a){var i;const s=See(e),c=Eee(t),u=(i=_ee(e,a))!==null&&i!==void 0?i:{};u[c]={expandToSizes:Object.fromEntries(n.entries()),layout:r};try{a.setItem(s,JSON.stringify(u))}catch(d){console.error(d)}}function Tq({layout:e,panelConstraints:t}){const n=[...e],r=n.reduce((i,s)=>i+s,0);if(n.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${n.map(i=>`${i}%`).join(", ")}`);if(!na(r,100)&&n.length>0)for(let i=0;i<t.length;i++){const s=n[i];xt(s!=null,`No layout data found for index ${i}`);const c=100/r*s;n[i]=c}let a=0;for(let i=0;i<t.length;i++){const s=n[i];xt(s!=null,`No layout data found for index ${i}`);const c=Bc({panelConstraints:t,panelIndex:i,size:s});s!=c&&(a+=s-c,n[i]=c)}if(!na(a,0))for(let i=0;i<t.length;i++){const s=n[i];xt(s!=null,`No layout data found for index ${i}`);const c=s+a,u=Bc({panelConstraints:t,panelIndex:i,size:c});if(s!==u&&(a-=u-s,n[i]=u,na(a,0)))break}return n}const Wje=100,lf={getItem:e=>(xq(lf),lf.getItem(e)),setItem:(e,t)=>{xq(lf),lf.setItem(e,t)}},Rq={};function xee({autoSaveId:e=null,children:t,className:n="",direction:r,forwardedRef:a,id:i=null,onLayout:s=null,keyboardResizeBy:c=null,storage:u=lf,style:d,tagName:p="div",...h}){const v=wO(i),y=b.useRef(null),[E,x]=b.useState(null),[_,S]=b.useState([]),w=$je(),T=b.useRef({}),k=b.useRef(new Map),N=b.useRef(0),A=b.useRef({autoSaveId:e,direction:r,dragState:E,id:v,keyboardResizeBy:c,onLayout:s,storage:u}),C=b.useRef({layout:_,panelDataArray:[],panelDataArrayChanged:!1});b.useRef({didLogIdAndOrderWarning:!1,didLogPanelConstraintsWarning:!1,prevPanelIds:[]}),b.useImperativeHandle(a,()=>({getId:()=>A.current.id,getLayout:()=>{const{layout:j}=C.current;return j},setLayout:j=>{const{onLayout:$}=A.current,{layout:U,panelDataArray:H}=C.current,W=Tq({layout:j,panelConstraints:H.map(X=>X.constraints)});_q(U,W)||(S(W),C.current.layout=W,$&&$(W),yc(H,W,T.current))}}),[]),cl(()=>{A.current.autoSaveId=e,A.current.direction=r,A.current.dragState=E,A.current.id=v,A.current.onLayout=s,A.current.storage=u}),Uje({committedValuesRef:A,eagerValuesRef:C,groupId:v,layout:_,panelDataArray:C.current.panelDataArray,setLayout:S,panelGroupElement:y.current}),b.useEffect(()=>{const{panelDataArray:j}=C.current;if(e){if(_.length===0||_.length!==j.length)return;let $=Rq[e];$==null&&($=Hje(Gje,Wje),Rq[e]=$);const U=[...j],H=new Map(k.current);$(e,U,H,_,u)}},[e,_,u]),b.useEffect(()=>{});const O=b.useCallback(j=>{const{onLayout:$}=A.current,{layout:U,panelDataArray:H}=C.current;if(j.constraints.collapsible){const W=H.map(Y=>Y.constraints),{collapsedSize:X=0,panelSize:de,pivotIndices:ue}=Ws(H,j,U);if(xt(de!=null,`Panel size not found for panel "${j.id}"`),!ao(de,X)){k.current.set(j.id,de);const Q=Ac(H,j)===H.length-1?de-X:X-de,oe=sf({delta:Q,initialLayout:U,panelConstraints:W,pivotIndices:ue,prevLayout:U,trigger:"imperative-api"});Jh(U,oe)||(S(oe),C.current.layout=oe,$&&$(oe),yc(H,oe,T.current))}}},[]),L=b.useCallback((j,$)=>{const{onLayout:U}=A.current,{layout:H,panelDataArray:W}=C.current;if(j.constraints.collapsible){const X=W.map(ae=>ae.constraints),{collapsedSize:de=0,panelSize:ue=0,minSize:Y=0,pivotIndices:Q}=Ws(W,j,H),oe=$??Y;if(ao(ue,de)){const ae=k.current.get(j.id),Re=ae!=null&&ae>=oe?ae:oe,Ye=Ac(W,j)===W.length-1?ue-Re:Re-ue,Ee=sf({delta:Ye,initialLayout:H,panelConstraints:X,pivotIndices:Q,prevLayout:H,trigger:"imperative-api"});Jh(H,Ee)||(S(Ee),C.current.layout=Ee,U&&U(Ee),yc(W,Ee,T.current))}}},[]),F=b.useCallback(j=>{const{layout:$,panelDataArray:U}=C.current,{panelSize:H}=Ws(U,j,$);return xt(H!=null,`Panel size not found for panel "${j.id}"`),H},[]),z=b.useCallback((j,$)=>{const{panelDataArray:U}=C.current,H=Ac(U,j);return qje({defaultSize:$,dragState:E,layout:_,panelData:U,panelIndex:H})},[E,_]),K=b.useCallback(j=>{const{layout:$,panelDataArray:U}=C.current,{collapsedSize:H=0,collapsible:W,panelSize:X}=Ws(U,j,$);return xt(X!=null,`Panel size not found for panel "${j.id}"`),W===!0&&ao(X,H)},[]),ee=b.useCallback(j=>{const{layout:$,panelDataArray:U}=C.current,{collapsedSize:H=0,collapsible:W,panelSize:X}=Ws(U,j,$);return xt(X!=null,`Panel size not found for panel "${j.id}"`),!W||xl(X,H)>0},[]),J=b.useCallback(j=>{const{panelDataArray:$}=C.current;$.push(j),$.sort((U,H)=>{const W=U.order,X=H.order;return W==null&&X==null?0:W==null?-1:X==null?1:W-X}),C.current.panelDataArrayChanged=!0,w()},[w]);cl(()=>{if(C.current.panelDataArrayChanged){C.current.panelDataArrayChanged=!1;const{autoSaveId:j,onLayout:$,storage:U}=A.current,{layout:H,panelDataArray:W}=C.current;let X=null;if(j){const ue=Vje(j,W,U);ue&&(k.current=new Map(Object.entries(ue.expandToSizes)),X=ue.layout)}X==null&&(X=Bje({panelDataArray:W}));const de=Tq({layout:X,panelConstraints:W.map(ue=>ue.constraints)});_q(H,de)||(S(de),C.current.layout=de,$&&$(de),yc(W,de,T.current))}}),cl(()=>{const j=C.current;return()=>{j.layout=[]}},[]);const le=b.useCallback(j=>{let $=!1;const U=y.current;return U&&window.getComputedStyle(U,null).getPropertyValue("direction")==="rtl"&&($=!0),function(W){W.preventDefault();const X=y.current;if(!X)return()=>null;const{direction:de,dragState:ue,id:Y,keyboardResizeBy:Q,onLayout:oe}=A.current,{layout:ae,panelDataArray:Re}=C.current,{initialLayout:Ae}=ue??{},Ye=bee(Y,j,X);let Ee=Fje(W,j,de,ue,Q,X);const Ne=de==="horizontal";Ne&&$&&(Ee=-Ee);const ze=Re.map(Ze=>Ze.constraints),he=sf({delta:Ee,initialLayout:Ae??ae,panelConstraints:ze,pivotIndices:Ye,prevLayout:ae,trigger:lee(W)?"keyboard":"mouse-or-touch"}),je=!Jh(ae,he);(cee(W)||uee(W))&&N.current!=Ee&&(N.current=Ee,!je&&Ee!==0?Ne?YR(j,Ee<0?fee:pee):YR(j,Ee<0?mee:hee):YR(j,0)),je&&(S(he),C.current.layout=he,oe&&oe(he),yc(Re,he,T.current))}},[]),q=b.useCallback((j,$)=>{const{onLayout:U}=A.current,{layout:H,panelDataArray:W}=C.current,X=W.map(ae=>ae.constraints),{panelSize:de,pivotIndices:ue}=Ws(W,j,H);xt(de!=null,`Panel size not found for panel "${j.id}"`);const Q=Ac(W,j)===W.length-1?de-$:$-de,oe=sf({delta:Q,initialLayout:H,panelConstraints:X,pivotIndices:ue,prevLayout:H,trigger:"imperative-api"});Jh(H,oe)||(S(oe),C.current.layout=oe,U&&U(oe),yc(W,oe,T.current))},[]),Z=b.useCallback((j,$)=>{const{layout:U,panelDataArray:H}=C.current,{collapsedSize:W=0,collapsible:X}=$,{collapsedSize:de=0,collapsible:ue,maxSize:Y=100,minSize:Q=0}=j.constraints,{panelSize:oe}=Ws(H,j,U);oe!=null&&(X&&ue&&ao(oe,W)?ao(W,de)||q(j,de):oe<Q?q(j,Q):oe>Y&&q(j,Y))},[q]),G=b.useCallback((j,$)=>{const{direction:U}=A.current,{layout:H}=C.current;if(!y.current)return;const W=jb(j,y.current);xt(W,`Drag handle element not found for id "${j}"`);const X=wee(U,$);x({dragHandleId:j,dragHandleRect:W.getBoundingClientRect(),initialCursorPosition:X,initialLayout:H})},[]),ie=b.useCallback(()=>{x(null)},[]),te=b.useCallback(j=>{const{panelDataArray:$}=C.current,U=Ac($,j);U>=0&&($.splice(U,1),delete T.current[j.id],C.current.panelDataArrayChanged=!0,w())},[w]),P=b.useMemo(()=>({collapsePanel:O,direction:r,dragState:E,expandPanel:L,getPanelSize:F,getPanelStyle:z,groupId:v,isPanelCollapsed:K,isPanelExpanded:ee,reevaluatePanelConstraints:Z,registerPanel:J,registerResizeHandle:le,resizePanel:q,startDragging:G,stopDragging:ie,unregisterPanel:te,panelGroupElement:y.current}),[O,E,r,L,F,z,v,K,ee,Z,J,le,q,G,ie,te]),B={display:"flex",flexDirection:r==="horizontal"?"row":"column",height:"100%",overflow:"hidden",width:"100%"};return b.createElement(Db.Provider,{value:P},b.createElement(p,{...h,children:t,className:n,id:i,ref:y,style:{...B,...d},[On.group]:"",[On.groupDirection]:r,[On.groupId]:v}))}const Tee=b.forwardRef((e,t)=>b.createElement(xee,{...e,forwardedRef:t}));xee.displayName="PanelGroup";Tee.displayName="forwardRef(PanelGroup)";function Ac(e,t){return e.findIndex(n=>n===t||n.id===t.id)}function Ws(e,t,n){const r=Ac(e,t),i=r===e.length-1?[r-1,r]:[r,r+1],s=n[r];return{...t.constraints,panelSize:s,pivotIndices:i}}function Kje({disabled:e,handleId:t,resizeHandler:n,panelGroupElement:r}){b.useEffect(()=>{if(e||n==null||r==null)return;const a=jb(t,r);if(a==null)return;const i=s=>{if(!s.defaultPrevented)switch(s.key){case"ArrowDown":case"ArrowLeft":case"ArrowRight":case"ArrowUp":case"End":case"Home":{s.preventDefault(),n(s);break}case"F6":{s.preventDefault();const c=a.getAttribute(On.groupId);xt(c,`No group element found for id "${c}"`);const u=Yf(c,r),d=vee(c,t,r);xt(d!==null,`No resize element found for id "${t}"`);const p=s.shiftKey?d>0?d-1:u.length-1:d+1<u.length?d+1:0;u[p].focus();break}}};return a.addEventListener("keydown",i),()=>{a.removeEventListener("keydown",i)}},[r,e,t,n])}function Ree({children:e=null,className:t="",disabled:n=!1,hitAreaMargins:r,id:a,onBlur:i,onClick:s,onDragging:c,onFocus:u,onPointerDown:d,onPointerUp:p,style:h={},tabIndex:v=0,tagName:y="div",...E}){var x,_;const S=b.useRef(null),w=b.useRef({onClick:s,onDragging:c,onPointerDown:d,onPointerUp:p});b.useEffect(()=>{w.current.onClick=s,w.current.onDragging=c,w.current.onPointerDown=d,w.current.onPointerUp=p});const T=b.useContext(Db);if(T===null)throw Error("PanelResizeHandle components must be rendered within a PanelGroup container");const{direction:k,groupId:N,registerResizeHandle:A,startDragging:C,stopDragging:O,panelGroupElement:L}=T,F=wO(a),[z,K]=b.useState("inactive"),[ee,J]=b.useState(!1),[le,q]=b.useState(null),Z=b.useRef({state:z});cl(()=>{Z.current.state=z}),b.useEffect(()=>{if(n)q(null);else{const P=A(F);q(()=>P)}},[n,F,A]);const G=(x=r?.coarse)!==null&&x!==void 0?x:15,ie=(_=r?.fine)!==null&&_!==void 0?_:5;b.useEffect(()=>{if(n||le==null)return;const P=S.current;xt(P,"Element ref not attached");let B=!1;return Oje(F,P,k,{coarse:G,fine:ie},($,U,H)=>{if(!U){K("inactive");return}switch($){case"down":{K("drag"),B=!1,xt(H,'Expected event to be defined for "down" action'),C(F,H);const{onDragging:W,onPointerDown:X}=w.current;W?.(!0),X?.();break}case"move":{const{state:W}=Z.current;B=!0,W!=="drag"&&K("hover"),xt(H,'Expected event to be defined for "move" action'),le(H);break}case"up":{K("hover"),O();const{onClick:W,onDragging:X,onPointerUp:de}=w.current;X?.(!1),de?.(),B||W?.();break}}})},[G,k,n,ie,A,F,le,C,O]),Kje({disabled:n,handleId:F,resizeHandler:le,panelGroupElement:L});const te={touchAction:"none",userSelect:"none"};return b.createElement(y,{...E,children:e,className:t,id:a,onBlur:()=>{J(!1),i?.()},onFocus:()=>{J(!0),u?.()},ref:S,role:"separator",style:{...te,...h},tabIndex:v,[On.groupDirection]:k,[On.groupId]:N,[On.resizeHandle]:"",[On.resizeHandleActive]:z==="drag"?"pointer":ee?"keyboard":void 0,[On.resizeHandleEnabled]:!n,[On.resizeHandleId]:F,[On.resizeHandleState]:z})}Ree.displayName="PanelResizeHandle";function ti({className:e,...t}){return m.jsx(Tee,{"data-slot":"resizable-panel-group",className:$e("flex h-full w-full data-[panel-group-direction=vertical]:flex-col",e),...t})}function Vn({...e}){return m.jsx(see,{"data-slot":"resizable-panel",...e})}function lo({withHandle:e,className:t,...n}){return m.jsx(Ree,{"data-slot":"resizable-handle",className:$e("bg-border focus-visible:ring-ring relative flex w-px items-center justify-center after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:ring-1 focus-visible:ring-offset-1 focus-visible:outline-hidden data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:translate-x-0 data-[panel-group-direction=vertical]:after:-translate-y-1/2 [&[data-panel-group-direction=vertical]>div]:rotate-90",t),...n,children:e&&m.jsx("div",{className:"bg-border z-10 flex h-4 w-3 items-center justify-center rounded-xs border",children:m.jsx(cSe,{className:"size-2.5"})})})}function EO({className:e,...t}){return m.jsx("kbd",{"data-slot":"kbd",className:$e("bg-muted text-muted-foreground pointer-events-none inline-flex h-5 w-fit min-w-5 items-center justify-center gap-1 rounded-sm px-1 font-sans text-xs font-medium select-none","[&_svg:not([class*='size-'])]:size-3","[[data-slot=tooltip-content]_&]:bg-background/20 [[data-slot=tooltip-content]_&]:text-background dark:[[data-slot=tooltip-content]_&]:bg-background/10",e),...t})}function Yje({isSearchExpanded:e,searchQuery:t,filteredNotificationsCount:n,notificationsCount:r,onSearchExpand:a,onSearchChange:i,onSearchBlur:s,onClearAll:c,searchInputRef:u}){return m.jsxs("div",{className:"flex flex-row items-center justify-between p-4 sm:p-4 py-3 gap-2",children:[m.jsx("div",{className:"flex items-center gap-2 flex-1",children:e?m.jsx(Hn,{ref:u,placeholder:"Search notifications...",value:t,onChange:d=>i(d.target.value),onBlur:s,className:"h-8 border-gray-300 dark:border-zinc-600"}):m.jsxs(m.Fragment,{children:[m.jsx("h2",{className:"text-lg font-medium text-gray-900 dark:text-gray-100",children:"Notifications"}),m.jsx(Hr,{className:"bg-zinc-500/20 text-zinc-600 dark:text-zinc-400 border-transparent",variant:"outline",children:n}),m.jsxs(ln,{children:[m.jsx(cn,{asChild:!0,children:m.jsx(Be,{variant:"ghost",size:"sm",onClick:a,className:"h-8 w-8 p-0",children:m.jsx(fb,{className:"h-4 w-4"})})}),m.jsxs(un,{side:"bottom",className:"flex gap-2",children:["Search",m.jsx(EO,{children:"F"})]})]})]})}),m.jsx("div",{className:"flex items-center gap-2",children:m.jsxs(ln,{children:[m.jsx(cn,{asChild:!0,children:m.jsx(Be,{variant:"ghost",size:"sm",onClick:c,disabled:r===0,className:"h-8 w-8 p-0",children:m.jsx(bl,{className:"h-4 w-4"})})}),m.jsx(un,{side:"bottom",children:"Clear all"})]})})]})}function Ku({id:e,isSelected:t,isFocused:n,icon:r,title:a,description:i,metadata:s,onClick:c,className:u}){return m.jsx("button",{id:e,type:"button",onClick:c,className:$e("w-full text-left cursor-pointer p-2 sm:p-4 border-b dark:border-zinc-700 hover:bg-gray-50 dark:hover:bg-zinc-800/50 transition-colors group",t&&"bg-zinc-50 dark:bg-zinc-800 border-l-4 border-l-zinc-500",n&&"ring-2 ring-zinc-500 dark:ring-zinc-400 ring-inset",u),children:m.jsxs("div",{className:"flex items-start gap-2 sm:gap-3",children:[r&&m.jsx("div",{className:"flex-shrink-0 mt-1",children:m.jsx("div",{className:$e("p-2.5 rounded-full transition-colors",t?"bg-zinc-500 dark:bg-zinc-100/80 text-zinc-100 dark:text-zinc-900":"bg-gray-100 dark:bg-zinc-700 text-gray-600 dark:text-gray-400 group-hover:bg-gray-200 dark:group-hover:bg-zinc-600"),children:r})}),m.jsxs("div",{className:"flex-1 min-w-0",children:[m.jsx("div",{className:"flex items-center gap-2 mb-1",children:m.jsx("h3",{className:$e("font-medium truncate font-mono text-sm"),children:a})}),i&&m.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 line-clamp-2",children:i})]})]})})}function Zje({notifications:e,selectedNotification:t,onNotificationSelect:n,focusedIndex:r,formatRelativeTime:a,listRef:i}){return e.length===0?m.jsx("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:m.jsx(ob,{vertical:!0,noBorder:!0,message:"No notifications yet"})}):m.jsx("div",{ref:i,className:"overflow-y-auto flex-1 overscroll-contain",children:e.map((s,c)=>m.jsx(Ku,{id:`notification-${s.id}`,isSelected:t?.id===s.id,isFocused:r===c,title:m.jsxs("span",{className:"flex items-center gap-3",children:[s.method,!s.read&&m.jsx("span",{className:"size-1.5 block rounded-full bg-orange-500"})]}),description:(()=>{const u=a(s.timestamp),d=s.params&&Object.keys(s.params).length>0?Object.keys(s.params).length:0,p=d>0?` | ${d} param${d>1?"s":""}`:"";return u+p})(),onClick:()=>n(s)},s.id))})}function Xje({notification:e,previewMode:t,onTogglePreview:n,onCopy:r,onDownload:a,onFullscreen:i,isCopied:s=!1,onClose:c}){return e?m.jsxs("div",{className:"flex flex-col h-full",children:[m.jsxs("div",{className:"flex-shrink-0 px-4 py-3 border-b border-gray-200 dark:border-zinc-700 flex items-center justify-between",children:[m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsxs("div",{className:"flex items-center gap-1",children:[m.jsx(Tu,{className:"h-3 w-3 text-gray-400"}),m.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:new Date(e.timestamp).toLocaleTimeString()})]}),m.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:e.formatRelativeTime(e.timestamp)})]}),m.jsxs("div",{className:"flex items-center gap-1",children:[m.jsxs(Be,{variant:"ghost",size:"sm",onClick:n,className:t?"":"text-purple-600 dark:text-purple-400",children:[t?m.jsx(PY,{className:"h-4 w-4 mr-1"}):m.jsx(jY,{className:"h-4 w-4 mr-1"}),t?"JSON":"Formatted"]}),m.jsx(Be,{variant:"ghost",size:"sm",onClick:r,children:s?m.jsx(Da,{className:"h-4 w-4"}):m.jsx(Br,{className:"h-4 w-4"})}),m.jsx(Be,{variant:"ghost",size:"sm",onClick:a,children:m.jsx(t1,{className:"h-4 w-4"})}),m.jsx(Be,{variant:"ghost",size:"sm",onClick:i,children:m.jsx(r1,{className:"h-4 w-4"})}),c&&m.jsx(Be,{variant:"ghost",size:"sm",onClick:c,children:m.jsx(qu,{className:"h-4 w-4"})})]})]}),m.jsx("div",{className:"flex-1 overflow-y-auto",children:m.jsx("div",{className:"px-4 pt-4",children:m.jsx(Zn,{data:{method:e.method,timestamp:e.timestamp,read:e.read,params:e.params},filename:`notification-${e.method.replace(/[^a-zA-Z0-9]/g,"-")}-${Date.now()}.json`})})})]}):m.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[m.jsx(QI,{className:"h-12 w-12 text-gray-400 dark:text-gray-600 mb-3"}),m.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"Select a notification to view details"})]})}function Nq(e){const n=Date.now()-e,r=Math.floor(n/1e3),a=Math.floor(r/60),i=Math.floor(a/60),s=Math.floor(i/24);return r<60?"just now":a<60?`${a}m ago`:i<24?`${i}h ago`:s<7?`${s}d ago`:new Date(e).toLocaleDateString()}function Jje({notifications:e,unreadCount:t,markNotificationRead:n,markAllNotificationsRead:r,clearNotifications:a,serverId:i,isConnected:s}){const[c,u]=b.useState(null),[d,p]=b.useState(""),[h,v]=b.useState(-1),[y,E]=b.useState(!0),[x,_]=b.useState(!1),[S,w]=b.useState(!0),[T,k]=b.useState(!1),N=b.useRef(null),A=b.useRef(null),C=b.useRef(null),O=b.useRef(!1);b.useEffect(()=>{y&&e.length>0&&N.current&&!O.current&&(N.current.scrollTop=0)},[e.length,y]),b.useEffect(()=>{const Z=N.current;if(!Z)return;const G=()=>{Z.scrollTop>0&&(O.current=!0,E(!1))};return Z.addEventListener("scroll",G),()=>Z.removeEventListener("scroll",G)},[]),b.useEffect(()=>{e.length===0&&(O.current=!1,E(!0))},[e.length]),b.useEffect(()=>{c&&!c.read&&n(c.id)},[c,n]),b.useEffect(()=>{x&&C.current&&C.current.focus()},[x]);const L=b.useCallback(()=>{d.trim()||_(!1)},[d]),F=b.useMemo(()=>{if(!d.trim())return e;const Z=d.toLowerCase();return e.filter(G=>G.method.toLowerCase().includes(Z)||JSON.stringify(G.params||{}).toLowerCase().includes(Z))},[e,d]);b.useEffect(()=>{v(-1)},[d]),b.useEffect(()=>{const Z=G=>{const ie=G.target;if(ie.tagName==="INPUT"||ie.tagName==="TEXTAREA"||ie.contentEditable==="true"||G.metaKey||G.ctrlKey||G.altKey)return;const P=F;if(G.key==="ArrowDown")G.preventDefault(),v(B=>{const j=B+1;return j>=P.length?0:j});else if(G.key==="ArrowUp")G.preventDefault(),v(B=>{const j=B-1;return j<0?P.length-1:j});else if(G.key==="Enter"&&h>=0){G.preventDefault();const B=F[h];B&&z(B)}};return document.addEventListener("keydown",Z),()=>document.removeEventListener("keydown",Z)},[h,F]),b.useEffect(()=>{if(h>=0){const Z=`notification-${F[h]?.id}`,G=document.getElementById(Z);G&&G.scrollIntoView({behavior:"smooth",block:"nearest"})}},[h,F]);const z=b.useCallback(Z=>{u(Z)},[]),K=b.useCallback(()=>{window.confirm("Are you sure you want to clear all notifications? This cannot be undone.")&&(a(),u(null))},[a]),ee=b.useCallback(async()=>{if(c)try{await navigator.clipboard.writeText(JSON.stringify({method:c.method,timestamp:c.timestamp,read:c.read,params:c.params},null,2)),k(!0),setTimeout(()=>k(!1),2e3)}catch(Z){console.error("[NotificationsTab] Failed to copy notification:",Z)}},[c]),J=b.useCallback(()=>{if(c)try{const Z=new globalThis.Blob([JSON.stringify({method:c.method,timestamp:c.timestamp,read:c.read,params:c.params},null,2)],{type:"application/json"}),G=URL.createObjectURL(Z),ie=document.createElement("a");ie.href=G,ie.download=`notification-${Date.now()}.json`,document.body.appendChild(ie),ie.click(),document.body.removeChild(ie),URL.revokeObjectURL(G)}catch(Z){console.error("[NotificationsTab] Failed to download notification:",Z)}},[c]),le=b.useCallback(async()=>{if(A.current)try{document.fullscreenElement?await document.exitFullscreen():await A.current.requestFullscreen()}catch(Z){console.error("[NotificationsTab] Failed to toggle fullscreen:",Z)}},[]),q=c?{method:c.method,params:c.params,timestamp:c.timestamp,read:c.read,formatRelativeTime:Nq}:null;return s?m.jsxs(ti,{direction:"horizontal",className:"h-full",children:[m.jsx(Vn,{defaultSize:40,minSize:30,children:m.jsx(ti,{direction:"vertical",className:"h-full border-r dark:border-zinc-700",children:m.jsxs(Vn,{defaultSize:75,minSize:30,children:[m.jsx(Yje,{isSearchExpanded:x,searchQuery:d,filteredNotificationsCount:F.length,notificationsCount:e.length,onSearchExpand:()=>_(!0),onSearchChange:p,onSearchBlur:L,onClearAll:K,searchInputRef:C}),m.jsx("div",{className:"flex flex-col h-full",children:m.jsx(Zje,{notifications:F,selectedNotification:c,onNotificationSelect:z,focusedIndex:h,formatRelativeTime:Nq,listRef:N})})]})})}),m.jsx(lo,{}),m.jsx(Vn,{defaultSize:60,minSize:40,children:m.jsx("div",{ref:A,className:"h-full bg-white dark:bg-zinc-900",children:m.jsx(Xje,{notification:q,previewMode:S,onTogglePreview:()=>w(!S),onCopy:ee,onDownload:J,onFullscreen:le,onClose:()=>u(null),isCopied:T})})})]}):m.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[m.jsx(QI,{className:"h-12 w-12 text-gray-400 dark:text-gray-600 mb-3"}),m.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"Not connected to server"})]})}function Nee({activeTab:e,isSearchExpanded:t,searchQuery:n,primaryTabTitle:r,secondaryTabTitle:a,primaryCount:i,secondaryCount:s,secondaryIcon:c,primaryIcon:u,searchPlaceholder:d="Search...",onSearchExpand:p,onSearchChange:h,onSearchBlur:v,onTabSwitch:y,searchInputRef:E,primaryTabName:x}){const _=e===x;return m.jsxs("div",{className:"flex flex-row items-center justify-between p-4 sm:p-4 py-3 gap-2",children:[m.jsx("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:t?m.jsx(Hn,{ref:E,placeholder:d,value:n,onChange:S=>h(S.target.value),onBlur:v,className:"h-8 border-gray-300 dark:border-zinc-600"}):m.jsxs(m.Fragment,{children:[m.jsx("h2",{className:"text-lg font-medium text-gray-900 dark:text-gray-100",children:_?r:a}),_&&m.jsxs(m.Fragment,{children:[m.jsx(Hr,{className:"bg-zinc-500/20 text-zinc-600 dark:text-zinc-400 border-transparent",variant:"outline",children:i}),m.jsxs(ln,{children:[m.jsx(cn,{asChild:!0,children:m.jsx(Be,{variant:"ghost",size:"sm",onClick:p,className:"h-8 w-8 p-0",children:m.jsx(fb,{className:"h-4 w-4"})})}),m.jsxs(un,{side:"bottom",className:"flex gap-2",children:["Search",m.jsx(EO,{children:"F"})]})]})]})]})}),m.jsxs(Be,{variant:"ghost",size:"sm",onClick:y,className:"gap-2 flex-shrink-0",children:[_?m.jsx(c,{}):m.jsx(u,{}),m.jsx("span",{className:"hidden sm:inline",children:_?a:r}),_&&s>0&&m.jsx(Hr,{className:"bg-purple-500/20 text-purple-600 dark:text-purple-400 border-transparent",variant:"outline",children:s})]})]})}function kq({prompts:e,selectedPrompt:t,onPromptSelect:n,focusedIndex:r}){return e.length===0?m.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[m.jsx(Pf,{className:"h-12 w-12 text-gray-400 dark:text-gray-600 mb-3"}),m.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"No prompts available"})]}):m.jsx("div",{className:"overflow-y-auto flex-1 border-r dark:border-zinc-700 overscroll-contain",children:e.map((a,i)=>m.jsx(Ku,{id:`prompt-${a.name}`,isSelected:t?.name===a.name,isFocused:r===i,icon:m.jsx(Pf,{className:"h-4 w-4"}),title:a.name,description:a.description,metadata:a.arguments&&a.arguments.length>0&&m.jsxs(Hr,{variant:"outline",className:"text-xs border-gray-300 dark:border-zinc-600 text-gray-600 dark:text-gray-400",children:[a.arguments.length," args"]}),onClick:()=>n(a)},a.name))})}function Cq({activeTab:e,isSearchExpanded:t,searchQuery:n,filteredPromptsCount:r,savedPromptsCount:a,onSearchExpand:i,onSearchChange:s,onSearchBlur:c,onTabSwitch:u,searchInputRef:d}){return m.jsx(Nee,{activeTab:e,isSearchExpanded:t,searchQuery:n,primaryTabName:"prompts",secondaryTabName:"saved",primaryTabTitle:"Prompts",secondaryTabTitle:"History",primaryCount:r,secondaryCount:a,primaryIcon:Pf,secondaryIcon:Tu,searchPlaceholder:"Search prompts...",onSearchExpand:i,onSearchChange:s,onSearchBlur:c,onTabSwitch:u,searchInputRef:d})}function Aq({savedPrompts:e,selectedPrompt:t,onLoadPrompt:n,onDeletePrompt:r,focusedIndex:a}){return e.length===0?m.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[m.jsx(Tu,{className:"h-12 w-12 text-gray-400 dark:text-gray-600 mb-3"}),m.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"No history"}),m.jsx("p",{className:"text-sm text-gray-400 dark:text-gray-500 mt-1",children:"Prompts you execute will appear here"})]}):m.jsx("div",{className:"overflow-y-auto flex-1 border-r dark:border-zinc-700 overscroll-contain",children:e.map((i,s)=>m.jsx(Ku,{id:`saved-prompt-${i.id}`,isSelected:t?.id===i.id,isFocused:a===s,icon:m.jsx(Tu,{className:"h-4 w-4"}),title:i.name,description:`${i.promptName} - ${new Date(i.savedAt).toLocaleString()}`,onClick:()=>n(i)},i.id))})}function Qje({selectedPrompt:e,promptArgs:t,onArgChange:n}){const r=e?.arguments||[];if(!(r.length>0))return m.jsx("div",{className:"flex items-center justify-center h-32 text-gray-500 dark:text-gray-400 text-sm",children:"No arguments required"});const i=s=>{const c=s.name,u=t[c],d=typeof u=="string"?u:JSON.stringify(u);return s.type==="boolean"?m.jsxs("div",{className:"space-y-2",children:[m.jsxs(yn,{htmlFor:c,className:"text-sm font-medium",children:[c,s.required&&m.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),m.jsxs("div",{className:"flex items-center space-x-2",children:[m.jsx("input",{id:c,type:"checkbox",checked:!!u,onChange:p=>n(c,p.target.checked),className:"rounded","aria-label":`Toggle ${c}`}),m.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400",children:s.description})]})]},c):s.type==="number"?m.jsxs("div",{className:"space-y-2",children:[m.jsxs(yn,{htmlFor:c,className:"text-sm font-medium",children:[c,s.required&&m.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),m.jsx(Hn,{id:c,type:"number",value:Number(u)||0,onChange:p=>n(c,Number(p.target.value)),placeholder:s.description||`Enter ${c}`}),s.description&&m.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:s.description})]},c):s.type==="array"||s.type==="object"?m.jsxs("div",{className:"space-y-2",children:[m.jsxs(yn,{htmlFor:c,className:"text-sm font-medium",children:[c,s.required&&m.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),m.jsx(xb,{id:c,value:d,onChange:p=>{try{const h=JSON.parse(p.target.value);n(c,h)}catch{n(c,p.target.value)}},placeholder:s.description||`Enter ${c} as JSON`,className:"font-mono text-sm min-h-[100px]"}),s.description&&m.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:s.description})]},c):m.jsxs("div",{className:"space-y-2",children:[m.jsxs(yn,{htmlFor:c,className:"text-sm font-medium",children:[c,s.required&&m.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),m.jsx(Hn,{id:c,value:d,onChange:p=>n(c,p.target.value),placeholder:s.description||`Enter ${c}`}),s.description&&m.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:s.description})]},c)};return m.jsx("div",{className:"space-y-4",children:r.map(s=>i(s))})}function Iq({selectedPrompt:e,promptArgs:t,isExecuting:n,isConnected:r,onArgChange:a,onExecute:i,onSave:s}){return e?m.jsxs("div",{className:"flex flex-col h-full",children:[m.jsx("div",{className:"flex-shrink-0 p-3 sm:p-6 pt-3 pb-4 pr-3",children:m.jsxs("div",{children:[m.jsxs("div",{className:"flex flex-row items-center justify-between mb-0 gap-2",children:[m.jsx("h3",{className:"text-base sm:text-lg font-semibold",children:e.name}),m.jsxs("div",{className:"flex gap-2 flex-shrink-0",children:[m.jsx(Be,{onClick:i,disabled:n||!r,size:"sm",className:"lg:size-default",children:n?m.jsxs(m.Fragment,{children:[m.jsx(vo,{className:"mr-2"}),m.jsx("span",{className:"hidden sm:inline",children:"Executing..."})]}):m.jsxs(m.Fragment,{children:[m.jsx(FY,{className:"h-4 w-4 sm:mr-2"}),m.jsx("span",{className:"hidden sm:inline",children:"Execute"})]})}),m.jsxs(Be,{variant:"outline",onClick:s,disabled:n,size:"sm",className:"lg:size-default gap-2",children:[m.jsx(a1,{className:"h-4 w-4"}),m.jsx("span",{className:"hidden sm:inline",children:"Save"})]})]})]}),e.description&&m.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 leading-relaxed mt-2",children:e.description})]})}),m.jsx("div",{className:"flex-1 overflow-y-auto px-3 sm:px-6 pb-4 pr-3",children:m.jsx(Qje,{selectedPrompt:e,promptArgs:t,onArgChange:a})})]}):m.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[m.jsx("p",{className:"text-gray-500 dark:text-gray-400 mb-2",children:"Select a prompt to get started"}),m.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500",children:"Choose a prompt from the list to view its details and execute it"})]})}function Oq({results:e,copiedResult:t,onCopy:n}){return m.jsx("div",{className:"flex flex-col h-full bg-white dark:bg-black border-t dark:border-zinc-700",children:m.jsx("div",{className:"flex-1 overflow-y-auto h-full",children:e.length>0?m.jsx("div",{className:"space-y-4 flex-1 h-full",children:e.map((r,a)=>m.jsxs("div",{className:"space-y-0 flex-1 h-full flex flex-col",children:[m.jsxs("div",{className:"flex items-center gap-2 px-4 pt-2 border-b border-gray-200 dark:border-zinc-600 pb-2",children:[m.jsx("h3",{className:"text-sm font-medium",children:"Response"}),m.jsxs("div",{className:"flex items-center gap-1",children:[m.jsx(Tu,{className:"h-3 w-3 text-gray-400"}),m.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:new Date(r.timestamp).toLocaleTimeString()})]}),r.duration!==void 0&&m.jsxs("div",{className:"flex items-center gap-1",children:[m.jsx(Uf,{className:"h-3 w-3 text-gray-400"}),m.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:[r.duration,"ms"]})]}),m.jsx("div",{className:"flex gap-2 ml-auto",children:m.jsx(Be,{variant:"ghost",size:"sm",onClick:()=>n(a,r.result),className:"h-6 px-2",children:t===a?m.jsx(Da,{className:"h-4 w-4"}):m.jsx(Br,{className:"h-4 w-4"})})})]}),r.error?m.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded p-3 mx-4",children:[m.jsx("p",{className:"text-red-800 dark:text-red-300 font-medium",children:"Error:"}),m.jsx("p",{className:"text-red-700 dark:text-red-400 text-sm",children:r.error})]}):m.jsx("div",{className:"px-4 pt-4",children:m.jsx(Zn,{data:r.result,filename:`prompt-result-${r.promptName}-${Date.now()}.json`})})]},a))}):m.jsx("div",{className:"flex items-center justify-center h-full",children:m.jsx("div",{className:"text-center",children:m.jsx(ob,{vertical:!0,noBorder:!0,message:"No Results yet"})})})})})}function _O({serverIds:e,onCountChange:t,onClearRef:n}={}){const[r,a]=b.useState([]),i=b.useRef(null),[s,c]=b.useState(new Set),[u]=b.useState(""),d=y=>{c(E=>{const x=new Set(E);return x.has(y)?x.delete(y):x.add(y),x})},p=async()=>{a([]),c(new Set),t?.(0);try{const y=new URLSearchParams;e&&e.length>0&&y.set("serverIds",e.join(","));const E=await fetch(`/inspector/api/rpc/log?${y.toString()}`,{method:"DELETE"});E.ok||console.warn("[RPC Logger] Failed to clear server buffer:",E.status)}catch(y){console.warn("[RPC Logger] Error clearing server buffer:",y)}},h=b.useMemo(()=>!e||e.length===0?"":[...e].sort().join(","),[e]);b.useEffect(()=>(n&&(n.current=p),()=>{n&&(n.current=null)}),[n,p]),b.useEffect(()=>{t?.(r.length)},[r.length,t]),b.useEffect(()=>{let y=null;try{const E=new URLSearchParams;E.set("replay","3"),E.set("_t",Date.now().toString()),e&&e.length>0&&E.set("serverIds",e.join(","));const x=`/inspector/api/rpc/stream?${E.toString()}`;console.log("[RPC Logger] Connecting to SSE stream:",x),y=new globalThis.EventSource(x),y.onopen=()=>{console.log("[RPC Logger] SSE connection opened")},y.onmessage=_=>{try{const S=JSON.parse(_.data);if(!S||S.type!=="rpc")return;const{serverId:w,direction:T,message:k,timestamp:N}=S,A=k,C=typeof A?.method=="string"?A.method:A?.result!==void 0?"result":A?.error!==void 0?"error":"unknown",O={id:`${N??Date.now()}-${Math.random().toString(36).slice(2)}`,serverId:typeof w=="string"?w:"unknown",direction:typeof T=="string"?T.toUpperCase():"",method:C,timestamp:N??new Date().toISOString(),payload:k};console.log("[RPC Logger] Received RPC event:",{method:C,direction:T,serverId:w}),a(L=>{const F=[O,...L].slice(0,1e3);return t?.(F.length),F})}catch(S){console.error("[RPC Logger] Error parsing SSE message:",S)}},y.onerror=_=>{console.error("[RPC Logger] SSE connection error:",_);try{y?.close()}catch{}}}catch(E){console.error("[RPC Logger] Failed to create SSE connection:",E)}return()=>{try{y?.close(),console.log("[RPC Logger] SSE connection closed")}catch{}}},[h]);const v=b.useMemo(()=>{let y=r;if(e&&e.length>0){const E=new Set(e);y=y.filter(x=>E.has(x.serverId))}if(u.trim()){const E=u.toLowerCase();y=y.filter(x=>x.serverId.toLowerCase().includes(E)||x.method.toLowerCase().includes(E)||x.direction.toLowerCase().includes(E)||JSON.stringify(x.payload).toLowerCase().includes(E))}return y},[r,u,e]);return m.jsx("div",{className:"flex h-full min-h-0 flex-col overflow-hidden",children:m.jsx("div",{ref:i,className:"flex-1 min-h-0 overflow-y-auto",children:v.length===0?m.jsxs("div",{className:"text-center py-8",children:[m.jsx("div",{className:"text-xs text-muted-foreground",children:"No messages yet"}),m.jsx("div",{className:"text-[10px] text-muted-foreground mt-1",children:"JSON-RPC messages will appear here"})]}):v.map(y=>{const E=s.has(y.id);return m.jsxs("div",{className:"group hover:bg-muted/50 transition-all duration-200 overflow-hidden",children:[m.jsxs("div",{className:"px-3 py-2 flex items-center gap-2 cursor-pointer hover:bg-muted/50 transition-colors",onClick:()=>d(y.id),children:[m.jsx("div",{className:"flex-shrink-0",children:E?m.jsx(Ol,{className:"h-3 w-3 text-muted-foreground transition-transform"}):m.jsx(Iwe,{className:"h-3 w-3 text-muted-foreground transition-transform"})}),m.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[m.jsx("span",{className:"text-muted-foreground font-mono text-xs",children:new Date(y.timestamp).toLocaleTimeString()}),m.jsx("span",{className:`flex items-center justify-center px-1 py-0.5 rounded ${y.direction==="RECEIVE"?"bg-blue-500/10 text-blue-600 dark:text-blue-400":"bg-green-500/10 text-green-600 dark:text-green-400"}`,title:y.direction==="RECEIVE"?"Incoming":"Outgoing",children:y.direction==="RECEIVE"?m.jsx(bwe,{className:"h-3 w-3"}):m.jsx(wwe,{className:"h-3 w-3"})}),m.jsx("span",{className:"text-xs font-mono text-foreground truncate",children:y.method})]})]}),E&&m.jsx("div",{className:"border-t bg-muted/20",children:m.jsx("div",{className:"p-3",children:m.jsx("div",{className:"max-h-[40vh] overflow-auto rounded-sm bg-background/60 p-2",children:m.jsx(Zn,{data:y.payload})})})})]},y.id)})})})}const Dq="mcp-inspector-saved-prompts";function kee({ref:e,prompts:t,callPrompt:n,serverId:r,isConnected:a}){const[i,s]=b.useState(null),[c,u]=b.useState(null),{selectedPromptName:d,setSelectedPromptName:p}=Tp(),[h,v]=b.useState({}),[y,E]=b.useState([]),[x,_]=b.useState(!1),[S,w]=b.useState(null),[T,k]=b.useState(""),[N,A]=b.useState("prompts"),[C,O]=b.useState([]),[L,F]=b.useState(!1),[z,K]=b.useState(""),[ee,J]=b.useState(!1),[le,q]=b.useState(-1),Z=b.useRef(null),[G,ie]=b.useState(!1),[te,P]=b.useState("list"),[B,j]=b.useState(0),[$,U]=b.useState(!0),H=b.useRef(null),W=b.useRef(null);b.useEffect(()=>{const Ee=()=>{ie(window.innerWidth<1024)};return Ee(),window.addEventListener("resize",Ee),()=>window.removeEventListener("resize",Ee)},[]),b.useEffect(()=>{P(i?"detail":"list")},[i]),b.useEffect(()=>{G&&y.length>0&&!x&&P("response")},[y,x,G]),b.useImperativeHandle(e,()=>({focusSearch:()=>{J(!0),setTimeout(()=>{Z.current&&Z.current.focus()},0)},blurSearch:()=>{k(""),J(!1),Z.current&&Z.current.blur()}})),b.useEffect(()=>{try{const Ee=localStorage.getItem(Dq);if(Ee){const Ne=JSON.parse(Ee);O(Ne)}}catch(Ee){console.error("[PromptsTab] Failed to load saved prompts:",Ee)}},[]);const X=b.useCallback(Ee=>{try{localStorage.setItem(Dq,JSON.stringify(Ee))}catch(Ne){console.error("[PromptsTab] Failed to save prompts:",Ne)}},[]);b.useEffect(()=>{ee&&Z.current&&Z.current.focus()},[ee]);const de=b.useCallback(()=>{T.trim()||J(!1)},[T]),ue=b.useMemo(()=>{if(!T.trim())return t;const Ee=T.toLowerCase();return t.filter(Ne=>Ne.name.toLowerCase().includes(Ee)||Ne.description?.toLowerCase().includes(Ee))},[t,T]),Y=b.useCallback(Ee=>{s(Ee);const Ne={};Ee.arguments&&Ee.arguments.forEach(ze=>{ze.default!==void 0?Ne[ze.name]=ze.default:ze.type==="string"?Ne[ze.name]="":ze.type==="number"?Ne[ze.name]=0:ze.type==="boolean"?Ne[ze.name]=!1:ze.type==="array"?Ne[ze.name]=[]:ze.type==="object"&&(Ne[ze.name]={})}),v(Ne)},[]),Q=b.useCallback(Ee=>{const Ne=t.find(ze=>ze.name===Ee.promptName);Ne&&(s(Ne),v(Ee.args),u(Ee))},[t]);b.useEffect(()=>{q(-1)},[T,N]),b.useEffect(()=>{const Ee=Ne=>{const ze=Ne.target;if(ze.tagName==="INPUT"||ze.tagName==="TEXTAREA"||ze.contentEditable==="true"||Ne.metaKey||Ne.ctrlKey||Ne.altKey)return;const je=N==="prompts"?ue:C;if(Ne.key==="ArrowDown")Ne.preventDefault(),q(Ze=>{const Se=Ze+1;return Se>=je.length?0:Se});else if(Ne.key==="ArrowUp")Ne.preventDefault(),q(Ze=>{const Se=Ze-1;return Se<0?je.length-1:Se});else if(Ne.key==="Enter"&&le>=0)if(Ne.preventDefault(),N==="prompts"){const Ze=ue[le];Ze&&Y(Ze)}else{const Ze=C[le];Ze&&Q(Ze)}};return document.addEventListener("keydown",Ee),()=>document.removeEventListener("keydown",Ee)},[le,ue,C,N,Y,Q]),b.useEffect(()=>{if(le>=0){const Ee=N==="prompts"?`prompt-${ue[le]?.name}`:`saved-prompt-${C[le]?.id}`,Ne=document.getElementById(Ee);Ne&&Ne.scrollIntoView({behavior:"smooth",block:"nearest"})}},[le,ue,C,N]),b.useEffect(()=>{if(console.warn("[PromptsTab] Auto-selection effect triggered:",{selectedPromptName:d,promptsCount:t.length,currentSelectedPrompt:i?.name}),d&&t.length>0){const Ee=t.find(Ne=>Ne.name===d);if(console.warn("[PromptsTab] Prompt lookup result:",{selectedPromptName:d,promptFound:!!Ee,promptName:Ee?.name,shouldSelect:Ee&&i?.name!==Ee.name}),Ee&&i?.name!==Ee.name){console.warn("[PromptsTab] Selecting prompt:",Ee.name),p(null);const Ne=setTimeout(()=>{Y(Ee);const ze=document.getElementById(`prompt-${Ee.name}`);ze&&(console.warn("[PromptsTab] Scrolling to prompt element"),ze.scrollIntoView({behavior:"smooth",block:"nearest"}))},100);return()=>clearTimeout(Ne)}}},[d,t,i,Y,p]);const oe=b.useCallback((Ee,Ne)=>{v(ze=>({...ze,[Ee]:Ne}))},[]),ae=b.useCallback(async()=>{if(!i||x)return;_(!0);const Ee=Date.now();try{const Ne=await n(i.name,h),ze=Date.now()-Ee;er.getInstance().capture(new _U({promptName:i.name,serverId:r,success:!0})).catch(()=>{}),E(je=>[{promptName:i.name,args:h,result:Ne,timestamp:Ee,duration:ze},...je])}catch(Ne){er.getInstance().capture(new _U({promptName:i.name,serverId:r,success:!1,error:Ne instanceof Error?Ne.message:"Unknown error"})).catch(()=>{});const he={promptName:i.name,args:h,result:null,error:Ne instanceof Error?Ne.message:String(Ne),timestamp:Ee,duration:Date.now()-Ee};E(je=>[he,...je])}finally{_(!1)}},[i,h,x,n,r]),Re=b.useCallback(async(Ee,Ne)=>{try{await navigator.clipboard.writeText(JSON.stringify(Ne,null,2)),w(Ee),setTimeout(()=>w(null),2e3)}catch(ze){console.error("[PromptsTab] Failed to copy result:",ze)}},[]),Ae=b.useCallback(()=>{i&&(K(""),F(!0))},[i]),Ye=b.useCallback(Ee=>{X(C.filter(Ne=>Ne.id!==Ee)),c?.id===Ee&&u(null)},[C,X,c]);return G?m.jsxs("div",{className:"h-full flex flex-col overflow-hidden relative bg-background",children:[te!=="list"&&m.jsxs("div",{className:"flex items-center gap-2 p-2 border-b shrink-0 bg-background z-10",children:[m.jsx(Be,{variant:"ghost",size:"sm",onClick:()=>{te==="response"?P("detail"):(s(null),P("list"))},className:"p-0 h-8 w-8",children:m.jsx(e1,{className:"h-4 w-4"})}),m.jsxs("div",{className:"flex items-center text-sm font-medium",children:[m.jsx("button",{onClick:()=>{s(null),P("list")},className:"text-muted-foreground hover:text-foreground hover:underline cursor-pointer",children:"Prompts"}),te!=="list"&&m.jsxs(m.Fragment,{children:[m.jsx("span",{className:"mx-2 text-muted-foreground",children:"/"}),m.jsx("button",{onClick:()=>{te==="response"&&P("detail")},className:te==="detail"?"text-foreground hover:underline":te==="response"?"text-muted-foreground hover:text-foreground hover:underline cursor-pointer":"text-muted-foreground",children:"Execute"})]}),te==="response"&&m.jsxs(m.Fragment,{children:[m.jsx("span",{className:"mx-2 text-muted-foreground",children:"/"}),m.jsx("span",{className:"text-foreground",children:"Response"})]})]})]}),m.jsx("div",{className:"flex-1 relative overflow-hidden",children:m.jsxs(bb,{initial:!1,mode:"popLayout",children:[te==="list"&&m.jsxs(qr.div,{initial:{x:"-100%"},animate:{x:0},exit:{x:"-100%"},transition:{type:"spring",stiffness:300,damping:30},className:"absolute inset-0 flex flex-col bg-background z-0",children:[m.jsx(Cq,{activeTab:N,isSearchExpanded:ee,searchQuery:T,filteredPromptsCount:ue.length,savedPromptsCount:C.length,onSearchExpand:()=>J(!0),onSearchChange:k,onSearchBlur:de,onTabSwitch:()=>A(N==="prompts"?"saved":"prompts"),searchInputRef:Z}),N==="prompts"?m.jsx(kq,{prompts:ue,selectedPrompt:i,onPromptSelect:Y,focusedIndex:le}):m.jsx(Aq,{savedPrompts:C,selectedPrompt:c,onLoadPrompt:Q,onDeletePrompt:Ye,focusedIndex:le})]},"list"),te==="detail"&&m.jsx(qr.div,{initial:{x:"100%"},animate:{x:0},exit:{x:"-100%"},transition:{type:"spring",stiffness:300,damping:30},className:"absolute inset-0 bg-background z-10",children:m.jsx(Iq,{selectedPrompt:i,promptArgs:h,isExecuting:x,isConnected:a,onArgChange:oe,onExecute:ae,onSave:Ae})},"detail"),te==="response"&&m.jsx(qr.div,{initial:{x:"100%"},animate:{x:0},exit:{x:"100%"},transition:{type:"spring",stiffness:300,damping:30},className:"absolute inset-0 bg-background z-20",children:m.jsx(Oq,{results:y,copiedResult:S,onCopy:Re})},"response")]})})]}):m.jsxs(ti,{direction:"horizontal",className:"h-full",children:[m.jsx(Vn,{defaultSize:33,className:"flex flex-col h-full relative",children:m.jsxs(ti,{direction:"vertical",className:"h-full border-r dark:border-zinc-700",children:[m.jsx(Vn,{defaultSize:75,minSize:30,children:m.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[m.jsx(Cq,{activeTab:N,isSearchExpanded:ee,searchQuery:T,filteredPromptsCount:ue.length,savedPromptsCount:C.length,onSearchExpand:()=>J(!0),onSearchChange:k,onSearchBlur:de,onTabSwitch:()=>A(N==="prompts"?"saved":"prompts"),searchInputRef:Z}),N==="prompts"?m.jsx(kq,{prompts:ue,selectedPrompt:i,onPromptSelect:Y,focusedIndex:le}):m.jsx(Aq,{savedPrompts:C,selectedPrompt:c,onLoadPrompt:Q,onDeletePrompt:Ye,focusedIndex:le})]})}),m.jsx(lo,{withHandle:!0}),m.jsxs(Vn,{ref:H,defaultSize:0,collapsible:!0,minSize:5,collapsedSize:5,onCollapse:()=>U(!0),onExpand:()=>U(!1),className:"flex flex-col border-t dark:border-zinc-700",children:[m.jsxs("div",{className:"group flex items-center justify-between p-3 shrink-0 cursor-pointer hover:bg-muted/50 transition-colors",onClick:Ee=>{Ee.preventDefault(),Ee.stopPropagation(),$?(H.current?.resize(25),U(!1)):(H.current?.resize(5),U(!0))},children:[m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx("h3",{className:"text-sm font-medium",children:"RPC Messages"}),B>0&&m.jsx(Hr,{variant:"secondary",className:"bg-zinc-500/20 text-zinc-600 dark:text-zinc-400 border-transparent",children:B}),B>0&&!$&&m.jsx(Be,{variant:"ghost",size:"sm",onClick:Ee=>{Ee.preventDefault(),Ee.stopPropagation(),W.current?.()},className:"h-6 w-6 p-0",title:"Clear all messages",children:m.jsx(bl,{className:"h-3.5 w-3.5"})})]}),m.jsx(Ol,{className:`h-4 w-4 text-muted-foreground transition-transform ${$?"rotate-180":""}`})]}),!$&&m.jsx("div",{className:"flex-1 overflow-hidden min-h-0",children:m.jsx(_O,{serverIds:[r],onCountChange:j,onClearRef:W})})]})]})}),m.jsx(lo,{withHandle:!0}),m.jsx(Vn,{defaultSize:67,children:m.jsxs(ti,{direction:"vertical",children:[m.jsx(Vn,{defaultSize:40,children:m.jsx(Iq,{selectedPrompt:i,promptArgs:h,isExecuting:x,isConnected:a,onArgChange:oe,onExecute:ae,onSave:Ae})}),m.jsx(lo,{withHandle:!0}),m.jsx(Vn,{defaultSize:50,children:m.jsx("div",{className:"flex flex-col h-full",children:m.jsx(Oq,{results:y,copiedResult:S,onCopy:Re})})})]})})]})}kee.displayName="PromptsTab";function ru(e){if(!e?.mimeType)return!1;const t=e.mimeType.toLowerCase();return t==="text/html"||t==="text/html+skybridge"||t==="text/uri-list"||t.startsWith("application/vnd.mcp-ui.remote-dom")}function ePe(e){return{uri:e.uri,mimeType:e.mimeType,text:e.text,blob:e.blob}}function Cee({resource:e,onUIAction:t,className:n}){const r=async i=>t?.(i),a=ePe(e);return m.jsx("div",{className:n,children:m.jsx(bO,{resource:a,onUIAction:r,htmlProps:{autoResizeIframe:{width:!0,height:!0},style:{width:"100%",minHeight:"200px"},sandboxPermissions:"allow-scripts allow-same-origin allow-forms allow-popups allow-popups-to-escape-sandbox"},remoteDomProps:{remoteElements:[dje,uje,fje,pje],library:vO}})})}function $q({result:e,isLoading:t,previewMode:n,serverId:r,readResource:a,onTogglePreview:i,onCopy:s,onDownload:c,onFullscreen:u,isCopied:d=!1}){let p=[],h;if(e?.resourceAnnotations&&(p=Object.keys(e.resourceAnnotations).filter(x=>x.startsWith("openai/")),h=e.resourceAnnotations["openai/outputTemplate"]),e?.result?.contents?.[0]?._meta){const x=e.result.contents[0]._meta,_=Object.keys(x).filter(S=>S.startsWith("openai/"));_.length>0&&(p=[...p,..._]),!h&&x["openai/outputTemplate"]&&(h=x["openai/outputTemplate"]),!h&&e.uri&&e.uri.startsWith("ui://widget/")&&(h=e.uri)}const v=!!(p.length>0&&h&&typeof h=="string"&&r&&a);if(t)return m.jsx("div",{className:"flex absolute left-0 top-0 items-center justify-center w-full h-full",children:m.jsx(vo,{className:"size-5"})});if(!e)return m.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[m.jsx("p",{className:"text-gray-500 dark:text-gray-400 mb-2",children:"Select a resource to view its contents"}),m.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500",children:"Choose a resource from the list to see its data"})]});if(e.error)return m.jsx("div",{className:"p-4",children:m.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded p-3",children:[m.jsx("p",{className:"text-red-800 dark:text-red-300 font-medium",children:"Error:"}),m.jsx("p",{className:"text-red-700 dark:text-red-400 text-sm",children:e.error})]})});const y=e?.result?.contents&&Array.isArray(e.result.contents)&&e.result.contents.some(x=>x.mimeType&&ru(x)),E=y?e.result.contents.filter(x=>x.mimeType&&ru(x)):[];return m.jsxs("div",{className:"flex flex-col h-full",children:[m.jsxs("div",{className:"flex-shrink-0 px-4 py-3 border-b border-gray-200 dark:border-zinc-700 flex items-center justify-between",children:[m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsxs("div",{className:"flex items-center gap-1",children:[m.jsx(Tu,{className:"h-3 w-3 text-gray-400"}),m.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:new Date(e.timestamp).toLocaleTimeString()})]}),(()=>{const x=e?.duration??e.result?.duration??e.result?.metrics?.durationMs;return x!==void 0?m.jsxs("div",{className:"flex items-center gap-1",children:[m.jsx(Uf,{className:"h-3 w-3 text-gray-400"}),m.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:[x,"ms"]})]}):null})(),y&&m.jsx(Hr,{variant:"outline",className:"text-xs bg-purple-50 dark:bg-purple-900/20 border-none border-purple-200 dark:border-purple-800/50 text-purple-600 dark:text-purple-400",children:"MCP UI"}),v&&m.jsx(Hr,{variant:"outline",className:"text-xs bg-blue-50 dark:bg-blue-900/20 border-none border-blue-200 dark:border-blue-800/50 text-blue-600 dark:text-blue-400",children:"OpenAI Widget"})]}),m.jsxs("div",{className:"flex items-center gap-1",children:[(y||v)&&m.jsxs(Be,{variant:"ghost",size:"sm",onClick:i,className:n?"":"text-purple-600 dark:text-purple-400",children:[n?m.jsx(PY,{className:"h-4 w-4 mr-1"}):m.jsx(jY,{className:"h-4 w-4 mr-1"}),n?"JSON":v?"Component":"Preview"]}),m.jsx(Be,{variant:"ghost",size:"sm",onClick:s,children:d?m.jsx(Da,{className:"h-4 w-4"}):m.jsx(Br,{className:"h-4 w-4"})}),m.jsx(Be,{variant:"ghost",size:"sm",onClick:c,children:m.jsx(t1,{className:"h-4 w-4"})}),m.jsx(Be,{variant:"ghost",size:"sm",onClick:u,children:m.jsx(r1,{className:"h-4 w-4"})})]})]}),m.jsx("div",{className:"flex-1 overflow-y-auto",children:v&&r&&a&&h?n?m.jsx("div",{className:"flex-1 h-full",children:m.jsx(fO,{componentUrl:h,toolName:e.uri,toolArgs:{},toolResult:e.result,serverId:r,readResource:a,className:"w-full h-full relative flex p-4"})}):m.jsx("div",{className:"px-4 pt-4",children:m.jsx(Zn,{data:e.result,filename:`resource-${e.uri.replace(/[^a-zA-Z0-9]/g,"-")}-${Date.now()}.json`})}):y?n?m.jsxs("div",{className:"space-y-0 h-full",children:[E.map((x,_)=>m.jsx("div",{className:"mx-0 size-full",children:m.jsx("div",{className:"w-full h-full",children:m.jsx(Cee,{resource:x,className:"w-full h-full"})})},`mcp-ui-${x.uri||`resource-${Date.now()}-${Math.random()}`}`)),(()=>{if(e.result.contents&&Array.isArray(e.result.contents)){const x=e.result.contents.filter(_=>!(_.mimeType&&ru(_)));if(x.length>0)return m.jsx("div",{className:"px-4",children:m.jsx(Zn,{data:x,filename:`resource-${e.uri.replace(/[^a-zA-Z0-9]/g,"-")}-non-ui-${Date.now()}.json`})})}return null})()]}):m.jsx("div",{className:"px-4 pt-4",children:m.jsx(Zn,{data:e.result,filename:`resource-${e.uri.replace(/[^a-zA-Z0-9]/g,"-")}-mcp-ui-${Date.now()}.json`})}):m.jsx("div",{className:"px-4 pt-4",children:m.jsx(Zn,{data:e.result,filename:`resource-${e.uri.replace(/[^a-zA-Z0-9]/g,"-")}-${Date.now()}.json`})})})]})}function tPe(e,t){if(!e&&!t)return m.jsx(rSe,{className:"h-5 w-5"});const n=(e||t||"").toLowerCase();return n.includes("image")?m.jsx(eSe,{className:"h-5 w-5"}):n.includes("json")||n.includes("javascript")||n.includes("typescript")?m.jsx(Jwe,{className:"h-5 w-5"}):n.includes("html")||n.includes("xml")?m.jsx(sSe,{className:"h-5 w-5"}):n.includes("database")||n.includes("sql")?m.jsx(db,{className:"h-5 w-5"}):m.jsx(n1,{className:"h-5 w-5"})}function Lq({resources:e,selectedResource:t,onResourceSelect:n,focusedIndex:r}){return e.length===0?m.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[m.jsx(db,{className:"h-12 w-12 text-gray-400 dark:text-gray-600 mb-3"}),m.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"No resources available"})]}):m.jsx("div",{className:"overflow-y-auto flex-1 overscroll-contain",children:e.map((a,i)=>{const s=tPe(a.mimeType,a.uri),c=[a.description,a.mimeType&&m.jsx("span",{className:"font-mono",children:a.mimeType},"mime")].filter(Boolean);return m.jsx(Ku,{id:`resource-${a.uri}`,isSelected:t?.uri===a.uri,isFocused:r===i,icon:s,title:a.name,description:c.length>0?m.jsxs("span",{className:"flex flex-col gap-1",children:[a.description&&m.jsx("span",{children:a.description}),a.mimeType&&m.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-500 font-mono",children:a.mimeType})]}):void 0,onClick:()=>n(a)},a.uri)})})}function Mq({isSearchExpanded:e,searchQuery:t,filteredResourcesCount:n,onSearchExpand:r,onSearchChange:a,onSearchBlur:i,searchInputRef:s}){return m.jsx("div",{className:"flex flex-row items-center justify-between p-4 sm:p-4 py-3 gap-2",children:m.jsx("div",{className:"flex items-center gap-2 flex-1",children:e?m.jsx(Hn,{ref:s,placeholder:"Search resources...",value:t,onChange:c=>a(c.target.value),onBlur:i,className:"h-8 border-gray-300 dark:border-zinc-600"}):m.jsxs(m.Fragment,{children:[m.jsx("h2",{className:"text-lg font-medium text-gray-900 dark:text-gray-100",children:"Resources"}),m.jsx(Hr,{className:"bg-zinc-500/20 text-zinc-600 dark:text-zinc-400 border-transparent",variant:"outline",children:n}),m.jsxs(ln,{children:[m.jsx(cn,{asChild:!0,children:m.jsx(Be,{variant:"ghost",size:"sm",onClick:r,className:"h-8 w-8 p-0",children:m.jsx(fb,{className:"h-4 w-4"})})}),m.jsxs(un,{side:"bottom",className:"flex gap-2",children:["Search",m.jsx(EO,{children:"F"})]})]})]})})})}function Aee({ref:e,resources:t,readResource:n,serverId:r,isConnected:a}){const[i,s]=b.useState(null),{selectedResourceUri:c,setSelectedResourceUri:u}=Tp(),[d,p]=b.useState(null),[h,v]=b.useState(!1),[y,E]=b.useState(""),[x]=b.useState("resources"),[_,S]=b.useState(!0),[w,T]=b.useState(!1),[k,N]=b.useState(-1),[A,C]=b.useState(!1),O=b.useRef(null),L=b.useRef(null),[F,z]=b.useState(!1),[K,ee]=b.useState("list"),[J,le]=b.useState(0),[q,Z]=b.useState(!0),G=b.useRef(null),ie=b.useRef(null);b.useEffect(()=>{const H=()=>{z(window.innerWidth<1024)};return H(),window.addEventListener("resize",H),()=>window.removeEventListener("resize",H)},[]),b.useEffect(()=>{ee(i?"detail":"list")},[i]),b.useImperativeHandle(e,()=>({focusSearch:()=>{T(!0),setTimeout(()=>{O.current&&O.current.focus()},0)},blurSearch:()=>{E(""),T(!1),O.current&&O.current.blur()}})),b.useEffect(()=>{w&&O.current&&O.current.focus()},[w]);const te=b.useCallback(()=>{y.trim()||T(!1)},[y]),P=b.useMemo(()=>{if(!y)return t;const H=y.toLowerCase();return t.filter(W=>W.name.toLowerCase().includes(H)||W.description?.toLowerCase().includes(H)||W.uri.toLowerCase().includes(H))},[t,y]),B=b.useCallback(async H=>{if(s(H),a){v(!0);const W=Date.now();try{const X=await n(H.uri);er.getInstance().capture(new EU({resourceUri:H.uri,serverId:r,success:!0})).catch(()=>{}),p({uri:H.uri,result:X,timestamp:W,resourceAnnotations:H.annotations})}catch(X){er.getInstance().capture(new EU({resourceUri:H.uri,serverId:r,success:!1,error:X instanceof Error?X.message:"Unknown error"})).catch(()=>{}),p({uri:H.uri,result:null,error:X instanceof Error?X.message:"Unknown error",timestamp:W,resourceAnnotations:H.annotations})}finally{v(!1)}}},[n,r,a]);b.useEffect(()=>{N(-1)},[y,x]),b.useEffect(()=>{const H=W=>{const X=W.target;if(X.tagName==="INPUT"||X.tagName==="TEXTAREA"||X.contentEditable==="true"||W.metaKey||W.ctrlKey||W.altKey)return;const ue=P;if(W.key==="ArrowDown")W.preventDefault(),N(Y=>{const Q=Y+1;return Q>=ue.length?0:Q});else if(W.key==="ArrowUp")W.preventDefault(),N(Y=>{const Q=Y-1;return Q<0?ue.length-1:Q});else if(W.key==="Enter"&&k>=0){W.preventDefault();const Y=P[k];Y&&B(Y)}};return document.addEventListener("keydown",H),()=>document.removeEventListener("keydown",H)},[k,P,B]),b.useEffect(()=>{if(k>=0){const H=`resource-${P[k]?.uri}`,W=document.getElementById(H);W&&W.scrollIntoView({behavior:"smooth",block:"nearest"})}},[k,P]),b.useEffect(()=>{if(c&&t.length>0){const H=t.find(W=>W.uri===c);H&&i?.uri!==H.uri&&(u(null),setTimeout(()=>{B(H);const W=document.getElementById(`resource-${H.uri}`);W&&W.scrollIntoView({behavior:"smooth",block:"nearest"})},100))}},[c,t,i,B,u]);const j=b.useCallback(async()=>{if(d)try{await navigator.clipboard.writeText(JSON.stringify(d.result,null,2)),C(!0),setTimeout(()=>C(!1),2e3)}catch(H){console.error("[ResourcesTab] Failed to copy result:",H)}},[d]),$=b.useCallback(()=>{if(d)try{const H=new globalThis.Blob([JSON.stringify(d.result,null,2)],{type:"application/json"}),W=URL.createObjectURL(H),X=document.createElement("a");X.href=W,X.download=`resource-${Date.now()}.json`,document.body.appendChild(X),X.click(),document.body.removeChild(X),URL.revokeObjectURL(W)}catch(H){console.error("[ResourcesTab] Failed to download result:",H)}},[d]),U=b.useCallback(async()=>{if(L.current)try{document.fullscreenElement?await document.exitFullscreen():await L.current.requestFullscreen()}catch(H){console.error("[ResourcesTab] Failed to toggle fullscreen:",H)}},[]);return F?m.jsxs("div",{className:"h-full flex flex-col overflow-hidden relative bg-background",children:[K!=="list"&&m.jsxs("div",{className:"flex items-center gap-2 p-2 border-b shrink-0 bg-background z-10",children:[m.jsx(Be,{variant:"ghost",size:"sm",onClick:()=>{s(null),ee("list")},className:"p-0 h-8 w-8",children:m.jsx(e1,{className:"h-4 w-4"})}),m.jsxs("div",{className:"flex items-center text-sm font-medium",children:[m.jsx("button",{onClick:()=>{s(null),ee("list")},className:"text-muted-foreground hover:text-foreground hover:underline cursor-pointer",children:"Resources"}),K==="detail"&&m.jsxs(m.Fragment,{children:[m.jsx("span",{className:"mx-2 text-muted-foreground",children:"/"}),m.jsx("span",{className:"text-foreground",children:"Content"})]})]})]}),m.jsx("div",{className:"flex-1 relative overflow-hidden",children:m.jsxs(bb,{initial:!1,mode:"popLayout",children:[K==="list"&&m.jsxs(qr.div,{initial:{x:"-100%"},animate:{x:0},exit:{x:"-100%"},transition:{type:"spring",stiffness:300,damping:30},className:"absolute inset-0 flex flex-col bg-background z-0",children:[m.jsx(Mq,{activeTab:x,isSearchExpanded:w,searchQuery:y,filteredResourcesCount:P.length,onSearchExpand:()=>T(!0),onSearchChange:E,onSearchBlur:te,onTabSwitch:()=>{},searchInputRef:O}),m.jsx("div",{className:"flex flex-col h-full",children:m.jsx(Lq,{resources:P,selectedResource:i,onResourceSelect:B,focusedIndex:k})})]},"list"),K==="detail"&&m.jsx(qr.div,{initial:{x:"100%"},animate:{x:0},exit:{x:"100%"},transition:{type:"spring",stiffness:300,damping:30},className:"absolute inset-0 bg-white dark:bg-zinc-900 z-10",children:m.jsx("div",{ref:L,className:"h-full",children:m.jsx($q,{result:d,isLoading:h,previewMode:_,serverId:r,readResource:n,onTogglePreview:()=>S(!_),onCopy:j,onDownload:$,onFullscreen:U,isCopied:A})})},"detail")]})})]}):m.jsxs(ti,{direction:"horizontal",className:"h-full",children:[m.jsx(Vn,{defaultSize:25,children:m.jsxs(ti,{direction:"vertical",className:"h-full border-r dark:border-zinc-700",children:[m.jsx(Vn,{defaultSize:75,minSize:30,children:m.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[m.jsx(Mq,{activeTab:x,isSearchExpanded:w,searchQuery:y,filteredResourcesCount:P.length,onSearchExpand:()=>T(!0),onSearchChange:E,onSearchBlur:te,onTabSwitch:()=>{},searchInputRef:O}),m.jsx(Lq,{resources:P,selectedResource:i,onResourceSelect:B,focusedIndex:k})]})}),m.jsx(lo,{withHandle:!0}),m.jsxs(Vn,{ref:G,defaultSize:0,collapsible:!0,minSize:5,collapsedSize:5,onCollapse:()=>Z(!0),onExpand:()=>Z(!1),className:"flex flex-col border-t dark:border-zinc-700",children:[m.jsxs("div",{className:"group flex items-center justify-between p-3 shrink-0 cursor-pointer hover:bg-muted/50 transition-colors",onClick:H=>{H.preventDefault(),H.stopPropagation(),q?(G.current?.resize(25),Z(!1)):(G.current?.resize(5),Z(!0))},children:[m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx("h3",{className:"text-sm font-medium",children:"RPC Messages"}),J>0&&m.jsx(Hr,{variant:"secondary",className:"bg-zinc-500/20 text-zinc-600 dark:text-zinc-400 border-transparent",children:J}),J>0&&!q&&m.jsx(Be,{variant:"ghost",size:"sm",onClick:H=>{H.preventDefault(),H.stopPropagation(),ie.current?.()},className:"h-6 w-6 p-0",title:"Clear all messages",children:m.jsx(bl,{className:"h-3.5 w-3.5"})})]}),m.jsx(Ol,{className:`h-4 w-4 text-muted-foreground transition-transform ${q?"":"rotate-180"}`})]}),!q&&m.jsx("div",{className:"flex-1 overflow-hidden min-h-0",children:m.jsx(_O,{serverIds:[r],onCountChange:le,onClearRef:ie})})]})]})}),m.jsx(lo,{}),m.jsx(Vn,{defaultSize:50,children:m.jsx(ti,{direction:"vertical",children:m.jsx(Vn,{defaultSize:70,children:m.jsx("div",{ref:L,className:"h-full bg-white dark:bg-zinc-900",children:m.jsx($q,{result:d,isLoading:h,previewMode:_,serverId:r,readResource:n,onTogglePreview:()=>S(!_),onCopy:j,onDownload:$,onFullscreen:U,isCopied:A})})})})})]})}Aee.displayName="ResourcesTab";function jq({savedRequests:e,selectedRequest:t,onLoadRequest:n,onDeleteRequest:r,focusedIndex:a}){if(e.length===0)return m.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[m.jsx(db,{className:"h-12 w-12 text-gray-400 dark:text-gray-600 mb-3"}),m.jsx("p",{className:"text-gray-500 dark:text-gray-400 mb-2",children:"No saved requests yet"}),m.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500",children:"Execute a tool and click Save to store requests"})]});const i=(s,c)=>{s.stopPropagation(),c()};return m.jsx("div",{className:"overflow-y-auto flex-1 border-r dark:border-zinc-700 overscroll-contain",children:e.map((s,c)=>m.jsxs("div",{className:"relative group",children:[m.jsx(Ku,{id:`saved-${s.id}`,isSelected:t?.id===s.id,isFocused:a===c,icon:m.jsx(tv,{className:"h-4 w-4"}),title:s.name,description:s.toolName,metadata:m.jsx("div",{className:"flex flex-col gap-1",children:m.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500",children:new Date(s.savedAt).toLocaleString()})}),onClick:()=>n(s)}),m.jsx("div",{className:"absolute top-1/2 right-2 -translate-y-1/2 opacity-0 group-hover:opacity-100 transition-opacity z-10",children:m.jsxs(ln,{children:[m.jsx(cn,{asChild:!0,children:m.jsx(Be,{variant:"secondary",size:"sm",onClick:u=>i(u,()=>r(s.id)),className:"h-8 w-8 p-0",children:m.jsx(bl,{className:"h-4 w-4"})})}),m.jsx(un,{children:m.jsx("p",{children:"Delete saved request"})})]})})]},s.id))})}function Pq({isOpen:e,requestName:t,defaultPlaceholder:n,onRequestNameChange:r,onSave:a,onCancel:i}){return e?m.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",onClick:i,children:m.jsxs("div",{className:"bg-white dark:bg-zinc-800 rounded-lg p-6 w-[400px] shadow-xl border border-gray-200 dark:border-zinc-700",onClick:s=>s.stopPropagation(),children:[m.jsx("h3",{className:"text-lg font-semibold mb-4 text-gray-900 dark:text-gray-100",children:"Save Request"}),m.jsxs("div",{className:"space-y-4",children:[m.jsxs("div",{children:[m.jsx(yn,{htmlFor:"request-name",children:"Request Name (optional)"}),m.jsx(Hn,{id:"request-name",value:t,onChange:s=>r(s.target.value),placeholder:n,className:"mt-2",onKeyDown:s=>{s.key==="Enter"&&a()},autoFocus:!0})]}),m.jsxs("div",{className:"flex justify-end gap-2",children:[m.jsx(Be,{variant:"outline",onClick:i,children:"Cancel"}),m.jsxs(Be,{onClick:a,children:[m.jsx(a1,{className:"h-4 w-4 mr-2"}),"Save"]})]})]})]})}):null}function Iee(e,t){if(!e?.$ref)return e;const n=e.$ref;if(n.startsWith("#/")){const r=n.substring(2).split("/");let a=t;for(const i of r)if(a&&typeof a=="object"&&i in a)a=a[i];else return console.warn(`Could not resolve $ref: ${n}`),e;return a}return e}function nPe(e,t){if(e.anyOf&&Array.isArray(e.anyOf)){const n=e.anyOf.find(r=>r.type!=="null");if(n)return{...Iee(n,t),nullable:!0}}return e}function rPe(e){return Array.isArray(e.enum)?e.enum:null}function aPe({selectedTool:e,toolArgs:t,onArgChange:n}){const r=e?.inputSchema?.properties||{},a=e?.inputSchema?.required||[];return Object.keys(r).length>0?m.jsx("div",{className:"space-y-4",children:Object.entries(r).map(([s,c])=>{const u=e?.inputSchema||{};let d=nPe(c,u);d=Iee(d,u);const p=rPe(d),h=d.type==="string"&&p!==null,v=d;v.required=a.includes(s);const y=t[s];let E="";return y!=null&&(typeof y=="string"?E=y:typeof y=="object"&&y!==null?E=JSON.stringify(y,null,2):E=String(y)),v.type==="object"||v.type==="array"?m.jsxs("div",{className:"space-y-2",children:[m.jsxs(yn,{htmlFor:s,className:"text-sm font-medium",children:[s,v?.required&&m.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),m.jsx(xb,{id:s,value:E,onChange:_=>n(s,_.target.value),placeholder:v?.description||`Enter ${s}`,className:"min-h-[100px]"}),v?.description&&m.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:v.description})]},s):h&&p?m.jsxs("div",{className:"space-y-2",children:[m.jsxs(yn,{htmlFor:s,className:"text-sm font-medium",children:[s,v.required&&m.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),m.jsxs(Xc,{value:String(t[s]||""),onValueChange:_=>n(s,_),children:[m.jsx(Qc,{id:s,className:"w-full",children:m.jsx(Jc,{placeholder:v.description||"Select an option"})}),m.jsx(eu,{children:p.map((_,S)=>m.jsx(Wa,{value:_,children:v.enumNames?.[S]||_},_))})]}),v.description&&m.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:v.description})]},s):m.jsxs("div",{className:"space-y-2",children:[m.jsxs(yn,{htmlFor:s,className:"text-sm font-medium",children:[s,v?.required&&m.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),m.jsx(Hn,{id:s,value:E,onChange:_=>n(s,_.target.value),placeholder:v?.description||`Enter ${s}`}),v?.description&&m.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:v.description})]},s)})}):m.jsx("div",{className:"flex items-center justify-center h-32 text-gray-500 dark:text-gray-400 text-sm",children:"No parameters required"})}function Uq({selectedTool:e,toolArgs:t,isExecuting:n,isConnected:r,onArgChange:a,onExecute:i,onSave:s}){return b.useEffect(()=>{const c=u=>{(u.metaKey||u.ctrlKey)&&u.key==="Enter"&&e&&!n&&r&&(u.preventDefault(),i())};return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[e,n,r,i]),e?m.jsxs("div",{className:"flex flex-col h-full",children:[m.jsx("div",{className:"flex-shrink-0 p-3 sm:p-5 pt-3 sm:pt-4 pb-4 sm:pr-4",children:m.jsxs("div",{children:[m.jsxs("div",{className:"flex flex-row items-center justify-between mb-0 gap-2",children:[m.jsx("h3",{className:"text-base sm:text-lg font-semibold",children:e.name}),m.jsxs("div",{className:"flex gap-2 flex-shrink-0",children:[m.jsxs(Be,{variant:"outline",onClick:s,disabled:n,size:"sm",className:"lg:size-default gap-2",children:[m.jsx(a1,{className:"h-4 w-4"}),m.jsx("span",{className:"hidden sm:inline",children:"Save"})]}),m.jsx(Be,{onClick:i,disabled:n||!r,size:"sm",className:"lg:size-default pr-1! gap-0",children:n?m.jsxs(m.Fragment,{children:[m.jsx(vo,{className:"mr-2"}),m.jsx("span",{className:"hidden sm:inline",children:"Executing..."})]}):m.jsxs(m.Fragment,{children:[m.jsx(FY,{className:"h-4 w-4 sm:mr-2"}),m.jsx("span",{className:"hidden sm:inline",children:"Execute"}),m.jsx("span",{className:"hidden sm:inline text-[12px] border text-zinc-300 p-1 rounded-full border-zinc-300 dark:text-zinc-600 dark:border-zinc-500 ml-2",children:"⌘↵"})]})})]})]}),e.description&&m.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 leading-relaxed mt-2",children:e.description})]})}),m.jsx("div",{className:"flex-1 overflow-y-auto px-3 sm:px-6 pb-4 pr-3",children:m.jsx(aPe,{selectedTool:e,toolArgs:t,onArgChange:a})})]}):m.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[m.jsx("p",{className:"text-gray-500 dark:text-gray-400 mb-2",children:"Select a tool to get started"}),m.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500",children:"Choose a tool from the list to view its details and execute it"})]})}function zq(e){const n=Date.now()-e,r=Math.floor(n/1e3),a=Math.floor(r/60),i=Math.floor(a/60),s=Math.floor(i/24);return r<10?"now":r<60?`${r}s ago`:a<60?`${a}m ago`:i<24?`${i}h ago`:`${s}d ago`}function iPe(e){try{return JSON.parse(e),!0}catch{return!1}}function oPe({content:e}){return!Array.isArray(e)||e.length===0?m.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:"No content"}):m.jsx("div",{className:"space-y-4",children:e.map((t,n)=>{if(t.type==="text"){const r=t.text||"";if(iPe(r))try{const a=JSON.parse(r);return m.jsxs("div",{className:"space-y-2",children:[m.jsx("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:"Text Content (JSON)"}),m.jsx(Zn,{data:a,filename:`content-${n}.json`})]},n)}catch{}return m.jsxs("div",{className:"space-y-2",children:[m.jsx("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:"Text Content"}),m.jsx("div",{className:"bg-gray-50 dark:bg-zinc-900 rounded-lg p-3 font-mono text-sm whitespace-pre-wrap break-words",children:r})]},n)}if(t.type==="image")return m.jsxs("div",{className:"space-y-2",children:[m.jsx("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:"Image Content"}),m.jsxs("div",{className:"bg-gray-50 dark:bg-zinc-900 rounded-lg p-3",children:[m.jsx("img",{src:`data:${t.mimeType||"image/png"};base64,${t.data}`,alt:"Result",className:"max-w-full rounded"}),t.annotations&&m.jsx("div",{className:"mt-2 text-xs text-gray-500 dark:text-gray-400",children:m.jsx(Zn,{data:t.annotations,filename:`image-annotations-${n}.json`})})]})]},n);if(t.type==="audio")return m.jsxs("div",{className:"space-y-2",children:[m.jsx("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:"Audio Content"}),m.jsxs("div",{className:"bg-gray-50 dark:bg-zinc-900 rounded-lg p-3",children:[m.jsx("audio",{controls:!0,src:`data:${t.mimeType||"audio/wav"};base64,${t.data}`,className:"w-full"}),t.annotations&&m.jsx("div",{className:"mt-2 text-xs text-gray-500 dark:text-gray-400",children:m.jsx(Zn,{data:t.annotations,filename:`audio-annotations-${n}.json`})})]})]},n);if(t.type==="resource_link")return m.jsxs("div",{className:"space-y-2",children:[m.jsx("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:"Resource Link"}),m.jsxs("div",{className:"bg-gray-50 dark:bg-zinc-900 rounded-lg p-3 space-y-2",children:[m.jsxs("div",{className:"font-mono text-sm break-all",children:[m.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:"URI:"})," ",t.uri]}),t.name&&m.jsxs("div",{className:"text-sm",children:[m.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:"Name:"})," ",t.name]}),t.description&&m.jsxs("div",{className:"text-sm",children:[m.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:"Description:"})," ",t.description]}),t.mimeType&&m.jsxs("div",{className:"text-sm",children:[m.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:"MIME Type:"})," ",t.mimeType]}),t.annotations&&m.jsxs("div",{className:"mt-2",children:[m.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:"Annotations:"}),m.jsx(Zn,{data:t.annotations,filename:`resource-link-annotations-${n}.json`})]})]})]},n);if(t.type==="resource"){const r=t.resource||{};return m.jsxs("div",{className:"space-y-2",children:[m.jsx("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:"Embedded Resource"}),m.jsxs("div",{className:"bg-gray-50 dark:bg-zinc-900 rounded-lg p-3 space-y-2",children:[m.jsxs("div",{className:"font-mono text-sm break-all",children:[m.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:"URI:"})," ",r.uri]}),r.mimeType&&m.jsxs("div",{className:"text-sm",children:[m.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:"MIME Type:"})," ",r.mimeType]}),r.text&&m.jsxs("div",{children:[m.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:"Content:"}),m.jsx("div",{className:"bg-white dark:bg-black rounded p-2 font-mono text-sm whitespace-pre-wrap break-words max-h-60 overflow-y-auto",children:r.text})]}),r.blob&&m.jsxs("div",{className:"text-sm text-gray-600 dark:text-gray-400",children:["[Binary content: ",r.blob.length||0," bytes]"]}),r.annotations&&m.jsxs("div",{className:"mt-2",children:[m.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:"Annotations:"}),m.jsx(Zn,{data:r.annotations,filename:`resource-annotations-${n}.json`})]})]})]},n)}return m.jsxs("div",{className:"space-y-2",children:[m.jsxs("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:["Unknown Content Type: ",t.type||"N/A"]}),m.jsx(Zn,{data:t,filename:`content-${n}.json`})]},n)})})}function Fq({results:e,copiedResult:t,previewMode:n,serverId:r,readResource:a,onCopy:i,onTogglePreview:s,onMaximize:c,isMaximized:u=!1}){const[d,p]=b.useState(0),[h,v]=b.useState(""),[y,E]=b.useState(!0),x=e[0],_=x?e.filter(J=>J.toolName===x.toolName):[],S=_[d]||_[0],w=e.findIndex(J=>J===S);b.useEffect(()=>{_.length>0&&d>=_.length&&p(0)},[_.length,d]),b.useEffect(()=>{const J=()=>{S&&v(zq(S.timestamp))};J();const le=setInterval(J,1e3);return()=>clearInterval(le)},[S]);const T=b.useMemo(()=>S?.args,[S?.timestamp,d]),k=b.useMemo(()=>S?.result,[S?.timestamp,d]),N=b.useCallback(J=>a(J),[a]);if(e.length===0)return m.jsx("div",{className:"flex flex-col h-full bg-white dark:bg-black border-t dark:border-zinc-700",children:m.jsx("div",{className:"flex-1 overflow-y-auto h-full",children:m.jsx("div",{className:"flex items-center justify-center h-full",children:m.jsx("div",{className:"text-center",children:m.jsx(ob,{vertical:!0,noBorder:!0,message:"No Results yet"})})})})});const A=S.toolMeta?.["openai/outputTemplate"],C=!!(A&&typeof A=="string"&&S.appsSdkResource),O=A,L=S.result?.content||[],F=L.filter(J=>J.type==="resource"&&ru(J.resource)),z=F.length>0,K=!!(L&&L.length>0||S.result?.structuredContent),ee=!z&&!C&&K;return m.jsx("div",{className:"flex flex-col h-full bg-white dark:bg-black border-t dark:border-zinc-700",children:m.jsx("div",{className:"flex-1 overflow-y-auto h-full",children:m.jsxs("div",{className:"space-y-0 flex-1 h-full flex flex-col",children:[m.jsxs("div",{className:`flex items-center gap-2 px-4 pt-2 ${z||C||ee?"border-b border-gray-200 dark:border-zinc-600 pb-2":""}`,children:[m.jsx("h3",{className:"text-sm font-medium hidden sm:block",children:"Response"}),S.duration!==void 0&&m.jsxs("div",{className:"hidden sm:flex items-center gap-1",children:[m.jsx(Uf,{className:"h-3 w-3 text-gray-400"}),m.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:[S.duration,"ms"]})]}),C&&m.jsxs("div",{className:"flex items-center gap-4 sm:ml-4",children:[m.jsxs("span",{className:"hidden sm:inline text-xs text-gray-500 dark:text-gray-400",children:["URI: ",O||"No URI"]}),m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx("button",{onClick:()=>s(),className:`text-xs font-medium ${n?"text-black dark:text-white":"text-zinc-500 dark:text-zinc-400"}`,children:"Component"}),m.jsx("span",{className:"text-xs text-zinc-400",children:"|"}),m.jsx("button",{onClick:()=>s(),className:`text-xs font-medium ${n?"text-zinc-500 dark:text-zinc-400":"text-black dark:text-white"}`,children:"Raw JSON"})]})]}),z&&!C&&m.jsxs("div",{className:"flex items-center gap-4 sm:ml-4",children:[m.jsxs("span",{className:"hidden sm:inline text-xs text-gray-500 dark:text-gray-400",children:["URI: ",F[0]?.resource?.uri||"No URI"]}),m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx("button",{onClick:()=>s(),className:`text-xs font-medium ${n?"text-black dark:text-white":"text-zinc-500 dark:text-zinc-400"}`,children:"Preview"}),m.jsx("span",{className:"text-xs text-zinc-400",children:"|"}),m.jsx("button",{onClick:()=>s(),className:`text-xs font-medium ${n?"text-zinc-500 dark:text-zinc-400":"text-black dark:text-white"}`,children:"JSON"})]})]}),ee&&m.jsxs("div",{className:"flex items-center gap-2 sm:ml-4",children:[m.jsx("button",{onClick:()=>E(!0),className:`text-xs font-medium ${y?"text-black dark:text-white":"text-zinc-500 dark:text-zinc-400"}`,children:"Formatted"}),m.jsx("span",{className:"text-xs text-zinc-400",children:"|"}),m.jsx("button",{onClick:()=>E(!1),className:`text-xs font-medium ${y?"text-zinc-500 dark:text-zinc-400":"text-black dark:text-white"}`,children:"Raw"})]}),m.jsxs("div",{className:"ml-auto flex items-center gap-1",children:[(C||z)&&c&&m.jsx(Be,{variant:"ghost",size:"sm",onClick:c,title:u?"Restore":"Maximize",children:u?m.jsx(wSe,{className:"h-4 w-4"}):m.jsx(r1,{className:"h-4 w-4"})}),_.length>1&&m.jsxs(Xc,{value:d.toString(),onValueChange:J=>p(parseInt(J)),children:[m.jsx(Qc,{size:"sm",className:"w-[140px] h-8 text-xs",children:m.jsx(Jc,{children:m.jsxs("div",{className:"flex items-center gap-1",children:[m.jsx(tv,{className:"h-3 w-3"}),m.jsx("span",{children:h})]})})}),m.jsx(eu,{children:_.map((J,le)=>m.jsx(Wa,{value:le.toString(),children:m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx(tv,{className:"h-3 w-3"}),m.jsx("span",{children:zq(J.timestamp)}),m.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",new Date(J.timestamp).toLocaleTimeString(),")"]})]})},le))})]}),m.jsx(Be,{variant:"ghost",size:"sm",onClick:()=>i(w,S.result),children:t===w?m.jsx(Da,{className:"h-4 w-4"}):m.jsx(Br,{className:"h-4 w-4"})})]})]}),S.error?m.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded p-3 mx-4",children:[m.jsx("p",{className:"text-red-800 dark:text-red-300 font-medium",children:"Error:"}),m.jsx("p",{className:"text-red-700 dark:text-red-400 text-sm",children:S.error})]}):(()=>{if(C){const J=S.appsSdkResource;return J.isLoading?m.jsx(m.Fragment,{}):J.error?m.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded p-3 mx-4",children:[m.jsx("p",{className:"text-red-800 dark:text-red-300 font-medium",children:"Resource Error:"}),m.jsx("p",{className:"text-red-700 dark:text-red-400 text-sm",children:J.error})]}):n?m.jsx("div",{className:"flex-1",children:m.jsx(fO,{componentUrl:O,toolName:S.toolName,toolArgs:T,toolResult:k,serverId:r,readResource:N,className:"w-full h-full relative p-4"})}):m.jsx("div",{className:"px-4 pt-4",children:m.jsx(Zn,{data:S.result,filename:`tool-result-${S.toolName}-${Date.now()}.json`})})}if(z)return n?m.jsxs("div",{className:"space-y-0 h-full",children:[F.map((J,le)=>m.jsx("div",{className:"mx-0 size-full",children:m.jsx(Cee,{resource:J.resource,onUIAction:q=>{},className:"w-full h-full relative"})},le)),L.filter(J=>!(J.type==="resource"&&ru(J.resource))).length>0&&m.jsx("div",{className:"px-4",children:m.jsx(Zn,{data:L.filter(J=>!(J.type==="resource"&&ru(J.resource))),filename:`tool-result-${S.toolName}-non-ui-${Date.now()}.json`})})]}):m.jsx("div",{className:"px-4 pt-4",children:m.jsx(Zn,{data:S.result,filename:`tool-result-${S.toolName}-mcp-ui-${Date.now()}.json`})});if(ee&&y){const J=S.result?.structuredContent;return m.jsxs("div",{className:"px-4 pt-4 space-y-4",children:[J&&m.jsxs("div",{className:"space-y-2",children:[m.jsx("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:"Structured Content"}),m.jsx(Zn,{data:J,filename:`structured-content-${S.toolName}-${Date.now()}.json`})]}),L&&L.length>0&&m.jsx(oPe,{content:L}),!J&&(!L||L.length===0)&&m.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:"No content to display"})]})}return m.jsx("div",{className:"px-4 pt-4",children:m.jsx(Zn,{data:S.result,filename:`tool-result-${S.toolName}-${Date.now()}.json`})})})()]})})})}function Bq({tools:e,selectedTool:t,onToolSelect:n,focusedIndex:r}){return e.length===0?m.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[m.jsx(yl,{className:"h-12 w-12 text-gray-400 dark:text-gray-600 mb-3"}),m.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"No tools available"})]}):m.jsx("div",{className:"overflow-y-auto flex-1 overscroll-contain",children:e.map((a,i)=>m.jsx(Ku,{id:`tool-${a.name}`,isSelected:t?.name===a.name,isFocused:r===i,icon:m.jsx(yl,{className:"h-4 w-4"}),title:a.name,description:a.description,metadata:a.inputSchema?.properties&&m.jsxs(Hr,{variant:"outline",className:"text-xs border-gray-300 dark:border-zinc-600 text-gray-600 dark:text-gray-400",children:[Object.keys(a.inputSchema.properties).length," params"]}),onClick:()=>n(a)},a.name))})}function qq({activeTab:e,isSearchExpanded:t,searchQuery:n,filteredToolsCount:r,savedRequestsCount:a,onSearchExpand:i,onSearchChange:s,onSearchBlur:c,onTabSwitch:u,searchInputRef:d}){return m.jsx(Nee,{activeTab:e,isSearchExpanded:t,searchQuery:n,primaryTabName:"tools",secondaryTabName:"saved",primaryTabTitle:"Tools",secondaryTabTitle:"Saved",primaryCount:r,secondaryCount:a,primaryIcon:yl,secondaryIcon:db,searchPlaceholder:"Search tools...",onSearchExpand:i,onSearchChange:s,onSearchBlur:c,onTabSwitch:u,searchInputRef:d})}const Hq="mcp-inspector-saved-requests";function Oee({ref:e,tools:t,callTool:n,readResource:r,serverId:a,isConnected:i}){const[s,c]=b.useState(null),[u,d]=b.useState(null),{selectedToolName:p,setSelectedToolName:h}=Tp(),[v,y]=b.useState({}),[E,x]=b.useState([]),[_,S]=b.useState(!1),[w,T]=b.useState(null),[k,N]=b.useState(""),[A,C]=b.useState("tools"),[O,L]=b.useState([]),[F,z]=b.useState(!1),[K,ee]=b.useState(""),[J,le]=b.useState(!0),[q,Z]=b.useState(!1),[G,ie]=b.useState(-1),te=b.useRef(null),[P,B]=b.useState(!1),[j,$]=b.useState("list"),[U,H]=b.useState(!1),[W,X]=b.useState(0),[de,ue]=b.useState(!0),[Y,Q]=b.useState(void 0),oe=b.useRef(null),ae=b.useRef(null),Re=b.useRef(null),Ae=b.useRef(null),Ye=b.useRef(null);b.useEffect(()=>{const De=()=>{B(window.innerWidth<1024)};return De(),window.addEventListener("resize",De),()=>window.removeEventListener("resize",De)},[]),b.useEffect(()=>{$(s?"detail":"list")},[s]),b.useEffect(()=>{P&&E.length>0&&!_&&$("response")},[E,_,P]),b.useImperativeHandle(e,()=>({focusSearch:()=>{Z(!0),setTimeout(()=>{te.current&&te.current.focus()},0)},blurSearch:()=>{N(""),Z(!1),te.current&&te.current.blur()}})),b.useEffect(()=>{try{const De=localStorage.getItem(Hq);De&&L(JSON.parse(De))}catch(De){console.error("[ToolsTab] Failed to load saved requests:",De)}},[]);const Ee=b.useCallback(De=>{try{localStorage.setItem(Hq,JSON.stringify(De)),L(De)}catch(ke){console.error("[ToolsTab] Failed to save requests:",ke)}},[]),Ne=b.useMemo(()=>{if(!k.trim())return t;const De=k.toLowerCase();return t.filter(ke=>ke.name.toLowerCase().includes(De)||ke.description?.toLowerCase().includes(De))},[t,k]),ze=b.useCallback(De=>{c(De);const ke={};De.inputSchema?.properties&&Object.entries(De.inputSchema.properties).forEach(([Fe,vt])=>{const gt=vt;gt.default!==void 0?ke[Fe]=gt.default:gt.type==="string"?ke[Fe]="":gt.type==="number"?ke[Fe]=0:gt.type==="boolean"?ke[Fe]=!1:gt.type==="array"?ke[Fe]="[]":gt.type==="object"&&(ke[Fe]="{}")}),y(ke)},[]),he=b.useCallback(De=>{const ke=t.find(Fe=>Fe.name===De.toolName);ke&&(c(ke),y(De.args),d(De))},[t]);b.useEffect(()=>{q&&te.current&&te.current.focus()},[q]);const je=b.useCallback(()=>{k.trim()||Z(!1)},[k]);b.useEffect(()=>{A!=="tools"&&Z(!1)},[A]),b.useEffect(()=>{ie(-1)},[k,A]),b.useEffect(()=>{const De=ke=>{const Fe=ke.target;if(Fe.tagName==="INPUT"||Fe.tagName==="TEXTAREA"||Fe.contentEditable==="true"||ke.metaKey||ke.ctrlKey||ke.altKey)return;const gt=A==="tools"?Ne:O;if(ke.key==="ArrowDown")ke.preventDefault(),ie(Lt=>{const qt=Lt+1;return qt>=gt.length?0:qt});else if(ke.key==="ArrowUp")ke.preventDefault(),ie(Lt=>{const qt=Lt-1;return qt<0?gt.length-1:qt});else if(ke.key==="Enter"&&G>=0)if(ke.preventDefault(),A==="tools"){const Lt=Ne[G];Lt&&ze(Lt)}else{const Lt=O[G];Lt&&he(Lt)}};return document.addEventListener("keydown",De),()=>document.removeEventListener("keydown",De)},[G,Ne,O,A,ze,he]),b.useEffect(()=>{if(G>=0){const De=A==="tools"?`tool-${Ne[G]?.name}`:`saved-${O[G]?.id}`,ke=document.getElementById(De);ke&&ke.scrollIntoView({behavior:"smooth",block:"nearest"})}},[G,Ne,O,A]),b.useEffect(()=>{if(p&&t.length>0){const De=t.find(ke=>ke.name===p);if(De&&s?.name!==De.name){h(null);const ke=setTimeout(()=>{ze(De);const Fe=document.getElementById(`tool-${De.name}`);Fe&&Fe.scrollIntoView({behavior:"smooth",block:"nearest"})},100);return()=>clearTimeout(ke)}}},[p,t,s,ze,h]);const Ze=b.useCallback((De,ke)=>{y(Fe=>{const vt={...Fe};if(s?.inputSchema?.properties?.[De]){const Lt=s.inputSchema.properties[De].type;if(Lt==="object"||Lt==="array")vt[De]=ke;else if(Lt==="string")vt[De]=ke;else try{vt[De]=JSON.parse(ke)}catch{vt[De]=ke}}else vt[De]=ke;return vt})},[s]),Se=b.useCallback(async()=>{if(!s||_)return;S(!0);const De=Date.now();try{const ke={...v};s.inputSchema?.properties&&Object.entries(s.inputSchema.properties).forEach(([Pt,pn])=>{const en=pn.type,ct=ke[Pt];if((en==="object"||en==="array")&&typeof ct=="string")try{ke[Pt]=JSON.parse(ct)}catch{}});const Fe=await n(s.name,ke,{timeout:6e5,resetTimeoutOnProgress:!0}),vt=Date.now()-De;er.getInstance().capture(new SU({toolName:s.name,serverId:a,success:!0,duration:vt})).catch(()=>{});const Lt=s?._meta||s?.metadata,qt=Lt?.["openai/outputTemplate"];let Ct;if(qt&&typeof qt=="string"){const Pt={toolName:s.name,args:v,result:Fe,timestamp:De,duration:vt,toolMeta:Lt,appsSdkResource:{uri:qt,resourceData:null,isLoading:!0}};x([Pt]);try{const pn=await r(qt);let Rn=null;if(Fe?.structuredContent)Rn=Fe.structuredContent;else if(Array.isArray(Fe)&&Fe[0]){const en=Fe[0];en.output?.value?.structuredContent?Rn=en.output.value.structuredContent:en.structuredContent?Rn=en.structuredContent:en.output?.value&&(Rn=en.output.value)}Rn||(Rn=Fe),Ct={uri:qt,resourceData:{...pn,structuredContent:Rn},isLoading:!1}}catch(pn){Ct={uri:qt,resourceData:null,isLoading:!1,error:pn instanceof Error?pn.message:String(pn)}}x(pn=>pn.map((Rn,en)=>en===0?{...Rn,appsSdkResource:Ct}:Rn))}else x(Pt=>[{toolName:s.name,args:v,result:Fe,timestamp:De,duration:vt,toolMeta:Lt},...Pt])}catch(ke){const Fe=Date.now()-De;er.getInstance().capture(new SU({toolName:s.name,serverId:a,success:!1,duration:Fe,error:ke instanceof Error?ke.message:String(ke)})).catch(()=>{});const gt=s?._meta||s?.metadata,Lt={toolName:s.name,args:v,result:null,error:ke instanceof Error?ke.message:String(ke),timestamp:De,duration:Fe,toolMeta:gt},qt=gt?.["openai/outputTemplate"];x(qt?[Lt]:Ct=>[Lt,...Ct])}finally{S(!1)}},[s,v,_,n,r,a]),ot=b.useCallback(async(De,ke)=>{try{await navigator.clipboard.writeText(JSON.stringify(ke,null,2)),T(De),setTimeout(()=>T(null),2e3)}catch(Fe){console.error("[ToolsTab] Failed to copy result:",Fe)}},[]),ut=b.useCallback(De=>{x(ke=>ke.filter((Fe,vt)=>vt!==De))},[]),tt=b.useCallback(De=>{const ke=E[De];if(ke){const Fe=window.open("","_blank","width=800,height=600");Fe&&(Fe.document.write(`
|
|
1615
1615
|
<html>
|
|
1616
1616
|
<head>
|
|
1617
1617
|
<title>${ke.toolName} Result</title>
|