@mcp-use/inspector 0.6.0-canary.2 → 0.6.0
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/{chunk-VL2OQCWN-BbZniIH7.js → chunk-VL2OQCWN-Bic-rB6T.js} +1 -1
- package/dist/client/assets/display-LIYVTGEU-BHRqqKvX.js +30 -0
- package/dist/client/assets/{embeddings-Bx8BP3CQ.js → embeddings-lLuDNyJW.js} +1 -1
- package/dist/client/assets/{index-Chn4_RxU.js → index-BR6cKw0d.js} +6 -6
- package/dist/client/assets/{index-BnZFQrhz.js → index-BwqAJmU6.js} +1 -1
- package/dist/client/assets/{index-BaWyJ7tn.js → index-CTMpeTG-.js} +1 -1
- package/dist/client/assets/{index-BU8ICj9I.js → index-D3r30E5x.js} +1 -1
- package/dist/client/assets/{index-PDBWFN_o.js → index-D6du61WF.js} +1 -1
- package/dist/client/assets/{index-Dw0l9952.js → index-UA3z-V5S.js} +1 -1
- package/dist/client/assets/{index-BSl6rYpG.js → index-xRISKm6b.js} +1 -1
- package/dist/client/assets/{langfuse-C4HKZ3NL-BATVIff_.js → langfuse-C4HKZ3NL-Dbzphj3a.js} +62 -60
- package/dist/client/assets/{winston-Dl8CQEx4.js → winston-Cw4A3I6l.js} +1 -1
- package/dist/client/index.html +2 -2
- package/package.json +2 -2
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/winston-
|
|
2
|
-
var G6=Object.defineProperty;var W6=(t,e,r)=>e in t?G6(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var bp=(t,e,r)=>W6(t,typeof e!="symbol"?e+"":e,r);function Y6(t,e){for(var r=0;r<e.length;r++){const n=e[r];if(typeof n!="string"&&!Array.isArray(n)){for(const a in n)if(a!=="default"&&!(a in t)){const s=Object.getOwnPropertyDescriptor(n,a);s&&Object.defineProperty(t,a,s.get?s:{enumerable:!0,get:()=>n[a]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))n(a);new MutationObserver(a=>{for(const s of a)if(s.type==="childList")for(const l of s.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&n(l)}).observe(document,{childList:!0,subtree:!0});function r(a){const s={};return a.integrity&&(s.integrity=a.integrity),a.referrerPolicy&&(s.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?s.credentials="include":a.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function n(a){if(a.ep)return;a.ep=!0;const s=r(a);fetch(a.href,s)}})();function hc(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function NEe(t){if(Object.prototype.hasOwnProperty.call(t,"__esModule"))return t;var e=t.default;if(typeof e=="function"){var r=function n(){var a=!1;try{a=this instanceof n}catch{}return a?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach(function(n){var a=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(r,n,a.get?a:{enumerable:!0,get:function(){return t[n]}})}),r}var $v={exports:{}},yu={};var Qk;function K6(){if(Qk)return yu;Qk=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function r(n,a,s){var l=null;if(s!==void 0&&(l=""+s),a.key!==void 0&&(l=""+a.key),"key"in a){s={};for(var c in a)c!=="key"&&(s[c]=a[c])}else s=a;return a=s.ref,{$$typeof:t,type:n,key:l,ref:a!==void 0?a:null,props:s}}return yu.Fragment=e,yu.jsx=r,yu.jsxs=r,yu}var Jk;function Z6(){return Jk||(Jk=1,$v.exports=K6()),$v.exports}var p=Z6();const X6="modulepreload",Q6=function(t){return"/inspector/"+t},eI={},ds=function(e,r,n){let a=Promise.resolve();if(r&&r.length>0){let d=function(f){return Promise.all(f.map(h=>Promise.resolve(h).then(g=>({status:"fulfilled",value:g}),g=>({status:"rejected",reason:g}))))};document.getElementsByTagName("link");const l=document.querySelector("meta[property=csp-nonce]"),c=l?.nonce||l?.getAttribute("nonce");a=d(r.map(f=>{if(f=Q6(f),f in eI)return;eI[f]=!0;const h=f.endsWith(".css"),g=h?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${f}"]${g}`))return;const v=document.createElement("link");if(v.rel=h?"stylesheet":X6,h||(v.as="script"),v.crossOrigin="",v.href=f,c&&v.setAttribute("nonce",c),document.head.appendChild(v),h)return new Promise((y,w)=>{v.addEventListener("load",y),v.addEventListener("error",()=>w(new Error(`Unable to preload CSS for ${f}`)))})}))}function s(l){const c=new Event("vite:preloadError",{cancelable:!0});if(c.payload=l,window.dispatchEvent(c),!c.defaultPrevented)throw l}return a.then(l=>{for(const c of l||[])c.status==="rejected"&&s(c.reason);return e().catch(s)})};var J6=Object.defineProperty,Qe=(t,e)=>J6(t,"name",{value:e,configurable:!0}),tI=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,r)=>(typeof require<"u"?require:e)[r]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')}),El={};async function jz(){if(typeof process<"u")try{const t=await ds(()=>import("./__vite-browser-external-DFygW7-s.js").then(r=>r.o),[]),e=await ds(()=>import("./path-C9FudP8b.js").then(r=>r.p),[]);return{fs:t.default,path:e.default}}catch{return{fs:null,path:null}}return{fs:null,path:null}}Qe(jz,"getNodeModules");var jn=null;function Uz(){if(typeof tI<"u")try{jn=tI("winston")}catch{}}Qe(Uz,"loadWinstonSync");async function Fz(){return jn||(jn=await ds(()=>import("./winston-Dl8CQEx4.js").then(t=>t.w),__vite__mapDeps([0,1,2,3]))),jn}Qe(Fz,"getWinston");var E_="mcp-use";function am(){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}}Qe(am,"isNodeJSEnvironment");var Yl,e9=(Yl=class{_level;name;constructor(e=E_,r="info"){this.name=e,this._level=r}shouldLog(e){const r=["error","warn","info","http","verbose","debug","silly"],n=r.indexOf(this._level);return r.indexOf(e)<=n}formatMessage(e,r){return`${new Date().toLocaleTimeString("en-US",{hour12:!1})} [${this.name}] ${e}: ${r}`}error(e){this.shouldLog("error")&&console.error(this.formatMessage("error",e))}warn(e){this.shouldLog("warn")&&console.warn(this.formatMessage("warn",e))}info(e){this.shouldLog("info")&&console.info(this.formatMessage("info",e))}debug(e){this.shouldLog("debug")&&console.debug(this.formatMessage("debug",e))}http(e){this.shouldLog("http")&&console.log(this.formatMessage("http",e))}verbose(e){this.shouldLog("verbose")&&console.log(this.formatMessage("verbose",e))}silly(e){this.shouldLog("silly")&&console.log(this.formatMessage("silly",e))}get level(){return this._level}set level(e){this._level=e}},Qe(Yl,"SimpleConsoleLogger"),Yl);function Fp(t){switch((typeof process<"u"&&El?t:void 0)?.trim()){case"2":return"debug";case"1":return"info";default:return"info"}}Qe(Fp,"resolveLevel");var _o,zz=(_o=class{static get(e=E_){if(!am()){if(!this.simpleInstances[e]){const r=typeof process<"u"&&El?.DEBUG||void 0;this.simpleInstances[e]=new e9(e,Fp(r))}return this.simpleInstances[e]}if(!this.instances[e]){if(!jn)throw new Error("Winston not loaded - call Logger.configure() first");const{createLogger:r,format:n}=jn,{combine:a,timestamp:s,label:l,colorize:c,splat:d}=n;this.instances[e]=r({level:Fp(El.DEBUG),format:a(c(),d(),l({label:e}),s({format:"HH:mm:ss"}),this.getFormatter()),transports:[]})}return this.instances[e]}static getFormatter(){if(!jn)throw new Error("Winston not loaded");const{format:e}=jn,{printf:r}=e,n=r(({level:l,message:c,label:d,timestamp:f})=>`${f} [${d}] ${l}: ${c}`),a=r(({level:l,message:c,label:d,timestamp:f})=>`${f} [${d}] ${l.toUpperCase()}: ${c}`),s=r(({level:l,message:c,label:d,timestamp:f})=>`${f} [${d}] ${l.toUpperCase()}: ${c}`);switch(this.currentFormat){case"minimal":return n;case"detailed":return a;case"emoji":return s;default:return n}}static async configure(e={}){const{level:r,console:n=!0,file:a,format:s="minimal"}=e,l=typeof process<"u"&&El?.DEBUG||void 0,c=r??Fp(l);if(this.currentFormat=s,!am()){Object.values(this.simpleInstances).forEach(T=>{T.level=c});return}if(await Fz(),!jn)throw new Error("Failed to load winston");const d=this.get();d.level=c;const f=d;if(f.clear(),n&&f.add(new jn.transports.Console),a){const{fs:T,path:x}=await jz();if(T&&x){const _=x.dirname(x.resolve(a));T.existsSync(_)||T.mkdirSync(_,{recursive:!0}),f.add(new jn.transports.File({filename:a}))}}const{format:h}=jn,{combine:g,timestamp:v,label:y,colorize:w,splat:S}=h;Object.values(this.instances).forEach(T=>{T&&"format"in T&&(T.level=c,T.format=g(w(),S(),y({label:E_}),v({format:"HH:mm:ss"}),this.getFormatter()))})}static setDebug(e){let r;e===2||e===!0?r="debug":r="info",Object.values(this.simpleInstances).forEach(n=>{n.level=r}),Object.values(this.instances).forEach(n=>{n&&(n.level=r)}),typeof process<"u"&&El&&(El.DEBUG=e?e===!0?"2":String(e):"0")}static setFormat(e){this.currentFormat=e,this.configure({format:e})}},Qe(_o,"Logger"),bp(_o,"instances",{}),bp(_o,"simpleInstances",{}),bp(_o,"currentFormat","minimal"),_o);am()&&(Uz(),jn&&zz.configure());var Me=zz.get(),Nt;(function(t){t.assertEqual=a=>{};function e(a){}t.assertIs=e;function r(a){throw new Error}t.assertNever=r,t.arrayToEnum=a=>{const s={};for(const l of a)s[l]=l;return s},t.getValidEnumValues=a=>{const s=t.objectKeys(a).filter(c=>typeof a[a[c]]!="number"),l={};for(const c of s)l[c]=a[c];return t.objectValues(l)},t.objectValues=a=>t.objectKeys(a).map(function(s){return a[s]}),t.objectKeys=typeof Object.keys=="function"?a=>Object.keys(a):a=>{const s=[];for(const l in a)Object.prototype.hasOwnProperty.call(a,l)&&s.push(l);return s},t.find=(a,s)=>{for(const l of a)if(s(l))return l},t.isInteger=typeof Number.isInteger=="function"?a=>Number.isInteger(a):a=>typeof a=="number"&&Number.isFinite(a)&&Math.floor(a)===a;function n(a,s=" | "){return a.map(l=>typeof l=="string"?`'${l}'`:l).join(s)}t.joinValues=n,t.jsonStringifyReplacer=(a,s)=>typeof s=="bigint"?s.toString():s})(Nt||(Nt={}));var rI;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(rI||(rI={}));const qe=Nt.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),yi=t=>{switch(typeof t){case"undefined":return qe.undefined;case"string":return qe.string;case"number":return Number.isNaN(t)?qe.nan:qe.number;case"boolean":return qe.boolean;case"function":return qe.function;case"bigint":return qe.bigint;case"symbol":return qe.symbol;case"object":return Array.isArray(t)?qe.array:t===null?qe.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?qe.promise:typeof Map<"u"&&t instanceof Map?qe.map:typeof Set<"u"&&t instanceof Set?qe.set:typeof Date<"u"&&t instanceof Date?qe.date:qe.object;default:return qe.unknown}},Ie=Nt.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class oa extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};const r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){const r=e||function(s){return s.message},n={_errors:[]},a=s=>{for(const l of s.issues)if(l.code==="invalid_union")l.unionErrors.map(a);else if(l.code==="invalid_return_type")a(l.returnTypeError);else if(l.code==="invalid_arguments")a(l.argumentsError);else if(l.path.length===0)n._errors.push(r(l));else{let c=n,d=0;for(;d<l.path.length;){const f=l.path[d];d===l.path.length-1?(c[f]=c[f]||{_errors:[]},c[f]._errors.push(r(l))):c[f]=c[f]||{_errors:[]},c=c[f],d++}}};return a(this),n}static assert(e){if(!(e instanceof oa))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Nt.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){const r={},n=[];for(const a of this.issues)if(a.path.length>0){const s=a.path[0];r[s]=r[s]||[],r[s].push(e(a))}else n.push(e(a));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}}oa.create=t=>new oa(t);const ld=(t,e)=>{let r;switch(t.code){case Ie.invalid_type:t.received===qe.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case Ie.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,Nt.jsonStringifyReplacer)}`;break;case Ie.unrecognized_keys:r=`Unrecognized key(s) in object: ${Nt.joinValues(t.keys,", ")}`;break;case Ie.invalid_union:r="Invalid input";break;case Ie.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Nt.joinValues(t.options)}`;break;case Ie.invalid_enum_value:r=`Invalid enum value. Expected ${Nt.joinValues(t.options)}, received '${t.received}'`;break;case Ie.invalid_arguments:r="Invalid function arguments";break;case Ie.invalid_return_type:r="Invalid function return type";break;case Ie.invalid_date:r="Invalid date";break;case Ie.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:Nt.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case Ie.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case Ie.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case Ie.custom:r="Invalid input";break;case Ie.invalid_intersection_types:r="Intersection results could not be merged";break;case Ie.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case Ie.not_finite:r="Number must be finite";break;default:r=e.defaultError,Nt.assertNever(t)}return{message:r}};let t9=ld;function S_(){return t9}const x_=t=>{const{data:e,path:r,errorMaps:n,issueData:a}=t,s=[...r,...a.path||[]],l={...a,path:s};if(a.message!==void 0)return{...a,path:s,message:a.message};let c="";const d=n.filter(f=>!!f).slice().reverse();for(const f of d)c=f(l,{data:e,defaultError:c}).message;return{...a,path:s,message:c}};function Fe(t,e){const r=S_(),n=x_({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===ld?void 0:ld].filter(a=>!!a)});t.common.issues.push(n)}class un{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){const n=[];for(const a of r){if(a.status==="aborted")return it;a.status==="dirty"&&e.dirty(),n.push(a.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){const n=[];for(const a of r){const s=await a.key,l=await a.value;n.push({key:s,value:l})}return un.mergeObjectSync(e,n)}static mergeObjectSync(e,r){const n={};for(const a of r){const{key:s,value:l}=a;if(s.status==="aborted"||l.status==="aborted")return it;s.status==="dirty"&&e.dirty(),l.status==="dirty"&&e.dirty(),s.value!=="__proto__"&&(typeof l.value<"u"||a.alwaysSet)&&(n[s.value]=l.value)}return{status:e.value,value:n}}}const it=Object.freeze({status:"aborted"}),Cu=t=>({status:"dirty",value:t}),Tn=t=>({status:"valid",value:t}),nI=t=>t.status==="aborted",aI=t=>t.status==="dirty",oc=t=>t.status==="valid",om=t=>typeof Promise<"u"&&t instanceof Promise;var tt;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(tt||(tt={}));class Ha{constructor(e,r,n,a){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=a}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const oI=(t,e)=>{if(oc(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const r=new oa(t.common.issues);return this._error=r,this._error}}};function pt(t){if(!t)return{};const{errorMap:e,invalid_type_error:r,required_error:n,description:a}=t;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:a}:{errorMap:(l,c)=>{const{message:d}=t;return l.code==="invalid_enum_value"?{message:d??c.defaultError}:typeof c.data>"u"?{message:d??n??c.defaultError}:l.code!=="invalid_type"?{message:c.defaultError}:{message:d??r??c.defaultError}},description:a}}class _t{get description(){return this._def.description}_getType(e){return yi(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:yi(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new un,ctx:{common:e.parent.common,data:e.data,parsedType:yi(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const r=this._parse(e);if(om(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){const r=this._parse(e);return Promise.resolve(r)}parse(e,r){const n=this.safeParse(e,r);if(n.success)return n.data;throw n.error}safeParse(e,r){const n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:yi(e)},a=this._parseSync({data:e,path:n.path,parent:n});return oI(n,a)}"~validate"(e){const r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:yi(e)};if(!this["~standard"].async)try{const n=this._parseSync({data:e,path:[],parent:r});return oc(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(n=>oc(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(e,r){const n=await this.safeParseAsync(e,r);if(n.success)return n.data;throw n.error}async safeParseAsync(e,r){const n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:yi(e)},a=this._parse({data:e,path:n.path,parent:n}),s=await(om(a)?a:Promise.resolve(a));return oI(n,s)}refine(e,r){const n=a=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(a):r;return this._refinement((a,s)=>{const l=e(a),c=()=>s.addIssue({code:Ie.custom,...n(a)});return typeof Promise<"u"&&l instanceof Promise?l.then(d=>d?!0:(c(),!1)):l?!0:(c(),!1)})}refinement(e,r){return this._refinement((n,a)=>e(n)?!0:(a.addIssue(typeof r=="function"?r(n,a):r),!1))}_refinement(e){return new xs({schema:this,typeName:ct.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return Ao.create(this,this._def)}nullable(){return ws.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return za.create(this)}promise(){return fd.create(this,this._def)}or(e){return cm.create([this,e],this._def)}and(e){return um.create(this,e,this._def)}transform(e){return new xs({...pt(this._def),schema:this,typeName:ct.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const r=typeof e=="function"?e:()=>e;return new pm({...pt(this._def),innerType:this,defaultValue:r,typeName:ct.ZodDefault})}brand(){return new Hz({typeName:ct.ZodBranded,type:this,...pt(this._def)})}catch(e){const r=typeof e=="function"?e:()=>e;return new mm({...pt(this._def),innerType:this,catchValue:r,typeName:ct.ZodCatch})}describe(e){const r=this.constructor;return new r({...this._def,description:e})}pipe(e){return nR.create(this,e)}readonly(){return hm.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const r9=/^c[^\s-]{8,}$/i,n9=/^[0-9a-z]+$/,a9=/^[0-9A-HJKMNP-TV-Z]{26}$/i,o9=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,i9=/^[a-z0-9_-]{21}$/i,s9=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,l9=/^[-+]?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)?)??$/,c9=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,u9="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Bv;const d9=/^(?:(?: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])$/,f9=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,p9=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,m9=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,h9=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,g9=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,$z="((\\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])))",v9=new RegExp(`^${$z}$`);function Bz(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);const r=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function b9(t){return new RegExp(`^${Bz(t)}$`)}function y9(t){let e=`${$z}T${Bz(t)}`;const r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function E9(t,e){return!!((e==="v4"||!e)&&d9.test(t)||(e==="v6"||!e)&&p9.test(t))}function S9(t,e){if(!s9.test(t))return!1;try{const[r]=t.split(".");if(!r)return!1;const n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),a=JSON.parse(atob(n));return!(typeof a!="object"||a===null||"typ"in a&&a?.typ!=="JWT"||!a.alg||e&&a.alg!==e)}catch{return!1}}function x9(t,e){return!!((e==="v4"||!e)&&f9.test(t)||(e==="v6"||!e)&&m9.test(t))}class Ro extends _t{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==qe.string){const s=this._getOrReturnCtx(e);return Fe(s,{code:Ie.invalid_type,expected:qe.string,received:s.parsedType}),it}const n=new un;let a;for(const s of this._def.checks)if(s.kind==="min")e.data.length<s.value&&(a=this._getOrReturnCtx(e,a),Fe(a,{code:Ie.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),n.dirty());else if(s.kind==="max")e.data.length>s.value&&(a=this._getOrReturnCtx(e,a),Fe(a,{code:Ie.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),n.dirty());else if(s.kind==="length"){const l=e.data.length>s.value,c=e.data.length<s.value;(l||c)&&(a=this._getOrReturnCtx(e,a),l?Fe(a,{code:Ie.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):c&&Fe(a,{code:Ie.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),n.dirty())}else if(s.kind==="email")c9.test(e.data)||(a=this._getOrReturnCtx(e,a),Fe(a,{validation:"email",code:Ie.invalid_string,message:s.message}),n.dirty());else if(s.kind==="emoji")Bv||(Bv=new RegExp(u9,"u")),Bv.test(e.data)||(a=this._getOrReturnCtx(e,a),Fe(a,{validation:"emoji",code:Ie.invalid_string,message:s.message}),n.dirty());else if(s.kind==="uuid")o9.test(e.data)||(a=this._getOrReturnCtx(e,a),Fe(a,{validation:"uuid",code:Ie.invalid_string,message:s.message}),n.dirty());else if(s.kind==="nanoid")i9.test(e.data)||(a=this._getOrReturnCtx(e,a),Fe(a,{validation:"nanoid",code:Ie.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid")r9.test(e.data)||(a=this._getOrReturnCtx(e,a),Fe(a,{validation:"cuid",code:Ie.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid2")n9.test(e.data)||(a=this._getOrReturnCtx(e,a),Fe(a,{validation:"cuid2",code:Ie.invalid_string,message:s.message}),n.dirty());else if(s.kind==="ulid")a9.test(e.data)||(a=this._getOrReturnCtx(e,a),Fe(a,{validation:"ulid",code:Ie.invalid_string,message:s.message}),n.dirty());else if(s.kind==="url")try{new URL(e.data)}catch{a=this._getOrReturnCtx(e,a),Fe(a,{validation:"url",code:Ie.invalid_string,message:s.message}),n.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(e.data)||(a=this._getOrReturnCtx(e,a),Fe(a,{validation:"regex",code:Ie.invalid_string,message:s.message}),n.dirty())):s.kind==="trim"?e.data=e.data.trim():s.kind==="includes"?e.data.includes(s.value,s.position)||(a=this._getOrReturnCtx(e,a),Fe(a,{code:Ie.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),n.dirty()):s.kind==="toLowerCase"?e.data=e.data.toLowerCase():s.kind==="toUpperCase"?e.data=e.data.toUpperCase():s.kind==="startsWith"?e.data.startsWith(s.value)||(a=this._getOrReturnCtx(e,a),Fe(a,{code:Ie.invalid_string,validation:{startsWith:s.value},message:s.message}),n.dirty()):s.kind==="endsWith"?e.data.endsWith(s.value)||(a=this._getOrReturnCtx(e,a),Fe(a,{code:Ie.invalid_string,validation:{endsWith:s.value},message:s.message}),n.dirty()):s.kind==="datetime"?y9(s).test(e.data)||(a=this._getOrReturnCtx(e,a),Fe(a,{code:Ie.invalid_string,validation:"datetime",message:s.message}),n.dirty()):s.kind==="date"?v9.test(e.data)||(a=this._getOrReturnCtx(e,a),Fe(a,{code:Ie.invalid_string,validation:"date",message:s.message}),n.dirty()):s.kind==="time"?b9(s).test(e.data)||(a=this._getOrReturnCtx(e,a),Fe(a,{code:Ie.invalid_string,validation:"time",message:s.message}),n.dirty()):s.kind==="duration"?l9.test(e.data)||(a=this._getOrReturnCtx(e,a),Fe(a,{validation:"duration",code:Ie.invalid_string,message:s.message}),n.dirty()):s.kind==="ip"?E9(e.data,s.version)||(a=this._getOrReturnCtx(e,a),Fe(a,{validation:"ip",code:Ie.invalid_string,message:s.message}),n.dirty()):s.kind==="jwt"?S9(e.data,s.alg)||(a=this._getOrReturnCtx(e,a),Fe(a,{validation:"jwt",code:Ie.invalid_string,message:s.message}),n.dirty()):s.kind==="cidr"?x9(e.data,s.version)||(a=this._getOrReturnCtx(e,a),Fe(a,{validation:"cidr",code:Ie.invalid_string,message:s.message}),n.dirty()):s.kind==="base64"?h9.test(e.data)||(a=this._getOrReturnCtx(e,a),Fe(a,{validation:"base64",code:Ie.invalid_string,message:s.message}),n.dirty()):s.kind==="base64url"?g9.test(e.data)||(a=this._getOrReturnCtx(e,a),Fe(a,{validation:"base64url",code:Ie.invalid_string,message:s.message}),n.dirty()):Nt.assertNever(s);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(a=>e.test(a),{validation:r,code:Ie.invalid_string,...tt.errToObj(n)})}_addCheck(e){return new Ro({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...tt.errToObj(e)})}url(e){return this._addCheck({kind:"url",...tt.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...tt.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...tt.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...tt.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...tt.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...tt.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...tt.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...tt.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...tt.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...tt.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...tt.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...tt.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...tt.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...tt.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...tt.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...tt.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...tt.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...tt.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...tt.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...tt.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...tt.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...tt.errToObj(r)})}nonempty(e){return this.min(1,tt.errToObj(e))}trim(){return new Ro({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Ro({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Ro({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}}Ro.create=t=>new Ro({checks:[],typeName:ct.ZodString,coerce:t?.coerce??!1,...pt(t)});function w9(t,e){const r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,a=r>n?r:n,s=Number.parseInt(t.toFixed(a).replace(".","")),l=Number.parseInt(e.toFixed(a).replace(".",""));return s%l/10**a}class ic extends _t{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==qe.number){const s=this._getOrReturnCtx(e);return Fe(s,{code:Ie.invalid_type,expected:qe.number,received:s.parsedType}),it}let n;const a=new un;for(const s of this._def.checks)s.kind==="int"?Nt.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),Fe(n,{code:Ie.invalid_type,expected:"integer",received:"float",message:s.message}),a.dirty()):s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(n=this._getOrReturnCtx(e,n),Fe(n,{code:Ie.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),a.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(n=this._getOrReturnCtx(e,n),Fe(n,{code:Ie.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),a.dirty()):s.kind==="multipleOf"?w9(e.data,s.value)!==0&&(n=this._getOrReturnCtx(e,n),Fe(n,{code:Ie.not_multiple_of,multipleOf:s.value,message:s.message}),a.dirty()):s.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),Fe(n,{code:Ie.not_finite,message:s.message}),a.dirty()):Nt.assertNever(s);return{status:a.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,tt.toString(r))}gt(e,r){return this.setLimit("min",e,!1,tt.toString(r))}lte(e,r){return this.setLimit("max",e,!0,tt.toString(r))}lt(e,r){return this.setLimit("max",e,!1,tt.toString(r))}setLimit(e,r,n,a){return new ic({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:tt.toString(a)}]})}_addCheck(e){return new ic({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:tt.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:tt.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:tt.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:tt.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:tt.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:tt.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:tt.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:tt.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:tt.toString(e)})}get minValue(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&Nt.isInteger(e.value))}get isFinite(){let e=null,r=null;for(const n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(r)&&Number.isFinite(e)}}ic.create=t=>new ic({checks:[],typeName:ct.ZodNumber,coerce:t?.coerce||!1,...pt(t)});class cd extends _t{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==qe.bigint)return this._getInvalidInput(e);let n;const a=new un;for(const s of this._def.checks)s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(n=this._getOrReturnCtx(e,n),Fe(n,{code:Ie.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),a.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(n=this._getOrReturnCtx(e,n),Fe(n,{code:Ie.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),a.dirty()):s.kind==="multipleOf"?e.data%s.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),Fe(n,{code:Ie.not_multiple_of,multipleOf:s.value,message:s.message}),a.dirty()):Nt.assertNever(s);return{status:a.value,value:e.data}}_getInvalidInput(e){const r=this._getOrReturnCtx(e);return Fe(r,{code:Ie.invalid_type,expected:qe.bigint,received:r.parsedType}),it}gte(e,r){return this.setLimit("min",e,!0,tt.toString(r))}gt(e,r){return this.setLimit("min",e,!1,tt.toString(r))}lte(e,r){return this.setLimit("max",e,!0,tt.toString(r))}lt(e,r){return this.setLimit("max",e,!1,tt.toString(r))}setLimit(e,r,n,a){return new cd({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:tt.toString(a)}]})}_addCheck(e){return new cd({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:tt.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:tt.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:tt.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:tt.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:tt.toString(r)})}get minValue(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}}cd.create=t=>new cd({checks:[],typeName:ct.ZodBigInt,coerce:t?.coerce??!1,...pt(t)});class w_ extends _t{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==qe.boolean){const n=this._getOrReturnCtx(e);return Fe(n,{code:Ie.invalid_type,expected:qe.boolean,received:n.parsedType}),it}return Tn(e.data)}}w_.create=t=>new w_({typeName:ct.ZodBoolean,coerce:t?.coerce||!1,...pt(t)});class im extends _t{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==qe.date){const s=this._getOrReturnCtx(e);return Fe(s,{code:Ie.invalid_type,expected:qe.date,received:s.parsedType}),it}if(Number.isNaN(e.data.getTime())){const s=this._getOrReturnCtx(e);return Fe(s,{code:Ie.invalid_date}),it}const n=new un;let a;for(const s of this._def.checks)s.kind==="min"?e.data.getTime()<s.value&&(a=this._getOrReturnCtx(e,a),Fe(a,{code:Ie.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),n.dirty()):s.kind==="max"?e.data.getTime()>s.value&&(a=this._getOrReturnCtx(e,a),Fe(a,{code:Ie.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),n.dirty()):Nt.assertNever(s);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new im({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:tt.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:tt.toString(r)})}get minDate(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}}im.create=t=>new im({checks:[],coerce:t?.coerce||!1,typeName:ct.ZodDate,...pt(t)});class iI extends _t{_parse(e){if(this._getType(e)!==qe.symbol){const n=this._getOrReturnCtx(e);return Fe(n,{code:Ie.invalid_type,expected:qe.symbol,received:n.parsedType}),it}return Tn(e.data)}}iI.create=t=>new iI({typeName:ct.ZodSymbol,...pt(t)});class sm extends _t{_parse(e){if(this._getType(e)!==qe.undefined){const n=this._getOrReturnCtx(e);return Fe(n,{code:Ie.invalid_type,expected:qe.undefined,received:n.parsedType}),it}return Tn(e.data)}}sm.create=t=>new sm({typeName:ct.ZodUndefined,...pt(t)});class lm extends _t{_parse(e){if(this._getType(e)!==qe.null){const n=this._getOrReturnCtx(e);return Fe(n,{code:Ie.invalid_type,expected:qe.null,received:n.parsedType}),it}return Tn(e.data)}}lm.create=t=>new lm({typeName:ct.ZodNull,...pt(t)});class ud extends _t{constructor(){super(...arguments),this._any=!0}_parse(e){return Tn(e.data)}}ud.create=t=>new ud({typeName:ct.ZodAny,...pt(t)});class zl extends _t{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Tn(e.data)}}zl.create=t=>new zl({typeName:ct.ZodUnknown,...pt(t)});class Ti extends _t{_parse(e){const r=this._getOrReturnCtx(e);return Fe(r,{code:Ie.invalid_type,expected:qe.never,received:r.parsedType}),it}}Ti.create=t=>new Ti({typeName:ct.ZodNever,...pt(t)});class sI extends _t{_parse(e){if(this._getType(e)!==qe.undefined){const n=this._getOrReturnCtx(e);return Fe(n,{code:Ie.invalid_type,expected:qe.void,received:n.parsedType}),it}return Tn(e.data)}}sI.create=t=>new sI({typeName:ct.ZodVoid,...pt(t)});class za extends _t{_parse(e){const{ctx:r,status:n}=this._processInputParams(e),a=this._def;if(r.parsedType!==qe.array)return Fe(r,{code:Ie.invalid_type,expected:qe.array,received:r.parsedType}),it;if(a.exactLength!==null){const l=r.data.length>a.exactLength.value,c=r.data.length<a.exactLength.value;(l||c)&&(Fe(r,{code:l?Ie.too_big:Ie.too_small,minimum:c?a.exactLength.value:void 0,maximum:l?a.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:a.exactLength.message}),n.dirty())}if(a.minLength!==null&&r.data.length<a.minLength.value&&(Fe(r,{code:Ie.too_small,minimum:a.minLength.value,type:"array",inclusive:!0,exact:!1,message:a.minLength.message}),n.dirty()),a.maxLength!==null&&r.data.length>a.maxLength.value&&(Fe(r,{code:Ie.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((l,c)=>a.type._parseAsync(new Ha(r,l,r.path,c)))).then(l=>un.mergeArray(n,l));const s=[...r.data].map((l,c)=>a.type._parseSync(new Ha(r,l,r.path,c)));return un.mergeArray(n,s)}get element(){return this._def.type}min(e,r){return new za({...this._def,minLength:{value:e,message:tt.toString(r)}})}max(e,r){return new za({...this._def,maxLength:{value:e,message:tt.toString(r)}})}length(e,r){return new za({...this._def,exactLength:{value:e,message:tt.toString(r)}})}nonempty(e){return this.min(1,e)}}za.create=(t,e)=>new za({type:t,minLength:null,maxLength:null,exactLength:null,typeName:ct.ZodArray,...pt(e)});function Sl(t){if(t instanceof Nr){const e={};for(const r in t.shape){const n=t.shape[r];e[r]=Ao.create(Sl(n))}return new Nr({...t._def,shape:()=>e})}else return t instanceof za?new za({...t._def,type:Sl(t.element)}):t instanceof Ao?Ao.create(Sl(t.unwrap())):t instanceof ws?ws.create(Sl(t.unwrap())):t instanceof ko?ko.create(t.items.map(e=>Sl(e))):t}class Nr extends _t{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),r=Nt.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==qe.object){const f=this._getOrReturnCtx(e);return Fe(f,{code:Ie.invalid_type,expected:qe.object,received:f.parsedType}),it}const{status:n,ctx:a}=this._processInputParams(e),{shape:s,keys:l}=this._getCached(),c=[];if(!(this._def.catchall instanceof Ti&&this._def.unknownKeys==="strip"))for(const f in a.data)l.includes(f)||c.push(f);const d=[];for(const f of l){const h=s[f],g=a.data[f];d.push({key:{status:"valid",value:f},value:h._parse(new Ha(a,g,a.path,f)),alwaysSet:f in a.data})}if(this._def.catchall instanceof Ti){const f=this._def.unknownKeys;if(f==="passthrough")for(const h of c)d.push({key:{status:"valid",value:h},value:{status:"valid",value:a.data[h]}});else if(f==="strict")c.length>0&&(Fe(a,{code:Ie.unrecognized_keys,keys:c}),n.dirty());else if(f!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const f=this._def.catchall;for(const h of c){const g=a.data[h];d.push({key:{status:"valid",value:h},value:f._parse(new Ha(a,g,a.path,h)),alwaysSet:h in a.data})}}return a.common.async?Promise.resolve().then(async()=>{const f=[];for(const h of d){const g=await h.key,v=await h.value;f.push({key:g,value:v,alwaysSet:h.alwaysSet})}return f}).then(f=>un.mergeObjectSync(n,f)):un.mergeObjectSync(n,d)}get shape(){return this._def.shape()}strict(e){return tt.errToObj,new Nr({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{const a=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:tt.errToObj(e).message??a}:{message:a}}}:{}})}strip(){return new Nr({...this._def,unknownKeys:"strip"})}passthrough(){return new Nr({...this._def,unknownKeys:"passthrough"})}extend(e){return new Nr({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Nr({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:ct.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new Nr({...this._def,catchall:e})}pick(e){const r={};for(const n of Nt.objectKeys(e))e[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new Nr({...this._def,shape:()=>r})}omit(e){const r={};for(const n of Nt.objectKeys(this.shape))e[n]||(r[n]=this.shape[n]);return new Nr({...this._def,shape:()=>r})}deepPartial(){return Sl(this)}partial(e){const r={};for(const n of Nt.objectKeys(this.shape)){const a=this.shape[n];e&&!e[n]?r[n]=a:r[n]=a.optional()}return new Nr({...this._def,shape:()=>r})}required(e){const r={};for(const n of Nt.objectKeys(this.shape))if(e&&!e[n])r[n]=this.shape[n];else{let s=this.shape[n];for(;s instanceof Ao;)s=s._def.innerType;r[n]=s}return new Nr({...this._def,shape:()=>r})}keyof(){return qz(Nt.objectKeys(this.shape))}}Nr.create=(t,e)=>new Nr({shape:()=>t,unknownKeys:"strip",catchall:Ti.create(),typeName:ct.ZodObject,...pt(e)});Nr.strictCreate=(t,e)=>new Nr({shape:()=>t,unknownKeys:"strict",catchall:Ti.create(),typeName:ct.ZodObject,...pt(e)});Nr.lazycreate=(t,e)=>new Nr({shape:t,unknownKeys:"strip",catchall:Ti.create(),typeName:ct.ZodObject,...pt(e)});class cm extends _t{_parse(e){const{ctx:r}=this._processInputParams(e),n=this._def.options;function a(s){for(const c of s)if(c.result.status==="valid")return c.result;for(const c of s)if(c.result.status==="dirty")return r.common.issues.push(...c.ctx.common.issues),c.result;const l=s.map(c=>new oa(c.ctx.common.issues));return Fe(r,{code:Ie.invalid_union,unionErrors:l}),it}if(r.common.async)return Promise.all(n.map(async s=>{const l={...r,common:{...r.common,issues:[]},parent:null};return{result:await s._parseAsync({data:r.data,path:r.path,parent:l}),ctx:l}})).then(a);{let s;const l=[];for(const d of n){const f={...r,common:{...r.common,issues:[]},parent:null},h=d._parseSync({data:r.data,path:r.path,parent:f});if(h.status==="valid")return h;h.status==="dirty"&&!s&&(s={result:h,ctx:f}),f.common.issues.length&&l.push(f.common.issues)}if(s)return r.common.issues.push(...s.ctx.common.issues),s.result;const c=l.map(d=>new oa(d));return Fe(r,{code:Ie.invalid_union,unionErrors:c}),it}}get options(){return this._def.options}}cm.create=(t,e)=>new cm({options:t,typeName:ct.ZodUnion,...pt(e)});const xo=t=>t instanceof T_?xo(t.schema):t instanceof xs?xo(t.innerType()):t instanceof fm?[t.value]:t instanceof Ss?t.options:t instanceof R_?Nt.objectValues(t.enum):t instanceof pm?xo(t._def.innerType):t instanceof sm?[void 0]:t instanceof lm?[null]:t instanceof Ao?[void 0,...xo(t.unwrap())]:t instanceof ws?[null,...xo(t.unwrap())]:t instanceof Hz||t instanceof hm?xo(t.unwrap()):t instanceof mm?xo(t._def.innerType):[];class rR extends _t{_parse(e){const{ctx:r}=this._processInputParams(e);if(r.parsedType!==qe.object)return Fe(r,{code:Ie.invalid_type,expected:qe.object,received:r.parsedType}),it;const n=this.discriminator,a=r.data[n],s=this.optionsMap.get(a);return s?r.common.async?s._parseAsync({data:r.data,path:r.path,parent:r}):s._parseSync({data:r.data,path:r.path,parent:r}):(Fe(r,{code:Ie.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),it)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,n){const a=new Map;for(const s of r){const l=xo(s.shape[e]);if(!l.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const c of l){if(a.has(c))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(c)}`);a.set(c,s)}}return new rR({typeName:ct.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:a,...pt(n)})}}function __(t,e){const r=yi(t),n=yi(e);if(t===e)return{valid:!0,data:t};if(r===qe.object&&n===qe.object){const a=Nt.objectKeys(e),s=Nt.objectKeys(t).filter(c=>a.indexOf(c)!==-1),l={...t,...e};for(const c of s){const d=__(t[c],e[c]);if(!d.valid)return{valid:!1};l[c]=d.data}return{valid:!0,data:l}}else if(r===qe.array&&n===qe.array){if(t.length!==e.length)return{valid:!1};const a=[];for(let s=0;s<t.length;s++){const l=t[s],c=e[s],d=__(l,c);if(!d.valid)return{valid:!1};a.push(d.data)}return{valid:!0,data:a}}else return r===qe.date&&n===qe.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}class um extends _t{_parse(e){const{status:r,ctx:n}=this._processInputParams(e),a=(s,l)=>{if(nI(s)||nI(l))return it;const c=__(s.value,l.value);return c.valid?((aI(s)||aI(l))&&r.dirty(),{status:r.value,value:c.data}):(Fe(n,{code:Ie.invalid_intersection_types}),it)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([s,l])=>a(s,l)):a(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}um.create=(t,e,r)=>new um({left:t,right:e,typeName:ct.ZodIntersection,...pt(r)});class ko extends _t{_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==qe.array)return Fe(n,{code:Ie.invalid_type,expected:qe.array,received:n.parsedType}),it;if(n.data.length<this._def.items.length)return Fe(n,{code:Ie.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),it;!this._def.rest&&n.data.length>this._def.items.length&&(Fe(n,{code:Ie.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());const s=[...n.data].map((l,c)=>{const d=this._def.items[c]||this._def.rest;return d?d._parse(new Ha(n,l,n.path,c)):null}).filter(l=>!!l);return n.common.async?Promise.all(s).then(l=>un.mergeArray(r,l)):un.mergeArray(r,s)}get items(){return this._def.items}rest(e){return new ko({...this._def,rest:e})}}ko.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ko({items:t,typeName:ct.ZodTuple,rest:null,...pt(e)})};class dm extends _t{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==qe.object)return Fe(n,{code:Ie.invalid_type,expected:qe.object,received:n.parsedType}),it;const a=[],s=this._def.keyType,l=this._def.valueType;for(const c in n.data)a.push({key:s._parse(new Ha(n,c,n.path,c)),value:l._parse(new Ha(n,n.data[c],n.path,c)),alwaysSet:c in n.data});return n.common.async?un.mergeObjectAsync(r,a):un.mergeObjectSync(r,a)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof _t?new dm({keyType:e,valueType:r,typeName:ct.ZodRecord,...pt(n)}):new dm({keyType:Ro.create(),valueType:e,typeName:ct.ZodRecord,...pt(r)})}}class lI extends _t{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==qe.map)return Fe(n,{code:Ie.invalid_type,expected:qe.map,received:n.parsedType}),it;const a=this._def.keyType,s=this._def.valueType,l=[...n.data.entries()].map(([c,d],f)=>({key:a._parse(new Ha(n,c,n.path,[f,"key"])),value:s._parse(new Ha(n,d,n.path,[f,"value"]))}));if(n.common.async){const c=new Map;return Promise.resolve().then(async()=>{for(const d of l){const f=await d.key,h=await d.value;if(f.status==="aborted"||h.status==="aborted")return it;(f.status==="dirty"||h.status==="dirty")&&r.dirty(),c.set(f.value,h.value)}return{status:r.value,value:c}})}else{const c=new Map;for(const d of l){const f=d.key,h=d.value;if(f.status==="aborted"||h.status==="aborted")return it;(f.status==="dirty"||h.status==="dirty")&&r.dirty(),c.set(f.value,h.value)}return{status:r.value,value:c}}}}lI.create=(t,e,r)=>new lI({valueType:e,keyType:t,typeName:ct.ZodMap,...pt(r)});class dd extends _t{_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==qe.set)return Fe(n,{code:Ie.invalid_type,expected:qe.set,received:n.parsedType}),it;const a=this._def;a.minSize!==null&&n.data.size<a.minSize.value&&(Fe(n,{code:Ie.too_small,minimum:a.minSize.value,type:"set",inclusive:!0,exact:!1,message:a.minSize.message}),r.dirty()),a.maxSize!==null&&n.data.size>a.maxSize.value&&(Fe(n,{code:Ie.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),r.dirty());const s=this._def.valueType;function l(d){const f=new Set;for(const h of d){if(h.status==="aborted")return it;h.status==="dirty"&&r.dirty(),f.add(h.value)}return{status:r.value,value:f}}const c=[...n.data.values()].map((d,f)=>s._parse(new Ha(n,d,n.path,f)));return n.common.async?Promise.all(c).then(d=>l(d)):l(c)}min(e,r){return new dd({...this._def,minSize:{value:e,message:tt.toString(r)}})}max(e,r){return new dd({...this._def,maxSize:{value:e,message:tt.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}}dd.create=(t,e)=>new dd({valueType:t,minSize:null,maxSize:null,typeName:ct.ZodSet,...pt(e)});class $u extends _t{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:r}=this._processInputParams(e);if(r.parsedType!==qe.function)return Fe(r,{code:Ie.invalid_type,expected:qe.function,received:r.parsedType}),it;function n(c,d){return x_({data:c,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,S_(),ld].filter(f=>!!f),issueData:{code:Ie.invalid_arguments,argumentsError:d}})}function a(c,d){return x_({data:c,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,S_(),ld].filter(f=>!!f),issueData:{code:Ie.invalid_return_type,returnTypeError:d}})}const s={errorMap:r.common.contextualErrorMap},l=r.data;if(this._def.returns instanceof fd){const c=this;return Tn(async function(...d){const f=new oa([]),h=await c._def.args.parseAsync(d,s).catch(y=>{throw f.addIssue(n(d,y)),f}),g=await Reflect.apply(l,this,h);return await c._def.returns._def.type.parseAsync(g,s).catch(y=>{throw f.addIssue(a(g,y)),f})})}else{const c=this;return Tn(function(...d){const f=c._def.args.safeParse(d,s);if(!f.success)throw new oa([n(d,f.error)]);const h=Reflect.apply(l,this,f.data),g=c._def.returns.safeParse(h,s);if(!g.success)throw new oa([a(h,g.error)]);return g.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new $u({...this._def,args:ko.create(e).rest(zl.create())})}returns(e){return new $u({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,n){return new $u({args:e||ko.create([]).rest(zl.create()),returns:r||zl.create(),typeName:ct.ZodFunction,...pt(n)})}}class T_ extends _t{get schema(){return this._def.getter()}_parse(e){const{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}}T_.create=(t,e)=>new T_({getter:t,typeName:ct.ZodLazy,...pt(e)});class fm extends _t{_parse(e){if(e.data!==this._def.value){const r=this._getOrReturnCtx(e);return Fe(r,{received:r.data,code:Ie.invalid_literal,expected:this._def.value}),it}return{status:"valid",value:e.data}}get value(){return this._def.value}}fm.create=(t,e)=>new fm({value:t,typeName:ct.ZodLiteral,...pt(e)});function qz(t,e){return new Ss({values:t,typeName:ct.ZodEnum,...pt(e)})}class Ss extends _t{_parse(e){if(typeof e.data!="string"){const r=this._getOrReturnCtx(e),n=this._def.values;return Fe(r,{expected:Nt.joinValues(n),received:r.parsedType,code:Ie.invalid_type}),it}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const r=this._getOrReturnCtx(e),n=this._def.values;return Fe(r,{received:r.data,code:Ie.invalid_enum_value,options:n}),it}return Tn(e.data)}get options(){return this._def.values}get enum(){const e={};for(const r of this._def.values)e[r]=r;return e}get Values(){const e={};for(const r of this._def.values)e[r]=r;return e}get Enum(){const e={};for(const r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return Ss.create(e,{...this._def,...r})}exclude(e,r=this._def){return Ss.create(this.options.filter(n=>!e.includes(n)),{...this._def,...r})}}Ss.create=qz;class R_ extends _t{_parse(e){const r=Nt.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==qe.string&&n.parsedType!==qe.number){const a=Nt.objectValues(r);return Fe(n,{expected:Nt.joinValues(a),received:n.parsedType,code:Ie.invalid_type}),it}if(this._cache||(this._cache=new Set(Nt.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const a=Nt.objectValues(r);return Fe(n,{received:n.data,code:Ie.invalid_enum_value,options:a}),it}return Tn(e.data)}get enum(){return this._def.values}}R_.create=(t,e)=>new R_({values:t,typeName:ct.ZodNativeEnum,...pt(e)});class fd extends _t{unwrap(){return this._def.type}_parse(e){const{ctx:r}=this._processInputParams(e);if(r.parsedType!==qe.promise&&r.common.async===!1)return Fe(r,{code:Ie.invalid_type,expected:qe.promise,received:r.parsedType}),it;const n=r.parsedType===qe.promise?r.data:Promise.resolve(r.data);return Tn(n.then(a=>this._def.type.parseAsync(a,{path:r.path,errorMap:r.common.contextualErrorMap})))}}fd.create=(t,e)=>new fd({type:t,typeName:ct.ZodPromise,...pt(e)});class xs extends _t{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ct.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:r,ctx:n}=this._processInputParams(e),a=this._def.effect||null,s={addIssue:l=>{Fe(n,l),l.fatal?r.abort():r.dirty()},get path(){return n.path}};if(s.addIssue=s.addIssue.bind(s),a.type==="preprocess"){const l=a.transform(n.data,s);if(n.common.async)return Promise.resolve(l).then(async c=>{if(r.value==="aborted")return it;const d=await this._def.schema._parseAsync({data:c,path:n.path,parent:n});return d.status==="aborted"?it:d.status==="dirty"||r.value==="dirty"?Cu(d.value):d});{if(r.value==="aborted")return it;const c=this._def.schema._parseSync({data:l,path:n.path,parent:n});return c.status==="aborted"?it:c.status==="dirty"||r.value==="dirty"?Cu(c.value):c}}if(a.type==="refinement"){const l=c=>{const d=a.refinement(c,s);if(n.common.async)return Promise.resolve(d);if(d instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return c};if(n.common.async===!1){const c=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return c.status==="aborted"?it:(c.status==="dirty"&&r.dirty(),l(c.value),{status:r.value,value:c.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(c=>c.status==="aborted"?it:(c.status==="dirty"&&r.dirty(),l(c.value).then(()=>({status:r.value,value:c.value}))))}if(a.type==="transform")if(n.common.async===!1){const l=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!oc(l))return it;const c=a.transform(l.value,s);if(c instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:c}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(l=>oc(l)?Promise.resolve(a.transform(l.value,s)).then(c=>({status:r.value,value:c})):it);Nt.assertNever(a)}}xs.create=(t,e,r)=>new xs({schema:t,typeName:ct.ZodEffects,effect:e,...pt(r)});xs.createWithPreprocess=(t,e,r)=>new xs({schema:e,effect:{type:"preprocess",transform:t},typeName:ct.ZodEffects,...pt(r)});class Ao extends _t{_parse(e){return this._getType(e)===qe.undefined?Tn(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Ao.create=(t,e)=>new Ao({innerType:t,typeName:ct.ZodOptional,...pt(e)});class ws extends _t{_parse(e){return this._getType(e)===qe.null?Tn(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ws.create=(t,e)=>new ws({innerType:t,typeName:ct.ZodNullable,...pt(e)});class pm extends _t{_parse(e){const{ctx:r}=this._processInputParams(e);let n=r.data;return r.parsedType===qe.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}}pm.create=(t,e)=>new pm({innerType:t,typeName:ct.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...pt(e)});class mm extends _t{_parse(e){const{ctx:r}=this._processInputParams(e),n={...r,common:{...r.common,issues:[]}},a=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return om(a)?a.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new oa(n.common.issues)},input:n.data})})):{status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new oa(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}mm.create=(t,e)=>new mm({innerType:t,typeName:ct.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...pt(e)});class cI extends _t{_parse(e){if(this._getType(e)!==qe.nan){const n=this._getOrReturnCtx(e);return Fe(n,{code:Ie.invalid_type,expected:qe.nan,received:n.parsedType}),it}return{status:"valid",value:e.data}}}cI.create=t=>new cI({typeName:ct.ZodNaN,...pt(t)});class Hz extends _t{_parse(e){const{ctx:r}=this._processInputParams(e),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}}class nR extends _t{_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{const s=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?it:s.status==="dirty"?(r.dirty(),Cu(s.value)):this._def.out._parseAsync({data:s.value,path:n.path,parent:n})})();{const a=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?it:a.status==="dirty"?(r.dirty(),{status:"dirty",value:a.value}):this._def.out._parseSync({data:a.value,path:n.path,parent:n})}}static create(e,r){return new nR({in:e,out:r,typeName:ct.ZodPipeline})}}class hm extends _t{_parse(e){const r=this._def.innerType._parse(e),n=a=>(oc(a)&&(a.value=Object.freeze(a.value)),a);return om(r)?r.then(a=>n(a)):n(r)}unwrap(){return this._def.innerType}}hm.create=(t,e)=>new hm({innerType:t,typeName:ct.ZodReadonly,...pt(e)});function uI(t,e){const r=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof r=="string"?{message:r}:r}function _9(t,e={},r){return t?ud.create().superRefine((n,a)=>{const s=t(n);if(s instanceof Promise)return s.then(l=>{if(!l){const c=uI(e,n),d=c.fatal??r??!0;a.addIssue({code:"custom",...c,fatal:d})}});if(!s){const l=uI(e,n),c=l.fatal??r??!0;a.addIssue({code:"custom",...l,fatal:c})}}):ud.create()}var ct;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(ct||(ct={}));const kEe=(t,e={message:`Input not instance of ${t.name}`})=>_9(r=>r instanceof t,e),be=Ro.create,$r=ic.create,Pr=w_.create,IEe=sm.create,OEe=lm.create,T9=ud.create,Dd=zl.create;Ti.create;const Ze=za.create,Pe=Nr.create,dn=cm.create,R9=rR.create;um.create;ko.create;const Ld=dm.create,DEe=$u.create,mt=fm.create,Io=Ss.create,LEe=fd.create,Ne=Ao.create;ws.create;const C9=it,zm="2025-06-18",A9=[zm,"2025-03-26","2024-11-05","2024-10-07"],$m="2.0",Vz=dn([be(),$r().int()]),Gz=be(),N9=Pe({progressToken:Ne(Vz)}).passthrough(),la=Pe({_meta:Ne(N9)}).passthrough(),Rn=Pe({method:be(),params:Ne(la)}),Md=Pe({_meta:Ne(Pe({}).passthrough())}).passthrough(),Za=Pe({method:be(),params:Ne(Md)}),ca=Pe({_meta:Ne(Pe({}).passthrough())}).passthrough(),Bm=dn([be(),$r().int()]),Wz=Pe({jsonrpc:mt($m),id:Bm}).merge(Rn).strict(),Yz=t=>Wz.safeParse(t).success,Kz=Pe({jsonrpc:mt($m)}).merge(Za).strict(),k9=t=>Kz.safeParse(t).success,Zz=Pe({jsonrpc:mt($m),id:Bm,result:ca}).strict(),C_=t=>Zz.safeParse(t).success;var La;(function(t){t[t.ConnectionClosed=-32e3]="ConnectionClosed",t[t.RequestTimeout=-32001]="RequestTimeout",t[t.ParseError=-32700]="ParseError",t[t.InvalidRequest=-32600]="InvalidRequest",t[t.MethodNotFound=-32601]="MethodNotFound",t[t.InvalidParams=-32602]="InvalidParams",t[t.InternalError=-32603]="InternalError"})(La||(La={}));const Xz=Pe({jsonrpc:mt($m),id:Bm,error:Pe({code:$r().int(),message:be(),data:Ne(Dd())})}).strict(),I9=t=>Xz.safeParse(t).success,zp=dn([Wz,Kz,Zz,Xz]),Il=ca.strict(),aR=Za.extend({method:mt("notifications/cancelled"),params:Md.extend({requestId:Bm,reason:be().optional()})}),O9=Pe({src:be(),mimeType:Ne(be()),sizes:Ne(Ze(be()))}).passthrough(),Pd=Pe({icons:Ze(O9).optional()}).passthrough(),jd=Pe({name:be(),title:Ne(be())}).passthrough(),Qz=jd.extend({version:be(),websiteUrl:Ne(be())}).merge(Pd),D9=Pe({experimental:Ne(Pe({}).passthrough()),sampling:Ne(Pe({}).passthrough()),elicitation:Ne(Pe({}).passthrough()),roots:Ne(Pe({listChanged:Ne(Pr())}).passthrough())}).passthrough(),L9=Rn.extend({method:mt("initialize"),params:la.extend({protocolVersion:be(),capabilities:D9,clientInfo:Qz})}),M9=Pe({experimental:Ne(Pe({}).passthrough()),logging:Ne(Pe({}).passthrough()),completions:Ne(Pe({}).passthrough()),prompts:Ne(Pe({listChanged:Ne(Pr())}).passthrough()),resources:Ne(Pe({subscribe:Ne(Pr()),listChanged:Ne(Pr())}).passthrough()),tools:Ne(Pe({listChanged:Ne(Pr())}).passthrough())}).passthrough(),Jz=ca.extend({protocolVersion:be(),capabilities:M9,serverInfo:Qz,instructions:Ne(be())}),e$=Za.extend({method:mt("notifications/initialized")}),P9=t=>e$.safeParse(t).success,oR=Rn.extend({method:mt("ping")}),j9=Pe({progress:$r(),total:Ne($r()),message:Ne(be())}).passthrough(),iR=Za.extend({method:mt("notifications/progress"),params:Md.merge(j9).extend({progressToken:Vz})}),qm=Rn.extend({params:la.extend({cursor:Ne(Gz)}).optional()}),Hm=ca.extend({nextCursor:Ne(Gz)}),t$=Pe({uri:be(),mimeType:Ne(be()),_meta:Ne(Pe({}).passthrough())}).passthrough(),r$=t$.extend({text:be()}),sR=be().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),n$=t$.extend({blob:sR}),a$=jd.extend({uri:be(),description:Ne(be()),mimeType:Ne(be()),_meta:Ne(Pe({}).passthrough())}).merge(Pd),U9=jd.extend({uriTemplate:be(),description:Ne(be()),mimeType:Ne(be()),_meta:Ne(Pe({}).passthrough())}).merge(Pd),F9=qm.extend({method:mt("resources/list")}),o$=Hm.extend({resources:Ze(a$)}),z9=qm.extend({method:mt("resources/templates/list")}),i$=Hm.extend({resourceTemplates:Ze(U9)}),$9=Rn.extend({method:mt("resources/read"),params:la.extend({uri:be()})}),s$=ca.extend({contents:Ze(dn([r$,n$]))}),B9=Za.extend({method:mt("notifications/resources/list_changed")}),q9=Rn.extend({method:mt("resources/subscribe"),params:la.extend({uri:be()})}),H9=Rn.extend({method:mt("resources/unsubscribe"),params:la.extend({uri:be()})}),V9=Za.extend({method:mt("notifications/resources/updated"),params:Md.extend({uri:be()})}),G9=Pe({name:be(),description:Ne(be()),required:Ne(Pr())}).passthrough(),W9=jd.extend({description:Ne(be()),arguments:Ne(Ze(G9)),_meta:Ne(Pe({}).passthrough())}).merge(Pd),Y9=qm.extend({method:mt("prompts/list")}),l$=Hm.extend({prompts:Ze(W9)}),K9=Rn.extend({method:mt("prompts/get"),params:la.extend({name:be(),arguments:Ne(Ld(be()))})}),lR=Pe({type:mt("text"),text:be(),_meta:Ne(Pe({}).passthrough())}).passthrough(),cR=Pe({type:mt("image"),data:sR,mimeType:be(),_meta:Ne(Pe({}).passthrough())}).passthrough(),uR=Pe({type:mt("audio"),data:sR,mimeType:be(),_meta:Ne(Pe({}).passthrough())}).passthrough(),Z9=Pe({type:mt("resource"),resource:dn([r$,n$]),_meta:Ne(Pe({}).passthrough())}).passthrough(),X9=a$.extend({type:mt("resource_link")}),c$=dn([lR,cR,uR,X9,Z9]),Q9=Pe({role:Io(["user","assistant"]),content:c$}).passthrough(),u$=ca.extend({description:Ne(be()),messages:Ze(Q9)}),J9=Za.extend({method:mt("notifications/prompts/list_changed")}),e8=Pe({title:Ne(be()),readOnlyHint:Ne(Pr()),destructiveHint:Ne(Pr()),idempotentHint:Ne(Pr()),openWorldHint:Ne(Pr())}).passthrough(),t8=jd.extend({description:Ne(be()),inputSchema:Pe({type:mt("object"),properties:Ne(Pe({}).passthrough()),required:Ne(Ze(be()))}).passthrough(),outputSchema:Ne(Pe({type:mt("object"),properties:Ne(Pe({}).passthrough()),required:Ne(Ze(be()))}).passthrough()),annotations:Ne(e8),_meta:Ne(Pe({}).passthrough())}).merge(Pd),r8=qm.extend({method:mt("tools/list")}),d$=Hm.extend({tools:Ze(t8)}),dR=ca.extend({content:Ze(c$).default([]),structuredContent:Pe({}).passthrough().optional(),isError:Ne(Pr())});dR.or(ca.extend({toolResult:Dd()}));const n8=Rn.extend({method:mt("tools/call"),params:la.extend({name:be(),arguments:Ne(Ld(Dd()))})}),a8=Za.extend({method:mt("notifications/tools/list_changed")}),f$=Io(["debug","info","notice","warning","error","critical","alert","emergency"]),o8=Rn.extend({method:mt("logging/setLevel"),params:la.extend({level:f$})}),i8=Za.extend({method:mt("notifications/message"),params:Md.extend({level:f$,logger:Ne(be()),data:Dd()})}),s8=Pe({name:be().optional()}).passthrough(),l8=Pe({hints:Ne(Ze(s8)),costPriority:Ne($r().min(0).max(1)),speedPriority:Ne($r().min(0).max(1)),intelligencePriority:Ne($r().min(0).max(1))}).passthrough(),c8=Pe({role:Io(["user","assistant"]),content:dn([lR,cR,uR])}).passthrough(),u8=Rn.extend({method:mt("sampling/createMessage"),params:la.extend({messages:Ze(c8),systemPrompt:Ne(be()),includeContext:Ne(Io(["none","thisServer","allServers"])),temperature:Ne($r()),maxTokens:$r().int(),stopSequences:Ne(Ze(be())),metadata:Ne(Pe({}).passthrough()),modelPreferences:Ne(l8)})}),d8=ca.extend({model:be(),stopReason:Ne(Io(["endTurn","stopSequence","maxTokens"]).or(be())),role:Io(["user","assistant"]),content:R9("type",[lR,cR,uR])}),f8=Pe({type:mt("boolean"),title:Ne(be()),description:Ne(be()),default:Ne(Pr())}).passthrough(),p8=Pe({type:mt("string"),title:Ne(be()),description:Ne(be()),minLength:Ne($r()),maxLength:Ne($r()),format:Ne(Io(["email","uri","date","date-time"]))}).passthrough(),m8=Pe({type:Io(["number","integer"]),title:Ne(be()),description:Ne(be()),minimum:Ne($r()),maximum:Ne($r())}).passthrough(),h8=Pe({type:mt("string"),title:Ne(be()),description:Ne(be()),enum:Ze(be()),enumNames:Ne(Ze(be()))}).passthrough(),g8=dn([f8,p8,m8,h8]),v8=Rn.extend({method:mt("elicitation/create"),params:la.extend({message:be(),requestedSchema:Pe({type:mt("object"),properties:Ld(be(),g8),required:Ne(Ze(be()))}).passthrough()})}),b8=ca.extend({action:Io(["accept","decline","cancel"]),content:Ne(Ld(be(),Dd()))}),y8=Pe({type:mt("ref/resource"),uri:be()}).passthrough(),E8=Pe({type:mt("ref/prompt"),name:be()}).passthrough(),S8=Rn.extend({method:mt("completion/complete"),params:la.extend({ref:dn([E8,y8]),argument:Pe({name:be(),value:be()}).passthrough(),context:Ne(Pe({arguments:Ne(Ld(be(),be()))}))})}),p$=ca.extend({completion:Pe({values:Ze(be()).max(100),total:Ne($r().int()),hasMore:Ne(Pr())}).passthrough()}),x8=Pe({uri:be().startsWith("file://"),name:Ne(be()),_meta:Ne(Pe({}).passthrough())}).passthrough(),w8=Rn.extend({method:mt("roots/list")}),_8=ca.extend({roots:Ze(x8)}),T8=Za.extend({method:mt("notifications/roots/list_changed")});dn([oR,L9,S8,o8,K9,Y9,F9,z9,$9,q9,H9,n8,r8]);dn([aR,iR,e$,T8]);dn([Il,d8,b8,_8]);dn([oR,u8,v8,w8]);dn([aR,iR,i8,V9,B9,a8,J9]);dn([Il,Jz,p$,u$,l$,o$,i$,s$,dR,d$]);class wi extends Error{constructor(e,r,n){super(`MCP error ${e}: ${r}`),this.code=e,this.data=n,this.name="McpError"}}const R8=6e4;class C8{constructor(e){this._options=e,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this.setNotificationHandler(aR,r=>{const n=this._requestHandlerAbortControllers.get(r.params.requestId);n?.abort(r.params.reason)}),this.setNotificationHandler(iR,r=>{this._onprogress(r)}),this.setRequestHandler(oR,r=>({}))}_setupTimeout(e,r,n,a,s=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(a,r),startTime:Date.now(),timeout:r,maxTotalTimeout:n,resetTimeoutOnProgress:s,onTimeout:a})}_resetTimeout(e){const r=this._timeoutInfo.get(e);if(!r)return!1;const n=Date.now()-r.startTime;if(r.maxTotalTimeout&&n>=r.maxTotalTimeout)throw this._timeoutInfo.delete(e),new wi(La.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:n});return clearTimeout(r.timeoutId),r.timeoutId=setTimeout(r.onTimeout,r.timeout),!0}_cleanupTimeout(e){const r=this._timeoutInfo.get(e);r&&(clearTimeout(r.timeoutId),this._timeoutInfo.delete(e))}async connect(e){var r,n,a;this._transport=e;const s=(r=this.transport)===null||r===void 0?void 0:r.onclose;this._transport.onclose=()=>{s?.(),this._onclose()};const l=(n=this.transport)===null||n===void 0?void 0:n.onerror;this._transport.onerror=d=>{l?.(d),this._onerror(d)};const c=(a=this._transport)===null||a===void 0?void 0:a.onmessage;this._transport.onmessage=(d,f)=>{c?.(d,f),C_(d)||I9(d)?this._onresponse(d):Yz(d)?this._onrequest(d,f):k9(d)?this._onnotification(d):this._onerror(new Error(`Unknown message type: ${JSON.stringify(d)}`))},await this._transport.start()}_onclose(){var e;const r=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._pendingDebouncedNotifications.clear(),this._transport=void 0,(e=this.onclose)===null||e===void 0||e.call(this);const n=new wi(La.ConnectionClosed,"Connection closed");for(const a of r.values())a(n)}_onerror(e){var r;(r=this.onerror)===null||r===void 0||r.call(this,e)}_onnotification(e){var r;const n=(r=this._notificationHandlers.get(e.method))!==null&&r!==void 0?r:this.fallbackNotificationHandler;n!==void 0&&Promise.resolve().then(()=>n(e)).catch(a=>this._onerror(new Error(`Uncaught error in notification handler: ${a}`)))}_onrequest(e,r){var n,a;const s=(n=this._requestHandlers.get(e.method))!==null&&n!==void 0?n:this.fallbackRequestHandler,l=this._transport;if(s===void 0){l?.send({jsonrpc:"2.0",id:e.id,error:{code:La.MethodNotFound,message:"Method not found"}}).catch(f=>this._onerror(new Error(`Failed to send an error response: ${f}`)));return}const c=new AbortController;this._requestHandlerAbortControllers.set(e.id,c);const d={signal:c.signal,sessionId:l?.sessionId,_meta:(a=e.params)===null||a===void 0?void 0:a._meta,sendNotification:f=>this.notification(f,{relatedRequestId:e.id}),sendRequest:(f,h,g)=>this.request(f,h,{...g,relatedRequestId:e.id}),authInfo:r?.authInfo,requestId:e.id,requestInfo:r?.requestInfo};Promise.resolve().then(()=>s(e,d)).then(f=>{if(!c.signal.aborted)return l?.send({result:f,jsonrpc:"2.0",id:e.id})},f=>{var h;if(!c.signal.aborted)return l?.send({jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(f.code)?f.code:La.InternalError,message:(h=f.message)!==null&&h!==void 0?h:"Internal error"}})}).catch(f=>this._onerror(new Error(`Failed to send response: ${f}`))).finally(()=>{this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){const{progressToken:r,...n}=e.params,a=Number(r),s=this._progressHandlers.get(a);if(!s){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}const l=this._responseHandlers.get(a),c=this._timeoutInfo.get(a);if(c&&l&&c.resetTimeoutOnProgress)try{this._resetTimeout(a)}catch(d){l(d);return}s(n)}_onresponse(e){const r=Number(e.id),n=this._responseHandlers.get(r);if(n===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}if(this._responseHandlers.delete(r),this._progressHandlers.delete(r),this._cleanupTimeout(r),C_(e))n(e);else{const a=new wi(e.error.code,e.error.message,e.error.data);n(a)}}get transport(){return this._transport}async close(){var e;await((e=this._transport)===null||e===void 0?void 0:e.close())}request(e,r,n){const{relatedRequestId:a,resumptionToken:s,onresumptiontoken:l}=n??{};return new Promise((c,d)=>{var f,h,g,v,y,w;if(!this._transport){d(new Error("Not connected"));return}((f=this._options)===null||f===void 0?void 0:f.enforceStrictCapabilities)===!0&&this.assertCapabilityForMethod(e.method),(h=n?.signal)===null||h===void 0||h.throwIfAborted();const S=this._requestMessageId++,T={...e,jsonrpc:"2.0",id:S};n?.onprogress&&(this._progressHandlers.set(S,n.onprogress),T.params={...e.params,_meta:{...((g=e.params)===null||g===void 0?void 0:g._meta)||{},progressToken:S}});const x=N=>{var k;this._responseHandlers.delete(S),this._progressHandlers.delete(S),this._cleanupTimeout(S),(k=this._transport)===null||k===void 0||k.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:S,reason:String(N)}},{relatedRequestId:a,resumptionToken:s,onresumptiontoken:l}).catch(A=>this._onerror(new Error(`Failed to send cancellation: ${A}`))),d(N)};this._responseHandlers.set(S,N=>{var k;if(!(!((k=n?.signal)===null||k===void 0)&&k.aborted)){if(N instanceof Error)return d(N);try{const A=r.parse(N.result);c(A)}catch(A){d(A)}}}),(v=n?.signal)===null||v===void 0||v.addEventListener("abort",()=>{var N;x((N=n?.signal)===null||N===void 0?void 0:N.reason)});const _=(y=n?.timeout)!==null&&y!==void 0?y:R8,C=()=>x(new wi(La.RequestTimeout,"Request timed out",{timeout:_}));this._setupTimeout(S,_,n?.maxTotalTimeout,C,(w=n?.resetTimeoutOnProgress)!==null&&w!==void 0?w:!1),this._transport.send(T,{relatedRequestId:a,resumptionToken:s,onresumptiontoken:l}).catch(N=>{this._cleanupTimeout(S),d(N)})})}async notification(e,r){var n,a;if(!this._transport)throw new Error("Not connected");if(this.assertNotificationCapability(e.method),((a=(n=this._options)===null||n===void 0?void 0:n.debouncedNotificationMethods)!==null&&a!==void 0?a:[]).includes(e.method)&&!e.params&&!r?.relatedRequestId){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{var d;if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;const f={...e,jsonrpc:"2.0"};(d=this._transport)===null||d===void 0||d.send(f,r).catch(h=>this._onerror(h))});return}const c={...e,jsonrpc:"2.0"};await this._transport.send(c,r)}setRequestHandler(e,r){const n=e.shape.method.value;this.assertRequestHandlerCapability(n),this._requestHandlers.set(n,(a,s)=>Promise.resolve(r(e.parse(a),s)))}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw new Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,r){this._notificationHandlers.set(e.shape.method.value,n=>Promise.resolve(r(e.parse(n))))}removeNotificationHandler(e){this._notificationHandlers.delete(e)}}function A8(t,e){return Object.entries(e).reduce((r,[n,a])=>(a&&typeof a=="object"?r[n]=r[n]?{...r[n],...a}:a:r[n]=a,r),{...t})}var Au={exports:{}};var N8=Au.exports,dI;function k8(){return dI||(dI=1,(function(t,e){(function(r,n){n(e)})(N8,(function(r){function n(){for(var ae=arguments.length,K=Array(ae),ie=0;ie<ae;ie++)K[ie]=arguments[ie];if(K.length>1){K[0]=K[0].slice(0,-1);for(var ye=K.length-1,ve=1;ve<ye;++ve)K[ve]=K[ve].slice(1,-1);return K[ye]=K[ye].slice(1),K.join("")}else return K[0]}function a(ae){return"(?:"+ae+")"}function s(ae){return ae===void 0?"undefined":ae===null?"null":Object.prototype.toString.call(ae).split(" ").pop().split("]").shift().toLowerCase()}function l(ae){return ae.toUpperCase()}function c(ae){return ae!=null?ae instanceof Array?ae:typeof ae.length!="number"||ae.split||ae.setInterval||ae.call?[ae]:Array.prototype.slice.call(ae):[]}function d(ae,K){var ie=ae;if(K)for(var ye in K)ie[ye]=K[ye];return ie}function f(ae){var K="[A-Za-z]",ie="[0-9]",ye=n(ie,"[A-Fa-f]"),ve=a(a("%[EFef]"+ye+"%"+ye+ye+"%"+ye+ye)+"|"+a("%[89A-Fa-f]"+ye+"%"+ye+ye)+"|"+a("%"+ye+ye)),Ue="[\\:\\/\\?\\#\\[\\]\\@]",Be="[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",ht=n(Ue,Be),Ut=ae?"[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]":"[]",sr=ae?"[\\uE000-\\uF8FF]":"[]",Et=n(K,ie,"[\\-\\.\\_\\~]",Ut);a(K+n(K,ie,"[\\+\\-\\.]")+"*"),a(a(ve+"|"+n(Et,Be,"[\\:]"))+"*");var Ft=a(a("25[0-5]")+"|"+a("2[0-4]"+ie)+"|"+a("1"+ie+ie)+"|"+a("0?[1-9]"+ie)+"|0?0?"+ie),Wt=a(Ft+"\\."+Ft+"\\."+Ft+"\\."+Ft),st=a(ye+"{1,4}"),Dt=a(a(st+"\\:"+st)+"|"+Wt),Yt=a(a(st+"\\:")+"{6}"+Dt),Pt=a("\\:\\:"+a(st+"\\:")+"{5}"+Dt),on=a(a(st)+"?\\:\\:"+a(st+"\\:")+"{4}"+Dt),zt=a(a(a(st+"\\:")+"{0,1}"+st)+"?\\:\\:"+a(st+"\\:")+"{3}"+Dt),Nn=a(a(a(st+"\\:")+"{0,2}"+st)+"?\\:\\:"+a(st+"\\:")+"{2}"+Dt),eo=a(a(a(st+"\\:")+"{0,3}"+st)+"?\\:\\:"+st+"\\:"+Dt),sn=a(a(a(st+"\\:")+"{0,4}"+st)+"?\\:\\:"+Dt),Ir=a(a(a(st+"\\:")+"{0,5}"+st)+"?\\:\\:"+st),Hn=a(a(a(st+"\\:")+"{0,6}"+st)+"?\\:\\:"),Ra=a([Yt,Pt,on,zt,Nn,eo,sn,Ir,Hn].join("|")),Vn=a(a(Et+"|"+ve)+"+");a("[vV]"+ye+"+\\."+n(Et,Be,"[\\:]")+"+"),a(a(ve+"|"+n(Et,Be))+"*");var ji=a(ve+"|"+n(Et,Be,"[\\:\\@]"));return a(a(ve+"|"+n(Et,Be,"[\\@]"))+"+"),a(a(ji+"|"+n("[\\/\\?]",sr))+"*"),{NOT_SCHEME:new RegExp(n("[^]",K,ie,"[\\+\\-\\.]"),"g"),NOT_USERINFO:new RegExp(n("[^\\%\\:]",Et,Be),"g"),NOT_HOST:new RegExp(n("[^\\%\\[\\]\\:]",Et,Be),"g"),NOT_PATH:new RegExp(n("[^\\%\\/\\:\\@]",Et,Be),"g"),NOT_PATH_NOSCHEME:new RegExp(n("[^\\%\\/\\@]",Et,Be),"g"),NOT_QUERY:new RegExp(n("[^\\%]",Et,Be,"[\\:\\@\\/\\?]",sr),"g"),NOT_FRAGMENT:new RegExp(n("[^\\%]",Et,Be,"[\\:\\@\\/\\?]"),"g"),ESCAPE:new RegExp(n("[^]",Et,Be),"g"),UNRESERVED:new RegExp(Et,"g"),OTHER_CHARS:new RegExp(n("[^\\%]",Et,ht),"g"),PCT_ENCODED:new RegExp(ve,"g"),IPV4ADDRESS:new RegExp("^("+Wt+")$"),IPV6ADDRESS:new RegExp("^\\[?("+Ra+")"+a(a("\\%25|\\%(?!"+ye+"{2})")+"("+Vn+")")+"?\\]?$")}}var h=f(!1),g=f(!0),v=(function(){function ae(K,ie){var ye=[],ve=!0,Ue=!1,Be=void 0;try{for(var ht=K[Symbol.iterator](),Ut;!(ve=(Ut=ht.next()).done)&&(ye.push(Ut.value),!(ie&&ye.length===ie));ve=!0);}catch(sr){Ue=!0,Be=sr}finally{try{!ve&&ht.return&&ht.return()}finally{if(Ue)throw Be}}return ye}return function(K,ie){if(Array.isArray(K))return K;if(Symbol.iterator in Object(K))return ae(K,ie);throw new TypeError("Invalid attempt to destructure non-iterable instance")}})(),y=function(ae){if(Array.isArray(ae)){for(var K=0,ie=Array(ae.length);K<ae.length;K++)ie[K]=ae[K];return ie}else return Array.from(ae)},w=2147483647,S=36,T=1,x=26,_=38,C=700,N=72,k=128,A="-",I=/^xn--/,O=/[^\0-\x7E]/,L=/[\x2E\u3002\uFF0E\uFF61]/g,M={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},P=S-T,W=Math.floor,X=String.fromCharCode;function ee(ae){throw new RangeError(M[ae])}function J(ae,K){for(var ie=[],ye=ae.length;ye--;)ie[ye]=K(ae[ye]);return ie}function B(ae,K){var ie=ae.split("@"),ye="";ie.length>1&&(ye=ie[0]+"@",ae=ie[1]),ae=ae.replace(L,".");var ve=ae.split("."),Ue=J(ve,K).join(".");return ye+Ue}function Y(ae){for(var K=[],ie=0,ye=ae.length;ie<ye;){var ve=ae.charCodeAt(ie++);if(ve>=55296&&ve<=56319&&ie<ye){var Ue=ae.charCodeAt(ie++);(Ue&64512)==56320?K.push(((ve&1023)<<10)+(Ue&1023)+65536):(K.push(ve),ie--)}else K.push(ve)}return K}var H=function(K){return String.fromCodePoint.apply(String,y(K))},re=function(K){return K-48<10?K-22:K-65<26?K-65:K-97<26?K-97:S},Q=function(K,ie){return K+22+75*(K<26)-((ie!=0)<<5)},j=function(K,ie,ye){var ve=0;for(K=ye?W(K/C):K>>1,K+=W(K/ie);K>P*x>>1;ve+=S)K=W(K/P);return W(ve+(P+1)*K/(K+_))},q=function(K){var ie=[],ye=K.length,ve=0,Ue=k,Be=N,ht=K.lastIndexOf(A);ht<0&&(ht=0);for(var Ut=0;Ut<ht;++Ut)K.charCodeAt(Ut)>=128&&ee("not-basic"),ie.push(K.charCodeAt(Ut));for(var sr=ht>0?ht+1:0;sr<ye;){for(var Et=ve,Ft=1,Wt=S;;Wt+=S){sr>=ye&&ee("invalid-input");var st=re(K.charCodeAt(sr++));(st>=S||st>W((w-ve)/Ft))&&ee("overflow"),ve+=st*Ft;var Dt=Wt<=Be?T:Wt>=Be+x?x:Wt-Be;if(st<Dt)break;var Yt=S-Dt;Ft>W(w/Yt)&&ee("overflow"),Ft*=Yt}var Pt=ie.length+1;Be=j(ve-Et,Pt,Et==0),W(ve/Pt)>w-Ue&&ee("overflow"),Ue+=W(ve/Pt),ve%=Pt,ie.splice(ve++,0,Ue)}return String.fromCodePoint.apply(String,ie)},z=function(K){var ie=[];K=Y(K);var ye=K.length,ve=k,Ue=0,Be=N,ht=!0,Ut=!1,sr=void 0;try{for(var Et=K[Symbol.iterator](),Ft;!(ht=(Ft=Et.next()).done);ht=!0){var Wt=Ft.value;Wt<128&&ie.push(X(Wt))}}catch(Bo){Ut=!0,sr=Bo}finally{try{!ht&&Et.return&&Et.return()}finally{if(Ut)throw sr}}var st=ie.length,Dt=st;for(st&&ie.push(A);Dt<ye;){var Yt=w,Pt=!0,on=!1,zt=void 0;try{for(var Nn=K[Symbol.iterator](),eo;!(Pt=(eo=Nn.next()).done);Pt=!0){var sn=eo.value;sn>=ve&&sn<Yt&&(Yt=sn)}}catch(Bo){on=!0,zt=Bo}finally{try{!Pt&&Nn.return&&Nn.return()}finally{if(on)throw zt}}var Ir=Dt+1;Yt-ve>W((w-Ue)/Ir)&&ee("overflow"),Ue+=(Yt-ve)*Ir,ve=Yt;var Hn=!0,Ra=!1,Vn=void 0;try{for(var ji=K[Symbol.iterator](),Ui;!(Hn=(Ui=ji.next()).done);Hn=!0){var Fi=Ui.value;if(Fi<ve&&++Ue>w&&ee("overflow"),Fi==ve){for(var mn=Ue,qr=S;;qr+=S){var zi=qr<=Be?T:qr>=Be+x?x:qr-Be;if(mn<zi)break;var sf=mn-zi,Ms=S-zi;ie.push(X(Q(zi+sf%Ms,0))),mn=W(sf/Ms)}ie.push(X(Q(mn,0))),Be=j(Ue,Ir,Dt==st),Ue=0,++Dt}}}catch(Bo){Ra=!0,Vn=Bo}finally{try{!Hn&&ji.return&&ji.return()}finally{if(Ra)throw Vn}}++Ue,++ve}return ie.join("")},G=function(K){return B(K,function(ie){return I.test(ie)?q(ie.slice(4).toLowerCase()):ie})},Z=function(K){return B(K,function(ie){return O.test(ie)?"xn--"+z(ie):ie})},U={version:"2.1.0",ucs2:{decode:Y,encode:H},decode:q,encode:z,toASCII:Z,toUnicode:G},F={};function te(ae){var K=ae.charCodeAt(0),ie=void 0;return K<16?ie="%0"+K.toString(16).toUpperCase():K<128?ie="%"+K.toString(16).toUpperCase():K<2048?ie="%"+(K>>6|192).toString(16).toUpperCase()+"%"+(K&63|128).toString(16).toUpperCase():ie="%"+(K>>12|224).toString(16).toUpperCase()+"%"+(K>>6&63|128).toString(16).toUpperCase()+"%"+(K&63|128).toString(16).toUpperCase(),ie}function fe(ae){for(var K="",ie=0,ye=ae.length;ie<ye;){var ve=parseInt(ae.substr(ie+1,2),16);if(ve<128)K+=String.fromCharCode(ve),ie+=3;else if(ve>=194&&ve<224){if(ye-ie>=6){var Ue=parseInt(ae.substr(ie+4,2),16);K+=String.fromCharCode((ve&31)<<6|Ue&63)}else K+=ae.substr(ie,6);ie+=6}else if(ve>=224){if(ye-ie>=9){var Be=parseInt(ae.substr(ie+4,2),16),ht=parseInt(ae.substr(ie+7,2),16);K+=String.fromCharCode((ve&15)<<12|(Be&63)<<6|ht&63)}else K+=ae.substr(ie,9);ie+=9}else K+=ae.substr(ie,3),ie+=3}return K}function V(ae,K){function ie(ye){var ve=fe(ye);return ve.match(K.UNRESERVED)?ve:ye}return ae.scheme&&(ae.scheme=String(ae.scheme).replace(K.PCT_ENCODED,ie).toLowerCase().replace(K.NOT_SCHEME,"")),ae.userinfo!==void 0&&(ae.userinfo=String(ae.userinfo).replace(K.PCT_ENCODED,ie).replace(K.NOT_USERINFO,te).replace(K.PCT_ENCODED,l)),ae.host!==void 0&&(ae.host=String(ae.host).replace(K.PCT_ENCODED,ie).toLowerCase().replace(K.NOT_HOST,te).replace(K.PCT_ENCODED,l)),ae.path!==void 0&&(ae.path=String(ae.path).replace(K.PCT_ENCODED,ie).replace(ae.scheme?K.NOT_PATH:K.NOT_PATH_NOSCHEME,te).replace(K.PCT_ENCODED,l)),ae.query!==void 0&&(ae.query=String(ae.query).replace(K.PCT_ENCODED,ie).replace(K.NOT_QUERY,te).replace(K.PCT_ENCODED,l)),ae.fragment!==void 0&&(ae.fragment=String(ae.fragment).replace(K.PCT_ENCODED,ie).replace(K.NOT_FRAGMENT,te).replace(K.PCT_ENCODED,l)),ae}function de(ae){return ae.replace(/^0*(.*)/,"$1")||"0"}function le(ae,K){var ie=ae.match(K.IPV4ADDRESS)||[],ye=v(ie,2),ve=ye[1];return ve?ve.split(".").map(de).join("."):ae}function pe(ae,K){var ie=ae.match(K.IPV6ADDRESS)||[],ye=v(ie,3),ve=ye[1],Ue=ye[2];if(ve){for(var Be=ve.toLowerCase().split("::").reverse(),ht=v(Be,2),Ut=ht[0],sr=ht[1],Et=sr?sr.split(":").map(de):[],Ft=Ut.split(":").map(de),Wt=K.IPV4ADDRESS.test(Ft[Ft.length-1]),st=Wt?7:8,Dt=Ft.length-st,Yt=Array(st),Pt=0;Pt<st;++Pt)Yt[Pt]=Et[Pt]||Ft[Dt+Pt]||"";Wt&&(Yt[st-1]=le(Yt[st-1],K));var on=Yt.reduce(function(Ir,Hn,Ra){if(!Hn||Hn==="0"){var Vn=Ir[Ir.length-1];Vn&&Vn.index+Vn.length===Ra?Vn.length++:Ir.push({index:Ra,length:1})}return Ir},[]),zt=on.sort(function(Ir,Hn){return Hn.length-Ir.length})[0],Nn=void 0;if(zt&&zt.length>1){var eo=Yt.slice(0,zt.index),sn=Yt.slice(zt.index+zt.length);Nn=eo.join(":")+"::"+sn.join(":")}else Nn=Yt.join(":");return Ue&&(Nn+="%"+Ue),Nn}else return ae}var Re=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,Ke="".match(/(){0}/)[1]===void 0;function je(ae){var K=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},ie={},ye=K.iri!==!1?g:h;K.reference==="suffix"&&(ae=(K.scheme?K.scheme+":":"")+"//"+ae);var ve=ae.match(Re);if(ve){Ke?(ie.scheme=ve[1],ie.userinfo=ve[3],ie.host=ve[4],ie.port=parseInt(ve[5],10),ie.path=ve[6]||"",ie.query=ve[7],ie.fragment=ve[8],isNaN(ie.port)&&(ie.port=ve[5])):(ie.scheme=ve[1]||void 0,ie.userinfo=ae.indexOf("@")!==-1?ve[3]:void 0,ie.host=ae.indexOf("//")!==-1?ve[4]:void 0,ie.port=parseInt(ve[5],10),ie.path=ve[6]||"",ie.query=ae.indexOf("?")!==-1?ve[7]:void 0,ie.fragment=ae.indexOf("#")!==-1?ve[8]:void 0,isNaN(ie.port)&&(ie.port=ae.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?ve[4]:void 0)),ie.host&&(ie.host=pe(le(ie.host,ye),ye)),ie.scheme===void 0&&ie.userinfo===void 0&&ie.host===void 0&&ie.port===void 0&&!ie.path&&ie.query===void 0?ie.reference="same-document":ie.scheme===void 0?ie.reference="relative":ie.fragment===void 0?ie.reference="absolute":ie.reference="uri",K.reference&&K.reference!=="suffix"&&K.reference!==ie.reference&&(ie.error=ie.error||"URI is not a "+K.reference+" reference.");var Ue=F[(K.scheme||ie.scheme||"").toLowerCase()];if(!K.unicodeSupport&&(!Ue||!Ue.unicodeSupport)){if(ie.host&&(K.domainHost||Ue&&Ue.domainHost))try{ie.host=U.toASCII(ie.host.replace(ye.PCT_ENCODED,fe).toLowerCase())}catch(Be){ie.error=ie.error||"Host's domain name can not be converted to ASCII via punycode: "+Be}V(ie,h)}else V(ie,ye);Ue&&Ue.parse&&Ue.parse(ie,K)}else ie.error=ie.error||"URI can not be parsed.";return ie}function ze(ae,K){var ie=K.iri!==!1?g:h,ye=[];return ae.userinfo!==void 0&&(ye.push(ae.userinfo),ye.push("@")),ae.host!==void 0&&ye.push(pe(le(String(ae.host),ie),ie).replace(ie.IPV6ADDRESS,function(ve,Ue,Be){return"["+Ue+(Be?"%25"+Be:"")+"]"})),(typeof ae.port=="number"||typeof ae.port=="string")&&(ye.push(":"),ye.push(String(ae.port))),ye.length?ye.join(""):void 0}var _e=/^\.\.?\//,Ae=/^\/\.(\/|$)/,$e=/^\/\.\.(\/|$)/,oe=/^\/?(?:.|\n)*?(?=\/|$)/;function Se(ae){for(var K=[];ae.length;)if(ae.match(_e))ae=ae.replace(_e,"");else if(ae.match(Ae))ae=ae.replace(Ae,"/");else if(ae.match($e))ae=ae.replace($e,"/"),K.pop();else if(ae==="."||ae==="..")ae="";else{var ie=ae.match(oe);if(ie){var ye=ie[0];ae=ae.slice(ye.length),K.push(ye)}else throw new Error("Unexpected dot segment condition")}return K.join("")}function Le(ae){var K=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},ie=K.iri?g:h,ye=[],ve=F[(K.scheme||ae.scheme||"").toLowerCase()];if(ve&&ve.serialize&&ve.serialize(ae,K),ae.host&&!ie.IPV6ADDRESS.test(ae.host)){if(K.domainHost||ve&&ve.domainHost)try{ae.host=K.iri?U.toUnicode(ae.host):U.toASCII(ae.host.replace(ie.PCT_ENCODED,fe).toLowerCase())}catch(ht){ae.error=ae.error||"Host's domain name can not be converted to "+(K.iri?"Unicode":"ASCII")+" via punycode: "+ht}}V(ae,ie),K.reference!=="suffix"&&ae.scheme&&(ye.push(ae.scheme),ye.push(":"));var Ue=ze(ae,K);if(Ue!==void 0&&(K.reference!=="suffix"&&ye.push("//"),ye.push(Ue),ae.path&&ae.path.charAt(0)!=="/"&&ye.push("/")),ae.path!==void 0){var Be=ae.path;!K.absolutePath&&(!ve||!ve.absolutePath)&&(Be=Se(Be)),Ue===void 0&&(Be=Be.replace(/^\/\//,"/%2F")),ye.push(Be)}return ae.query!==void 0&&(ye.push("?"),ye.push(ae.query)),ae.fragment!==void 0&&(ye.push("#"),ye.push(ae.fragment)),ye.join("")}function we(ae,K){var ie=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},ye=arguments[3],ve={};return ye||(ae=je(Le(ae,ie),ie),K=je(Le(K,ie),ie)),ie=ie||{},!ie.tolerant&&K.scheme?(ve.scheme=K.scheme,ve.userinfo=K.userinfo,ve.host=K.host,ve.port=K.port,ve.path=Se(K.path||""),ve.query=K.query):(K.userinfo!==void 0||K.host!==void 0||K.port!==void 0?(ve.userinfo=K.userinfo,ve.host=K.host,ve.port=K.port,ve.path=Se(K.path||""),ve.query=K.query):(K.path?(K.path.charAt(0)==="/"?ve.path=Se(K.path):((ae.userinfo!==void 0||ae.host!==void 0||ae.port!==void 0)&&!ae.path?ve.path="/"+K.path:ae.path?ve.path=ae.path.slice(0,ae.path.lastIndexOf("/")+1)+K.path:ve.path=K.path,ve.path=Se(ve.path)),ve.query=K.query):(ve.path=ae.path,K.query!==void 0?ve.query=K.query:ve.query=ae.query),ve.userinfo=ae.userinfo,ve.host=ae.host,ve.port=ae.port),ve.scheme=ae.scheme),ve.fragment=K.fragment,ve}function ke(ae,K,ie){var ye=d({scheme:"null"},ie);return Le(we(je(ae,ye),je(K,ye),ye,!0),ye)}function Oe(ae,K){return typeof ae=="string"?ae=Le(je(ae,K),K):s(ae)==="object"&&(ae=je(Le(ae,K),K)),ae}function Ve(ae,K,ie){return typeof ae=="string"?ae=Le(je(ae,ie),ie):s(ae)==="object"&&(ae=Le(ae,ie)),typeof K=="string"?K=Le(je(K,ie),ie):s(K)==="object"&&(K=Le(K,ie)),ae===K}function et(ae,K){return ae&&ae.toString().replace(!K||!K.iri?h.ESCAPE:g.ESCAPE,te)}function ut(ae,K){return ae&&ae.toString().replace(!K||!K.iri?h.PCT_ENCODED:g.PCT_ENCODED,fe)}var At={scheme:"http",domainHost:!0,parse:function(K,ie){return K.host||(K.error=K.error||"HTTP URIs must have a host."),K},serialize:function(K,ie){var ye=String(K.scheme).toLowerCase()==="https";return(K.port===(ye?443:80)||K.port==="")&&(K.port=void 0),K.path||(K.path="/"),K}},An={scheme:"https",domainHost:At.domainHost,parse:At.parse,serialize:At.serialize};function vr(ae){return typeof ae.secure=="boolean"?ae.secure:String(ae.scheme).toLowerCase()==="wss"}var or={scheme:"ws",domainHost:!0,parse:function(K,ie){var ye=K;return ye.secure=vr(ye),ye.resourceName=(ye.path||"/")+(ye.query?"?"+ye.query:""),ye.path=void 0,ye.query=void 0,ye},serialize:function(K,ie){if((K.port===(vr(K)?443:80)||K.port==="")&&(K.port=void 0),typeof K.secure=="boolean"&&(K.scheme=K.secure?"wss":"ws",K.secure=void 0),K.resourceName){var ye=K.resourceName.split("?"),ve=v(ye,2),Ue=ve[0],Be=ve[1];K.path=Ue&&Ue!=="/"?Ue:void 0,K.query=Be,K.resourceName=void 0}return K.fragment=void 0,K}},Mt={scheme:"wss",domainHost:or.domainHost,parse:or.parse,serialize:or.serialize},Zt={},fr="[A-Za-z0-9\\-\\.\\_\\~\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]",_r="[0-9A-Fa-f]",Bn=a(a("%[EFef]"+_r+"%"+_r+_r+"%"+_r+_r)+"|"+a("%[89A-Fa-f]"+_r+"%"+_r+_r)+"|"+a("%"+_r+_r)),ir="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",Gt="[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",pn=n(Gt,'[\\"\\\\]'),da="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",an=new RegExp(fr,"g"),rt=new RegExp(Bn,"g"),jt=new RegExp(n("[^]",ir,"[\\.]",'[\\"]',pn),"g"),Qt=new RegExp(n("[^]",fr,da),"g"),jr=Qt;function qn(ae){var K=fe(ae);return K.match(an)?K:ae}var Xt={scheme:"mailto",parse:function(K,ie){var ye=K,ve=ye.to=ye.path?ye.path.split(","):[];if(ye.path=void 0,ye.query){for(var Ue=!1,Be={},ht=ye.query.split("&"),Ut=0,sr=ht.length;Ut<sr;++Ut){var Et=ht[Ut].split("=");switch(Et[0]){case"to":for(var Ft=Et[1].split(","),Wt=0,st=Ft.length;Wt<st;++Wt)ve.push(Ft[Wt]);break;case"subject":ye.subject=ut(Et[1],ie);break;case"body":ye.body=ut(Et[1],ie);break;default:Ue=!0,Be[ut(Et[0],ie)]=ut(Et[1],ie);break}}Ue&&(ye.headers=Be)}ye.query=void 0;for(var Dt=0,Yt=ve.length;Dt<Yt;++Dt){var Pt=ve[Dt].split("@");if(Pt[0]=ut(Pt[0]),ie.unicodeSupport)Pt[1]=ut(Pt[1],ie).toLowerCase();else try{Pt[1]=U.toASCII(ut(Pt[1],ie).toLowerCase())}catch(on){ye.error=ye.error||"Email address's domain name can not be converted to ASCII via punycode: "+on}ve[Dt]=Pt.join("@")}return ye},serialize:function(K,ie){var ye=K,ve=c(K.to);if(ve){for(var Ue=0,Be=ve.length;Ue<Be;++Ue){var ht=String(ve[Ue]),Ut=ht.lastIndexOf("@"),sr=ht.slice(0,Ut).replace(rt,qn).replace(rt,l).replace(jt,te),Et=ht.slice(Ut+1);try{Et=ie.iri?U.toUnicode(Et):U.toASCII(ut(Et,ie).toLowerCase())}catch(Dt){ye.error=ye.error||"Email address's domain name can not be converted to "+(ie.iri?"Unicode":"ASCII")+" via punycode: "+Dt}ve[Ue]=sr+"@"+Et}ye.path=ve.join(",")}var Ft=K.headers=K.headers||{};K.subject&&(Ft.subject=K.subject),K.body&&(Ft.body=K.body);var Wt=[];for(var st in Ft)Ft[st]!==Zt[st]&&Wt.push(st.replace(rt,qn).replace(rt,l).replace(Qt,te)+"="+Ft[st].replace(rt,qn).replace(rt,l).replace(jr,te));return Wt.length&&(ye.query=Wt.join("&")),ye}},Jr=/^([^\:]+)\:(.*)/,Ta={scheme:"urn",parse:function(K,ie){var ye=K.path&&K.path.match(Jr),ve=K;if(ye){var Ue=ie.scheme||ve.scheme||"urn",Be=ye[1].toLowerCase(),ht=ye[2],Ut=Ue+":"+(ie.nid||Be),sr=F[Ut];ve.nid=Be,ve.nss=ht,ve.path=void 0,sr&&(ve=sr.parse(ve,ie))}else ve.error=ve.error||"URN can not be parsed.";return ve},serialize:function(K,ie){var ye=ie.scheme||K.scheme||"urn",ve=K.nid,Ue=ye+":"+(ie.nid||ve),Be=F[Ue];Be&&(K=Be.serialize(K,ie));var ht=K,Ut=K.nss;return ht.path=(ve||ie.nid)+":"+Ut,ht}},en=/^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/,Br={scheme:"urn:uuid",parse:function(K,ie){var ye=K;return ye.uuid=ye.nss,ye.nss=void 0,!ie.tolerant&&(!ye.uuid||!ye.uuid.match(en))&&(ye.error=ye.error||"UUID is not valid."),ye},serialize:function(K,ie){var ye=K;return ye.nss=(K.uuid||"").toLowerCase(),ye}};F[At.scheme]=At,F[An.scheme]=An,F[or.scheme]=or,F[Mt.scheme]=Mt,F[Xt.scheme]=Xt,F[Ta.scheme]=Ta,F[Br.scheme]=Br,r.SCHEMES=F,r.pctEncChar=te,r.pctDecChars=fe,r.parse=je,r.removeDotSegments=Se,r.serialize=Le,r.resolveComponents=we,r.resolve=ke,r.normalize=Oe,r.equal=Ve,r.escapeComponent=et,r.unescapeComponent=ut,Object.defineProperty(r,"__esModule",{value:!0})}))})(Au,Au.exports)),Au.exports}var qv,fI;function fR(){return fI||(fI=1,qv=function t(e,r){if(e===r)return!0;if(e&&r&&typeof e=="object"&&typeof r=="object"){if(e.constructor!==r.constructor)return!1;var n,a,s;if(Array.isArray(e)){if(n=e.length,n!=r.length)return!1;for(a=n;a--!==0;)if(!t(e[a],r[a]))return!1;return!0}if(e.constructor===RegExp)return e.source===r.source&&e.flags===r.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===r.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===r.toString();if(s=Object.keys(e),n=s.length,n!==Object.keys(r).length)return!1;for(a=n;a--!==0;)if(!Object.prototype.hasOwnProperty.call(r,s[a]))return!1;for(a=n;a--!==0;){var l=s[a];if(!t(e[l],r[l]))return!1}return!0}return e!==e&&r!==r}),qv}var Hv,pI;function I8(){return pI||(pI=1,Hv=function(e){for(var r=0,n=e.length,a=0,s;a<n;)r++,s=e.charCodeAt(a++),s>=55296&&s<=56319&&a<n&&(s=e.charCodeAt(a),(s&64512)==56320&&a++);return r}),Hv}var Vv,mI;function gc(){if(mI)return Vv;mI=1,Vv={copy:t,checkDataType:e,checkDataTypes:r,coerceToTypes:a,toHash:s,getProperty:d,escapeQuotes:f,equal:fR(),ucs2length:I8(),varOccurences:h,varReplace:g,schemaHasRules:v,schemaHasRulesExcept:y,schemaUnknownRules:w,toQuotedString:S,getPathExpr:T,getPath:x,getData:N,unescapeFragment:A,unescapeJsonPointer:L,escapeFragment:I,escapeJsonPointer:O};function t(M,P){P=P||{};for(var W in M)P[W]=M[W];return P}function e(M,P,W,X){var ee=X?" !== ":" === ",J=X?" || ":" && ",B=X?"!":"",Y=X?"":"!";switch(M){case"null":return P+ee+"null";case"array":return B+"Array.isArray("+P+")";case"object":return"("+B+P+J+"typeof "+P+ee+'"object"'+J+Y+"Array.isArray("+P+"))";case"integer":return"(typeof "+P+ee+'"number"'+J+Y+"("+P+" % 1)"+J+P+ee+P+(W?J+B+"isFinite("+P+")":"")+")";case"number":return"(typeof "+P+ee+'"'+M+'"'+(W?J+B+"isFinite("+P+")":"")+")";default:return"typeof "+P+ee+'"'+M+'"'}}function r(M,P,W){switch(M.length){case 1:return e(M[0],P,W,!0);default:var X="",ee=s(M);ee.array&&ee.object&&(X=ee.null?"(":"(!"+P+" || ",X+="typeof "+P+' !== "object")',delete ee.null,delete ee.array,delete ee.object),ee.number&&delete ee.integer;for(var J in ee)X+=(X?" && ":"")+e(J,P,W,!0);return X}}var n=s(["string","number","integer","boolean","null"]);function a(M,P){if(Array.isArray(P)){for(var W=[],X=0;X<P.length;X++){var ee=P[X];(n[ee]||M==="array"&&ee==="array")&&(W[W.length]=ee)}if(W.length)return W}else{if(n[P])return[P];if(M==="array"&&P==="array")return["array"]}}function s(M){for(var P={},W=0;W<M.length;W++)P[M[W]]=!0;return P}var l=/^[a-z$_][a-z$_0-9]*$/i,c=/'|\\/g;function d(M){return typeof M=="number"?"["+M+"]":l.test(M)?"."+M:"['"+f(M)+"']"}function f(M){return M.replace(c,"\\$&").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\f/g,"\\f").replace(/\t/g,"\\t")}function h(M,P){P+="[^0-9]";var W=M.match(new RegExp(P,"g"));return W?W.length:0}function g(M,P,W){return P+="([^0-9])",W=W.replace(/\$/g,"$$$$"),M.replace(new RegExp(P,"g"),W+"$1")}function v(M,P){if(typeof M=="boolean")return!M;for(var W in M)if(P[W])return!0}function y(M,P,W){if(typeof M=="boolean")return!M&&W!="not";for(var X in M)if(X!=W&&P[X])return!0}function w(M,P){if(typeof M!="boolean"){for(var W in M)if(!P[W])return W}}function S(M){return"'"+f(M)+"'"}function T(M,P,W,X){var ee=W?"'/' + "+P+(X?"":".replace(/~/g, '~0').replace(/\\//g, '~1')"):X?"'[' + "+P+" + ']'":"'[\\'' + "+P+" + '\\']'";return k(M,ee)}function x(M,P,W){var X=S(W?"/"+O(P):d(P));return k(M,X)}var _=/^\/(?:[^~]|~0|~1)*$/,C=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function N(M,P,W){var X,ee,J,B;if(M==="")return"rootData";if(M[0]=="/"){if(!_.test(M))throw new Error("Invalid JSON-pointer: "+M);ee=M,J="rootData"}else{if(B=M.match(C),!B)throw new Error("Invalid JSON-pointer: "+M);if(X=+B[1],ee=B[2],ee=="#"){if(X>=P)throw new Error("Cannot access property/index "+X+" levels up, current level is "+P);return W[P-X]}if(X>P)throw new Error("Cannot access data "+X+" levels up, current level is "+P);if(J="data"+(P-X||""),!ee)return J}for(var Y=J,H=ee.split("/"),re=0;re<H.length;re++){var Q=H[re];Q&&(J+=d(L(Q)),Y+=" && "+J)}return Y}function k(M,P){return M=='""'?P:(M+" + "+P).replace(/([^\\])' \+ '/g,"$1")}function A(M){return L(decodeURIComponent(M))}function I(M){return encodeURIComponent(O(M))}function O(M){return M.replace(/~/g,"~0").replace(/\//g,"~1")}function L(M){return M.replace(/~1/g,"/").replace(/~0/g,"~")}return Vv}var Gv,hI;function m$(){if(hI)return Gv;hI=1;var t=gc();Gv=e;function e(r){t.copy(r,this)}return Gv}var Wv={exports:{}},gI;function O8(){if(gI)return Wv.exports;gI=1;var t=Wv.exports=function(n,a,s){typeof a=="function"&&(s=a,a={}),s=a.cb||s;var l=typeof s=="function"?s:s.pre||function(){},c=s.post||function(){};e(a,l,c,n,"",n)};t.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0},t.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},t.propsKeywords={definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},t.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function e(n,a,s,l,c,d,f,h,g,v){if(l&&typeof l=="object"&&!Array.isArray(l)){a(l,c,d,f,h,g,v);for(var y in l){var w=l[y];if(Array.isArray(w)){if(y in t.arrayKeywords)for(var S=0;S<w.length;S++)e(n,a,s,w[S],c+"/"+y+"/"+S,d,c,y,l,S)}else if(y in t.propsKeywords){if(w&&typeof w=="object")for(var T in w)e(n,a,s,w[T],c+"/"+y+"/"+r(T),d,c,y,l,T)}else(y in t.keywords||n.allKeys&&!(y in t.skipKeywords))&&e(n,a,s,w,c+"/"+y,d,c,y,l)}s(l,c,d,f,h,g,v)}}function r(n){return n.replace(/~/g,"~0").replace(/\//g,"~1")}return Wv.exports}var Yv,vI;function pR(){if(vI)return Yv;vI=1;var t=k8(),e=fR(),r=gc(),n=m$(),a=O8();Yv=s,s.normalizeId=x,s.fullPath=w,s.url=_,s.ids=C,s.inlineRef=g,s.schema=l;function s(N,k,A){var I=this._refs[A];if(typeof I=="string")if(this._refs[I])I=this._refs[I];else return s.call(this,N,k,I);if(I=I||this._schemas[A],I instanceof n)return g(I.schema,this._opts.inlineRefs)?I.schema:I.validate||this._compile(I);var O=l.call(this,k,A),L,M,P;return O&&(L=O.schema,k=O.root,P=O.baseId),L instanceof n?M=L.validate||N.call(this,L.schema,k,void 0,P):L!==void 0&&(M=g(L,this._opts.inlineRefs)?L:N.call(this,L,k,void 0,P)),M}function l(N,k){var A=t.parse(k),I=S(A),O=w(this._getId(N.schema));if(Object.keys(N.schema).length===0||I!==O){var L=x(I),M=this._refs[L];if(typeof M=="string")return c.call(this,N,M,A);if(M instanceof n)M.validate||this._compile(M),N=M;else if(M=this._schemas[L],M instanceof n){if(M.validate||this._compile(M),L==x(k))return{schema:M,root:N,baseId:O};N=M}else return;if(!N.schema)return;O=w(this._getId(N.schema))}return f.call(this,A,O,N.schema,N)}function c(N,k,A){var I=l.call(this,N,k);if(I){var O=I.schema,L=I.baseId;N=I.root;var M=this._getId(O);return M&&(L=_(L,M)),f.call(this,A,L,O,N)}}var d=r.toHash(["properties","patternProperties","enum","dependencies","definitions"]);function f(N,k,A,I){if(N.fragment=N.fragment||"",N.fragment.slice(0,1)=="/"){for(var O=N.fragment.split("/"),L=1;L<O.length;L++){var M=O[L];if(M){if(M=r.unescapeFragment(M),A=A[M],A===void 0)break;var P;if(!d[M]&&(P=this._getId(A),P&&(k=_(k,P)),A.$ref)){var W=_(k,A.$ref),X=l.call(this,I,W);X&&(A=X.schema,I=X.root,k=X.baseId)}}}if(A!==void 0&&A!==I.schema)return{schema:A,root:I,baseId:k}}}var h=r.toHash(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum"]);function g(N,k){if(k===!1)return!1;if(k===void 0||k===!0)return v(N);if(k)return y(N)<=k}function v(N){var k;if(Array.isArray(N)){for(var A=0;A<N.length;A++)if(k=N[A],typeof k=="object"&&!v(k))return!1}else for(var I in N)if(I=="$ref"||(k=N[I],typeof k=="object"&&!v(k)))return!1;return!0}function y(N){var k=0,A;if(Array.isArray(N)){for(var I=0;I<N.length;I++)if(A=N[I],typeof A=="object"&&(k+=y(A)),k==1/0)return 1/0}else for(var O in N){if(O=="$ref")return 1/0;if(h[O])k++;else if(A=N[O],typeof A=="object"&&(k+=y(A)+1),k==1/0)return 1/0}return k}function w(N,k){k!==!1&&(N=x(N));var A=t.parse(N);return S(A)}function S(N){return t.serialize(N).split("#")[0]+"#"}var T=/#\/?$/;function x(N){return N?N.replace(T,""):""}function _(N,k){return k=x(k),t.resolve(N,k)}function C(N){var k=x(this._getId(N)),A={"":k},I={"":w(k,!1)},O={},L=this;return a(N,{allKeys:!0},function(M,P,W,X,ee,J,B){if(P!==""){var Y=L._getId(M),H=A[X],re=I[X]+"/"+ee;if(B!==void 0&&(re+="/"+(typeof B=="number"?B:r.escapeFragment(B))),typeof Y=="string"){Y=H=x(H?t.resolve(H,Y):Y);var Q=L._refs[Y];if(typeof Q=="string"&&(Q=L._refs[Q]),Q&&Q.schema){if(!e(M,Q.schema))throw new Error('id "'+Y+'" resolves to more than one schema')}else if(Y!=x(re))if(Y[0]=="#"){if(O[Y]&&!e(M,O[Y]))throw new Error('id "'+Y+'" resolves to more than one schema');O[Y]=M}else L._refs[Y]=re}A[P]=H,I[P]=re}}),O}return Yv}var Kv,bI;function mR(){if(bI)return Kv;bI=1;var t=pR();Kv={Validation:n(e),MissingRef:n(r)};function e(a){this.message="validation failed",this.errors=a,this.ajv=this.validation=!0}r.message=function(a,s){return"can't resolve reference "+s+" from id "+a};function r(a,s,l){this.message=l||r.message(a,s),this.missingRef=t.url(a,s),this.missingSchema=t.normalizeId(t.fullPath(this.missingRef))}function n(a){return a.prototype=Object.create(Error.prototype),a.prototype.constructor=a,a}return Kv}var Zv,yI;function h$(){return yI||(yI=1,Zv=function(t,e){e||(e={}),typeof e=="function"&&(e={cmp:e});var r=typeof e.cycles=="boolean"?e.cycles:!1,n=e.cmp&&(function(s){return function(l){return function(c,d){var f={key:c,value:l[c]},h={key:d,value:l[d]};return s(f,h)}}})(e.cmp),a=[];return(function s(l){if(l&&l.toJSON&&typeof l.toJSON=="function"&&(l=l.toJSON()),l!==void 0){if(typeof l=="number")return isFinite(l)?""+l:"null";if(typeof l!="object")return JSON.stringify(l);var c,d;if(Array.isArray(l)){for(d="[",c=0;c<l.length;c++)c&&(d+=","),d+=s(l[c])||"null";return d+"]"}if(l===null)return"null";if(a.indexOf(l)!==-1){if(r)return JSON.stringify("__cycle__");throw new TypeError("Converting circular structure to JSON")}var f=a.push(l)-1,h=Object.keys(l).sort(n&&n(l));for(d="",c=0;c<h.length;c++){var g=h[c],v=s(l[g]);v&&(d&&(d+=","),d+=JSON.stringify(g)+":"+v)}return a.splice(f,1),"{"+d+"}"}})(t)}),Zv}var Xv,EI;function g$(){return EI||(EI=1,Xv=function(e,r,n){var a="",s=e.schema.$async===!0,l=e.util.schemaHasRulesExcept(e.schema,e.RULES.all,"$ref"),c=e.self._getId(e.schema);if(e.opts.strictKeywords){var d=e.util.schemaUnknownRules(e.schema,e.RULES.keywords);if(d){var f="unknown keyword: "+d;if(e.opts.strictKeywords==="log")e.logger.warn(f);else throw new Error(f)}}if(e.isTop&&(a+=" var validate = ",s&&(e.async=!0,a+="async "),a+="function(data, dataPath, parentData, parentDataProperty, rootData) { 'use strict'; ",c&&(e.opts.sourceCode||e.opts.processCode)&&(a+=" "+("/*# sourceURL="+c+" */")+" ")),typeof e.schema=="boolean"||!(l||e.schema.$ref)){var r="false schema",h=e.level,g=e.dataLevel,v=e.schema[r],y=e.schemaPath+e.util.getProperty(r),w=e.errSchemaPath+"/"+r,k=!e.opts.allErrors,O,S="data"+(g||""),N="valid"+h;if(e.schema===!1){e.isTop?k=!0:a+=" var "+N+" = false; ";var T=T||[];T.push(a),a="",e.createErrors!==!1?(a+=" { keyword: '"+(O||"false schema")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(w)+" , params: {} ",e.opts.messages!==!1&&(a+=" , message: 'boolean schema is false' "),e.opts.verbose&&(a+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+S+" "),a+=" } "):a+=" {} ";var x=a;a=T.pop(),!e.compositeRule&&k?e.async?a+=" throw new ValidationError(["+x+"]); ":a+=" validate.errors = ["+x+"]; return false; ":a+=" var err = "+x+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else e.isTop?s?a+=" return data; ":a+=" validate.errors = null; return true; ":a+=" var "+N+" = true; ";return e.isTop&&(a+=" }; return validate; "),a}if(e.isTop){var _=e.isTop,h=e.level=0,g=e.dataLevel=0,S="data";if(e.rootId=e.resolve.fullPath(e.self._getId(e.root.schema)),e.baseId=e.baseId||e.rootId,delete e.isTop,e.dataPathArr=[""],e.schema.default!==void 0&&e.opts.useDefaults&&e.opts.strictDefaults){var C="default is ignored in the schema root";if(e.opts.strictDefaults==="log")e.logger.warn(C);else throw new Error(C)}a+=" var vErrors = null; ",a+=" var errors = 0; ",a+=" if (rootData === undefined) rootData = data; "}else{var h=e.level,g=e.dataLevel,S="data"+(g||"");if(c&&(e.baseId=e.resolve.url(e.baseId,c)),s&&!e.async)throw new Error("async schema in sync schema");a+=" var errs_"+h+" = errors;"}var N="valid"+h,k=!e.opts.allErrors,A="",I="",O,L=e.schema.type,M=Array.isArray(L);if(L&&e.opts.nullable&&e.schema.nullable===!0&&(M?L.indexOf("null")==-1&&(L=L.concat("null")):L!="null"&&(L=[L,"null"],M=!0)),M&&L.length==1&&(L=L[0],M=!1),e.schema.$ref&&l){if(e.opts.extendRefs=="fail")throw new Error('$ref: validation keywords used in schema at path "'+e.errSchemaPath+'" (see option extendRefs)');e.opts.extendRefs!==!0&&(l=!1,e.logger.warn('$ref: keywords ignored in schema at path "'+e.errSchemaPath+'"'))}if(e.schema.$comment&&e.opts.$comment&&(a+=" "+e.RULES.all.$comment.code(e,"$comment")),L){if(e.opts.coerceTypes)var P=e.util.coerceToTypes(e.opts.coerceTypes,L);var W=e.RULES.types[L];if(P||M||W===!0||W&&!Ae(W)){var y=e.schemaPath+".type",w=e.errSchemaPath+"/type",y=e.schemaPath+".type",w=e.errSchemaPath+"/type",X=M?"checkDataTypes":"checkDataType";if(a+=" if ("+e.util[X](L,S,e.opts.strictNumbers,!0)+") { ",P){var ee="dataType"+h,J="coerced"+h;a+=" var "+ee+" = typeof "+S+"; var "+J+" = undefined; ",e.opts.coerceTypes=="array"&&(a+=" if ("+ee+" == 'object' && Array.isArray("+S+") && "+S+".length == 1) { "+S+" = "+S+"[0]; "+ee+" = typeof "+S+"; if ("+e.util.checkDataType(e.schema.type,S,e.opts.strictNumbers)+") "+J+" = "+S+"; } "),a+=" if ("+J+" !== undefined) ; ";var B=P;if(B)for(var Y,H=-1,re=B.length-1;H<re;)Y=B[H+=1],Y=="string"?a+=" else if ("+ee+" == 'number' || "+ee+" == 'boolean') "+J+" = '' + "+S+"; else if ("+S+" === null) "+J+" = ''; ":Y=="number"||Y=="integer"?(a+=" else if ("+ee+" == 'boolean' || "+S+" === null || ("+ee+" == 'string' && "+S+" && "+S+" == +"+S+" ",Y=="integer"&&(a+=" && !("+S+" % 1)"),a+=")) "+J+" = +"+S+"; "):Y=="boolean"?a+=" else if ("+S+" === 'false' || "+S+" === 0 || "+S+" === null) "+J+" = false; else if ("+S+" === 'true' || "+S+" === 1) "+J+" = true; ":Y=="null"?a+=" else if ("+S+" === '' || "+S+" === 0 || "+S+" === false) "+J+" = null; ":e.opts.coerceTypes=="array"&&Y=="array"&&(a+=" else if ("+ee+" == 'string' || "+ee+" == 'number' || "+ee+" == 'boolean' || "+S+" == null) "+J+" = ["+S+"]; ");a+=" else { ";var T=T||[];T.push(a),a="",e.createErrors!==!1?(a+=" { keyword: '"+(O||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(w)+" , params: { type: '",M?a+=""+L.join(","):a+=""+L,a+="' } ",e.opts.messages!==!1&&(a+=" , message: 'should be ",M?a+=""+L.join(","):a+=""+L,a+="' "),e.opts.verbose&&(a+=" , schema: validate.schema"+y+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+S+" "),a+=" } "):a+=" {} ";var x=a;a=T.pop(),!e.compositeRule&&k?e.async?a+=" throw new ValidationError(["+x+"]); ":a+=" validate.errors = ["+x+"]; return false; ":a+=" var err = "+x+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } if ("+J+" !== undefined) { ";var Q=g?"data"+(g-1||""):"parentData",j=g?e.dataPathArr[g]:"parentDataProperty";a+=" "+S+" = "+J+"; ",g||(a+="if ("+Q+" !== undefined)"),a+=" "+Q+"["+j+"] = "+J+"; } "}else{var T=T||[];T.push(a),a="",e.createErrors!==!1?(a+=" { keyword: '"+(O||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(w)+" , params: { type: '",M?a+=""+L.join(","):a+=""+L,a+="' } ",e.opts.messages!==!1&&(a+=" , message: 'should be ",M?a+=""+L.join(","):a+=""+L,a+="' "),e.opts.verbose&&(a+=" , schema: validate.schema"+y+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+S+" "),a+=" } "):a+=" {} ";var x=a;a=T.pop(),!e.compositeRule&&k?e.async?a+=" throw new ValidationError(["+x+"]); ":a+=" validate.errors = ["+x+"]; return false; ":a+=" var err = "+x+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}a+=" } "}}if(e.schema.$ref&&!l)a+=" "+e.RULES.all.$ref.code(e,"$ref")+" ",k&&(a+=" } if (errors === ",_?a+="0":a+="errs_"+h,a+=") { ",I+="}");else{var q=e.RULES;if(q){for(var W,z=-1,G=q.length-1;z<G;)if(W=q[z+=1],Ae(W)){if(W.type&&(a+=" if ("+e.util.checkDataType(W.type,S,e.opts.strictNumbers)+") { "),e.opts.useDefaults){if(W.type=="object"&&e.schema.properties){var v=e.schema.properties,Z=Object.keys(v),U=Z;if(U)for(var F,te=-1,fe=U.length-1;te<fe;){F=U[te+=1];var V=v[F];if(V.default!==void 0){var de=S+e.util.getProperty(F);if(e.compositeRule){if(e.opts.strictDefaults){var C="default is ignored for: "+de;if(e.opts.strictDefaults==="log")e.logger.warn(C);else throw new Error(C)}}else a+=" if ("+de+" === undefined ",e.opts.useDefaults=="empty"&&(a+=" || "+de+" === null || "+de+" === '' "),a+=" ) "+de+" = ",e.opts.useDefaults=="shared"?a+=" "+e.useDefault(V.default)+" ":a+=" "+JSON.stringify(V.default)+" ",a+="; "}}}else if(W.type=="array"&&Array.isArray(e.schema.items)){var le=e.schema.items;if(le){for(var V,H=-1,pe=le.length-1;H<pe;)if(V=le[H+=1],V.default!==void 0){var de=S+"["+H+"]";if(e.compositeRule){if(e.opts.strictDefaults){var C="default is ignored for: "+de;if(e.opts.strictDefaults==="log")e.logger.warn(C);else throw new Error(C)}}else a+=" if ("+de+" === undefined ",e.opts.useDefaults=="empty"&&(a+=" || "+de+" === null || "+de+" === '' "),a+=" ) "+de+" = ",e.opts.useDefaults=="shared"?a+=" "+e.useDefault(V.default)+" ":a+=" "+JSON.stringify(V.default)+" ",a+="; "}}}}var Re=W.rules;if(Re){for(var Ke,je=-1,ze=Re.length-1;je<ze;)if(Ke=Re[je+=1],$e(Ke)){var _e=Ke.code(e,Ke.keyword,W.type);_e&&(a+=" "+_e+" ",k&&(A+="}"))}}if(k&&(a+=" "+A+" ",A=""),W.type&&(a+=" } ",L&&L===W.type&&!P)){a+=" else { ";var y=e.schemaPath+".type",w=e.errSchemaPath+"/type",T=T||[];T.push(a),a="",e.createErrors!==!1?(a+=" { keyword: '"+(O||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(w)+" , params: { type: '",M?a+=""+L.join(","):a+=""+L,a+="' } ",e.opts.messages!==!1&&(a+=" , message: 'should be ",M?a+=""+L.join(","):a+=""+L,a+="' "),e.opts.verbose&&(a+=" , schema: validate.schema"+y+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+S+" "),a+=" } "):a+=" {} ";var x=a;a=T.pop(),!e.compositeRule&&k?e.async?a+=" throw new ValidationError(["+x+"]); ":a+=" validate.errors = ["+x+"]; return false; ":a+=" var err = "+x+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } "}k&&(a+=" if (errors === ",_?a+="0":a+="errs_"+h,a+=") { ",I+="}")}}}k&&(a+=" "+I+" "),_?(s?(a+=" if (errors === 0) return data; ",a+=" else throw new ValidationError(vErrors); "):(a+=" validate.errors = vErrors; ",a+=" return errors === 0; "),a+=" }; return validate;"):a+=" var "+N+" = errors === errs_"+h+";";function Ae(Se){for(var Le=Se.rules,we=0;we<Le.length;we++)if($e(Le[we]))return!0}function $e(Se){return e.schema[Se.keyword]!==void 0||Se.implements&&oe(Se)}function oe(Se){for(var Le=Se.implements,we=0;we<Le.length;we++)if(e.schema[Le[we]]!==void 0)return!0}return a}),Xv}var Qv,SI;function D8(){if(SI)return Qv;SI=1;var t=pR(),e=gc(),r=mR(),n=h$(),a=g$(),s=e.ucs2length,l=fR(),c=r.Validation;Qv=d;function d(x,_,C,N){var k=this,A=this._opts,I=[void 0],O={},L=[],M={},P=[],W={},X=[];_=_||{schema:x,refVal:I,refs:O};var ee=f.call(this,x,_,N),J=this._compilations[ee.index];if(ee.compiling)return J.callValidate=Q;var B=this._formats,Y=this.RULES;try{var H=j(x,_,C,N);J.validate=H;var re=J.callValidate;return re&&(re.schema=H.schema,re.errors=null,re.refs=H.refs,re.refVal=H.refVal,re.root=H.root,re.$async=H.$async,A.sourceCode&&(re.source=H.source)),H}finally{h.call(this,x,_,N)}function Q(){var V=J.validate,de=V.apply(this,arguments);return Q.errors=V.errors,de}function j(V,de,le,pe){var Re=!de||de&&de.schema==V;if(de.schema!=_.schema)return d.call(k,V,de,le,pe);var Ke=V.$async===!0,je=a({isTop:!0,schema:V,isRoot:Re,baseId:pe,root:de,schemaPath:"",errSchemaPath:"#",errorPath:'""',MissingRefError:r.MissingRef,RULES:Y,validate:a,util:e,resolve:t,resolveRef:q,usePattern:F,useDefault:te,useCustomRule:fe,opts:A,formats:B,logger:k.logger,self:k});je=T(I,w)+T(L,v)+T(P,y)+T(X,S)+je,A.processCode&&(je=A.processCode(je,V));var ze;try{var _e=new Function("self","RULES","formats","root","refVal","defaults","customRules","equal","ucs2length","ValidationError",je);ze=_e(k,Y,B,_,I,P,X,l,s,c),I[0]=ze}catch(Ae){throw k.logger.error("Error compiling schema, function code:",je),Ae}return ze.schema=V,ze.errors=null,ze.refs=O,ze.refVal=I,ze.root=Re?ze:de,Ke&&(ze.$async=!0),A.sourceCode===!0&&(ze.source={code:je,patterns:L,defaults:P}),ze}function q(V,de,le){de=t.url(V,de);var pe=O[de],Re,Ke;if(pe!==void 0)return Re=I[pe],Ke="refVal["+pe+"]",U(Re,Ke);if(!le&&_.refs){var je=_.refs[de];if(je!==void 0)return Re=_.refVal[je],Ke=z(de,Re),U(Re,Ke)}Ke=z(de);var ze=t.call(k,j,_,de);if(ze===void 0){var _e=C&&C[de];_e&&(ze=t.inlineRef(_e,A.inlineRefs)?_e:d.call(k,_e,_,C,V))}if(ze===void 0)G(de);else return Z(de,ze),U(ze,Ke)}function z(V,de){var le=I.length;return I[le]=de,O[V]=le,"refVal"+le}function G(V){delete O[V]}function Z(V,de){var le=O[V];I[le]=de}function U(V,de){return typeof V=="object"||typeof V=="boolean"?{code:de,schema:V,inline:!0}:{code:de,$async:V&&!!V.$async}}function F(V){var de=M[V];return de===void 0&&(de=M[V]=L.length,L[de]=V),"pattern"+de}function te(V){switch(typeof V){case"boolean":case"number":return""+V;case"string":return e.toQuotedString(V);case"object":if(V===null)return"null";var de=n(V),le=W[de];return le===void 0&&(le=W[de]=P.length,P[le]=V),"default"+le}}function fe(V,de,le,pe){if(k._opts.validateSchema!==!1){var Re=V.definition.dependencies;if(Re&&!Re.every(function(Le){return Object.prototype.hasOwnProperty.call(le,Le)}))throw new Error("parent schema must have all required keywords: "+Re.join(","));var Ke=V.definition.validateSchema;if(Ke){var je=Ke(de);if(!je){var ze="keyword schema is invalid: "+k.errorsText(Ke.errors);if(k._opts.validateSchema=="log")k.logger.error(ze);else throw new Error(ze)}}}var _e=V.definition.compile,Ae=V.definition.inline,$e=V.definition.macro,oe;if(_e)oe=_e.call(k,de,le,pe);else if($e)oe=$e.call(k,de,le,pe),A.validateSchema!==!1&&k.validateSchema(oe,!0);else if(Ae)oe=Ae.call(k,pe,V.keyword,de,le);else if(oe=V.definition.validate,!oe)return;if(oe===void 0)throw new Error('custom keyword "'+V.keyword+'"failed to compile');var Se=X.length;return X[Se]=oe,{code:"customRule"+Se,validate:oe}}}function f(x,_,C){var N=g.call(this,x,_,C);return N>=0?{index:N,compiling:!0}:(N=this._compilations.length,this._compilations[N]={schema:x,root:_,baseId:C},{index:N,compiling:!1})}function h(x,_,C){var N=g.call(this,x,_,C);N>=0&&this._compilations.splice(N,1)}function g(x,_,C){for(var N=0;N<this._compilations.length;N++){var k=this._compilations[N];if(k.schema==x&&k.root==_&&k.baseId==C)return N}return-1}function v(x,_){return"var pattern"+x+" = new RegExp("+e.toQuotedString(_[x])+");"}function y(x){return"var default"+x+" = defaults["+x+"];"}function w(x,_){return _[x]===void 0?"":"var refVal"+x+" = refVal["+x+"];"}function S(x){return"var customRule"+x+" = customRules["+x+"];"}function T(x,_){if(!x.length)return"";for(var C="",N=0;N<x.length;N++)C+=_(N,x);return C}return Qv}var Jv={exports:{}},xI;function L8(){if(xI)return Jv.exports;xI=1;var t=Jv.exports=function(){this._cache={}};return t.prototype.put=function(r,n){this._cache[r]=n},t.prototype.get=function(r){return this._cache[r]},t.prototype.del=function(r){delete this._cache[r]},t.prototype.clear=function(){this._cache={}},Jv.exports}var eb,wI;function M8(){if(wI)return eb;wI=1;var t=gc(),e=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,r=[0,31,28,31,30,31,30,31,31,30,31,30,31],n=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,a=/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,s=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,l=/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,c=/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,d=/^(?:(?:http[s\u017F]?|ftp):\/\/)(?:(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+(?::(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?@)?(?:(?!10(?:\.[0-9]{1,3}){3})(?!127(?:\.[0-9]{1,3}){3})(?!169\.254(?:\.[0-9]{1,3}){2})(?!192\.168(?:\.[0-9]{1,3}){2})(?!172\.(?:1[6-9]|2[0-9]|3[01])(?:\.[0-9]{1,3}){2})(?:[1-9][0-9]?|1[0-9][0-9]|2[01][0-9]|22[0-3])(?:\.(?:1?[0-9]{1,2}|2[0-4][0-9]|25[0-5])){2}(?:\.(?:[1-9][0-9]?|1[0-9][0-9]|2[0-4][0-9]|25[0-4]))|(?:(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)(?:\.(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)*(?:\.(?:(?:[a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]){2,})))(?::[0-9]{2,5})?(?:\/(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?$/i,f=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,h=/^(?:\/(?:[^~/]|~0|~1)*)*$/,g=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,v=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;eb=y;function y(I){return I=I=="full"?"full":"fast",t.copy(y[I])}y.fast={date:/^\d\d\d\d-[0-1]\d-[0-3]\d$/,time:/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,"date-time":/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,"uri-template":c,url:d,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i,hostname:a,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipv6:/^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i,regex:A,uuid:f,"json-pointer":h,"json-pointer-uri-fragment":g,"relative-json-pointer":v},y.full={date:S,time:T,"date-time":_,uri:N,"uri-reference":l,"uri-template":c,url:d,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:a,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipv6:/^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i,regex:A,uuid:f,"json-pointer":h,"json-pointer-uri-fragment":g,"relative-json-pointer":v};function w(I){return I%4===0&&(I%100!==0||I%400===0)}function S(I){var O=I.match(e);if(!O)return!1;var L=+O[1],M=+O[2],P=+O[3];return M>=1&&M<=12&&P>=1&&P<=(M==2&&w(L)?29:r[M])}function T(I,O){var L=I.match(n);if(!L)return!1;var M=L[1],P=L[2],W=L[3],X=L[5];return(M<=23&&P<=59&&W<=59||M==23&&P==59&&W==60)&&(!O||X)}var x=/t|\s/i;function _(I){var O=I.split(x);return O.length==2&&S(O[0])&&T(O[1],!0)}var C=/\/|:/;function N(I){return C.test(I)&&s.test(I)}var k=/[^\\]\\Z/;function A(I){if(k.test(I))return!1;try{return new RegExp(I),!0}catch{return!1}}return eb}var tb,_I;function P8(){return _I||(_I=1,tb=function(e,r,n){var a=" ",s=e.level,l=e.dataLevel,c=e.schema[r],d=e.errSchemaPath+"/"+r,f=!e.opts.allErrors,h="data"+(l||""),g="valid"+s,v,y;if(c=="#"||c=="#/")e.isRoot?(v=e.async,y="validate"):(v=e.root.schema.$async===!0,y="root.refVal[0]");else{var w=e.resolveRef(e.baseId,c,e.isRoot);if(w===void 0){var S=e.MissingRefError.message(e.baseId,c);if(e.opts.missingRefs=="fail"){e.logger.error(S);var T=T||[];T.push(a),a="",e.createErrors!==!1?(a+=" { keyword: '$ref' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(d)+" , params: { ref: '"+e.util.escapeQuotes(c)+"' } ",e.opts.messages!==!1&&(a+=" , message: 'can\\'t resolve reference "+e.util.escapeQuotes(c)+"' "),e.opts.verbose&&(a+=" , schema: "+e.util.toQuotedString(c)+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),a+=" } "):a+=" {} ";var x=a;a=T.pop(),!e.compositeRule&&f?e.async?a+=" throw new ValidationError(["+x+"]); ":a+=" validate.errors = ["+x+"]; return false; ":a+=" var err = "+x+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",f&&(a+=" if (false) { ")}else if(e.opts.missingRefs=="ignore")e.logger.warn(S),f&&(a+=" if (true) { ");else throw new e.MissingRefError(e.baseId,c,S)}else if(w.inline){var _=e.util.copy(e);_.level++;var C="valid"+_.level;_.schema=w.schema,_.schemaPath="",_.errSchemaPath=c;var N=e.validate(_).replace(/validate\.schema/g,w.code);a+=" "+N+" ",f&&(a+=" if ("+C+") { ")}else v=w.$async===!0||e.async&&w.$async!==!1,y=w.code}if(y){var T=T||[];T.push(a),a="",e.opts.passContext?a+=" "+y+".call(this, ":a+=" "+y+"( ",a+=" "+h+", (dataPath || '')",e.errorPath!='""'&&(a+=" + "+e.errorPath);var k=l?"data"+(l-1||""):"parentData",A=l?e.dataPathArr[l]:"parentDataProperty";a+=" , "+k+" , "+A+", rootData) ";var I=a;if(a=T.pop(),v){if(!e.async)throw new Error("async schema referenced by sync schema");f&&(a+=" var "+g+"; "),a+=" try { await "+I+"; ",f&&(a+=" "+g+" = true; "),a+=" } catch (e) { if (!(e instanceof ValidationError)) throw e; if (vErrors === null) vErrors = e.errors; else vErrors = vErrors.concat(e.errors); errors = vErrors.length; ",f&&(a+=" "+g+" = false; "),a+=" } ",f&&(a+=" if ("+g+") { ")}else a+=" if (!"+I+") { if (vErrors === null) vErrors = "+y+".errors; else vErrors = vErrors.concat("+y+".errors); errors = vErrors.length; } ",f&&(a+=" else { ")}return a}),tb}var rb,TI;function j8(){return TI||(TI=1,rb=function(e,r,n){var a=" ",s=e.schema[r],l=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,d=!e.opts.allErrors,f=e.util.copy(e),h="";f.level++;var g="valid"+f.level,v=f.baseId,y=!0,w=s;if(w)for(var S,T=-1,x=w.length-1;T<x;)S=w[T+=1],(e.opts.strictKeywords?typeof S=="object"&&Object.keys(S).length>0||S===!1:e.util.schemaHasRules(S,e.RULES.all))&&(y=!1,f.schema=S,f.schemaPath=l+"["+T+"]",f.errSchemaPath=c+"/"+T,a+=" "+e.validate(f)+" ",f.baseId=v,d&&(a+=" if ("+g+") { ",h+="}"));return d&&(y?a+=" if (true) { ":a+=" "+h.slice(0,-1)+" "),a}),rb}var nb,RI;function U8(){return RI||(RI=1,nb=function(e,r,n){var a=" ",s=e.level,l=e.dataLevel,c=e.schema[r],d=e.schemaPath+e.util.getProperty(r),f=e.errSchemaPath+"/"+r,h=!e.opts.allErrors,g="data"+(l||""),v="valid"+s,y="errs__"+s,w=e.util.copy(e),S="";w.level++;var T="valid"+w.level,x=c.every(function(O){return e.opts.strictKeywords?typeof O=="object"&&Object.keys(O).length>0||O===!1:e.util.schemaHasRules(O,e.RULES.all)});if(x){var _=w.baseId;a+=" var "+y+" = errors; var "+v+" = false; ";var C=e.compositeRule;e.compositeRule=w.compositeRule=!0;var N=c;if(N)for(var k,A=-1,I=N.length-1;A<I;)k=N[A+=1],w.schema=k,w.schemaPath=d+"["+A+"]",w.errSchemaPath=f+"/"+A,a+=" "+e.validate(w)+" ",w.baseId=_,a+=" "+v+" = "+v+" || "+T+"; if (!"+v+") { ",S+="}";e.compositeRule=w.compositeRule=C,a+=" "+S+" if (!"+v+") { var err = ",e.createErrors!==!1?(a+=" { keyword: 'anyOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: {} ",e.opts.messages!==!1&&(a+=" , message: 'should match some schema in anyOf' "),e.opts.verbose&&(a+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+g+" "),a+=" } "):a+=" {} ",a+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&h&&(e.async?a+=" throw new ValidationError(vErrors); ":a+=" validate.errors = vErrors; return false; "),a+=" } else { errors = "+y+"; if (vErrors !== null) { if ("+y+") vErrors.length = "+y+"; else vErrors = null; } ",e.opts.allErrors&&(a+=" } ")}else h&&(a+=" if (true) { ");return a}),nb}var ab,CI;function F8(){return CI||(CI=1,ab=function(e,r,n){var a=" ",s=e.schema[r],l=e.errSchemaPath+"/"+r;e.opts.allErrors;var c=e.util.toQuotedString(s);return e.opts.$comment===!0?a+=" console.log("+c+");":typeof e.opts.$comment=="function"&&(a+=" self._opts.$comment("+c+", "+e.util.toQuotedString(l)+", validate.root.schema);"),a}),ab}var ob,AI;function z8(){return AI||(AI=1,ob=function(e,r,n){var a=" ",s=e.level,l=e.dataLevel,c=e.schema[r],d=e.schemaPath+e.util.getProperty(r),f=e.errSchemaPath+"/"+r,h=!e.opts.allErrors,g="data"+(l||""),v="valid"+s,y=e.opts.$data&&c&&c.$data;y&&(a+=" var schema"+s+" = "+e.util.getData(c.$data,l,e.dataPathArr)+"; "),y||(a+=" var schema"+s+" = validate.schema"+d+";"),a+="var "+v+" = equal("+g+", schema"+s+"); if (!"+v+") { ";var w=w||[];w.push(a),a="",e.createErrors!==!1?(a+=" { keyword: 'const' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { allowedValue: schema"+s+" } ",e.opts.messages!==!1&&(a+=" , message: 'should be equal to constant' "),e.opts.verbose&&(a+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+g+" "),a+=" } "):a+=" {} ";var S=a;return a=w.pop(),!e.compositeRule&&h?e.async?a+=" throw new ValidationError(["+S+"]); ":a+=" validate.errors = ["+S+"]; return false; ":a+=" var err = "+S+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" }",h&&(a+=" else { "),a}),ob}var ib,NI;function $8(){return NI||(NI=1,ib=function(e,r,n){var a=" ",s=e.level,l=e.dataLevel,c=e.schema[r],d=e.schemaPath+e.util.getProperty(r),f=e.errSchemaPath+"/"+r,h=!e.opts.allErrors,g="data"+(l||""),v="valid"+s,y="errs__"+s,w=e.util.copy(e),S="";w.level++;var T="valid"+w.level,x="i"+s,_=w.dataLevel=e.dataLevel+1,C="data"+_,N=e.baseId,k=e.opts.strictKeywords?typeof c=="object"&&Object.keys(c).length>0||c===!1:e.util.schemaHasRules(c,e.RULES.all);if(a+="var "+y+" = errors;var "+v+";",k){var A=e.compositeRule;e.compositeRule=w.compositeRule=!0,w.schema=c,w.schemaPath=d,w.errSchemaPath=f,a+=" var "+T+" = false; for (var "+x+" = 0; "+x+" < "+g+".length; "+x+"++) { ",w.errorPath=e.util.getPathExpr(e.errorPath,x,e.opts.jsonPointers,!0);var I=g+"["+x+"]";w.dataPathArr[_]=x;var O=e.validate(w);w.baseId=N,e.util.varOccurences(O,C)<2?a+=" "+e.util.varReplace(O,C,I)+" ":a+=" var "+C+" = "+I+"; "+O+" ",a+=" if ("+T+") break; } ",e.compositeRule=w.compositeRule=A,a+=" "+S+" if (!"+T+") {"}else a+=" if ("+g+".length == 0) {";var L=L||[];L.push(a),a="",e.createErrors!==!1?(a+=" { keyword: 'contains' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: {} ",e.opts.messages!==!1&&(a+=" , message: 'should contain a valid item' "),e.opts.verbose&&(a+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+g+" "),a+=" } "):a+=" {} ";var M=a;return a=L.pop(),!e.compositeRule&&h?e.async?a+=" throw new ValidationError(["+M+"]); ":a+=" validate.errors = ["+M+"]; return false; ":a+=" var err = "+M+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } else { ",k&&(a+=" errors = "+y+"; if (vErrors !== null) { if ("+y+") vErrors.length = "+y+"; else vErrors = null; } "),e.opts.allErrors&&(a+=" } "),a}),ib}var sb,kI;function B8(){return kI||(kI=1,sb=function(e,r,n){var a=" ",s=e.level,l=e.dataLevel,c=e.schema[r],d=e.schemaPath+e.util.getProperty(r),f=e.errSchemaPath+"/"+r,h=!e.opts.allErrors,g="data"+(l||""),v="errs__"+s,y=e.util.copy(e),w="";y.level++;var S="valid"+y.level,T={},x={},_=e.opts.ownProperties;for(A in c)if(A!="__proto__"){var C=c[A],N=Array.isArray(C)?x:T;N[A]=C}a+="var "+v+" = errors;";var k=e.errorPath;a+="var missing"+s+";";for(var A in x)if(N=x[A],N.length){if(a+=" if ( "+g+e.util.getProperty(A)+" !== undefined ",_&&(a+=" && Object.prototype.hasOwnProperty.call("+g+", '"+e.util.escapeQuotes(A)+"') "),h){a+=" && ( ";var I=N;if(I)for(var O,L=-1,M=I.length-1;L<M;){O=I[L+=1],L&&(a+=" || ");var P=e.util.getProperty(O),W=g+P;a+=" ( ( "+W+" === undefined ",_&&(a+=" || ! Object.prototype.hasOwnProperty.call("+g+", '"+e.util.escapeQuotes(O)+"') "),a+=") && (missing"+s+" = "+e.util.toQuotedString(e.opts.jsonPointers?O:P)+") ) "}a+=")) { ";var X="missing"+s,ee="' + "+X+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.opts.jsonPointers?e.util.getPathExpr(k,X,!0):k+" + "+X);var J=J||[];J.push(a),a="",e.createErrors!==!1?(a+=" { keyword: 'dependencies' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { property: '"+e.util.escapeQuotes(A)+"', missingProperty: '"+ee+"', depsCount: "+N.length+", deps: '"+e.util.escapeQuotes(N.length==1?N[0]:N.join(", "))+"' } ",e.opts.messages!==!1&&(a+=" , message: 'should have ",N.length==1?a+="property "+e.util.escapeQuotes(N[0]):a+="properties "+e.util.escapeQuotes(N.join(", ")),a+=" when property "+e.util.escapeQuotes(A)+" is present' "),e.opts.verbose&&(a+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+g+" "),a+=" } "):a+=" {} ";var B=a;a=J.pop(),!e.compositeRule&&h?e.async?a+=" throw new ValidationError(["+B+"]); ":a+=" validate.errors = ["+B+"]; return false; ":a+=" var err = "+B+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else{a+=" ) { ";var Y=N;if(Y)for(var O,H=-1,re=Y.length-1;H<re;){O=Y[H+=1];var P=e.util.getProperty(O),ee=e.util.escapeQuotes(O),W=g+P;e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(k,O,e.opts.jsonPointers)),a+=" if ( "+W+" === undefined ",_&&(a+=" || ! Object.prototype.hasOwnProperty.call("+g+", '"+e.util.escapeQuotes(O)+"') "),a+=") { var err = ",e.createErrors!==!1?(a+=" { keyword: 'dependencies' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { property: '"+e.util.escapeQuotes(A)+"', missingProperty: '"+ee+"', depsCount: "+N.length+", deps: '"+e.util.escapeQuotes(N.length==1?N[0]:N.join(", "))+"' } ",e.opts.messages!==!1&&(a+=" , message: 'should have ",N.length==1?a+="property "+e.util.escapeQuotes(N[0]):a+="properties "+e.util.escapeQuotes(N.join(", ")),a+=" when property "+e.util.escapeQuotes(A)+" is present' "),e.opts.verbose&&(a+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+g+" "),a+=" } "):a+=" {} ",a+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } "}}a+=" } ",h&&(w+="}",a+=" else { ")}e.errorPath=k;var Q=y.baseId;for(var A in T){var C=T[A];(e.opts.strictKeywords?typeof C=="object"&&Object.keys(C).length>0||C===!1:e.util.schemaHasRules(C,e.RULES.all))&&(a+=" "+S+" = true; if ( "+g+e.util.getProperty(A)+" !== undefined ",_&&(a+=" && Object.prototype.hasOwnProperty.call("+g+", '"+e.util.escapeQuotes(A)+"') "),a+=") { ",y.schema=C,y.schemaPath=d+e.util.getProperty(A),y.errSchemaPath=f+"/"+e.util.escapeFragment(A),a+=" "+e.validate(y)+" ",y.baseId=Q,a+=" } ",h&&(a+=" if ("+S+") { ",w+="}"))}return h&&(a+=" "+w+" if ("+v+" == errors) {"),a}),sb}var lb,II;function q8(){return II||(II=1,lb=function(e,r,n){var a=" ",s=e.level,l=e.dataLevel,c=e.schema[r],d=e.schemaPath+e.util.getProperty(r),f=e.errSchemaPath+"/"+r,h=!e.opts.allErrors,g="data"+(l||""),v="valid"+s,y=e.opts.$data&&c&&c.$data;y&&(a+=" var schema"+s+" = "+e.util.getData(c.$data,l,e.dataPathArr)+"; ");var w="i"+s,S="schema"+s;y||(a+=" var "+S+" = validate.schema"+d+";"),a+="var "+v+";",y&&(a+=" if (schema"+s+" === undefined) "+v+" = true; else if (!Array.isArray(schema"+s+")) "+v+" = false; else {"),a+=""+v+" = false;for (var "+w+"=0; "+w+"<"+S+".length; "+w+"++) if (equal("+g+", "+S+"["+w+"])) { "+v+" = true; break; }",y&&(a+=" } "),a+=" if (!"+v+") { ";var T=T||[];T.push(a),a="",e.createErrors!==!1?(a+=" { keyword: 'enum' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { allowedValues: schema"+s+" } ",e.opts.messages!==!1&&(a+=" , message: 'should be equal to one of the allowed values' "),e.opts.verbose&&(a+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+g+" "),a+=" } "):a+=" {} ";var x=a;return a=T.pop(),!e.compositeRule&&h?e.async?a+=" throw new ValidationError(["+x+"]); ":a+=" validate.errors = ["+x+"]; return false; ":a+=" var err = "+x+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" }",h&&(a+=" else { "),a}),lb}var cb,OI;function H8(){return OI||(OI=1,cb=function(e,r,n){var a=" ",s=e.level,l=e.dataLevel,c=e.schema[r],d=e.schemaPath+e.util.getProperty(r),f=e.errSchemaPath+"/"+r,h=!e.opts.allErrors,g="data"+(l||"");if(e.opts.format===!1)return h&&(a+=" if (true) { "),a;var v=e.opts.$data&&c&&c.$data,y;v?(a+=" var schema"+s+" = "+e.util.getData(c.$data,l,e.dataPathArr)+"; ",y="schema"+s):y=c;var w=e.opts.unknownFormats,S=Array.isArray(w);if(v){var T="format"+s,x="isObject"+s,_="formatType"+s;a+=" var "+T+" = formats["+y+"]; var "+x+" = typeof "+T+" == 'object' && !("+T+" instanceof RegExp) && "+T+".validate; var "+_+" = "+x+" && "+T+".type || 'string'; if ("+x+") { ",e.async&&(a+=" var async"+s+" = "+T+".async; "),a+=" "+T+" = "+T+".validate; } if ( ",v&&(a+=" ("+y+" !== undefined && typeof "+y+" != 'string') || "),a+=" (",w!="ignore"&&(a+=" ("+y+" && !"+T+" ",S&&(a+=" && self._opts.unknownFormats.indexOf("+y+") == -1 "),a+=") || "),a+=" ("+T+" && "+_+" == '"+n+"' && !(typeof "+T+" == 'function' ? ",e.async?a+=" (async"+s+" ? await "+T+"("+g+") : "+T+"("+g+")) ":a+=" "+T+"("+g+") ",a+=" : "+T+".test("+g+"))))) {"}else{var T=e.formats[c];if(!T){if(w=="ignore")return e.logger.warn('unknown format "'+c+'" ignored in schema at path "'+e.errSchemaPath+'"'),h&&(a+=" if (true) { "),a;if(S&&w.indexOf(c)>=0)return h&&(a+=" if (true) { "),a;throw new Error('unknown format "'+c+'" is used in schema at path "'+e.errSchemaPath+'"')}var x=typeof T=="object"&&!(T instanceof RegExp)&&T.validate,_=x&&T.type||"string";if(x){var C=T.async===!0;T=T.validate}if(_!=n)return h&&(a+=" if (true) { "),a;if(C){if(!e.async)throw new Error("async format in sync schema");var N="formats"+e.util.getProperty(c)+".validate";a+=" if (!(await "+N+"("+g+"))) { "}else{a+=" if (! ";var N="formats"+e.util.getProperty(c);x&&(N+=".validate"),typeof T=="function"?a+=" "+N+"("+g+") ":a+=" "+N+".test("+g+") ",a+=") { "}}var k=k||[];k.push(a),a="",e.createErrors!==!1?(a+=" { keyword: 'format' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { format: ",v?a+=""+y:a+=""+e.util.toQuotedString(c),a+=" } ",e.opts.messages!==!1&&(a+=` , message: 'should match format "`,v?a+="' + "+y+" + '":a+=""+e.util.escapeQuotes(c),a+=`"' `),e.opts.verbose&&(a+=" , schema: ",v?a+="validate.schema"+d:a+=""+e.util.toQuotedString(c),a+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+g+" "),a+=" } "):a+=" {} ";var A=a;return a=k.pop(),!e.compositeRule&&h?e.async?a+=" throw new ValidationError(["+A+"]); ":a+=" validate.errors = ["+A+"]; return false; ":a+=" var err = "+A+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } ",h&&(a+=" else { "),a}),cb}var ub,DI;function V8(){return DI||(DI=1,ub=function(e,r,n){var a=" ",s=e.level,l=e.dataLevel,c=e.schema[r],d=e.schemaPath+e.util.getProperty(r),f=e.errSchemaPath+"/"+r,h=!e.opts.allErrors,g="data"+(l||""),v="valid"+s,y="errs__"+s,w=e.util.copy(e);w.level++;var S="valid"+w.level,T=e.schema.then,x=e.schema.else,_=T!==void 0&&(e.opts.strictKeywords?typeof T=="object"&&Object.keys(T).length>0||T===!1:e.util.schemaHasRules(T,e.RULES.all)),C=x!==void 0&&(e.opts.strictKeywords?typeof x=="object"&&Object.keys(x).length>0||x===!1:e.util.schemaHasRules(x,e.RULES.all)),N=w.baseId;if(_||C){var k;w.createErrors=!1,w.schema=c,w.schemaPath=d,w.errSchemaPath=f,a+=" var "+y+" = errors; var "+v+" = true; ";var A=e.compositeRule;e.compositeRule=w.compositeRule=!0,a+=" "+e.validate(w)+" ",w.baseId=N,w.createErrors=!0,a+=" errors = "+y+"; if (vErrors !== null) { if ("+y+") vErrors.length = "+y+"; else vErrors = null; } ",e.compositeRule=w.compositeRule=A,_?(a+=" if ("+S+") { ",w.schema=e.schema.then,w.schemaPath=e.schemaPath+".then",w.errSchemaPath=e.errSchemaPath+"/then",a+=" "+e.validate(w)+" ",w.baseId=N,a+=" "+v+" = "+S+"; ",_&&C?(k="ifClause"+s,a+=" var "+k+" = 'then'; "):k="'then'",a+=" } ",C&&(a+=" else { ")):a+=" if (!"+S+") { ",C&&(w.schema=e.schema.else,w.schemaPath=e.schemaPath+".else",w.errSchemaPath=e.errSchemaPath+"/else",a+=" "+e.validate(w)+" ",w.baseId=N,a+=" "+v+" = "+S+"; ",_&&C?(k="ifClause"+s,a+=" var "+k+" = 'else'; "):k="'else'",a+=" } "),a+=" if (!"+v+") { var err = ",e.createErrors!==!1?(a+=" { keyword: 'if' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { failingKeyword: "+k+" } ",e.opts.messages!==!1&&(a+=` , message: 'should match "' + `+k+` + '" schema' `),e.opts.verbose&&(a+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+g+" "),a+=" } "):a+=" {} ",a+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&h&&(e.async?a+=" throw new ValidationError(vErrors); ":a+=" validate.errors = vErrors; return false; "),a+=" } ",h&&(a+=" else { ")}else h&&(a+=" if (true) { ");return a}),ub}var db,LI;function G8(){return LI||(LI=1,db=function(e,r,n){var a=" ",s=e.level,l=e.dataLevel,c=e.schema[r],d=e.schemaPath+e.util.getProperty(r),f=e.errSchemaPath+"/"+r,h=!e.opts.allErrors,g="data"+(l||""),v="valid"+s,y="errs__"+s,w=e.util.copy(e),S="";w.level++;var T="valid"+w.level,x="i"+s,_=w.dataLevel=e.dataLevel+1,C="data"+_,N=e.baseId;if(a+="var "+y+" = errors;var "+v+";",Array.isArray(c)){var k=e.schema.additionalItems;if(k===!1){a+=" "+v+" = "+g+".length <= "+c.length+"; ";var A=f;f=e.errSchemaPath+"/additionalItems",a+=" if (!"+v+") { ";var I=I||[];I.push(a),a="",e.createErrors!==!1?(a+=" { keyword: 'additionalItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { limit: "+c.length+" } ",e.opts.messages!==!1&&(a+=" , message: 'should NOT have more than "+c.length+" items' "),e.opts.verbose&&(a+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+g+" "),a+=" } "):a+=" {} ";var O=a;a=I.pop(),!e.compositeRule&&h?e.async?a+=" throw new ValidationError(["+O+"]); ":a+=" validate.errors = ["+O+"]; return false; ":a+=" var err = "+O+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } ",f=A,h&&(S+="}",a+=" else { ")}var L=c;if(L){for(var M,P=-1,W=L.length-1;P<W;)if(M=L[P+=1],e.opts.strictKeywords?typeof M=="object"&&Object.keys(M).length>0||M===!1:e.util.schemaHasRules(M,e.RULES.all)){a+=" "+T+" = true; if ("+g+".length > "+P+") { ";var X=g+"["+P+"]";w.schema=M,w.schemaPath=d+"["+P+"]",w.errSchemaPath=f+"/"+P,w.errorPath=e.util.getPathExpr(e.errorPath,P,e.opts.jsonPointers,!0),w.dataPathArr[_]=P;var ee=e.validate(w);w.baseId=N,e.util.varOccurences(ee,C)<2?a+=" "+e.util.varReplace(ee,C,X)+" ":a+=" var "+C+" = "+X+"; "+ee+" ",a+=" } ",h&&(a+=" if ("+T+") { ",S+="}")}}if(typeof k=="object"&&(e.opts.strictKeywords?typeof k=="object"&&Object.keys(k).length>0||k===!1:e.util.schemaHasRules(k,e.RULES.all))){w.schema=k,w.schemaPath=e.schemaPath+".additionalItems",w.errSchemaPath=e.errSchemaPath+"/additionalItems",a+=" "+T+" = true; if ("+g+".length > "+c.length+") { for (var "+x+" = "+c.length+"; "+x+" < "+g+".length; "+x+"++) { ",w.errorPath=e.util.getPathExpr(e.errorPath,x,e.opts.jsonPointers,!0);var X=g+"["+x+"]";w.dataPathArr[_]=x;var ee=e.validate(w);w.baseId=N,e.util.varOccurences(ee,C)<2?a+=" "+e.util.varReplace(ee,C,X)+" ":a+=" var "+C+" = "+X+"; "+ee+" ",h&&(a+=" if (!"+T+") break; "),a+=" } } ",h&&(a+=" if ("+T+") { ",S+="}")}}else if(e.opts.strictKeywords?typeof c=="object"&&Object.keys(c).length>0||c===!1:e.util.schemaHasRules(c,e.RULES.all)){w.schema=c,w.schemaPath=d,w.errSchemaPath=f,a+=" for (var "+x+" = 0; "+x+" < "+g+".length; "+x+"++) { ",w.errorPath=e.util.getPathExpr(e.errorPath,x,e.opts.jsonPointers,!0);var X=g+"["+x+"]";w.dataPathArr[_]=x;var ee=e.validate(w);w.baseId=N,e.util.varOccurences(ee,C)<2?a+=" "+e.util.varReplace(ee,C,X)+" ":a+=" var "+C+" = "+X+"; "+ee+" ",h&&(a+=" if (!"+T+") break; "),a+=" }"}return h&&(a+=" "+S+" if ("+y+" == errors) {"),a}),db}var fb,MI;function PI(){return MI||(MI=1,fb=function(e,r,n){var a=" ",s=e.level,l=e.dataLevel,c=e.schema[r],d=e.schemaPath+e.util.getProperty(r),f=e.errSchemaPath+"/"+r,h=!e.opts.allErrors,N,g="data"+(l||""),v=e.opts.$data&&c&&c.$data,y;v?(a+=" var schema"+s+" = "+e.util.getData(c.$data,l,e.dataPathArr)+"; ",y="schema"+s):y=c;var w=r=="maximum",S=w?"exclusiveMaximum":"exclusiveMinimum",T=e.schema[S],x=e.opts.$data&&T&&T.$data,_=w?"<":">",C=w?">":"<",N=void 0;if(!(v||typeof c=="number"||c===void 0))throw new Error(r+" must be number");if(!(x||T===void 0||typeof T=="number"||typeof T=="boolean"))throw new Error(S+" must be number or boolean");if(x){var k=e.util.getData(T.$data,l,e.dataPathArr),A="exclusive"+s,I="exclType"+s,O="exclIsNumber"+s,L="op"+s,M="' + "+L+" + '";a+=" var schemaExcl"+s+" = "+k+"; ",k="schemaExcl"+s,a+=" var "+A+"; var "+I+" = typeof "+k+"; if ("+I+" != 'boolean' && "+I+" != 'undefined' && "+I+" != 'number') { ";var N=S,P=P||[];P.push(a),a="",e.createErrors!==!1?(a+=" { keyword: '"+(N||"_exclusiveLimit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: {} ",e.opts.messages!==!1&&(a+=" , message: '"+S+" should be boolean' "),e.opts.verbose&&(a+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+g+" "),a+=" } "):a+=" {} ";var W=a;a=P.pop(),!e.compositeRule&&h?e.async?a+=" throw new ValidationError(["+W+"]); ":a+=" validate.errors = ["+W+"]; return false; ":a+=" var err = "+W+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } else if ( ",v&&(a+=" ("+y+" !== undefined && typeof "+y+" != 'number') || "),a+=" "+I+" == 'number' ? ( ("+A+" = "+y+" === undefined || "+k+" "+_+"= "+y+") ? "+g+" "+C+"= "+k+" : "+g+" "+C+" "+y+" ) : ( ("+A+" = "+k+" === true) ? "+g+" "+C+"= "+y+" : "+g+" "+C+" "+y+" ) || "+g+" !== "+g+") { var op"+s+" = "+A+" ? '"+_+"' : '"+_+"='; ",c===void 0&&(N=S,f=e.errSchemaPath+"/"+S,y=k,v=x)}else{var O=typeof T=="number",M=_;if(O&&v){var L="'"+M+"'";a+=" if ( ",v&&(a+=" ("+y+" !== undefined && typeof "+y+" != 'number') || "),a+=" ( "+y+" === undefined || "+T+" "+_+"= "+y+" ? "+g+" "+C+"= "+T+" : "+g+" "+C+" "+y+" ) || "+g+" !== "+g+") { "}else{O&&c===void 0?(A=!0,N=S,f=e.errSchemaPath+"/"+S,y=T,C+="="):(O&&(y=Math[w?"min":"max"](T,c)),T===(O?y:!0)?(A=!0,N=S,f=e.errSchemaPath+"/"+S,C+="="):(A=!1,M+="="));var L="'"+M+"'";a+=" if ( ",v&&(a+=" ("+y+" !== undefined && typeof "+y+" != 'number') || "),a+=" "+g+" "+C+" "+y+" || "+g+" !== "+g+") { "}}N=N||r;var P=P||[];P.push(a),a="",e.createErrors!==!1?(a+=" { keyword: '"+(N||"_limit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { comparison: "+L+", limit: "+y+", exclusive: "+A+" } ",e.opts.messages!==!1&&(a+=" , message: 'should be "+M+" ",v?a+="' + "+y:a+=""+y+"'"),e.opts.verbose&&(a+=" , schema: ",v?a+="validate.schema"+d:a+=""+c,a+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+g+" "),a+=" } "):a+=" {} ";var W=a;return a=P.pop(),!e.compositeRule&&h?e.async?a+=" throw new ValidationError(["+W+"]); ":a+=" validate.errors = ["+W+"]; return false; ":a+=" var err = "+W+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } ",h&&(a+=" else { "),a}),fb}var pb,jI;function UI(){return jI||(jI=1,pb=function(e,r,n){var a=" ",s=e.level,l=e.dataLevel,c=e.schema[r],d=e.schemaPath+e.util.getProperty(r),f=e.errSchemaPath+"/"+r,h=!e.opts.allErrors,S,g="data"+(l||""),v=e.opts.$data&&c&&c.$data,y;if(v?(a+=" var schema"+s+" = "+e.util.getData(c.$data,l,e.dataPathArr)+"; ",y="schema"+s):y=c,!(v||typeof c=="number"))throw new Error(r+" must be number");var w=r=="maxItems"?">":"<";a+="if ( ",v&&(a+=" ("+y+" !== undefined && typeof "+y+" != 'number') || "),a+=" "+g+".length "+w+" "+y+") { ";var S=r,T=T||[];T.push(a),a="",e.createErrors!==!1?(a+=" { keyword: '"+(S||"_limitItems")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { limit: "+y+" } ",e.opts.messages!==!1&&(a+=" , message: 'should NOT have ",r=="maxItems"?a+="more":a+="fewer",a+=" than ",v?a+="' + "+y+" + '":a+=""+c,a+=" items' "),e.opts.verbose&&(a+=" , schema: ",v?a+="validate.schema"+d:a+=""+c,a+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+g+" "),a+=" } "):a+=" {} ";var x=a;return a=T.pop(),!e.compositeRule&&h?e.async?a+=" throw new ValidationError(["+x+"]); ":a+=" validate.errors = ["+x+"]; return false; ":a+=" var err = "+x+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+="} ",h&&(a+=" else { "),a}),pb}var mb,FI;function zI(){return FI||(FI=1,mb=function(e,r,n){var a=" ",s=e.level,l=e.dataLevel,c=e.schema[r],d=e.schemaPath+e.util.getProperty(r),f=e.errSchemaPath+"/"+r,h=!e.opts.allErrors,S,g="data"+(l||""),v=e.opts.$data&&c&&c.$data,y;if(v?(a+=" var schema"+s+" = "+e.util.getData(c.$data,l,e.dataPathArr)+"; ",y="schema"+s):y=c,!(v||typeof c=="number"))throw new Error(r+" must be number");var w=r=="maxLength"?">":"<";a+="if ( ",v&&(a+=" ("+y+" !== undefined && typeof "+y+" != 'number') || "),e.opts.unicode===!1?a+=" "+g+".length ":a+=" ucs2length("+g+") ",a+=" "+w+" "+y+") { ";var S=r,T=T||[];T.push(a),a="",e.createErrors!==!1?(a+=" { keyword: '"+(S||"_limitLength")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { limit: "+y+" } ",e.opts.messages!==!1&&(a+=" , message: 'should NOT be ",r=="maxLength"?a+="longer":a+="shorter",a+=" than ",v?a+="' + "+y+" + '":a+=""+c,a+=" characters' "),e.opts.verbose&&(a+=" , schema: ",v?a+="validate.schema"+d:a+=""+c,a+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+g+" "),a+=" } "):a+=" {} ";var x=a;return a=T.pop(),!e.compositeRule&&h?e.async?a+=" throw new ValidationError(["+x+"]); ":a+=" validate.errors = ["+x+"]; return false; ":a+=" var err = "+x+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+="} ",h&&(a+=" else { "),a}),mb}var hb,$I;function BI(){return $I||($I=1,hb=function(e,r,n){var a=" ",s=e.level,l=e.dataLevel,c=e.schema[r],d=e.schemaPath+e.util.getProperty(r),f=e.errSchemaPath+"/"+r,h=!e.opts.allErrors,S,g="data"+(l||""),v=e.opts.$data&&c&&c.$data,y;if(v?(a+=" var schema"+s+" = "+e.util.getData(c.$data,l,e.dataPathArr)+"; ",y="schema"+s):y=c,!(v||typeof c=="number"))throw new Error(r+" must be number");var w=r=="maxProperties"?">":"<";a+="if ( ",v&&(a+=" ("+y+" !== undefined && typeof "+y+" != 'number') || "),a+=" Object.keys("+g+").length "+w+" "+y+") { ";var S=r,T=T||[];T.push(a),a="",e.createErrors!==!1?(a+=" { keyword: '"+(S||"_limitProperties")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { limit: "+y+" } ",e.opts.messages!==!1&&(a+=" , message: 'should NOT have ",r=="maxProperties"?a+="more":a+="fewer",a+=" than ",v?a+="' + "+y+" + '":a+=""+c,a+=" properties' "),e.opts.verbose&&(a+=" , schema: ",v?a+="validate.schema"+d:a+=""+c,a+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+g+" "),a+=" } "):a+=" {} ";var x=a;return a=T.pop(),!e.compositeRule&&h?e.async?a+=" throw new ValidationError(["+x+"]); ":a+=" validate.errors = ["+x+"]; return false; ":a+=" var err = "+x+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+="} ",h&&(a+=" else { "),a}),hb}var gb,qI;function W8(){return qI||(qI=1,gb=function(e,r,n){var a=" ",s=e.level,l=e.dataLevel,c=e.schema[r],d=e.schemaPath+e.util.getProperty(r),f=e.errSchemaPath+"/"+r,h=!e.opts.allErrors,g="data"+(l||""),v=e.opts.$data&&c&&c.$data,y;if(v?(a+=" var schema"+s+" = "+e.util.getData(c.$data,l,e.dataPathArr)+"; ",y="schema"+s):y=c,!(v||typeof c=="number"))throw new Error(r+" must be number");a+="var division"+s+";if (",v&&(a+=" "+y+" !== undefined && ( typeof "+y+" != 'number' || "),a+=" (division"+s+" = "+g+" / "+y+", ",e.opts.multipleOfPrecision?a+=" Math.abs(Math.round(division"+s+") - division"+s+") > 1e-"+e.opts.multipleOfPrecision+" ":a+=" division"+s+" !== parseInt(division"+s+") ",a+=" ) ",v&&(a+=" ) "),a+=" ) { ";var w=w||[];w.push(a),a="",e.createErrors!==!1?(a+=" { keyword: 'multipleOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { multipleOf: "+y+" } ",e.opts.messages!==!1&&(a+=" , message: 'should be multiple of ",v?a+="' + "+y:a+=""+y+"'"),e.opts.verbose&&(a+=" , schema: ",v?a+="validate.schema"+d:a+=""+c,a+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+g+" "),a+=" } "):a+=" {} ";var S=a;return a=w.pop(),!e.compositeRule&&h?e.async?a+=" throw new ValidationError(["+S+"]); ":a+=" validate.errors = ["+S+"]; return false; ":a+=" var err = "+S+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+="} ",h&&(a+=" else { "),a}),gb}var vb,HI;function Y8(){return HI||(HI=1,vb=function(e,r,n){var a=" ",s=e.level,l=e.dataLevel,c=e.schema[r],d=e.schemaPath+e.util.getProperty(r),f=e.errSchemaPath+"/"+r,h=!e.opts.allErrors,g="data"+(l||""),v="errs__"+s,y=e.util.copy(e);y.level++;var w="valid"+y.level;if(e.opts.strictKeywords?typeof c=="object"&&Object.keys(c).length>0||c===!1:e.util.schemaHasRules(c,e.RULES.all)){y.schema=c,y.schemaPath=d,y.errSchemaPath=f,a+=" var "+v+" = errors; ";var S=e.compositeRule;e.compositeRule=y.compositeRule=!0,y.createErrors=!1;var T;y.opts.allErrors&&(T=y.opts.allErrors,y.opts.allErrors=!1),a+=" "+e.validate(y)+" ",y.createErrors=!0,T&&(y.opts.allErrors=T),e.compositeRule=y.compositeRule=S,a+=" if ("+w+") { ";var x=x||[];x.push(a),a="",e.createErrors!==!1?(a+=" { keyword: 'not' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: {} ",e.opts.messages!==!1&&(a+=" , message: 'should NOT be valid' "),e.opts.verbose&&(a+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+g+" "),a+=" } "):a+=" {} ";var _=a;a=x.pop(),!e.compositeRule&&h?e.async?a+=" throw new ValidationError(["+_+"]); ":a+=" validate.errors = ["+_+"]; return false; ":a+=" var err = "+_+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } else { errors = "+v+"; if (vErrors !== null) { if ("+v+") vErrors.length = "+v+"; else vErrors = null; } ",e.opts.allErrors&&(a+=" } ")}else a+=" var err = ",e.createErrors!==!1?(a+=" { keyword: 'not' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: {} ",e.opts.messages!==!1&&(a+=" , message: 'should NOT be valid' "),e.opts.verbose&&(a+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+g+" "),a+=" } "):a+=" {} ",a+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",h&&(a+=" if (false) { ");return a}),vb}var bb,VI;function K8(){return VI||(VI=1,bb=function(e,r,n){var a=" ",s=e.level,l=e.dataLevel,c=e.schema[r],d=e.schemaPath+e.util.getProperty(r),f=e.errSchemaPath+"/"+r,h=!e.opts.allErrors,g="data"+(l||""),v="valid"+s,y="errs__"+s,w=e.util.copy(e),S="";w.level++;var T="valid"+w.level,x=w.baseId,_="prevValid"+s,C="passingSchemas"+s;a+="var "+y+" = errors , "+_+" = false , "+v+" = false , "+C+" = null; ";var N=e.compositeRule;e.compositeRule=w.compositeRule=!0;var k=c;if(k)for(var A,I=-1,O=k.length-1;I<O;)A=k[I+=1],(e.opts.strictKeywords?typeof A=="object"&&Object.keys(A).length>0||A===!1:e.util.schemaHasRules(A,e.RULES.all))?(w.schema=A,w.schemaPath=d+"["+I+"]",w.errSchemaPath=f+"/"+I,a+=" "+e.validate(w)+" ",w.baseId=x):a+=" var "+T+" = true; ",I&&(a+=" if ("+T+" && "+_+") { "+v+" = false; "+C+" = ["+C+", "+I+"]; } else { ",S+="}"),a+=" if ("+T+") { "+v+" = "+_+" = true; "+C+" = "+I+"; }";return e.compositeRule=w.compositeRule=N,a+=""+S+"if (!"+v+") { var err = ",e.createErrors!==!1?(a+=" { keyword: 'oneOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { passingSchemas: "+C+" } ",e.opts.messages!==!1&&(a+=" , message: 'should match exactly one schema in oneOf' "),e.opts.verbose&&(a+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+g+" "),a+=" } "):a+=" {} ",a+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&h&&(e.async?a+=" throw new ValidationError(vErrors); ":a+=" validate.errors = vErrors; return false; "),a+="} else { errors = "+y+"; if (vErrors !== null) { if ("+y+") vErrors.length = "+y+"; else vErrors = null; }",e.opts.allErrors&&(a+=" } "),a}),bb}var yb,GI;function Z8(){return GI||(GI=1,yb=function(e,r,n){var a=" ",s=e.level,l=e.dataLevel,c=e.schema[r],d=e.schemaPath+e.util.getProperty(r),f=e.errSchemaPath+"/"+r,h=!e.opts.allErrors,g="data"+(l||""),v=e.opts.$data&&c&&c.$data,y;v?(a+=" var schema"+s+" = "+e.util.getData(c.$data,l,e.dataPathArr)+"; ",y="schema"+s):y=c;var w=v?"(new RegExp("+y+"))":e.usePattern(c);a+="if ( ",v&&(a+=" ("+y+" !== undefined && typeof "+y+" != 'string') || "),a+=" !"+w+".test("+g+") ) { ";var S=S||[];S.push(a),a="",e.createErrors!==!1?(a+=" { keyword: 'pattern' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { pattern: ",v?a+=""+y:a+=""+e.util.toQuotedString(c),a+=" } ",e.opts.messages!==!1&&(a+=` , message: 'should match pattern "`,v?a+="' + "+y+" + '":a+=""+e.util.escapeQuotes(c),a+=`"' `),e.opts.verbose&&(a+=" , schema: ",v?a+="validate.schema"+d:a+=""+e.util.toQuotedString(c),a+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+g+" "),a+=" } "):a+=" {} ";var T=a;return a=S.pop(),!e.compositeRule&&h?e.async?a+=" throw new ValidationError(["+T+"]); ":a+=" validate.errors = ["+T+"]; return false; ":a+=" var err = "+T+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+="} ",h&&(a+=" else { "),a}),yb}var Eb,WI;function X8(){return WI||(WI=1,Eb=function(e,r,n){var a=" ",s=e.level,l=e.dataLevel,c=e.schema[r],d=e.schemaPath+e.util.getProperty(r),f=e.errSchemaPath+"/"+r,h=!e.opts.allErrors,g="data"+(l||""),v="errs__"+s,y=e.util.copy(e),w="";y.level++;var S="valid"+y.level,T="key"+s,x="idx"+s,_=y.dataLevel=e.dataLevel+1,C="data"+_,N="dataProperties"+s,k=Object.keys(c||{}).filter(H),A=e.schema.patternProperties||{},I=Object.keys(A).filter(H),O=e.schema.additionalProperties,L=k.length||I.length,M=O===!1,P=typeof O=="object"&&Object.keys(O).length,W=e.opts.removeAdditional,X=M||P||W,ee=e.opts.ownProperties,J=e.baseId,B=e.schema.required;if(B&&!(e.opts.$data&&B.$data)&&B.length<e.opts.loopRequired)var Y=e.util.toHash(B);function H(Ve){return Ve!=="__proto__"}if(a+="var "+v+" = errors;var "+S+" = true;",ee&&(a+=" var "+N+" = undefined;"),X){if(ee?a+=" "+N+" = "+N+" || Object.keys("+g+"); for (var "+x+"=0; "+x+"<"+N+".length; "+x+"++) { var "+T+" = "+N+"["+x+"]; ":a+=" for (var "+T+" in "+g+") { ",L){if(a+=" var isAdditional"+s+" = !(false ",k.length)if(k.length>8)a+=" || validate.schema"+d+".hasOwnProperty("+T+") ";else{var re=k;if(re)for(var Q,j=-1,q=re.length-1;j<q;)Q=re[j+=1],a+=" || "+T+" == "+e.util.toQuotedString(Q)+" "}if(I.length){var z=I;if(z)for(var G,Z=-1,U=z.length-1;Z<U;)G=z[Z+=1],a+=" || "+e.usePattern(G)+".test("+T+") "}a+=" ); if (isAdditional"+s+") { "}if(W=="all")a+=" delete "+g+"["+T+"]; ";else{var F=e.errorPath,te="' + "+T+" + '";if(e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(e.errorPath,T,e.opts.jsonPointers)),M)if(W)a+=" delete "+g+"["+T+"]; ";else{a+=" "+S+" = false; ";var fe=f;f=e.errSchemaPath+"/additionalProperties";var V=V||[];V.push(a),a="",e.createErrors!==!1?(a+=" { keyword: 'additionalProperties' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { additionalProperty: '"+te+"' } ",e.opts.messages!==!1&&(a+=" , message: '",e.opts._errorDataPathProperty?a+="is an invalid additional property":a+="should NOT have additional properties",a+="' "),e.opts.verbose&&(a+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+g+" "),a+=" } "):a+=" {} ";var de=a;a=V.pop(),!e.compositeRule&&h?e.async?a+=" throw new ValidationError(["+de+"]); ":a+=" validate.errors = ["+de+"]; return false; ":a+=" var err = "+de+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",f=fe,h&&(a+=" break; ")}else if(P)if(W=="failing"){a+=" var "+v+" = errors; ";var le=e.compositeRule;e.compositeRule=y.compositeRule=!0,y.schema=O,y.schemaPath=e.schemaPath+".additionalProperties",y.errSchemaPath=e.errSchemaPath+"/additionalProperties",y.errorPath=e.opts._errorDataPathProperty?e.errorPath:e.util.getPathExpr(e.errorPath,T,e.opts.jsonPointers);var pe=g+"["+T+"]";y.dataPathArr[_]=T;var Re=e.validate(y);y.baseId=J,e.util.varOccurences(Re,C)<2?a+=" "+e.util.varReplace(Re,C,pe)+" ":a+=" var "+C+" = "+pe+"; "+Re+" ",a+=" if (!"+S+") { errors = "+v+"; if (validate.errors !== null) { if (errors) validate.errors.length = errors; else validate.errors = null; } delete "+g+"["+T+"]; } ",e.compositeRule=y.compositeRule=le}else{y.schema=O,y.schemaPath=e.schemaPath+".additionalProperties",y.errSchemaPath=e.errSchemaPath+"/additionalProperties",y.errorPath=e.opts._errorDataPathProperty?e.errorPath:e.util.getPathExpr(e.errorPath,T,e.opts.jsonPointers);var pe=g+"["+T+"]";y.dataPathArr[_]=T;var Re=e.validate(y);y.baseId=J,e.util.varOccurences(Re,C)<2?a+=" "+e.util.varReplace(Re,C,pe)+" ":a+=" var "+C+" = "+pe+"; "+Re+" ",h&&(a+=" if (!"+S+") break; ")}e.errorPath=F}L&&(a+=" } "),a+=" } ",h&&(a+=" if ("+S+") { ",w+="}")}var Ke=e.opts.useDefaults&&!e.compositeRule;if(k.length){var je=k;if(je)for(var Q,ze=-1,_e=je.length-1;ze<_e;){Q=je[ze+=1];var Ae=c[Q];if(e.opts.strictKeywords?typeof Ae=="object"&&Object.keys(Ae).length>0||Ae===!1:e.util.schemaHasRules(Ae,e.RULES.all)){var $e=e.util.getProperty(Q),pe=g+$e,oe=Ke&&Ae.default!==void 0;y.schema=Ae,y.schemaPath=d+$e,y.errSchemaPath=f+"/"+e.util.escapeFragment(Q),y.errorPath=e.util.getPath(e.errorPath,Q,e.opts.jsonPointers),y.dataPathArr[_]=e.util.toQuotedString(Q);var Re=e.validate(y);if(y.baseId=J,e.util.varOccurences(Re,C)<2){Re=e.util.varReplace(Re,C,pe);var Se=pe}else{var Se=C;a+=" var "+C+" = "+pe+"; "}if(oe)a+=" "+Re+" ";else{if(Y&&Y[Q]){a+=" if ( "+Se+" === undefined ",ee&&(a+=" || ! Object.prototype.hasOwnProperty.call("+g+", '"+e.util.escapeQuotes(Q)+"') "),a+=") { "+S+" = false; ";var F=e.errorPath,fe=f,Le=e.util.escapeQuotes(Q);e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(F,Q,e.opts.jsonPointers)),f=e.errSchemaPath+"/required";var V=V||[];V.push(a),a="",e.createErrors!==!1?(a+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { missingProperty: '"+Le+"' } ",e.opts.messages!==!1&&(a+=" , message: '",e.opts._errorDataPathProperty?a+="is a required property":a+="should have required property \\'"+Le+"\\'",a+="' "),e.opts.verbose&&(a+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+g+" "),a+=" } "):a+=" {} ";var de=a;a=V.pop(),!e.compositeRule&&h?e.async?a+=" throw new ValidationError(["+de+"]); ":a+=" validate.errors = ["+de+"]; return false; ":a+=" var err = "+de+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",f=fe,e.errorPath=F,a+=" } else { "}else h?(a+=" if ( "+Se+" === undefined ",ee&&(a+=" || ! Object.prototype.hasOwnProperty.call("+g+", '"+e.util.escapeQuotes(Q)+"') "),a+=") { "+S+" = true; } else { "):(a+=" if ("+Se+" !== undefined ",ee&&(a+=" && Object.prototype.hasOwnProperty.call("+g+", '"+e.util.escapeQuotes(Q)+"') "),a+=" ) { ");a+=" "+Re+" } "}}h&&(a+=" if ("+S+") { ",w+="}")}}if(I.length){var we=I;if(we)for(var G,ke=-1,Oe=we.length-1;ke<Oe;){G=we[ke+=1];var Ae=A[G];if(e.opts.strictKeywords?typeof Ae=="object"&&Object.keys(Ae).length>0||Ae===!1:e.util.schemaHasRules(Ae,e.RULES.all)){y.schema=Ae,y.schemaPath=e.schemaPath+".patternProperties"+e.util.getProperty(G),y.errSchemaPath=e.errSchemaPath+"/patternProperties/"+e.util.escapeFragment(G),ee?a+=" "+N+" = "+N+" || Object.keys("+g+"); for (var "+x+"=0; "+x+"<"+N+".length; "+x+"++) { var "+T+" = "+N+"["+x+"]; ":a+=" for (var "+T+" in "+g+") { ",a+=" if ("+e.usePattern(G)+".test("+T+")) { ",y.errorPath=e.util.getPathExpr(e.errorPath,T,e.opts.jsonPointers);var pe=g+"["+T+"]";y.dataPathArr[_]=T;var Re=e.validate(y);y.baseId=J,e.util.varOccurences(Re,C)<2?a+=" "+e.util.varReplace(Re,C,pe)+" ":a+=" var "+C+" = "+pe+"; "+Re+" ",h&&(a+=" if (!"+S+") break; "),a+=" } ",h&&(a+=" else "+S+" = true; "),a+=" } ",h&&(a+=" if ("+S+") { ",w+="}")}}}return h&&(a+=" "+w+" if ("+v+" == errors) {"),a}),Eb}var Sb,YI;function Q8(){return YI||(YI=1,Sb=function(e,r,n){var a=" ",s=e.level,l=e.dataLevel,c=e.schema[r],d=e.schemaPath+e.util.getProperty(r),f=e.errSchemaPath+"/"+r,h=!e.opts.allErrors,g="data"+(l||""),v="errs__"+s,y=e.util.copy(e),w="";y.level++;var S="valid"+y.level;if(a+="var "+v+" = errors;",e.opts.strictKeywords?typeof c=="object"&&Object.keys(c).length>0||c===!1:e.util.schemaHasRules(c,e.RULES.all)){y.schema=c,y.schemaPath=d,y.errSchemaPath=f;var T="key"+s,x="idx"+s,_="i"+s,C="' + "+T+" + '",N=y.dataLevel=e.dataLevel+1,k="data"+N,A="dataProperties"+s,I=e.opts.ownProperties,O=e.baseId;I&&(a+=" var "+A+" = undefined; "),I?a+=" "+A+" = "+A+" || Object.keys("+g+"); for (var "+x+"=0; "+x+"<"+A+".length; "+x+"++) { var "+T+" = "+A+"["+x+"]; ":a+=" for (var "+T+" in "+g+") { ",a+=" var startErrs"+s+" = errors; ";var L=T,M=e.compositeRule;e.compositeRule=y.compositeRule=!0;var P=e.validate(y);y.baseId=O,e.util.varOccurences(P,k)<2?a+=" "+e.util.varReplace(P,k,L)+" ":a+=" var "+k+" = "+L+"; "+P+" ",e.compositeRule=y.compositeRule=M,a+=" if (!"+S+") { for (var "+_+"=startErrs"+s+"; "+_+"<errors; "+_+"++) { vErrors["+_+"].propertyName = "+T+"; } var err = ",e.createErrors!==!1?(a+=" { keyword: 'propertyNames' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { propertyName: '"+C+"' } ",e.opts.messages!==!1&&(a+=" , message: 'property name \\'"+C+"\\' is invalid' "),e.opts.verbose&&(a+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+g+" "),a+=" } "):a+=" {} ",a+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&h&&(e.async?a+=" throw new ValidationError(vErrors); ":a+=" validate.errors = vErrors; return false; "),h&&(a+=" break; "),a+=" } }"}return h&&(a+=" "+w+" if ("+v+" == errors) {"),a}),Sb}var xb,KI;function J8(){return KI||(KI=1,xb=function(e,r,n){var a=" ",s=e.level,l=e.dataLevel,c=e.schema[r],d=e.schemaPath+e.util.getProperty(r),f=e.errSchemaPath+"/"+r,h=!e.opts.allErrors,g="data"+(l||""),v="valid"+s,y=e.opts.$data&&c&&c.$data;y&&(a+=" var schema"+s+" = "+e.util.getData(c.$data,l,e.dataPathArr)+"; ");var w="schema"+s;if(!y)if(c.length<e.opts.loopRequired&&e.schema.properties&&Object.keys(e.schema.properties).length){var S=[],T=c;if(T)for(var x,_=-1,C=T.length-1;_<C;){x=T[_+=1];var N=e.schema.properties[x];N&&(e.opts.strictKeywords?typeof N=="object"&&Object.keys(N).length>0||N===!1:e.util.schemaHasRules(N,e.RULES.all))||(S[S.length]=x)}}else var S=c;if(y||S.length){var k=e.errorPath,A=y||S.length>=e.opts.loopRequired,I=e.opts.ownProperties;if(h)if(a+=" var missing"+s+"; ",A){y||(a+=" var "+w+" = validate.schema"+d+"; ");var O="i"+s,L="schema"+s+"["+O+"]",M="' + "+L+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(k,L,e.opts.jsonPointers)),a+=" var "+v+" = true; ",y&&(a+=" if (schema"+s+" === undefined) "+v+" = true; else if (!Array.isArray(schema"+s+")) "+v+" = false; else {"),a+=" for (var "+O+" = 0; "+O+" < "+w+".length; "+O+"++) { "+v+" = "+g+"["+w+"["+O+"]] !== undefined ",I&&(a+=" && Object.prototype.hasOwnProperty.call("+g+", "+w+"["+O+"]) "),a+="; if (!"+v+") break; } ",y&&(a+=" } "),a+=" if (!"+v+") { ";var P=P||[];P.push(a),a="",e.createErrors!==!1?(a+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { missingProperty: '"+M+"' } ",e.opts.messages!==!1&&(a+=" , message: '",e.opts._errorDataPathProperty?a+="is a required property":a+="should have required property \\'"+M+"\\'",a+="' "),e.opts.verbose&&(a+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+g+" "),a+=" } "):a+=" {} ";var W=a;a=P.pop(),!e.compositeRule&&h?e.async?a+=" throw new ValidationError(["+W+"]); ":a+=" validate.errors = ["+W+"]; return false; ":a+=" var err = "+W+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } else { "}else{a+=" if ( ";var X=S;if(X)for(var ee,O=-1,J=X.length-1;O<J;){ee=X[O+=1],O&&(a+=" || ");var B=e.util.getProperty(ee),Y=g+B;a+=" ( ( "+Y+" === undefined ",I&&(a+=" || ! Object.prototype.hasOwnProperty.call("+g+", '"+e.util.escapeQuotes(ee)+"') "),a+=") && (missing"+s+" = "+e.util.toQuotedString(e.opts.jsonPointers?ee:B)+") ) "}a+=") { ";var L="missing"+s,M="' + "+L+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.opts.jsonPointers?e.util.getPathExpr(k,L,!0):k+" + "+L);var P=P||[];P.push(a),a="",e.createErrors!==!1?(a+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { missingProperty: '"+M+"' } ",e.opts.messages!==!1&&(a+=" , message: '",e.opts._errorDataPathProperty?a+="is a required property":a+="should have required property \\'"+M+"\\'",a+="' "),e.opts.verbose&&(a+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+g+" "),a+=" } "):a+=" {} ";var W=a;a=P.pop(),!e.compositeRule&&h?e.async?a+=" throw new ValidationError(["+W+"]); ":a+=" validate.errors = ["+W+"]; return false; ":a+=" var err = "+W+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } else { "}else if(A){y||(a+=" var "+w+" = validate.schema"+d+"; ");var O="i"+s,L="schema"+s+"["+O+"]",M="' + "+L+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(k,L,e.opts.jsonPointers)),y&&(a+=" if ("+w+" && !Array.isArray("+w+")) { var err = ",e.createErrors!==!1?(a+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { missingProperty: '"+M+"' } ",e.opts.messages!==!1&&(a+=" , message: '",e.opts._errorDataPathProperty?a+="is a required property":a+="should have required property \\'"+M+"\\'",a+="' "),e.opts.verbose&&(a+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+g+" "),a+=" } "):a+=" {} ",a+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } else if ("+w+" !== undefined) { "),a+=" for (var "+O+" = 0; "+O+" < "+w+".length; "+O+"++) { if ("+g+"["+w+"["+O+"]] === undefined ",I&&(a+=" || ! Object.prototype.hasOwnProperty.call("+g+", "+w+"["+O+"]) "),a+=") { var err = ",e.createErrors!==!1?(a+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { missingProperty: '"+M+"' } ",e.opts.messages!==!1&&(a+=" , message: '",e.opts._errorDataPathProperty?a+="is a required property":a+="should have required property \\'"+M+"\\'",a+="' "),e.opts.verbose&&(a+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+g+" "),a+=" } "):a+=" {} ",a+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } } ",y&&(a+=" } ")}else{var H=S;if(H)for(var ee,re=-1,Q=H.length-1;re<Q;){ee=H[re+=1];var B=e.util.getProperty(ee),M=e.util.escapeQuotes(ee),Y=g+B;e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(k,ee,e.opts.jsonPointers)),a+=" if ( "+Y+" === undefined ",I&&(a+=" || ! Object.prototype.hasOwnProperty.call("+g+", '"+e.util.escapeQuotes(ee)+"') "),a+=") { var err = ",e.createErrors!==!1?(a+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { missingProperty: '"+M+"' } ",e.opts.messages!==!1&&(a+=" , message: '",e.opts._errorDataPathProperty?a+="is a required property":a+="should have required property \\'"+M+"\\'",a+="' "),e.opts.verbose&&(a+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+g+" "),a+=" } "):a+=" {} ",a+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } "}}e.errorPath=k}else h&&(a+=" if (true) {");return a}),xb}var wb,ZI;function eW(){return ZI||(ZI=1,wb=function(e,r,n){var a=" ",s=e.level,l=e.dataLevel,c=e.schema[r],d=e.schemaPath+e.util.getProperty(r),f=e.errSchemaPath+"/"+r,h=!e.opts.allErrors,g="data"+(l||""),v="valid"+s,y=e.opts.$data&&c&&c.$data,w;if(y?(a+=" var schema"+s+" = "+e.util.getData(c.$data,l,e.dataPathArr)+"; ",w="schema"+s):w=c,(c||y)&&e.opts.uniqueItems!==!1){y&&(a+=" var "+v+"; if ("+w+" === false || "+w+" === undefined) "+v+" = true; else if (typeof "+w+" != 'boolean') "+v+" = false; else { "),a+=" var i = "+g+".length , "+v+" = true , j; if (i > 1) { ";var S=e.schema.items&&e.schema.items.type,T=Array.isArray(S);if(!S||S=="object"||S=="array"||T&&(S.indexOf("object")>=0||S.indexOf("array")>=0))a+=" outer: for (;i--;) { for (j = i; j--;) { if (equal("+g+"[i], "+g+"[j])) { "+v+" = false; break outer; } } } ";else{a+=" var itemIndices = {}, item; for (;i--;) { var item = "+g+"[i]; ";var x="checkDataType"+(T?"s":"");a+=" if ("+e.util[x](S,"item",e.opts.strictNumbers,!0)+") continue; ",T&&(a+=` if (typeof item == 'string') item = '"' + item; `),a+=" if (typeof itemIndices[item] == 'number') { "+v+" = false; j = itemIndices[item]; break; } itemIndices[item] = i; } "}a+=" } ",y&&(a+=" } "),a+=" if (!"+v+") { ";var _=_||[];_.push(a),a="",e.createErrors!==!1?(a+=" { keyword: 'uniqueItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { i: i, j: j } ",e.opts.messages!==!1&&(a+=" , message: 'should NOT have duplicate items (items ## ' + j + ' and ' + i + ' are identical)' "),e.opts.verbose&&(a+=" , schema: ",y?a+="validate.schema"+d:a+=""+c,a+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+g+" "),a+=" } "):a+=" {} ";var C=a;a=_.pop(),!e.compositeRule&&h?e.async?a+=" throw new ValidationError(["+C+"]); ":a+=" validate.errors = ["+C+"]; return false; ":a+=" var err = "+C+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } ",h&&(a+=" else { ")}else h&&(a+=" if (true) { ");return a}),wb}var _b,XI;function tW(){return XI||(XI=1,_b={$ref:P8(),allOf:j8(),anyOf:U8(),$comment:F8(),const:z8(),contains:$8(),dependencies:B8(),enum:q8(),format:H8(),if:V8(),items:G8(),maximum:PI(),minimum:PI(),maxItems:UI(),minItems:UI(),maxLength:zI(),minLength:zI(),maxProperties:BI(),minProperties:BI(),multipleOf:W8(),not:Y8(),oneOf:K8(),pattern:Z8(),properties:X8(),propertyNames:Q8(),required:J8(),uniqueItems:eW(),validate:g$()}),_b}var Tb,QI;function rW(){if(QI)return Tb;QI=1;var t=tW(),e=gc().toHash;return Tb=function(){var n=[{type:"number",rules:[{maximum:["exclusiveMaximum"]},{minimum:["exclusiveMinimum"]},"multipleOf","format"]},{type:"string",rules:["maxLength","minLength","pattern","format"]},{type:"array",rules:["maxItems","minItems","items","contains","uniqueItems"]},{type:"object",rules:["maxProperties","minProperties","required","dependencies","propertyNames",{properties:["additionalProperties","patternProperties"]}]},{rules:["$ref","const","enum","not","anyOf","oneOf","allOf","if"]}],a=["type","$comment"],s=["$schema","$id","id","$data","$async","title","description","default","definitions","examples","readOnly","writeOnly","contentMediaType","contentEncoding","additionalItems","then","else"],l=["number","integer","string","array","object","boolean","null"];return n.all=e(a),n.types=e(l),n.forEach(function(c){c.rules=c.rules.map(function(d){var f;if(typeof d=="object"){var h=Object.keys(d)[0];f=d[h],d=h,f.forEach(function(v){a.push(v),n.all[v]=!0})}a.push(d);var g=n.all[d]={keyword:d,code:t[d],implements:f};return g}),n.all.$comment={keyword:"$comment",code:t.$comment},c.type&&(n.types[c.type]=c)}),n.keywords=e(a.concat(s)),n.custom={},n},Tb}var Rb,JI;function nW(){if(JI)return Rb;JI=1;var t=["multipleOf","maximum","exclusiveMaximum","minimum","exclusiveMinimum","maxLength","minLength","pattern","additionalItems","maxItems","minItems","uniqueItems","maxProperties","minProperties","required","additionalProperties","enum","format","const"];return Rb=function(e,r){for(var n=0;n<r.length;n++){e=JSON.parse(JSON.stringify(e));var a=r[n].split("/"),s=e,l;for(l=1;l<a.length;l++)s=s[a[l]];for(l=0;l<t.length;l++){var c=t[l],d=s[c];d&&(s[c]={anyOf:[d,{$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"}]})}}return e},Rb}var Cb,eO;function aW(){if(eO)return Cb;eO=1;var t=mR().MissingRef;Cb=e;function e(r,n,a){var s=this;if(typeof this._opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");typeof n=="function"&&(a=n,n=void 0);var l=c(r).then(function(){var f=s._addSchema(r,void 0,n);return f.validate||d(f)});return a&&l.then(function(f){a(null,f)},a),l;function c(f){var h=f.$schema;return h&&!s.getSchema(h)?e.call(s,{$ref:h},!0):Promise.resolve()}function d(f){try{return s._compile(f)}catch(g){if(g instanceof t)return h(g);throw g}function h(g){var v=g.missingSchema;if(S(v))throw new Error("Schema "+v+" is loaded but "+g.missingRef+" cannot be resolved");var y=s._loadingSchemas[v];return y||(y=s._loadingSchemas[v]=s._opts.loadSchema(v),y.then(w,w)),y.then(function(T){if(!S(v))return c(T).then(function(){S(v)||s.addSchema(T,v,void 0,n)})}).then(function(){return d(f)});function w(){delete s._loadingSchemas[v]}function S(T){return s._refs[T]||s._schemas[T]}}}}return Cb}var Ab,tO;function oW(){return tO||(tO=1,Ab=function(e,r,n){var a=" ",s=e.level,l=e.dataLevel,c=e.schema[r],d=e.schemaPath+e.util.getProperty(r),f=e.errSchemaPath+"/"+r,h=!e.opts.allErrors,g,v="data"+(l||""),y="valid"+s,w="errs__"+s,S=e.opts.$data&&c&&c.$data,T;S?(a+=" var schema"+s+" = "+e.util.getData(c.$data,l,e.dataPathArr)+"; ",T="schema"+s):T=c;var x=this,_="definition"+s,C=x.definition,N="",k,A,I,O,L;if(S&&C.$data){L="keywordValidate"+s;var M=C.validateSchema;a+=" var "+_+" = RULES.custom['"+r+"'].definition; var "+L+" = "+_+".validate;"}else{if(O=e.useCustomRule(x,c,e.schema,e),!O)return;T="validate.schema"+d,L=O.code,k=C.compile,A=C.inline,I=C.macro}var P=L+".errors",W="i"+s,X="ruleErr"+s,ee=C.async;if(ee&&!e.async)throw new Error("async keyword in sync schema");if(A||I||(a+=""+P+" = null;"),a+="var "+w+" = errors;var "+y+";",S&&C.$data&&(N+="}",a+=" if ("+T+" === undefined) { "+y+" = true; } else { ",M&&(N+="}",a+=" "+y+" = "+_+".validateSchema("+T+"); if ("+y+") { ")),A)C.statements?a+=" "+O.validate+" ":a+=" "+y+" = "+O.validate+"; ";else if(I){var J=e.util.copy(e),N="";J.level++;var B="valid"+J.level;J.schema=O.validate,J.schemaPath="";var Y=e.compositeRule;e.compositeRule=J.compositeRule=!0;var H=e.validate(J).replace(/validate\.schema/g,L);e.compositeRule=J.compositeRule=Y,a+=" "+H}else{var re=re||[];re.push(a),a="",a+=" "+L+".call( ",e.opts.passContext?a+="this":a+="self",k||C.schema===!1?a+=" , "+v+" ":a+=" , "+T+" , "+v+" , validate.schema"+e.schemaPath+" ",a+=" , (dataPath || '')",e.errorPath!='""'&&(a+=" + "+e.errorPath);var Q=l?"data"+(l-1||""):"parentData",j=l?e.dataPathArr[l]:"parentDataProperty";a+=" , "+Q+" , "+j+" , rootData ) ";var q=a;a=re.pop(),C.errors===!1?(a+=" "+y+" = ",ee&&(a+="await "),a+=""+q+"; "):ee?(P="customErrors"+s,a+=" var "+P+" = null; try { "+y+" = await "+q+"; } catch (e) { "+y+" = false; if (e instanceof ValidationError) "+P+" = e.errors; else throw e; } "):a+=" "+P+" = null; "+y+" = "+q+"; "}if(C.modifying&&(a+=" if ("+Q+") "+v+" = "+Q+"["+j+"];"),a+=""+N,C.valid)h&&(a+=" if (true) { ");else{a+=" if ( ",C.valid===void 0?(a+=" !",I?a+=""+B:a+=""+y):a+=" "+!C.valid+" ",a+=") { ",g=x.keyword;var re=re||[];re.push(a),a="";var re=re||[];re.push(a),a="",e.createErrors!==!1?(a+=" { keyword: '"+(g||"custom")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { keyword: '"+x.keyword+"' } ",e.opts.messages!==!1&&(a+=` , message: 'should pass "`+x.keyword+`" keyword validation' `),e.opts.verbose&&(a+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+v+" "),a+=" } "):a+=" {} ";var z=a;a=re.pop(),!e.compositeRule&&h?e.async?a+=" throw new ValidationError(["+z+"]); ":a+=" validate.errors = ["+z+"]; return false; ":a+=" var err = "+z+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";var G=a;a=re.pop(),A?C.errors?C.errors!="full"&&(a+=" for (var "+W+"="+w+"; "+W+"<errors; "+W+"++) { var "+X+" = vErrors["+W+"]; if ("+X+".dataPath === undefined) "+X+".dataPath = (dataPath || '') + "+e.errorPath+"; if ("+X+".schemaPath === undefined) { "+X+'.schemaPath = "'+f+'"; } ',e.opts.verbose&&(a+=" "+X+".schema = "+T+"; "+X+".data = "+v+"; "),a+=" } "):C.errors===!1?a+=" "+G+" ":(a+=" if ("+w+" == errors) { "+G+" } else { for (var "+W+"="+w+"; "+W+"<errors; "+W+"++) { var "+X+" = vErrors["+W+"]; if ("+X+".dataPath === undefined) "+X+".dataPath = (dataPath || '') + "+e.errorPath+"; if ("+X+".schemaPath === undefined) { "+X+'.schemaPath = "'+f+'"; } ',e.opts.verbose&&(a+=" "+X+".schema = "+T+"; "+X+".data = "+v+"; "),a+=" } } "):I?(a+=" var err = ",e.createErrors!==!1?(a+=" { keyword: '"+(g||"custom")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { keyword: '"+x.keyword+"' } ",e.opts.messages!==!1&&(a+=` , message: 'should pass "`+x.keyword+`" keyword validation' `),e.opts.verbose&&(a+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+v+" "),a+=" } "):a+=" {} ",a+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&h&&(e.async?a+=" throw new ValidationError(vErrors); ":a+=" validate.errors = vErrors; return false; ")):C.errors===!1?a+=" "+G+" ":(a+=" if (Array.isArray("+P+")) { if (vErrors === null) vErrors = "+P+"; else vErrors = vErrors.concat("+P+"); errors = vErrors.length; for (var "+W+"="+w+"; "+W+"<errors; "+W+"++) { var "+X+" = vErrors["+W+"]; if ("+X+".dataPath === undefined) "+X+".dataPath = (dataPath || '') + "+e.errorPath+"; "+X+'.schemaPath = "'+f+'"; ',e.opts.verbose&&(a+=" "+X+".schema = "+T+"; "+X+".data = "+v+"; "),a+=" } } else { "+G+" } "),a+=" } ",h&&(a+=" else { ")}return a}),Ab}const iW="http://json-schema.org/draft-07/schema#",sW="http://json-schema.org/draft-07/schema#",lW="Core schema meta-schema",cW={schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},uW=["object","boolean"],dW={$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},v$={$schema:iW,$id:sW,title:lW,definitions:cW,type:uW,properties:dW,default:!0};var Nb,rO;function fW(){if(rO)return Nb;rO=1;var t=v$;return Nb={$id:"https://github.com/ajv-validator/ajv/blob/master/lib/definition_schema.js",definitions:{simpleTypes:t.definitions.simpleTypes},type:"object",dependencies:{schema:["validate"],$data:["validate"],statements:["inline"],valid:{not:{required:["macro"]}}},properties:{type:t.properties.type,schema:{type:"boolean"},statements:{type:"boolean"},dependencies:{type:"array",items:{type:"string"}},metaSchema:{type:"object"},modifying:{type:"boolean"},valid:{type:"boolean"},$data:{type:"boolean"},async:{type:"boolean"},errors:{anyOf:[{type:"boolean"},{const:"full"}]}}},Nb}var kb,nO;function pW(){if(nO)return kb;nO=1;var t=/^[a-z_$][a-z0-9_$-]*$/i,e=oW(),r=fW();kb={add:n,get:a,remove:s,validate:l};function n(c,d){var f=this.RULES;if(f.keywords[c])throw new Error("Keyword "+c+" is already defined");if(!t.test(c))throw new Error("Keyword "+c+" is not a valid identifier");if(d){this.validateKeyword(d,!0);var h=d.type;if(Array.isArray(h))for(var g=0;g<h.length;g++)y(c,h[g],d);else y(c,h,d);var v=d.metaSchema;v&&(d.$data&&this._opts.$data&&(v={anyOf:[v,{$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"}]}),d.validateSchema=this.compile(v,!0))}f.keywords[c]=f.all[c]=!0;function y(w,S,T){for(var x,_=0;_<f.length;_++){var C=f[_];if(C.type==S){x=C;break}}x||(x={type:S,rules:[]},f.push(x));var N={keyword:w,definition:T,custom:!0,code:e,implements:T.implements};x.rules.push(N),f.custom[w]=N}return this}function a(c){var d=this.RULES.custom[c];return d?d.definition:this.RULES.keywords[c]||!1}function s(c){var d=this.RULES;delete d.keywords[c],delete d.all[c],delete d.custom[c];for(var f=0;f<d.length;f++)for(var h=d[f].rules,g=0;g<h.length;g++)if(h[g].keyword==c){h.splice(g,1);break}return this}function l(c,d){l.errors=null;var f=this._validateKeyword=this._validateKeyword||this.compile(r,!0);if(f(c))return!0;if(l.errors=f.errors,d)throw new Error("custom keyword definition is invalid: "+this.errorsText(f.errors));return!1}return kb}const mW="http://json-schema.org/draft-07/schema#",hW="https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",gW="Meta-schema for $data reference (JSON Schema extension proposal)",vW="object",bW=["$data"],yW={$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},EW=!1,SW={$schema:mW,$id:hW,description:gW,type:vW,required:bW,properties:yW,additionalProperties:EW};var Ib,aO;function xW(){if(aO)return Ib;aO=1;var t=D8(),e=pR(),r=L8(),n=m$(),a=h$(),s=M8(),l=rW(),c=nW(),d=gc();Ib=w,w.prototype.validate=S,w.prototype.compile=T,w.prototype.addSchema=x,w.prototype.addMetaSchema=_,w.prototype.validateSchema=C,w.prototype.getSchema=k,w.prototype.removeSchema=O,w.prototype.addFormat=Y,w.prototype.errorsText=B,w.prototype._addSchema=M,w.prototype._compile=P,w.prototype.compileAsync=aW();var f=pW();w.prototype.addKeyword=f.add,w.prototype.getKeyword=f.get,w.prototype.removeKeyword=f.remove,w.prototype.validateKeyword=f.validate;var h=mR();w.ValidationError=h.Validation,w.MissingRefError=h.MissingRef,w.$dataMetaSchema=c;var g="http://json-schema.org/draft-07/schema",v=["removeAdditional","useDefaults","coerceTypes","strictDefaults"],y=["/properties"];function w(U){if(!(this instanceof w))return new w(U);U=this._opts=d.copy(U)||{},G(this),this._schemas={},this._refs={},this._fragments={},this._formats=s(U.format),this._cache=U.cache||new r,this._loadingSchemas={},this._compilations=[],this.RULES=l(),this._getId=W(U),U.loopRequired=U.loopRequired||1/0,U.errorDataPath=="property"&&(U._errorDataPathProperty=!0),U.serialize===void 0&&(U.serialize=a),this._metaOpts=z(this),U.formats&&Q(this),U.keywords&&j(this),H(this),typeof U.meta=="object"&&this.addMetaSchema(U.meta),U.nullable&&this.addKeyword("nullable",{metaSchema:{type:"boolean"}}),re(this)}function S(U,F){var te;if(typeof U=="string"){if(te=this.getSchema(U),!te)throw new Error('no schema with key or ref "'+U+'"')}else{var fe=this._addSchema(U);te=fe.validate||this._compile(fe)}var V=te(F);return te.$async!==!0&&(this.errors=te.errors),V}function T(U,F){var te=this._addSchema(U,void 0,F);return te.validate||this._compile(te)}function x(U,F,te,fe){if(Array.isArray(U)){for(var V=0;V<U.length;V++)this.addSchema(U[V],void 0,te,fe);return this}var de=this._getId(U);if(de!==void 0&&typeof de!="string")throw new Error("schema id must be string");return F=e.normalizeId(F||de),q(this,F),this._schemas[F]=this._addSchema(U,te,fe,!0),this}function _(U,F,te){return this.addSchema(U,F,te,!0),this}function C(U,F){var te=U.$schema;if(te!==void 0&&typeof te!="string")throw new Error("$schema must be a string");if(te=te||this._opts.defaultMeta||N(this),!te)return this.logger.warn("meta-schema not available"),this.errors=null,!0;var fe=this.validate(te,U);if(!fe&&F){var V="schema is invalid: "+this.errorsText();if(this._opts.validateSchema=="log")this.logger.error(V);else throw new Error(V)}return fe}function N(U){var F=U._opts.meta;return U._opts.defaultMeta=typeof F=="object"?U._getId(F)||F:U.getSchema(g)?g:void 0,U._opts.defaultMeta}function k(U){var F=I(this,U);switch(typeof F){case"object":return F.validate||this._compile(F);case"string":return this.getSchema(F);case"undefined":return A(this,U)}}function A(U,F){var te=e.schema.call(U,{schema:{}},F);if(te){var fe=te.schema,V=te.root,de=te.baseId,le=t.call(U,fe,V,void 0,de);return U._fragments[F]=new n({ref:F,fragment:!0,schema:fe,root:V,baseId:de,validate:le}),le}}function I(U,F){return F=e.normalizeId(F),U._schemas[F]||U._refs[F]||U._fragments[F]}function O(U){if(U instanceof RegExp)return L(this,this._schemas,U),L(this,this._refs,U),this;switch(typeof U){case"undefined":return L(this,this._schemas),L(this,this._refs),this._cache.clear(),this;case"string":var F=I(this,U);return F&&this._cache.del(F.cacheKey),delete this._schemas[U],delete this._refs[U],this;case"object":var te=this._opts.serialize,fe=te?te(U):U;this._cache.del(fe);var V=this._getId(U);V&&(V=e.normalizeId(V),delete this._schemas[V],delete this._refs[V])}return this}function L(U,F,te){for(var fe in F){var V=F[fe];!V.meta&&(!te||te.test(fe))&&(U._cache.del(V.cacheKey),delete F[fe])}}function M(U,F,te,fe){if(typeof U!="object"&&typeof U!="boolean")throw new Error("schema should be object or boolean");var V=this._opts.serialize,de=V?V(U):U,le=this._cache.get(de);if(le)return le;fe=fe||this._opts.addUsedSchema!==!1;var pe=e.normalizeId(this._getId(U));pe&&fe&&q(this,pe);var Re=this._opts.validateSchema!==!1&&!F,Ke;Re&&!(Ke=pe&&pe==e.normalizeId(U.$schema))&&this.validateSchema(U,!0);var je=e.ids.call(this,U),ze=new n({id:pe,schema:U,localRefs:je,cacheKey:de,meta:te});return pe[0]!="#"&&fe&&(this._refs[pe]=ze),this._cache.put(de,ze),Re&&Ke&&this.validateSchema(U,!0),ze}function P(U,F){if(U.compiling)return U.validate=V,V.schema=U.schema,V.errors=null,V.root=F||V,U.schema.$async===!0&&(V.$async=!0),V;U.compiling=!0;var te;U.meta&&(te=this._opts,this._opts=this._metaOpts);var fe;try{fe=t.call(this,U.schema,F,U.localRefs)}catch(de){throw delete U.validate,de}finally{U.compiling=!1,U.meta&&(this._opts=te)}return U.validate=fe,U.refs=fe.refs,U.refVal=fe.refVal,U.root=fe.root,fe;function V(){var de=U.validate,le=de.apply(this,arguments);return V.errors=de.errors,le}}function W(U){switch(U.schemaId){case"auto":return J;case"id":return X;default:return ee}}function X(U){return U.$id&&this.logger.warn("schema $id ignored",U.$id),U.id}function ee(U){return U.id&&this.logger.warn("schema id ignored",U.id),U.$id}function J(U){if(U.$id&&U.id&&U.$id!=U.id)throw new Error("schema $id is different from id");return U.$id||U.id}function B(U,F){if(U=U||this.errors,!U)return"No errors";F=F||{};for(var te=F.separator===void 0?", ":F.separator,fe=F.dataVar===void 0?"data":F.dataVar,V="",de=0;de<U.length;de++){var le=U[de];le&&(V+=fe+le.dataPath+" "+le.message+te)}return V.slice(0,-te.length)}function Y(U,F){return typeof F=="string"&&(F=new RegExp(F)),this._formats[U]=F,this}function H(U){var F;if(U._opts.$data&&(F=SW,U.addMetaSchema(F,F.$id,!0)),U._opts.meta!==!1){var te=v$;U._opts.$data&&(te=c(te,y)),U.addMetaSchema(te,g,!0),U._refs["http://json-schema.org/schema"]=g}}function re(U){var F=U._opts.schemas;if(F)if(Array.isArray(F))U.addSchema(F);else for(var te in F)U.addSchema(F[te],te)}function Q(U){for(var F in U._opts.formats){var te=U._opts.formats[F];U.addFormat(F,te)}}function j(U){for(var F in U._opts.keywords){var te=U._opts.keywords[F];U.addKeyword(F,te)}}function q(U,F){if(U._schemas[F]||U._refs[F])throw new Error('schema with key or id "'+F+'" already exists')}function z(U){for(var F=d.copy(U._opts),te=0;te<v.length;te++)delete F[v[te]];return F}function G(U){var F=U._opts.logger;if(F===!1)U.logger={log:Z,warn:Z,error:Z};else{if(F===void 0&&(F=console),!(typeof F=="object"&&F.log&&F.warn&&F.error))throw new Error("logger must implement log, warn and error methods");U.logger=F}}function Z(){}return Ib}var wW=xW();const _W=hc(wW);class oO extends C8{constructor(e,r){var n;super(r),this._clientInfo=e,this._cachedToolOutputValidators=new Map,this._capabilities=(n=r?.capabilities)!==null&&n!==void 0?n:{},this._ajv=new _W}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=A8(this._capabilities,e)}assertCapability(e,r){var n;if(!(!((n=this._serverCapabilities)===null||n===void 0)&&n[e]))throw new Error(`Server does not support ${e} (required for ${r})`)}async connect(e,r){if(await super.connect(e),e.sessionId===void 0)try{const n=await this.request({method:"initialize",params:{protocolVersion:zm,capabilities:this._capabilities,clientInfo:this._clientInfo}},Jz,r);if(n===void 0)throw new Error(`Server sent invalid initialize result: ${n}`);if(!A9.includes(n.protocolVersion))throw new Error(`Server's protocol version is not supported: ${n.protocolVersion}`);this._serverCapabilities=n.capabilities,this._serverVersion=n.serverInfo,e.setProtocolVersion&&e.setProtocolVersion(n.protocolVersion),this._instructions=n.instructions,await this.notification({method:"notifications/initialized"})}catch(n){throw this.close(),n}}getServerCapabilities(){return this._serverCapabilities}getServerVersion(){return this._serverVersion}getInstructions(){return this._instructions}assertCapabilityForMethod(e){var r,n,a,s,l;switch(e){case"logging/setLevel":if(!(!((r=this._serverCapabilities)===null||r===void 0)&&r.logging))throw new Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!(!((n=this._serverCapabilities)===null||n===void 0)&&n.prompts))throw new Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":case"resources/subscribe":case"resources/unsubscribe":if(!(!((a=this._serverCapabilities)===null||a===void 0)&&a.resources))throw new Error(`Server does not support resources (required for ${e})`);if(e==="resources/subscribe"&&!this._serverCapabilities.resources.subscribe)throw new Error(`Server does not support resource subscriptions (required for ${e})`);break;case"tools/call":case"tools/list":if(!(!((s=this._serverCapabilities)===null||s===void 0)&&s.tools))throw new Error(`Server does not support tools (required for ${e})`);break;case"completion/complete":if(!(!((l=this._serverCapabilities)===null||l===void 0)&&l.completions))throw new Error(`Server does not support completions (required for ${e})`);break}}assertNotificationCapability(e){var r;switch(e){case"notifications/roots/list_changed":if(!(!((r=this._capabilities.roots)===null||r===void 0)&&r.listChanged))throw new Error(`Client does not support roots list changed notifications (required for ${e})`);break}}assertRequestHandlerCapability(e){switch(e){case"sampling/createMessage":if(!this._capabilities.sampling)throw new Error(`Client does not support sampling capability (required for ${e})`);break;case"elicitation/create":if(!this._capabilities.elicitation)throw new Error(`Client does not support elicitation capability (required for ${e})`);break;case"roots/list":if(!this._capabilities.roots)throw new Error(`Client does not support roots capability (required for ${e})`);break}}async ping(e){return this.request({method:"ping"},Il,e)}async complete(e,r){return this.request({method:"completion/complete",params:e},p$,r)}async setLoggingLevel(e,r){return this.request({method:"logging/setLevel",params:{level:e}},Il,r)}async getPrompt(e,r){return this.request({method:"prompts/get",params:e},u$,r)}async listPrompts(e,r){return this.request({method:"prompts/list",params:e},l$,r)}async listResources(e,r){return this.request({method:"resources/list",params:e},o$,r)}async listResourceTemplates(e,r){return this.request({method:"resources/templates/list",params:e},i$,r)}async readResource(e,r){return this.request({method:"resources/read",params:e},s$,r)}async subscribeResource(e,r){return this.request({method:"resources/subscribe",params:e},Il,r)}async unsubscribeResource(e,r){return this.request({method:"resources/unsubscribe",params:e},Il,r)}async callTool(e,r=dR,n){const a=await this.request({method:"tools/call",params:e},r,n),s=this.getToolOutputValidator(e.name);if(s){if(!a.structuredContent&&!a.isError)throw new wi(La.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`);if(a.structuredContent)try{if(!s(a.structuredContent))throw new wi(La.InvalidParams,`Structured content does not match the tool's output schema: ${this._ajv.errorsText(s.errors)}`)}catch(l){throw l instanceof wi?l:new wi(La.InvalidParams,`Failed to validate structured content: ${l instanceof Error?l.message:String(l)}`)}}return a}cacheToolOutputSchemas(e){this._cachedToolOutputValidators.clear();for(const r of e)if(r.outputSchema)try{const n=this._ajv.compile(r.outputSchema);this._cachedToolOutputValidators.set(r.name,n)}catch{}}getToolOutputValidator(e){return this._cachedToolOutputValidators.get(e)}async listTools(e,r){const n=await this.request({method:"tools/list",params:e},d$,r);return this.cacheToolOutputSchemas(n.tools),n}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}}let hR;hR=globalThis.crypto;async function TW(t){return(await hR).getRandomValues(new Uint8Array(t))}async function RW(t){const e="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~";let r="";const n=await TW(t);for(let a=0;a<t;a++){const s=n[a]%e.length;r+=e[s]}return r}async function CW(t){return await RW(t)}async function AW(t){const e=await(await hR).subtle.digest("SHA-256",new TextEncoder().encode(t));return btoa(String.fromCharCode(...new Uint8Array(e))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}async function NW(t){if(t||(t=43),t<43||t>128)throw`Expected a length between 43 and 128. Received ${t}.`;const e=await CW(t),r=await AW(e);return{code_verifier:e,code_challenge:r}}const Fr=be().url().superRefine((t,e)=>{if(!URL.canParse(t))return e.addIssue({code:Ie.custom,message:"URL must be parseable",fatal:!0}),C9}).refine(t=>{const e=new URL(t);return e.protocol!=="javascript:"&&e.protocol!=="data:"&&e.protocol!=="vbscript:"},{message:"URL cannot use javascript:, data:, or vbscript: scheme"}),kW=Pe({resource:be().url(),authorization_servers:Ze(Fr).optional(),jwks_uri:be().url().optional(),scopes_supported:Ze(be()).optional(),bearer_methods_supported:Ze(be()).optional(),resource_signing_alg_values_supported:Ze(be()).optional(),resource_name:be().optional(),resource_documentation:be().optional(),resource_policy_uri:be().url().optional(),resource_tos_uri:be().url().optional(),tls_client_certificate_bound_access_tokens:Pr().optional(),authorization_details_types_supported:Ze(be()).optional(),dpop_signing_alg_values_supported:Ze(be()).optional(),dpop_bound_access_tokens_required:Pr().optional()}).passthrough(),b$=Pe({issuer:be(),authorization_endpoint:Fr,token_endpoint:Fr,registration_endpoint:Fr.optional(),scopes_supported:Ze(be()).optional(),response_types_supported:Ze(be()),response_modes_supported:Ze(be()).optional(),grant_types_supported:Ze(be()).optional(),token_endpoint_auth_methods_supported:Ze(be()).optional(),token_endpoint_auth_signing_alg_values_supported:Ze(be()).optional(),service_documentation:Fr.optional(),revocation_endpoint:Fr.optional(),revocation_endpoint_auth_methods_supported:Ze(be()).optional(),revocation_endpoint_auth_signing_alg_values_supported:Ze(be()).optional(),introspection_endpoint:be().optional(),introspection_endpoint_auth_methods_supported:Ze(be()).optional(),introspection_endpoint_auth_signing_alg_values_supported:Ze(be()).optional(),code_challenge_methods_supported:Ze(be()).optional()}).passthrough(),IW=Pe({issuer:be(),authorization_endpoint:Fr,token_endpoint:Fr,userinfo_endpoint:Fr.optional(),jwks_uri:Fr,registration_endpoint:Fr.optional(),scopes_supported:Ze(be()).optional(),response_types_supported:Ze(be()),response_modes_supported:Ze(be()).optional(),grant_types_supported:Ze(be()).optional(),acr_values_supported:Ze(be()).optional(),subject_types_supported:Ze(be()),id_token_signing_alg_values_supported:Ze(be()),id_token_encryption_alg_values_supported:Ze(be()).optional(),id_token_encryption_enc_values_supported:Ze(be()).optional(),userinfo_signing_alg_values_supported:Ze(be()).optional(),userinfo_encryption_alg_values_supported:Ze(be()).optional(),userinfo_encryption_enc_values_supported:Ze(be()).optional(),request_object_signing_alg_values_supported:Ze(be()).optional(),request_object_encryption_alg_values_supported:Ze(be()).optional(),request_object_encryption_enc_values_supported:Ze(be()).optional(),token_endpoint_auth_methods_supported:Ze(be()).optional(),token_endpoint_auth_signing_alg_values_supported:Ze(be()).optional(),display_values_supported:Ze(be()).optional(),claim_types_supported:Ze(be()).optional(),claims_supported:Ze(be()).optional(),service_documentation:be().optional(),claims_locales_supported:Ze(be()).optional(),ui_locales_supported:Ze(be()).optional(),claims_parameter_supported:Pr().optional(),request_parameter_supported:Pr().optional(),request_uri_parameter_supported:Pr().optional(),require_request_uri_registration:Pr().optional(),op_policy_uri:Fr.optional(),op_tos_uri:Fr.optional()}).passthrough(),OW=IW.merge(b$.pick({code_challenge_methods_supported:!0})),y$=Pe({access_token:be(),id_token:be().optional(),token_type:be(),expires_in:$r().optional(),scope:be().optional(),refresh_token:be().optional()}).strip(),DW=Pe({error:be(),error_description:be().optional(),error_uri:be().optional()}),LW=Pe({redirect_uris:Ze(Fr),token_endpoint_auth_method:be().optional(),grant_types:Ze(be()).optional(),response_types:Ze(be()).optional(),client_name:be().optional(),client_uri:Fr.optional(),logo_uri:Fr.optional(),scope:be().optional(),contacts:Ze(be()).optional(),tos_uri:Fr.optional(),policy_uri:be().optional(),jwks_uri:Fr.optional(),jwks:T9().optional(),software_id:be().optional(),software_version:be().optional(),software_statement:be().optional()}).strip(),MW=Pe({client_id:be(),client_secret:be().optional(),client_id_issued_at:$r().optional(),client_secret_expires_at:$r().optional()}).strip(),PW=LW.merge(MW);Pe({error:be(),error_description:be().optional()}).strip();Pe({token:be(),token_type_hint:be().optional()}).strip();function jW(t){const e=typeof t=="string"?new URL(t):new URL(t.href);return e.hash="",e}function UW({requestedResource:t,configuredResource:e}){const r=typeof t=="string"?new URL(t):new URL(t.href),n=typeof e=="string"?new URL(e):new URL(e.href);if(r.origin!==n.origin||r.pathname.length<n.pathname.length)return!1;const a=r.pathname.endsWith("/")?r.pathname:r.pathname+"/",s=n.pathname.endsWith("/")?n.pathname:n.pathname+"/";return a.startsWith(s)}class Qr extends Error{constructor(e,r){super(e),this.errorUri=r,this.name=this.constructor.name}toResponseObject(){const e={error:this.errorCode,error_description:this.message};return this.errorUri&&(e.error_uri=this.errorUri),e}get errorCode(){return this.constructor.errorCode}}class A_ extends Qr{}A_.errorCode="invalid_request";class gm extends Qr{}gm.errorCode="invalid_client";class vm extends Qr{}vm.errorCode="invalid_grant";class bm extends Qr{}bm.errorCode="unauthorized_client";class N_ extends Qr{}N_.errorCode="unsupported_grant_type";class k_ extends Qr{}k_.errorCode="invalid_scope";class I_ extends Qr{}I_.errorCode="access_denied";class sc extends Qr{}sc.errorCode="server_error";class O_ extends Qr{}O_.errorCode="temporarily_unavailable";class D_ extends Qr{}D_.errorCode="unsupported_response_type";class L_ extends Qr{}L_.errorCode="unsupported_token_type";class M_ extends Qr{}M_.errorCode="invalid_token";class P_ extends Qr{}P_.errorCode="method_not_allowed";class j_ extends Qr{}j_.errorCode="too_many_requests";class U_ extends Qr{}U_.errorCode="invalid_client_metadata";class F_ extends Qr{}F_.errorCode="insufficient_scope";const FW={[A_.errorCode]:A_,[gm.errorCode]:gm,[vm.errorCode]:vm,[bm.errorCode]:bm,[N_.errorCode]:N_,[k_.errorCode]:k_,[I_.errorCode]:I_,[sc.errorCode]:sc,[O_.errorCode]:O_,[D_.errorCode]:D_,[L_.errorCode]:L_,[M_.errorCode]:M_,[P_.errorCode]:P_,[j_.errorCode]:j_,[U_.errorCode]:U_,[F_.errorCode]:F_};class Ma extends Error{constructor(e){super(e??"Unauthorized")}}const Ob="code",Db="S256";function E$(t,e){const r=t.client_secret!==void 0;return e.length===0?r?"client_secret_post":"none":r&&e.includes("client_secret_basic")?"client_secret_basic":r&&e.includes("client_secret_post")?"client_secret_post":e.includes("none")?"none":r?"client_secret_post":"none"}function S$(t,e,r,n){const{client_id:a,client_secret:s}=e;switch(t){case"client_secret_basic":zW(a,s,r);return;case"client_secret_post":$W(a,s,n);return;case"none":BW(a,n);return;default:throw new Error(`Unsupported client authentication method: ${t}`)}}function zW(t,e,r){if(!e)throw new Error("client_secret_basic authentication requires a client_secret");const n=btoa(`${t}:${e}`);r.set("Authorization",`Basic ${n}`)}function $W(t,e,r){r.set("client_id",t),e&&r.set("client_secret",e)}function BW(t,e){e.set("client_id",t)}async function gR(t){const e=t instanceof Response?t.status:void 0,r=t instanceof Response?await t.text():t;try{const n=DW.parse(JSON.parse(r)),{error:a,error_description:s,error_uri:l}=n,c=FW[a]||sc;return new c(s||"",l)}catch(n){const a=`${e?`HTTP ${e}: `:""}Invalid OAuth error response: ${n}. Raw body: ${r}`;return new sc(a)}}async function gs(t,e){var r,n;try{return await Lb(t,e)}catch(a){if(a instanceof gm||a instanceof bm)return await((r=t.invalidateCredentials)===null||r===void 0?void 0:r.call(t,"all")),await Lb(t,e);if(a instanceof vm)return await((n=t.invalidateCredentials)===null||n===void 0?void 0:n.call(t,"tokens")),await Lb(t,e);throw a}}async function Lb(t,{serverUrl:e,authorizationCode:r,scope:n,resourceMetadataUrl:a,fetchFn:s}){let l,c;try{l=await HW(e,{resourceMetadataUrl:a},s),l.authorization_servers&&l.authorization_servers.length>0&&(c=l.authorization_servers[0])}catch{}c||(c=e);const d=await qW(e,t,l),f=await KW(c,{fetchFn:s});let h=await Promise.resolve(t.clientInformation());if(!h){if(r!==void 0)throw new Error("Existing OAuth client information is required when exchanging an authorization code");if(!t.saveClientInformation)throw new Error("OAuth client information must be saveable for dynamic registration");const S=await JW(c,{metadata:f,clientMetadata:t.clientMetadata,fetchFn:s});await t.saveClientInformation(S),h=S}if(r!==void 0){const S=await t.codeVerifier(),T=await XW(c,{metadata:f,clientInformation:h,authorizationCode:r,codeVerifier:S,redirectUri:t.redirectUrl,resource:d,addClientAuthentication:t.addClientAuthentication,fetchFn:s});return await t.saveTokens(T),"AUTHORIZED"}const g=await t.tokens();if(g?.refresh_token)try{const S=await QW(c,{metadata:f,clientInformation:h,refreshToken:g.refresh_token,resource:d,addClientAuthentication:t.addClientAuthentication,fetchFn:s});return await t.saveTokens(S),"AUTHORIZED"}catch(S){if(!(!(S instanceof Qr)||S instanceof sc))throw S}const v=t.state?await t.state():void 0,{authorizationUrl:y,codeVerifier:w}=await ZW(c,{metadata:f,clientInformation:h,state:v,redirectUrl:t.redirectUrl,scope:n||t.clientMetadata.scope,resource:d});return await t.saveCodeVerifier(w),await t.redirectToAuthorization(y),"REDIRECT"}async function qW(t,e,r){const n=jW(t);if(e.validateResourceURL)return await e.validateResourceURL(n,r?.resource);if(r){if(!UW({requestedResource:n,configuredResource:r.resource}))throw new Error(`Protected resource ${r.resource} does not match expected ${n} (or origin)`);return new URL(r.resource)}}function z_(t){const e=t.headers.get("WWW-Authenticate");if(!e)return;const[r,n]=e.split(" ");if(r.toLowerCase()!=="bearer"||!n)return;const s=/resource_metadata="([^"]*)"/.exec(e);if(s)try{return new URL(s[1])}catch{return}}async function HW(t,e,r=fetch){const n=await WW(t,"oauth-protected-resource",r,{protocolVersion:e?.protocolVersion,metadataUrl:e?.resourceMetadataUrl});if(!n||n.status===404)throw new Error("Resource server does not implement OAuth 2.0 Protected Resource Metadata.");if(!n.ok)throw new Error(`HTTP ${n.status} trying to load well-known OAuth protected resource metadata.`);return kW.parse(await n.json())}async function vR(t,e,r=fetch){try{return await r(t,{headers:e})}catch(n){if(n instanceof TypeError)return e?vR(t,void 0,r):void 0;throw n}}function VW(t,e="",r={}){return e.endsWith("/")&&(e=e.slice(0,-1)),r.prependPathname?`${e}/.well-known/${t}`:`/.well-known/${t}${e}`}async function iO(t,e,r=fetch){return await vR(t,{"MCP-Protocol-Version":e},r)}function GW(t,e){return!t||t.status>=400&&t.status<500&&e!=="/"}async function WW(t,e,r,n){var a,s;const l=new URL(t),c=(a=n?.protocolVersion)!==null&&a!==void 0?a:zm;let d;if(n?.metadataUrl)d=new URL(n.metadataUrl);else{const h=VW(e,l.pathname);d=new URL(h,(s=n?.metadataServerUrl)!==null&&s!==void 0?s:l),d.search=l.search}let f=await iO(d,c,r);if(!n?.metadataUrl&&GW(f,l.pathname)){const h=new URL(`/.well-known/${e}`,l);f=await iO(h,c,r)}return f}function YW(t){const e=typeof t=="string"?new URL(t):t,r=e.pathname!=="/",n=[];if(!r)return n.push({url:new URL("/.well-known/oauth-authorization-server",e.origin),type:"oauth"}),n.push({url:new URL("/.well-known/openid-configuration",e.origin),type:"oidc"}),n;let a=e.pathname;return a.endsWith("/")&&(a=a.slice(0,-1)),n.push({url:new URL(`/.well-known/oauth-authorization-server${a}`,e.origin),type:"oauth"}),n.push({url:new URL("/.well-known/oauth-authorization-server",e.origin),type:"oauth"}),n.push({url:new URL(`/.well-known/openid-configuration${a}`,e.origin),type:"oidc"}),n.push({url:new URL(`${a}/.well-known/openid-configuration`,e.origin),type:"oidc"}),n}async function KW(t,{fetchFn:e=fetch,protocolVersion:r=zm}={}){const n={"MCP-Protocol-Version":r},a=YW(t);for(const{url:s,type:l}of a){const c=await vR(s,n,e);if(c){if(!c.ok){if(c.status>=400&&c.status<500)continue;throw new Error(`HTTP ${c.status} trying to load ${l==="oauth"?"OAuth":"OpenID provider"} metadata from ${s}`)}return l==="oauth"?b$.parse(await c.json()):OW.parse(await c.json())}}}async function ZW(t,{metadata:e,clientInformation:r,redirectUrl:n,scope:a,state:s,resource:l}){let c;if(e){if(c=new URL(e.authorization_endpoint),!e.response_types_supported.includes(Ob))throw new Error(`Incompatible auth server: does not support response type ${Ob}`);if(e.code_challenge_methods_supported&&!e.code_challenge_methods_supported.includes(Db))throw new Error(`Incompatible auth server: does not support code challenge method ${Db}`)}else c=new URL("/authorize",t);const d=await NW(),f=d.code_verifier,h=d.code_challenge;return c.searchParams.set("response_type",Ob),c.searchParams.set("client_id",r.client_id),c.searchParams.set("code_challenge",h),c.searchParams.set("code_challenge_method",Db),c.searchParams.set("redirect_uri",String(n)),s&&c.searchParams.set("state",s),a&&c.searchParams.set("scope",a),a?.includes("offline_access")&&c.searchParams.append("prompt","consent"),l&&c.searchParams.set("resource",l.href),{authorizationUrl:c,codeVerifier:f}}async function XW(t,{metadata:e,clientInformation:r,authorizationCode:n,codeVerifier:a,redirectUri:s,resource:l,addClientAuthentication:c,fetchFn:d}){var f;const h="authorization_code",g=e?.token_endpoint?new URL(e.token_endpoint):new URL("/token",t);if(e?.grant_types_supported&&!e.grant_types_supported.includes(h))throw new Error(`Incompatible auth server: does not support grant type ${h}`);const v=new Headers({"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"}),y=new URLSearchParams({grant_type:h,code:n,code_verifier:a,redirect_uri:String(s)});if(c)c(v,y,t,e);else{const S=(f=e?.token_endpoint_auth_methods_supported)!==null&&f!==void 0?f:[],T=E$(r,S);S$(T,r,v,y)}l&&y.set("resource",l.href);const w=await(d??fetch)(g,{method:"POST",headers:v,body:y});if(!w.ok)throw await gR(w);return y$.parse(await w.json())}async function QW(t,{metadata:e,clientInformation:r,refreshToken:n,resource:a,addClientAuthentication:s,fetchFn:l}){var c;const d="refresh_token";let f;if(e){if(f=new URL(e.token_endpoint),e.grant_types_supported&&!e.grant_types_supported.includes(d))throw new Error(`Incompatible auth server: does not support grant type ${d}`)}else f=new URL("/token",t);const h=new Headers({"Content-Type":"application/x-www-form-urlencoded"}),g=new URLSearchParams({grant_type:d,refresh_token:n});if(s)s(h,g,t,e);else{const y=(c=e?.token_endpoint_auth_methods_supported)!==null&&c!==void 0?c:[],w=E$(r,y);S$(w,r,h,g)}a&&g.set("resource",a.href);const v=await(l??fetch)(f,{method:"POST",headers:h,body:g});if(!v.ok)throw await gR(v);return y$.parse({refresh_token:n,...await v.json()})}async function JW(t,{metadata:e,clientMetadata:r,fetchFn:n}){let a;if(e){if(!e.registration_endpoint)throw new Error("Incompatible auth server: does not support dynamic client registration");a=new URL(e.registration_endpoint)}else a=new URL("/register",t);const s=await(n??fetch)(a,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});if(!s.ok)throw await gR(s);return PW.parse(await s.json())}class sO extends Error{constructor(e,r){super(e),this.name="ParseError",this.type=r.type,this.field=r.field,this.value=r.value,this.line=r.line}}function Mb(t){}function x$(t){if(typeof t=="function")throw new TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");const{onEvent:e=Mb,onError:r=Mb,onRetry:n=Mb,onComment:a}=t;let s="",l=!0,c,d="",f="";function h(S){const T=l?S.replace(/^\xEF\xBB\xBF/,""):S,[x,_]=e7(`${s}${T}`);for(const C of x)g(C);s=_,l=!1}function g(S){if(S===""){y();return}if(S.startsWith(":")){a&&a(S.slice(S.startsWith(": ")?2:1));return}const T=S.indexOf(":");if(T!==-1){const x=S.slice(0,T),_=S[T+1]===" "?2:1,C=S.slice(T+_);v(x,C,S);return}v(S,"",S)}function v(S,T,x){switch(S){case"event":f=T;break;case"data":d=`${d}${T}
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/winston-Cw4A3I6l.js","assets/__vite-browser-external-DFygW7-s.js","assets/index-DRz5BQNA.js","assets/path-C9FudP8b.js","assets/index-D3r30E5x.js","assets/index-BwqAJmU6.js","assets/chunk-VL2OQCWN-Bic-rB6T.js","assets/embeddings-lLuDNyJW.js","assets/index-xRISKm6b.js","assets/index-UA3z-V5S.js","assets/langfuse-C4HKZ3NL-Dbzphj3a.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
var G6=Object.defineProperty;var W6=(t,e,r)=>e in t?G6(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var bp=(t,e,r)=>W6(t,typeof e!="symbol"?e+"":e,r);function Y6(t,e){for(var r=0;r<e.length;r++){const n=e[r];if(typeof n!="string"&&!Array.isArray(n)){for(const a in n)if(a!=="default"&&!(a in t)){const s=Object.getOwnPropertyDescriptor(n,a);s&&Object.defineProperty(t,a,s.get?s:{enumerable:!0,get:()=>n[a]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))n(a);new MutationObserver(a=>{for(const s of a)if(s.type==="childList")for(const l of s.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&n(l)}).observe(document,{childList:!0,subtree:!0});function r(a){const s={};return a.integrity&&(s.integrity=a.integrity),a.referrerPolicy&&(s.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?s.credentials="include":a.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function n(a){if(a.ep)return;a.ep=!0;const s=r(a);fetch(a.href,s)}})();function hc(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function NEe(t){if(Object.prototype.hasOwnProperty.call(t,"__esModule"))return t;var e=t.default;if(typeof e=="function"){var r=function n(){var a=!1;try{a=this instanceof n}catch{}return a?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach(function(n){var a=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(r,n,a.get?a:{enumerable:!0,get:function(){return t[n]}})}),r}var $v={exports:{}},yu={};var Qk;function K6(){if(Qk)return yu;Qk=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function r(n,a,s){var l=null;if(s!==void 0&&(l=""+s),a.key!==void 0&&(l=""+a.key),"key"in a){s={};for(var c in a)c!=="key"&&(s[c]=a[c])}else s=a;return a=s.ref,{$$typeof:t,type:n,key:l,ref:a!==void 0?a:null,props:s}}return yu.Fragment=e,yu.jsx=r,yu.jsxs=r,yu}var Jk;function Z6(){return Jk||(Jk=1,$v.exports=K6()),$v.exports}var p=Z6();const X6="modulepreload",Q6=function(t){return"/inspector/"+t},eI={},ds=function(e,r,n){let a=Promise.resolve();if(r&&r.length>0){let d=function(f){return Promise.all(f.map(h=>Promise.resolve(h).then(g=>({status:"fulfilled",value:g}),g=>({status:"rejected",reason:g}))))};document.getElementsByTagName("link");const l=document.querySelector("meta[property=csp-nonce]"),c=l?.nonce||l?.getAttribute("nonce");a=d(r.map(f=>{if(f=Q6(f),f in eI)return;eI[f]=!0;const h=f.endsWith(".css"),g=h?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${f}"]${g}`))return;const v=document.createElement("link");if(v.rel=h?"stylesheet":X6,h||(v.as="script"),v.crossOrigin="",v.href=f,c&&v.setAttribute("nonce",c),document.head.appendChild(v),h)return new Promise((y,w)=>{v.addEventListener("load",y),v.addEventListener("error",()=>w(new Error(`Unable to preload CSS for ${f}`)))})}))}function s(l){const c=new Event("vite:preloadError",{cancelable:!0});if(c.payload=l,window.dispatchEvent(c),!c.defaultPrevented)throw l}return a.then(l=>{for(const c of l||[])c.status==="rejected"&&s(c.reason);return e().catch(s)})};var J6=Object.defineProperty,Qe=(t,e)=>J6(t,"name",{value:e,configurable:!0}),tI=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,r)=>(typeof require<"u"?require:e)[r]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')}),El={};async function jz(){if(typeof process<"u")try{const t=await ds(()=>import("./__vite-browser-external-DFygW7-s.js").then(r=>r.o),[]),e=await ds(()=>import("./path-C9FudP8b.js").then(r=>r.p),[]);return{fs:t.default,path:e.default}}catch{return{fs:null,path:null}}return{fs:null,path:null}}Qe(jz,"getNodeModules");var jn=null;function Uz(){if(typeof tI<"u")try{jn=tI("winston")}catch{}}Qe(Uz,"loadWinstonSync");async function Fz(){return jn||(jn=await ds(()=>import("./winston-Cw4A3I6l.js").then(t=>t.w),__vite__mapDeps([0,1,2,3]))),jn}Qe(Fz,"getWinston");var E_="mcp-use";function am(){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}}Qe(am,"isNodeJSEnvironment");var Yl,e9=(Yl=class{_level;name;constructor(e=E_,r="info"){this.name=e,this._level=r}shouldLog(e){const r=["error","warn","info","http","verbose","debug","silly"],n=r.indexOf(this._level);return r.indexOf(e)<=n}formatMessage(e,r){return`${new Date().toLocaleTimeString("en-US",{hour12:!1})} [${this.name}] ${e}: ${r}`}error(e){this.shouldLog("error")&&console.error(this.formatMessage("error",e))}warn(e){this.shouldLog("warn")&&console.warn(this.formatMessage("warn",e))}info(e){this.shouldLog("info")&&console.info(this.formatMessage("info",e))}debug(e){this.shouldLog("debug")&&console.debug(this.formatMessage("debug",e))}http(e){this.shouldLog("http")&&console.log(this.formatMessage("http",e))}verbose(e){this.shouldLog("verbose")&&console.log(this.formatMessage("verbose",e))}silly(e){this.shouldLog("silly")&&console.log(this.formatMessage("silly",e))}get level(){return this._level}set level(e){this._level=e}},Qe(Yl,"SimpleConsoleLogger"),Yl);function Fp(t){switch((typeof process<"u"&&El?t:void 0)?.trim()){case"2":return"debug";case"1":return"info";default:return"info"}}Qe(Fp,"resolveLevel");var _o,zz=(_o=class{static get(e=E_){if(!am()){if(!this.simpleInstances[e]){const r=typeof process<"u"&&El?.DEBUG||void 0;this.simpleInstances[e]=new e9(e,Fp(r))}return this.simpleInstances[e]}if(!this.instances[e]){if(!jn)throw new Error("Winston not loaded - call Logger.configure() first");const{createLogger:r,format:n}=jn,{combine:a,timestamp:s,label:l,colorize:c,splat:d}=n;this.instances[e]=r({level:Fp(El.DEBUG),format:a(c(),d(),l({label:e}),s({format:"HH:mm:ss"}),this.getFormatter()),transports:[]})}return this.instances[e]}static getFormatter(){if(!jn)throw new Error("Winston not loaded");const{format:e}=jn,{printf:r}=e,n=r(({level:l,message:c,label:d,timestamp:f})=>`${f} [${d}] ${l}: ${c}`),a=r(({level:l,message:c,label:d,timestamp:f})=>`${f} [${d}] ${l.toUpperCase()}: ${c}`),s=r(({level:l,message:c,label:d,timestamp:f})=>`${f} [${d}] ${l.toUpperCase()}: ${c}`);switch(this.currentFormat){case"minimal":return n;case"detailed":return a;case"emoji":return s;default:return n}}static async configure(e={}){const{level:r,console:n=!0,file:a,format:s="minimal"}=e,l=typeof process<"u"&&El?.DEBUG||void 0,c=r??Fp(l);if(this.currentFormat=s,!am()){Object.values(this.simpleInstances).forEach(T=>{T.level=c});return}if(await Fz(),!jn)throw new Error("Failed to load winston");const d=this.get();d.level=c;const f=d;if(f.clear(),n&&f.add(new jn.transports.Console),a){const{fs:T,path:x}=await jz();if(T&&x){const _=x.dirname(x.resolve(a));T.existsSync(_)||T.mkdirSync(_,{recursive:!0}),f.add(new jn.transports.File({filename:a}))}}const{format:h}=jn,{combine:g,timestamp:v,label:y,colorize:w,splat:S}=h;Object.values(this.instances).forEach(T=>{T&&"format"in T&&(T.level=c,T.format=g(w(),S(),y({label:E_}),v({format:"HH:mm:ss"}),this.getFormatter()))})}static setDebug(e){let r;e===2||e===!0?r="debug":r="info",Object.values(this.simpleInstances).forEach(n=>{n.level=r}),Object.values(this.instances).forEach(n=>{n&&(n.level=r)}),typeof process<"u"&&El&&(El.DEBUG=e?e===!0?"2":String(e):"0")}static setFormat(e){this.currentFormat=e,this.configure({format:e})}},Qe(_o,"Logger"),bp(_o,"instances",{}),bp(_o,"simpleInstances",{}),bp(_o,"currentFormat","minimal"),_o);am()&&(Uz(),jn&&zz.configure());var Me=zz.get(),Kl,$z=(Kl=class{client=null;connectionManager=null;toolsCache=null;capabilitiesCache=null;serverInfoCache=null;connected=!1;opts;constructor(e={}){this.opts=e}async disconnect(){if(!this.connected){Me.debug("Not connected to MCP implementation");return}Me.debug("Disconnecting from MCP implementation"),await this.cleanupResources(),this.connected=!1,Me.debug("Disconnected from MCP implementation")}get isClientConnected(){return this.client!=null}async initialize(e=this.opts.defaultRequestOptions??{}){if(!this.client)throw new Error("MCP client is not connected");Me.debug("Caching server capabilities & tools");const r=this.client.getServerCapabilities();this.capabilitiesCache=r;const n=this.client.getServerVersion();this.serverInfoCache=n||null;const a=await this.client.listTools(void 0,e);return this.toolsCache=a.tools??[],Me.debug(`Fetched ${this.toolsCache.length} tools from server`),Me.debug("Server capabilities:",r),Me.debug("Server info:",n),r}get tools(){if(!this.toolsCache)throw new Error("MCP client is not initialized; call initialize() first");return this.toolsCache}get serverCapabilities(){return this.capabilitiesCache}get serverInfo(){return this.serverInfoCache}async callTool(e,r,n){if(!this.client)throw new Error("MCP client is not connected");Me.debug(`Calling tool '${e}' with args`,r);const a=await this.client.callTool({name:e,arguments:r},void 0,n);return Me.debug(`Tool '${e}' returned`,a),a}async listResources(e,r){if(!this.client)throw new Error("MCP client is not connected");return Me.debug("Listing resources",e?`with cursor: ${e}`:""),await this.client.listResources({cursor:e},r)}async listAllResources(e){if(!this.client)throw new Error("MCP client is not connected");if(!this.capabilitiesCache?.resources)return Me.debug("Server does not advertise resources capability, skipping"),{resources:[]};try{Me.debug("Listing all resources (with auto-pagination)");const r=[];let n;do{const a=await this.client.listResources({cursor:n},e);r.push(...a.resources||[]),n=a.nextCursor}while(n);return{resources:r}}catch(r){if(r.code===-32601)return Me.debug("Server advertised resources but method not found"),{resources:[]};throw r}}async listResourceTemplates(e){if(!this.client)throw new Error("MCP client is not connected");return Me.debug("Listing resource templates"),await this.client.listResourceTemplates(void 0,e)}async readResource(e,r){if(!this.client)throw new Error("MCP client is not connected");return Me.debug(`Reading resource ${e}`),await this.client.readResource({uri:e},r)}async subscribeToResource(e,r){if(!this.client)throw new Error("MCP client is not connected");return Me.debug(`Subscribing to resource: ${e}`),await this.client.subscribeResource({uri:e},r)}async unsubscribeFromResource(e,r){if(!this.client)throw new Error("MCP client is not connected");return Me.debug(`Unsubscribing from resource: ${e}`),await this.client.unsubscribeResource({uri:e},r)}async listPrompts(){if(!this.client)throw new Error("MCP client is not connected");if(!this.capabilitiesCache?.prompts)return Me.debug("Server does not advertise prompts capability, skipping"),{prompts:[]};try{return Me.debug("Listing prompts"),await this.client.listPrompts()}catch(e){if(e.code===-32601)return Me.debug("Server advertised prompts but method not found"),{prompts:[]};throw e}}async getPrompt(e,r){if(!this.client)throw new Error("MCP client is not connected");return Me.debug(`Getting prompt ${e}`),await this.client.getPrompt({name:e,arguments:r})}async request(e,r=null,n){if(!this.client)throw new Error("MCP client is not connected");return Me.debug(`Sending raw request '${e}' with params`,r),await this.client.request({method:e,params:r??{}},void 0,n)}async cleanupResources(){const e=[];if(this.client)try{typeof this.client.close=="function"&&await this.client.close()}catch(r){const n=`Error closing client: ${r}`;Me.warn(n),e.push(n)}finally{this.client=null}if(this.connectionManager)try{await this.connectionManager.stop()}catch(r){const n=`Error stopping connection manager: ${r}`;Me.warn(n),e.push(n)}finally{this.connectionManager=null}this.toolsCache=null,e.length&&Me.warn(`Resource cleanup finished with ${e.length} issue(s)`)}},Qe(Kl,"BaseConnector"),Kl),Nt;(function(t){t.assertEqual=a=>{};function e(a){}t.assertIs=e;function r(a){throw new Error}t.assertNever=r,t.arrayToEnum=a=>{const s={};for(const l of a)s[l]=l;return s},t.getValidEnumValues=a=>{const s=t.objectKeys(a).filter(c=>typeof a[a[c]]!="number"),l={};for(const c of s)l[c]=a[c];return t.objectValues(l)},t.objectValues=a=>t.objectKeys(a).map(function(s){return a[s]}),t.objectKeys=typeof Object.keys=="function"?a=>Object.keys(a):a=>{const s=[];for(const l in a)Object.prototype.hasOwnProperty.call(a,l)&&s.push(l);return s},t.find=(a,s)=>{for(const l of a)if(s(l))return l},t.isInteger=typeof Number.isInteger=="function"?a=>Number.isInteger(a):a=>typeof a=="number"&&Number.isFinite(a)&&Math.floor(a)===a;function n(a,s=" | "){return a.map(l=>typeof l=="string"?`'${l}'`:l).join(s)}t.joinValues=n,t.jsonStringifyReplacer=(a,s)=>typeof s=="bigint"?s.toString():s})(Nt||(Nt={}));var rI;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(rI||(rI={}));const qe=Nt.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),yi=t=>{switch(typeof t){case"undefined":return qe.undefined;case"string":return qe.string;case"number":return Number.isNaN(t)?qe.nan:qe.number;case"boolean":return qe.boolean;case"function":return qe.function;case"bigint":return qe.bigint;case"symbol":return qe.symbol;case"object":return Array.isArray(t)?qe.array:t===null?qe.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?qe.promise:typeof Map<"u"&&t instanceof Map?qe.map:typeof Set<"u"&&t instanceof Set?qe.set:typeof Date<"u"&&t instanceof Date?qe.date:qe.object;default:return qe.unknown}},Ie=Nt.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class oa extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};const r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){const r=e||function(s){return s.message},n={_errors:[]},a=s=>{for(const l of s.issues)if(l.code==="invalid_union")l.unionErrors.map(a);else if(l.code==="invalid_return_type")a(l.returnTypeError);else if(l.code==="invalid_arguments")a(l.argumentsError);else if(l.path.length===0)n._errors.push(r(l));else{let c=n,d=0;for(;d<l.path.length;){const f=l.path[d];d===l.path.length-1?(c[f]=c[f]||{_errors:[]},c[f]._errors.push(r(l))):c[f]=c[f]||{_errors:[]},c=c[f],d++}}};return a(this),n}static assert(e){if(!(e instanceof oa))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Nt.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){const r={},n=[];for(const a of this.issues)if(a.path.length>0){const s=a.path[0];r[s]=r[s]||[],r[s].push(e(a))}else n.push(e(a));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}}oa.create=t=>new oa(t);const ld=(t,e)=>{let r;switch(t.code){case Ie.invalid_type:t.received===qe.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case Ie.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,Nt.jsonStringifyReplacer)}`;break;case Ie.unrecognized_keys:r=`Unrecognized key(s) in object: ${Nt.joinValues(t.keys,", ")}`;break;case Ie.invalid_union:r="Invalid input";break;case Ie.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Nt.joinValues(t.options)}`;break;case Ie.invalid_enum_value:r=`Invalid enum value. Expected ${Nt.joinValues(t.options)}, received '${t.received}'`;break;case Ie.invalid_arguments:r="Invalid function arguments";break;case Ie.invalid_return_type:r="Invalid function return type";break;case Ie.invalid_date:r="Invalid date";break;case Ie.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:Nt.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case Ie.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case Ie.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case Ie.custom:r="Invalid input";break;case Ie.invalid_intersection_types:r="Intersection results could not be merged";break;case Ie.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case Ie.not_finite:r="Number must be finite";break;default:r=e.defaultError,Nt.assertNever(t)}return{message:r}};let t9=ld;function S_(){return t9}const x_=t=>{const{data:e,path:r,errorMaps:n,issueData:a}=t,s=[...r,...a.path||[]],l={...a,path:s};if(a.message!==void 0)return{...a,path:s,message:a.message};let c="";const d=n.filter(f=>!!f).slice().reverse();for(const f of d)c=f(l,{data:e,defaultError:c}).message;return{...a,path:s,message:c}};function Fe(t,e){const r=S_(),n=x_({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===ld?void 0:ld].filter(a=>!!a)});t.common.issues.push(n)}class un{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){const n=[];for(const a of r){if(a.status==="aborted")return it;a.status==="dirty"&&e.dirty(),n.push(a.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){const n=[];for(const a of r){const s=await a.key,l=await a.value;n.push({key:s,value:l})}return un.mergeObjectSync(e,n)}static mergeObjectSync(e,r){const n={};for(const a of r){const{key:s,value:l}=a;if(s.status==="aborted"||l.status==="aborted")return it;s.status==="dirty"&&e.dirty(),l.status==="dirty"&&e.dirty(),s.value!=="__proto__"&&(typeof l.value<"u"||a.alwaysSet)&&(n[s.value]=l.value)}return{status:e.value,value:n}}}const it=Object.freeze({status:"aborted"}),Cu=t=>({status:"dirty",value:t}),Tn=t=>({status:"valid",value:t}),nI=t=>t.status==="aborted",aI=t=>t.status==="dirty",oc=t=>t.status==="valid",om=t=>typeof Promise<"u"&&t instanceof Promise;var tt;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(tt||(tt={}));class Ha{constructor(e,r,n,a){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=a}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const oI=(t,e)=>{if(oc(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const r=new oa(t.common.issues);return this._error=r,this._error}}};function pt(t){if(!t)return{};const{errorMap:e,invalid_type_error:r,required_error:n,description:a}=t;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:a}:{errorMap:(l,c)=>{const{message:d}=t;return l.code==="invalid_enum_value"?{message:d??c.defaultError}:typeof c.data>"u"?{message:d??n??c.defaultError}:l.code!=="invalid_type"?{message:c.defaultError}:{message:d??r??c.defaultError}},description:a}}class _t{get description(){return this._def.description}_getType(e){return yi(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:yi(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new un,ctx:{common:e.parent.common,data:e.data,parsedType:yi(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const r=this._parse(e);if(om(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){const r=this._parse(e);return Promise.resolve(r)}parse(e,r){const n=this.safeParse(e,r);if(n.success)return n.data;throw n.error}safeParse(e,r){const n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:yi(e)},a=this._parseSync({data:e,path:n.path,parent:n});return oI(n,a)}"~validate"(e){const r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:yi(e)};if(!this["~standard"].async)try{const n=this._parseSync({data:e,path:[],parent:r});return oc(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(n=>oc(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(e,r){const n=await this.safeParseAsync(e,r);if(n.success)return n.data;throw n.error}async safeParseAsync(e,r){const n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:yi(e)},a=this._parse({data:e,path:n.path,parent:n}),s=await(om(a)?a:Promise.resolve(a));return oI(n,s)}refine(e,r){const n=a=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(a):r;return this._refinement((a,s)=>{const l=e(a),c=()=>s.addIssue({code:Ie.custom,...n(a)});return typeof Promise<"u"&&l instanceof Promise?l.then(d=>d?!0:(c(),!1)):l?!0:(c(),!1)})}refinement(e,r){return this._refinement((n,a)=>e(n)?!0:(a.addIssue(typeof r=="function"?r(n,a):r),!1))}_refinement(e){return new xs({schema:this,typeName:ct.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return Ao.create(this,this._def)}nullable(){return ws.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return za.create(this)}promise(){return fd.create(this,this._def)}or(e){return cm.create([this,e],this._def)}and(e){return um.create(this,e,this._def)}transform(e){return new xs({...pt(this._def),schema:this,typeName:ct.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const r=typeof e=="function"?e:()=>e;return new pm({...pt(this._def),innerType:this,defaultValue:r,typeName:ct.ZodDefault})}brand(){return new Vz({typeName:ct.ZodBranded,type:this,...pt(this._def)})}catch(e){const r=typeof e=="function"?e:()=>e;return new mm({...pt(this._def),innerType:this,catchValue:r,typeName:ct.ZodCatch})}describe(e){const r=this.constructor;return new r({...this._def,description:e})}pipe(e){return nR.create(this,e)}readonly(){return hm.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const r9=/^c[^\s-]{8,}$/i,n9=/^[0-9a-z]+$/,a9=/^[0-9A-HJKMNP-TV-Z]{26}$/i,o9=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,i9=/^[a-z0-9_-]{21}$/i,s9=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,l9=/^[-+]?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)?)??$/,c9=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,u9="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Bv;const d9=/^(?:(?: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])$/,f9=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,p9=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,m9=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,h9=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,g9=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Bz="((\\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])))",v9=new RegExp(`^${Bz}$`);function qz(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);const r=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function b9(t){return new RegExp(`^${qz(t)}$`)}function y9(t){let e=`${Bz}T${qz(t)}`;const r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function E9(t,e){return!!((e==="v4"||!e)&&d9.test(t)||(e==="v6"||!e)&&p9.test(t))}function S9(t,e){if(!s9.test(t))return!1;try{const[r]=t.split(".");if(!r)return!1;const n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),a=JSON.parse(atob(n));return!(typeof a!="object"||a===null||"typ"in a&&a?.typ!=="JWT"||!a.alg||e&&a.alg!==e)}catch{return!1}}function x9(t,e){return!!((e==="v4"||!e)&&f9.test(t)||(e==="v6"||!e)&&m9.test(t))}class Ro extends _t{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==qe.string){const s=this._getOrReturnCtx(e);return Fe(s,{code:Ie.invalid_type,expected:qe.string,received:s.parsedType}),it}const n=new un;let a;for(const s of this._def.checks)if(s.kind==="min")e.data.length<s.value&&(a=this._getOrReturnCtx(e,a),Fe(a,{code:Ie.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),n.dirty());else if(s.kind==="max")e.data.length>s.value&&(a=this._getOrReturnCtx(e,a),Fe(a,{code:Ie.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),n.dirty());else if(s.kind==="length"){const l=e.data.length>s.value,c=e.data.length<s.value;(l||c)&&(a=this._getOrReturnCtx(e,a),l?Fe(a,{code:Ie.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):c&&Fe(a,{code:Ie.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),n.dirty())}else if(s.kind==="email")c9.test(e.data)||(a=this._getOrReturnCtx(e,a),Fe(a,{validation:"email",code:Ie.invalid_string,message:s.message}),n.dirty());else if(s.kind==="emoji")Bv||(Bv=new RegExp(u9,"u")),Bv.test(e.data)||(a=this._getOrReturnCtx(e,a),Fe(a,{validation:"emoji",code:Ie.invalid_string,message:s.message}),n.dirty());else if(s.kind==="uuid")o9.test(e.data)||(a=this._getOrReturnCtx(e,a),Fe(a,{validation:"uuid",code:Ie.invalid_string,message:s.message}),n.dirty());else if(s.kind==="nanoid")i9.test(e.data)||(a=this._getOrReturnCtx(e,a),Fe(a,{validation:"nanoid",code:Ie.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid")r9.test(e.data)||(a=this._getOrReturnCtx(e,a),Fe(a,{validation:"cuid",code:Ie.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid2")n9.test(e.data)||(a=this._getOrReturnCtx(e,a),Fe(a,{validation:"cuid2",code:Ie.invalid_string,message:s.message}),n.dirty());else if(s.kind==="ulid")a9.test(e.data)||(a=this._getOrReturnCtx(e,a),Fe(a,{validation:"ulid",code:Ie.invalid_string,message:s.message}),n.dirty());else if(s.kind==="url")try{new URL(e.data)}catch{a=this._getOrReturnCtx(e,a),Fe(a,{validation:"url",code:Ie.invalid_string,message:s.message}),n.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(e.data)||(a=this._getOrReturnCtx(e,a),Fe(a,{validation:"regex",code:Ie.invalid_string,message:s.message}),n.dirty())):s.kind==="trim"?e.data=e.data.trim():s.kind==="includes"?e.data.includes(s.value,s.position)||(a=this._getOrReturnCtx(e,a),Fe(a,{code:Ie.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),n.dirty()):s.kind==="toLowerCase"?e.data=e.data.toLowerCase():s.kind==="toUpperCase"?e.data=e.data.toUpperCase():s.kind==="startsWith"?e.data.startsWith(s.value)||(a=this._getOrReturnCtx(e,a),Fe(a,{code:Ie.invalid_string,validation:{startsWith:s.value},message:s.message}),n.dirty()):s.kind==="endsWith"?e.data.endsWith(s.value)||(a=this._getOrReturnCtx(e,a),Fe(a,{code:Ie.invalid_string,validation:{endsWith:s.value},message:s.message}),n.dirty()):s.kind==="datetime"?y9(s).test(e.data)||(a=this._getOrReturnCtx(e,a),Fe(a,{code:Ie.invalid_string,validation:"datetime",message:s.message}),n.dirty()):s.kind==="date"?v9.test(e.data)||(a=this._getOrReturnCtx(e,a),Fe(a,{code:Ie.invalid_string,validation:"date",message:s.message}),n.dirty()):s.kind==="time"?b9(s).test(e.data)||(a=this._getOrReturnCtx(e,a),Fe(a,{code:Ie.invalid_string,validation:"time",message:s.message}),n.dirty()):s.kind==="duration"?l9.test(e.data)||(a=this._getOrReturnCtx(e,a),Fe(a,{validation:"duration",code:Ie.invalid_string,message:s.message}),n.dirty()):s.kind==="ip"?E9(e.data,s.version)||(a=this._getOrReturnCtx(e,a),Fe(a,{validation:"ip",code:Ie.invalid_string,message:s.message}),n.dirty()):s.kind==="jwt"?S9(e.data,s.alg)||(a=this._getOrReturnCtx(e,a),Fe(a,{validation:"jwt",code:Ie.invalid_string,message:s.message}),n.dirty()):s.kind==="cidr"?x9(e.data,s.version)||(a=this._getOrReturnCtx(e,a),Fe(a,{validation:"cidr",code:Ie.invalid_string,message:s.message}),n.dirty()):s.kind==="base64"?h9.test(e.data)||(a=this._getOrReturnCtx(e,a),Fe(a,{validation:"base64",code:Ie.invalid_string,message:s.message}),n.dirty()):s.kind==="base64url"?g9.test(e.data)||(a=this._getOrReturnCtx(e,a),Fe(a,{validation:"base64url",code:Ie.invalid_string,message:s.message}),n.dirty()):Nt.assertNever(s);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(a=>e.test(a),{validation:r,code:Ie.invalid_string,...tt.errToObj(n)})}_addCheck(e){return new Ro({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...tt.errToObj(e)})}url(e){return this._addCheck({kind:"url",...tt.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...tt.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...tt.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...tt.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...tt.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...tt.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...tt.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...tt.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...tt.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...tt.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...tt.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...tt.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...tt.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...tt.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...tt.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...tt.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...tt.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...tt.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...tt.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...tt.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...tt.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...tt.errToObj(r)})}nonempty(e){return this.min(1,tt.errToObj(e))}trim(){return new Ro({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Ro({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Ro({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}}Ro.create=t=>new Ro({checks:[],typeName:ct.ZodString,coerce:t?.coerce??!1,...pt(t)});function w9(t,e){const r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,a=r>n?r:n,s=Number.parseInt(t.toFixed(a).replace(".","")),l=Number.parseInt(e.toFixed(a).replace(".",""));return s%l/10**a}class ic extends _t{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==qe.number){const s=this._getOrReturnCtx(e);return Fe(s,{code:Ie.invalid_type,expected:qe.number,received:s.parsedType}),it}let n;const a=new un;for(const s of this._def.checks)s.kind==="int"?Nt.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),Fe(n,{code:Ie.invalid_type,expected:"integer",received:"float",message:s.message}),a.dirty()):s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(n=this._getOrReturnCtx(e,n),Fe(n,{code:Ie.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),a.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(n=this._getOrReturnCtx(e,n),Fe(n,{code:Ie.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),a.dirty()):s.kind==="multipleOf"?w9(e.data,s.value)!==0&&(n=this._getOrReturnCtx(e,n),Fe(n,{code:Ie.not_multiple_of,multipleOf:s.value,message:s.message}),a.dirty()):s.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),Fe(n,{code:Ie.not_finite,message:s.message}),a.dirty()):Nt.assertNever(s);return{status:a.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,tt.toString(r))}gt(e,r){return this.setLimit("min",e,!1,tt.toString(r))}lte(e,r){return this.setLimit("max",e,!0,tt.toString(r))}lt(e,r){return this.setLimit("max",e,!1,tt.toString(r))}setLimit(e,r,n,a){return new ic({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:tt.toString(a)}]})}_addCheck(e){return new ic({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:tt.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:tt.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:tt.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:tt.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:tt.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:tt.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:tt.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:tt.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:tt.toString(e)})}get minValue(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&Nt.isInteger(e.value))}get isFinite(){let e=null,r=null;for(const n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(r)&&Number.isFinite(e)}}ic.create=t=>new ic({checks:[],typeName:ct.ZodNumber,coerce:t?.coerce||!1,...pt(t)});class cd extends _t{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==qe.bigint)return this._getInvalidInput(e);let n;const a=new un;for(const s of this._def.checks)s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(n=this._getOrReturnCtx(e,n),Fe(n,{code:Ie.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),a.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(n=this._getOrReturnCtx(e,n),Fe(n,{code:Ie.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),a.dirty()):s.kind==="multipleOf"?e.data%s.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),Fe(n,{code:Ie.not_multiple_of,multipleOf:s.value,message:s.message}),a.dirty()):Nt.assertNever(s);return{status:a.value,value:e.data}}_getInvalidInput(e){const r=this._getOrReturnCtx(e);return Fe(r,{code:Ie.invalid_type,expected:qe.bigint,received:r.parsedType}),it}gte(e,r){return this.setLimit("min",e,!0,tt.toString(r))}gt(e,r){return this.setLimit("min",e,!1,tt.toString(r))}lte(e,r){return this.setLimit("max",e,!0,tt.toString(r))}lt(e,r){return this.setLimit("max",e,!1,tt.toString(r))}setLimit(e,r,n,a){return new cd({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:tt.toString(a)}]})}_addCheck(e){return new cd({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:tt.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:tt.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:tt.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:tt.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:tt.toString(r)})}get minValue(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}}cd.create=t=>new cd({checks:[],typeName:ct.ZodBigInt,coerce:t?.coerce??!1,...pt(t)});class w_ extends _t{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==qe.boolean){const n=this._getOrReturnCtx(e);return Fe(n,{code:Ie.invalid_type,expected:qe.boolean,received:n.parsedType}),it}return Tn(e.data)}}w_.create=t=>new w_({typeName:ct.ZodBoolean,coerce:t?.coerce||!1,...pt(t)});class im extends _t{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==qe.date){const s=this._getOrReturnCtx(e);return Fe(s,{code:Ie.invalid_type,expected:qe.date,received:s.parsedType}),it}if(Number.isNaN(e.data.getTime())){const s=this._getOrReturnCtx(e);return Fe(s,{code:Ie.invalid_date}),it}const n=new un;let a;for(const s of this._def.checks)s.kind==="min"?e.data.getTime()<s.value&&(a=this._getOrReturnCtx(e,a),Fe(a,{code:Ie.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),n.dirty()):s.kind==="max"?e.data.getTime()>s.value&&(a=this._getOrReturnCtx(e,a),Fe(a,{code:Ie.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),n.dirty()):Nt.assertNever(s);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new im({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:tt.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:tt.toString(r)})}get minDate(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}}im.create=t=>new im({checks:[],coerce:t?.coerce||!1,typeName:ct.ZodDate,...pt(t)});class iI extends _t{_parse(e){if(this._getType(e)!==qe.symbol){const n=this._getOrReturnCtx(e);return Fe(n,{code:Ie.invalid_type,expected:qe.symbol,received:n.parsedType}),it}return Tn(e.data)}}iI.create=t=>new iI({typeName:ct.ZodSymbol,...pt(t)});class sm extends _t{_parse(e){if(this._getType(e)!==qe.undefined){const n=this._getOrReturnCtx(e);return Fe(n,{code:Ie.invalid_type,expected:qe.undefined,received:n.parsedType}),it}return Tn(e.data)}}sm.create=t=>new sm({typeName:ct.ZodUndefined,...pt(t)});class lm extends _t{_parse(e){if(this._getType(e)!==qe.null){const n=this._getOrReturnCtx(e);return Fe(n,{code:Ie.invalid_type,expected:qe.null,received:n.parsedType}),it}return Tn(e.data)}}lm.create=t=>new lm({typeName:ct.ZodNull,...pt(t)});class ud extends _t{constructor(){super(...arguments),this._any=!0}_parse(e){return Tn(e.data)}}ud.create=t=>new ud({typeName:ct.ZodAny,...pt(t)});class zl extends _t{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Tn(e.data)}}zl.create=t=>new zl({typeName:ct.ZodUnknown,...pt(t)});class Ti extends _t{_parse(e){const r=this._getOrReturnCtx(e);return Fe(r,{code:Ie.invalid_type,expected:qe.never,received:r.parsedType}),it}}Ti.create=t=>new Ti({typeName:ct.ZodNever,...pt(t)});class sI extends _t{_parse(e){if(this._getType(e)!==qe.undefined){const n=this._getOrReturnCtx(e);return Fe(n,{code:Ie.invalid_type,expected:qe.void,received:n.parsedType}),it}return Tn(e.data)}}sI.create=t=>new sI({typeName:ct.ZodVoid,...pt(t)});class za extends _t{_parse(e){const{ctx:r,status:n}=this._processInputParams(e),a=this._def;if(r.parsedType!==qe.array)return Fe(r,{code:Ie.invalid_type,expected:qe.array,received:r.parsedType}),it;if(a.exactLength!==null){const l=r.data.length>a.exactLength.value,c=r.data.length<a.exactLength.value;(l||c)&&(Fe(r,{code:l?Ie.too_big:Ie.too_small,minimum:c?a.exactLength.value:void 0,maximum:l?a.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:a.exactLength.message}),n.dirty())}if(a.minLength!==null&&r.data.length<a.minLength.value&&(Fe(r,{code:Ie.too_small,minimum:a.minLength.value,type:"array",inclusive:!0,exact:!1,message:a.minLength.message}),n.dirty()),a.maxLength!==null&&r.data.length>a.maxLength.value&&(Fe(r,{code:Ie.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((l,c)=>a.type._parseAsync(new Ha(r,l,r.path,c)))).then(l=>un.mergeArray(n,l));const s=[...r.data].map((l,c)=>a.type._parseSync(new Ha(r,l,r.path,c)));return un.mergeArray(n,s)}get element(){return this._def.type}min(e,r){return new za({...this._def,minLength:{value:e,message:tt.toString(r)}})}max(e,r){return new za({...this._def,maxLength:{value:e,message:tt.toString(r)}})}length(e,r){return new za({...this._def,exactLength:{value:e,message:tt.toString(r)}})}nonempty(e){return this.min(1,e)}}za.create=(t,e)=>new za({type:t,minLength:null,maxLength:null,exactLength:null,typeName:ct.ZodArray,...pt(e)});function Sl(t){if(t instanceof Nr){const e={};for(const r in t.shape){const n=t.shape[r];e[r]=Ao.create(Sl(n))}return new Nr({...t._def,shape:()=>e})}else return t instanceof za?new za({...t._def,type:Sl(t.element)}):t instanceof Ao?Ao.create(Sl(t.unwrap())):t instanceof ws?ws.create(Sl(t.unwrap())):t instanceof ko?ko.create(t.items.map(e=>Sl(e))):t}class Nr extends _t{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),r=Nt.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==qe.object){const f=this._getOrReturnCtx(e);return Fe(f,{code:Ie.invalid_type,expected:qe.object,received:f.parsedType}),it}const{status:n,ctx:a}=this._processInputParams(e),{shape:s,keys:l}=this._getCached(),c=[];if(!(this._def.catchall instanceof Ti&&this._def.unknownKeys==="strip"))for(const f in a.data)l.includes(f)||c.push(f);const d=[];for(const f of l){const h=s[f],g=a.data[f];d.push({key:{status:"valid",value:f},value:h._parse(new Ha(a,g,a.path,f)),alwaysSet:f in a.data})}if(this._def.catchall instanceof Ti){const f=this._def.unknownKeys;if(f==="passthrough")for(const h of c)d.push({key:{status:"valid",value:h},value:{status:"valid",value:a.data[h]}});else if(f==="strict")c.length>0&&(Fe(a,{code:Ie.unrecognized_keys,keys:c}),n.dirty());else if(f!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const f=this._def.catchall;for(const h of c){const g=a.data[h];d.push({key:{status:"valid",value:h},value:f._parse(new Ha(a,g,a.path,h)),alwaysSet:h in a.data})}}return a.common.async?Promise.resolve().then(async()=>{const f=[];for(const h of d){const g=await h.key,v=await h.value;f.push({key:g,value:v,alwaysSet:h.alwaysSet})}return f}).then(f=>un.mergeObjectSync(n,f)):un.mergeObjectSync(n,d)}get shape(){return this._def.shape()}strict(e){return tt.errToObj,new Nr({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{const a=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:tt.errToObj(e).message??a}:{message:a}}}:{}})}strip(){return new Nr({...this._def,unknownKeys:"strip"})}passthrough(){return new Nr({...this._def,unknownKeys:"passthrough"})}extend(e){return new Nr({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Nr({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:ct.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new Nr({...this._def,catchall:e})}pick(e){const r={};for(const n of Nt.objectKeys(e))e[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new Nr({...this._def,shape:()=>r})}omit(e){const r={};for(const n of Nt.objectKeys(this.shape))e[n]||(r[n]=this.shape[n]);return new Nr({...this._def,shape:()=>r})}deepPartial(){return Sl(this)}partial(e){const r={};for(const n of Nt.objectKeys(this.shape)){const a=this.shape[n];e&&!e[n]?r[n]=a:r[n]=a.optional()}return new Nr({...this._def,shape:()=>r})}required(e){const r={};for(const n of Nt.objectKeys(this.shape))if(e&&!e[n])r[n]=this.shape[n];else{let s=this.shape[n];for(;s instanceof Ao;)s=s._def.innerType;r[n]=s}return new Nr({...this._def,shape:()=>r})}keyof(){return Hz(Nt.objectKeys(this.shape))}}Nr.create=(t,e)=>new Nr({shape:()=>t,unknownKeys:"strip",catchall:Ti.create(),typeName:ct.ZodObject,...pt(e)});Nr.strictCreate=(t,e)=>new Nr({shape:()=>t,unknownKeys:"strict",catchall:Ti.create(),typeName:ct.ZodObject,...pt(e)});Nr.lazycreate=(t,e)=>new Nr({shape:t,unknownKeys:"strip",catchall:Ti.create(),typeName:ct.ZodObject,...pt(e)});class cm extends _t{_parse(e){const{ctx:r}=this._processInputParams(e),n=this._def.options;function a(s){for(const c of s)if(c.result.status==="valid")return c.result;for(const c of s)if(c.result.status==="dirty")return r.common.issues.push(...c.ctx.common.issues),c.result;const l=s.map(c=>new oa(c.ctx.common.issues));return Fe(r,{code:Ie.invalid_union,unionErrors:l}),it}if(r.common.async)return Promise.all(n.map(async s=>{const l={...r,common:{...r.common,issues:[]},parent:null};return{result:await s._parseAsync({data:r.data,path:r.path,parent:l}),ctx:l}})).then(a);{let s;const l=[];for(const d of n){const f={...r,common:{...r.common,issues:[]},parent:null},h=d._parseSync({data:r.data,path:r.path,parent:f});if(h.status==="valid")return h;h.status==="dirty"&&!s&&(s={result:h,ctx:f}),f.common.issues.length&&l.push(f.common.issues)}if(s)return r.common.issues.push(...s.ctx.common.issues),s.result;const c=l.map(d=>new oa(d));return Fe(r,{code:Ie.invalid_union,unionErrors:c}),it}}get options(){return this._def.options}}cm.create=(t,e)=>new cm({options:t,typeName:ct.ZodUnion,...pt(e)});const xo=t=>t instanceof T_?xo(t.schema):t instanceof xs?xo(t.innerType()):t instanceof fm?[t.value]:t instanceof Ss?t.options:t instanceof R_?Nt.objectValues(t.enum):t instanceof pm?xo(t._def.innerType):t instanceof sm?[void 0]:t instanceof lm?[null]:t instanceof Ao?[void 0,...xo(t.unwrap())]:t instanceof ws?[null,...xo(t.unwrap())]:t instanceof Vz||t instanceof hm?xo(t.unwrap()):t instanceof mm?xo(t._def.innerType):[];class rR extends _t{_parse(e){const{ctx:r}=this._processInputParams(e);if(r.parsedType!==qe.object)return Fe(r,{code:Ie.invalid_type,expected:qe.object,received:r.parsedType}),it;const n=this.discriminator,a=r.data[n],s=this.optionsMap.get(a);return s?r.common.async?s._parseAsync({data:r.data,path:r.path,parent:r}):s._parseSync({data:r.data,path:r.path,parent:r}):(Fe(r,{code:Ie.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),it)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,n){const a=new Map;for(const s of r){const l=xo(s.shape[e]);if(!l.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const c of l){if(a.has(c))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(c)}`);a.set(c,s)}}return new rR({typeName:ct.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:a,...pt(n)})}}function __(t,e){const r=yi(t),n=yi(e);if(t===e)return{valid:!0,data:t};if(r===qe.object&&n===qe.object){const a=Nt.objectKeys(e),s=Nt.objectKeys(t).filter(c=>a.indexOf(c)!==-1),l={...t,...e};for(const c of s){const d=__(t[c],e[c]);if(!d.valid)return{valid:!1};l[c]=d.data}return{valid:!0,data:l}}else if(r===qe.array&&n===qe.array){if(t.length!==e.length)return{valid:!1};const a=[];for(let s=0;s<t.length;s++){const l=t[s],c=e[s],d=__(l,c);if(!d.valid)return{valid:!1};a.push(d.data)}return{valid:!0,data:a}}else return r===qe.date&&n===qe.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}class um extends _t{_parse(e){const{status:r,ctx:n}=this._processInputParams(e),a=(s,l)=>{if(nI(s)||nI(l))return it;const c=__(s.value,l.value);return c.valid?((aI(s)||aI(l))&&r.dirty(),{status:r.value,value:c.data}):(Fe(n,{code:Ie.invalid_intersection_types}),it)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([s,l])=>a(s,l)):a(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}um.create=(t,e,r)=>new um({left:t,right:e,typeName:ct.ZodIntersection,...pt(r)});class ko extends _t{_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==qe.array)return Fe(n,{code:Ie.invalid_type,expected:qe.array,received:n.parsedType}),it;if(n.data.length<this._def.items.length)return Fe(n,{code:Ie.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),it;!this._def.rest&&n.data.length>this._def.items.length&&(Fe(n,{code:Ie.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());const s=[...n.data].map((l,c)=>{const d=this._def.items[c]||this._def.rest;return d?d._parse(new Ha(n,l,n.path,c)):null}).filter(l=>!!l);return n.common.async?Promise.all(s).then(l=>un.mergeArray(r,l)):un.mergeArray(r,s)}get items(){return this._def.items}rest(e){return new ko({...this._def,rest:e})}}ko.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ko({items:t,typeName:ct.ZodTuple,rest:null,...pt(e)})};class dm extends _t{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==qe.object)return Fe(n,{code:Ie.invalid_type,expected:qe.object,received:n.parsedType}),it;const a=[],s=this._def.keyType,l=this._def.valueType;for(const c in n.data)a.push({key:s._parse(new Ha(n,c,n.path,c)),value:l._parse(new Ha(n,n.data[c],n.path,c)),alwaysSet:c in n.data});return n.common.async?un.mergeObjectAsync(r,a):un.mergeObjectSync(r,a)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof _t?new dm({keyType:e,valueType:r,typeName:ct.ZodRecord,...pt(n)}):new dm({keyType:Ro.create(),valueType:e,typeName:ct.ZodRecord,...pt(r)})}}class lI extends _t{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==qe.map)return Fe(n,{code:Ie.invalid_type,expected:qe.map,received:n.parsedType}),it;const a=this._def.keyType,s=this._def.valueType,l=[...n.data.entries()].map(([c,d],f)=>({key:a._parse(new Ha(n,c,n.path,[f,"key"])),value:s._parse(new Ha(n,d,n.path,[f,"value"]))}));if(n.common.async){const c=new Map;return Promise.resolve().then(async()=>{for(const d of l){const f=await d.key,h=await d.value;if(f.status==="aborted"||h.status==="aborted")return it;(f.status==="dirty"||h.status==="dirty")&&r.dirty(),c.set(f.value,h.value)}return{status:r.value,value:c}})}else{const c=new Map;for(const d of l){const f=d.key,h=d.value;if(f.status==="aborted"||h.status==="aborted")return it;(f.status==="dirty"||h.status==="dirty")&&r.dirty(),c.set(f.value,h.value)}return{status:r.value,value:c}}}}lI.create=(t,e,r)=>new lI({valueType:e,keyType:t,typeName:ct.ZodMap,...pt(r)});class dd extends _t{_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==qe.set)return Fe(n,{code:Ie.invalid_type,expected:qe.set,received:n.parsedType}),it;const a=this._def;a.minSize!==null&&n.data.size<a.minSize.value&&(Fe(n,{code:Ie.too_small,minimum:a.minSize.value,type:"set",inclusive:!0,exact:!1,message:a.minSize.message}),r.dirty()),a.maxSize!==null&&n.data.size>a.maxSize.value&&(Fe(n,{code:Ie.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),r.dirty());const s=this._def.valueType;function l(d){const f=new Set;for(const h of d){if(h.status==="aborted")return it;h.status==="dirty"&&r.dirty(),f.add(h.value)}return{status:r.value,value:f}}const c=[...n.data.values()].map((d,f)=>s._parse(new Ha(n,d,n.path,f)));return n.common.async?Promise.all(c).then(d=>l(d)):l(c)}min(e,r){return new dd({...this._def,minSize:{value:e,message:tt.toString(r)}})}max(e,r){return new dd({...this._def,maxSize:{value:e,message:tt.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}}dd.create=(t,e)=>new dd({valueType:t,minSize:null,maxSize:null,typeName:ct.ZodSet,...pt(e)});class $u extends _t{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:r}=this._processInputParams(e);if(r.parsedType!==qe.function)return Fe(r,{code:Ie.invalid_type,expected:qe.function,received:r.parsedType}),it;function n(c,d){return x_({data:c,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,S_(),ld].filter(f=>!!f),issueData:{code:Ie.invalid_arguments,argumentsError:d}})}function a(c,d){return x_({data:c,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,S_(),ld].filter(f=>!!f),issueData:{code:Ie.invalid_return_type,returnTypeError:d}})}const s={errorMap:r.common.contextualErrorMap},l=r.data;if(this._def.returns instanceof fd){const c=this;return Tn(async function(...d){const f=new oa([]),h=await c._def.args.parseAsync(d,s).catch(y=>{throw f.addIssue(n(d,y)),f}),g=await Reflect.apply(l,this,h);return await c._def.returns._def.type.parseAsync(g,s).catch(y=>{throw f.addIssue(a(g,y)),f})})}else{const c=this;return Tn(function(...d){const f=c._def.args.safeParse(d,s);if(!f.success)throw new oa([n(d,f.error)]);const h=Reflect.apply(l,this,f.data),g=c._def.returns.safeParse(h,s);if(!g.success)throw new oa([a(h,g.error)]);return g.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new $u({...this._def,args:ko.create(e).rest(zl.create())})}returns(e){return new $u({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,n){return new $u({args:e||ko.create([]).rest(zl.create()),returns:r||zl.create(),typeName:ct.ZodFunction,...pt(n)})}}class T_ extends _t{get schema(){return this._def.getter()}_parse(e){const{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}}T_.create=(t,e)=>new T_({getter:t,typeName:ct.ZodLazy,...pt(e)});class fm extends _t{_parse(e){if(e.data!==this._def.value){const r=this._getOrReturnCtx(e);return Fe(r,{received:r.data,code:Ie.invalid_literal,expected:this._def.value}),it}return{status:"valid",value:e.data}}get value(){return this._def.value}}fm.create=(t,e)=>new fm({value:t,typeName:ct.ZodLiteral,...pt(e)});function Hz(t,e){return new Ss({values:t,typeName:ct.ZodEnum,...pt(e)})}class Ss extends _t{_parse(e){if(typeof e.data!="string"){const r=this._getOrReturnCtx(e),n=this._def.values;return Fe(r,{expected:Nt.joinValues(n),received:r.parsedType,code:Ie.invalid_type}),it}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const r=this._getOrReturnCtx(e),n=this._def.values;return Fe(r,{received:r.data,code:Ie.invalid_enum_value,options:n}),it}return Tn(e.data)}get options(){return this._def.values}get enum(){const e={};for(const r of this._def.values)e[r]=r;return e}get Values(){const e={};for(const r of this._def.values)e[r]=r;return e}get Enum(){const e={};for(const r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return Ss.create(e,{...this._def,...r})}exclude(e,r=this._def){return Ss.create(this.options.filter(n=>!e.includes(n)),{...this._def,...r})}}Ss.create=Hz;class R_ extends _t{_parse(e){const r=Nt.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==qe.string&&n.parsedType!==qe.number){const a=Nt.objectValues(r);return Fe(n,{expected:Nt.joinValues(a),received:n.parsedType,code:Ie.invalid_type}),it}if(this._cache||(this._cache=new Set(Nt.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const a=Nt.objectValues(r);return Fe(n,{received:n.data,code:Ie.invalid_enum_value,options:a}),it}return Tn(e.data)}get enum(){return this._def.values}}R_.create=(t,e)=>new R_({values:t,typeName:ct.ZodNativeEnum,...pt(e)});class fd extends _t{unwrap(){return this._def.type}_parse(e){const{ctx:r}=this._processInputParams(e);if(r.parsedType!==qe.promise&&r.common.async===!1)return Fe(r,{code:Ie.invalid_type,expected:qe.promise,received:r.parsedType}),it;const n=r.parsedType===qe.promise?r.data:Promise.resolve(r.data);return Tn(n.then(a=>this._def.type.parseAsync(a,{path:r.path,errorMap:r.common.contextualErrorMap})))}}fd.create=(t,e)=>new fd({type:t,typeName:ct.ZodPromise,...pt(e)});class xs extends _t{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ct.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:r,ctx:n}=this._processInputParams(e),a=this._def.effect||null,s={addIssue:l=>{Fe(n,l),l.fatal?r.abort():r.dirty()},get path(){return n.path}};if(s.addIssue=s.addIssue.bind(s),a.type==="preprocess"){const l=a.transform(n.data,s);if(n.common.async)return Promise.resolve(l).then(async c=>{if(r.value==="aborted")return it;const d=await this._def.schema._parseAsync({data:c,path:n.path,parent:n});return d.status==="aborted"?it:d.status==="dirty"||r.value==="dirty"?Cu(d.value):d});{if(r.value==="aborted")return it;const c=this._def.schema._parseSync({data:l,path:n.path,parent:n});return c.status==="aborted"?it:c.status==="dirty"||r.value==="dirty"?Cu(c.value):c}}if(a.type==="refinement"){const l=c=>{const d=a.refinement(c,s);if(n.common.async)return Promise.resolve(d);if(d instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return c};if(n.common.async===!1){const c=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return c.status==="aborted"?it:(c.status==="dirty"&&r.dirty(),l(c.value),{status:r.value,value:c.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(c=>c.status==="aborted"?it:(c.status==="dirty"&&r.dirty(),l(c.value).then(()=>({status:r.value,value:c.value}))))}if(a.type==="transform")if(n.common.async===!1){const l=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!oc(l))return it;const c=a.transform(l.value,s);if(c instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:c}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(l=>oc(l)?Promise.resolve(a.transform(l.value,s)).then(c=>({status:r.value,value:c})):it);Nt.assertNever(a)}}xs.create=(t,e,r)=>new xs({schema:t,typeName:ct.ZodEffects,effect:e,...pt(r)});xs.createWithPreprocess=(t,e,r)=>new xs({schema:e,effect:{type:"preprocess",transform:t},typeName:ct.ZodEffects,...pt(r)});class Ao extends _t{_parse(e){return this._getType(e)===qe.undefined?Tn(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Ao.create=(t,e)=>new Ao({innerType:t,typeName:ct.ZodOptional,...pt(e)});class ws extends _t{_parse(e){return this._getType(e)===qe.null?Tn(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ws.create=(t,e)=>new ws({innerType:t,typeName:ct.ZodNullable,...pt(e)});class pm extends _t{_parse(e){const{ctx:r}=this._processInputParams(e);let n=r.data;return r.parsedType===qe.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}}pm.create=(t,e)=>new pm({innerType:t,typeName:ct.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...pt(e)});class mm extends _t{_parse(e){const{ctx:r}=this._processInputParams(e),n={...r,common:{...r.common,issues:[]}},a=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return om(a)?a.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new oa(n.common.issues)},input:n.data})})):{status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new oa(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}mm.create=(t,e)=>new mm({innerType:t,typeName:ct.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...pt(e)});class cI extends _t{_parse(e){if(this._getType(e)!==qe.nan){const n=this._getOrReturnCtx(e);return Fe(n,{code:Ie.invalid_type,expected:qe.nan,received:n.parsedType}),it}return{status:"valid",value:e.data}}}cI.create=t=>new cI({typeName:ct.ZodNaN,...pt(t)});class Vz extends _t{_parse(e){const{ctx:r}=this._processInputParams(e),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}}class nR extends _t{_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{const s=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?it:s.status==="dirty"?(r.dirty(),Cu(s.value)):this._def.out._parseAsync({data:s.value,path:n.path,parent:n})})();{const a=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?it:a.status==="dirty"?(r.dirty(),{status:"dirty",value:a.value}):this._def.out._parseSync({data:a.value,path:n.path,parent:n})}}static create(e,r){return new nR({in:e,out:r,typeName:ct.ZodPipeline})}}class hm extends _t{_parse(e){const r=this._def.innerType._parse(e),n=a=>(oc(a)&&(a.value=Object.freeze(a.value)),a);return om(r)?r.then(a=>n(a)):n(r)}unwrap(){return this._def.innerType}}hm.create=(t,e)=>new hm({innerType:t,typeName:ct.ZodReadonly,...pt(e)});function uI(t,e){const r=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof r=="string"?{message:r}:r}function _9(t,e={},r){return t?ud.create().superRefine((n,a)=>{const s=t(n);if(s instanceof Promise)return s.then(l=>{if(!l){const c=uI(e,n),d=c.fatal??r??!0;a.addIssue({code:"custom",...c,fatal:d})}});if(!s){const l=uI(e,n),c=l.fatal??r??!0;a.addIssue({code:"custom",...l,fatal:c})}}):ud.create()}var ct;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(ct||(ct={}));const kEe=(t,e={message:`Input not instance of ${t.name}`})=>_9(r=>r instanceof t,e),be=Ro.create,$r=ic.create,Pr=w_.create,IEe=sm.create,OEe=lm.create,T9=ud.create,Dd=zl.create;Ti.create;const Ze=za.create,Pe=Nr.create,dn=cm.create,R9=rR.create;um.create;ko.create;const Ld=dm.create,DEe=$u.create,mt=fm.create,Io=Ss.create,LEe=fd.create,Ne=Ao.create;ws.create;const C9=it,zm="2025-06-18",A9=[zm,"2025-03-26","2024-11-05","2024-10-07"],$m="2.0",Gz=dn([be(),$r().int()]),Wz=be(),N9=Pe({progressToken:Ne(Gz)}).passthrough(),la=Pe({_meta:Ne(N9)}).passthrough(),Rn=Pe({method:be(),params:Ne(la)}),Md=Pe({_meta:Ne(Pe({}).passthrough())}).passthrough(),Za=Pe({method:be(),params:Ne(Md)}),ca=Pe({_meta:Ne(Pe({}).passthrough())}).passthrough(),Bm=dn([be(),$r().int()]),Yz=Pe({jsonrpc:mt($m),id:Bm}).merge(Rn).strict(),Kz=t=>Yz.safeParse(t).success,Zz=Pe({jsonrpc:mt($m)}).merge(Za).strict(),k9=t=>Zz.safeParse(t).success,Xz=Pe({jsonrpc:mt($m),id:Bm,result:ca}).strict(),C_=t=>Xz.safeParse(t).success;var La;(function(t){t[t.ConnectionClosed=-32e3]="ConnectionClosed",t[t.RequestTimeout=-32001]="RequestTimeout",t[t.ParseError=-32700]="ParseError",t[t.InvalidRequest=-32600]="InvalidRequest",t[t.MethodNotFound=-32601]="MethodNotFound",t[t.InvalidParams=-32602]="InvalidParams",t[t.InternalError=-32603]="InternalError"})(La||(La={}));const Qz=Pe({jsonrpc:mt($m),id:Bm,error:Pe({code:$r().int(),message:be(),data:Ne(Dd())})}).strict(),I9=t=>Qz.safeParse(t).success,zp=dn([Yz,Zz,Xz,Qz]),Il=ca.strict(),aR=Za.extend({method:mt("notifications/cancelled"),params:Md.extend({requestId:Bm,reason:be().optional()})}),O9=Pe({src:be(),mimeType:Ne(be()),sizes:Ne(Ze(be()))}).passthrough(),Pd=Pe({icons:Ze(O9).optional()}).passthrough(),jd=Pe({name:be(),title:Ne(be())}).passthrough(),Jz=jd.extend({version:be(),websiteUrl:Ne(be())}).merge(Pd),D9=Pe({experimental:Ne(Pe({}).passthrough()),sampling:Ne(Pe({}).passthrough()),elicitation:Ne(Pe({}).passthrough()),roots:Ne(Pe({listChanged:Ne(Pr())}).passthrough())}).passthrough(),L9=Rn.extend({method:mt("initialize"),params:la.extend({protocolVersion:be(),capabilities:D9,clientInfo:Jz})}),M9=Pe({experimental:Ne(Pe({}).passthrough()),logging:Ne(Pe({}).passthrough()),completions:Ne(Pe({}).passthrough()),prompts:Ne(Pe({listChanged:Ne(Pr())}).passthrough()),resources:Ne(Pe({subscribe:Ne(Pr()),listChanged:Ne(Pr())}).passthrough()),tools:Ne(Pe({listChanged:Ne(Pr())}).passthrough())}).passthrough(),e$=ca.extend({protocolVersion:be(),capabilities:M9,serverInfo:Jz,instructions:Ne(be())}),t$=Za.extend({method:mt("notifications/initialized")}),P9=t=>t$.safeParse(t).success,oR=Rn.extend({method:mt("ping")}),j9=Pe({progress:$r(),total:Ne($r()),message:Ne(be())}).passthrough(),iR=Za.extend({method:mt("notifications/progress"),params:Md.merge(j9).extend({progressToken:Gz})}),qm=Rn.extend({params:la.extend({cursor:Ne(Wz)}).optional()}),Hm=ca.extend({nextCursor:Ne(Wz)}),r$=Pe({uri:be(),mimeType:Ne(be()),_meta:Ne(Pe({}).passthrough())}).passthrough(),n$=r$.extend({text:be()}),sR=be().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),a$=r$.extend({blob:sR}),o$=jd.extend({uri:be(),description:Ne(be()),mimeType:Ne(be()),_meta:Ne(Pe({}).passthrough())}).merge(Pd),U9=jd.extend({uriTemplate:be(),description:Ne(be()),mimeType:Ne(be()),_meta:Ne(Pe({}).passthrough())}).merge(Pd),F9=qm.extend({method:mt("resources/list")}),i$=Hm.extend({resources:Ze(o$)}),z9=qm.extend({method:mt("resources/templates/list")}),s$=Hm.extend({resourceTemplates:Ze(U9)}),$9=Rn.extend({method:mt("resources/read"),params:la.extend({uri:be()})}),l$=ca.extend({contents:Ze(dn([n$,a$]))}),B9=Za.extend({method:mt("notifications/resources/list_changed")}),q9=Rn.extend({method:mt("resources/subscribe"),params:la.extend({uri:be()})}),H9=Rn.extend({method:mt("resources/unsubscribe"),params:la.extend({uri:be()})}),V9=Za.extend({method:mt("notifications/resources/updated"),params:Md.extend({uri:be()})}),G9=Pe({name:be(),description:Ne(be()),required:Ne(Pr())}).passthrough(),W9=jd.extend({description:Ne(be()),arguments:Ne(Ze(G9)),_meta:Ne(Pe({}).passthrough())}).merge(Pd),Y9=qm.extend({method:mt("prompts/list")}),c$=Hm.extend({prompts:Ze(W9)}),K9=Rn.extend({method:mt("prompts/get"),params:la.extend({name:be(),arguments:Ne(Ld(be()))})}),lR=Pe({type:mt("text"),text:be(),_meta:Ne(Pe({}).passthrough())}).passthrough(),cR=Pe({type:mt("image"),data:sR,mimeType:be(),_meta:Ne(Pe({}).passthrough())}).passthrough(),uR=Pe({type:mt("audio"),data:sR,mimeType:be(),_meta:Ne(Pe({}).passthrough())}).passthrough(),Z9=Pe({type:mt("resource"),resource:dn([n$,a$]),_meta:Ne(Pe({}).passthrough())}).passthrough(),X9=o$.extend({type:mt("resource_link")}),u$=dn([lR,cR,uR,X9,Z9]),Q9=Pe({role:Io(["user","assistant"]),content:u$}).passthrough(),d$=ca.extend({description:Ne(be()),messages:Ze(Q9)}),J9=Za.extend({method:mt("notifications/prompts/list_changed")}),e8=Pe({title:Ne(be()),readOnlyHint:Ne(Pr()),destructiveHint:Ne(Pr()),idempotentHint:Ne(Pr()),openWorldHint:Ne(Pr())}).passthrough(),t8=jd.extend({description:Ne(be()),inputSchema:Pe({type:mt("object"),properties:Ne(Pe({}).passthrough()),required:Ne(Ze(be()))}).passthrough(),outputSchema:Ne(Pe({type:mt("object"),properties:Ne(Pe({}).passthrough()),required:Ne(Ze(be()))}).passthrough()),annotations:Ne(e8),_meta:Ne(Pe({}).passthrough())}).merge(Pd),r8=qm.extend({method:mt("tools/list")}),f$=Hm.extend({tools:Ze(t8)}),dR=ca.extend({content:Ze(u$).default([]),structuredContent:Pe({}).passthrough().optional(),isError:Ne(Pr())});dR.or(ca.extend({toolResult:Dd()}));const n8=Rn.extend({method:mt("tools/call"),params:la.extend({name:be(),arguments:Ne(Ld(Dd()))})}),a8=Za.extend({method:mt("notifications/tools/list_changed")}),p$=Io(["debug","info","notice","warning","error","critical","alert","emergency"]),o8=Rn.extend({method:mt("logging/setLevel"),params:la.extend({level:p$})}),i8=Za.extend({method:mt("notifications/message"),params:Md.extend({level:p$,logger:Ne(be()),data:Dd()})}),s8=Pe({name:be().optional()}).passthrough(),l8=Pe({hints:Ne(Ze(s8)),costPriority:Ne($r().min(0).max(1)),speedPriority:Ne($r().min(0).max(1)),intelligencePriority:Ne($r().min(0).max(1))}).passthrough(),c8=Pe({role:Io(["user","assistant"]),content:dn([lR,cR,uR])}).passthrough(),u8=Rn.extend({method:mt("sampling/createMessage"),params:la.extend({messages:Ze(c8),systemPrompt:Ne(be()),includeContext:Ne(Io(["none","thisServer","allServers"])),temperature:Ne($r()),maxTokens:$r().int(),stopSequences:Ne(Ze(be())),metadata:Ne(Pe({}).passthrough()),modelPreferences:Ne(l8)})}),d8=ca.extend({model:be(),stopReason:Ne(Io(["endTurn","stopSequence","maxTokens"]).or(be())),role:Io(["user","assistant"]),content:R9("type",[lR,cR,uR])}),f8=Pe({type:mt("boolean"),title:Ne(be()),description:Ne(be()),default:Ne(Pr())}).passthrough(),p8=Pe({type:mt("string"),title:Ne(be()),description:Ne(be()),minLength:Ne($r()),maxLength:Ne($r()),format:Ne(Io(["email","uri","date","date-time"]))}).passthrough(),m8=Pe({type:Io(["number","integer"]),title:Ne(be()),description:Ne(be()),minimum:Ne($r()),maximum:Ne($r())}).passthrough(),h8=Pe({type:mt("string"),title:Ne(be()),description:Ne(be()),enum:Ze(be()),enumNames:Ne(Ze(be()))}).passthrough(),g8=dn([f8,p8,m8,h8]),v8=Rn.extend({method:mt("elicitation/create"),params:la.extend({message:be(),requestedSchema:Pe({type:mt("object"),properties:Ld(be(),g8),required:Ne(Ze(be()))}).passthrough()})}),b8=ca.extend({action:Io(["accept","decline","cancel"]),content:Ne(Ld(be(),Dd()))}),y8=Pe({type:mt("ref/resource"),uri:be()}).passthrough(),E8=Pe({type:mt("ref/prompt"),name:be()}).passthrough(),S8=Rn.extend({method:mt("completion/complete"),params:la.extend({ref:dn([E8,y8]),argument:Pe({name:be(),value:be()}).passthrough(),context:Ne(Pe({arguments:Ne(Ld(be(),be()))}))})}),m$=ca.extend({completion:Pe({values:Ze(be()).max(100),total:Ne($r().int()),hasMore:Ne(Pr())}).passthrough()}),x8=Pe({uri:be().startsWith("file://"),name:Ne(be()),_meta:Ne(Pe({}).passthrough())}).passthrough(),w8=Rn.extend({method:mt("roots/list")}),_8=ca.extend({roots:Ze(x8)}),T8=Za.extend({method:mt("notifications/roots/list_changed")});dn([oR,L9,S8,o8,K9,Y9,F9,z9,$9,q9,H9,n8,r8]);dn([aR,iR,t$,T8]);dn([Il,d8,b8,_8]);dn([oR,u8,v8,w8]);dn([aR,iR,i8,V9,B9,a8,J9]);dn([Il,e$,m$,d$,c$,i$,s$,l$,dR,f$]);class wi extends Error{constructor(e,r,n){super(`MCP error ${e}: ${r}`),this.code=e,this.data=n,this.name="McpError"}}const R8=6e4;class C8{constructor(e){this._options=e,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this.setNotificationHandler(aR,r=>{const n=this._requestHandlerAbortControllers.get(r.params.requestId);n?.abort(r.params.reason)}),this.setNotificationHandler(iR,r=>{this._onprogress(r)}),this.setRequestHandler(oR,r=>({}))}_setupTimeout(e,r,n,a,s=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(a,r),startTime:Date.now(),timeout:r,maxTotalTimeout:n,resetTimeoutOnProgress:s,onTimeout:a})}_resetTimeout(e){const r=this._timeoutInfo.get(e);if(!r)return!1;const n=Date.now()-r.startTime;if(r.maxTotalTimeout&&n>=r.maxTotalTimeout)throw this._timeoutInfo.delete(e),new wi(La.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:n});return clearTimeout(r.timeoutId),r.timeoutId=setTimeout(r.onTimeout,r.timeout),!0}_cleanupTimeout(e){const r=this._timeoutInfo.get(e);r&&(clearTimeout(r.timeoutId),this._timeoutInfo.delete(e))}async connect(e){var r,n,a;this._transport=e;const s=(r=this.transport)===null||r===void 0?void 0:r.onclose;this._transport.onclose=()=>{s?.(),this._onclose()};const l=(n=this.transport)===null||n===void 0?void 0:n.onerror;this._transport.onerror=d=>{l?.(d),this._onerror(d)};const c=(a=this._transport)===null||a===void 0?void 0:a.onmessage;this._transport.onmessage=(d,f)=>{c?.(d,f),C_(d)||I9(d)?this._onresponse(d):Kz(d)?this._onrequest(d,f):k9(d)?this._onnotification(d):this._onerror(new Error(`Unknown message type: ${JSON.stringify(d)}`))},await this._transport.start()}_onclose(){var e;const r=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._pendingDebouncedNotifications.clear(),this._transport=void 0,(e=this.onclose)===null||e===void 0||e.call(this);const n=new wi(La.ConnectionClosed,"Connection closed");for(const a of r.values())a(n)}_onerror(e){var r;(r=this.onerror)===null||r===void 0||r.call(this,e)}_onnotification(e){var r;const n=(r=this._notificationHandlers.get(e.method))!==null&&r!==void 0?r:this.fallbackNotificationHandler;n!==void 0&&Promise.resolve().then(()=>n(e)).catch(a=>this._onerror(new Error(`Uncaught error in notification handler: ${a}`)))}_onrequest(e,r){var n,a;const s=(n=this._requestHandlers.get(e.method))!==null&&n!==void 0?n:this.fallbackRequestHandler,l=this._transport;if(s===void 0){l?.send({jsonrpc:"2.0",id:e.id,error:{code:La.MethodNotFound,message:"Method not found"}}).catch(f=>this._onerror(new Error(`Failed to send an error response: ${f}`)));return}const c=new AbortController;this._requestHandlerAbortControllers.set(e.id,c);const d={signal:c.signal,sessionId:l?.sessionId,_meta:(a=e.params)===null||a===void 0?void 0:a._meta,sendNotification:f=>this.notification(f,{relatedRequestId:e.id}),sendRequest:(f,h,g)=>this.request(f,h,{...g,relatedRequestId:e.id}),authInfo:r?.authInfo,requestId:e.id,requestInfo:r?.requestInfo};Promise.resolve().then(()=>s(e,d)).then(f=>{if(!c.signal.aborted)return l?.send({result:f,jsonrpc:"2.0",id:e.id})},f=>{var h;if(!c.signal.aborted)return l?.send({jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(f.code)?f.code:La.InternalError,message:(h=f.message)!==null&&h!==void 0?h:"Internal error"}})}).catch(f=>this._onerror(new Error(`Failed to send response: ${f}`))).finally(()=>{this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){const{progressToken:r,...n}=e.params,a=Number(r),s=this._progressHandlers.get(a);if(!s){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}const l=this._responseHandlers.get(a),c=this._timeoutInfo.get(a);if(c&&l&&c.resetTimeoutOnProgress)try{this._resetTimeout(a)}catch(d){l(d);return}s(n)}_onresponse(e){const r=Number(e.id),n=this._responseHandlers.get(r);if(n===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}if(this._responseHandlers.delete(r),this._progressHandlers.delete(r),this._cleanupTimeout(r),C_(e))n(e);else{const a=new wi(e.error.code,e.error.message,e.error.data);n(a)}}get transport(){return this._transport}async close(){var e;await((e=this._transport)===null||e===void 0?void 0:e.close())}request(e,r,n){const{relatedRequestId:a,resumptionToken:s,onresumptiontoken:l}=n??{};return new Promise((c,d)=>{var f,h,g,v,y,w;if(!this._transport){d(new Error("Not connected"));return}((f=this._options)===null||f===void 0?void 0:f.enforceStrictCapabilities)===!0&&this.assertCapabilityForMethod(e.method),(h=n?.signal)===null||h===void 0||h.throwIfAborted();const S=this._requestMessageId++,T={...e,jsonrpc:"2.0",id:S};n?.onprogress&&(this._progressHandlers.set(S,n.onprogress),T.params={...e.params,_meta:{...((g=e.params)===null||g===void 0?void 0:g._meta)||{},progressToken:S}});const x=N=>{var k;this._responseHandlers.delete(S),this._progressHandlers.delete(S),this._cleanupTimeout(S),(k=this._transport)===null||k===void 0||k.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:S,reason:String(N)}},{relatedRequestId:a,resumptionToken:s,onresumptiontoken:l}).catch(A=>this._onerror(new Error(`Failed to send cancellation: ${A}`))),d(N)};this._responseHandlers.set(S,N=>{var k;if(!(!((k=n?.signal)===null||k===void 0)&&k.aborted)){if(N instanceof Error)return d(N);try{const A=r.parse(N.result);c(A)}catch(A){d(A)}}}),(v=n?.signal)===null||v===void 0||v.addEventListener("abort",()=>{var N;x((N=n?.signal)===null||N===void 0?void 0:N.reason)});const _=(y=n?.timeout)!==null&&y!==void 0?y:R8,C=()=>x(new wi(La.RequestTimeout,"Request timed out",{timeout:_}));this._setupTimeout(S,_,n?.maxTotalTimeout,C,(w=n?.resetTimeoutOnProgress)!==null&&w!==void 0?w:!1),this._transport.send(T,{relatedRequestId:a,resumptionToken:s,onresumptiontoken:l}).catch(N=>{this._cleanupTimeout(S),d(N)})})}async notification(e,r){var n,a;if(!this._transport)throw new Error("Not connected");if(this.assertNotificationCapability(e.method),((a=(n=this._options)===null||n===void 0?void 0:n.debouncedNotificationMethods)!==null&&a!==void 0?a:[]).includes(e.method)&&!e.params&&!r?.relatedRequestId){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{var d;if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;const f={...e,jsonrpc:"2.0"};(d=this._transport)===null||d===void 0||d.send(f,r).catch(h=>this._onerror(h))});return}const c={...e,jsonrpc:"2.0"};await this._transport.send(c,r)}setRequestHandler(e,r){const n=e.shape.method.value;this.assertRequestHandlerCapability(n),this._requestHandlers.set(n,(a,s)=>Promise.resolve(r(e.parse(a),s)))}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw new Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,r){this._notificationHandlers.set(e.shape.method.value,n=>Promise.resolve(r(e.parse(n))))}removeNotificationHandler(e){this._notificationHandlers.delete(e)}}function A8(t,e){return Object.entries(e).reduce((r,[n,a])=>(a&&typeof a=="object"?r[n]=r[n]?{...r[n],...a}:a:r[n]=a,r),{...t})}var Au={exports:{}};var N8=Au.exports,dI;function k8(){return dI||(dI=1,(function(t,e){(function(r,n){n(e)})(N8,(function(r){function n(){for(var ae=arguments.length,K=Array(ae),ie=0;ie<ae;ie++)K[ie]=arguments[ie];if(K.length>1){K[0]=K[0].slice(0,-1);for(var ye=K.length-1,ve=1;ve<ye;++ve)K[ve]=K[ve].slice(1,-1);return K[ye]=K[ye].slice(1),K.join("")}else return K[0]}function a(ae){return"(?:"+ae+")"}function s(ae){return ae===void 0?"undefined":ae===null?"null":Object.prototype.toString.call(ae).split(" ").pop().split("]").shift().toLowerCase()}function l(ae){return ae.toUpperCase()}function c(ae){return ae!=null?ae instanceof Array?ae:typeof ae.length!="number"||ae.split||ae.setInterval||ae.call?[ae]:Array.prototype.slice.call(ae):[]}function d(ae,K){var ie=ae;if(K)for(var ye in K)ie[ye]=K[ye];return ie}function f(ae){var K="[A-Za-z]",ie="[0-9]",ye=n(ie,"[A-Fa-f]"),ve=a(a("%[EFef]"+ye+"%"+ye+ye+"%"+ye+ye)+"|"+a("%[89A-Fa-f]"+ye+"%"+ye+ye)+"|"+a("%"+ye+ye)),Ue="[\\:\\/\\?\\#\\[\\]\\@]",Be="[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",ht=n(Ue,Be),Ut=ae?"[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]":"[]",sr=ae?"[\\uE000-\\uF8FF]":"[]",Et=n(K,ie,"[\\-\\.\\_\\~]",Ut);a(K+n(K,ie,"[\\+\\-\\.]")+"*"),a(a(ve+"|"+n(Et,Be,"[\\:]"))+"*");var Ft=a(a("25[0-5]")+"|"+a("2[0-4]"+ie)+"|"+a("1"+ie+ie)+"|"+a("0?[1-9]"+ie)+"|0?0?"+ie),Wt=a(Ft+"\\."+Ft+"\\."+Ft+"\\."+Ft),st=a(ye+"{1,4}"),Dt=a(a(st+"\\:"+st)+"|"+Wt),Yt=a(a(st+"\\:")+"{6}"+Dt),Pt=a("\\:\\:"+a(st+"\\:")+"{5}"+Dt),on=a(a(st)+"?\\:\\:"+a(st+"\\:")+"{4}"+Dt),zt=a(a(a(st+"\\:")+"{0,1}"+st)+"?\\:\\:"+a(st+"\\:")+"{3}"+Dt),Nn=a(a(a(st+"\\:")+"{0,2}"+st)+"?\\:\\:"+a(st+"\\:")+"{2}"+Dt),eo=a(a(a(st+"\\:")+"{0,3}"+st)+"?\\:\\:"+st+"\\:"+Dt),sn=a(a(a(st+"\\:")+"{0,4}"+st)+"?\\:\\:"+Dt),Ir=a(a(a(st+"\\:")+"{0,5}"+st)+"?\\:\\:"+st),Hn=a(a(a(st+"\\:")+"{0,6}"+st)+"?\\:\\:"),Ra=a([Yt,Pt,on,zt,Nn,eo,sn,Ir,Hn].join("|")),Vn=a(a(Et+"|"+ve)+"+");a("[vV]"+ye+"+\\."+n(Et,Be,"[\\:]")+"+"),a(a(ve+"|"+n(Et,Be))+"*");var ji=a(ve+"|"+n(Et,Be,"[\\:\\@]"));return a(a(ve+"|"+n(Et,Be,"[\\@]"))+"+"),a(a(ji+"|"+n("[\\/\\?]",sr))+"*"),{NOT_SCHEME:new RegExp(n("[^]",K,ie,"[\\+\\-\\.]"),"g"),NOT_USERINFO:new RegExp(n("[^\\%\\:]",Et,Be),"g"),NOT_HOST:new RegExp(n("[^\\%\\[\\]\\:]",Et,Be),"g"),NOT_PATH:new RegExp(n("[^\\%\\/\\:\\@]",Et,Be),"g"),NOT_PATH_NOSCHEME:new RegExp(n("[^\\%\\/\\@]",Et,Be),"g"),NOT_QUERY:new RegExp(n("[^\\%]",Et,Be,"[\\:\\@\\/\\?]",sr),"g"),NOT_FRAGMENT:new RegExp(n("[^\\%]",Et,Be,"[\\:\\@\\/\\?]"),"g"),ESCAPE:new RegExp(n("[^]",Et,Be),"g"),UNRESERVED:new RegExp(Et,"g"),OTHER_CHARS:new RegExp(n("[^\\%]",Et,ht),"g"),PCT_ENCODED:new RegExp(ve,"g"),IPV4ADDRESS:new RegExp("^("+Wt+")$"),IPV6ADDRESS:new RegExp("^\\[?("+Ra+")"+a(a("\\%25|\\%(?!"+ye+"{2})")+"("+Vn+")")+"?\\]?$")}}var h=f(!1),g=f(!0),v=(function(){function ae(K,ie){var ye=[],ve=!0,Ue=!1,Be=void 0;try{for(var ht=K[Symbol.iterator](),Ut;!(ve=(Ut=ht.next()).done)&&(ye.push(Ut.value),!(ie&&ye.length===ie));ve=!0);}catch(sr){Ue=!0,Be=sr}finally{try{!ve&&ht.return&&ht.return()}finally{if(Ue)throw Be}}return ye}return function(K,ie){if(Array.isArray(K))return K;if(Symbol.iterator in Object(K))return ae(K,ie);throw new TypeError("Invalid attempt to destructure non-iterable instance")}})(),y=function(ae){if(Array.isArray(ae)){for(var K=0,ie=Array(ae.length);K<ae.length;K++)ie[K]=ae[K];return ie}else return Array.from(ae)},w=2147483647,S=36,T=1,x=26,_=38,C=700,N=72,k=128,A="-",I=/^xn--/,O=/[^\0-\x7E]/,L=/[\x2E\u3002\uFF0E\uFF61]/g,M={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},P=S-T,W=Math.floor,X=String.fromCharCode;function ee(ae){throw new RangeError(M[ae])}function J(ae,K){for(var ie=[],ye=ae.length;ye--;)ie[ye]=K(ae[ye]);return ie}function B(ae,K){var ie=ae.split("@"),ye="";ie.length>1&&(ye=ie[0]+"@",ae=ie[1]),ae=ae.replace(L,".");var ve=ae.split("."),Ue=J(ve,K).join(".");return ye+Ue}function Y(ae){for(var K=[],ie=0,ye=ae.length;ie<ye;){var ve=ae.charCodeAt(ie++);if(ve>=55296&&ve<=56319&&ie<ye){var Ue=ae.charCodeAt(ie++);(Ue&64512)==56320?K.push(((ve&1023)<<10)+(Ue&1023)+65536):(K.push(ve),ie--)}else K.push(ve)}return K}var H=function(K){return String.fromCodePoint.apply(String,y(K))},re=function(K){return K-48<10?K-22:K-65<26?K-65:K-97<26?K-97:S},Q=function(K,ie){return K+22+75*(K<26)-((ie!=0)<<5)},j=function(K,ie,ye){var ve=0;for(K=ye?W(K/C):K>>1,K+=W(K/ie);K>P*x>>1;ve+=S)K=W(K/P);return W(ve+(P+1)*K/(K+_))},q=function(K){var ie=[],ye=K.length,ve=0,Ue=k,Be=N,ht=K.lastIndexOf(A);ht<0&&(ht=0);for(var Ut=0;Ut<ht;++Ut)K.charCodeAt(Ut)>=128&&ee("not-basic"),ie.push(K.charCodeAt(Ut));for(var sr=ht>0?ht+1:0;sr<ye;){for(var Et=ve,Ft=1,Wt=S;;Wt+=S){sr>=ye&&ee("invalid-input");var st=re(K.charCodeAt(sr++));(st>=S||st>W((w-ve)/Ft))&&ee("overflow"),ve+=st*Ft;var Dt=Wt<=Be?T:Wt>=Be+x?x:Wt-Be;if(st<Dt)break;var Yt=S-Dt;Ft>W(w/Yt)&&ee("overflow"),Ft*=Yt}var Pt=ie.length+1;Be=j(ve-Et,Pt,Et==0),W(ve/Pt)>w-Ue&&ee("overflow"),Ue+=W(ve/Pt),ve%=Pt,ie.splice(ve++,0,Ue)}return String.fromCodePoint.apply(String,ie)},z=function(K){var ie=[];K=Y(K);var ye=K.length,ve=k,Ue=0,Be=N,ht=!0,Ut=!1,sr=void 0;try{for(var Et=K[Symbol.iterator](),Ft;!(ht=(Ft=Et.next()).done);ht=!0){var Wt=Ft.value;Wt<128&&ie.push(X(Wt))}}catch(Bo){Ut=!0,sr=Bo}finally{try{!ht&&Et.return&&Et.return()}finally{if(Ut)throw sr}}var st=ie.length,Dt=st;for(st&&ie.push(A);Dt<ye;){var Yt=w,Pt=!0,on=!1,zt=void 0;try{for(var Nn=K[Symbol.iterator](),eo;!(Pt=(eo=Nn.next()).done);Pt=!0){var sn=eo.value;sn>=ve&&sn<Yt&&(Yt=sn)}}catch(Bo){on=!0,zt=Bo}finally{try{!Pt&&Nn.return&&Nn.return()}finally{if(on)throw zt}}var Ir=Dt+1;Yt-ve>W((w-Ue)/Ir)&&ee("overflow"),Ue+=(Yt-ve)*Ir,ve=Yt;var Hn=!0,Ra=!1,Vn=void 0;try{for(var ji=K[Symbol.iterator](),Ui;!(Hn=(Ui=ji.next()).done);Hn=!0){var Fi=Ui.value;if(Fi<ve&&++Ue>w&&ee("overflow"),Fi==ve){for(var mn=Ue,qr=S;;qr+=S){var zi=qr<=Be?T:qr>=Be+x?x:qr-Be;if(mn<zi)break;var sf=mn-zi,Ms=S-zi;ie.push(X(Q(zi+sf%Ms,0))),mn=W(sf/Ms)}ie.push(X(Q(mn,0))),Be=j(Ue,Ir,Dt==st),Ue=0,++Dt}}}catch(Bo){Ra=!0,Vn=Bo}finally{try{!Hn&&ji.return&&ji.return()}finally{if(Ra)throw Vn}}++Ue,++ve}return ie.join("")},G=function(K){return B(K,function(ie){return I.test(ie)?q(ie.slice(4).toLowerCase()):ie})},Z=function(K){return B(K,function(ie){return O.test(ie)?"xn--"+z(ie):ie})},U={version:"2.1.0",ucs2:{decode:Y,encode:H},decode:q,encode:z,toASCII:Z,toUnicode:G},F={};function te(ae){var K=ae.charCodeAt(0),ie=void 0;return K<16?ie="%0"+K.toString(16).toUpperCase():K<128?ie="%"+K.toString(16).toUpperCase():K<2048?ie="%"+(K>>6|192).toString(16).toUpperCase()+"%"+(K&63|128).toString(16).toUpperCase():ie="%"+(K>>12|224).toString(16).toUpperCase()+"%"+(K>>6&63|128).toString(16).toUpperCase()+"%"+(K&63|128).toString(16).toUpperCase(),ie}function fe(ae){for(var K="",ie=0,ye=ae.length;ie<ye;){var ve=parseInt(ae.substr(ie+1,2),16);if(ve<128)K+=String.fromCharCode(ve),ie+=3;else if(ve>=194&&ve<224){if(ye-ie>=6){var Ue=parseInt(ae.substr(ie+4,2),16);K+=String.fromCharCode((ve&31)<<6|Ue&63)}else K+=ae.substr(ie,6);ie+=6}else if(ve>=224){if(ye-ie>=9){var Be=parseInt(ae.substr(ie+4,2),16),ht=parseInt(ae.substr(ie+7,2),16);K+=String.fromCharCode((ve&15)<<12|(Be&63)<<6|ht&63)}else K+=ae.substr(ie,9);ie+=9}else K+=ae.substr(ie,3),ie+=3}return K}function V(ae,K){function ie(ye){var ve=fe(ye);return ve.match(K.UNRESERVED)?ve:ye}return ae.scheme&&(ae.scheme=String(ae.scheme).replace(K.PCT_ENCODED,ie).toLowerCase().replace(K.NOT_SCHEME,"")),ae.userinfo!==void 0&&(ae.userinfo=String(ae.userinfo).replace(K.PCT_ENCODED,ie).replace(K.NOT_USERINFO,te).replace(K.PCT_ENCODED,l)),ae.host!==void 0&&(ae.host=String(ae.host).replace(K.PCT_ENCODED,ie).toLowerCase().replace(K.NOT_HOST,te).replace(K.PCT_ENCODED,l)),ae.path!==void 0&&(ae.path=String(ae.path).replace(K.PCT_ENCODED,ie).replace(ae.scheme?K.NOT_PATH:K.NOT_PATH_NOSCHEME,te).replace(K.PCT_ENCODED,l)),ae.query!==void 0&&(ae.query=String(ae.query).replace(K.PCT_ENCODED,ie).replace(K.NOT_QUERY,te).replace(K.PCT_ENCODED,l)),ae.fragment!==void 0&&(ae.fragment=String(ae.fragment).replace(K.PCT_ENCODED,ie).replace(K.NOT_FRAGMENT,te).replace(K.PCT_ENCODED,l)),ae}function de(ae){return ae.replace(/^0*(.*)/,"$1")||"0"}function le(ae,K){var ie=ae.match(K.IPV4ADDRESS)||[],ye=v(ie,2),ve=ye[1];return ve?ve.split(".").map(de).join("."):ae}function pe(ae,K){var ie=ae.match(K.IPV6ADDRESS)||[],ye=v(ie,3),ve=ye[1],Ue=ye[2];if(ve){for(var Be=ve.toLowerCase().split("::").reverse(),ht=v(Be,2),Ut=ht[0],sr=ht[1],Et=sr?sr.split(":").map(de):[],Ft=Ut.split(":").map(de),Wt=K.IPV4ADDRESS.test(Ft[Ft.length-1]),st=Wt?7:8,Dt=Ft.length-st,Yt=Array(st),Pt=0;Pt<st;++Pt)Yt[Pt]=Et[Pt]||Ft[Dt+Pt]||"";Wt&&(Yt[st-1]=le(Yt[st-1],K));var on=Yt.reduce(function(Ir,Hn,Ra){if(!Hn||Hn==="0"){var Vn=Ir[Ir.length-1];Vn&&Vn.index+Vn.length===Ra?Vn.length++:Ir.push({index:Ra,length:1})}return Ir},[]),zt=on.sort(function(Ir,Hn){return Hn.length-Ir.length})[0],Nn=void 0;if(zt&&zt.length>1){var eo=Yt.slice(0,zt.index),sn=Yt.slice(zt.index+zt.length);Nn=eo.join(":")+"::"+sn.join(":")}else Nn=Yt.join(":");return Ue&&(Nn+="%"+Ue),Nn}else return ae}var Re=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,Ke="".match(/(){0}/)[1]===void 0;function je(ae){var K=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},ie={},ye=K.iri!==!1?g:h;K.reference==="suffix"&&(ae=(K.scheme?K.scheme+":":"")+"//"+ae);var ve=ae.match(Re);if(ve){Ke?(ie.scheme=ve[1],ie.userinfo=ve[3],ie.host=ve[4],ie.port=parseInt(ve[5],10),ie.path=ve[6]||"",ie.query=ve[7],ie.fragment=ve[8],isNaN(ie.port)&&(ie.port=ve[5])):(ie.scheme=ve[1]||void 0,ie.userinfo=ae.indexOf("@")!==-1?ve[3]:void 0,ie.host=ae.indexOf("//")!==-1?ve[4]:void 0,ie.port=parseInt(ve[5],10),ie.path=ve[6]||"",ie.query=ae.indexOf("?")!==-1?ve[7]:void 0,ie.fragment=ae.indexOf("#")!==-1?ve[8]:void 0,isNaN(ie.port)&&(ie.port=ae.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?ve[4]:void 0)),ie.host&&(ie.host=pe(le(ie.host,ye),ye)),ie.scheme===void 0&&ie.userinfo===void 0&&ie.host===void 0&&ie.port===void 0&&!ie.path&&ie.query===void 0?ie.reference="same-document":ie.scheme===void 0?ie.reference="relative":ie.fragment===void 0?ie.reference="absolute":ie.reference="uri",K.reference&&K.reference!=="suffix"&&K.reference!==ie.reference&&(ie.error=ie.error||"URI is not a "+K.reference+" reference.");var Ue=F[(K.scheme||ie.scheme||"").toLowerCase()];if(!K.unicodeSupport&&(!Ue||!Ue.unicodeSupport)){if(ie.host&&(K.domainHost||Ue&&Ue.domainHost))try{ie.host=U.toASCII(ie.host.replace(ye.PCT_ENCODED,fe).toLowerCase())}catch(Be){ie.error=ie.error||"Host's domain name can not be converted to ASCII via punycode: "+Be}V(ie,h)}else V(ie,ye);Ue&&Ue.parse&&Ue.parse(ie,K)}else ie.error=ie.error||"URI can not be parsed.";return ie}function ze(ae,K){var ie=K.iri!==!1?g:h,ye=[];return ae.userinfo!==void 0&&(ye.push(ae.userinfo),ye.push("@")),ae.host!==void 0&&ye.push(pe(le(String(ae.host),ie),ie).replace(ie.IPV6ADDRESS,function(ve,Ue,Be){return"["+Ue+(Be?"%25"+Be:"")+"]"})),(typeof ae.port=="number"||typeof ae.port=="string")&&(ye.push(":"),ye.push(String(ae.port))),ye.length?ye.join(""):void 0}var _e=/^\.\.?\//,Ae=/^\/\.(\/|$)/,$e=/^\/\.\.(\/|$)/,oe=/^\/?(?:.|\n)*?(?=\/|$)/;function Se(ae){for(var K=[];ae.length;)if(ae.match(_e))ae=ae.replace(_e,"");else if(ae.match(Ae))ae=ae.replace(Ae,"/");else if(ae.match($e))ae=ae.replace($e,"/"),K.pop();else if(ae==="."||ae==="..")ae="";else{var ie=ae.match(oe);if(ie){var ye=ie[0];ae=ae.slice(ye.length),K.push(ye)}else throw new Error("Unexpected dot segment condition")}return K.join("")}function Le(ae){var K=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},ie=K.iri?g:h,ye=[],ve=F[(K.scheme||ae.scheme||"").toLowerCase()];if(ve&&ve.serialize&&ve.serialize(ae,K),ae.host&&!ie.IPV6ADDRESS.test(ae.host)){if(K.domainHost||ve&&ve.domainHost)try{ae.host=K.iri?U.toUnicode(ae.host):U.toASCII(ae.host.replace(ie.PCT_ENCODED,fe).toLowerCase())}catch(ht){ae.error=ae.error||"Host's domain name can not be converted to "+(K.iri?"Unicode":"ASCII")+" via punycode: "+ht}}V(ae,ie),K.reference!=="suffix"&&ae.scheme&&(ye.push(ae.scheme),ye.push(":"));var Ue=ze(ae,K);if(Ue!==void 0&&(K.reference!=="suffix"&&ye.push("//"),ye.push(Ue),ae.path&&ae.path.charAt(0)!=="/"&&ye.push("/")),ae.path!==void 0){var Be=ae.path;!K.absolutePath&&(!ve||!ve.absolutePath)&&(Be=Se(Be)),Ue===void 0&&(Be=Be.replace(/^\/\//,"/%2F")),ye.push(Be)}return ae.query!==void 0&&(ye.push("?"),ye.push(ae.query)),ae.fragment!==void 0&&(ye.push("#"),ye.push(ae.fragment)),ye.join("")}function we(ae,K){var ie=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},ye=arguments[3],ve={};return ye||(ae=je(Le(ae,ie),ie),K=je(Le(K,ie),ie)),ie=ie||{},!ie.tolerant&&K.scheme?(ve.scheme=K.scheme,ve.userinfo=K.userinfo,ve.host=K.host,ve.port=K.port,ve.path=Se(K.path||""),ve.query=K.query):(K.userinfo!==void 0||K.host!==void 0||K.port!==void 0?(ve.userinfo=K.userinfo,ve.host=K.host,ve.port=K.port,ve.path=Se(K.path||""),ve.query=K.query):(K.path?(K.path.charAt(0)==="/"?ve.path=Se(K.path):((ae.userinfo!==void 0||ae.host!==void 0||ae.port!==void 0)&&!ae.path?ve.path="/"+K.path:ae.path?ve.path=ae.path.slice(0,ae.path.lastIndexOf("/")+1)+K.path:ve.path=K.path,ve.path=Se(ve.path)),ve.query=K.query):(ve.path=ae.path,K.query!==void 0?ve.query=K.query:ve.query=ae.query),ve.userinfo=ae.userinfo,ve.host=ae.host,ve.port=ae.port),ve.scheme=ae.scheme),ve.fragment=K.fragment,ve}function ke(ae,K,ie){var ye=d({scheme:"null"},ie);return Le(we(je(ae,ye),je(K,ye),ye,!0),ye)}function Oe(ae,K){return typeof ae=="string"?ae=Le(je(ae,K),K):s(ae)==="object"&&(ae=je(Le(ae,K),K)),ae}function Ve(ae,K,ie){return typeof ae=="string"?ae=Le(je(ae,ie),ie):s(ae)==="object"&&(ae=Le(ae,ie)),typeof K=="string"?K=Le(je(K,ie),ie):s(K)==="object"&&(K=Le(K,ie)),ae===K}function et(ae,K){return ae&&ae.toString().replace(!K||!K.iri?h.ESCAPE:g.ESCAPE,te)}function ut(ae,K){return ae&&ae.toString().replace(!K||!K.iri?h.PCT_ENCODED:g.PCT_ENCODED,fe)}var At={scheme:"http",domainHost:!0,parse:function(K,ie){return K.host||(K.error=K.error||"HTTP URIs must have a host."),K},serialize:function(K,ie){var ye=String(K.scheme).toLowerCase()==="https";return(K.port===(ye?443:80)||K.port==="")&&(K.port=void 0),K.path||(K.path="/"),K}},An={scheme:"https",domainHost:At.domainHost,parse:At.parse,serialize:At.serialize};function vr(ae){return typeof ae.secure=="boolean"?ae.secure:String(ae.scheme).toLowerCase()==="wss"}var or={scheme:"ws",domainHost:!0,parse:function(K,ie){var ye=K;return ye.secure=vr(ye),ye.resourceName=(ye.path||"/")+(ye.query?"?"+ye.query:""),ye.path=void 0,ye.query=void 0,ye},serialize:function(K,ie){if((K.port===(vr(K)?443:80)||K.port==="")&&(K.port=void 0),typeof K.secure=="boolean"&&(K.scheme=K.secure?"wss":"ws",K.secure=void 0),K.resourceName){var ye=K.resourceName.split("?"),ve=v(ye,2),Ue=ve[0],Be=ve[1];K.path=Ue&&Ue!=="/"?Ue:void 0,K.query=Be,K.resourceName=void 0}return K.fragment=void 0,K}},Mt={scheme:"wss",domainHost:or.domainHost,parse:or.parse,serialize:or.serialize},Zt={},fr="[A-Za-z0-9\\-\\.\\_\\~\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]",_r="[0-9A-Fa-f]",Bn=a(a("%[EFef]"+_r+"%"+_r+_r+"%"+_r+_r)+"|"+a("%[89A-Fa-f]"+_r+"%"+_r+_r)+"|"+a("%"+_r+_r)),ir="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",Gt="[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",pn=n(Gt,'[\\"\\\\]'),da="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",an=new RegExp(fr,"g"),rt=new RegExp(Bn,"g"),jt=new RegExp(n("[^]",ir,"[\\.]",'[\\"]',pn),"g"),Qt=new RegExp(n("[^]",fr,da),"g"),jr=Qt;function qn(ae){var K=fe(ae);return K.match(an)?K:ae}var Xt={scheme:"mailto",parse:function(K,ie){var ye=K,ve=ye.to=ye.path?ye.path.split(","):[];if(ye.path=void 0,ye.query){for(var Ue=!1,Be={},ht=ye.query.split("&"),Ut=0,sr=ht.length;Ut<sr;++Ut){var Et=ht[Ut].split("=");switch(Et[0]){case"to":for(var Ft=Et[1].split(","),Wt=0,st=Ft.length;Wt<st;++Wt)ve.push(Ft[Wt]);break;case"subject":ye.subject=ut(Et[1],ie);break;case"body":ye.body=ut(Et[1],ie);break;default:Ue=!0,Be[ut(Et[0],ie)]=ut(Et[1],ie);break}}Ue&&(ye.headers=Be)}ye.query=void 0;for(var Dt=0,Yt=ve.length;Dt<Yt;++Dt){var Pt=ve[Dt].split("@");if(Pt[0]=ut(Pt[0]),ie.unicodeSupport)Pt[1]=ut(Pt[1],ie).toLowerCase();else try{Pt[1]=U.toASCII(ut(Pt[1],ie).toLowerCase())}catch(on){ye.error=ye.error||"Email address's domain name can not be converted to ASCII via punycode: "+on}ve[Dt]=Pt.join("@")}return ye},serialize:function(K,ie){var ye=K,ve=c(K.to);if(ve){for(var Ue=0,Be=ve.length;Ue<Be;++Ue){var ht=String(ve[Ue]),Ut=ht.lastIndexOf("@"),sr=ht.slice(0,Ut).replace(rt,qn).replace(rt,l).replace(jt,te),Et=ht.slice(Ut+1);try{Et=ie.iri?U.toUnicode(Et):U.toASCII(ut(Et,ie).toLowerCase())}catch(Dt){ye.error=ye.error||"Email address's domain name can not be converted to "+(ie.iri?"Unicode":"ASCII")+" via punycode: "+Dt}ve[Ue]=sr+"@"+Et}ye.path=ve.join(",")}var Ft=K.headers=K.headers||{};K.subject&&(Ft.subject=K.subject),K.body&&(Ft.body=K.body);var Wt=[];for(var st in Ft)Ft[st]!==Zt[st]&&Wt.push(st.replace(rt,qn).replace(rt,l).replace(Qt,te)+"="+Ft[st].replace(rt,qn).replace(rt,l).replace(jr,te));return Wt.length&&(ye.query=Wt.join("&")),ye}},Jr=/^([^\:]+)\:(.*)/,Ta={scheme:"urn",parse:function(K,ie){var ye=K.path&&K.path.match(Jr),ve=K;if(ye){var Ue=ie.scheme||ve.scheme||"urn",Be=ye[1].toLowerCase(),ht=ye[2],Ut=Ue+":"+(ie.nid||Be),sr=F[Ut];ve.nid=Be,ve.nss=ht,ve.path=void 0,sr&&(ve=sr.parse(ve,ie))}else ve.error=ve.error||"URN can not be parsed.";return ve},serialize:function(K,ie){var ye=ie.scheme||K.scheme||"urn",ve=K.nid,Ue=ye+":"+(ie.nid||ve),Be=F[Ue];Be&&(K=Be.serialize(K,ie));var ht=K,Ut=K.nss;return ht.path=(ve||ie.nid)+":"+Ut,ht}},en=/^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/,Br={scheme:"urn:uuid",parse:function(K,ie){var ye=K;return ye.uuid=ye.nss,ye.nss=void 0,!ie.tolerant&&(!ye.uuid||!ye.uuid.match(en))&&(ye.error=ye.error||"UUID is not valid."),ye},serialize:function(K,ie){var ye=K;return ye.nss=(K.uuid||"").toLowerCase(),ye}};F[At.scheme]=At,F[An.scheme]=An,F[or.scheme]=or,F[Mt.scheme]=Mt,F[Xt.scheme]=Xt,F[Ta.scheme]=Ta,F[Br.scheme]=Br,r.SCHEMES=F,r.pctEncChar=te,r.pctDecChars=fe,r.parse=je,r.removeDotSegments=Se,r.serialize=Le,r.resolveComponents=we,r.resolve=ke,r.normalize=Oe,r.equal=Ve,r.escapeComponent=et,r.unescapeComponent=ut,Object.defineProperty(r,"__esModule",{value:!0})}))})(Au,Au.exports)),Au.exports}var qv,fI;function fR(){return fI||(fI=1,qv=function t(e,r){if(e===r)return!0;if(e&&r&&typeof e=="object"&&typeof r=="object"){if(e.constructor!==r.constructor)return!1;var n,a,s;if(Array.isArray(e)){if(n=e.length,n!=r.length)return!1;for(a=n;a--!==0;)if(!t(e[a],r[a]))return!1;return!0}if(e.constructor===RegExp)return e.source===r.source&&e.flags===r.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===r.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===r.toString();if(s=Object.keys(e),n=s.length,n!==Object.keys(r).length)return!1;for(a=n;a--!==0;)if(!Object.prototype.hasOwnProperty.call(r,s[a]))return!1;for(a=n;a--!==0;){var l=s[a];if(!t(e[l],r[l]))return!1}return!0}return e!==e&&r!==r}),qv}var Hv,pI;function I8(){return pI||(pI=1,Hv=function(e){for(var r=0,n=e.length,a=0,s;a<n;)r++,s=e.charCodeAt(a++),s>=55296&&s<=56319&&a<n&&(s=e.charCodeAt(a),(s&64512)==56320&&a++);return r}),Hv}var Vv,mI;function gc(){if(mI)return Vv;mI=1,Vv={copy:t,checkDataType:e,checkDataTypes:r,coerceToTypes:a,toHash:s,getProperty:d,escapeQuotes:f,equal:fR(),ucs2length:I8(),varOccurences:h,varReplace:g,schemaHasRules:v,schemaHasRulesExcept:y,schemaUnknownRules:w,toQuotedString:S,getPathExpr:T,getPath:x,getData:N,unescapeFragment:A,unescapeJsonPointer:L,escapeFragment:I,escapeJsonPointer:O};function t(M,P){P=P||{};for(var W in M)P[W]=M[W];return P}function e(M,P,W,X){var ee=X?" !== ":" === ",J=X?" || ":" && ",B=X?"!":"",Y=X?"":"!";switch(M){case"null":return P+ee+"null";case"array":return B+"Array.isArray("+P+")";case"object":return"("+B+P+J+"typeof "+P+ee+'"object"'+J+Y+"Array.isArray("+P+"))";case"integer":return"(typeof "+P+ee+'"number"'+J+Y+"("+P+" % 1)"+J+P+ee+P+(W?J+B+"isFinite("+P+")":"")+")";case"number":return"(typeof "+P+ee+'"'+M+'"'+(W?J+B+"isFinite("+P+")":"")+")";default:return"typeof "+P+ee+'"'+M+'"'}}function r(M,P,W){switch(M.length){case 1:return e(M[0],P,W,!0);default:var X="",ee=s(M);ee.array&&ee.object&&(X=ee.null?"(":"(!"+P+" || ",X+="typeof "+P+' !== "object")',delete ee.null,delete ee.array,delete ee.object),ee.number&&delete ee.integer;for(var J in ee)X+=(X?" && ":"")+e(J,P,W,!0);return X}}var n=s(["string","number","integer","boolean","null"]);function a(M,P){if(Array.isArray(P)){for(var W=[],X=0;X<P.length;X++){var ee=P[X];(n[ee]||M==="array"&&ee==="array")&&(W[W.length]=ee)}if(W.length)return W}else{if(n[P])return[P];if(M==="array"&&P==="array")return["array"]}}function s(M){for(var P={},W=0;W<M.length;W++)P[M[W]]=!0;return P}var l=/^[a-z$_][a-z$_0-9]*$/i,c=/'|\\/g;function d(M){return typeof M=="number"?"["+M+"]":l.test(M)?"."+M:"['"+f(M)+"']"}function f(M){return M.replace(c,"\\$&").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\f/g,"\\f").replace(/\t/g,"\\t")}function h(M,P){P+="[^0-9]";var W=M.match(new RegExp(P,"g"));return W?W.length:0}function g(M,P,W){return P+="([^0-9])",W=W.replace(/\$/g,"$$$$"),M.replace(new RegExp(P,"g"),W+"$1")}function v(M,P){if(typeof M=="boolean")return!M;for(var W in M)if(P[W])return!0}function y(M,P,W){if(typeof M=="boolean")return!M&&W!="not";for(var X in M)if(X!=W&&P[X])return!0}function w(M,P){if(typeof M!="boolean"){for(var W in M)if(!P[W])return W}}function S(M){return"'"+f(M)+"'"}function T(M,P,W,X){var ee=W?"'/' + "+P+(X?"":".replace(/~/g, '~0').replace(/\\//g, '~1')"):X?"'[' + "+P+" + ']'":"'[\\'' + "+P+" + '\\']'";return k(M,ee)}function x(M,P,W){var X=S(W?"/"+O(P):d(P));return k(M,X)}var _=/^\/(?:[^~]|~0|~1)*$/,C=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function N(M,P,W){var X,ee,J,B;if(M==="")return"rootData";if(M[0]=="/"){if(!_.test(M))throw new Error("Invalid JSON-pointer: "+M);ee=M,J="rootData"}else{if(B=M.match(C),!B)throw new Error("Invalid JSON-pointer: "+M);if(X=+B[1],ee=B[2],ee=="#"){if(X>=P)throw new Error("Cannot access property/index "+X+" levels up, current level is "+P);return W[P-X]}if(X>P)throw new Error("Cannot access data "+X+" levels up, current level is "+P);if(J="data"+(P-X||""),!ee)return J}for(var Y=J,H=ee.split("/"),re=0;re<H.length;re++){var Q=H[re];Q&&(J+=d(L(Q)),Y+=" && "+J)}return Y}function k(M,P){return M=='""'?P:(M+" + "+P).replace(/([^\\])' \+ '/g,"$1")}function A(M){return L(decodeURIComponent(M))}function I(M){return encodeURIComponent(O(M))}function O(M){return M.replace(/~/g,"~0").replace(/\//g,"~1")}function L(M){return M.replace(/~1/g,"/").replace(/~0/g,"~")}return Vv}var Gv,hI;function h$(){if(hI)return Gv;hI=1;var t=gc();Gv=e;function e(r){t.copy(r,this)}return Gv}var Wv={exports:{}},gI;function O8(){if(gI)return Wv.exports;gI=1;var t=Wv.exports=function(n,a,s){typeof a=="function"&&(s=a,a={}),s=a.cb||s;var l=typeof s=="function"?s:s.pre||function(){},c=s.post||function(){};e(a,l,c,n,"",n)};t.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0},t.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},t.propsKeywords={definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},t.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function e(n,a,s,l,c,d,f,h,g,v){if(l&&typeof l=="object"&&!Array.isArray(l)){a(l,c,d,f,h,g,v);for(var y in l){var w=l[y];if(Array.isArray(w)){if(y in t.arrayKeywords)for(var S=0;S<w.length;S++)e(n,a,s,w[S],c+"/"+y+"/"+S,d,c,y,l,S)}else if(y in t.propsKeywords){if(w&&typeof w=="object")for(var T in w)e(n,a,s,w[T],c+"/"+y+"/"+r(T),d,c,y,l,T)}else(y in t.keywords||n.allKeys&&!(y in t.skipKeywords))&&e(n,a,s,w,c+"/"+y,d,c,y,l)}s(l,c,d,f,h,g,v)}}function r(n){return n.replace(/~/g,"~0").replace(/\//g,"~1")}return Wv.exports}var Yv,vI;function pR(){if(vI)return Yv;vI=1;var t=k8(),e=fR(),r=gc(),n=h$(),a=O8();Yv=s,s.normalizeId=x,s.fullPath=w,s.url=_,s.ids=C,s.inlineRef=g,s.schema=l;function s(N,k,A){var I=this._refs[A];if(typeof I=="string")if(this._refs[I])I=this._refs[I];else return s.call(this,N,k,I);if(I=I||this._schemas[A],I instanceof n)return g(I.schema,this._opts.inlineRefs)?I.schema:I.validate||this._compile(I);var O=l.call(this,k,A),L,M,P;return O&&(L=O.schema,k=O.root,P=O.baseId),L instanceof n?M=L.validate||N.call(this,L.schema,k,void 0,P):L!==void 0&&(M=g(L,this._opts.inlineRefs)?L:N.call(this,L,k,void 0,P)),M}function l(N,k){var A=t.parse(k),I=S(A),O=w(this._getId(N.schema));if(Object.keys(N.schema).length===0||I!==O){var L=x(I),M=this._refs[L];if(typeof M=="string")return c.call(this,N,M,A);if(M instanceof n)M.validate||this._compile(M),N=M;else if(M=this._schemas[L],M instanceof n){if(M.validate||this._compile(M),L==x(k))return{schema:M,root:N,baseId:O};N=M}else return;if(!N.schema)return;O=w(this._getId(N.schema))}return f.call(this,A,O,N.schema,N)}function c(N,k,A){var I=l.call(this,N,k);if(I){var O=I.schema,L=I.baseId;N=I.root;var M=this._getId(O);return M&&(L=_(L,M)),f.call(this,A,L,O,N)}}var d=r.toHash(["properties","patternProperties","enum","dependencies","definitions"]);function f(N,k,A,I){if(N.fragment=N.fragment||"",N.fragment.slice(0,1)=="/"){for(var O=N.fragment.split("/"),L=1;L<O.length;L++){var M=O[L];if(M){if(M=r.unescapeFragment(M),A=A[M],A===void 0)break;var P;if(!d[M]&&(P=this._getId(A),P&&(k=_(k,P)),A.$ref)){var W=_(k,A.$ref),X=l.call(this,I,W);X&&(A=X.schema,I=X.root,k=X.baseId)}}}if(A!==void 0&&A!==I.schema)return{schema:A,root:I,baseId:k}}}var h=r.toHash(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum"]);function g(N,k){if(k===!1)return!1;if(k===void 0||k===!0)return v(N);if(k)return y(N)<=k}function v(N){var k;if(Array.isArray(N)){for(var A=0;A<N.length;A++)if(k=N[A],typeof k=="object"&&!v(k))return!1}else for(var I in N)if(I=="$ref"||(k=N[I],typeof k=="object"&&!v(k)))return!1;return!0}function y(N){var k=0,A;if(Array.isArray(N)){for(var I=0;I<N.length;I++)if(A=N[I],typeof A=="object"&&(k+=y(A)),k==1/0)return 1/0}else for(var O in N){if(O=="$ref")return 1/0;if(h[O])k++;else if(A=N[O],typeof A=="object"&&(k+=y(A)+1),k==1/0)return 1/0}return k}function w(N,k){k!==!1&&(N=x(N));var A=t.parse(N);return S(A)}function S(N){return t.serialize(N).split("#")[0]+"#"}var T=/#\/?$/;function x(N){return N?N.replace(T,""):""}function _(N,k){return k=x(k),t.resolve(N,k)}function C(N){var k=x(this._getId(N)),A={"":k},I={"":w(k,!1)},O={},L=this;return a(N,{allKeys:!0},function(M,P,W,X,ee,J,B){if(P!==""){var Y=L._getId(M),H=A[X],re=I[X]+"/"+ee;if(B!==void 0&&(re+="/"+(typeof B=="number"?B:r.escapeFragment(B))),typeof Y=="string"){Y=H=x(H?t.resolve(H,Y):Y);var Q=L._refs[Y];if(typeof Q=="string"&&(Q=L._refs[Q]),Q&&Q.schema){if(!e(M,Q.schema))throw new Error('id "'+Y+'" resolves to more than one schema')}else if(Y!=x(re))if(Y[0]=="#"){if(O[Y]&&!e(M,O[Y]))throw new Error('id "'+Y+'" resolves to more than one schema');O[Y]=M}else L._refs[Y]=re}A[P]=H,I[P]=re}}),O}return Yv}var Kv,bI;function mR(){if(bI)return Kv;bI=1;var t=pR();Kv={Validation:n(e),MissingRef:n(r)};function e(a){this.message="validation failed",this.errors=a,this.ajv=this.validation=!0}r.message=function(a,s){return"can't resolve reference "+s+" from id "+a};function r(a,s,l){this.message=l||r.message(a,s),this.missingRef=t.url(a,s),this.missingSchema=t.normalizeId(t.fullPath(this.missingRef))}function n(a){return a.prototype=Object.create(Error.prototype),a.prototype.constructor=a,a}return Kv}var Zv,yI;function g$(){return yI||(yI=1,Zv=function(t,e){e||(e={}),typeof e=="function"&&(e={cmp:e});var r=typeof e.cycles=="boolean"?e.cycles:!1,n=e.cmp&&(function(s){return function(l){return function(c,d){var f={key:c,value:l[c]},h={key:d,value:l[d]};return s(f,h)}}})(e.cmp),a=[];return(function s(l){if(l&&l.toJSON&&typeof l.toJSON=="function"&&(l=l.toJSON()),l!==void 0){if(typeof l=="number")return isFinite(l)?""+l:"null";if(typeof l!="object")return JSON.stringify(l);var c,d;if(Array.isArray(l)){for(d="[",c=0;c<l.length;c++)c&&(d+=","),d+=s(l[c])||"null";return d+"]"}if(l===null)return"null";if(a.indexOf(l)!==-1){if(r)return JSON.stringify("__cycle__");throw new TypeError("Converting circular structure to JSON")}var f=a.push(l)-1,h=Object.keys(l).sort(n&&n(l));for(d="",c=0;c<h.length;c++){var g=h[c],v=s(l[g]);v&&(d&&(d+=","),d+=JSON.stringify(g)+":"+v)}return a.splice(f,1),"{"+d+"}"}})(t)}),Zv}var Xv,EI;function v$(){return EI||(EI=1,Xv=function(e,r,n){var a="",s=e.schema.$async===!0,l=e.util.schemaHasRulesExcept(e.schema,e.RULES.all,"$ref"),c=e.self._getId(e.schema);if(e.opts.strictKeywords){var d=e.util.schemaUnknownRules(e.schema,e.RULES.keywords);if(d){var f="unknown keyword: "+d;if(e.opts.strictKeywords==="log")e.logger.warn(f);else throw new Error(f)}}if(e.isTop&&(a+=" var validate = ",s&&(e.async=!0,a+="async "),a+="function(data, dataPath, parentData, parentDataProperty, rootData) { 'use strict'; ",c&&(e.opts.sourceCode||e.opts.processCode)&&(a+=" "+("/*# sourceURL="+c+" */")+" ")),typeof e.schema=="boolean"||!(l||e.schema.$ref)){var r="false schema",h=e.level,g=e.dataLevel,v=e.schema[r],y=e.schemaPath+e.util.getProperty(r),w=e.errSchemaPath+"/"+r,k=!e.opts.allErrors,O,S="data"+(g||""),N="valid"+h;if(e.schema===!1){e.isTop?k=!0:a+=" var "+N+" = false; ";var T=T||[];T.push(a),a="",e.createErrors!==!1?(a+=" { keyword: '"+(O||"false schema")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(w)+" , params: {} ",e.opts.messages!==!1&&(a+=" , message: 'boolean schema is false' "),e.opts.verbose&&(a+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+S+" "),a+=" } "):a+=" {} ";var x=a;a=T.pop(),!e.compositeRule&&k?e.async?a+=" throw new ValidationError(["+x+"]); ":a+=" validate.errors = ["+x+"]; return false; ":a+=" var err = "+x+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else e.isTop?s?a+=" return data; ":a+=" validate.errors = null; return true; ":a+=" var "+N+" = true; ";return e.isTop&&(a+=" }; return validate; "),a}if(e.isTop){var _=e.isTop,h=e.level=0,g=e.dataLevel=0,S="data";if(e.rootId=e.resolve.fullPath(e.self._getId(e.root.schema)),e.baseId=e.baseId||e.rootId,delete e.isTop,e.dataPathArr=[""],e.schema.default!==void 0&&e.opts.useDefaults&&e.opts.strictDefaults){var C="default is ignored in the schema root";if(e.opts.strictDefaults==="log")e.logger.warn(C);else throw new Error(C)}a+=" var vErrors = null; ",a+=" var errors = 0; ",a+=" if (rootData === undefined) rootData = data; "}else{var h=e.level,g=e.dataLevel,S="data"+(g||"");if(c&&(e.baseId=e.resolve.url(e.baseId,c)),s&&!e.async)throw new Error("async schema in sync schema");a+=" var errs_"+h+" = errors;"}var N="valid"+h,k=!e.opts.allErrors,A="",I="",O,L=e.schema.type,M=Array.isArray(L);if(L&&e.opts.nullable&&e.schema.nullable===!0&&(M?L.indexOf("null")==-1&&(L=L.concat("null")):L!="null"&&(L=[L,"null"],M=!0)),M&&L.length==1&&(L=L[0],M=!1),e.schema.$ref&&l){if(e.opts.extendRefs=="fail")throw new Error('$ref: validation keywords used in schema at path "'+e.errSchemaPath+'" (see option extendRefs)');e.opts.extendRefs!==!0&&(l=!1,e.logger.warn('$ref: keywords ignored in schema at path "'+e.errSchemaPath+'"'))}if(e.schema.$comment&&e.opts.$comment&&(a+=" "+e.RULES.all.$comment.code(e,"$comment")),L){if(e.opts.coerceTypes)var P=e.util.coerceToTypes(e.opts.coerceTypes,L);var W=e.RULES.types[L];if(P||M||W===!0||W&&!Ae(W)){var y=e.schemaPath+".type",w=e.errSchemaPath+"/type",y=e.schemaPath+".type",w=e.errSchemaPath+"/type",X=M?"checkDataTypes":"checkDataType";if(a+=" if ("+e.util[X](L,S,e.opts.strictNumbers,!0)+") { ",P){var ee="dataType"+h,J="coerced"+h;a+=" var "+ee+" = typeof "+S+"; var "+J+" = undefined; ",e.opts.coerceTypes=="array"&&(a+=" if ("+ee+" == 'object' && Array.isArray("+S+") && "+S+".length == 1) { "+S+" = "+S+"[0]; "+ee+" = typeof "+S+"; if ("+e.util.checkDataType(e.schema.type,S,e.opts.strictNumbers)+") "+J+" = "+S+"; } "),a+=" if ("+J+" !== undefined) ; ";var B=P;if(B)for(var Y,H=-1,re=B.length-1;H<re;)Y=B[H+=1],Y=="string"?a+=" else if ("+ee+" == 'number' || "+ee+" == 'boolean') "+J+" = '' + "+S+"; else if ("+S+" === null) "+J+" = ''; ":Y=="number"||Y=="integer"?(a+=" else if ("+ee+" == 'boolean' || "+S+" === null || ("+ee+" == 'string' && "+S+" && "+S+" == +"+S+" ",Y=="integer"&&(a+=" && !("+S+" % 1)"),a+=")) "+J+" = +"+S+"; "):Y=="boolean"?a+=" else if ("+S+" === 'false' || "+S+" === 0 || "+S+" === null) "+J+" = false; else if ("+S+" === 'true' || "+S+" === 1) "+J+" = true; ":Y=="null"?a+=" else if ("+S+" === '' || "+S+" === 0 || "+S+" === false) "+J+" = null; ":e.opts.coerceTypes=="array"&&Y=="array"&&(a+=" else if ("+ee+" == 'string' || "+ee+" == 'number' || "+ee+" == 'boolean' || "+S+" == null) "+J+" = ["+S+"]; ");a+=" else { ";var T=T||[];T.push(a),a="",e.createErrors!==!1?(a+=" { keyword: '"+(O||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(w)+" , params: { type: '",M?a+=""+L.join(","):a+=""+L,a+="' } ",e.opts.messages!==!1&&(a+=" , message: 'should be ",M?a+=""+L.join(","):a+=""+L,a+="' "),e.opts.verbose&&(a+=" , schema: validate.schema"+y+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+S+" "),a+=" } "):a+=" {} ";var x=a;a=T.pop(),!e.compositeRule&&k?e.async?a+=" throw new ValidationError(["+x+"]); ":a+=" validate.errors = ["+x+"]; return false; ":a+=" var err = "+x+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } if ("+J+" !== undefined) { ";var Q=g?"data"+(g-1||""):"parentData",j=g?e.dataPathArr[g]:"parentDataProperty";a+=" "+S+" = "+J+"; ",g||(a+="if ("+Q+" !== undefined)"),a+=" "+Q+"["+j+"] = "+J+"; } "}else{var T=T||[];T.push(a),a="",e.createErrors!==!1?(a+=" { keyword: '"+(O||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(w)+" , params: { type: '",M?a+=""+L.join(","):a+=""+L,a+="' } ",e.opts.messages!==!1&&(a+=" , message: 'should be ",M?a+=""+L.join(","):a+=""+L,a+="' "),e.opts.verbose&&(a+=" , schema: validate.schema"+y+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+S+" "),a+=" } "):a+=" {} ";var x=a;a=T.pop(),!e.compositeRule&&k?e.async?a+=" throw new ValidationError(["+x+"]); ":a+=" validate.errors = ["+x+"]; return false; ":a+=" var err = "+x+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}a+=" } "}}if(e.schema.$ref&&!l)a+=" "+e.RULES.all.$ref.code(e,"$ref")+" ",k&&(a+=" } if (errors === ",_?a+="0":a+="errs_"+h,a+=") { ",I+="}");else{var q=e.RULES;if(q){for(var W,z=-1,G=q.length-1;z<G;)if(W=q[z+=1],Ae(W)){if(W.type&&(a+=" if ("+e.util.checkDataType(W.type,S,e.opts.strictNumbers)+") { "),e.opts.useDefaults){if(W.type=="object"&&e.schema.properties){var v=e.schema.properties,Z=Object.keys(v),U=Z;if(U)for(var F,te=-1,fe=U.length-1;te<fe;){F=U[te+=1];var V=v[F];if(V.default!==void 0){var de=S+e.util.getProperty(F);if(e.compositeRule){if(e.opts.strictDefaults){var C="default is ignored for: "+de;if(e.opts.strictDefaults==="log")e.logger.warn(C);else throw new Error(C)}}else a+=" if ("+de+" === undefined ",e.opts.useDefaults=="empty"&&(a+=" || "+de+" === null || "+de+" === '' "),a+=" ) "+de+" = ",e.opts.useDefaults=="shared"?a+=" "+e.useDefault(V.default)+" ":a+=" "+JSON.stringify(V.default)+" ",a+="; "}}}else if(W.type=="array"&&Array.isArray(e.schema.items)){var le=e.schema.items;if(le){for(var V,H=-1,pe=le.length-1;H<pe;)if(V=le[H+=1],V.default!==void 0){var de=S+"["+H+"]";if(e.compositeRule){if(e.opts.strictDefaults){var C="default is ignored for: "+de;if(e.opts.strictDefaults==="log")e.logger.warn(C);else throw new Error(C)}}else a+=" if ("+de+" === undefined ",e.opts.useDefaults=="empty"&&(a+=" || "+de+" === null || "+de+" === '' "),a+=" ) "+de+" = ",e.opts.useDefaults=="shared"?a+=" "+e.useDefault(V.default)+" ":a+=" "+JSON.stringify(V.default)+" ",a+="; "}}}}var Re=W.rules;if(Re){for(var Ke,je=-1,ze=Re.length-1;je<ze;)if(Ke=Re[je+=1],$e(Ke)){var _e=Ke.code(e,Ke.keyword,W.type);_e&&(a+=" "+_e+" ",k&&(A+="}"))}}if(k&&(a+=" "+A+" ",A=""),W.type&&(a+=" } ",L&&L===W.type&&!P)){a+=" else { ";var y=e.schemaPath+".type",w=e.errSchemaPath+"/type",T=T||[];T.push(a),a="",e.createErrors!==!1?(a+=" { keyword: '"+(O||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(w)+" , params: { type: '",M?a+=""+L.join(","):a+=""+L,a+="' } ",e.opts.messages!==!1&&(a+=" , message: 'should be ",M?a+=""+L.join(","):a+=""+L,a+="' "),e.opts.verbose&&(a+=" , schema: validate.schema"+y+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+S+" "),a+=" } "):a+=" {} ";var x=a;a=T.pop(),!e.compositeRule&&k?e.async?a+=" throw new ValidationError(["+x+"]); ":a+=" validate.errors = ["+x+"]; return false; ":a+=" var err = "+x+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } "}k&&(a+=" if (errors === ",_?a+="0":a+="errs_"+h,a+=") { ",I+="}")}}}k&&(a+=" "+I+" "),_?(s?(a+=" if (errors === 0) return data; ",a+=" else throw new ValidationError(vErrors); "):(a+=" validate.errors = vErrors; ",a+=" return errors === 0; "),a+=" }; return validate;"):a+=" var "+N+" = errors === errs_"+h+";";function Ae(Se){for(var Le=Se.rules,we=0;we<Le.length;we++)if($e(Le[we]))return!0}function $e(Se){return e.schema[Se.keyword]!==void 0||Se.implements&&oe(Se)}function oe(Se){for(var Le=Se.implements,we=0;we<Le.length;we++)if(e.schema[Le[we]]!==void 0)return!0}return a}),Xv}var Qv,SI;function D8(){if(SI)return Qv;SI=1;var t=pR(),e=gc(),r=mR(),n=g$(),a=v$(),s=e.ucs2length,l=fR(),c=r.Validation;Qv=d;function d(x,_,C,N){var k=this,A=this._opts,I=[void 0],O={},L=[],M={},P=[],W={},X=[];_=_||{schema:x,refVal:I,refs:O};var ee=f.call(this,x,_,N),J=this._compilations[ee.index];if(ee.compiling)return J.callValidate=Q;var B=this._formats,Y=this.RULES;try{var H=j(x,_,C,N);J.validate=H;var re=J.callValidate;return re&&(re.schema=H.schema,re.errors=null,re.refs=H.refs,re.refVal=H.refVal,re.root=H.root,re.$async=H.$async,A.sourceCode&&(re.source=H.source)),H}finally{h.call(this,x,_,N)}function Q(){var V=J.validate,de=V.apply(this,arguments);return Q.errors=V.errors,de}function j(V,de,le,pe){var Re=!de||de&&de.schema==V;if(de.schema!=_.schema)return d.call(k,V,de,le,pe);var Ke=V.$async===!0,je=a({isTop:!0,schema:V,isRoot:Re,baseId:pe,root:de,schemaPath:"",errSchemaPath:"#",errorPath:'""',MissingRefError:r.MissingRef,RULES:Y,validate:a,util:e,resolve:t,resolveRef:q,usePattern:F,useDefault:te,useCustomRule:fe,opts:A,formats:B,logger:k.logger,self:k});je=T(I,w)+T(L,v)+T(P,y)+T(X,S)+je,A.processCode&&(je=A.processCode(je,V));var ze;try{var _e=new Function("self","RULES","formats","root","refVal","defaults","customRules","equal","ucs2length","ValidationError",je);ze=_e(k,Y,B,_,I,P,X,l,s,c),I[0]=ze}catch(Ae){throw k.logger.error("Error compiling schema, function code:",je),Ae}return ze.schema=V,ze.errors=null,ze.refs=O,ze.refVal=I,ze.root=Re?ze:de,Ke&&(ze.$async=!0),A.sourceCode===!0&&(ze.source={code:je,patterns:L,defaults:P}),ze}function q(V,de,le){de=t.url(V,de);var pe=O[de],Re,Ke;if(pe!==void 0)return Re=I[pe],Ke="refVal["+pe+"]",U(Re,Ke);if(!le&&_.refs){var je=_.refs[de];if(je!==void 0)return Re=_.refVal[je],Ke=z(de,Re),U(Re,Ke)}Ke=z(de);var ze=t.call(k,j,_,de);if(ze===void 0){var _e=C&&C[de];_e&&(ze=t.inlineRef(_e,A.inlineRefs)?_e:d.call(k,_e,_,C,V))}if(ze===void 0)G(de);else return Z(de,ze),U(ze,Ke)}function z(V,de){var le=I.length;return I[le]=de,O[V]=le,"refVal"+le}function G(V){delete O[V]}function Z(V,de){var le=O[V];I[le]=de}function U(V,de){return typeof V=="object"||typeof V=="boolean"?{code:de,schema:V,inline:!0}:{code:de,$async:V&&!!V.$async}}function F(V){var de=M[V];return de===void 0&&(de=M[V]=L.length,L[de]=V),"pattern"+de}function te(V){switch(typeof V){case"boolean":case"number":return""+V;case"string":return e.toQuotedString(V);case"object":if(V===null)return"null";var de=n(V),le=W[de];return le===void 0&&(le=W[de]=P.length,P[le]=V),"default"+le}}function fe(V,de,le,pe){if(k._opts.validateSchema!==!1){var Re=V.definition.dependencies;if(Re&&!Re.every(function(Le){return Object.prototype.hasOwnProperty.call(le,Le)}))throw new Error("parent schema must have all required keywords: "+Re.join(","));var Ke=V.definition.validateSchema;if(Ke){var je=Ke(de);if(!je){var ze="keyword schema is invalid: "+k.errorsText(Ke.errors);if(k._opts.validateSchema=="log")k.logger.error(ze);else throw new Error(ze)}}}var _e=V.definition.compile,Ae=V.definition.inline,$e=V.definition.macro,oe;if(_e)oe=_e.call(k,de,le,pe);else if($e)oe=$e.call(k,de,le,pe),A.validateSchema!==!1&&k.validateSchema(oe,!0);else if(Ae)oe=Ae.call(k,pe,V.keyword,de,le);else if(oe=V.definition.validate,!oe)return;if(oe===void 0)throw new Error('custom keyword "'+V.keyword+'"failed to compile');var Se=X.length;return X[Se]=oe,{code:"customRule"+Se,validate:oe}}}function f(x,_,C){var N=g.call(this,x,_,C);return N>=0?{index:N,compiling:!0}:(N=this._compilations.length,this._compilations[N]={schema:x,root:_,baseId:C},{index:N,compiling:!1})}function h(x,_,C){var N=g.call(this,x,_,C);N>=0&&this._compilations.splice(N,1)}function g(x,_,C){for(var N=0;N<this._compilations.length;N++){var k=this._compilations[N];if(k.schema==x&&k.root==_&&k.baseId==C)return N}return-1}function v(x,_){return"var pattern"+x+" = new RegExp("+e.toQuotedString(_[x])+");"}function y(x){return"var default"+x+" = defaults["+x+"];"}function w(x,_){return _[x]===void 0?"":"var refVal"+x+" = refVal["+x+"];"}function S(x){return"var customRule"+x+" = customRules["+x+"];"}function T(x,_){if(!x.length)return"";for(var C="",N=0;N<x.length;N++)C+=_(N,x);return C}return Qv}var Jv={exports:{}},xI;function L8(){if(xI)return Jv.exports;xI=1;var t=Jv.exports=function(){this._cache={}};return t.prototype.put=function(r,n){this._cache[r]=n},t.prototype.get=function(r){return this._cache[r]},t.prototype.del=function(r){delete this._cache[r]},t.prototype.clear=function(){this._cache={}},Jv.exports}var eb,wI;function M8(){if(wI)return eb;wI=1;var t=gc(),e=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,r=[0,31,28,31,30,31,30,31,31,30,31,30,31],n=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,a=/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,s=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,l=/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,c=/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,d=/^(?:(?:http[s\u017F]?|ftp):\/\/)(?:(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+(?::(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?@)?(?:(?!10(?:\.[0-9]{1,3}){3})(?!127(?:\.[0-9]{1,3}){3})(?!169\.254(?:\.[0-9]{1,3}){2})(?!192\.168(?:\.[0-9]{1,3}){2})(?!172\.(?:1[6-9]|2[0-9]|3[01])(?:\.[0-9]{1,3}){2})(?:[1-9][0-9]?|1[0-9][0-9]|2[01][0-9]|22[0-3])(?:\.(?:1?[0-9]{1,2}|2[0-4][0-9]|25[0-5])){2}(?:\.(?:[1-9][0-9]?|1[0-9][0-9]|2[0-4][0-9]|25[0-4]))|(?:(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)(?:\.(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)*(?:\.(?:(?:[a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]){2,})))(?::[0-9]{2,5})?(?:\/(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?$/i,f=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,h=/^(?:\/(?:[^~/]|~0|~1)*)*$/,g=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,v=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;eb=y;function y(I){return I=I=="full"?"full":"fast",t.copy(y[I])}y.fast={date:/^\d\d\d\d-[0-1]\d-[0-3]\d$/,time:/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,"date-time":/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,"uri-template":c,url:d,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i,hostname:a,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipv6:/^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i,regex:A,uuid:f,"json-pointer":h,"json-pointer-uri-fragment":g,"relative-json-pointer":v},y.full={date:S,time:T,"date-time":_,uri:N,"uri-reference":l,"uri-template":c,url:d,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:a,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipv6:/^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i,regex:A,uuid:f,"json-pointer":h,"json-pointer-uri-fragment":g,"relative-json-pointer":v};function w(I){return I%4===0&&(I%100!==0||I%400===0)}function S(I){var O=I.match(e);if(!O)return!1;var L=+O[1],M=+O[2],P=+O[3];return M>=1&&M<=12&&P>=1&&P<=(M==2&&w(L)?29:r[M])}function T(I,O){var L=I.match(n);if(!L)return!1;var M=L[1],P=L[2],W=L[3],X=L[5];return(M<=23&&P<=59&&W<=59||M==23&&P==59&&W==60)&&(!O||X)}var x=/t|\s/i;function _(I){var O=I.split(x);return O.length==2&&S(O[0])&&T(O[1],!0)}var C=/\/|:/;function N(I){return C.test(I)&&s.test(I)}var k=/[^\\]\\Z/;function A(I){if(k.test(I))return!1;try{return new RegExp(I),!0}catch{return!1}}return eb}var tb,_I;function P8(){return _I||(_I=1,tb=function(e,r,n){var a=" ",s=e.level,l=e.dataLevel,c=e.schema[r],d=e.errSchemaPath+"/"+r,f=!e.opts.allErrors,h="data"+(l||""),g="valid"+s,v,y;if(c=="#"||c=="#/")e.isRoot?(v=e.async,y="validate"):(v=e.root.schema.$async===!0,y="root.refVal[0]");else{var w=e.resolveRef(e.baseId,c,e.isRoot);if(w===void 0){var S=e.MissingRefError.message(e.baseId,c);if(e.opts.missingRefs=="fail"){e.logger.error(S);var T=T||[];T.push(a),a="",e.createErrors!==!1?(a+=" { keyword: '$ref' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(d)+" , params: { ref: '"+e.util.escapeQuotes(c)+"' } ",e.opts.messages!==!1&&(a+=" , message: 'can\\'t resolve reference "+e.util.escapeQuotes(c)+"' "),e.opts.verbose&&(a+=" , schema: "+e.util.toQuotedString(c)+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),a+=" } "):a+=" {} ";var x=a;a=T.pop(),!e.compositeRule&&f?e.async?a+=" throw new ValidationError(["+x+"]); ":a+=" validate.errors = ["+x+"]; return false; ":a+=" var err = "+x+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",f&&(a+=" if (false) { ")}else if(e.opts.missingRefs=="ignore")e.logger.warn(S),f&&(a+=" if (true) { ");else throw new e.MissingRefError(e.baseId,c,S)}else if(w.inline){var _=e.util.copy(e);_.level++;var C="valid"+_.level;_.schema=w.schema,_.schemaPath="",_.errSchemaPath=c;var N=e.validate(_).replace(/validate\.schema/g,w.code);a+=" "+N+" ",f&&(a+=" if ("+C+") { ")}else v=w.$async===!0||e.async&&w.$async!==!1,y=w.code}if(y){var T=T||[];T.push(a),a="",e.opts.passContext?a+=" "+y+".call(this, ":a+=" "+y+"( ",a+=" "+h+", (dataPath || '')",e.errorPath!='""'&&(a+=" + "+e.errorPath);var k=l?"data"+(l-1||""):"parentData",A=l?e.dataPathArr[l]:"parentDataProperty";a+=" , "+k+" , "+A+", rootData) ";var I=a;if(a=T.pop(),v){if(!e.async)throw new Error("async schema referenced by sync schema");f&&(a+=" var "+g+"; "),a+=" try { await "+I+"; ",f&&(a+=" "+g+" = true; "),a+=" } catch (e) { if (!(e instanceof ValidationError)) throw e; if (vErrors === null) vErrors = e.errors; else vErrors = vErrors.concat(e.errors); errors = vErrors.length; ",f&&(a+=" "+g+" = false; "),a+=" } ",f&&(a+=" if ("+g+") { ")}else a+=" if (!"+I+") { if (vErrors === null) vErrors = "+y+".errors; else vErrors = vErrors.concat("+y+".errors); errors = vErrors.length; } ",f&&(a+=" else { ")}return a}),tb}var rb,TI;function j8(){return TI||(TI=1,rb=function(e,r,n){var a=" ",s=e.schema[r],l=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,d=!e.opts.allErrors,f=e.util.copy(e),h="";f.level++;var g="valid"+f.level,v=f.baseId,y=!0,w=s;if(w)for(var S,T=-1,x=w.length-1;T<x;)S=w[T+=1],(e.opts.strictKeywords?typeof S=="object"&&Object.keys(S).length>0||S===!1:e.util.schemaHasRules(S,e.RULES.all))&&(y=!1,f.schema=S,f.schemaPath=l+"["+T+"]",f.errSchemaPath=c+"/"+T,a+=" "+e.validate(f)+" ",f.baseId=v,d&&(a+=" if ("+g+") { ",h+="}"));return d&&(y?a+=" if (true) { ":a+=" "+h.slice(0,-1)+" "),a}),rb}var nb,RI;function U8(){return RI||(RI=1,nb=function(e,r,n){var a=" ",s=e.level,l=e.dataLevel,c=e.schema[r],d=e.schemaPath+e.util.getProperty(r),f=e.errSchemaPath+"/"+r,h=!e.opts.allErrors,g="data"+(l||""),v="valid"+s,y="errs__"+s,w=e.util.copy(e),S="";w.level++;var T="valid"+w.level,x=c.every(function(O){return e.opts.strictKeywords?typeof O=="object"&&Object.keys(O).length>0||O===!1:e.util.schemaHasRules(O,e.RULES.all)});if(x){var _=w.baseId;a+=" var "+y+" = errors; var "+v+" = false; ";var C=e.compositeRule;e.compositeRule=w.compositeRule=!0;var N=c;if(N)for(var k,A=-1,I=N.length-1;A<I;)k=N[A+=1],w.schema=k,w.schemaPath=d+"["+A+"]",w.errSchemaPath=f+"/"+A,a+=" "+e.validate(w)+" ",w.baseId=_,a+=" "+v+" = "+v+" || "+T+"; if (!"+v+") { ",S+="}";e.compositeRule=w.compositeRule=C,a+=" "+S+" if (!"+v+") { var err = ",e.createErrors!==!1?(a+=" { keyword: 'anyOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: {} ",e.opts.messages!==!1&&(a+=" , message: 'should match some schema in anyOf' "),e.opts.verbose&&(a+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+g+" "),a+=" } "):a+=" {} ",a+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&h&&(e.async?a+=" throw new ValidationError(vErrors); ":a+=" validate.errors = vErrors; return false; "),a+=" } else { errors = "+y+"; if (vErrors !== null) { if ("+y+") vErrors.length = "+y+"; else vErrors = null; } ",e.opts.allErrors&&(a+=" } ")}else h&&(a+=" if (true) { ");return a}),nb}var ab,CI;function F8(){return CI||(CI=1,ab=function(e,r,n){var a=" ",s=e.schema[r],l=e.errSchemaPath+"/"+r;e.opts.allErrors;var c=e.util.toQuotedString(s);return e.opts.$comment===!0?a+=" console.log("+c+");":typeof e.opts.$comment=="function"&&(a+=" self._opts.$comment("+c+", "+e.util.toQuotedString(l)+", validate.root.schema);"),a}),ab}var ob,AI;function z8(){return AI||(AI=1,ob=function(e,r,n){var a=" ",s=e.level,l=e.dataLevel,c=e.schema[r],d=e.schemaPath+e.util.getProperty(r),f=e.errSchemaPath+"/"+r,h=!e.opts.allErrors,g="data"+(l||""),v="valid"+s,y=e.opts.$data&&c&&c.$data;y&&(a+=" var schema"+s+" = "+e.util.getData(c.$data,l,e.dataPathArr)+"; "),y||(a+=" var schema"+s+" = validate.schema"+d+";"),a+="var "+v+" = equal("+g+", schema"+s+"); if (!"+v+") { ";var w=w||[];w.push(a),a="",e.createErrors!==!1?(a+=" { keyword: 'const' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { allowedValue: schema"+s+" } ",e.opts.messages!==!1&&(a+=" , message: 'should be equal to constant' "),e.opts.verbose&&(a+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+g+" "),a+=" } "):a+=" {} ";var S=a;return a=w.pop(),!e.compositeRule&&h?e.async?a+=" throw new ValidationError(["+S+"]); ":a+=" validate.errors = ["+S+"]; return false; ":a+=" var err = "+S+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" }",h&&(a+=" else { "),a}),ob}var ib,NI;function $8(){return NI||(NI=1,ib=function(e,r,n){var a=" ",s=e.level,l=e.dataLevel,c=e.schema[r],d=e.schemaPath+e.util.getProperty(r),f=e.errSchemaPath+"/"+r,h=!e.opts.allErrors,g="data"+(l||""),v="valid"+s,y="errs__"+s,w=e.util.copy(e),S="";w.level++;var T="valid"+w.level,x="i"+s,_=w.dataLevel=e.dataLevel+1,C="data"+_,N=e.baseId,k=e.opts.strictKeywords?typeof c=="object"&&Object.keys(c).length>0||c===!1:e.util.schemaHasRules(c,e.RULES.all);if(a+="var "+y+" = errors;var "+v+";",k){var A=e.compositeRule;e.compositeRule=w.compositeRule=!0,w.schema=c,w.schemaPath=d,w.errSchemaPath=f,a+=" var "+T+" = false; for (var "+x+" = 0; "+x+" < "+g+".length; "+x+"++) { ",w.errorPath=e.util.getPathExpr(e.errorPath,x,e.opts.jsonPointers,!0);var I=g+"["+x+"]";w.dataPathArr[_]=x;var O=e.validate(w);w.baseId=N,e.util.varOccurences(O,C)<2?a+=" "+e.util.varReplace(O,C,I)+" ":a+=" var "+C+" = "+I+"; "+O+" ",a+=" if ("+T+") break; } ",e.compositeRule=w.compositeRule=A,a+=" "+S+" if (!"+T+") {"}else a+=" if ("+g+".length == 0) {";var L=L||[];L.push(a),a="",e.createErrors!==!1?(a+=" { keyword: 'contains' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: {} ",e.opts.messages!==!1&&(a+=" , message: 'should contain a valid item' "),e.opts.verbose&&(a+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+g+" "),a+=" } "):a+=" {} ";var M=a;return a=L.pop(),!e.compositeRule&&h?e.async?a+=" throw new ValidationError(["+M+"]); ":a+=" validate.errors = ["+M+"]; return false; ":a+=" var err = "+M+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } else { ",k&&(a+=" errors = "+y+"; if (vErrors !== null) { if ("+y+") vErrors.length = "+y+"; else vErrors = null; } "),e.opts.allErrors&&(a+=" } "),a}),ib}var sb,kI;function B8(){return kI||(kI=1,sb=function(e,r,n){var a=" ",s=e.level,l=e.dataLevel,c=e.schema[r],d=e.schemaPath+e.util.getProperty(r),f=e.errSchemaPath+"/"+r,h=!e.opts.allErrors,g="data"+(l||""),v="errs__"+s,y=e.util.copy(e),w="";y.level++;var S="valid"+y.level,T={},x={},_=e.opts.ownProperties;for(A in c)if(A!="__proto__"){var C=c[A],N=Array.isArray(C)?x:T;N[A]=C}a+="var "+v+" = errors;";var k=e.errorPath;a+="var missing"+s+";";for(var A in x)if(N=x[A],N.length){if(a+=" if ( "+g+e.util.getProperty(A)+" !== undefined ",_&&(a+=" && Object.prototype.hasOwnProperty.call("+g+", '"+e.util.escapeQuotes(A)+"') "),h){a+=" && ( ";var I=N;if(I)for(var O,L=-1,M=I.length-1;L<M;){O=I[L+=1],L&&(a+=" || ");var P=e.util.getProperty(O),W=g+P;a+=" ( ( "+W+" === undefined ",_&&(a+=" || ! Object.prototype.hasOwnProperty.call("+g+", '"+e.util.escapeQuotes(O)+"') "),a+=") && (missing"+s+" = "+e.util.toQuotedString(e.opts.jsonPointers?O:P)+") ) "}a+=")) { ";var X="missing"+s,ee="' + "+X+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.opts.jsonPointers?e.util.getPathExpr(k,X,!0):k+" + "+X);var J=J||[];J.push(a),a="",e.createErrors!==!1?(a+=" { keyword: 'dependencies' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { property: '"+e.util.escapeQuotes(A)+"', missingProperty: '"+ee+"', depsCount: "+N.length+", deps: '"+e.util.escapeQuotes(N.length==1?N[0]:N.join(", "))+"' } ",e.opts.messages!==!1&&(a+=" , message: 'should have ",N.length==1?a+="property "+e.util.escapeQuotes(N[0]):a+="properties "+e.util.escapeQuotes(N.join(", ")),a+=" when property "+e.util.escapeQuotes(A)+" is present' "),e.opts.verbose&&(a+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+g+" "),a+=" } "):a+=" {} ";var B=a;a=J.pop(),!e.compositeRule&&h?e.async?a+=" throw new ValidationError(["+B+"]); ":a+=" validate.errors = ["+B+"]; return false; ":a+=" var err = "+B+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else{a+=" ) { ";var Y=N;if(Y)for(var O,H=-1,re=Y.length-1;H<re;){O=Y[H+=1];var P=e.util.getProperty(O),ee=e.util.escapeQuotes(O),W=g+P;e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(k,O,e.opts.jsonPointers)),a+=" if ( "+W+" === undefined ",_&&(a+=" || ! Object.prototype.hasOwnProperty.call("+g+", '"+e.util.escapeQuotes(O)+"') "),a+=") { var err = ",e.createErrors!==!1?(a+=" { keyword: 'dependencies' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { property: '"+e.util.escapeQuotes(A)+"', missingProperty: '"+ee+"', depsCount: "+N.length+", deps: '"+e.util.escapeQuotes(N.length==1?N[0]:N.join(", "))+"' } ",e.opts.messages!==!1&&(a+=" , message: 'should have ",N.length==1?a+="property "+e.util.escapeQuotes(N[0]):a+="properties "+e.util.escapeQuotes(N.join(", ")),a+=" when property "+e.util.escapeQuotes(A)+" is present' "),e.opts.verbose&&(a+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+g+" "),a+=" } "):a+=" {} ",a+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } "}}a+=" } ",h&&(w+="}",a+=" else { ")}e.errorPath=k;var Q=y.baseId;for(var A in T){var C=T[A];(e.opts.strictKeywords?typeof C=="object"&&Object.keys(C).length>0||C===!1:e.util.schemaHasRules(C,e.RULES.all))&&(a+=" "+S+" = true; if ( "+g+e.util.getProperty(A)+" !== undefined ",_&&(a+=" && Object.prototype.hasOwnProperty.call("+g+", '"+e.util.escapeQuotes(A)+"') "),a+=") { ",y.schema=C,y.schemaPath=d+e.util.getProperty(A),y.errSchemaPath=f+"/"+e.util.escapeFragment(A),a+=" "+e.validate(y)+" ",y.baseId=Q,a+=" } ",h&&(a+=" if ("+S+") { ",w+="}"))}return h&&(a+=" "+w+" if ("+v+" == errors) {"),a}),sb}var lb,II;function q8(){return II||(II=1,lb=function(e,r,n){var a=" ",s=e.level,l=e.dataLevel,c=e.schema[r],d=e.schemaPath+e.util.getProperty(r),f=e.errSchemaPath+"/"+r,h=!e.opts.allErrors,g="data"+(l||""),v="valid"+s,y=e.opts.$data&&c&&c.$data;y&&(a+=" var schema"+s+" = "+e.util.getData(c.$data,l,e.dataPathArr)+"; ");var w="i"+s,S="schema"+s;y||(a+=" var "+S+" = validate.schema"+d+";"),a+="var "+v+";",y&&(a+=" if (schema"+s+" === undefined) "+v+" = true; else if (!Array.isArray(schema"+s+")) "+v+" = false; else {"),a+=""+v+" = false;for (var "+w+"=0; "+w+"<"+S+".length; "+w+"++) if (equal("+g+", "+S+"["+w+"])) { "+v+" = true; break; }",y&&(a+=" } "),a+=" if (!"+v+") { ";var T=T||[];T.push(a),a="",e.createErrors!==!1?(a+=" { keyword: 'enum' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { allowedValues: schema"+s+" } ",e.opts.messages!==!1&&(a+=" , message: 'should be equal to one of the allowed values' "),e.opts.verbose&&(a+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+g+" "),a+=" } "):a+=" {} ";var x=a;return a=T.pop(),!e.compositeRule&&h?e.async?a+=" throw new ValidationError(["+x+"]); ":a+=" validate.errors = ["+x+"]; return false; ":a+=" var err = "+x+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" }",h&&(a+=" else { "),a}),lb}var cb,OI;function H8(){return OI||(OI=1,cb=function(e,r,n){var a=" ",s=e.level,l=e.dataLevel,c=e.schema[r],d=e.schemaPath+e.util.getProperty(r),f=e.errSchemaPath+"/"+r,h=!e.opts.allErrors,g="data"+(l||"");if(e.opts.format===!1)return h&&(a+=" if (true) { "),a;var v=e.opts.$data&&c&&c.$data,y;v?(a+=" var schema"+s+" = "+e.util.getData(c.$data,l,e.dataPathArr)+"; ",y="schema"+s):y=c;var w=e.opts.unknownFormats,S=Array.isArray(w);if(v){var T="format"+s,x="isObject"+s,_="formatType"+s;a+=" var "+T+" = formats["+y+"]; var "+x+" = typeof "+T+" == 'object' && !("+T+" instanceof RegExp) && "+T+".validate; var "+_+" = "+x+" && "+T+".type || 'string'; if ("+x+") { ",e.async&&(a+=" var async"+s+" = "+T+".async; "),a+=" "+T+" = "+T+".validate; } if ( ",v&&(a+=" ("+y+" !== undefined && typeof "+y+" != 'string') || "),a+=" (",w!="ignore"&&(a+=" ("+y+" && !"+T+" ",S&&(a+=" && self._opts.unknownFormats.indexOf("+y+") == -1 "),a+=") || "),a+=" ("+T+" && "+_+" == '"+n+"' && !(typeof "+T+" == 'function' ? ",e.async?a+=" (async"+s+" ? await "+T+"("+g+") : "+T+"("+g+")) ":a+=" "+T+"("+g+") ",a+=" : "+T+".test("+g+"))))) {"}else{var T=e.formats[c];if(!T){if(w=="ignore")return e.logger.warn('unknown format "'+c+'" ignored in schema at path "'+e.errSchemaPath+'"'),h&&(a+=" if (true) { "),a;if(S&&w.indexOf(c)>=0)return h&&(a+=" if (true) { "),a;throw new Error('unknown format "'+c+'" is used in schema at path "'+e.errSchemaPath+'"')}var x=typeof T=="object"&&!(T instanceof RegExp)&&T.validate,_=x&&T.type||"string";if(x){var C=T.async===!0;T=T.validate}if(_!=n)return h&&(a+=" if (true) { "),a;if(C){if(!e.async)throw new Error("async format in sync schema");var N="formats"+e.util.getProperty(c)+".validate";a+=" if (!(await "+N+"("+g+"))) { "}else{a+=" if (! ";var N="formats"+e.util.getProperty(c);x&&(N+=".validate"),typeof T=="function"?a+=" "+N+"("+g+") ":a+=" "+N+".test("+g+") ",a+=") { "}}var k=k||[];k.push(a),a="",e.createErrors!==!1?(a+=" { keyword: 'format' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { format: ",v?a+=""+y:a+=""+e.util.toQuotedString(c),a+=" } ",e.opts.messages!==!1&&(a+=` , message: 'should match format "`,v?a+="' + "+y+" + '":a+=""+e.util.escapeQuotes(c),a+=`"' `),e.opts.verbose&&(a+=" , schema: ",v?a+="validate.schema"+d:a+=""+e.util.toQuotedString(c),a+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+g+" "),a+=" } "):a+=" {} ";var A=a;return a=k.pop(),!e.compositeRule&&h?e.async?a+=" throw new ValidationError(["+A+"]); ":a+=" validate.errors = ["+A+"]; return false; ":a+=" var err = "+A+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } ",h&&(a+=" else { "),a}),cb}var ub,DI;function V8(){return DI||(DI=1,ub=function(e,r,n){var a=" ",s=e.level,l=e.dataLevel,c=e.schema[r],d=e.schemaPath+e.util.getProperty(r),f=e.errSchemaPath+"/"+r,h=!e.opts.allErrors,g="data"+(l||""),v="valid"+s,y="errs__"+s,w=e.util.copy(e);w.level++;var S="valid"+w.level,T=e.schema.then,x=e.schema.else,_=T!==void 0&&(e.opts.strictKeywords?typeof T=="object"&&Object.keys(T).length>0||T===!1:e.util.schemaHasRules(T,e.RULES.all)),C=x!==void 0&&(e.opts.strictKeywords?typeof x=="object"&&Object.keys(x).length>0||x===!1:e.util.schemaHasRules(x,e.RULES.all)),N=w.baseId;if(_||C){var k;w.createErrors=!1,w.schema=c,w.schemaPath=d,w.errSchemaPath=f,a+=" var "+y+" = errors; var "+v+" = true; ";var A=e.compositeRule;e.compositeRule=w.compositeRule=!0,a+=" "+e.validate(w)+" ",w.baseId=N,w.createErrors=!0,a+=" errors = "+y+"; if (vErrors !== null) { if ("+y+") vErrors.length = "+y+"; else vErrors = null; } ",e.compositeRule=w.compositeRule=A,_?(a+=" if ("+S+") { ",w.schema=e.schema.then,w.schemaPath=e.schemaPath+".then",w.errSchemaPath=e.errSchemaPath+"/then",a+=" "+e.validate(w)+" ",w.baseId=N,a+=" "+v+" = "+S+"; ",_&&C?(k="ifClause"+s,a+=" var "+k+" = 'then'; "):k="'then'",a+=" } ",C&&(a+=" else { ")):a+=" if (!"+S+") { ",C&&(w.schema=e.schema.else,w.schemaPath=e.schemaPath+".else",w.errSchemaPath=e.errSchemaPath+"/else",a+=" "+e.validate(w)+" ",w.baseId=N,a+=" "+v+" = "+S+"; ",_&&C?(k="ifClause"+s,a+=" var "+k+" = 'else'; "):k="'else'",a+=" } "),a+=" if (!"+v+") { var err = ",e.createErrors!==!1?(a+=" { keyword: 'if' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { failingKeyword: "+k+" } ",e.opts.messages!==!1&&(a+=` , message: 'should match "' + `+k+` + '" schema' `),e.opts.verbose&&(a+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+g+" "),a+=" } "):a+=" {} ",a+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&h&&(e.async?a+=" throw new ValidationError(vErrors); ":a+=" validate.errors = vErrors; return false; "),a+=" } ",h&&(a+=" else { ")}else h&&(a+=" if (true) { ");return a}),ub}var db,LI;function G8(){return LI||(LI=1,db=function(e,r,n){var a=" ",s=e.level,l=e.dataLevel,c=e.schema[r],d=e.schemaPath+e.util.getProperty(r),f=e.errSchemaPath+"/"+r,h=!e.opts.allErrors,g="data"+(l||""),v="valid"+s,y="errs__"+s,w=e.util.copy(e),S="";w.level++;var T="valid"+w.level,x="i"+s,_=w.dataLevel=e.dataLevel+1,C="data"+_,N=e.baseId;if(a+="var "+y+" = errors;var "+v+";",Array.isArray(c)){var k=e.schema.additionalItems;if(k===!1){a+=" "+v+" = "+g+".length <= "+c.length+"; ";var A=f;f=e.errSchemaPath+"/additionalItems",a+=" if (!"+v+") { ";var I=I||[];I.push(a),a="",e.createErrors!==!1?(a+=" { keyword: 'additionalItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { limit: "+c.length+" } ",e.opts.messages!==!1&&(a+=" , message: 'should NOT have more than "+c.length+" items' "),e.opts.verbose&&(a+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+g+" "),a+=" } "):a+=" {} ";var O=a;a=I.pop(),!e.compositeRule&&h?e.async?a+=" throw new ValidationError(["+O+"]); ":a+=" validate.errors = ["+O+"]; return false; ":a+=" var err = "+O+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } ",f=A,h&&(S+="}",a+=" else { ")}var L=c;if(L){for(var M,P=-1,W=L.length-1;P<W;)if(M=L[P+=1],e.opts.strictKeywords?typeof M=="object"&&Object.keys(M).length>0||M===!1:e.util.schemaHasRules(M,e.RULES.all)){a+=" "+T+" = true; if ("+g+".length > "+P+") { ";var X=g+"["+P+"]";w.schema=M,w.schemaPath=d+"["+P+"]",w.errSchemaPath=f+"/"+P,w.errorPath=e.util.getPathExpr(e.errorPath,P,e.opts.jsonPointers,!0),w.dataPathArr[_]=P;var ee=e.validate(w);w.baseId=N,e.util.varOccurences(ee,C)<2?a+=" "+e.util.varReplace(ee,C,X)+" ":a+=" var "+C+" = "+X+"; "+ee+" ",a+=" } ",h&&(a+=" if ("+T+") { ",S+="}")}}if(typeof k=="object"&&(e.opts.strictKeywords?typeof k=="object"&&Object.keys(k).length>0||k===!1:e.util.schemaHasRules(k,e.RULES.all))){w.schema=k,w.schemaPath=e.schemaPath+".additionalItems",w.errSchemaPath=e.errSchemaPath+"/additionalItems",a+=" "+T+" = true; if ("+g+".length > "+c.length+") { for (var "+x+" = "+c.length+"; "+x+" < "+g+".length; "+x+"++) { ",w.errorPath=e.util.getPathExpr(e.errorPath,x,e.opts.jsonPointers,!0);var X=g+"["+x+"]";w.dataPathArr[_]=x;var ee=e.validate(w);w.baseId=N,e.util.varOccurences(ee,C)<2?a+=" "+e.util.varReplace(ee,C,X)+" ":a+=" var "+C+" = "+X+"; "+ee+" ",h&&(a+=" if (!"+T+") break; "),a+=" } } ",h&&(a+=" if ("+T+") { ",S+="}")}}else if(e.opts.strictKeywords?typeof c=="object"&&Object.keys(c).length>0||c===!1:e.util.schemaHasRules(c,e.RULES.all)){w.schema=c,w.schemaPath=d,w.errSchemaPath=f,a+=" for (var "+x+" = 0; "+x+" < "+g+".length; "+x+"++) { ",w.errorPath=e.util.getPathExpr(e.errorPath,x,e.opts.jsonPointers,!0);var X=g+"["+x+"]";w.dataPathArr[_]=x;var ee=e.validate(w);w.baseId=N,e.util.varOccurences(ee,C)<2?a+=" "+e.util.varReplace(ee,C,X)+" ":a+=" var "+C+" = "+X+"; "+ee+" ",h&&(a+=" if (!"+T+") break; "),a+=" }"}return h&&(a+=" "+S+" if ("+y+" == errors) {"),a}),db}var fb,MI;function PI(){return MI||(MI=1,fb=function(e,r,n){var a=" ",s=e.level,l=e.dataLevel,c=e.schema[r],d=e.schemaPath+e.util.getProperty(r),f=e.errSchemaPath+"/"+r,h=!e.opts.allErrors,N,g="data"+(l||""),v=e.opts.$data&&c&&c.$data,y;v?(a+=" var schema"+s+" = "+e.util.getData(c.$data,l,e.dataPathArr)+"; ",y="schema"+s):y=c;var w=r=="maximum",S=w?"exclusiveMaximum":"exclusiveMinimum",T=e.schema[S],x=e.opts.$data&&T&&T.$data,_=w?"<":">",C=w?">":"<",N=void 0;if(!(v||typeof c=="number"||c===void 0))throw new Error(r+" must be number");if(!(x||T===void 0||typeof T=="number"||typeof T=="boolean"))throw new Error(S+" must be number or boolean");if(x){var k=e.util.getData(T.$data,l,e.dataPathArr),A="exclusive"+s,I="exclType"+s,O="exclIsNumber"+s,L="op"+s,M="' + "+L+" + '";a+=" var schemaExcl"+s+" = "+k+"; ",k="schemaExcl"+s,a+=" var "+A+"; var "+I+" = typeof "+k+"; if ("+I+" != 'boolean' && "+I+" != 'undefined' && "+I+" != 'number') { ";var N=S,P=P||[];P.push(a),a="",e.createErrors!==!1?(a+=" { keyword: '"+(N||"_exclusiveLimit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: {} ",e.opts.messages!==!1&&(a+=" , message: '"+S+" should be boolean' "),e.opts.verbose&&(a+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+g+" "),a+=" } "):a+=" {} ";var W=a;a=P.pop(),!e.compositeRule&&h?e.async?a+=" throw new ValidationError(["+W+"]); ":a+=" validate.errors = ["+W+"]; return false; ":a+=" var err = "+W+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } else if ( ",v&&(a+=" ("+y+" !== undefined && typeof "+y+" != 'number') || "),a+=" "+I+" == 'number' ? ( ("+A+" = "+y+" === undefined || "+k+" "+_+"= "+y+") ? "+g+" "+C+"= "+k+" : "+g+" "+C+" "+y+" ) : ( ("+A+" = "+k+" === true) ? "+g+" "+C+"= "+y+" : "+g+" "+C+" "+y+" ) || "+g+" !== "+g+") { var op"+s+" = "+A+" ? '"+_+"' : '"+_+"='; ",c===void 0&&(N=S,f=e.errSchemaPath+"/"+S,y=k,v=x)}else{var O=typeof T=="number",M=_;if(O&&v){var L="'"+M+"'";a+=" if ( ",v&&(a+=" ("+y+" !== undefined && typeof "+y+" != 'number') || "),a+=" ( "+y+" === undefined || "+T+" "+_+"= "+y+" ? "+g+" "+C+"= "+T+" : "+g+" "+C+" "+y+" ) || "+g+" !== "+g+") { "}else{O&&c===void 0?(A=!0,N=S,f=e.errSchemaPath+"/"+S,y=T,C+="="):(O&&(y=Math[w?"min":"max"](T,c)),T===(O?y:!0)?(A=!0,N=S,f=e.errSchemaPath+"/"+S,C+="="):(A=!1,M+="="));var L="'"+M+"'";a+=" if ( ",v&&(a+=" ("+y+" !== undefined && typeof "+y+" != 'number') || "),a+=" "+g+" "+C+" "+y+" || "+g+" !== "+g+") { "}}N=N||r;var P=P||[];P.push(a),a="",e.createErrors!==!1?(a+=" { keyword: '"+(N||"_limit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { comparison: "+L+", limit: "+y+", exclusive: "+A+" } ",e.opts.messages!==!1&&(a+=" , message: 'should be "+M+" ",v?a+="' + "+y:a+=""+y+"'"),e.opts.verbose&&(a+=" , schema: ",v?a+="validate.schema"+d:a+=""+c,a+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+g+" "),a+=" } "):a+=" {} ";var W=a;return a=P.pop(),!e.compositeRule&&h?e.async?a+=" throw new ValidationError(["+W+"]); ":a+=" validate.errors = ["+W+"]; return false; ":a+=" var err = "+W+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } ",h&&(a+=" else { "),a}),fb}var pb,jI;function UI(){return jI||(jI=1,pb=function(e,r,n){var a=" ",s=e.level,l=e.dataLevel,c=e.schema[r],d=e.schemaPath+e.util.getProperty(r),f=e.errSchemaPath+"/"+r,h=!e.opts.allErrors,S,g="data"+(l||""),v=e.opts.$data&&c&&c.$data,y;if(v?(a+=" var schema"+s+" = "+e.util.getData(c.$data,l,e.dataPathArr)+"; ",y="schema"+s):y=c,!(v||typeof c=="number"))throw new Error(r+" must be number");var w=r=="maxItems"?">":"<";a+="if ( ",v&&(a+=" ("+y+" !== undefined && typeof "+y+" != 'number') || "),a+=" "+g+".length "+w+" "+y+") { ";var S=r,T=T||[];T.push(a),a="",e.createErrors!==!1?(a+=" { keyword: '"+(S||"_limitItems")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { limit: "+y+" } ",e.opts.messages!==!1&&(a+=" , message: 'should NOT have ",r=="maxItems"?a+="more":a+="fewer",a+=" than ",v?a+="' + "+y+" + '":a+=""+c,a+=" items' "),e.opts.verbose&&(a+=" , schema: ",v?a+="validate.schema"+d:a+=""+c,a+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+g+" "),a+=" } "):a+=" {} ";var x=a;return a=T.pop(),!e.compositeRule&&h?e.async?a+=" throw new ValidationError(["+x+"]); ":a+=" validate.errors = ["+x+"]; return false; ":a+=" var err = "+x+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+="} ",h&&(a+=" else { "),a}),pb}var mb,FI;function zI(){return FI||(FI=1,mb=function(e,r,n){var a=" ",s=e.level,l=e.dataLevel,c=e.schema[r],d=e.schemaPath+e.util.getProperty(r),f=e.errSchemaPath+"/"+r,h=!e.opts.allErrors,S,g="data"+(l||""),v=e.opts.$data&&c&&c.$data,y;if(v?(a+=" var schema"+s+" = "+e.util.getData(c.$data,l,e.dataPathArr)+"; ",y="schema"+s):y=c,!(v||typeof c=="number"))throw new Error(r+" must be number");var w=r=="maxLength"?">":"<";a+="if ( ",v&&(a+=" ("+y+" !== undefined && typeof "+y+" != 'number') || "),e.opts.unicode===!1?a+=" "+g+".length ":a+=" ucs2length("+g+") ",a+=" "+w+" "+y+") { ";var S=r,T=T||[];T.push(a),a="",e.createErrors!==!1?(a+=" { keyword: '"+(S||"_limitLength")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { limit: "+y+" } ",e.opts.messages!==!1&&(a+=" , message: 'should NOT be ",r=="maxLength"?a+="longer":a+="shorter",a+=" than ",v?a+="' + "+y+" + '":a+=""+c,a+=" characters' "),e.opts.verbose&&(a+=" , schema: ",v?a+="validate.schema"+d:a+=""+c,a+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+g+" "),a+=" } "):a+=" {} ";var x=a;return a=T.pop(),!e.compositeRule&&h?e.async?a+=" throw new ValidationError(["+x+"]); ":a+=" validate.errors = ["+x+"]; return false; ":a+=" var err = "+x+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+="} ",h&&(a+=" else { "),a}),mb}var hb,$I;function BI(){return $I||($I=1,hb=function(e,r,n){var a=" ",s=e.level,l=e.dataLevel,c=e.schema[r],d=e.schemaPath+e.util.getProperty(r),f=e.errSchemaPath+"/"+r,h=!e.opts.allErrors,S,g="data"+(l||""),v=e.opts.$data&&c&&c.$data,y;if(v?(a+=" var schema"+s+" = "+e.util.getData(c.$data,l,e.dataPathArr)+"; ",y="schema"+s):y=c,!(v||typeof c=="number"))throw new Error(r+" must be number");var w=r=="maxProperties"?">":"<";a+="if ( ",v&&(a+=" ("+y+" !== undefined && typeof "+y+" != 'number') || "),a+=" Object.keys("+g+").length "+w+" "+y+") { ";var S=r,T=T||[];T.push(a),a="",e.createErrors!==!1?(a+=" { keyword: '"+(S||"_limitProperties")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { limit: "+y+" } ",e.opts.messages!==!1&&(a+=" , message: 'should NOT have ",r=="maxProperties"?a+="more":a+="fewer",a+=" than ",v?a+="' + "+y+" + '":a+=""+c,a+=" properties' "),e.opts.verbose&&(a+=" , schema: ",v?a+="validate.schema"+d:a+=""+c,a+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+g+" "),a+=" } "):a+=" {} ";var x=a;return a=T.pop(),!e.compositeRule&&h?e.async?a+=" throw new ValidationError(["+x+"]); ":a+=" validate.errors = ["+x+"]; return false; ":a+=" var err = "+x+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+="} ",h&&(a+=" else { "),a}),hb}var gb,qI;function W8(){return qI||(qI=1,gb=function(e,r,n){var a=" ",s=e.level,l=e.dataLevel,c=e.schema[r],d=e.schemaPath+e.util.getProperty(r),f=e.errSchemaPath+"/"+r,h=!e.opts.allErrors,g="data"+(l||""),v=e.opts.$data&&c&&c.$data,y;if(v?(a+=" var schema"+s+" = "+e.util.getData(c.$data,l,e.dataPathArr)+"; ",y="schema"+s):y=c,!(v||typeof c=="number"))throw new Error(r+" must be number");a+="var division"+s+";if (",v&&(a+=" "+y+" !== undefined && ( typeof "+y+" != 'number' || "),a+=" (division"+s+" = "+g+" / "+y+", ",e.opts.multipleOfPrecision?a+=" Math.abs(Math.round(division"+s+") - division"+s+") > 1e-"+e.opts.multipleOfPrecision+" ":a+=" division"+s+" !== parseInt(division"+s+") ",a+=" ) ",v&&(a+=" ) "),a+=" ) { ";var w=w||[];w.push(a),a="",e.createErrors!==!1?(a+=" { keyword: 'multipleOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { multipleOf: "+y+" } ",e.opts.messages!==!1&&(a+=" , message: 'should be multiple of ",v?a+="' + "+y:a+=""+y+"'"),e.opts.verbose&&(a+=" , schema: ",v?a+="validate.schema"+d:a+=""+c,a+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+g+" "),a+=" } "):a+=" {} ";var S=a;return a=w.pop(),!e.compositeRule&&h?e.async?a+=" throw new ValidationError(["+S+"]); ":a+=" validate.errors = ["+S+"]; return false; ":a+=" var err = "+S+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+="} ",h&&(a+=" else { "),a}),gb}var vb,HI;function Y8(){return HI||(HI=1,vb=function(e,r,n){var a=" ",s=e.level,l=e.dataLevel,c=e.schema[r],d=e.schemaPath+e.util.getProperty(r),f=e.errSchemaPath+"/"+r,h=!e.opts.allErrors,g="data"+(l||""),v="errs__"+s,y=e.util.copy(e);y.level++;var w="valid"+y.level;if(e.opts.strictKeywords?typeof c=="object"&&Object.keys(c).length>0||c===!1:e.util.schemaHasRules(c,e.RULES.all)){y.schema=c,y.schemaPath=d,y.errSchemaPath=f,a+=" var "+v+" = errors; ";var S=e.compositeRule;e.compositeRule=y.compositeRule=!0,y.createErrors=!1;var T;y.opts.allErrors&&(T=y.opts.allErrors,y.opts.allErrors=!1),a+=" "+e.validate(y)+" ",y.createErrors=!0,T&&(y.opts.allErrors=T),e.compositeRule=y.compositeRule=S,a+=" if ("+w+") { ";var x=x||[];x.push(a),a="",e.createErrors!==!1?(a+=" { keyword: 'not' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: {} ",e.opts.messages!==!1&&(a+=" , message: 'should NOT be valid' "),e.opts.verbose&&(a+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+g+" "),a+=" } "):a+=" {} ";var _=a;a=x.pop(),!e.compositeRule&&h?e.async?a+=" throw new ValidationError(["+_+"]); ":a+=" validate.errors = ["+_+"]; return false; ":a+=" var err = "+_+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } else { errors = "+v+"; if (vErrors !== null) { if ("+v+") vErrors.length = "+v+"; else vErrors = null; } ",e.opts.allErrors&&(a+=" } ")}else a+=" var err = ",e.createErrors!==!1?(a+=" { keyword: 'not' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: {} ",e.opts.messages!==!1&&(a+=" , message: 'should NOT be valid' "),e.opts.verbose&&(a+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+g+" "),a+=" } "):a+=" {} ",a+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",h&&(a+=" if (false) { ");return a}),vb}var bb,VI;function K8(){return VI||(VI=1,bb=function(e,r,n){var a=" ",s=e.level,l=e.dataLevel,c=e.schema[r],d=e.schemaPath+e.util.getProperty(r),f=e.errSchemaPath+"/"+r,h=!e.opts.allErrors,g="data"+(l||""),v="valid"+s,y="errs__"+s,w=e.util.copy(e),S="";w.level++;var T="valid"+w.level,x=w.baseId,_="prevValid"+s,C="passingSchemas"+s;a+="var "+y+" = errors , "+_+" = false , "+v+" = false , "+C+" = null; ";var N=e.compositeRule;e.compositeRule=w.compositeRule=!0;var k=c;if(k)for(var A,I=-1,O=k.length-1;I<O;)A=k[I+=1],(e.opts.strictKeywords?typeof A=="object"&&Object.keys(A).length>0||A===!1:e.util.schemaHasRules(A,e.RULES.all))?(w.schema=A,w.schemaPath=d+"["+I+"]",w.errSchemaPath=f+"/"+I,a+=" "+e.validate(w)+" ",w.baseId=x):a+=" var "+T+" = true; ",I&&(a+=" if ("+T+" && "+_+") { "+v+" = false; "+C+" = ["+C+", "+I+"]; } else { ",S+="}"),a+=" if ("+T+") { "+v+" = "+_+" = true; "+C+" = "+I+"; }";return e.compositeRule=w.compositeRule=N,a+=""+S+"if (!"+v+") { var err = ",e.createErrors!==!1?(a+=" { keyword: 'oneOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { passingSchemas: "+C+" } ",e.opts.messages!==!1&&(a+=" , message: 'should match exactly one schema in oneOf' "),e.opts.verbose&&(a+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+g+" "),a+=" } "):a+=" {} ",a+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&h&&(e.async?a+=" throw new ValidationError(vErrors); ":a+=" validate.errors = vErrors; return false; "),a+="} else { errors = "+y+"; if (vErrors !== null) { if ("+y+") vErrors.length = "+y+"; else vErrors = null; }",e.opts.allErrors&&(a+=" } "),a}),bb}var yb,GI;function Z8(){return GI||(GI=1,yb=function(e,r,n){var a=" ",s=e.level,l=e.dataLevel,c=e.schema[r],d=e.schemaPath+e.util.getProperty(r),f=e.errSchemaPath+"/"+r,h=!e.opts.allErrors,g="data"+(l||""),v=e.opts.$data&&c&&c.$data,y;v?(a+=" var schema"+s+" = "+e.util.getData(c.$data,l,e.dataPathArr)+"; ",y="schema"+s):y=c;var w=v?"(new RegExp("+y+"))":e.usePattern(c);a+="if ( ",v&&(a+=" ("+y+" !== undefined && typeof "+y+" != 'string') || "),a+=" !"+w+".test("+g+") ) { ";var S=S||[];S.push(a),a="",e.createErrors!==!1?(a+=" { keyword: 'pattern' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { pattern: ",v?a+=""+y:a+=""+e.util.toQuotedString(c),a+=" } ",e.opts.messages!==!1&&(a+=` , message: 'should match pattern "`,v?a+="' + "+y+" + '":a+=""+e.util.escapeQuotes(c),a+=`"' `),e.opts.verbose&&(a+=" , schema: ",v?a+="validate.schema"+d:a+=""+e.util.toQuotedString(c),a+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+g+" "),a+=" } "):a+=" {} ";var T=a;return a=S.pop(),!e.compositeRule&&h?e.async?a+=" throw new ValidationError(["+T+"]); ":a+=" validate.errors = ["+T+"]; return false; ":a+=" var err = "+T+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+="} ",h&&(a+=" else { "),a}),yb}var Eb,WI;function X8(){return WI||(WI=1,Eb=function(e,r,n){var a=" ",s=e.level,l=e.dataLevel,c=e.schema[r],d=e.schemaPath+e.util.getProperty(r),f=e.errSchemaPath+"/"+r,h=!e.opts.allErrors,g="data"+(l||""),v="errs__"+s,y=e.util.copy(e),w="";y.level++;var S="valid"+y.level,T="key"+s,x="idx"+s,_=y.dataLevel=e.dataLevel+1,C="data"+_,N="dataProperties"+s,k=Object.keys(c||{}).filter(H),A=e.schema.patternProperties||{},I=Object.keys(A).filter(H),O=e.schema.additionalProperties,L=k.length||I.length,M=O===!1,P=typeof O=="object"&&Object.keys(O).length,W=e.opts.removeAdditional,X=M||P||W,ee=e.opts.ownProperties,J=e.baseId,B=e.schema.required;if(B&&!(e.opts.$data&&B.$data)&&B.length<e.opts.loopRequired)var Y=e.util.toHash(B);function H(Ve){return Ve!=="__proto__"}if(a+="var "+v+" = errors;var "+S+" = true;",ee&&(a+=" var "+N+" = undefined;"),X){if(ee?a+=" "+N+" = "+N+" || Object.keys("+g+"); for (var "+x+"=0; "+x+"<"+N+".length; "+x+"++) { var "+T+" = "+N+"["+x+"]; ":a+=" for (var "+T+" in "+g+") { ",L){if(a+=" var isAdditional"+s+" = !(false ",k.length)if(k.length>8)a+=" || validate.schema"+d+".hasOwnProperty("+T+") ";else{var re=k;if(re)for(var Q,j=-1,q=re.length-1;j<q;)Q=re[j+=1],a+=" || "+T+" == "+e.util.toQuotedString(Q)+" "}if(I.length){var z=I;if(z)for(var G,Z=-1,U=z.length-1;Z<U;)G=z[Z+=1],a+=" || "+e.usePattern(G)+".test("+T+") "}a+=" ); if (isAdditional"+s+") { "}if(W=="all")a+=" delete "+g+"["+T+"]; ";else{var F=e.errorPath,te="' + "+T+" + '";if(e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(e.errorPath,T,e.opts.jsonPointers)),M)if(W)a+=" delete "+g+"["+T+"]; ";else{a+=" "+S+" = false; ";var fe=f;f=e.errSchemaPath+"/additionalProperties";var V=V||[];V.push(a),a="",e.createErrors!==!1?(a+=" { keyword: 'additionalProperties' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { additionalProperty: '"+te+"' } ",e.opts.messages!==!1&&(a+=" , message: '",e.opts._errorDataPathProperty?a+="is an invalid additional property":a+="should NOT have additional properties",a+="' "),e.opts.verbose&&(a+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+g+" "),a+=" } "):a+=" {} ";var de=a;a=V.pop(),!e.compositeRule&&h?e.async?a+=" throw new ValidationError(["+de+"]); ":a+=" validate.errors = ["+de+"]; return false; ":a+=" var err = "+de+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",f=fe,h&&(a+=" break; ")}else if(P)if(W=="failing"){a+=" var "+v+" = errors; ";var le=e.compositeRule;e.compositeRule=y.compositeRule=!0,y.schema=O,y.schemaPath=e.schemaPath+".additionalProperties",y.errSchemaPath=e.errSchemaPath+"/additionalProperties",y.errorPath=e.opts._errorDataPathProperty?e.errorPath:e.util.getPathExpr(e.errorPath,T,e.opts.jsonPointers);var pe=g+"["+T+"]";y.dataPathArr[_]=T;var Re=e.validate(y);y.baseId=J,e.util.varOccurences(Re,C)<2?a+=" "+e.util.varReplace(Re,C,pe)+" ":a+=" var "+C+" = "+pe+"; "+Re+" ",a+=" if (!"+S+") { errors = "+v+"; if (validate.errors !== null) { if (errors) validate.errors.length = errors; else validate.errors = null; } delete "+g+"["+T+"]; } ",e.compositeRule=y.compositeRule=le}else{y.schema=O,y.schemaPath=e.schemaPath+".additionalProperties",y.errSchemaPath=e.errSchemaPath+"/additionalProperties",y.errorPath=e.opts._errorDataPathProperty?e.errorPath:e.util.getPathExpr(e.errorPath,T,e.opts.jsonPointers);var pe=g+"["+T+"]";y.dataPathArr[_]=T;var Re=e.validate(y);y.baseId=J,e.util.varOccurences(Re,C)<2?a+=" "+e.util.varReplace(Re,C,pe)+" ":a+=" var "+C+" = "+pe+"; "+Re+" ",h&&(a+=" if (!"+S+") break; ")}e.errorPath=F}L&&(a+=" } "),a+=" } ",h&&(a+=" if ("+S+") { ",w+="}")}var Ke=e.opts.useDefaults&&!e.compositeRule;if(k.length){var je=k;if(je)for(var Q,ze=-1,_e=je.length-1;ze<_e;){Q=je[ze+=1];var Ae=c[Q];if(e.opts.strictKeywords?typeof Ae=="object"&&Object.keys(Ae).length>0||Ae===!1:e.util.schemaHasRules(Ae,e.RULES.all)){var $e=e.util.getProperty(Q),pe=g+$e,oe=Ke&&Ae.default!==void 0;y.schema=Ae,y.schemaPath=d+$e,y.errSchemaPath=f+"/"+e.util.escapeFragment(Q),y.errorPath=e.util.getPath(e.errorPath,Q,e.opts.jsonPointers),y.dataPathArr[_]=e.util.toQuotedString(Q);var Re=e.validate(y);if(y.baseId=J,e.util.varOccurences(Re,C)<2){Re=e.util.varReplace(Re,C,pe);var Se=pe}else{var Se=C;a+=" var "+C+" = "+pe+"; "}if(oe)a+=" "+Re+" ";else{if(Y&&Y[Q]){a+=" if ( "+Se+" === undefined ",ee&&(a+=" || ! Object.prototype.hasOwnProperty.call("+g+", '"+e.util.escapeQuotes(Q)+"') "),a+=") { "+S+" = false; ";var F=e.errorPath,fe=f,Le=e.util.escapeQuotes(Q);e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(F,Q,e.opts.jsonPointers)),f=e.errSchemaPath+"/required";var V=V||[];V.push(a),a="",e.createErrors!==!1?(a+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { missingProperty: '"+Le+"' } ",e.opts.messages!==!1&&(a+=" , message: '",e.opts._errorDataPathProperty?a+="is a required property":a+="should have required property \\'"+Le+"\\'",a+="' "),e.opts.verbose&&(a+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+g+" "),a+=" } "):a+=" {} ";var de=a;a=V.pop(),!e.compositeRule&&h?e.async?a+=" throw new ValidationError(["+de+"]); ":a+=" validate.errors = ["+de+"]; return false; ":a+=" var err = "+de+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",f=fe,e.errorPath=F,a+=" } else { "}else h?(a+=" if ( "+Se+" === undefined ",ee&&(a+=" || ! Object.prototype.hasOwnProperty.call("+g+", '"+e.util.escapeQuotes(Q)+"') "),a+=") { "+S+" = true; } else { "):(a+=" if ("+Se+" !== undefined ",ee&&(a+=" && Object.prototype.hasOwnProperty.call("+g+", '"+e.util.escapeQuotes(Q)+"') "),a+=" ) { ");a+=" "+Re+" } "}}h&&(a+=" if ("+S+") { ",w+="}")}}if(I.length){var we=I;if(we)for(var G,ke=-1,Oe=we.length-1;ke<Oe;){G=we[ke+=1];var Ae=A[G];if(e.opts.strictKeywords?typeof Ae=="object"&&Object.keys(Ae).length>0||Ae===!1:e.util.schemaHasRules(Ae,e.RULES.all)){y.schema=Ae,y.schemaPath=e.schemaPath+".patternProperties"+e.util.getProperty(G),y.errSchemaPath=e.errSchemaPath+"/patternProperties/"+e.util.escapeFragment(G),ee?a+=" "+N+" = "+N+" || Object.keys("+g+"); for (var "+x+"=0; "+x+"<"+N+".length; "+x+"++) { var "+T+" = "+N+"["+x+"]; ":a+=" for (var "+T+" in "+g+") { ",a+=" if ("+e.usePattern(G)+".test("+T+")) { ",y.errorPath=e.util.getPathExpr(e.errorPath,T,e.opts.jsonPointers);var pe=g+"["+T+"]";y.dataPathArr[_]=T;var Re=e.validate(y);y.baseId=J,e.util.varOccurences(Re,C)<2?a+=" "+e.util.varReplace(Re,C,pe)+" ":a+=" var "+C+" = "+pe+"; "+Re+" ",h&&(a+=" if (!"+S+") break; "),a+=" } ",h&&(a+=" else "+S+" = true; "),a+=" } ",h&&(a+=" if ("+S+") { ",w+="}")}}}return h&&(a+=" "+w+" if ("+v+" == errors) {"),a}),Eb}var Sb,YI;function Q8(){return YI||(YI=1,Sb=function(e,r,n){var a=" ",s=e.level,l=e.dataLevel,c=e.schema[r],d=e.schemaPath+e.util.getProperty(r),f=e.errSchemaPath+"/"+r,h=!e.opts.allErrors,g="data"+(l||""),v="errs__"+s,y=e.util.copy(e),w="";y.level++;var S="valid"+y.level;if(a+="var "+v+" = errors;",e.opts.strictKeywords?typeof c=="object"&&Object.keys(c).length>0||c===!1:e.util.schemaHasRules(c,e.RULES.all)){y.schema=c,y.schemaPath=d,y.errSchemaPath=f;var T="key"+s,x="idx"+s,_="i"+s,C="' + "+T+" + '",N=y.dataLevel=e.dataLevel+1,k="data"+N,A="dataProperties"+s,I=e.opts.ownProperties,O=e.baseId;I&&(a+=" var "+A+" = undefined; "),I?a+=" "+A+" = "+A+" || Object.keys("+g+"); for (var "+x+"=0; "+x+"<"+A+".length; "+x+"++) { var "+T+" = "+A+"["+x+"]; ":a+=" for (var "+T+" in "+g+") { ",a+=" var startErrs"+s+" = errors; ";var L=T,M=e.compositeRule;e.compositeRule=y.compositeRule=!0;var P=e.validate(y);y.baseId=O,e.util.varOccurences(P,k)<2?a+=" "+e.util.varReplace(P,k,L)+" ":a+=" var "+k+" = "+L+"; "+P+" ",e.compositeRule=y.compositeRule=M,a+=" if (!"+S+") { for (var "+_+"=startErrs"+s+"; "+_+"<errors; "+_+"++) { vErrors["+_+"].propertyName = "+T+"; } var err = ",e.createErrors!==!1?(a+=" { keyword: 'propertyNames' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { propertyName: '"+C+"' } ",e.opts.messages!==!1&&(a+=" , message: 'property name \\'"+C+"\\' is invalid' "),e.opts.verbose&&(a+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+g+" "),a+=" } "):a+=" {} ",a+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&h&&(e.async?a+=" throw new ValidationError(vErrors); ":a+=" validate.errors = vErrors; return false; "),h&&(a+=" break; "),a+=" } }"}return h&&(a+=" "+w+" if ("+v+" == errors) {"),a}),Sb}var xb,KI;function J8(){return KI||(KI=1,xb=function(e,r,n){var a=" ",s=e.level,l=e.dataLevel,c=e.schema[r],d=e.schemaPath+e.util.getProperty(r),f=e.errSchemaPath+"/"+r,h=!e.opts.allErrors,g="data"+(l||""),v="valid"+s,y=e.opts.$data&&c&&c.$data;y&&(a+=" var schema"+s+" = "+e.util.getData(c.$data,l,e.dataPathArr)+"; ");var w="schema"+s;if(!y)if(c.length<e.opts.loopRequired&&e.schema.properties&&Object.keys(e.schema.properties).length){var S=[],T=c;if(T)for(var x,_=-1,C=T.length-1;_<C;){x=T[_+=1];var N=e.schema.properties[x];N&&(e.opts.strictKeywords?typeof N=="object"&&Object.keys(N).length>0||N===!1:e.util.schemaHasRules(N,e.RULES.all))||(S[S.length]=x)}}else var S=c;if(y||S.length){var k=e.errorPath,A=y||S.length>=e.opts.loopRequired,I=e.opts.ownProperties;if(h)if(a+=" var missing"+s+"; ",A){y||(a+=" var "+w+" = validate.schema"+d+"; ");var O="i"+s,L="schema"+s+"["+O+"]",M="' + "+L+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(k,L,e.opts.jsonPointers)),a+=" var "+v+" = true; ",y&&(a+=" if (schema"+s+" === undefined) "+v+" = true; else if (!Array.isArray(schema"+s+")) "+v+" = false; else {"),a+=" for (var "+O+" = 0; "+O+" < "+w+".length; "+O+"++) { "+v+" = "+g+"["+w+"["+O+"]] !== undefined ",I&&(a+=" && Object.prototype.hasOwnProperty.call("+g+", "+w+"["+O+"]) "),a+="; if (!"+v+") break; } ",y&&(a+=" } "),a+=" if (!"+v+") { ";var P=P||[];P.push(a),a="",e.createErrors!==!1?(a+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { missingProperty: '"+M+"' } ",e.opts.messages!==!1&&(a+=" , message: '",e.opts._errorDataPathProperty?a+="is a required property":a+="should have required property \\'"+M+"\\'",a+="' "),e.opts.verbose&&(a+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+g+" "),a+=" } "):a+=" {} ";var W=a;a=P.pop(),!e.compositeRule&&h?e.async?a+=" throw new ValidationError(["+W+"]); ":a+=" validate.errors = ["+W+"]; return false; ":a+=" var err = "+W+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } else { "}else{a+=" if ( ";var X=S;if(X)for(var ee,O=-1,J=X.length-1;O<J;){ee=X[O+=1],O&&(a+=" || ");var B=e.util.getProperty(ee),Y=g+B;a+=" ( ( "+Y+" === undefined ",I&&(a+=" || ! Object.prototype.hasOwnProperty.call("+g+", '"+e.util.escapeQuotes(ee)+"') "),a+=") && (missing"+s+" = "+e.util.toQuotedString(e.opts.jsonPointers?ee:B)+") ) "}a+=") { ";var L="missing"+s,M="' + "+L+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.opts.jsonPointers?e.util.getPathExpr(k,L,!0):k+" + "+L);var P=P||[];P.push(a),a="",e.createErrors!==!1?(a+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { missingProperty: '"+M+"' } ",e.opts.messages!==!1&&(a+=" , message: '",e.opts._errorDataPathProperty?a+="is a required property":a+="should have required property \\'"+M+"\\'",a+="' "),e.opts.verbose&&(a+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+g+" "),a+=" } "):a+=" {} ";var W=a;a=P.pop(),!e.compositeRule&&h?e.async?a+=" throw new ValidationError(["+W+"]); ":a+=" validate.errors = ["+W+"]; return false; ":a+=" var err = "+W+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } else { "}else if(A){y||(a+=" var "+w+" = validate.schema"+d+"; ");var O="i"+s,L="schema"+s+"["+O+"]",M="' + "+L+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(k,L,e.opts.jsonPointers)),y&&(a+=" if ("+w+" && !Array.isArray("+w+")) { var err = ",e.createErrors!==!1?(a+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { missingProperty: '"+M+"' } ",e.opts.messages!==!1&&(a+=" , message: '",e.opts._errorDataPathProperty?a+="is a required property":a+="should have required property \\'"+M+"\\'",a+="' "),e.opts.verbose&&(a+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+g+" "),a+=" } "):a+=" {} ",a+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } else if ("+w+" !== undefined) { "),a+=" for (var "+O+" = 0; "+O+" < "+w+".length; "+O+"++) { if ("+g+"["+w+"["+O+"]] === undefined ",I&&(a+=" || ! Object.prototype.hasOwnProperty.call("+g+", "+w+"["+O+"]) "),a+=") { var err = ",e.createErrors!==!1?(a+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { missingProperty: '"+M+"' } ",e.opts.messages!==!1&&(a+=" , message: '",e.opts._errorDataPathProperty?a+="is a required property":a+="should have required property \\'"+M+"\\'",a+="' "),e.opts.verbose&&(a+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+g+" "),a+=" } "):a+=" {} ",a+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } } ",y&&(a+=" } ")}else{var H=S;if(H)for(var ee,re=-1,Q=H.length-1;re<Q;){ee=H[re+=1];var B=e.util.getProperty(ee),M=e.util.escapeQuotes(ee),Y=g+B;e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(k,ee,e.opts.jsonPointers)),a+=" if ( "+Y+" === undefined ",I&&(a+=" || ! Object.prototype.hasOwnProperty.call("+g+", '"+e.util.escapeQuotes(ee)+"') "),a+=") { var err = ",e.createErrors!==!1?(a+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { missingProperty: '"+M+"' } ",e.opts.messages!==!1&&(a+=" , message: '",e.opts._errorDataPathProperty?a+="is a required property":a+="should have required property \\'"+M+"\\'",a+="' "),e.opts.verbose&&(a+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+g+" "),a+=" } "):a+=" {} ",a+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } "}}e.errorPath=k}else h&&(a+=" if (true) {");return a}),xb}var wb,ZI;function eW(){return ZI||(ZI=1,wb=function(e,r,n){var a=" ",s=e.level,l=e.dataLevel,c=e.schema[r],d=e.schemaPath+e.util.getProperty(r),f=e.errSchemaPath+"/"+r,h=!e.opts.allErrors,g="data"+(l||""),v="valid"+s,y=e.opts.$data&&c&&c.$data,w;if(y?(a+=" var schema"+s+" = "+e.util.getData(c.$data,l,e.dataPathArr)+"; ",w="schema"+s):w=c,(c||y)&&e.opts.uniqueItems!==!1){y&&(a+=" var "+v+"; if ("+w+" === false || "+w+" === undefined) "+v+" = true; else if (typeof "+w+" != 'boolean') "+v+" = false; else { "),a+=" var i = "+g+".length , "+v+" = true , j; if (i > 1) { ";var S=e.schema.items&&e.schema.items.type,T=Array.isArray(S);if(!S||S=="object"||S=="array"||T&&(S.indexOf("object")>=0||S.indexOf("array")>=0))a+=" outer: for (;i--;) { for (j = i; j--;) { if (equal("+g+"[i], "+g+"[j])) { "+v+" = false; break outer; } } } ";else{a+=" var itemIndices = {}, item; for (;i--;) { var item = "+g+"[i]; ";var x="checkDataType"+(T?"s":"");a+=" if ("+e.util[x](S,"item",e.opts.strictNumbers,!0)+") continue; ",T&&(a+=` if (typeof item == 'string') item = '"' + item; `),a+=" if (typeof itemIndices[item] == 'number') { "+v+" = false; j = itemIndices[item]; break; } itemIndices[item] = i; } "}a+=" } ",y&&(a+=" } "),a+=" if (!"+v+") { ";var _=_||[];_.push(a),a="",e.createErrors!==!1?(a+=" { keyword: 'uniqueItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { i: i, j: j } ",e.opts.messages!==!1&&(a+=" , message: 'should NOT have duplicate items (items ## ' + j + ' and ' + i + ' are identical)' "),e.opts.verbose&&(a+=" , schema: ",y?a+="validate.schema"+d:a+=""+c,a+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+g+" "),a+=" } "):a+=" {} ";var C=a;a=_.pop(),!e.compositeRule&&h?e.async?a+=" throw new ValidationError(["+C+"]); ":a+=" validate.errors = ["+C+"]; return false; ":a+=" var err = "+C+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } ",h&&(a+=" else { ")}else h&&(a+=" if (true) { ");return a}),wb}var _b,XI;function tW(){return XI||(XI=1,_b={$ref:P8(),allOf:j8(),anyOf:U8(),$comment:F8(),const:z8(),contains:$8(),dependencies:B8(),enum:q8(),format:H8(),if:V8(),items:G8(),maximum:PI(),minimum:PI(),maxItems:UI(),minItems:UI(),maxLength:zI(),minLength:zI(),maxProperties:BI(),minProperties:BI(),multipleOf:W8(),not:Y8(),oneOf:K8(),pattern:Z8(),properties:X8(),propertyNames:Q8(),required:J8(),uniqueItems:eW(),validate:v$()}),_b}var Tb,QI;function rW(){if(QI)return Tb;QI=1;var t=tW(),e=gc().toHash;return Tb=function(){var n=[{type:"number",rules:[{maximum:["exclusiveMaximum"]},{minimum:["exclusiveMinimum"]},"multipleOf","format"]},{type:"string",rules:["maxLength","minLength","pattern","format"]},{type:"array",rules:["maxItems","minItems","items","contains","uniqueItems"]},{type:"object",rules:["maxProperties","minProperties","required","dependencies","propertyNames",{properties:["additionalProperties","patternProperties"]}]},{rules:["$ref","const","enum","not","anyOf","oneOf","allOf","if"]}],a=["type","$comment"],s=["$schema","$id","id","$data","$async","title","description","default","definitions","examples","readOnly","writeOnly","contentMediaType","contentEncoding","additionalItems","then","else"],l=["number","integer","string","array","object","boolean","null"];return n.all=e(a),n.types=e(l),n.forEach(function(c){c.rules=c.rules.map(function(d){var f;if(typeof d=="object"){var h=Object.keys(d)[0];f=d[h],d=h,f.forEach(function(v){a.push(v),n.all[v]=!0})}a.push(d);var g=n.all[d]={keyword:d,code:t[d],implements:f};return g}),n.all.$comment={keyword:"$comment",code:t.$comment},c.type&&(n.types[c.type]=c)}),n.keywords=e(a.concat(s)),n.custom={},n},Tb}var Rb,JI;function nW(){if(JI)return Rb;JI=1;var t=["multipleOf","maximum","exclusiveMaximum","minimum","exclusiveMinimum","maxLength","minLength","pattern","additionalItems","maxItems","minItems","uniqueItems","maxProperties","minProperties","required","additionalProperties","enum","format","const"];return Rb=function(e,r){for(var n=0;n<r.length;n++){e=JSON.parse(JSON.stringify(e));var a=r[n].split("/"),s=e,l;for(l=1;l<a.length;l++)s=s[a[l]];for(l=0;l<t.length;l++){var c=t[l],d=s[c];d&&(s[c]={anyOf:[d,{$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"}]})}}return e},Rb}var Cb,eO;function aW(){if(eO)return Cb;eO=1;var t=mR().MissingRef;Cb=e;function e(r,n,a){var s=this;if(typeof this._opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");typeof n=="function"&&(a=n,n=void 0);var l=c(r).then(function(){var f=s._addSchema(r,void 0,n);return f.validate||d(f)});return a&&l.then(function(f){a(null,f)},a),l;function c(f){var h=f.$schema;return h&&!s.getSchema(h)?e.call(s,{$ref:h},!0):Promise.resolve()}function d(f){try{return s._compile(f)}catch(g){if(g instanceof t)return h(g);throw g}function h(g){var v=g.missingSchema;if(S(v))throw new Error("Schema "+v+" is loaded but "+g.missingRef+" cannot be resolved");var y=s._loadingSchemas[v];return y||(y=s._loadingSchemas[v]=s._opts.loadSchema(v),y.then(w,w)),y.then(function(T){if(!S(v))return c(T).then(function(){S(v)||s.addSchema(T,v,void 0,n)})}).then(function(){return d(f)});function w(){delete s._loadingSchemas[v]}function S(T){return s._refs[T]||s._schemas[T]}}}}return Cb}var Ab,tO;function oW(){return tO||(tO=1,Ab=function(e,r,n){var a=" ",s=e.level,l=e.dataLevel,c=e.schema[r],d=e.schemaPath+e.util.getProperty(r),f=e.errSchemaPath+"/"+r,h=!e.opts.allErrors,g,v="data"+(l||""),y="valid"+s,w="errs__"+s,S=e.opts.$data&&c&&c.$data,T;S?(a+=" var schema"+s+" = "+e.util.getData(c.$data,l,e.dataPathArr)+"; ",T="schema"+s):T=c;var x=this,_="definition"+s,C=x.definition,N="",k,A,I,O,L;if(S&&C.$data){L="keywordValidate"+s;var M=C.validateSchema;a+=" var "+_+" = RULES.custom['"+r+"'].definition; var "+L+" = "+_+".validate;"}else{if(O=e.useCustomRule(x,c,e.schema,e),!O)return;T="validate.schema"+d,L=O.code,k=C.compile,A=C.inline,I=C.macro}var P=L+".errors",W="i"+s,X="ruleErr"+s,ee=C.async;if(ee&&!e.async)throw new Error("async keyword in sync schema");if(A||I||(a+=""+P+" = null;"),a+="var "+w+" = errors;var "+y+";",S&&C.$data&&(N+="}",a+=" if ("+T+" === undefined) { "+y+" = true; } else { ",M&&(N+="}",a+=" "+y+" = "+_+".validateSchema("+T+"); if ("+y+") { ")),A)C.statements?a+=" "+O.validate+" ":a+=" "+y+" = "+O.validate+"; ";else if(I){var J=e.util.copy(e),N="";J.level++;var B="valid"+J.level;J.schema=O.validate,J.schemaPath="";var Y=e.compositeRule;e.compositeRule=J.compositeRule=!0;var H=e.validate(J).replace(/validate\.schema/g,L);e.compositeRule=J.compositeRule=Y,a+=" "+H}else{var re=re||[];re.push(a),a="",a+=" "+L+".call( ",e.opts.passContext?a+="this":a+="self",k||C.schema===!1?a+=" , "+v+" ":a+=" , "+T+" , "+v+" , validate.schema"+e.schemaPath+" ",a+=" , (dataPath || '')",e.errorPath!='""'&&(a+=" + "+e.errorPath);var Q=l?"data"+(l-1||""):"parentData",j=l?e.dataPathArr[l]:"parentDataProperty";a+=" , "+Q+" , "+j+" , rootData ) ";var q=a;a=re.pop(),C.errors===!1?(a+=" "+y+" = ",ee&&(a+="await "),a+=""+q+"; "):ee?(P="customErrors"+s,a+=" var "+P+" = null; try { "+y+" = await "+q+"; } catch (e) { "+y+" = false; if (e instanceof ValidationError) "+P+" = e.errors; else throw e; } "):a+=" "+P+" = null; "+y+" = "+q+"; "}if(C.modifying&&(a+=" if ("+Q+") "+v+" = "+Q+"["+j+"];"),a+=""+N,C.valid)h&&(a+=" if (true) { ");else{a+=" if ( ",C.valid===void 0?(a+=" !",I?a+=""+B:a+=""+y):a+=" "+!C.valid+" ",a+=") { ",g=x.keyword;var re=re||[];re.push(a),a="";var re=re||[];re.push(a),a="",e.createErrors!==!1?(a+=" { keyword: '"+(g||"custom")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { keyword: '"+x.keyword+"' } ",e.opts.messages!==!1&&(a+=` , message: 'should pass "`+x.keyword+`" keyword validation' `),e.opts.verbose&&(a+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+v+" "),a+=" } "):a+=" {} ";var z=a;a=re.pop(),!e.compositeRule&&h?e.async?a+=" throw new ValidationError(["+z+"]); ":a+=" validate.errors = ["+z+"]; return false; ":a+=" var err = "+z+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";var G=a;a=re.pop(),A?C.errors?C.errors!="full"&&(a+=" for (var "+W+"="+w+"; "+W+"<errors; "+W+"++) { var "+X+" = vErrors["+W+"]; if ("+X+".dataPath === undefined) "+X+".dataPath = (dataPath || '') + "+e.errorPath+"; if ("+X+".schemaPath === undefined) { "+X+'.schemaPath = "'+f+'"; } ',e.opts.verbose&&(a+=" "+X+".schema = "+T+"; "+X+".data = "+v+"; "),a+=" } "):C.errors===!1?a+=" "+G+" ":(a+=" if ("+w+" == errors) { "+G+" } else { for (var "+W+"="+w+"; "+W+"<errors; "+W+"++) { var "+X+" = vErrors["+W+"]; if ("+X+".dataPath === undefined) "+X+".dataPath = (dataPath || '') + "+e.errorPath+"; if ("+X+".schemaPath === undefined) { "+X+'.schemaPath = "'+f+'"; } ',e.opts.verbose&&(a+=" "+X+".schema = "+T+"; "+X+".data = "+v+"; "),a+=" } } "):I?(a+=" var err = ",e.createErrors!==!1?(a+=" { keyword: '"+(g||"custom")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { keyword: '"+x.keyword+"' } ",e.opts.messages!==!1&&(a+=` , message: 'should pass "`+x.keyword+`" keyword validation' `),e.opts.verbose&&(a+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+v+" "),a+=" } "):a+=" {} ",a+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&h&&(e.async?a+=" throw new ValidationError(vErrors); ":a+=" validate.errors = vErrors; return false; ")):C.errors===!1?a+=" "+G+" ":(a+=" if (Array.isArray("+P+")) { if (vErrors === null) vErrors = "+P+"; else vErrors = vErrors.concat("+P+"); errors = vErrors.length; for (var "+W+"="+w+"; "+W+"<errors; "+W+"++) { var "+X+" = vErrors["+W+"]; if ("+X+".dataPath === undefined) "+X+".dataPath = (dataPath || '') + "+e.errorPath+"; "+X+'.schemaPath = "'+f+'"; ',e.opts.verbose&&(a+=" "+X+".schema = "+T+"; "+X+".data = "+v+"; "),a+=" } } else { "+G+" } "),a+=" } ",h&&(a+=" else { ")}return a}),Ab}const iW="http://json-schema.org/draft-07/schema#",sW="http://json-schema.org/draft-07/schema#",lW="Core schema meta-schema",cW={schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},uW=["object","boolean"],dW={$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},b$={$schema:iW,$id:sW,title:lW,definitions:cW,type:uW,properties:dW,default:!0};var Nb,rO;function fW(){if(rO)return Nb;rO=1;var t=b$;return Nb={$id:"https://github.com/ajv-validator/ajv/blob/master/lib/definition_schema.js",definitions:{simpleTypes:t.definitions.simpleTypes},type:"object",dependencies:{schema:["validate"],$data:["validate"],statements:["inline"],valid:{not:{required:["macro"]}}},properties:{type:t.properties.type,schema:{type:"boolean"},statements:{type:"boolean"},dependencies:{type:"array",items:{type:"string"}},metaSchema:{type:"object"},modifying:{type:"boolean"},valid:{type:"boolean"},$data:{type:"boolean"},async:{type:"boolean"},errors:{anyOf:[{type:"boolean"},{const:"full"}]}}},Nb}var kb,nO;function pW(){if(nO)return kb;nO=1;var t=/^[a-z_$][a-z0-9_$-]*$/i,e=oW(),r=fW();kb={add:n,get:a,remove:s,validate:l};function n(c,d){var f=this.RULES;if(f.keywords[c])throw new Error("Keyword "+c+" is already defined");if(!t.test(c))throw new Error("Keyword "+c+" is not a valid identifier");if(d){this.validateKeyword(d,!0);var h=d.type;if(Array.isArray(h))for(var g=0;g<h.length;g++)y(c,h[g],d);else y(c,h,d);var v=d.metaSchema;v&&(d.$data&&this._opts.$data&&(v={anyOf:[v,{$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"}]}),d.validateSchema=this.compile(v,!0))}f.keywords[c]=f.all[c]=!0;function y(w,S,T){for(var x,_=0;_<f.length;_++){var C=f[_];if(C.type==S){x=C;break}}x||(x={type:S,rules:[]},f.push(x));var N={keyword:w,definition:T,custom:!0,code:e,implements:T.implements};x.rules.push(N),f.custom[w]=N}return this}function a(c){var d=this.RULES.custom[c];return d?d.definition:this.RULES.keywords[c]||!1}function s(c){var d=this.RULES;delete d.keywords[c],delete d.all[c],delete d.custom[c];for(var f=0;f<d.length;f++)for(var h=d[f].rules,g=0;g<h.length;g++)if(h[g].keyword==c){h.splice(g,1);break}return this}function l(c,d){l.errors=null;var f=this._validateKeyword=this._validateKeyword||this.compile(r,!0);if(f(c))return!0;if(l.errors=f.errors,d)throw new Error("custom keyword definition is invalid: "+this.errorsText(f.errors));return!1}return kb}const mW="http://json-schema.org/draft-07/schema#",hW="https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",gW="Meta-schema for $data reference (JSON Schema extension proposal)",vW="object",bW=["$data"],yW={$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},EW=!1,SW={$schema:mW,$id:hW,description:gW,type:vW,required:bW,properties:yW,additionalProperties:EW};var Ib,aO;function xW(){if(aO)return Ib;aO=1;var t=D8(),e=pR(),r=L8(),n=h$(),a=g$(),s=M8(),l=rW(),c=nW(),d=gc();Ib=w,w.prototype.validate=S,w.prototype.compile=T,w.prototype.addSchema=x,w.prototype.addMetaSchema=_,w.prototype.validateSchema=C,w.prototype.getSchema=k,w.prototype.removeSchema=O,w.prototype.addFormat=Y,w.prototype.errorsText=B,w.prototype._addSchema=M,w.prototype._compile=P,w.prototype.compileAsync=aW();var f=pW();w.prototype.addKeyword=f.add,w.prototype.getKeyword=f.get,w.prototype.removeKeyword=f.remove,w.prototype.validateKeyword=f.validate;var h=mR();w.ValidationError=h.Validation,w.MissingRefError=h.MissingRef,w.$dataMetaSchema=c;var g="http://json-schema.org/draft-07/schema",v=["removeAdditional","useDefaults","coerceTypes","strictDefaults"],y=["/properties"];function w(U){if(!(this instanceof w))return new w(U);U=this._opts=d.copy(U)||{},G(this),this._schemas={},this._refs={},this._fragments={},this._formats=s(U.format),this._cache=U.cache||new r,this._loadingSchemas={},this._compilations=[],this.RULES=l(),this._getId=W(U),U.loopRequired=U.loopRequired||1/0,U.errorDataPath=="property"&&(U._errorDataPathProperty=!0),U.serialize===void 0&&(U.serialize=a),this._metaOpts=z(this),U.formats&&Q(this),U.keywords&&j(this),H(this),typeof U.meta=="object"&&this.addMetaSchema(U.meta),U.nullable&&this.addKeyword("nullable",{metaSchema:{type:"boolean"}}),re(this)}function S(U,F){var te;if(typeof U=="string"){if(te=this.getSchema(U),!te)throw new Error('no schema with key or ref "'+U+'"')}else{var fe=this._addSchema(U);te=fe.validate||this._compile(fe)}var V=te(F);return te.$async!==!0&&(this.errors=te.errors),V}function T(U,F){var te=this._addSchema(U,void 0,F);return te.validate||this._compile(te)}function x(U,F,te,fe){if(Array.isArray(U)){for(var V=0;V<U.length;V++)this.addSchema(U[V],void 0,te,fe);return this}var de=this._getId(U);if(de!==void 0&&typeof de!="string")throw new Error("schema id must be string");return F=e.normalizeId(F||de),q(this,F),this._schemas[F]=this._addSchema(U,te,fe,!0),this}function _(U,F,te){return this.addSchema(U,F,te,!0),this}function C(U,F){var te=U.$schema;if(te!==void 0&&typeof te!="string")throw new Error("$schema must be a string");if(te=te||this._opts.defaultMeta||N(this),!te)return this.logger.warn("meta-schema not available"),this.errors=null,!0;var fe=this.validate(te,U);if(!fe&&F){var V="schema is invalid: "+this.errorsText();if(this._opts.validateSchema=="log")this.logger.error(V);else throw new Error(V)}return fe}function N(U){var F=U._opts.meta;return U._opts.defaultMeta=typeof F=="object"?U._getId(F)||F:U.getSchema(g)?g:void 0,U._opts.defaultMeta}function k(U){var F=I(this,U);switch(typeof F){case"object":return F.validate||this._compile(F);case"string":return this.getSchema(F);case"undefined":return A(this,U)}}function A(U,F){var te=e.schema.call(U,{schema:{}},F);if(te){var fe=te.schema,V=te.root,de=te.baseId,le=t.call(U,fe,V,void 0,de);return U._fragments[F]=new n({ref:F,fragment:!0,schema:fe,root:V,baseId:de,validate:le}),le}}function I(U,F){return F=e.normalizeId(F),U._schemas[F]||U._refs[F]||U._fragments[F]}function O(U){if(U instanceof RegExp)return L(this,this._schemas,U),L(this,this._refs,U),this;switch(typeof U){case"undefined":return L(this,this._schemas),L(this,this._refs),this._cache.clear(),this;case"string":var F=I(this,U);return F&&this._cache.del(F.cacheKey),delete this._schemas[U],delete this._refs[U],this;case"object":var te=this._opts.serialize,fe=te?te(U):U;this._cache.del(fe);var V=this._getId(U);V&&(V=e.normalizeId(V),delete this._schemas[V],delete this._refs[V])}return this}function L(U,F,te){for(var fe in F){var V=F[fe];!V.meta&&(!te||te.test(fe))&&(U._cache.del(V.cacheKey),delete F[fe])}}function M(U,F,te,fe){if(typeof U!="object"&&typeof U!="boolean")throw new Error("schema should be object or boolean");var V=this._opts.serialize,de=V?V(U):U,le=this._cache.get(de);if(le)return le;fe=fe||this._opts.addUsedSchema!==!1;var pe=e.normalizeId(this._getId(U));pe&&fe&&q(this,pe);var Re=this._opts.validateSchema!==!1&&!F,Ke;Re&&!(Ke=pe&&pe==e.normalizeId(U.$schema))&&this.validateSchema(U,!0);var je=e.ids.call(this,U),ze=new n({id:pe,schema:U,localRefs:je,cacheKey:de,meta:te});return pe[0]!="#"&&fe&&(this._refs[pe]=ze),this._cache.put(de,ze),Re&&Ke&&this.validateSchema(U,!0),ze}function P(U,F){if(U.compiling)return U.validate=V,V.schema=U.schema,V.errors=null,V.root=F||V,U.schema.$async===!0&&(V.$async=!0),V;U.compiling=!0;var te;U.meta&&(te=this._opts,this._opts=this._metaOpts);var fe;try{fe=t.call(this,U.schema,F,U.localRefs)}catch(de){throw delete U.validate,de}finally{U.compiling=!1,U.meta&&(this._opts=te)}return U.validate=fe,U.refs=fe.refs,U.refVal=fe.refVal,U.root=fe.root,fe;function V(){var de=U.validate,le=de.apply(this,arguments);return V.errors=de.errors,le}}function W(U){switch(U.schemaId){case"auto":return J;case"id":return X;default:return ee}}function X(U){return U.$id&&this.logger.warn("schema $id ignored",U.$id),U.id}function ee(U){return U.id&&this.logger.warn("schema id ignored",U.id),U.$id}function J(U){if(U.$id&&U.id&&U.$id!=U.id)throw new Error("schema $id is different from id");return U.$id||U.id}function B(U,F){if(U=U||this.errors,!U)return"No errors";F=F||{};for(var te=F.separator===void 0?", ":F.separator,fe=F.dataVar===void 0?"data":F.dataVar,V="",de=0;de<U.length;de++){var le=U[de];le&&(V+=fe+le.dataPath+" "+le.message+te)}return V.slice(0,-te.length)}function Y(U,F){return typeof F=="string"&&(F=new RegExp(F)),this._formats[U]=F,this}function H(U){var F;if(U._opts.$data&&(F=SW,U.addMetaSchema(F,F.$id,!0)),U._opts.meta!==!1){var te=b$;U._opts.$data&&(te=c(te,y)),U.addMetaSchema(te,g,!0),U._refs["http://json-schema.org/schema"]=g}}function re(U){var F=U._opts.schemas;if(F)if(Array.isArray(F))U.addSchema(F);else for(var te in F)U.addSchema(F[te],te)}function Q(U){for(var F in U._opts.formats){var te=U._opts.formats[F];U.addFormat(F,te)}}function j(U){for(var F in U._opts.keywords){var te=U._opts.keywords[F];U.addKeyword(F,te)}}function q(U,F){if(U._schemas[F]||U._refs[F])throw new Error('schema with key or id "'+F+'" already exists')}function z(U){for(var F=d.copy(U._opts),te=0;te<v.length;te++)delete F[v[te]];return F}function G(U){var F=U._opts.logger;if(F===!1)U.logger={log:Z,warn:Z,error:Z};else{if(F===void 0&&(F=console),!(typeof F=="object"&&F.log&&F.warn&&F.error))throw new Error("logger must implement log, warn and error methods");U.logger=F}}function Z(){}return Ib}var wW=xW();const _W=hc(wW);class oO extends C8{constructor(e,r){var n;super(r),this._clientInfo=e,this._cachedToolOutputValidators=new Map,this._capabilities=(n=r?.capabilities)!==null&&n!==void 0?n:{},this._ajv=new _W}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=A8(this._capabilities,e)}assertCapability(e,r){var n;if(!(!((n=this._serverCapabilities)===null||n===void 0)&&n[e]))throw new Error(`Server does not support ${e} (required for ${r})`)}async connect(e,r){if(await super.connect(e),e.sessionId===void 0)try{const n=await this.request({method:"initialize",params:{protocolVersion:zm,capabilities:this._capabilities,clientInfo:this._clientInfo}},e$,r);if(n===void 0)throw new Error(`Server sent invalid initialize result: ${n}`);if(!A9.includes(n.protocolVersion))throw new Error(`Server's protocol version is not supported: ${n.protocolVersion}`);this._serverCapabilities=n.capabilities,this._serverVersion=n.serverInfo,e.setProtocolVersion&&e.setProtocolVersion(n.protocolVersion),this._instructions=n.instructions,await this.notification({method:"notifications/initialized"})}catch(n){throw this.close(),n}}getServerCapabilities(){return this._serverCapabilities}getServerVersion(){return this._serverVersion}getInstructions(){return this._instructions}assertCapabilityForMethod(e){var r,n,a,s,l;switch(e){case"logging/setLevel":if(!(!((r=this._serverCapabilities)===null||r===void 0)&&r.logging))throw new Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!(!((n=this._serverCapabilities)===null||n===void 0)&&n.prompts))throw new Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":case"resources/subscribe":case"resources/unsubscribe":if(!(!((a=this._serverCapabilities)===null||a===void 0)&&a.resources))throw new Error(`Server does not support resources (required for ${e})`);if(e==="resources/subscribe"&&!this._serverCapabilities.resources.subscribe)throw new Error(`Server does not support resource subscriptions (required for ${e})`);break;case"tools/call":case"tools/list":if(!(!((s=this._serverCapabilities)===null||s===void 0)&&s.tools))throw new Error(`Server does not support tools (required for ${e})`);break;case"completion/complete":if(!(!((l=this._serverCapabilities)===null||l===void 0)&&l.completions))throw new Error(`Server does not support completions (required for ${e})`);break}}assertNotificationCapability(e){var r;switch(e){case"notifications/roots/list_changed":if(!(!((r=this._capabilities.roots)===null||r===void 0)&&r.listChanged))throw new Error(`Client does not support roots list changed notifications (required for ${e})`);break}}assertRequestHandlerCapability(e){switch(e){case"sampling/createMessage":if(!this._capabilities.sampling)throw new Error(`Client does not support sampling capability (required for ${e})`);break;case"elicitation/create":if(!this._capabilities.elicitation)throw new Error(`Client does not support elicitation capability (required for ${e})`);break;case"roots/list":if(!this._capabilities.roots)throw new Error(`Client does not support roots capability (required for ${e})`);break}}async ping(e){return this.request({method:"ping"},Il,e)}async complete(e,r){return this.request({method:"completion/complete",params:e},m$,r)}async setLoggingLevel(e,r){return this.request({method:"logging/setLevel",params:{level:e}},Il,r)}async getPrompt(e,r){return this.request({method:"prompts/get",params:e},d$,r)}async listPrompts(e,r){return this.request({method:"prompts/list",params:e},c$,r)}async listResources(e,r){return this.request({method:"resources/list",params:e},i$,r)}async listResourceTemplates(e,r){return this.request({method:"resources/templates/list",params:e},s$,r)}async readResource(e,r){return this.request({method:"resources/read",params:e},l$,r)}async subscribeResource(e,r){return this.request({method:"resources/subscribe",params:e},Il,r)}async unsubscribeResource(e,r){return this.request({method:"resources/unsubscribe",params:e},Il,r)}async callTool(e,r=dR,n){const a=await this.request({method:"tools/call",params:e},r,n),s=this.getToolOutputValidator(e.name);if(s){if(!a.structuredContent&&!a.isError)throw new wi(La.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`);if(a.structuredContent)try{if(!s(a.structuredContent))throw new wi(La.InvalidParams,`Structured content does not match the tool's output schema: ${this._ajv.errorsText(s.errors)}`)}catch(l){throw l instanceof wi?l:new wi(La.InvalidParams,`Failed to validate structured content: ${l instanceof Error?l.message:String(l)}`)}}return a}cacheToolOutputSchemas(e){this._cachedToolOutputValidators.clear();for(const r of e)if(r.outputSchema)try{const n=this._ajv.compile(r.outputSchema);this._cachedToolOutputValidators.set(r.name,n)}catch{}}getToolOutputValidator(e){return this._cachedToolOutputValidators.get(e)}async listTools(e,r){const n=await this.request({method:"tools/list",params:e},f$,r);return this.cacheToolOutputSchemas(n.tools),n}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}}let hR;hR=globalThis.crypto;async function TW(t){return(await hR).getRandomValues(new Uint8Array(t))}async function RW(t){const e="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~";let r="";const n=await TW(t);for(let a=0;a<t;a++){const s=n[a]%e.length;r+=e[s]}return r}async function CW(t){return await RW(t)}async function AW(t){const e=await(await hR).subtle.digest("SHA-256",new TextEncoder().encode(t));return btoa(String.fromCharCode(...new Uint8Array(e))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}async function NW(t){if(t||(t=43),t<43||t>128)throw`Expected a length between 43 and 128. Received ${t}.`;const e=await CW(t),r=await AW(e);return{code_verifier:e,code_challenge:r}}const Fr=be().url().superRefine((t,e)=>{if(!URL.canParse(t))return e.addIssue({code:Ie.custom,message:"URL must be parseable",fatal:!0}),C9}).refine(t=>{const e=new URL(t);return e.protocol!=="javascript:"&&e.protocol!=="data:"&&e.protocol!=="vbscript:"},{message:"URL cannot use javascript:, data:, or vbscript: scheme"}),kW=Pe({resource:be().url(),authorization_servers:Ze(Fr).optional(),jwks_uri:be().url().optional(),scopes_supported:Ze(be()).optional(),bearer_methods_supported:Ze(be()).optional(),resource_signing_alg_values_supported:Ze(be()).optional(),resource_name:be().optional(),resource_documentation:be().optional(),resource_policy_uri:be().url().optional(),resource_tos_uri:be().url().optional(),tls_client_certificate_bound_access_tokens:Pr().optional(),authorization_details_types_supported:Ze(be()).optional(),dpop_signing_alg_values_supported:Ze(be()).optional(),dpop_bound_access_tokens_required:Pr().optional()}).passthrough(),y$=Pe({issuer:be(),authorization_endpoint:Fr,token_endpoint:Fr,registration_endpoint:Fr.optional(),scopes_supported:Ze(be()).optional(),response_types_supported:Ze(be()),response_modes_supported:Ze(be()).optional(),grant_types_supported:Ze(be()).optional(),token_endpoint_auth_methods_supported:Ze(be()).optional(),token_endpoint_auth_signing_alg_values_supported:Ze(be()).optional(),service_documentation:Fr.optional(),revocation_endpoint:Fr.optional(),revocation_endpoint_auth_methods_supported:Ze(be()).optional(),revocation_endpoint_auth_signing_alg_values_supported:Ze(be()).optional(),introspection_endpoint:be().optional(),introspection_endpoint_auth_methods_supported:Ze(be()).optional(),introspection_endpoint_auth_signing_alg_values_supported:Ze(be()).optional(),code_challenge_methods_supported:Ze(be()).optional()}).passthrough(),IW=Pe({issuer:be(),authorization_endpoint:Fr,token_endpoint:Fr,userinfo_endpoint:Fr.optional(),jwks_uri:Fr,registration_endpoint:Fr.optional(),scopes_supported:Ze(be()).optional(),response_types_supported:Ze(be()),response_modes_supported:Ze(be()).optional(),grant_types_supported:Ze(be()).optional(),acr_values_supported:Ze(be()).optional(),subject_types_supported:Ze(be()),id_token_signing_alg_values_supported:Ze(be()),id_token_encryption_alg_values_supported:Ze(be()).optional(),id_token_encryption_enc_values_supported:Ze(be()).optional(),userinfo_signing_alg_values_supported:Ze(be()).optional(),userinfo_encryption_alg_values_supported:Ze(be()).optional(),userinfo_encryption_enc_values_supported:Ze(be()).optional(),request_object_signing_alg_values_supported:Ze(be()).optional(),request_object_encryption_alg_values_supported:Ze(be()).optional(),request_object_encryption_enc_values_supported:Ze(be()).optional(),token_endpoint_auth_methods_supported:Ze(be()).optional(),token_endpoint_auth_signing_alg_values_supported:Ze(be()).optional(),display_values_supported:Ze(be()).optional(),claim_types_supported:Ze(be()).optional(),claims_supported:Ze(be()).optional(),service_documentation:be().optional(),claims_locales_supported:Ze(be()).optional(),ui_locales_supported:Ze(be()).optional(),claims_parameter_supported:Pr().optional(),request_parameter_supported:Pr().optional(),request_uri_parameter_supported:Pr().optional(),require_request_uri_registration:Pr().optional(),op_policy_uri:Fr.optional(),op_tos_uri:Fr.optional()}).passthrough(),OW=IW.merge(y$.pick({code_challenge_methods_supported:!0})),E$=Pe({access_token:be(),id_token:be().optional(),token_type:be(),expires_in:$r().optional(),scope:be().optional(),refresh_token:be().optional()}).strip(),DW=Pe({error:be(),error_description:be().optional(),error_uri:be().optional()}),LW=Pe({redirect_uris:Ze(Fr),token_endpoint_auth_method:be().optional(),grant_types:Ze(be()).optional(),response_types:Ze(be()).optional(),client_name:be().optional(),client_uri:Fr.optional(),logo_uri:Fr.optional(),scope:be().optional(),contacts:Ze(be()).optional(),tos_uri:Fr.optional(),policy_uri:be().optional(),jwks_uri:Fr.optional(),jwks:T9().optional(),software_id:be().optional(),software_version:be().optional(),software_statement:be().optional()}).strip(),MW=Pe({client_id:be(),client_secret:be().optional(),client_id_issued_at:$r().optional(),client_secret_expires_at:$r().optional()}).strip(),PW=LW.merge(MW);Pe({error:be(),error_description:be().optional()}).strip();Pe({token:be(),token_type_hint:be().optional()}).strip();function jW(t){const e=typeof t=="string"?new URL(t):new URL(t.href);return e.hash="",e}function UW({requestedResource:t,configuredResource:e}){const r=typeof t=="string"?new URL(t):new URL(t.href),n=typeof e=="string"?new URL(e):new URL(e.href);if(r.origin!==n.origin||r.pathname.length<n.pathname.length)return!1;const a=r.pathname.endsWith("/")?r.pathname:r.pathname+"/",s=n.pathname.endsWith("/")?n.pathname:n.pathname+"/";return a.startsWith(s)}class Qr extends Error{constructor(e,r){super(e),this.errorUri=r,this.name=this.constructor.name}toResponseObject(){const e={error:this.errorCode,error_description:this.message};return this.errorUri&&(e.error_uri=this.errorUri),e}get errorCode(){return this.constructor.errorCode}}class A_ extends Qr{}A_.errorCode="invalid_request";class gm extends Qr{}gm.errorCode="invalid_client";class vm extends Qr{}vm.errorCode="invalid_grant";class bm extends Qr{}bm.errorCode="unauthorized_client";class N_ extends Qr{}N_.errorCode="unsupported_grant_type";class k_ extends Qr{}k_.errorCode="invalid_scope";class I_ extends Qr{}I_.errorCode="access_denied";class sc extends Qr{}sc.errorCode="server_error";class O_ extends Qr{}O_.errorCode="temporarily_unavailable";class D_ extends Qr{}D_.errorCode="unsupported_response_type";class L_ extends Qr{}L_.errorCode="unsupported_token_type";class M_ extends Qr{}M_.errorCode="invalid_token";class P_ extends Qr{}P_.errorCode="method_not_allowed";class j_ extends Qr{}j_.errorCode="too_many_requests";class U_ extends Qr{}U_.errorCode="invalid_client_metadata";class F_ extends Qr{}F_.errorCode="insufficient_scope";const FW={[A_.errorCode]:A_,[gm.errorCode]:gm,[vm.errorCode]:vm,[bm.errorCode]:bm,[N_.errorCode]:N_,[k_.errorCode]:k_,[I_.errorCode]:I_,[sc.errorCode]:sc,[O_.errorCode]:O_,[D_.errorCode]:D_,[L_.errorCode]:L_,[M_.errorCode]:M_,[P_.errorCode]:P_,[j_.errorCode]:j_,[U_.errorCode]:U_,[F_.errorCode]:F_};class Ma extends Error{constructor(e){super(e??"Unauthorized")}}const Ob="code",Db="S256";function S$(t,e){const r=t.client_secret!==void 0;return e.length===0?r?"client_secret_post":"none":r&&e.includes("client_secret_basic")?"client_secret_basic":r&&e.includes("client_secret_post")?"client_secret_post":e.includes("none")?"none":r?"client_secret_post":"none"}function x$(t,e,r,n){const{client_id:a,client_secret:s}=e;switch(t){case"client_secret_basic":zW(a,s,r);return;case"client_secret_post":$W(a,s,n);return;case"none":BW(a,n);return;default:throw new Error(`Unsupported client authentication method: ${t}`)}}function zW(t,e,r){if(!e)throw new Error("client_secret_basic authentication requires a client_secret");const n=btoa(`${t}:${e}`);r.set("Authorization",`Basic ${n}`)}function $W(t,e,r){r.set("client_id",t),e&&r.set("client_secret",e)}function BW(t,e){e.set("client_id",t)}async function gR(t){const e=t instanceof Response?t.status:void 0,r=t instanceof Response?await t.text():t;try{const n=DW.parse(JSON.parse(r)),{error:a,error_description:s,error_uri:l}=n,c=FW[a]||sc;return new c(s||"",l)}catch(n){const a=`${e?`HTTP ${e}: `:""}Invalid OAuth error response: ${n}. Raw body: ${r}`;return new sc(a)}}async function gs(t,e){var r,n;try{return await Lb(t,e)}catch(a){if(a instanceof gm||a instanceof bm)return await((r=t.invalidateCredentials)===null||r===void 0?void 0:r.call(t,"all")),await Lb(t,e);if(a instanceof vm)return await((n=t.invalidateCredentials)===null||n===void 0?void 0:n.call(t,"tokens")),await Lb(t,e);throw a}}async function Lb(t,{serverUrl:e,authorizationCode:r,scope:n,resourceMetadataUrl:a,fetchFn:s}){let l,c;try{l=await HW(e,{resourceMetadataUrl:a},s),l.authorization_servers&&l.authorization_servers.length>0&&(c=l.authorization_servers[0])}catch{}c||(c=e);const d=await qW(e,t,l),f=await KW(c,{fetchFn:s});let h=await Promise.resolve(t.clientInformation());if(!h){if(r!==void 0)throw new Error("Existing OAuth client information is required when exchanging an authorization code");if(!t.saveClientInformation)throw new Error("OAuth client information must be saveable for dynamic registration");const S=await JW(c,{metadata:f,clientMetadata:t.clientMetadata,fetchFn:s});await t.saveClientInformation(S),h=S}if(r!==void 0){const S=await t.codeVerifier(),T=await XW(c,{metadata:f,clientInformation:h,authorizationCode:r,codeVerifier:S,redirectUri:t.redirectUrl,resource:d,addClientAuthentication:t.addClientAuthentication,fetchFn:s});return await t.saveTokens(T),"AUTHORIZED"}const g=await t.tokens();if(g?.refresh_token)try{const S=await QW(c,{metadata:f,clientInformation:h,refreshToken:g.refresh_token,resource:d,addClientAuthentication:t.addClientAuthentication,fetchFn:s});return await t.saveTokens(S),"AUTHORIZED"}catch(S){if(!(!(S instanceof Qr)||S instanceof sc))throw S}const v=t.state?await t.state():void 0,{authorizationUrl:y,codeVerifier:w}=await ZW(c,{metadata:f,clientInformation:h,state:v,redirectUrl:t.redirectUrl,scope:n||t.clientMetadata.scope,resource:d});return await t.saveCodeVerifier(w),await t.redirectToAuthorization(y),"REDIRECT"}async function qW(t,e,r){const n=jW(t);if(e.validateResourceURL)return await e.validateResourceURL(n,r?.resource);if(r){if(!UW({requestedResource:n,configuredResource:r.resource}))throw new Error(`Protected resource ${r.resource} does not match expected ${n} (or origin)`);return new URL(r.resource)}}function z_(t){const e=t.headers.get("WWW-Authenticate");if(!e)return;const[r,n]=e.split(" ");if(r.toLowerCase()!=="bearer"||!n)return;const s=/resource_metadata="([^"]*)"/.exec(e);if(s)try{return new URL(s[1])}catch{return}}async function HW(t,e,r=fetch){const n=await WW(t,"oauth-protected-resource",r,{protocolVersion:e?.protocolVersion,metadataUrl:e?.resourceMetadataUrl});if(!n||n.status===404)throw new Error("Resource server does not implement OAuth 2.0 Protected Resource Metadata.");if(!n.ok)throw new Error(`HTTP ${n.status} trying to load well-known OAuth protected resource metadata.`);return kW.parse(await n.json())}async function vR(t,e,r=fetch){try{return await r(t,{headers:e})}catch(n){if(n instanceof TypeError)return e?vR(t,void 0,r):void 0;throw n}}function VW(t,e="",r={}){return e.endsWith("/")&&(e=e.slice(0,-1)),r.prependPathname?`${e}/.well-known/${t}`:`/.well-known/${t}${e}`}async function iO(t,e,r=fetch){return await vR(t,{"MCP-Protocol-Version":e},r)}function GW(t,e){return!t||t.status>=400&&t.status<500&&e!=="/"}async function WW(t,e,r,n){var a,s;const l=new URL(t),c=(a=n?.protocolVersion)!==null&&a!==void 0?a:zm;let d;if(n?.metadataUrl)d=new URL(n.metadataUrl);else{const h=VW(e,l.pathname);d=new URL(h,(s=n?.metadataServerUrl)!==null&&s!==void 0?s:l),d.search=l.search}let f=await iO(d,c,r);if(!n?.metadataUrl&&GW(f,l.pathname)){const h=new URL(`/.well-known/${e}`,l);f=await iO(h,c,r)}return f}function YW(t){const e=typeof t=="string"?new URL(t):t,r=e.pathname!=="/",n=[];if(!r)return n.push({url:new URL("/.well-known/oauth-authorization-server",e.origin),type:"oauth"}),n.push({url:new URL("/.well-known/openid-configuration",e.origin),type:"oidc"}),n;let a=e.pathname;return a.endsWith("/")&&(a=a.slice(0,-1)),n.push({url:new URL(`/.well-known/oauth-authorization-server${a}`,e.origin),type:"oauth"}),n.push({url:new URL("/.well-known/oauth-authorization-server",e.origin),type:"oauth"}),n.push({url:new URL(`/.well-known/openid-configuration${a}`,e.origin),type:"oidc"}),n.push({url:new URL(`${a}/.well-known/openid-configuration`,e.origin),type:"oidc"}),n}async function KW(t,{fetchFn:e=fetch,protocolVersion:r=zm}={}){const n={"MCP-Protocol-Version":r},a=YW(t);for(const{url:s,type:l}of a){const c=await vR(s,n,e);if(c){if(!c.ok){if(c.status>=400&&c.status<500)continue;throw new Error(`HTTP ${c.status} trying to load ${l==="oauth"?"OAuth":"OpenID provider"} metadata from ${s}`)}return l==="oauth"?y$.parse(await c.json()):OW.parse(await c.json())}}}async function ZW(t,{metadata:e,clientInformation:r,redirectUrl:n,scope:a,state:s,resource:l}){let c;if(e){if(c=new URL(e.authorization_endpoint),!e.response_types_supported.includes(Ob))throw new Error(`Incompatible auth server: does not support response type ${Ob}`);if(e.code_challenge_methods_supported&&!e.code_challenge_methods_supported.includes(Db))throw new Error(`Incompatible auth server: does not support code challenge method ${Db}`)}else c=new URL("/authorize",t);const d=await NW(),f=d.code_verifier,h=d.code_challenge;return c.searchParams.set("response_type",Ob),c.searchParams.set("client_id",r.client_id),c.searchParams.set("code_challenge",h),c.searchParams.set("code_challenge_method",Db),c.searchParams.set("redirect_uri",String(n)),s&&c.searchParams.set("state",s),a&&c.searchParams.set("scope",a),a?.includes("offline_access")&&c.searchParams.append("prompt","consent"),l&&c.searchParams.set("resource",l.href),{authorizationUrl:c,codeVerifier:f}}async function XW(t,{metadata:e,clientInformation:r,authorizationCode:n,codeVerifier:a,redirectUri:s,resource:l,addClientAuthentication:c,fetchFn:d}){var f;const h="authorization_code",g=e?.token_endpoint?new URL(e.token_endpoint):new URL("/token",t);if(e?.grant_types_supported&&!e.grant_types_supported.includes(h))throw new Error(`Incompatible auth server: does not support grant type ${h}`);const v=new Headers({"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"}),y=new URLSearchParams({grant_type:h,code:n,code_verifier:a,redirect_uri:String(s)});if(c)c(v,y,t,e);else{const S=(f=e?.token_endpoint_auth_methods_supported)!==null&&f!==void 0?f:[],T=S$(r,S);x$(T,r,v,y)}l&&y.set("resource",l.href);const w=await(d??fetch)(g,{method:"POST",headers:v,body:y});if(!w.ok)throw await gR(w);return E$.parse(await w.json())}async function QW(t,{metadata:e,clientInformation:r,refreshToken:n,resource:a,addClientAuthentication:s,fetchFn:l}){var c;const d="refresh_token";let f;if(e){if(f=new URL(e.token_endpoint),e.grant_types_supported&&!e.grant_types_supported.includes(d))throw new Error(`Incompatible auth server: does not support grant type ${d}`)}else f=new URL("/token",t);const h=new Headers({"Content-Type":"application/x-www-form-urlencoded"}),g=new URLSearchParams({grant_type:d,refresh_token:n});if(s)s(h,g,t,e);else{const y=(c=e?.token_endpoint_auth_methods_supported)!==null&&c!==void 0?c:[],w=S$(r,y);x$(w,r,h,g)}a&&g.set("resource",a.href);const v=await(l??fetch)(f,{method:"POST",headers:h,body:g});if(!v.ok)throw await gR(v);return E$.parse({refresh_token:n,...await v.json()})}async function JW(t,{metadata:e,clientMetadata:r,fetchFn:n}){let a;if(e){if(!e.registration_endpoint)throw new Error("Incompatible auth server: does not support dynamic client registration");a=new URL(e.registration_endpoint)}else a=new URL("/register",t);const s=await(n??fetch)(a,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});if(!s.ok)throw await gR(s);return PW.parse(await s.json())}class sO extends Error{constructor(e,r){super(e),this.name="ParseError",this.type=r.type,this.field=r.field,this.value=r.value,this.line=r.line}}function Mb(t){}function w$(t){if(typeof t=="function")throw new TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");const{onEvent:e=Mb,onError:r=Mb,onRetry:n=Mb,onComment:a}=t;let s="",l=!0,c,d="",f="";function h(S){const T=l?S.replace(/^\xEF\xBB\xBF/,""):S,[x,_]=e7(`${s}${T}`);for(const C of x)g(C);s=_,l=!1}function g(S){if(S===""){y();return}if(S.startsWith(":")){a&&a(S.slice(S.startsWith(": ")?2:1));return}const T=S.indexOf(":");if(T!==-1){const x=S.slice(0,T),_=S[T+1]===" "?2:1,C=S.slice(T+_);v(x,C,S);return}v(S,"",S)}function v(S,T,x){switch(S){case"event":f=T;break;case"data":d=`${d}${T}
|
|
3
3
|
`;break;case"id":c=T.includes("\0")?void 0:T;break;case"retry":/^\d+$/.test(T)?n(parseInt(T,10)):r(new sO(`Invalid \`retry\` value: "${T}"`,{type:"invalid-retry",value:T,line:x}));break;default:r(new sO(`Unknown field "${S.length>20?`${S.slice(0,20)}…`:S}"`,{type:"unknown-field",field:S,value:T,line:x}));break}}function y(){d.length>0&&e({id:c,event:f||void 0,data:d.endsWith(`
|
|
4
4
|
`)?d.slice(0,-1):d}),c=void 0,d="",f=""}function w(S={}){s&&S.consume&&g(s),l=!0,c=void 0,d="",f="",s=""}return{feed:h,reset:w}}function e7(t){const e=[];let r="",n=0;for(;n<t.length;){const a=t.indexOf("\r",n),s=t.indexOf(`
|
|
5
5
|
`,n);let l=-1;if(a!==-1&&s!==-1?l=Math.min(a,s):a!==-1?a===t.length-1?l=-1:l=a:s!==-1&&(l=s),l===-1){r=t.slice(n);break}else{const c=t.slice(n,l);e.push(c),n=l+1,t[n-1]==="\r"&&t[n]===`
|
|
6
|
-
`&&n++}}return[e,r]}class t7 extends TransformStream{constructor({onError:e,onRetry:r,onComment:n}={}){let a;super({start(s){a=x$({onEvent:l=>{s.enqueue(l)},onError(l){e==="terminate"?s.error(l):typeof e=="function"&&e(l)},onRetry:r,onComment:n})},transform(s){a.feed(s)}})}}const r7={initialReconnectionDelay:1e3,maxReconnectionDelay:3e4,reconnectionDelayGrowFactor:1.5,maxRetries:2};class Nu extends Error{constructor(e,r){super(`Streamable HTTP error: ${r}`),this.code=e}}class n7{constructor(e,r){var n;this._hasCompletedAuthFlow=!1,this._url=e,this._resourceMetadataUrl=void 0,this._requestInit=r?.requestInit,this._authProvider=r?.authProvider,this._fetch=r?.fetch,this._sessionId=r?.sessionId,this._reconnectionOptions=(n=r?.reconnectionOptions)!==null&&n!==void 0?n:r7}async _authThenStart(){var e;if(!this._authProvider)throw new Ma("No auth provider");let r;try{r=await gs(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})}catch(n){throw(e=this.onerror)===null||e===void 0||e.call(this,n),n}if(r!=="AUTHORIZED")throw new Ma;return await this._startOrAuthSse({resumptionToken:void 0})}async _commonHeaders(){var e;const r={};if(this._authProvider){const a=await this._authProvider.tokens();a&&(r.Authorization=`Bearer ${a.access_token}`)}this._sessionId&&(r["mcp-session-id"]=this._sessionId),this._protocolVersion&&(r["mcp-protocol-version"]=this._protocolVersion);const n=this._normalizeHeaders((e=this._requestInit)===null||e===void 0?void 0:e.headers);return new Headers({...r,...n})}async _startOrAuthSse(e){var r,n,a;const{resumptionToken:s}=e;try{const l=await this._commonHeaders();l.set("Accept","text/event-stream"),s&&l.set("last-event-id",s);const c=await((r=this._fetch)!==null&&r!==void 0?r:fetch)(this._url,{method:"GET",headers:l,signal:(n=this._abortController)===null||n===void 0?void 0:n.signal});if(!c.ok){if(c.status===401&&this._authProvider)return await this._authThenStart();if(c.status===405)return;throw new Nu(c.status,`Failed to open SSE stream: ${c.statusText}`)}this._handleSseStream(c.body,e,!0)}catch(l){throw(a=this.onerror)===null||a===void 0||a.call(this,l),l}}_getNextReconnectionDelay(e){const r=this._reconnectionOptions.initialReconnectionDelay,n=this._reconnectionOptions.reconnectionDelayGrowFactor,a=this._reconnectionOptions.maxReconnectionDelay;return Math.min(r*Math.pow(n,e),a)}_normalizeHeaders(e){return e?e instanceof Headers?Object.fromEntries(e.entries()):Array.isArray(e)?Object.fromEntries(e):{...e}:{}}_scheduleReconnection(e,r=0){var n;const a=this._reconnectionOptions.maxRetries;if(a>0&&r>=a){(n=this.onerror)===null||n===void 0||n.call(this,new Error(`Maximum reconnection attempts (${a}) exceeded.`));return}const s=this._getNextReconnectionDelay(r);setTimeout(()=>{this._startOrAuthSse(e).catch(l=>{var c;(c=this.onerror)===null||c===void 0||c.call(this,new Error(`Failed to reconnect SSE stream: ${l instanceof Error?l.message:String(l)}`)),this._scheduleReconnection(e,r+1)})},s)}_handleSseStream(e,r,n){if(!e)return;const{onresumptiontoken:a,replayMessageId:s}=r;let l;(async()=>{var d,f,h,g;try{const v=e.pipeThrough(new TextDecoderStream).pipeThrough(new t7).getReader();for(;;){const{value:y,done:w}=await v.read();if(w)break;if(y.id&&(l=y.id,a?.(y.id)),!y.event||y.event==="message")try{const S=zp.parse(JSON.parse(y.data));s!==void 0&&C_(S)&&(S.id=s),(d=this.onmessage)===null||d===void 0||d.call(this,S)}catch(S){(f=this.onerror)===null||f===void 0||f.call(this,S)}}}catch(v){if((h=this.onerror)===null||h===void 0||h.call(this,new Error(`SSE stream disconnected: ${v}`)),n&&this._abortController&&!this._abortController.signal.aborted)try{this._scheduleReconnection({resumptionToken:l,onresumptiontoken:a,replayMessageId:s},0)}catch(y){(g=this.onerror)===null||g===void 0||g.call(this,new Error(`Failed to reconnect: ${y instanceof Error?y.message:String(y)}`))}}})()}async start(){if(this._abortController)throw new Error("StreamableHTTPClientTransport already started! If using Client class, note that connect() calls start() automatically.");this._abortController=new AbortController}async finishAuth(e){if(!this._authProvider)throw new Ma("No auth provider");if(await gs(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})!=="AUTHORIZED")throw new Ma("Failed to authorize")}async close(){var e,r;(e=this._abortController)===null||e===void 0||e.abort(),(r=this.onclose)===null||r===void 0||r.call(this)}async send(e,r){var n,a,s,l;try{const{resumptionToken:c,onresumptiontoken:d}=r||{};if(c){this._startOrAuthSse({resumptionToken:c,replayMessageId:Yz(e)?e.id:void 0}).catch(T=>{var x;return(x=this.onerror)===null||x===void 0?void 0:x.call(this,T)});return}const f=await this._commonHeaders();f.set("content-type","application/json"),f.set("accept","application/json, text/event-stream");const h={...this._requestInit,method:"POST",headers:f,body:JSON.stringify(e),signal:(n=this._abortController)===null||n===void 0?void 0:n.signal},g=await((a=this._fetch)!==null&&a!==void 0?a:fetch)(this._url,h),v=g.headers.get("mcp-session-id");if(v&&(this._sessionId=v),!g.ok){if(g.status===401&&this._authProvider){if(this._hasCompletedAuthFlow)throw new Nu(401,"Server returned 401 after successful authentication");if(this._resourceMetadataUrl=z_(g),await gs(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})!=="AUTHORIZED")throw new Ma;return this._hasCompletedAuthFlow=!0,this.send(e)}const T=await g.text().catch(()=>null);throw new Error(`Error POSTing to endpoint (HTTP ${g.status}): ${T}`)}if(this._hasCompletedAuthFlow=!1,g.status===202){P9(e)&&this._startOrAuthSse({resumptionToken:void 0}).catch(T=>{var x;return(x=this.onerror)===null||x===void 0?void 0:x.call(this,T)});return}const w=(Array.isArray(e)?e:[e]).filter(T=>"method"in T&&"id"in T&&T.id!==void 0).length>0,S=g.headers.get("content-type");if(w)if(S?.includes("text/event-stream"))this._handleSseStream(g.body,{onresumptiontoken:d},!1);else if(S?.includes("application/json")){const T=await g.json(),x=Array.isArray(T)?T.map(_=>zp.parse(_)):[zp.parse(T)];for(const _ of x)(s=this.onmessage)===null||s===void 0||s.call(this,_)}else throw new Nu(-1,`Unexpected content type: ${S}`)}catch(c){throw(l=this.onerror)===null||l===void 0||l.call(this,c),c}}get sessionId(){return this._sessionId}async terminateSession(){var e,r,n;if(this._sessionId)try{const a=await this._commonHeaders(),s={...this._requestInit,method:"DELETE",headers:a,signal:(e=this._abortController)===null||e===void 0?void 0:e.signal},l=await((r=this._fetch)!==null&&r!==void 0?r:fetch)(this._url,s);if(!l.ok&&l.status!==405)throw new Nu(l.status,`Failed to terminate session: ${l.statusText}`);this._sessionId=void 0}catch(a){throw(n=this.onerror)===null||n===void 0||n.call(this,a),a}}setProtocolVersion(e){this._protocolVersion=e}get protocolVersion(){return this._protocolVersion}}class lO extends Event{constructor(e,r){var n,a;super(e),this.code=(n=r?.code)!=null?n:void 0,this.message=(a=r?.message)!=null?a:void 0}[Symbol.for("nodejs.util.inspect.custom")](e,r,n){return n(cO(this),r)}[Symbol.for("Deno.customInspect")](e,r){return e(cO(this),r)}}function a7(t){const e=globalThis.DOMException;return typeof e=="function"?new e(t,"SyntaxError"):new SyntaxError(t)}function $_(t){return t instanceof Error?"errors"in t&&Array.isArray(t.errors)?t.errors.map($_).join(", "):"cause"in t&&t.cause instanceof Error?`${t}: ${$_(t.cause)}`:t.message:`${t}`}function cO(t){return{type:t.type,message:t.message,code:t.code,defaultPrevented:t.defaultPrevented,cancelable:t.cancelable,timeStamp:t.timeStamp}}var w$=t=>{throw TypeError(t)},bR=(t,e,r)=>e.has(t)||w$("Cannot "+r),wt=(t,e,r)=>(bR(t,e,"read from private field"),r?r.call(t):e.get(t)),Dr=(t,e,r)=>e.has(t)?w$("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),rr=(t,e,r,n)=>(bR(t,e,"write to private field"),e.set(t,r),r),wo=(t,e,r)=>(bR(t,e,"access private method"),r),xn,cs,xl,$p,ym,Bu,Ol,qu,Ei,wl,$l,_l,ku,va,B_,q_,H_,uO,V_,G_,Iu,W_,Y_;class Bp extends EventTarget{constructor(e,r){var n,a;super(),Dr(this,va),this.CONNECTING=0,this.OPEN=1,this.CLOSED=2,Dr(this,xn),Dr(this,cs),Dr(this,xl),Dr(this,$p),Dr(this,ym),Dr(this,Bu),Dr(this,Ol),Dr(this,qu,null),Dr(this,Ei),Dr(this,wl),Dr(this,$l,null),Dr(this,_l,null),Dr(this,ku,null),Dr(this,q_,async s=>{var l;wt(this,wl).reset();const{body:c,redirected:d,status:f,headers:h}=s;if(f===204){wo(this,va,Iu).call(this,"Server sent HTTP 204, not reconnecting",204),this.close();return}if(d?rr(this,xl,new URL(s.url)):rr(this,xl,void 0),f!==200){wo(this,va,Iu).call(this,`Non-200 status code (${f})`,f);return}if(!(h.get("content-type")||"").startsWith("text/event-stream")){wo(this,va,Iu).call(this,'Invalid content type, expected "text/event-stream"',f);return}if(wt(this,xn)===this.CLOSED)return;rr(this,xn,this.OPEN);const g=new Event("open");if((l=wt(this,ku))==null||l.call(this,g),this.dispatchEvent(g),typeof c!="object"||!c||!("getReader"in c)){wo(this,va,Iu).call(this,"Invalid response body, expected a web ReadableStream",f),this.close();return}const v=new TextDecoder,y=c.getReader();let w=!0;do{const{done:S,value:T}=await y.read();T&&wt(this,wl).feed(v.decode(T,{stream:!S})),S&&(w=!1,wt(this,wl).reset(),wo(this,va,W_).call(this))}while(w)}),Dr(this,H_,s=>{rr(this,Ei,void 0),!(s.name==="AbortError"||s.type==="aborted")&&wo(this,va,W_).call(this,$_(s))}),Dr(this,V_,s=>{typeof s.id=="string"&&rr(this,qu,s.id);const l=new MessageEvent(s.event||"message",{data:s.data,origin:wt(this,xl)?wt(this,xl).origin:wt(this,cs).origin,lastEventId:s.id||""});wt(this,_l)&&(!s.event||s.event==="message")&&wt(this,_l).call(this,l),this.dispatchEvent(l)}),Dr(this,G_,s=>{rr(this,Bu,s)}),Dr(this,Y_,()=>{rr(this,Ol,void 0),wt(this,xn)===this.CONNECTING&&wo(this,va,B_).call(this)});try{if(e instanceof URL)rr(this,cs,e);else if(typeof e=="string")rr(this,cs,new URL(e,o7()));else throw new Error("Invalid URL")}catch{throw a7("An invalid or illegal string was specified")}rr(this,wl,x$({onEvent:wt(this,V_),onRetry:wt(this,G_)})),rr(this,xn,this.CONNECTING),rr(this,Bu,3e3),rr(this,ym,(n=r?.fetch)!=null?n:globalThis.fetch),rr(this,$p,(a=r?.withCredentials)!=null?a:!1),wo(this,va,B_).call(this)}get readyState(){return wt(this,xn)}get url(){return wt(this,cs).href}get withCredentials(){return wt(this,$p)}get onerror(){return wt(this,$l)}set onerror(e){rr(this,$l,e)}get onmessage(){return wt(this,_l)}set onmessage(e){rr(this,_l,e)}get onopen(){return wt(this,ku)}set onopen(e){rr(this,ku,e)}addEventListener(e,r,n){const a=r;super.addEventListener(e,a,n)}removeEventListener(e,r,n){const a=r;super.removeEventListener(e,a,n)}close(){wt(this,Ol)&&clearTimeout(wt(this,Ol)),wt(this,xn)!==this.CLOSED&&(wt(this,Ei)&&wt(this,Ei).abort(),rr(this,xn,this.CLOSED),rr(this,Ei,void 0))}}xn=new WeakMap,cs=new WeakMap,xl=new WeakMap,$p=new WeakMap,ym=new WeakMap,Bu=new WeakMap,Ol=new WeakMap,qu=new WeakMap,Ei=new WeakMap,wl=new WeakMap,$l=new WeakMap,_l=new WeakMap,ku=new WeakMap,va=new WeakSet,B_=function(){rr(this,xn,this.CONNECTING),rr(this,Ei,new AbortController),wt(this,ym)(wt(this,cs),wo(this,va,uO).call(this)).then(wt(this,q_)).catch(wt(this,H_))},q_=new WeakMap,H_=new WeakMap,uO=function(){var t;const e={mode:"cors",redirect:"follow",headers:{Accept:"text/event-stream",...wt(this,qu)?{"Last-Event-ID":wt(this,qu)}:void 0},cache:"no-store",signal:(t=wt(this,Ei))==null?void 0:t.signal};return"window"in globalThis&&(e.credentials=this.withCredentials?"include":"same-origin"),e},V_=new WeakMap,G_=new WeakMap,Iu=function(t,e){var r;wt(this,xn)!==this.CLOSED&&rr(this,xn,this.CLOSED);const n=new lO("error",{code:e,message:t});(r=wt(this,$l))==null||r.call(this,n),this.dispatchEvent(n)},W_=function(t,e){var r;if(wt(this,xn)===this.CLOSED)return;rr(this,xn,this.CONNECTING);const n=new lO("error",{code:e,message:t});(r=wt(this,$l))==null||r.call(this,n),this.dispatchEvent(n),rr(this,Ol,setTimeout(wt(this,Y_),wt(this,Bu)))},Y_=new WeakMap,Bp.CONNECTING=0,Bp.OPEN=1,Bp.CLOSED=2;function o7(){const t="document"in globalThis?globalThis.document:void 0;return t&&typeof t=="object"&&"baseURI"in t&&typeof t.baseURI=="string"?t.baseURI:void 0}class i7 extends Error{constructor(e,r,n){super(`SSE error: ${r}`),this.code=e,this.event=n}}class s7{constructor(e,r){this._url=e,this._resourceMetadataUrl=void 0,this._eventSourceInit=r?.eventSourceInit,this._requestInit=r?.requestInit,this._authProvider=r?.authProvider,this._fetch=r?.fetch}async _authThenStart(){var e;if(!this._authProvider)throw new Ma("No auth provider");let r;try{r=await gs(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})}catch(n){throw(e=this.onerror)===null||e===void 0||e.call(this,n),n}if(r!=="AUTHORIZED")throw new Ma;return await this._startOrAuth()}async _commonHeaders(){var e;const r={};if(this._authProvider){const n=await this._authProvider.tokens();n&&(r.Authorization=`Bearer ${n.access_token}`)}return this._protocolVersion&&(r["mcp-protocol-version"]=this._protocolVersion),new Headers({...r,...(e=this._requestInit)===null||e===void 0?void 0:e.headers})}_startOrAuth(){var e,r,n;const a=(n=(r=(e=this===null||this===void 0?void 0:this._eventSourceInit)===null||e===void 0?void 0:e.fetch)!==null&&r!==void 0?r:this._fetch)!==null&&n!==void 0?n:fetch;return new Promise((s,l)=>{this._eventSource=new Bp(this._url.href,{...this._eventSourceInit,fetch:async(c,d)=>{const f=await this._commonHeaders();f.set("Accept","text/event-stream");const h=await a(c,{...d,headers:f});return h.status===401&&h.headers.has("www-authenticate")&&(this._resourceMetadataUrl=z_(h)),h}}),this._abortController=new AbortController,this._eventSource.onerror=c=>{var d;if(c.code===401&&this._authProvider){this._authThenStart().then(s,l);return}const f=new i7(c.code,c.message,c);l(f),(d=this.onerror)===null||d===void 0||d.call(this,f)},this._eventSource.onopen=()=>{},this._eventSource.addEventListener("endpoint",c=>{var d;const f=c;try{if(this._endpoint=new URL(f.data,this._url),this._endpoint.origin!==this._url.origin)throw new Error(`Endpoint origin does not match connection origin: ${this._endpoint.origin}`)}catch(h){l(h),(d=this.onerror)===null||d===void 0||d.call(this,h),this.close();return}s()}),this._eventSource.onmessage=c=>{var d,f;const h=c;let g;try{g=zp.parse(JSON.parse(h.data))}catch(v){(d=this.onerror)===null||d===void 0||d.call(this,v);return}(f=this.onmessage)===null||f===void 0||f.call(this,g)}})}async start(){if(this._eventSource)throw new Error("SSEClientTransport already started! If using Client class, note that connect() calls start() automatically.");return await this._startOrAuth()}async finishAuth(e){if(!this._authProvider)throw new Ma("No auth provider");if(await gs(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})!=="AUTHORIZED")throw new Ma("Failed to authorize")}async close(){var e,r,n;(e=this._abortController)===null||e===void 0||e.abort(),(r=this._eventSource)===null||r===void 0||r.close(),(n=this.onclose)===null||n===void 0||n.call(this)}async send(e){var r,n,a;if(!this._endpoint)throw new Error("Not connected");try{const s=await this._commonHeaders();s.set("content-type","application/json");const l={...this._requestInit,method:"POST",headers:s,body:JSON.stringify(e),signal:(r=this._abortController)===null||r===void 0?void 0:r.signal},c=await((n=this._fetch)!==null&&n!==void 0?n:fetch)(this._endpoint,l);if(!c.ok){if(c.status===401&&this._authProvider){if(this._resourceMetadataUrl=z_(c),await gs(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})!=="AUTHORIZED")throw new Ma;return this.send(e)}const d=await c.text().catch(()=>null);throw new Error(`Error POSTing to endpoint (HTTP ${c.status}): ${d}`)}}catch(s){throw(a=this.onerror)===null||a===void 0||a.call(this,s),s}}setProtocolVersion(e){this._protocolVersion=e}}const Yr=[];for(let t=0;t<256;++t)Yr.push((t+256).toString(16).slice(1));function l7(t,e=0){return(Yr[t[e+0]]+Yr[t[e+1]]+Yr[t[e+2]]+Yr[t[e+3]]+"-"+Yr[t[e+4]]+Yr[t[e+5]]+"-"+Yr[t[e+6]]+Yr[t[e+7]]+"-"+Yr[t[e+8]]+Yr[t[e+9]]+"-"+Yr[t[e+10]]+Yr[t[e+11]]+Yr[t[e+12]]+Yr[t[e+13]]+Yr[t[e+14]]+Yr[t[e+15]]).toLowerCase()}let Pb;const c7=new Uint8Array(16);function u7(){if(!Pb){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Pb=crypto.getRandomValues.bind(crypto)}return Pb(c7)}const d7=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),dO={randomUUID:d7};function f7(t,e,r){if(dO.randomUUID&&!t)return dO.randomUUID();t=t||{};const n=t.random??t.rng?.()??u7();if(n.length<16)throw new Error("Random bytes length must be >= 16");return n[6]=n[6]&15|64,n[8]=n[8]&63|128,l7(n)}var jb,fO;function p7(){return fO||(fO=1,jb=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")}),jb}var m7=p7();const pO=hc(m7);function Ou(t){const e=()=>{throw new Error(`Invalid url to pass to open(): ${t}`)};let r;try{r=new URL(t)}catch{e()}return r.protocol!=="https:"&&r.protocol!=="http:"&&e(),r.hostname!==encodeURIComponent(r.hostname)&&e(),r.username&&(r.username=encodeURIComponent(r.username)),r.password&&(r.password=encodeURIComponent(r.password)),r.pathname=r.pathname.slice(0,1)+encodeURIComponent(r.pathname.slice(1)).replace(/%2f/ig,"/"),r.search=r.search.slice(0,1)+Array.from(r.searchParams.entries()).map(h7).join("&"),r.hash=r.hash.slice(0,1)+encodeURIComponent(r.hash.slice(1)),r.href}function h7([t,e]){return`${encodeURIComponent(t)}${e.length>0?`=${encodeURIComponent(e)}`:""}`}var Kl,g7=(Kl=class{connector;autoConnect;constructor(e,r=!0){this.connector=e,this.autoConnect=r}async connect(){await this.connector.connect()}async disconnect(){await this.connector.disconnect()}async initialize(){!this.isConnected&&this.autoConnect&&await this.connect(),await this.connector.initialize()}get isConnected(){return this.connector&&this.connector.isClientConnected}},Qe(Kl,"MCPSession"),Kl),Zl,_$=(Zl=class{client=null;connectionManager=null;toolsCache=null;capabilitiesCache=null;serverInfoCache=null;connected=!1;opts;constructor(e={}){this.opts=e}async disconnect(){if(!this.connected){Me.debug("Not connected to MCP implementation");return}Me.debug("Disconnecting from MCP implementation"),await this.cleanupResources(),this.connected=!1,Me.debug("Disconnected from MCP implementation")}get isClientConnected(){return this.client!=null}async initialize(e=this.opts.defaultRequestOptions??{}){if(!this.client)throw new Error("MCP client is not connected");Me.debug("Caching server capabilities & tools");const r=this.client.getServerCapabilities();this.capabilitiesCache=r;const n=this.client.getServerVersion();this.serverInfoCache=n||null;const a=await this.client.listTools(void 0,e);return this.toolsCache=a.tools??[],Me.debug(`Fetched ${this.toolsCache.length} tools from server`),Me.debug("Server capabilities:",r),Me.debug("Server info:",n),r}get tools(){if(!this.toolsCache)throw new Error("MCP client is not initialized; call initialize() first");return this.toolsCache}get serverCapabilities(){return this.capabilitiesCache}get serverInfo(){return this.serverInfoCache}async callTool(e,r,n){if(!this.client)throw new Error("MCP client is not connected");Me.debug(`Calling tool '${e}' with args`,r);const a=await this.client.callTool({name:e,arguments:r},void 0,n);return Me.debug(`Tool '${e}' returned`,a),a}async listResources(e,r){if(!this.client)throw new Error("MCP client is not connected");return Me.debug("Listing resources",e?`with cursor: ${e}`:""),await this.client.listResources({cursor:e},r)}async listAllResources(e){if(!this.client)throw new Error("MCP client is not connected");if(!this.capabilitiesCache?.resources)return Me.debug("Server does not advertise resources capability, skipping"),{resources:[]};try{Me.debug("Listing all resources (with auto-pagination)");const r=[];let n;do{const a=await this.client.listResources({cursor:n},e);r.push(...a.resources||[]),n=a.nextCursor}while(n);return{resources:r}}catch(r){if(r.code===-32601)return Me.debug("Server advertised resources but method not found"),{resources:[]};throw r}}async listResourceTemplates(e){if(!this.client)throw new Error("MCP client is not connected");return Me.debug("Listing resource templates"),await this.client.listResourceTemplates(void 0,e)}async readResource(e,r){if(!this.client)throw new Error("MCP client is not connected");return Me.debug(`Reading resource ${e}`),await this.client.readResource({uri:e},r)}async subscribeToResource(e,r){if(!this.client)throw new Error("MCP client is not connected");return Me.debug(`Subscribing to resource: ${e}`),await this.client.subscribeResource({uri:e},r)}async unsubscribeFromResource(e,r){if(!this.client)throw new Error("MCP client is not connected");return Me.debug(`Unsubscribing from resource: ${e}`),await this.client.unsubscribeResource({uri:e},r)}async listPrompts(){if(!this.client)throw new Error("MCP client is not connected");if(!this.capabilitiesCache?.prompts)return Me.debug("Server does not advertise prompts capability, skipping"),{prompts:[]};try{return Me.debug("Listing prompts"),await this.client.listPrompts()}catch(e){if(e.code===-32601)return Me.debug("Server advertised prompts but method not found"),{prompts:[]};throw e}}async getPrompt(e,r){if(!this.client)throw new Error("MCP client is not connected");return Me.debug(`Getting prompt ${e}`),await this.client.getPrompt({name:e,arguments:r})}async request(e,r=null,n){if(!this.client)throw new Error("MCP client is not connected");return Me.debug(`Sending raw request '${e}' with params`,r),await this.client.request({method:e,params:r??{}},void 0,n)}async cleanupResources(){const e=[];if(this.client)try{typeof this.client.close=="function"&&await this.client.close()}catch(r){const n=`Error closing client: ${r}`;Me.warn(n),e.push(n)}finally{this.client=null}if(this.connectionManager)try{await this.connectionManager.stop()}catch(r){const n=`Error stopping connection manager: ${r}`;Me.warn(n),e.push(n)}finally{this.connectionManager=null}this.toolsCache=null,e.length&&Me.warn(`Resource cleanup finished with ${e.length} issue(s)`)}},Qe(Zl,"BaseConnector"),Zl),Xl,yR=(Xl=class{_readyPromise;_readyResolver;_donePromise;_doneResolver;_exception=null;_connection=null;_task=null;_abortController=null;constructor(){this.reset()}async start(){if(this.reset(),Me.debug(`Starting ${this.constructor.name}`),this._task=this.connectionTask(),await this._readyPromise,this._exception)throw this._exception;if(this._connection===null)throw new Error("Connection was not established");return this._connection}async stop(){if(this._task&&this._abortController){Me.debug(`Cancelling ${this.constructor.name} task`),this._abortController.abort();try{await this._task}catch(e){e instanceof Error&&e.name==="AbortError"?Me.debug(`${this.constructor.name} task aborted successfully`):Me.warn(`Error stopping ${this.constructor.name} task: ${e}`)}}await this._donePromise,Me.debug(`${this.constructor.name} task completed`)}reset(){this._readyPromise=new Promise(e=>this._readyResolver=e),this._donePromise=new Promise(e=>this._doneResolver=e),this._exception=null,this._connection=null,this._task=null,this._abortController=new AbortController}async connectionTask(){Me.debug(`Running ${this.constructor.name} task`);try{this._connection=await this.establishConnection(),Me.debug(`${this.constructor.name} connected successfully`),this._readyResolver(),await this.waitForAbort()}catch(e){this._exception=e,Me.error(`Error in ${this.constructor.name} task: ${e}`),this._readyResolver()}finally{if(this._connection!==null){try{await this.closeConnection(this._connection)}catch(e){Me.warn(`Error closing connection in ${this.constructor.name}: ${e}`)}this._connection=null}this._doneResolver()}}async waitForAbort(){return new Promise((e,r)=>{if(!this._abortController)return;const n=this._abortController.signal;if(n.aborted){e();return}const a=Qe(()=>{n.removeEventListener("abort",a),e()},"onAbort");n.addEventListener("abort",a)})}},Qe(Xl,"ConnectionManager"),Xl),Ql,v7=(Ql=class extends yR{url;opts;_transport=null;constructor(e,r){super(),this.url=typeof e=="string"?new URL(e):e,this.opts=r}async establishConnection(){return this._transport=new s7(this.url,this.opts),Me.debug(`${this.constructor.name} connected successfully`),this._transport}async closeConnection(e){if(this._transport)try{await this._transport.close()}catch(r){Me.warn(`Error closing SSE transport: ${r}`)}finally{this._transport=null}}},Qe(Ql,"SseConnectionManager"),Ql),Jl,b7=(Jl=class extends yR{url;opts;_transport=null;constructor(e,r){super(),this.url=typeof e=="string"?new URL(e):e,this.opts=r}async establishConnection(){return this._transport=new n7(this.url,this.opts),Me.debug(`${this.constructor.name} created successfully`),this._transport}async closeConnection(e){if(this._transport)try{await this._transport.close()}catch(r){Me.warn(`Error closing Streamable HTTP transport: ${r}`)}finally{this._transport=null}}get sessionId(){return this._transport?.sessionId}},Qe(Jl,"StreamableHttpConnectionManager"),Jl),ec,mO=(ec=class extends _${baseUrl;headers;timeout;sseReadTimeout;clientInfo;preferSse;transportType=null;constructor(e,r={}){super(r),this.baseUrl=e.replace(/\/$/,""),this.headers={...r.headers??{}},r.authToken&&(this.headers.Authorization=`Bearer ${r.authToken}`),this.timeout=r.timeout??3e4,this.sseReadTimeout=r.sseReadTimeout??3e5,this.clientInfo=r.clientInfo??{name:"http-connector",version:"1.0.0"},this.preferSse=r.preferSse??!1}async connect(){if(this.connected){Me.debug("Already connected to MCP implementation");return}const e=this.baseUrl;if(this.preferSse){Me.debug(`Connecting to MCP implementation via HTTP/SSE: ${e}`),await this.connectWithSse(e);return}Me.debug(`Connecting to MCP implementation via HTTP: ${e}`);try{Me.info("🔄 Attempting streamable HTTP transport..."),await this.connectWithStreamableHttp(e),Me.info("✅ Successfully connected via streamable HTTP")}catch(r){let n="Unknown error",a=!1;if(r instanceof Nu)a=r.code===401,r.code===400&&r.message.includes("Missing session ID")?(n="Server requires session ID (FastMCP compatibility) - using SSE transport",Me.warn(`⚠️ ${n}`)):r.code===404||r.code===405?(n=`Server returned ${r.code} - server likely doesn't support streamable HTTP`,Me.debug(n)):(n=`Server returned ${r.code}: ${r.message}`,Me.debug(n));else if(r instanceof Error){const s=r.toString(),l=r.message||"";a=s.includes("401")||l.includes("Unauthorized"),s.includes("Missing session ID")||s.includes("Bad Request: Missing session ID")||l.includes("FastMCP session ID error")?(n="Server requires session ID (FastMCP compatibility) - using SSE transport",Me.warn(`⚠️ ${n}`)):s.includes("405 Method Not Allowed")||s.includes("404 Not Found")?(n="Server doesn't support streamable HTTP (405/404)",Me.debug(n)):(n=`Streamable HTTP failed: ${r.message}`,Me.debug(n))}if(a){Me.info("Authentication required - skipping SSE fallback"),await this.cleanupResources();const s=new Error("Authentication required");throw s.code=401,s}Me.info("🔄 Falling back to SSE transport...");try{await this.connectWithSse(e)}catch(s){if(Me.error("Failed to connect with both transports:"),Me.error(` Streamable HTTP: ${n}`),Me.error(` SSE: ${s}`),await this.cleanupResources(),s?.message?.includes("401")||s?.message?.includes("Unauthorized")){const c=new Error("Authentication required");throw c.code=401,c}throw new Error("Could not connect to server with any available transport")}}}async connectWithStreamableHttp(e){try{this.connectionManager=new b7(e,{authProvider:this.opts.authProvider,requestInit:{headers:this.headers},reconnectionOptions:{maxReconnectionDelay:3e4,initialReconnectionDelay:1e3,reconnectionDelayGrowFactor:1.5,maxRetries:2}});const r=await this.connectionManager.start();this.client=new oO(this.clientInfo,this.opts.clientOptions);try{await this.client.connect(r)}catch(n){if(n instanceof Error){const a=n.message||n.toString();if(a.includes("Missing session ID")||a.includes("Bad Request: Missing session ID")){const s=new Error(`FastMCP session ID error: ${a}`);throw s.cause=n,s}}throw n}this.connected=!0,this.transportType="streamable-http",Me.debug(`Successfully connected to MCP implementation via streamable HTTP: ${e}`)}catch(r){throw await this.cleanupResources(),r}}async connectWithSse(e){try{this.connectionManager=new v7(e,{requestInit:{headers:this.headers}});const r=await this.connectionManager.start();this.client=new oO(this.clientInfo,this.opts.clientOptions),await this.client.connect(r),this.connected=!0,this.transportType="sse",Me.debug(`Successfully connected to MCP implementation via HTTP/SSE: ${e}`)}catch(r){throw await this.cleanupResources(),r}}get publicIdentifier(){return{type:"http",url:this.baseUrl,transport:this.transportType||"unknown"}}getTransportType(){return this.transportType}},Qe(ec,"HttpConnector"),ec),tc,y7=(tc=class extends yR{url;headers;_ws=null;constructor(e,r={}){super(),this.url=e,this.headers=r}async establishConnection(){return Me.debug(`Connecting to WebSocket: ${this.url}`),new Promise((e,r)=>{const n=new pO(this.url,{headers:this.headers});this._ws=n;const a=Qe(()=>{l(),Me.debug("WebSocket connected successfully"),e(n)},"onOpen"),s=Qe(c=>{l(),Me.error(`Failed to connect to WebSocket: ${c}`),r(c)},"onError"),l=Qe(()=>{n.off("open",a),n.off("error",s)},"cleanup");n.on("open",a),n.on("error",s)})}async closeConnection(e){return Me.debug("Closing WebSocket connection"),new Promise(r=>{const n=Qe(()=>{e.off("close",n),this._ws=null,r()},"onClose");if(e.readyState===pO.CLOSED){n();return}e.on("close",n);try{e.close()}catch(a){Me.warn(`Error closing WebSocket connection: ${a}`),n()}})}},Qe(tc,"WebSocketConnectionManager"),tc),rc,E7=(rc=class extends _${url;headers;connectionManager=null;ws=null;receiverTask=null;pending=new Map;toolsCache=null;constructor(e,r={}){super(),this.url=e,this.headers={...r.headers??{}},r.authToken&&(this.headers.Authorization=`Bearer ${r.authToken}`)}async connect(){if(this.connected){Me.debug("Already connected to MCP implementation");return}Me.debug(`Connecting via WebSocket: ${this.url}`);try{this.connectionManager=new y7(this.url,this.headers),this.ws=await this.connectionManager.start(),this.receiverTask=this.receiveLoop(),this.connected=!0,Me.debug("WebSocket connected successfully")}catch(e){throw Me.error(`Failed to connect: ${e}`),await this.cleanupResources(),e}}async disconnect(){if(!this.connected){Me.debug("Not connected to MCP implementation");return}Me.debug("Disconnecting …"),await this.cleanupResources(),this.connected=!1}sendRequest(e,r=null){if(!this.ws)throw new Error("WebSocket is not connected");const n=f7(),a=JSON.stringify({id:n,method:e,params:r??{}});return new Promise((s,l)=>{this.pending.set(n,{resolve:s,reject:l}),this.ws.send(a,c=>{c&&(this.pending.delete(n),l(c))})})}async receiveLoop(){if(!this.ws)return;const e=this.ws,r=Qe(n=>{let a;try{a=JSON.parse(n.data??n)}catch(l){Me.warn("Received non‑JSON frame",l);return}const s=a.id;if(s&&this.pending.has(s)){const{resolve:l,reject:c}=this.pending.get(s);this.pending.delete(s),"result"in a?l(a.result):"error"in a&&c(a.error)}else Me.debug("Received unsolicited message",a)},"onMessage");return e.addEventListener?e.addEventListener("message",r):e.on("message",r),new Promise(n=>{const a=Qe(()=>{e.removeEventListener?e.removeEventListener("message",r):e.off("message",r),this.rejectAll(new Error("WebSocket closed")),n()},"onClose");e.addEventListener?e.addEventListener("close",a):e.on("close",a)})}rejectAll(e){for(const{reject:r}of this.pending.values())r(e);this.pending.clear()}async initialize(){Me.debug("Initializing MCP session over WebSocket");const e=await this.sendRequest("initialize"),r=await this.listTools();return this.toolsCache=r.map(n=>n),Me.debug(`Initialized with ${this.toolsCache.length} tools`),e}async listTools(){return(await this.sendRequest("tools/list")).tools??[]}async callTool(e,r){return await this.sendRequest("tools/call",{name:e,arguments:r})}async listResources(){const e=await this.sendRequest("resources/list");return{resources:Array.isArray(e)?e:[]}}async readResource(e){return await this.sendRequest("resources/read",{uri:e})}async request(e,r=null){return await this.sendRequest(e,r)}get tools(){if(!this.toolsCache)throw new Error("MCP client is not initialized");return this.toolsCache}async cleanupResources(){this.receiverTask&&await this.receiverTask.catch(()=>{}),this.receiverTask=null,this.rejectAll(new Error("WebSocket disconnected")),this.connectionManager&&(await this.connectionManager.stop(),this.connectionManager=null,this.ws=null),this.toolsCache=null}get publicIdentifier(){return{type:"websocket",url:this.url}}},Qe(rc,"WebSocketConnector"),rc),nc,K_=(nc=class{serverUrl;storageKeyPrefix;serverUrlHash;clientName;clientUri;callbackUrl;preventAutoAuth;onPopupWindow;constructor(e,r={}){this.serverUrl=e,this.storageKeyPrefix=r.storageKeyPrefix||"mcp:auth",this.serverUrlHash=this.hashString(e),this.clientName=r.clientName||"mcp-use",this.clientUri=r.clientUri||(typeof window<"u"?window.location.origin:""),this.callbackUrl=Ou(r.callbackUrl||(typeof window<"u"?new URL("/oauth/callback",window.location.origin).toString():"/oauth/callback")),this.preventAutoAuth=r.preventAutoAuth,this.onPopupWindow=r.onPopupWindow}get redirectUrl(){return Ou(this.callbackUrl)}get clientMetadata(){return{redirect_uris:[this.redirectUrl],token_endpoint_auth_method:"none",grant_types:["authorization_code","refresh_token"],response_types:["code"],client_name:this.clientName,client_uri:this.clientUri}}async clientInformation(){const e=this.getKey("client_info"),r=localStorage.getItem(e);if(r)try{return JSON.parse(r)}catch(n){console.warn(`[${this.storageKeyPrefix}] Failed to parse client information:`,n),localStorage.removeItem(e);return}}async saveClientInformation(e){const r=this.getKey("client_info");localStorage.setItem(r,JSON.stringify(e))}async tokens(){const e=this.getKey("tokens"),r=localStorage.getItem(e);if(r)try{return JSON.parse(r)}catch(n){console.warn(`[${this.storageKeyPrefix}] Failed to parse tokens:`,n),localStorage.removeItem(e);return}}async saveTokens(e){const r=this.getKey("tokens");localStorage.setItem(r,JSON.stringify(e)),localStorage.removeItem(this.getKey("code_verifier")),localStorage.removeItem(this.getKey("last_auth_url"))}async saveCodeVerifier(e){const r=this.getKey("code_verifier");localStorage.setItem(r,e)}async codeVerifier(){const e=this.getKey("code_verifier"),r=localStorage.getItem(e);if(!r)throw new Error(`[${this.storageKeyPrefix}] Code verifier not found in storage for key ${e}. Auth flow likely corrupted or timed out.`);return r}async prepareAuthorizationUrl(e){const r=globalThis.crypto.randomUUID(),n=`${this.storageKeyPrefix}:state_${r}`,a={serverUrlHash:this.serverUrlHash,expiry:Date.now()+1e3*60*10,providerOptions:{serverUrl:this.serverUrl,storageKeyPrefix:this.storageKeyPrefix,clientName:this.clientName,clientUri:this.clientUri,callbackUrl:this.callbackUrl}};localStorage.setItem(n,JSON.stringify(a)),e.searchParams.set("state",r);const s=e.toString(),l=Ou(s);return localStorage.setItem(this.getKey("last_auth_url"),l),l}async redirectToAuthorization(e){if(this.preventAutoAuth)return;const r=await this.prepareAuthorizationUrl(e),n="width=600,height=700,resizable=yes,scrollbars=yes,status=yes";try{const a=window.open(r,`mcp_auth_${this.serverUrlHash}`,n);this.onPopupWindow&&this.onPopupWindow(r,n,a),!a||a.closed||typeof a.closed>"u"?console.warn(`[${this.storageKeyPrefix}] Popup likely blocked by browser. Manual navigation might be required using the stored URL.`):(a.focus(),console.info(`[${this.storageKeyPrefix}] Redirecting to authorization URL in popup.`))}catch(a){console.error(`[${this.storageKeyPrefix}] Error opening popup window:`,a)}}getLastAttemptedAuthUrl(){const e=localStorage.getItem(this.getKey("last_auth_url"));return e?Ou(e):null}clearStorage(){const e=`${this.storageKeyPrefix}_${this.serverUrlHash}_`,r=`${this.storageKeyPrefix}:state_`,n=[];let a=0;for(let l=0;l<localStorage.length;l++){const c=localStorage.key(l);if(c){if(c.startsWith(e))n.push(c);else if(c.startsWith(r))try{const d=localStorage.getItem(c);d&&JSON.parse(d).serverUrlHash===this.serverUrlHash&&n.push(c)}catch(d){console.warn(`[${this.storageKeyPrefix}] Error parsing state key ${c} during clearStorage:`,d)}}}return[...new Set(n)].forEach(l=>{localStorage.removeItem(l),a++}),a}hashString(e){let r=0;for(let n=0;n<e.length;n++){const a=e.charCodeAt(n);r=(r<<5)-r+a,r=r&r}return Math.abs(r).toString(16)}getKey(e){return`${this.storageKeyPrefix}_${this.serverUrlHash}_${e}`}},Qe(nc,"BrowserOAuthClientProvider"),nc);async function T$(){const t=new URLSearchParams(window.location.search),e=t.get("code"),r=t.get("state"),n=t.get("error"),a=t.get("error_description"),s="[mcp-callback]";console.log(`${s} Handling callback...`,{code:e,state:r,error:n,errorDescription:a});let l=null,c=null;const d=r?`mcp:auth:state_${r}`:null;try{if(n)throw new Error(`OAuth error: ${n} - ${a||"No description provided."}`);if(!e)throw new Error("Authorization code not found in callback query parameters.");if(!r||!d)throw new Error("State parameter not found or invalid in callback query parameters.");const f=localStorage.getItem(d);if(!f)throw new Error(`Invalid or expired state parameter "${r}". No matching state found in storage.`);try{c=JSON.parse(f)}catch{throw new Error("Failed to parse stored OAuth state.")}if(!c.expiry||c.expiry<Date.now())throw localStorage.removeItem(d),new Error("OAuth state has expired. Please try initiating authentication again.");if(!c.providerOptions)throw new Error("Stored state is missing required provider options.");const{serverUrl:h,...g}=c.providerOptions;console.log(`${s} Re-instantiating provider for server: ${h}`),l=new K_(h,g),console.log(`${s} Calling SDK auth() to exchange code...`);const v=new URL(h).origin,y=await gs(l,{serverUrl:v,authorizationCode:e});if(y==="AUTHORIZED"){if(console.log(`${s} Authorization successful via SDK auth(). Notifying opener...`),window.opener&&!window.opener.closed)window.opener.postMessage({type:"mcp_auth_callback",success:!0},window.location.origin),window.close();else{console.warn(`${s} No opener window detected. Redirecting to root.`);const w=window.location.pathname.split("/").filter(Boolean),S=w.length>0&&w[w.length-1]==="callback"?"/"+w.slice(0,-2).join("/"):"/";window.location.href=S||"/"}localStorage.removeItem(d)}else throw console.warn(`${s} SDK auth() returned unexpected status: ${y}`),new Error(`Unexpected result from authentication library: ${y}`)}catch(f){console.error(`${s} Error during OAuth callback handling:`,f);const h=f instanceof Error?f.message:String(f);window.opener&&!window.opener.closed&&window.opener.postMessage({type:"mcp_auth_callback",success:!1,error:h},window.location.origin);try{document.body.innerHTML=`
|
|
6
|
+
`&&n++}}return[e,r]}class t7 extends TransformStream{constructor({onError:e,onRetry:r,onComment:n}={}){let a;super({start(s){a=w$({onEvent:l=>{s.enqueue(l)},onError(l){e==="terminate"?s.error(l):typeof e=="function"&&e(l)},onRetry:r,onComment:n})},transform(s){a.feed(s)}})}}const r7={initialReconnectionDelay:1e3,maxReconnectionDelay:3e4,reconnectionDelayGrowFactor:1.5,maxRetries:2};class Nu extends Error{constructor(e,r){super(`Streamable HTTP error: ${r}`),this.code=e}}class n7{constructor(e,r){var n;this._hasCompletedAuthFlow=!1,this._url=e,this._resourceMetadataUrl=void 0,this._requestInit=r?.requestInit,this._authProvider=r?.authProvider,this._fetch=r?.fetch,this._sessionId=r?.sessionId,this._reconnectionOptions=(n=r?.reconnectionOptions)!==null&&n!==void 0?n:r7}async _authThenStart(){var e;if(!this._authProvider)throw new Ma("No auth provider");let r;try{r=await gs(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})}catch(n){throw(e=this.onerror)===null||e===void 0||e.call(this,n),n}if(r!=="AUTHORIZED")throw new Ma;return await this._startOrAuthSse({resumptionToken:void 0})}async _commonHeaders(){var e;const r={};if(this._authProvider){const a=await this._authProvider.tokens();a&&(r.Authorization=`Bearer ${a.access_token}`)}this._sessionId&&(r["mcp-session-id"]=this._sessionId),this._protocolVersion&&(r["mcp-protocol-version"]=this._protocolVersion);const n=this._normalizeHeaders((e=this._requestInit)===null||e===void 0?void 0:e.headers);return new Headers({...r,...n})}async _startOrAuthSse(e){var r,n,a;const{resumptionToken:s}=e;try{const l=await this._commonHeaders();l.set("Accept","text/event-stream"),s&&l.set("last-event-id",s);const c=await((r=this._fetch)!==null&&r!==void 0?r:fetch)(this._url,{method:"GET",headers:l,signal:(n=this._abortController)===null||n===void 0?void 0:n.signal});if(!c.ok){if(c.status===401&&this._authProvider)return await this._authThenStart();if(c.status===405)return;throw new Nu(c.status,`Failed to open SSE stream: ${c.statusText}`)}this._handleSseStream(c.body,e,!0)}catch(l){throw(a=this.onerror)===null||a===void 0||a.call(this,l),l}}_getNextReconnectionDelay(e){const r=this._reconnectionOptions.initialReconnectionDelay,n=this._reconnectionOptions.reconnectionDelayGrowFactor,a=this._reconnectionOptions.maxReconnectionDelay;return Math.min(r*Math.pow(n,e),a)}_normalizeHeaders(e){return e?e instanceof Headers?Object.fromEntries(e.entries()):Array.isArray(e)?Object.fromEntries(e):{...e}:{}}_scheduleReconnection(e,r=0){var n;const a=this._reconnectionOptions.maxRetries;if(a>0&&r>=a){(n=this.onerror)===null||n===void 0||n.call(this,new Error(`Maximum reconnection attempts (${a}) exceeded.`));return}const s=this._getNextReconnectionDelay(r);setTimeout(()=>{this._startOrAuthSse(e).catch(l=>{var c;(c=this.onerror)===null||c===void 0||c.call(this,new Error(`Failed to reconnect SSE stream: ${l instanceof Error?l.message:String(l)}`)),this._scheduleReconnection(e,r+1)})},s)}_handleSseStream(e,r,n){if(!e)return;const{onresumptiontoken:a,replayMessageId:s}=r;let l;(async()=>{var d,f,h,g;try{const v=e.pipeThrough(new TextDecoderStream).pipeThrough(new t7).getReader();for(;;){const{value:y,done:w}=await v.read();if(w)break;if(y.id&&(l=y.id,a?.(y.id)),!y.event||y.event==="message")try{const S=zp.parse(JSON.parse(y.data));s!==void 0&&C_(S)&&(S.id=s),(d=this.onmessage)===null||d===void 0||d.call(this,S)}catch(S){(f=this.onerror)===null||f===void 0||f.call(this,S)}}}catch(v){if((h=this.onerror)===null||h===void 0||h.call(this,new Error(`SSE stream disconnected: ${v}`)),n&&this._abortController&&!this._abortController.signal.aborted)try{this._scheduleReconnection({resumptionToken:l,onresumptiontoken:a,replayMessageId:s},0)}catch(y){(g=this.onerror)===null||g===void 0||g.call(this,new Error(`Failed to reconnect: ${y instanceof Error?y.message:String(y)}`))}}})()}async start(){if(this._abortController)throw new Error("StreamableHTTPClientTransport already started! If using Client class, note that connect() calls start() automatically.");this._abortController=new AbortController}async finishAuth(e){if(!this._authProvider)throw new Ma("No auth provider");if(await gs(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})!=="AUTHORIZED")throw new Ma("Failed to authorize")}async close(){var e,r;(e=this._abortController)===null||e===void 0||e.abort(),(r=this.onclose)===null||r===void 0||r.call(this)}async send(e,r){var n,a,s,l;try{const{resumptionToken:c,onresumptiontoken:d}=r||{};if(c){this._startOrAuthSse({resumptionToken:c,replayMessageId:Kz(e)?e.id:void 0}).catch(T=>{var x;return(x=this.onerror)===null||x===void 0?void 0:x.call(this,T)});return}const f=await this._commonHeaders();f.set("content-type","application/json"),f.set("accept","application/json, text/event-stream");const h={...this._requestInit,method:"POST",headers:f,body:JSON.stringify(e),signal:(n=this._abortController)===null||n===void 0?void 0:n.signal},g=await((a=this._fetch)!==null&&a!==void 0?a:fetch)(this._url,h),v=g.headers.get("mcp-session-id");if(v&&(this._sessionId=v),!g.ok){if(g.status===401&&this._authProvider){if(this._hasCompletedAuthFlow)throw new Nu(401,"Server returned 401 after successful authentication");if(this._resourceMetadataUrl=z_(g),await gs(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})!=="AUTHORIZED")throw new Ma;return this._hasCompletedAuthFlow=!0,this.send(e)}const T=await g.text().catch(()=>null);throw new Error(`Error POSTing to endpoint (HTTP ${g.status}): ${T}`)}if(this._hasCompletedAuthFlow=!1,g.status===202){P9(e)&&this._startOrAuthSse({resumptionToken:void 0}).catch(T=>{var x;return(x=this.onerror)===null||x===void 0?void 0:x.call(this,T)});return}const w=(Array.isArray(e)?e:[e]).filter(T=>"method"in T&&"id"in T&&T.id!==void 0).length>0,S=g.headers.get("content-type");if(w)if(S?.includes("text/event-stream"))this._handleSseStream(g.body,{onresumptiontoken:d},!1);else if(S?.includes("application/json")){const T=await g.json(),x=Array.isArray(T)?T.map(_=>zp.parse(_)):[zp.parse(T)];for(const _ of x)(s=this.onmessage)===null||s===void 0||s.call(this,_)}else throw new Nu(-1,`Unexpected content type: ${S}`)}catch(c){throw(l=this.onerror)===null||l===void 0||l.call(this,c),c}}get sessionId(){return this._sessionId}async terminateSession(){var e,r,n;if(this._sessionId)try{const a=await this._commonHeaders(),s={...this._requestInit,method:"DELETE",headers:a,signal:(e=this._abortController)===null||e===void 0?void 0:e.signal},l=await((r=this._fetch)!==null&&r!==void 0?r:fetch)(this._url,s);if(!l.ok&&l.status!==405)throw new Nu(l.status,`Failed to terminate session: ${l.statusText}`);this._sessionId=void 0}catch(a){throw(n=this.onerror)===null||n===void 0||n.call(this,a),a}}setProtocolVersion(e){this._protocolVersion=e}get protocolVersion(){return this._protocolVersion}}class lO extends Event{constructor(e,r){var n,a;super(e),this.code=(n=r?.code)!=null?n:void 0,this.message=(a=r?.message)!=null?a:void 0}[Symbol.for("nodejs.util.inspect.custom")](e,r,n){return n(cO(this),r)}[Symbol.for("Deno.customInspect")](e,r){return e(cO(this),r)}}function a7(t){const e=globalThis.DOMException;return typeof e=="function"?new e(t,"SyntaxError"):new SyntaxError(t)}function $_(t){return t instanceof Error?"errors"in t&&Array.isArray(t.errors)?t.errors.map($_).join(", "):"cause"in t&&t.cause instanceof Error?`${t}: ${$_(t.cause)}`:t.message:`${t}`}function cO(t){return{type:t.type,message:t.message,code:t.code,defaultPrevented:t.defaultPrevented,cancelable:t.cancelable,timeStamp:t.timeStamp}}var _$=t=>{throw TypeError(t)},bR=(t,e,r)=>e.has(t)||_$("Cannot "+r),wt=(t,e,r)=>(bR(t,e,"read from private field"),r?r.call(t):e.get(t)),Dr=(t,e,r)=>e.has(t)?_$("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),rr=(t,e,r,n)=>(bR(t,e,"write to private field"),e.set(t,r),r),wo=(t,e,r)=>(bR(t,e,"access private method"),r),xn,cs,xl,$p,ym,Bu,Ol,qu,Ei,wl,$l,_l,ku,va,B_,q_,H_,uO,V_,G_,Iu,W_,Y_;class Bp extends EventTarget{constructor(e,r){var n,a;super(),Dr(this,va),this.CONNECTING=0,this.OPEN=1,this.CLOSED=2,Dr(this,xn),Dr(this,cs),Dr(this,xl),Dr(this,$p),Dr(this,ym),Dr(this,Bu),Dr(this,Ol),Dr(this,qu,null),Dr(this,Ei),Dr(this,wl),Dr(this,$l,null),Dr(this,_l,null),Dr(this,ku,null),Dr(this,q_,async s=>{var l;wt(this,wl).reset();const{body:c,redirected:d,status:f,headers:h}=s;if(f===204){wo(this,va,Iu).call(this,"Server sent HTTP 204, not reconnecting",204),this.close();return}if(d?rr(this,xl,new URL(s.url)):rr(this,xl,void 0),f!==200){wo(this,va,Iu).call(this,`Non-200 status code (${f})`,f);return}if(!(h.get("content-type")||"").startsWith("text/event-stream")){wo(this,va,Iu).call(this,'Invalid content type, expected "text/event-stream"',f);return}if(wt(this,xn)===this.CLOSED)return;rr(this,xn,this.OPEN);const g=new Event("open");if((l=wt(this,ku))==null||l.call(this,g),this.dispatchEvent(g),typeof c!="object"||!c||!("getReader"in c)){wo(this,va,Iu).call(this,"Invalid response body, expected a web ReadableStream",f),this.close();return}const v=new TextDecoder,y=c.getReader();let w=!0;do{const{done:S,value:T}=await y.read();T&&wt(this,wl).feed(v.decode(T,{stream:!S})),S&&(w=!1,wt(this,wl).reset(),wo(this,va,W_).call(this))}while(w)}),Dr(this,H_,s=>{rr(this,Ei,void 0),!(s.name==="AbortError"||s.type==="aborted")&&wo(this,va,W_).call(this,$_(s))}),Dr(this,V_,s=>{typeof s.id=="string"&&rr(this,qu,s.id);const l=new MessageEvent(s.event||"message",{data:s.data,origin:wt(this,xl)?wt(this,xl).origin:wt(this,cs).origin,lastEventId:s.id||""});wt(this,_l)&&(!s.event||s.event==="message")&&wt(this,_l).call(this,l),this.dispatchEvent(l)}),Dr(this,G_,s=>{rr(this,Bu,s)}),Dr(this,Y_,()=>{rr(this,Ol,void 0),wt(this,xn)===this.CONNECTING&&wo(this,va,B_).call(this)});try{if(e instanceof URL)rr(this,cs,e);else if(typeof e=="string")rr(this,cs,new URL(e,o7()));else throw new Error("Invalid URL")}catch{throw a7("An invalid or illegal string was specified")}rr(this,wl,w$({onEvent:wt(this,V_),onRetry:wt(this,G_)})),rr(this,xn,this.CONNECTING),rr(this,Bu,3e3),rr(this,ym,(n=r?.fetch)!=null?n:globalThis.fetch),rr(this,$p,(a=r?.withCredentials)!=null?a:!1),wo(this,va,B_).call(this)}get readyState(){return wt(this,xn)}get url(){return wt(this,cs).href}get withCredentials(){return wt(this,$p)}get onerror(){return wt(this,$l)}set onerror(e){rr(this,$l,e)}get onmessage(){return wt(this,_l)}set onmessage(e){rr(this,_l,e)}get onopen(){return wt(this,ku)}set onopen(e){rr(this,ku,e)}addEventListener(e,r,n){const a=r;super.addEventListener(e,a,n)}removeEventListener(e,r,n){const a=r;super.removeEventListener(e,a,n)}close(){wt(this,Ol)&&clearTimeout(wt(this,Ol)),wt(this,xn)!==this.CLOSED&&(wt(this,Ei)&&wt(this,Ei).abort(),rr(this,xn,this.CLOSED),rr(this,Ei,void 0))}}xn=new WeakMap,cs=new WeakMap,xl=new WeakMap,$p=new WeakMap,ym=new WeakMap,Bu=new WeakMap,Ol=new WeakMap,qu=new WeakMap,Ei=new WeakMap,wl=new WeakMap,$l=new WeakMap,_l=new WeakMap,ku=new WeakMap,va=new WeakSet,B_=function(){rr(this,xn,this.CONNECTING),rr(this,Ei,new AbortController),wt(this,ym)(wt(this,cs),wo(this,va,uO).call(this)).then(wt(this,q_)).catch(wt(this,H_))},q_=new WeakMap,H_=new WeakMap,uO=function(){var t;const e={mode:"cors",redirect:"follow",headers:{Accept:"text/event-stream",...wt(this,qu)?{"Last-Event-ID":wt(this,qu)}:void 0},cache:"no-store",signal:(t=wt(this,Ei))==null?void 0:t.signal};return"window"in globalThis&&(e.credentials=this.withCredentials?"include":"same-origin"),e},V_=new WeakMap,G_=new WeakMap,Iu=function(t,e){var r;wt(this,xn)!==this.CLOSED&&rr(this,xn,this.CLOSED);const n=new lO("error",{code:e,message:t});(r=wt(this,$l))==null||r.call(this,n),this.dispatchEvent(n)},W_=function(t,e){var r;if(wt(this,xn)===this.CLOSED)return;rr(this,xn,this.CONNECTING);const n=new lO("error",{code:e,message:t});(r=wt(this,$l))==null||r.call(this,n),this.dispatchEvent(n),rr(this,Ol,setTimeout(wt(this,Y_),wt(this,Bu)))},Y_=new WeakMap,Bp.CONNECTING=0,Bp.OPEN=1,Bp.CLOSED=2;function o7(){const t="document"in globalThis?globalThis.document:void 0;return t&&typeof t=="object"&&"baseURI"in t&&typeof t.baseURI=="string"?t.baseURI:void 0}class i7 extends Error{constructor(e,r,n){super(`SSE error: ${r}`),this.code=e,this.event=n}}class s7{constructor(e,r){this._url=e,this._resourceMetadataUrl=void 0,this._eventSourceInit=r?.eventSourceInit,this._requestInit=r?.requestInit,this._authProvider=r?.authProvider,this._fetch=r?.fetch}async _authThenStart(){var e;if(!this._authProvider)throw new Ma("No auth provider");let r;try{r=await gs(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})}catch(n){throw(e=this.onerror)===null||e===void 0||e.call(this,n),n}if(r!=="AUTHORIZED")throw new Ma;return await this._startOrAuth()}async _commonHeaders(){var e;const r={};if(this._authProvider){const n=await this._authProvider.tokens();n&&(r.Authorization=`Bearer ${n.access_token}`)}return this._protocolVersion&&(r["mcp-protocol-version"]=this._protocolVersion),new Headers({...r,...(e=this._requestInit)===null||e===void 0?void 0:e.headers})}_startOrAuth(){var e,r,n;const a=(n=(r=(e=this===null||this===void 0?void 0:this._eventSourceInit)===null||e===void 0?void 0:e.fetch)!==null&&r!==void 0?r:this._fetch)!==null&&n!==void 0?n:fetch;return new Promise((s,l)=>{this._eventSource=new Bp(this._url.href,{...this._eventSourceInit,fetch:async(c,d)=>{const f=await this._commonHeaders();f.set("Accept","text/event-stream");const h=await a(c,{...d,headers:f});return h.status===401&&h.headers.has("www-authenticate")&&(this._resourceMetadataUrl=z_(h)),h}}),this._abortController=new AbortController,this._eventSource.onerror=c=>{var d;if(c.code===401&&this._authProvider){this._authThenStart().then(s,l);return}const f=new i7(c.code,c.message,c);l(f),(d=this.onerror)===null||d===void 0||d.call(this,f)},this._eventSource.onopen=()=>{},this._eventSource.addEventListener("endpoint",c=>{var d;const f=c;try{if(this._endpoint=new URL(f.data,this._url),this._endpoint.origin!==this._url.origin)throw new Error(`Endpoint origin does not match connection origin: ${this._endpoint.origin}`)}catch(h){l(h),(d=this.onerror)===null||d===void 0||d.call(this,h),this.close();return}s()}),this._eventSource.onmessage=c=>{var d,f;const h=c;let g;try{g=zp.parse(JSON.parse(h.data))}catch(v){(d=this.onerror)===null||d===void 0||d.call(this,v);return}(f=this.onmessage)===null||f===void 0||f.call(this,g)}})}async start(){if(this._eventSource)throw new Error("SSEClientTransport already started! If using Client class, note that connect() calls start() automatically.");return await this._startOrAuth()}async finishAuth(e){if(!this._authProvider)throw new Ma("No auth provider");if(await gs(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})!=="AUTHORIZED")throw new Ma("Failed to authorize")}async close(){var e,r,n;(e=this._abortController)===null||e===void 0||e.abort(),(r=this._eventSource)===null||r===void 0||r.close(),(n=this.onclose)===null||n===void 0||n.call(this)}async send(e){var r,n,a;if(!this._endpoint)throw new Error("Not connected");try{const s=await this._commonHeaders();s.set("content-type","application/json");const l={...this._requestInit,method:"POST",headers:s,body:JSON.stringify(e),signal:(r=this._abortController)===null||r===void 0?void 0:r.signal},c=await((n=this._fetch)!==null&&n!==void 0?n:fetch)(this._endpoint,l);if(!c.ok){if(c.status===401&&this._authProvider){if(this._resourceMetadataUrl=z_(c),await gs(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})!=="AUTHORIZED")throw new Ma;return this.send(e)}const d=await c.text().catch(()=>null);throw new Error(`Error POSTing to endpoint (HTTP ${c.status}): ${d}`)}}catch(s){throw(a=this.onerror)===null||a===void 0||a.call(this,s),s}}setProtocolVersion(e){this._protocolVersion=e}}const Yr=[];for(let t=0;t<256;++t)Yr.push((t+256).toString(16).slice(1));function l7(t,e=0){return(Yr[t[e+0]]+Yr[t[e+1]]+Yr[t[e+2]]+Yr[t[e+3]]+"-"+Yr[t[e+4]]+Yr[t[e+5]]+"-"+Yr[t[e+6]]+Yr[t[e+7]]+"-"+Yr[t[e+8]]+Yr[t[e+9]]+"-"+Yr[t[e+10]]+Yr[t[e+11]]+Yr[t[e+12]]+Yr[t[e+13]]+Yr[t[e+14]]+Yr[t[e+15]]).toLowerCase()}let Pb;const c7=new Uint8Array(16);function u7(){if(!Pb){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Pb=crypto.getRandomValues.bind(crypto)}return Pb(c7)}const d7=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),dO={randomUUID:d7};function f7(t,e,r){if(dO.randomUUID&&!t)return dO.randomUUID();t=t||{};const n=t.random??t.rng?.()??u7();if(n.length<16)throw new Error("Random bytes length must be >= 16");return n[6]=n[6]&15|64,n[8]=n[8]&63|128,l7(n)}var jb,fO;function p7(){return fO||(fO=1,jb=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")}),jb}var m7=p7();const pO=hc(m7);function Ou(t){const e=()=>{throw new Error(`Invalid url to pass to open(): ${t}`)};let r;try{r=new URL(t)}catch{e()}return r.protocol!=="https:"&&r.protocol!=="http:"&&e(),r.hostname!==encodeURIComponent(r.hostname)&&e(),r.username&&(r.username=encodeURIComponent(r.username)),r.password&&(r.password=encodeURIComponent(r.password)),r.pathname=r.pathname.slice(0,1)+encodeURIComponent(r.pathname.slice(1)).replace(/%2f/ig,"/"),r.search=r.search.slice(0,1)+Array.from(r.searchParams.entries()).map(h7).join("&"),r.hash=r.hash.slice(0,1)+encodeURIComponent(r.hash.slice(1)),r.href}function h7([t,e]){return`${encodeURIComponent(t)}${e.length>0?`=${encodeURIComponent(e)}`:""}`}var Zl,g7=(Zl=class{connector;autoConnect;constructor(e,r=!0){this.connector=e,this.autoConnect=r}async connect(){await this.connector.connect()}async disconnect(){await this.connector.disconnect()}async initialize(){!this.isConnected&&this.autoConnect&&await this.connect(),await this.connector.initialize()}get isConnected(){return this.connector&&this.connector.isClientConnected}},Qe(Zl,"MCPSession"),Zl),Xl,yR=(Xl=class{_readyPromise;_readyResolver;_donePromise;_doneResolver;_exception=null;_connection=null;_task=null;_abortController=null;constructor(){this.reset()}async start(){if(this.reset(),Me.debug(`Starting ${this.constructor.name}`),this._task=this.connectionTask(),await this._readyPromise,this._exception)throw this._exception;if(this._connection===null)throw new Error("Connection was not established");return this._connection}async stop(){if(this._task&&this._abortController){Me.debug(`Cancelling ${this.constructor.name} task`),this._abortController.abort();try{await this._task}catch(e){e instanceof Error&&e.name==="AbortError"?Me.debug(`${this.constructor.name} task aborted successfully`):Me.warn(`Error stopping ${this.constructor.name} task: ${e}`)}}await this._donePromise,Me.debug(`${this.constructor.name} task completed`)}reset(){this._readyPromise=new Promise(e=>this._readyResolver=e),this._donePromise=new Promise(e=>this._doneResolver=e),this._exception=null,this._connection=null,this._task=null,this._abortController=new AbortController}async connectionTask(){Me.debug(`Running ${this.constructor.name} task`);try{this._connection=await this.establishConnection(),Me.debug(`${this.constructor.name} connected successfully`),this._readyResolver(),await this.waitForAbort()}catch(e){this._exception=e,Me.error(`Error in ${this.constructor.name} task: ${e}`),this._readyResolver()}finally{if(this._connection!==null){try{await this.closeConnection(this._connection)}catch(e){Me.warn(`Error closing connection in ${this.constructor.name}: ${e}`)}this._connection=null}this._doneResolver()}}async waitForAbort(){return new Promise((e,r)=>{if(!this._abortController)return;const n=this._abortController.signal;if(n.aborted){e();return}const a=Qe(()=>{n.removeEventListener("abort",a),e()},"onAbort");n.addEventListener("abort",a)})}},Qe(Xl,"ConnectionManager"),Xl),Ql,v7=(Ql=class extends yR{url;opts;_transport=null;constructor(e,r){super(),this.url=typeof e=="string"?new URL(e):e,this.opts=r}async establishConnection(){return this._transport=new s7(this.url,this.opts),Me.debug(`${this.constructor.name} connected successfully`),this._transport}async closeConnection(e){if(this._transport)try{await this._transport.close()}catch(r){Me.warn(`Error closing SSE transport: ${r}`)}finally{this._transport=null}}},Qe(Ql,"SseConnectionManager"),Ql),Jl,b7=(Jl=class extends yR{url;opts;_transport=null;constructor(e,r){super(),this.url=typeof e=="string"?new URL(e):e,this.opts=r}async establishConnection(){return this._transport=new n7(this.url,this.opts),Me.debug(`${this.constructor.name} created successfully`),this._transport}async closeConnection(e){if(this._transport)try{await this._transport.close()}catch(r){Me.warn(`Error closing Streamable HTTP transport: ${r}`)}finally{this._transport=null}}get sessionId(){return this._transport?.sessionId}},Qe(Jl,"StreamableHttpConnectionManager"),Jl),ec,mO=(ec=class extends $z{baseUrl;headers;timeout;sseReadTimeout;clientInfo;preferSse;transportType=null;constructor(e,r={}){super(r),this.baseUrl=e.replace(/\/$/,""),this.headers={...r.headers??{}},r.authToken&&(this.headers.Authorization=`Bearer ${r.authToken}`),this.timeout=r.timeout??3e4,this.sseReadTimeout=r.sseReadTimeout??3e5,this.clientInfo=r.clientInfo??{name:"http-connector",version:"1.0.0"},this.preferSse=r.preferSse??!1}async connect(){if(this.connected){Me.debug("Already connected to MCP implementation");return}const e=this.baseUrl;if(this.preferSse){Me.debug(`Connecting to MCP implementation via HTTP/SSE: ${e}`),await this.connectWithSse(e);return}Me.debug(`Connecting to MCP implementation via HTTP: ${e}`);try{Me.info("🔄 Attempting streamable HTTP transport..."),await this.connectWithStreamableHttp(e),Me.info("✅ Successfully connected via streamable HTTP")}catch(r){let n="Unknown error",a=!1;if(r instanceof Nu)a=r.code===401,r.code===400&&r.message.includes("Missing session ID")?(n="Server requires session ID (FastMCP compatibility) - using SSE transport",Me.warn(`⚠️ ${n}`)):r.code===404||r.code===405?(n=`Server returned ${r.code} - server likely doesn't support streamable HTTP`,Me.debug(n)):(n=`Server returned ${r.code}: ${r.message}`,Me.debug(n));else if(r instanceof Error){const s=r.toString(),l=r.message||"";a=s.includes("401")||l.includes("Unauthorized"),s.includes("Missing session ID")||s.includes("Bad Request: Missing session ID")||l.includes("FastMCP session ID error")?(n="Server requires session ID (FastMCP compatibility) - using SSE transport",Me.warn(`⚠️ ${n}`)):s.includes("405 Method Not Allowed")||s.includes("404 Not Found")?(n="Server doesn't support streamable HTTP (405/404)",Me.debug(n)):(n=`Streamable HTTP failed: ${r.message}`,Me.debug(n))}if(a){Me.info("Authentication required - skipping SSE fallback"),await this.cleanupResources();const s=new Error("Authentication required");throw s.code=401,s}Me.info("🔄 Falling back to SSE transport...");try{await this.connectWithSse(e)}catch(s){if(Me.error("Failed to connect with both transports:"),Me.error(` Streamable HTTP: ${n}`),Me.error(` SSE: ${s}`),await this.cleanupResources(),s?.message?.includes("401")||s?.message?.includes("Unauthorized")){const c=new Error("Authentication required");throw c.code=401,c}throw new Error("Could not connect to server with any available transport")}}}async connectWithStreamableHttp(e){try{this.connectionManager=new b7(e,{authProvider:this.opts.authProvider,requestInit:{headers:this.headers},reconnectionOptions:{maxReconnectionDelay:3e4,initialReconnectionDelay:1e3,reconnectionDelayGrowFactor:1.5,maxRetries:2}});const r=await this.connectionManager.start();this.client=new oO(this.clientInfo,this.opts.clientOptions);try{await this.client.connect(r)}catch(n){if(n instanceof Error){const a=n.message||n.toString();if(a.includes("Missing session ID")||a.includes("Bad Request: Missing session ID")){const s=new Error(`FastMCP session ID error: ${a}`);throw s.cause=n,s}}throw n}this.connected=!0,this.transportType="streamable-http",Me.debug(`Successfully connected to MCP implementation via streamable HTTP: ${e}`)}catch(r){throw await this.cleanupResources(),r}}async connectWithSse(e){try{this.connectionManager=new v7(e,{requestInit:{headers:this.headers}});const r=await this.connectionManager.start();this.client=new oO(this.clientInfo,this.opts.clientOptions),await this.client.connect(r),this.connected=!0,this.transportType="sse",Me.debug(`Successfully connected to MCP implementation via HTTP/SSE: ${e}`)}catch(r){throw await this.cleanupResources(),r}}get publicIdentifier(){return{type:"http",url:this.baseUrl,transport:this.transportType||"unknown"}}getTransportType(){return this.transportType}},Qe(ec,"HttpConnector"),ec),tc,y7=(tc=class extends yR{url;headers;_ws=null;constructor(e,r={}){super(),this.url=e,this.headers=r}async establishConnection(){return Me.debug(`Connecting to WebSocket: ${this.url}`),new Promise((e,r)=>{const n=new pO(this.url,{headers:this.headers});this._ws=n;const a=Qe(()=>{l(),Me.debug("WebSocket connected successfully"),e(n)},"onOpen"),s=Qe(c=>{l(),Me.error(`Failed to connect to WebSocket: ${c}`),r(c)},"onError"),l=Qe(()=>{n.off("open",a),n.off("error",s)},"cleanup");n.on("open",a),n.on("error",s)})}async closeConnection(e){return Me.debug("Closing WebSocket connection"),new Promise(r=>{const n=Qe(()=>{e.off("close",n),this._ws=null,r()},"onClose");if(e.readyState===pO.CLOSED){n();return}e.on("close",n);try{e.close()}catch(a){Me.warn(`Error closing WebSocket connection: ${a}`),n()}})}},Qe(tc,"WebSocketConnectionManager"),tc),rc,E7=(rc=class extends $z{url;headers;connectionManager=null;ws=null;receiverTask=null;pending=new Map;toolsCache=null;constructor(e,r={}){super(),this.url=e,this.headers={...r.headers??{}},r.authToken&&(this.headers.Authorization=`Bearer ${r.authToken}`)}async connect(){if(this.connected){Me.debug("Already connected to MCP implementation");return}Me.debug(`Connecting via WebSocket: ${this.url}`);try{this.connectionManager=new y7(this.url,this.headers),this.ws=await this.connectionManager.start(),this.receiverTask=this.receiveLoop(),this.connected=!0,Me.debug("WebSocket connected successfully")}catch(e){throw Me.error(`Failed to connect: ${e}`),await this.cleanupResources(),e}}async disconnect(){if(!this.connected){Me.debug("Not connected to MCP implementation");return}Me.debug("Disconnecting …"),await this.cleanupResources(),this.connected=!1}sendRequest(e,r=null){if(!this.ws)throw new Error("WebSocket is not connected");const n=f7(),a=JSON.stringify({id:n,method:e,params:r??{}});return new Promise((s,l)=>{this.pending.set(n,{resolve:s,reject:l}),this.ws.send(a,c=>{c&&(this.pending.delete(n),l(c))})})}async receiveLoop(){if(!this.ws)return;const e=this.ws,r=Qe(n=>{let a;try{a=JSON.parse(n.data??n)}catch(l){Me.warn("Received non‑JSON frame",l);return}const s=a.id;if(s&&this.pending.has(s)){const{resolve:l,reject:c}=this.pending.get(s);this.pending.delete(s),"result"in a?l(a.result):"error"in a&&c(a.error)}else Me.debug("Received unsolicited message",a)},"onMessage");return e.addEventListener?e.addEventListener("message",r):e.on("message",r),new Promise(n=>{const a=Qe(()=>{e.removeEventListener?e.removeEventListener("message",r):e.off("message",r),this.rejectAll(new Error("WebSocket closed")),n()},"onClose");e.addEventListener?e.addEventListener("close",a):e.on("close",a)})}rejectAll(e){for(const{reject:r}of this.pending.values())r(e);this.pending.clear()}async initialize(){Me.debug("Initializing MCP session over WebSocket");const e=await this.sendRequest("initialize"),r=await this.listTools();return this.toolsCache=r.map(n=>n),Me.debug(`Initialized with ${this.toolsCache.length} tools`),e}async listTools(){return(await this.sendRequest("tools/list")).tools??[]}async callTool(e,r){return await this.sendRequest("tools/call",{name:e,arguments:r})}async listResources(){const e=await this.sendRequest("resources/list");return{resources:Array.isArray(e)?e:[]}}async readResource(e){return await this.sendRequest("resources/read",{uri:e})}async request(e,r=null){return await this.sendRequest(e,r)}get tools(){if(!this.toolsCache)throw new Error("MCP client is not initialized");return this.toolsCache}async cleanupResources(){this.receiverTask&&await this.receiverTask.catch(()=>{}),this.receiverTask=null,this.rejectAll(new Error("WebSocket disconnected")),this.connectionManager&&(await this.connectionManager.stop(),this.connectionManager=null,this.ws=null),this.toolsCache=null}get publicIdentifier(){return{type:"websocket",url:this.url}}},Qe(rc,"WebSocketConnector"),rc),nc,K_=(nc=class{serverUrl;storageKeyPrefix;serverUrlHash;clientName;clientUri;callbackUrl;preventAutoAuth;onPopupWindow;constructor(e,r={}){this.serverUrl=e,this.storageKeyPrefix=r.storageKeyPrefix||"mcp:auth",this.serverUrlHash=this.hashString(e),this.clientName=r.clientName||"mcp-use",this.clientUri=r.clientUri||(typeof window<"u"?window.location.origin:""),this.callbackUrl=Ou(r.callbackUrl||(typeof window<"u"?new URL("/oauth/callback",window.location.origin).toString():"/oauth/callback")),this.preventAutoAuth=r.preventAutoAuth,this.onPopupWindow=r.onPopupWindow}get redirectUrl(){return Ou(this.callbackUrl)}get clientMetadata(){return{redirect_uris:[this.redirectUrl],token_endpoint_auth_method:"none",grant_types:["authorization_code","refresh_token"],response_types:["code"],client_name:this.clientName,client_uri:this.clientUri}}async clientInformation(){const e=this.getKey("client_info"),r=localStorage.getItem(e);if(r)try{return JSON.parse(r)}catch(n){console.warn(`[${this.storageKeyPrefix}] Failed to parse client information:`,n),localStorage.removeItem(e);return}}async saveClientInformation(e){const r=this.getKey("client_info");localStorage.setItem(r,JSON.stringify(e))}async tokens(){const e=this.getKey("tokens"),r=localStorage.getItem(e);if(r)try{return JSON.parse(r)}catch(n){console.warn(`[${this.storageKeyPrefix}] Failed to parse tokens:`,n),localStorage.removeItem(e);return}}async saveTokens(e){const r=this.getKey("tokens");localStorage.setItem(r,JSON.stringify(e)),localStorage.removeItem(this.getKey("code_verifier")),localStorage.removeItem(this.getKey("last_auth_url"))}async saveCodeVerifier(e){const r=this.getKey("code_verifier");localStorage.setItem(r,e)}async codeVerifier(){const e=this.getKey("code_verifier"),r=localStorage.getItem(e);if(!r)throw new Error(`[${this.storageKeyPrefix}] Code verifier not found in storage for key ${e}. Auth flow likely corrupted or timed out.`);return r}async prepareAuthorizationUrl(e){const r=globalThis.crypto.randomUUID(),n=`${this.storageKeyPrefix}:state_${r}`,a={serverUrlHash:this.serverUrlHash,expiry:Date.now()+1e3*60*10,providerOptions:{serverUrl:this.serverUrl,storageKeyPrefix:this.storageKeyPrefix,clientName:this.clientName,clientUri:this.clientUri,callbackUrl:this.callbackUrl}};localStorage.setItem(n,JSON.stringify(a)),e.searchParams.set("state",r);const s=e.toString(),l=Ou(s);return localStorage.setItem(this.getKey("last_auth_url"),l),l}async redirectToAuthorization(e){if(this.preventAutoAuth)return;const r=await this.prepareAuthorizationUrl(e),n="width=600,height=700,resizable=yes,scrollbars=yes,status=yes";try{const a=window.open(r,`mcp_auth_${this.serverUrlHash}`,n);this.onPopupWindow&&this.onPopupWindow(r,n,a),!a||a.closed||typeof a.closed>"u"?console.warn(`[${this.storageKeyPrefix}] Popup likely blocked by browser. Manual navigation might be required using the stored URL.`):(a.focus(),console.info(`[${this.storageKeyPrefix}] Redirecting to authorization URL in popup.`))}catch(a){console.error(`[${this.storageKeyPrefix}] Error opening popup window:`,a)}}getLastAttemptedAuthUrl(){const e=localStorage.getItem(this.getKey("last_auth_url"));return e?Ou(e):null}clearStorage(){const e=`${this.storageKeyPrefix}_${this.serverUrlHash}_`,r=`${this.storageKeyPrefix}:state_`,n=[];let a=0;for(let l=0;l<localStorage.length;l++){const c=localStorage.key(l);if(c){if(c.startsWith(e))n.push(c);else if(c.startsWith(r))try{const d=localStorage.getItem(c);d&&JSON.parse(d).serverUrlHash===this.serverUrlHash&&n.push(c)}catch(d){console.warn(`[${this.storageKeyPrefix}] Error parsing state key ${c} during clearStorage:`,d)}}}return[...new Set(n)].forEach(l=>{localStorage.removeItem(l),a++}),a}hashString(e){let r=0;for(let n=0;n<e.length;n++){const a=e.charCodeAt(n);r=(r<<5)-r+a,r=r&r}return Math.abs(r).toString(16)}getKey(e){return`${this.storageKeyPrefix}_${this.serverUrlHash}_${e}`}},Qe(nc,"BrowserOAuthClientProvider"),nc);async function T$(){const t=new URLSearchParams(window.location.search),e=t.get("code"),r=t.get("state"),n=t.get("error"),a=t.get("error_description"),s="[mcp-callback]";console.log(`${s} Handling callback...`,{code:e,state:r,error:n,errorDescription:a});let l=null,c=null;const d=r?`mcp:auth:state_${r}`:null;try{if(n)throw new Error(`OAuth error: ${n} - ${a||"No description provided."}`);if(!e)throw new Error("Authorization code not found in callback query parameters.");if(!r||!d)throw new Error("State parameter not found or invalid in callback query parameters.");const f=localStorage.getItem(d);if(!f)throw new Error(`Invalid or expired state parameter "${r}". No matching state found in storage.`);try{c=JSON.parse(f)}catch{throw new Error("Failed to parse stored OAuth state.")}if(!c.expiry||c.expiry<Date.now())throw localStorage.removeItem(d),new Error("OAuth state has expired. Please try initiating authentication again.");if(!c.providerOptions)throw new Error("Stored state is missing required provider options.");const{serverUrl:h,...g}=c.providerOptions;console.log(`${s} Re-instantiating provider for server: ${h}`),l=new K_(h,g),console.log(`${s} Calling SDK auth() to exchange code...`);const v=new URL(h).origin,y=await gs(l,{serverUrl:v,authorizationCode:e});if(y==="AUTHORIZED"){if(console.log(`${s} Authorization successful via SDK auth(). Notifying opener...`),window.opener&&!window.opener.closed)window.opener.postMessage({type:"mcp_auth_callback",success:!0},window.location.origin),window.close();else{console.warn(`${s} No opener window detected. Redirecting to root.`);const w=window.location.pathname.split("/").filter(Boolean),S=w.length>0&&w[w.length-1]==="callback"?"/"+w.slice(0,-2).join("/"):"/";window.location.href=S||"/"}localStorage.removeItem(d)}else throw console.warn(`${s} SDK auth() returned unexpected status: ${y}`),new Error(`Unexpected result from authentication library: ${y}`)}catch(f){console.error(`${s} Error during OAuth callback handling:`,f);const h=f instanceof Error?f.message:String(f);window.opener&&!window.opener.closed&&window.opener.postMessage({type:"mcp_auth_callback",success:!1,error:h},window.location.origin);try{document.body.innerHTML=`
|
|
7
7
|
<div style="font-family: sans-serif; padding: 20px;">
|
|
8
8
|
<h1>Authentication Error</h1>
|
|
9
9
|
<p style="color: red; background-color: #ffebeb; border: 1px solid red; padding: 10px; border-radius: 4px;">
|
|
@@ -62,7 +62,7 @@ Please change the parent <Route path="${_}"> to <Route path="${_==="/"?"*":`${_}
|
|
|
62
62
|
`)},tD=function(){var t=parseInt(document.body.getAttribute(ql)||"0",10);return isFinite(t)?t:0},jQ=function(){b.useEffect(function(){return document.body.setAttribute(ql,(tD()+1).toString()),function(){var t=tD()-1;t<=0?document.body.removeAttribute(ql):document.body.setAttribute(ql,t.toString())}},[])},UQ=function(t){var e=t.noRelative,r=t.noImportant,n=t.gapMode,a=n===void 0?"margin":n;jQ();var s=b.useMemo(function(){return LQ(a)},[a]);return b.createElement(MQ,{styles:PQ(s,!e,a,r?"":"!important")})},oT=!1;if(typeof window<"u")try{var Rp=Object.defineProperty({},"passive",{get:function(){return oT=!0,!0}});window.addEventListener("test",Rp,Rp),window.removeEventListener("test",Rp,Rp)}catch{oT=!1}var vl=oT?{passive:!1}:!1,FQ=function(t){return t.tagName==="TEXTAREA"},YB=function(t,e){if(!(t instanceof Element))return!1;var r=window.getComputedStyle(t);return r[e]!=="hidden"&&!(r.overflowY===r.overflowX&&!FQ(t)&&r[e]==="visible")},zQ=function(t){return YB(t,"overflowY")},$Q=function(t){return YB(t,"overflowX")},rD=function(t,e){var r=e.ownerDocument,n=e;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var a=KB(t,n);if(a){var s=ZB(t,n),l=s[1],c=s[2];if(l>c)return!0}n=n.parentNode}while(n&&n!==r.body);return!1},BQ=function(t){var e=t.scrollTop,r=t.scrollHeight,n=t.clientHeight;return[e,r,n]},qQ=function(t){var e=t.scrollLeft,r=t.scrollWidth,n=t.clientWidth;return[e,r,n]},KB=function(t,e){return t==="v"?zQ(e):$Q(e)},ZB=function(t,e){return t==="v"?BQ(e):qQ(e)},HQ=function(t,e){return t==="h"&&e==="rtl"?-1:1},VQ=function(t,e,r,n,a){var s=HQ(t,window.getComputedStyle(e).direction),l=s*n,c=r.target,d=e.contains(c),f=!1,h=l>0,g=0,v=0;do{if(!c)break;var y=ZB(t,c),w=y[0],S=y[1],T=y[2],x=S-T-s*w;(w||x)&&KB(t,c)&&(g+=x,v+=w);var _=c.parentNode;c=_&&_.nodeType===Node.DOCUMENT_FRAGMENT_NODE?_.host:_}while(!d&&c!==document.body||d&&(e.contains(c)||e===c));return(h&&Math.abs(g)<1||!h&&Math.abs(v)<1)&&(f=!0),f},Cp=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},nD=function(t){return[t.deltaX,t.deltaY]},aD=function(t){return t&&"current"in t?t.current:t},GQ=function(t,e){return t[0]===e[0]&&t[1]===e[1]},WQ=function(t){return`
|
|
63
63
|
.block-interactivity-`.concat(t,` {pointer-events: none;}
|
|
64
64
|
.allow-interactivity-`).concat(t,` {pointer-events: all;}
|
|
65
|
-
`)},YQ=0,bl=[];function KQ(t){var e=b.useRef([]),r=b.useRef([0,0]),n=b.useRef(),a=b.useState(YQ++)[0],s=b.useState(WB)[0],l=b.useRef(t);b.useEffect(function(){l.current=t},[t]),b.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(a));var S=gQ([t.lockRef.current],(t.shards||[]).map(aD),!0).filter(Boolean);return S.forEach(function(T){return T.classList.add("allow-interactivity-".concat(a))}),function(){document.body.classList.remove("block-interactivity-".concat(a)),S.forEach(function(T){return T.classList.remove("allow-interactivity-".concat(a))})}}},[t.inert,t.lockRef.current,t.shards]);var c=b.useCallback(function(S,T){if("touches"in S&&S.touches.length===2||S.type==="wheel"&&S.ctrlKey)return!l.current.allowPinchZoom;var x=Cp(S),_=r.current,C="deltaX"in S?S.deltaX:_[0]-x[0],N="deltaY"in S?S.deltaY:_[1]-x[1],k,A=S.target,I=Math.abs(C)>Math.abs(N)?"h":"v";if("touches"in S&&I==="h"&&A.type==="range")return!1;var O=rD(I,A);if(!O)return!0;if(O?k=I:(k=I==="v"?"h":"v",O=rD(I,A)),!O)return!1;if(!n.current&&"changedTouches"in S&&(C||N)&&(n.current=k),!k)return!0;var L=n.current||k;return VQ(L,T,S,L==="h"?C:N)},[]),d=b.useCallback(function(S){var T=S;if(!(!bl.length||bl[bl.length-1]!==s)){var x="deltaY"in T?nD(T):Cp(T),_=e.current.filter(function(k){return k.name===T.type&&(k.target===T.target||T.target===k.shadowParent)&&GQ(k.delta,x)})[0];if(_&&_.should){T.cancelable&&T.preventDefault();return}if(!_){var C=(l.current.shards||[]).map(aD).filter(Boolean).filter(function(k){return k.contains(T.target)}),N=C.length>0?c(T,C[0]):!l.current.noIsolation;N&&T.cancelable&&T.preventDefault()}}},[]),f=b.useCallback(function(S,T,x,_){var C={name:S,delta:T,target:x,should:_,shadowParent:ZQ(x)};e.current.push(C),setTimeout(function(){e.current=e.current.filter(function(N){return N!==C})},1)},[]),h=b.useCallback(function(S){r.current=Cp(S),n.current=void 0},[]),g=b.useCallback(function(S){f(S.type,nD(S),S.target,c(S,t.lockRef.current))},[]),v=b.useCallback(function(S){f(S.type,Cp(S),S.target,c(S,t.lockRef.current))},[]);b.useEffect(function(){return bl.push(s),t.setCallbacks({onScrollCapture:g,onWheelCapture:g,onTouchMoveCapture:v}),document.addEventListener("wheel",d,vl),document.addEventListener("touchmove",d,vl),document.addEventListener("touchstart",h,vl),function(){bl=bl.filter(function(S){return S!==s}),document.removeEventListener("wheel",d,vl),document.removeEventListener("touchmove",d,vl),document.removeEventListener("touchstart",h,vl)}},[]);var y=t.removeScrollBar,w=t.inert;return b.createElement(b.Fragment,null,w?b.createElement(s,{styles:WQ(a)}):null,y?b.createElement(UQ,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function ZQ(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const XQ=TQ(GB,KQ);var Vd=b.forwardRef(function(t,e){return b.createElement(nh,Pa({},t,{ref:e,sideCar:XQ}))});Vd.classNames=nh.classNames;var iT=["Enter"," "],QQ=["ArrowDown","PageUp","Home"],XB=["ArrowUp","PageDown","End"],JQ=[...QQ,...XB],eJ={ltr:[...iT,"ArrowRight"],rtl:[...iT,"ArrowLeft"]},tJ={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Gd="Menu",[gd,rJ,nJ]=AR(Gd),[Os,QB]=Qa(Gd,[nJ,Oi,UB]),ah=Oi(),JB=UB(),[aJ,Ds]=Os(Gd),[oJ,Wd]=Os(Gd),e4=t=>{const{__scopeMenu:e,open:r=!1,children:n,dir:a,onOpenChange:s,modal:l=!0}=t,c=ah(e),[d,f]=b.useState(null),h=b.useRef(!1),g=Ya(s),v=NR(a);return b.useEffect(()=>{const y=()=>{h.current=!0,document.addEventListener("pointerdown",w,{capture:!0,once:!0}),document.addEventListener("pointermove",w,{capture:!0,once:!0})},w=()=>h.current=!1;return document.addEventListener("keydown",y,{capture:!0}),()=>{document.removeEventListener("keydown",y,{capture:!0}),document.removeEventListener("pointerdown",w,{capture:!0}),document.removeEventListener("pointermove",w,{capture:!0})}},[]),p.jsx(Jm,{...c,children:p.jsx(aJ,{scope:e,open:r,onOpenChange:g,content:d,onContentChange:f,children:p.jsx(oJ,{scope:e,onClose:b.useCallback(()=>g(!1),[g]),isUsingKeyboardRef:h,dir:v,modal:l,children:n})})})};e4.displayName=Gd;var iJ="MenuAnchor",UR=b.forwardRef((t,e)=>{const{__scopeMenu:r,...n}=t,a=ah(r);return p.jsx(qd,{...a,...n,ref:e})});UR.displayName=iJ;var FR="MenuPortal",[sJ,t4]=Os(FR,{forceMount:void 0}),r4=t=>{const{__scopeMenu:e,forceMount:r,children:n,container:a}=t,s=Ds(FR,e);return p.jsx(sJ,{scope:e,forceMount:r,children:p.jsx(ua,{present:r||s.open,children:p.jsx(Cc,{asChild:!0,container:a,children:n})})})};r4.displayName=FR;var ia="MenuContent",[lJ,zR]=Os(ia),n4=b.forwardRef((t,e)=>{const r=t4(ia,t.__scopeMenu),{forceMount:n=r.forceMount,...a}=t,s=Ds(ia,t.__scopeMenu),l=Wd(ia,t.__scopeMenu);return p.jsx(gd.Provider,{scope:t.__scopeMenu,children:p.jsx(ua,{present:n||s.open,children:p.jsx(gd.Slot,{scope:t.__scopeMenu,children:l.modal?p.jsx(cJ,{...a,ref:e}):p.jsx(uJ,{...a,ref:e})})})})}),cJ=b.forwardRef((t,e)=>{const r=Ds(ia,t.__scopeMenu),n=b.useRef(null),a=kt(e,n);return b.useEffect(()=>{const s=n.current;if(s)return rh(s)},[]),p.jsx($R,{...t,ref:a,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:He(t.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)})}),uJ=b.forwardRef((t,e)=>{const r=Ds(ia,t.__scopeMenu);return p.jsx($R,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)})}),dJ=_s("MenuContent.ScrollLock"),$R=b.forwardRef((t,e)=>{const{__scopeMenu:r,loop:n=!1,trapFocus:a,onOpenAutoFocus:s,onCloseAutoFocus:l,disableOutsidePointerEvents:c,onEntryFocus:d,onEscapeKeyDown:f,onPointerDownOutside:h,onFocusOutside:g,onInteractOutside:v,onDismiss:y,disableOutsideScroll:w,...S}=t,T=Ds(ia,r),x=Wd(ia,r),_=ah(r),C=JB(r),N=rJ(r),[k,A]=b.useState(null),I=b.useRef(null),O=kt(e,I,T.onContentChange),L=b.useRef(0),M=b.useRef(""),P=b.useRef(0),W=b.useRef(null),X=b.useRef("right"),ee=b.useRef(0),J=w?Vd:b.Fragment,B=w?{as:dJ,allowPinchZoom:!0}:void 0,Y=re=>{const Q=M.current+re,j=N().filter(F=>!F.disabled),q=document.activeElement,z=j.find(F=>F.ref.current===q)?.textValue,G=j.map(F=>F.textValue),Z=wJ(G,Q,z),U=j.find(F=>F.textValue===Z)?.ref.current;(function F(te){M.current=te,window.clearTimeout(L.current),te!==""&&(L.current=window.setTimeout(()=>F(""),1e3))})(Q),U&&setTimeout(()=>U.focus())};b.useEffect(()=>()=>window.clearTimeout(L.current),[]),Ym();const H=b.useCallback(re=>X.current===W.current?.side&&TJ(re,W.current?.area),[]);return p.jsx(lJ,{scope:r,searchRef:M,onItemEnter:b.useCallback(re=>{H(re)&&re.preventDefault()},[H]),onItemLeave:b.useCallback(re=>{H(re)||(I.current?.focus(),A(null))},[H]),onTriggerLeave:b.useCallback(re=>{H(re)&&re.preventDefault()},[H]),pointerGraceTimerRef:P,onPointerGraceIntentChange:b.useCallback(re=>{W.current=re},[]),children:p.jsx(J,{...B,children:p.jsx($d,{asChild:!0,trapped:a,onMountAutoFocus:He(s,re=>{re.preventDefault(),I.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:l,children:p.jsx(_c,{asChild:!0,disableOutsidePointerEvents:c,onEscapeKeyDown:f,onPointerDownOutside:h,onFocusOutside:g,onInteractOutside:v,onDismiss:y,children:p.jsx(dQ,{asChild:!0,...C,dir:x.dir,orientation:"vertical",loop:n,currentTabStopId:k,onCurrentTabStopIdChange:A,onEntryFocus:He(d,re=>{x.isUsingKeyboardRef.current||re.preventDefault()}),preventScrollOnEntryFocus:!0,children:p.jsx(eh,{role:"menu","aria-orientation":"vertical","data-state":y4(T.open),"data-radix-menu-content":"",dir:x.dir,..._,...S,ref:O,style:{outline:"none",...S.style},onKeyDown:He(S.onKeyDown,re=>{const j=re.target.closest("[data-radix-menu-content]")===re.currentTarget,q=re.ctrlKey||re.altKey||re.metaKey,z=re.key.length===1;j&&(re.key==="Tab"&&re.preventDefault(),!q&&z&&Y(re.key));const G=I.current;if(re.target!==G||!JQ.includes(re.key))return;re.preventDefault();const U=N().filter(F=>!F.disabled).map(F=>F.ref.current);XB.includes(re.key)&&U.reverse(),SJ(U)}),onBlur:He(t.onBlur,re=>{re.currentTarget.contains(re.target)||(window.clearTimeout(L.current),M.current="")}),onPointerMove:He(t.onPointerMove,vd(re=>{const Q=re.target,j=ee.current!==re.clientX;if(re.currentTarget.contains(Q)&&j){const q=re.clientX>ee.current?"right":"left";X.current=q,ee.current=re.clientX}}))})})})})})})});n4.displayName=ia;var fJ="MenuGroup",BR=b.forwardRef((t,e)=>{const{__scopeMenu:r,...n}=t;return p.jsx(yt.div,{role:"group",...n,ref:e})});BR.displayName=fJ;var pJ="MenuLabel",a4=b.forwardRef((t,e)=>{const{__scopeMenu:r,...n}=t;return p.jsx(yt.div,{...n,ref:e})});a4.displayName=pJ;var Cm="MenuItem",oD="menu.itemSelect",oh=b.forwardRef((t,e)=>{const{disabled:r=!1,onSelect:n,...a}=t,s=b.useRef(null),l=Wd(Cm,t.__scopeMenu),c=zR(Cm,t.__scopeMenu),d=kt(e,s),f=b.useRef(!1),h=()=>{const g=s.current;if(!r&&g){const v=new CustomEvent(oD,{bubbles:!0,cancelable:!0});g.addEventListener(oD,y=>n?.(y),{once:!0}),dB(g,v),v.defaultPrevented?f.current=!1:l.onClose()}};return p.jsx(o4,{...a,ref:d,disabled:r,onClick:He(t.onClick,h),onPointerDown:g=>{t.onPointerDown?.(g),f.current=!0},onPointerUp:He(t.onPointerUp,g=>{f.current||g.currentTarget?.click()}),onKeyDown:He(t.onKeyDown,g=>{const v=c.searchRef.current!=="";r||v&&g.key===" "||iT.includes(g.key)&&(g.currentTarget.click(),g.preventDefault())})})});oh.displayName=Cm;var o4=b.forwardRef((t,e)=>{const{__scopeMenu:r,disabled:n=!1,textValue:a,...s}=t,l=zR(Cm,r),c=JB(r),d=b.useRef(null),f=kt(e,d),[h,g]=b.useState(!1),[v,y]=b.useState("");return b.useEffect(()=>{const w=d.current;w&&y((w.textContent??"").trim())},[s.children]),p.jsx(gd.ItemSlot,{scope:r,disabled:n,textValue:a??v,children:p.jsx(fQ,{asChild:!0,...c,focusable:!n,children:p.jsx(yt.div,{role:"menuitem","data-highlighted":h?"":void 0,"aria-disabled":n||void 0,"data-disabled":n?"":void 0,...s,ref:f,onPointerMove:He(t.onPointerMove,vd(w=>{n?l.onItemLeave(w):(l.onItemEnter(w),w.defaultPrevented||w.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:He(t.onPointerLeave,vd(w=>l.onItemLeave(w))),onFocus:He(t.onFocus,()=>g(!0)),onBlur:He(t.onBlur,()=>g(!1))})})})}),mJ="MenuCheckboxItem",i4=b.forwardRef((t,e)=>{const{checked:r=!1,onCheckedChange:n,...a}=t;return p.jsx(d4,{scope:t.__scopeMenu,checked:r,children:p.jsx(oh,{role:"menuitemcheckbox","aria-checked":Am(r)?"mixed":r,...a,ref:e,"data-state":HR(r),onSelect:He(a.onSelect,()=>n?.(Am(r)?!0:!r),{checkForDefaultPrevented:!1})})})});i4.displayName=mJ;var s4="MenuRadioGroup",[hJ,gJ]=Os(s4,{value:void 0,onValueChange:()=>{}}),l4=b.forwardRef((t,e)=>{const{value:r,onValueChange:n,...a}=t,s=Ya(n);return p.jsx(hJ,{scope:t.__scopeMenu,value:r,onValueChange:s,children:p.jsx(BR,{...a,ref:e})})});l4.displayName=s4;var c4="MenuRadioItem",u4=b.forwardRef((t,e)=>{const{value:r,...n}=t,a=gJ(c4,t.__scopeMenu),s=r===a.value;return p.jsx(d4,{scope:t.__scopeMenu,checked:s,children:p.jsx(oh,{role:"menuitemradio","aria-checked":s,...n,ref:e,"data-state":HR(s),onSelect:He(n.onSelect,()=>a.onValueChange?.(r),{checkForDefaultPrevented:!1})})})});u4.displayName=c4;var qR="MenuItemIndicator",[d4,vJ]=Os(qR,{checked:!1}),f4=b.forwardRef((t,e)=>{const{__scopeMenu:r,forceMount:n,...a}=t,s=vJ(qR,r);return p.jsx(ua,{present:n||Am(s.checked)||s.checked===!0,children:p.jsx(yt.span,{...a,ref:e,"data-state":HR(s.checked)})})});f4.displayName=qR;var bJ="MenuSeparator",p4=b.forwardRef((t,e)=>{const{__scopeMenu:r,...n}=t;return p.jsx(yt.div,{role:"separator","aria-orientation":"horizontal",...n,ref:e})});p4.displayName=bJ;var yJ="MenuArrow",m4=b.forwardRef((t,e)=>{const{__scopeMenu:r,...n}=t,a=ah(r);return p.jsx(th,{...a,...n,ref:e})});m4.displayName=yJ;var EJ="MenuSub",[MEe,h4]=Os(EJ),Du="MenuSubTrigger",g4=b.forwardRef((t,e)=>{const r=Ds(Du,t.__scopeMenu),n=Wd(Du,t.__scopeMenu),a=h4(Du,t.__scopeMenu),s=zR(Du,t.__scopeMenu),l=b.useRef(null),{pointerGraceTimerRef:c,onPointerGraceIntentChange:d}=s,f={__scopeMenu:t.__scopeMenu},h=b.useCallback(()=>{l.current&&window.clearTimeout(l.current),l.current=null},[]);return b.useEffect(()=>h,[h]),b.useEffect(()=>{const g=c.current;return()=>{window.clearTimeout(g),d(null)}},[c,d]),p.jsx(UR,{asChild:!0,...f,children:p.jsx(o4,{id:a.triggerId,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":a.contentId,"data-state":y4(r.open),...t,ref:Ga(e,a.onTriggerChange),onClick:g=>{t.onClick?.(g),!(t.disabled||g.defaultPrevented)&&(g.currentTarget.focus(),r.open||r.onOpenChange(!0))},onPointerMove:He(t.onPointerMove,vd(g=>{s.onItemEnter(g),!g.defaultPrevented&&!t.disabled&&!r.open&&!l.current&&(s.onPointerGraceIntentChange(null),l.current=window.setTimeout(()=>{r.onOpenChange(!0),h()},100))})),onPointerLeave:He(t.onPointerLeave,vd(g=>{h();const v=r.content?.getBoundingClientRect();if(v){const y=r.content?.dataset.side,w=y==="right",S=w?-5:5,T=v[w?"left":"right"],x=v[w?"right":"left"];s.onPointerGraceIntentChange({area:[{x:g.clientX+S,y:g.clientY},{x:T,y:v.top},{x,y:v.top},{x,y:v.bottom},{x:T,y:v.bottom}],side:y}),window.clearTimeout(c.current),c.current=window.setTimeout(()=>s.onPointerGraceIntentChange(null),300)}else{if(s.onTriggerLeave(g),g.defaultPrevented)return;s.onPointerGraceIntentChange(null)}})),onKeyDown:He(t.onKeyDown,g=>{const v=s.searchRef.current!=="";t.disabled||v&&g.key===" "||eJ[n.dir].includes(g.key)&&(r.onOpenChange(!0),r.content?.focus(),g.preventDefault())})})})});g4.displayName=Du;var v4="MenuSubContent",b4=b.forwardRef((t,e)=>{const r=t4(ia,t.__scopeMenu),{forceMount:n=r.forceMount,...a}=t,s=Ds(ia,t.__scopeMenu),l=Wd(ia,t.__scopeMenu),c=h4(v4,t.__scopeMenu),d=b.useRef(null),f=kt(e,d);return p.jsx(gd.Provider,{scope:t.__scopeMenu,children:p.jsx(ua,{present:n||s.open,children:p.jsx(gd.Slot,{scope:t.__scopeMenu,children:p.jsx($R,{id:c.contentId,"aria-labelledby":c.triggerId,...a,ref:f,align:"start",side:l.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:h=>{l.isUsingKeyboardRef.current&&d.current?.focus(),h.preventDefault()},onCloseAutoFocus:h=>h.preventDefault(),onFocusOutside:He(t.onFocusOutside,h=>{h.target!==c.trigger&&s.onOpenChange(!1)}),onEscapeKeyDown:He(t.onEscapeKeyDown,h=>{l.onClose(),h.preventDefault()}),onKeyDown:He(t.onKeyDown,h=>{const g=h.currentTarget.contains(h.target),v=tJ[l.dir].includes(h.key);g&&v&&(s.onOpenChange(!1),c.trigger?.focus(),h.preventDefault())})})})})})});b4.displayName=v4;function y4(t){return t?"open":"closed"}function Am(t){return t==="indeterminate"}function HR(t){return Am(t)?"indeterminate":t?"checked":"unchecked"}function SJ(t){const e=document.activeElement;for(const r of t)if(r===e||(r.focus(),document.activeElement!==e))return}function xJ(t,e){return t.map((r,n)=>t[(e+n)%t.length])}function wJ(t,e,r){const a=e.length>1&&Array.from(e).every(f=>f===e[0])?e[0]:e,s=r?t.indexOf(r):-1;let l=xJ(t,Math.max(s,0));a.length===1&&(l=l.filter(f=>f!==r));const d=l.find(f=>f.toLowerCase().startsWith(a.toLowerCase()));return d!==r?d:void 0}function _J(t,e){const{x:r,y:n}=t;let a=!1;for(let s=0,l=e.length-1;s<e.length;l=s++){const c=e[s],d=e[l],f=c.x,h=c.y,g=d.x,v=d.y;h>n!=v>n&&r<(g-f)*(n-h)/(v-h)+f&&(a=!a)}return a}function TJ(t,e){if(!e)return!1;const r={x:t.clientX,y:t.clientY};return _J(r,e)}function vd(t){return e=>e.pointerType==="mouse"?t(e):void 0}var RJ=e4,CJ=UR,AJ=r4,NJ=n4,kJ=BR,IJ=a4,OJ=oh,DJ=i4,LJ=l4,MJ=u4,PJ=f4,jJ=p4,UJ=m4,FJ=g4,zJ=b4,ih="DropdownMenu",[$J]=Qa(ih,[QB]),fn=QB(),[BJ,E4]=$J(ih),S4=t=>{const{__scopeDropdownMenu:e,children:r,dir:n,open:a,defaultOpen:s,onOpenChange:l,modal:c=!0}=t,d=fn(e),f=b.useRef(null),[h,g]=Ri({prop:a,defaultProp:s??!1,onChange:l,caller:ih});return p.jsx(BJ,{scope:e,triggerId:Xr(),triggerRef:f,contentId:Xr(),open:h,onOpenChange:g,onOpenToggle:b.useCallback(()=>g(v=>!v),[g]),modal:c,children:p.jsx(RJ,{...d,open:h,onOpenChange:g,dir:n,modal:c,children:r})})};S4.displayName=ih;var x4="DropdownMenuTrigger",w4=b.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,disabled:n=!1,...a}=t,s=E4(x4,r),l=fn(r);return p.jsx(CJ,{asChild:!0,...l,children:p.jsx(yt.button,{type:"button",id:s.triggerId,"aria-haspopup":"menu","aria-expanded":s.open,"aria-controls":s.open?s.contentId:void 0,"data-state":s.open?"open":"closed","data-disabled":n?"":void 0,disabled:n,...a,ref:Ga(e,s.triggerRef),onPointerDown:He(t.onPointerDown,c=>{!n&&c.button===0&&c.ctrlKey===!1&&(s.onOpenToggle(),s.open||c.preventDefault())}),onKeyDown:He(t.onKeyDown,c=>{n||(["Enter"," "].includes(c.key)&&s.onOpenToggle(),c.key==="ArrowDown"&&s.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(c.key)&&c.preventDefault())})})})});w4.displayName=x4;var qJ="DropdownMenuPortal",_4=t=>{const{__scopeDropdownMenu:e,...r}=t,n=fn(e);return p.jsx(AJ,{...n,...r})};_4.displayName=qJ;var T4="DropdownMenuContent",R4=b.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,a=E4(T4,r),s=fn(r),l=b.useRef(!1);return p.jsx(NJ,{id:a.contentId,"aria-labelledby":a.triggerId,...s,...n,ref:e,onCloseAutoFocus:He(t.onCloseAutoFocus,c=>{l.current||a.triggerRef.current?.focus(),l.current=!1,c.preventDefault()}),onInteractOutside:He(t.onInteractOutside,c=>{const d=c.detail.originalEvent,f=d.button===0&&d.ctrlKey===!0,h=d.button===2||f;(!a.modal||h)&&(l.current=!0)}),style:{...t.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)"}})});R4.displayName=T4;var HJ="DropdownMenuGroup",VJ=b.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,a=fn(r);return p.jsx(kJ,{...a,...n,ref:e})});VJ.displayName=HJ;var GJ="DropdownMenuLabel",C4=b.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,a=fn(r);return p.jsx(IJ,{...a,...n,ref:e})});C4.displayName=GJ;var WJ="DropdownMenuItem",A4=b.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,a=fn(r);return p.jsx(OJ,{...a,...n,ref:e})});A4.displayName=WJ;var YJ="DropdownMenuCheckboxItem",N4=b.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,a=fn(r);return p.jsx(DJ,{...a,...n,ref:e})});N4.displayName=YJ;var KJ="DropdownMenuRadioGroup",ZJ=b.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,a=fn(r);return p.jsx(LJ,{...a,...n,ref:e})});ZJ.displayName=KJ;var XJ="DropdownMenuRadioItem",k4=b.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,a=fn(r);return p.jsx(MJ,{...a,...n,ref:e})});k4.displayName=XJ;var QJ="DropdownMenuItemIndicator",JJ=b.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,a=fn(r);return p.jsx(PJ,{...a,...n,ref:e})});JJ.displayName=QJ;var eee="DropdownMenuSeparator",I4=b.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,a=fn(r);return p.jsx(jJ,{...a,...n,ref:e})});I4.displayName=eee;var tee="DropdownMenuArrow",ree=b.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,a=fn(r);return p.jsx(UJ,{...a,...n,ref:e})});ree.displayName=tee;var nee="DropdownMenuSubTrigger",O4=b.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,a=fn(r);return p.jsx(FJ,{...a,...n,ref:e})});O4.displayName=nee;var aee="DropdownMenuSubContent",D4=b.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,a=fn(r);return p.jsx(zJ,{...a,...n,ref:e,style:{...t.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)"}})});D4.displayName=aee;var oee=S4,iee=w4,see=_4,L4=R4,M4=C4,P4=A4,lee=N4,cee=k4,j4=I4,uee=O4,dee=D4;const sT=oee,lT=iee;uee.displayName;dee.displayName;function Nm({ref:t,className:e,sideOffset:r=4,...n}){return p.jsx(see,{children:p.jsx(L4,{ref:t,sideOffset:r,className:De("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",e),...n})})}Nm.displayName=L4.displayName;function Co({ref:t,className:e,inset:r,...n}){return p.jsx(P4,{ref:t,className:De("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",r&&"pl-8",e),...n})}Co.displayName=P4.displayName;lee.displayName;cee.displayName;function cT({ref:t,className:e,inset:r,...n}){return p.jsx(M4,{ref:t,className:De("px-2 py-1.5 text-sm font-semibold",r&&"pl-8",e),...n})}cT.displayName=M4.displayName;function Lu({ref:t,className:e,...r}){return p.jsx(j4,{ref:t,className:De("-mx-1 my-1 h-px bg-muted",e),...r})}Lu.displayName=j4.displayName;var fee=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],$o=fee.reduce((t,e)=>{const r=W$(`Primitive.${e}`),n=b.forwardRef((a,s)=>{const{asChild:l,...c}=a,d=l?r:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),p.jsx(d,{...c,ref:s})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{}),pee="Label",U4=b.forwardRef((t,e)=>p.jsx($o.label,{...t,ref:e,onMouseDown:r=>{r.target.closest("button, input, select, textarea")||(t.onMouseDown?.(r),!r.defaultPrevented&&r.detail>1&&r.preventDefault())}}));U4.displayName=pee;var mee=U4;function lr({className:t,...e}){return p.jsx(mee,{"data-slot":"label",className:De("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",t),...e})}function VR({message:t,className:e="",vertical:r,noBorder:n}){return p.jsx("div",{className:De(`mt-2 rounded-md p-6 ${e}`,!n&&"border"),children:p.jsxs("p",{className:De("text-sm text-muted-foreground flex items-center gap-4",r&&"flex-col"),children:[p.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:p.jsx("g",{stroke:"none",strokeWidth:"1",fill:"none",fillRule:"evenodd",children:p.jsxs("g",{transform:"translate(5.320900, 5.320900)",fillRule:"nonzero",className:"stroke-black dark:stroke-white",strokeWidth:"4",children:[p.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"}),p.jsx("circle",{cx:"50",cy:"212.0001",r:"52.5"}),p.jsx("circle",{cx:"212.0001",cy:"50",r:"52.5"})]})})}),t]})})}function F4({className:t,color:e,children:r,grayscaled:n=!1}){const a=b.useMemo(()=>{if(e){const g=e.split("(")[1].split(")")[0].trim().split(/\s+/);return Number.parseFloat(g[1]||"0")}return n?0:.2},[e,n]),s=b.useMemo(()=>{if(e){const g=e.split("(")[1].split(")")[0].trim().split(/\s+/);return Number.parseFloat(g[0]||"0.5")}return n?.3:.4},[e,n]),l=b.useMemo(()=>{if(e){const g=e.split("(")[1].split(")")[0].trim().split(/\s+/);return Number.parseFloat(g[2]||"0")}return Math.floor(Math.random()*360)},[e]),c=b.useMemo(()=>e||`oklch(${Math.min(s,1)} ${a} ${l})`,[l,a,s]),d=b.useMemo(()=>`oklch(${Math.min(s*2,1)} ${a} ${l})`,[l,a,s,e]),f=b.useMemo(()=>Math.floor(Math.random()*360),[l]),h=b.useMemo(()=>"1000%",[]);return p.jsx("section",{className:De("relative w-full h-full overflow-hidden",t),style:{background:`${d}`},children:p.jsxs("div",{className:"isolate relative w-full h-full",children:[p.jsx("div",{className:"noise w-full h-full",style:{background:`linear-gradient(${f}deg, ${c}, transparent), url(https://grainy-gradients.vercel.app/noise.svg)`,filter:`contrast(120%) brightness(${h})`}}),r&&p.jsx("div",{className:"relative z-10 w-full h-full",children:r})]})})}function z4(t){const e=b.useRef({value:t,previous:t});return b.useMemo(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}var sh="Switch",[hee]=Qa(sh),[gee,vee]=hee(sh),$4=b.forwardRef((t,e)=>{const{__scopeSwitch:r,name:n,checked:a,defaultChecked:s,required:l,disabled:c,value:d="on",onCheckedChange:f,form:h,...g}=t,[v,y]=b.useState(null),w=kt(e,C=>y(C)),S=b.useRef(!1),T=v?h||!!v.closest("form"):!0,[x,_]=Ri({prop:a,defaultProp:s??!1,onChange:f,caller:sh});return p.jsxs(gee,{scope:r,checked:x,disabled:c,children:[p.jsx(yt.button,{type:"button",role:"switch","aria-checked":x,"aria-required":l,"data-state":V4(x),"data-disabled":c?"":void 0,disabled:c,value:d,...g,ref:w,onClick:He(t.onClick,C=>{_(N=>!N),T&&(S.current=C.isPropagationStopped(),S.current||C.stopPropagation())})}),T&&p.jsx(H4,{control:v,bubbles:!S.current,name:n,value:d,checked:x,required:l,disabled:c,form:h,style:{transform:"translateX(-100%)"}})]})});$4.displayName=sh;var B4="SwitchThumb",q4=b.forwardRef((t,e)=>{const{__scopeSwitch:r,...n}=t,a=vee(B4,r);return p.jsx(yt.span,{"data-state":V4(a.checked),"data-disabled":a.disabled?"":void 0,...n,ref:e})});q4.displayName=B4;var bee="SwitchBubbleInput",H4=b.forwardRef(({__scopeSwitch:t,control:e,checked:r,bubbles:n=!0,...a},s)=>{const l=b.useRef(null),c=kt(l,s),d=z4(r),f=CB(e);return b.useEffect(()=>{const h=l.current;if(!h)return;const g=window.HTMLInputElement.prototype,y=Object.getOwnPropertyDescriptor(g,"checked").set;if(d!==r&&y){const w=new Event("click",{bubbles:n});y.call(h,r),h.dispatchEvent(w)}},[d,r,n]),p.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:r,...a,tabIndex:-1,ref:c,style:{...a.style,...f,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});H4.displayName=bee;function V4(t){return t?"checked":"unchecked"}var G4=$4,yee=q4;function GR({ref:t,className:e,...r}){return p.jsx(G4,{className:De("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",e),...r,ref:t,children:p.jsx(yee,{className:De("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")})})}GR.displayName=G4.displayName;var W4=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"}),Eee="VisuallyHidden",Y4=b.forwardRef((t,e)=>p.jsx(yt.span,{...t,ref:e,style:{...W4,...t.style}}));Y4.displayName=Eee;var See=Y4,[lh]=Qa("Tooltip",[Oi]),ch=Oi(),K4="TooltipProvider",xee=700,uT="tooltip.open",[wee,WR]=lh(K4),Z4=t=>{const{__scopeTooltip:e,delayDuration:r=xee,skipDelayDuration:n=300,disableHoverableContent:a=!1,children:s}=t,l=b.useRef(!0),c=b.useRef(!1),d=b.useRef(0);return b.useEffect(()=>{const f=d.current;return()=>window.clearTimeout(f)},[]),p.jsx(wee,{scope:e,isOpenDelayedRef:l,delayDuration:r,onOpen:b.useCallback(()=>{window.clearTimeout(d.current),l.current=!1},[]),onClose:b.useCallback(()=>{window.clearTimeout(d.current),d.current=window.setTimeout(()=>l.current=!0,n)},[n]),isPointerInTransitRef:c,onPointerInTransitChange:b.useCallback(f=>{c.current=f},[]),disableHoverableContent:a,children:s})};Z4.displayName=K4;var bd="Tooltip",[_ee,Yd]=lh(bd),X4=t=>{const{__scopeTooltip:e,children:r,open:n,defaultOpen:a,onOpenChange:s,disableHoverableContent:l,delayDuration:c}=t,d=WR(bd,t.__scopeTooltip),f=ch(e),[h,g]=b.useState(null),v=Xr(),y=b.useRef(0),w=l??d.disableHoverableContent,S=c??d.delayDuration,T=b.useRef(!1),[x,_]=Ri({prop:n,defaultProp:a??!1,onChange:I=>{I?(d.onOpen(),document.dispatchEvent(new CustomEvent(uT))):d.onClose(),s?.(I)},caller:bd}),C=b.useMemo(()=>x?T.current?"delayed-open":"instant-open":"closed",[x]),N=b.useCallback(()=>{window.clearTimeout(y.current),y.current=0,T.current=!1,_(!0)},[_]),k=b.useCallback(()=>{window.clearTimeout(y.current),y.current=0,_(!1)},[_]),A=b.useCallback(()=>{window.clearTimeout(y.current),y.current=window.setTimeout(()=>{T.current=!0,_(!0),y.current=0},S)},[S,_]);return b.useEffect(()=>()=>{y.current&&(window.clearTimeout(y.current),y.current=0)},[]),p.jsx(Jm,{...f,children:p.jsx(_ee,{scope:e,contentId:v,open:x,stateAttribute:C,trigger:h,onTriggerChange:g,onTriggerEnter:b.useCallback(()=>{d.isOpenDelayedRef.current?A():N()},[d.isOpenDelayedRef,A,N]),onTriggerLeave:b.useCallback(()=>{w?k():(window.clearTimeout(y.current),y.current=0)},[k,w]),onOpen:N,onClose:k,disableHoverableContent:w,children:r})})};X4.displayName=bd;var dT="TooltipTrigger",Q4=b.forwardRef((t,e)=>{const{__scopeTooltip:r,...n}=t,a=Yd(dT,r),s=WR(dT,r),l=ch(r),c=b.useRef(null),d=kt(e,c,a.onTriggerChange),f=b.useRef(!1),h=b.useRef(!1),g=b.useCallback(()=>f.current=!1,[]);return b.useEffect(()=>()=>document.removeEventListener("pointerup",g),[g]),p.jsx(qd,{asChild:!0,...l,children:p.jsx(yt.button,{"aria-describedby":a.open?a.contentId:void 0,"data-state":a.stateAttribute,...n,ref:d,onPointerMove:He(t.onPointerMove,v=>{v.pointerType!=="touch"&&!h.current&&!s.isPointerInTransitRef.current&&(a.onTriggerEnter(),h.current=!0)}),onPointerLeave:He(t.onPointerLeave,()=>{a.onTriggerLeave(),h.current=!1}),onPointerDown:He(t.onPointerDown,()=>{a.open&&a.onClose(),f.current=!0,document.addEventListener("pointerup",g,{once:!0})}),onFocus:He(t.onFocus,()=>{f.current||a.onOpen()}),onBlur:He(t.onBlur,a.onClose),onClick:He(t.onClick,a.onClose)})})});Q4.displayName=dT;var YR="TooltipPortal",[Tee,Ree]=lh(YR,{forceMount:void 0}),J4=t=>{const{__scopeTooltip:e,forceMount:r,children:n,container:a}=t,s=Yd(YR,e);return p.jsx(Tee,{scope:e,forceMount:r,children:p.jsx(ua,{present:r||s.open,children:p.jsx(Cc,{asChild:!0,container:a,children:n})})})};J4.displayName=YR;var cc="TooltipContent",e3=b.forwardRef((t,e)=>{const r=Ree(cc,t.__scopeTooltip),{forceMount:n=r.forceMount,side:a="top",...s}=t,l=Yd(cc,t.__scopeTooltip);return p.jsx(ua,{present:n||l.open,children:l.disableHoverableContent?p.jsx(t3,{side:a,...s,ref:e}):p.jsx(Cee,{side:a,...s,ref:e})})}),Cee=b.forwardRef((t,e)=>{const r=Yd(cc,t.__scopeTooltip),n=WR(cc,t.__scopeTooltip),a=b.useRef(null),s=kt(e,a),[l,c]=b.useState(null),{trigger:d,onClose:f}=r,h=a.current,{onPointerInTransitChange:g}=n,v=b.useCallback(()=>{c(null),g(!1)},[g]),y=b.useCallback((w,S)=>{const T=w.currentTarget,x={x:w.clientX,y:w.clientY},_=Iee(x,T.getBoundingClientRect()),C=Oee(x,_),N=Dee(S.getBoundingClientRect()),k=Mee([...C,...N]);c(k),g(!0)},[g]);return b.useEffect(()=>()=>v(),[v]),b.useEffect(()=>{if(d&&h){const w=T=>y(T,h),S=T=>y(T,d);return d.addEventListener("pointerleave",w),h.addEventListener("pointerleave",S),()=>{d.removeEventListener("pointerleave",w),h.removeEventListener("pointerleave",S)}}},[d,h,y,v]),b.useEffect(()=>{if(l){const w=S=>{const T=S.target,x={x:S.clientX,y:S.clientY},_=d?.contains(T)||h?.contains(T),C=!Lee(x,l);_?v():C&&(v(),f())};return document.addEventListener("pointermove",w),()=>document.removeEventListener("pointermove",w)}},[d,h,l,f,v]),p.jsx(t3,{...t,ref:s})}),[Aee,Nee]=lh(bd,{isInside:!1}),kee=uZ("TooltipContent"),t3=b.forwardRef((t,e)=>{const{__scopeTooltip:r,children:n,"aria-label":a,onEscapeKeyDown:s,onPointerDownOutside:l,...c}=t,d=Yd(cc,r),f=ch(r),{onClose:h}=d;return b.useEffect(()=>(document.addEventListener(uT,h),()=>document.removeEventListener(uT,h)),[h]),b.useEffect(()=>{if(d.trigger){const g=v=>{v.target?.contains(d.trigger)&&h()};return window.addEventListener("scroll",g,{capture:!0}),()=>window.removeEventListener("scroll",g,{capture:!0})}},[d.trigger,h]),p.jsx(_c,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:l,onFocusOutside:g=>g.preventDefault(),onDismiss:h,children:p.jsxs(eh,{"data-state":d.stateAttribute,...f,...c,ref:e,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:[p.jsx(kee,{children:n}),p.jsx(Aee,{scope:r,isInside:!0,children:p.jsx(See,{id:d.contentId,role:"tooltip",children:a||n})})]})})});e3.displayName=cc;var r3="TooltipArrow",n3=b.forwardRef((t,e)=>{const{__scopeTooltip:r,...n}=t,a=ch(r);return Nee(r3,r).isInside?null:p.jsx(th,{...a,...n,ref:e})});n3.displayName=r3;function Iee(t,e){const r=Math.abs(e.top-t.y),n=Math.abs(e.bottom-t.y),a=Math.abs(e.right-t.x),s=Math.abs(e.left-t.x);switch(Math.min(r,n,a,s)){case s:return"left";case a:return"right";case r:return"top";case n:return"bottom";default:throw new Error("unreachable")}}function Oee(t,e,r=5){const n=[];switch(e){case"top":n.push({x:t.x-r,y:t.y+r},{x:t.x+r,y:t.y+r});break;case"bottom":n.push({x:t.x-r,y:t.y-r},{x:t.x+r,y:t.y-r});break;case"left":n.push({x:t.x+r,y:t.y-r},{x:t.x+r,y:t.y+r});break;case"right":n.push({x:t.x-r,y:t.y-r},{x:t.x-r,y:t.y+r});break}return n}function Dee(t){const{top:e,right:r,bottom:n,left:a}=t;return[{x:a,y:e},{x:r,y:e},{x:r,y:n},{x:a,y:n}]}function Lee(t,e){const{x:r,y:n}=t;let a=!1;for(let s=0,l=e.length-1;s<e.length;l=s++){const c=e[s],d=e[l],f=c.x,h=c.y,g=d.x,v=d.y;h>n!=v>n&&r<(g-f)*(n-h)/(v-h)+f&&(a=!a)}return a}function Mee(t){const e=t.slice();return e.sort((r,n)=>r.x<n.x?-1:r.x>n.x?1:r.y<n.y?-1:r.y>n.y?1:0),Pee(e)}function Pee(t){if(t.length<=1)return t.slice();const e=[];for(let n=0;n<t.length;n++){const a=t[n];for(;e.length>=2;){const s=e[e.length-1],l=e[e.length-2];if((s.x-l.x)*(a.y-l.y)>=(s.y-l.y)*(a.x-l.x))e.pop();else break}e.push(a)}e.pop();const r=[];for(let n=t.length-1;n>=0;n--){const a=t[n];for(;r.length>=2;){const s=r[r.length-1],l=r[r.length-2];if((s.x-l.x)*(a.y-l.y)>=(s.y-l.y)*(a.x-l.x))r.pop();else break}r.push(a)}return r.pop(),e.length===1&&r.length===1&&e[0].x===r[0].x&&e[0].y===r[0].y?e:e.concat(r)}var jee=Z4,Uee=X4,Fee=Q4,zee=J4,$ee=e3,Bee=n3;function a3({delayDuration:t=0,...e}){return p.jsx(jee,{"data-slot":"tooltip-provider",delayDuration:t,...e})}function Sr({...t}){return p.jsx(a3,{children:p.jsx(Uee,{"data-slot":"tooltip",...t})})}function xr({...t}){return p.jsx(Fee,{"data-slot":"tooltip-trigger",...t})}function wr({className:t,sideOffset:e=0,children:r,...n}){return p.jsx(zee,{children:p.jsxs($ee,{"data-slot":"tooltip-content",sideOffset:e,className:De("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",t),...n,children:[r,p.jsx(Bee,{className:"bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}class qee{name="mcp_inspector_open";properties;constructor(e){this.properties={server_url:e.serverUrl,connection_count:e.connectionCount}}}class iD{name="mcp_tool_execution";properties;constructor(e){this.properties={tool_name:e.toolName,server_id:e.serverId,success:e.success,duration:e.duration,error:e.error}}}class sD{name="mcp_resource_read";properties;constructor(e){this.properties={resource_uri:e.resourceUri,server_id:e.serverId,success:e.success,error:e.error}}}class lD{name="mcp_prompt_call";properties;constructor(e){this.properties={prompt_name:e.promptName,server_id:e.serverId,success:e.success,error:e.error}}}class cD{name="mcp_chat_message";properties;constructor(e){this.properties={server_id:e.serverId,provider:e.provider,model:e.model,message_count:e.messageCount,tool_calls_count:e.toolCallsCount,success:e.success,execution_mode:e.executionMode,duration:e.duration,error:e.error}}}class Hee{name="mcp_server_added";properties;constructor(e){this.properties={server_id:e.serverId,server_url:e.serverUrl,connection_type:e.connectionType,via_proxy:e.viaProxy}}}class Vee{name="mcp_server_removed";properties;constructor(e){this.properties={server_id:e.serverId}}}class Gee{name="mcp_command_palette_open";properties;constructor(e){this.properties={trigger:e.trigger}}}class Wee{name="mcp_tool_saved";properties;constructor(e){this.properties={tool_name:e.toolName,server_id:e.serverId}}}function ny(){try{return"0.6.0-canary.2"}catch{return"0.0.0"}}var Yee={};function ay(){try{return typeof window<"u"&&typeof document<"u"}catch{return!1}}class uD{endpoint;timeout;constructor(e,r=3e3){this.endpoint=e,this.timeout=r}async logEvent(e){try{const r=new AbortController,n=setTimeout(()=>r.abort(),this.timeout),a=await fetch(this.endpoint,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),signal:r.signal});if(clearTimeout(n),!a.ok)throw new Error(`HTTP error! status: ${a.status}`)}catch{}}}function pi(t){return`mcp_inspector_telemetry_${t}`}class zr{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 e=ay(),r=this.isTelemetryDisabled();if(this._source=this.getStoredSource()||"inspector",r)this._posthogClient=null,this._scarfClient=null;else if(!e)this._posthogClient=null,this._scarfClient=null;else{try{this._posthogClient=new uD(this.POSTHOG_PROXY_URL,3e3)}catch{this._posthogClient=null}try{this._scarfClient=new uD(this.SCARF_PROXY_URL,3e3)}catch{this._scarfClient=null}}}isTelemetryDisabled(){return typeof localStorage<"u"&&localStorage.getItem(pi("disabled"))==="true"||typeof process<"u"&&Yee?.MCP_USE_ANONYMIZED_TELEMETRY==="false"}getStoredSource(){return typeof localStorage<"u"?localStorage.getItem(pi("source")):null}static getInstance(){return zr.instance||(zr.instance=new zr),zr.instance}setSource(e){this._source=e,typeof localStorage<"u"&&localStorage.setItem(pi("source"),e)}getSource(){return this._source}get userId(){if(this._currUserId)return this._currUserId;if(!ay())return this._currUserId=this.UNKNOWN_USER_ID,this._currUserId;try{const e=localStorage.getItem(pi("user_id"));if(e)this._currUserId=e;else{const r=this.generateUserId();localStorage.setItem(pi("user_id"),r),this._currUserId=r}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,e=>{const r=Math.random()*16|0;return(e==="x"?r:r&3|8).toString(16)})}async capture(e){if(!(!this._posthogClient&&!this._scarfClient)){if(this._posthogClient)try{const r={event:e.name,user_id:this.userId,properties:{...e.properties,mcp_use_version:ny(),language:"typescript",source:this._source,package:"inspector"}};await this._posthogClient.logEvent(r)}catch{}if(this._scarfClient)try{const r={};r.mcp_use_version=ny(),r.user_id=this.userId,r.event=e.name,r.language="typescript",r.source=this._source,r.package="inspector",await this._scarfClient.logEvent(r)}catch{}}}async trackPackageDownload(e){if(this._scarfClient&&ay())try{const r=ny();let n=!1,a=!1;const s=localStorage.getItem(pi("download_version"));if(s?r>s&&(n=!0,a=!1,localStorage.setItem(pi("download_version"),r)):(n=!0,a=!0,localStorage.setItem(pi("download_version"),r)),n){const l={...e||{}};l.mcp_use_version=r,l.user_id=this.userId,l.event="package_download",l.first_download=a,l.language="typescript",l.source=this._source,l.package="inspector",await this._scarfClient.logEvent(l)}}catch{}}async trackInspectorOpen(e){const r=new qee(e);await this.capture(r)}}const o3=b.createContext(void 0);function Kee({url:t,name:e,proxyConfig:r,transportType:n,onUpdate:a,onRemove:s}){const l=typeof window<"u"?new URL("/inspector/oauth/callback",window.location.origin).toString():"/inspector/oauth/callback";let c=t,d={};if(r?.proxyAddress){const v=new URL(r.proxyAddress),y=new URL(t);c=`${v.origin}${v.pathname}${y.pathname}${y.search}`,d["X-Target-URL"]=t}r?.customHeaders&&(d={...d,...r.customHeaders});const f=SR({url:c,callbackUrl:l,customHeaders:Object.keys(d).length>0?d:void 0,transportType:n||"http"}),h=b.useRef(a),g=b.useRef(null);return b.useEffect(()=>{h.current=a},[a]),b.useEffect(()=>{if(typeof queueMicrotask<"u")queueMicrotask(()=>{f.state==="ready"&&f.serverInfo&&console.log("[McpContext] Server info available:",f.serverInfo);const v={id:t,url:t,name:f.serverInfo?.name||e,state:f.state,tools:f.tools,resources:f.resources,prompts:f.prompts,error:f.error??null,authUrl:f.authUrl??null,customHeaders:d,transportType:n,proxyConfig:r,serverInfo:f.serverInfo,capabilities:f.capabilities,callTool:f.callTool,readResource:f.readResource,listPrompts:f.listPrompts,getPrompt:f.getPrompt,authenticate:f.authenticate,retry:f.retry,clearStorage:f.clearStorage,client:f.client},y=g.current;(!y||y.state!==v.state||y.error!==v.error||y.authUrl!==v.authUrl||y.name!==v.name||y.tools.length!==v.tools.length||y.resources.length!==v.resources.length||y.prompts.length!==v.prompts.length||y.serverInfo!==v.serverInfo||y.capabilities!==v.capabilities||!y.client)&&(g.current=v,h.current(v))});else{const v={id:t,url:t,name:f.serverInfo?.name||e,state:f.state,tools:f.tools,resources:f.resources,prompts:f.prompts,error:f.error??null,authUrl:f.authUrl??null,customHeaders:d,transportType:n,proxyConfig:r,serverInfo:f.serverInfo,capabilities:f.capabilities,callTool:f.callTool,readResource:f.readResource,listPrompts:f.listPrompts,getPrompt:f.getPrompt,authenticate:f.authenticate,retry:f.retry,clearStorage:f.clearStorage,client:f.client},y=g.current;(!y||y.state!==v.state||y.error!==v.error||y.authUrl!==v.authUrl||y.name!==v.name||y.tools.length!==v.tools.length||y.resources.length!==v.resources.length||y.prompts.length!==v.prompts.length||y.serverInfo!==v.serverInfo||y.capabilities!==v.capabilities||!y.client)&&(g.current=v,h.current(v))}},[t,e,n,r,f.state,f.tools,f.resources,f.prompts,f.error,f.authUrl,f.serverInfo,f.capabilities,f.client]),null}function Zee({children:t}){const[e,r]=b.useState([]),[n,a]=b.useState(new Map),[s,l]=b.useState(0),[c,d]=b.useState(!0),[f,h]=b.useState(new Set);b.useEffect(()=>{const k=localStorage.getItem("mcp-inspector-connections");if(k)try{const I=JSON.parse(k),O=Array.isArray(I)?I.filter(M=>M&&typeof M=="object"&&typeof M.id=="string"&&typeof M.url=="string"&&typeof M.name=="string").map(M=>(M.transportType||(M.transportType="http"),M)):[];(O.length!==I.length||O.some(M=>M.transportType==="http"&&!I.find(P=>P.id===M.id&&P.transportType)))&&(console.warn("Updated connections in localStorage with transport type migration"),localStorage.setItem("mcp-inspector-connections",JSON.stringify(O))),r(O)}catch(I){console.error("Failed to parse saved connections:",I),localStorage.removeItem("mcp-inspector-connections")}const A=localStorage.getItem("mcp-inspector-auto-connect");A!==null&&d(A==="true")},[]);const g=b.useCallback(k=>{a(A=>new Map(A).set(k.id,k)),l(A=>A+1),k.serverInfo?.name&&k.state==="ready"&&r(A=>{const I=A.find(O=>O.id===k.id);if(I&&I.name!==k.serverInfo.name){const O=A.map(L=>L.id===k.id?{...L,name:k.serverInfo.name}:L);return localStorage.setItem("mcp-inspector-connections",JSON.stringify(O)),O}return A})},[]),v=b.useCallback((k,A,I,O)=>{const M={id:k,url:k,name:A||k,proxyConfig:I,transportType:O||"http"};r(P=>{if(P.some(X=>X.id===k))return P;const W=[...P,M];return localStorage.setItem("mcp-inspector-connections",JSON.stringify(W)),W})},[]),y=b.useCallback(k=>{zr.getInstance().capture(new Vee({serverId:k})).catch(()=>{}),r(I=>{const O=I.filter(L=>L.id!==k);return localStorage.setItem("mcp-inspector-connections",JSON.stringify(O)),O}),a(I=>{const O=new Map(I),L=O.get(k);if(L){try{L.clearStorage()}catch(M){console.error("Failed to clear storage:",M)}O.delete(k)}return O})},[]),w=b.useCallback(k=>{const A=n.get(k);if(A)return A;const I=e.find(O=>O.id===k);if(I)return{id:I.id,url:I.url,name:I.name,state:"disconnected",tools:[],resources:[],prompts:[],error:null,authUrl:null,transportType:I.transportType,proxyConfig:I.proxyConfig,listPrompts:async O=>{throw new Error("Not connected")},getPrompt:async()=>{throw new Error("Not connected")},callTool:async()=>{throw new Error("Not connected")},readResource:async()=>{throw new Error("Not connected")},authenticate:()=>{},retry:()=>{},clearStorage:()=>{},client:null}},[n,e]),S=b.useCallback(k=>{d(k),localStorage.setItem("mcp-inspector-auto-connect",String(k)),k||h(new Set)},[]),T=b.useCallback(k=>{h(A=>new Set(A).add(k))},[]),x=b.useCallback(k=>{h(A=>{const I=new Set(A);return I.delete(k),I}),a(A=>{const I=new Map(A),O=I.get(k);if(O){try{O.clearStorage()}catch(L){console.error("Failed to clear storage:",L)}I.delete(k)}return I})},[]),_=b.useCallback((k,A)=>{r(I=>{const O=I.map(L=>L.id===k?{...L,name:A.name||L.name,proxyConfig:A.proxyConfig,transportType:A.transportType||L.transportType}:L);return localStorage.setItem("mcp-inspector-connections",JSON.stringify(O)),O})},[]),C=b.useMemo(()=>e.map(A=>{const I=n.get(A.id);return I||{id:A.id,url:A.url,name:A.name,state:"disconnected",tools:[],resources:[],prompts:[],error:null,authUrl:null,transportType:A.transportType,proxyConfig:A.proxyConfig,callTool:async()=>{throw new Error("Not connected")},readResource:async()=>{throw new Error("Not connected")},listPrompts:async O=>{throw new Error("Not connected")},getPrompt:async()=>{throw new Error("Not connected")},authenticate:()=>{},retry:()=>{},clearStorage:()=>{},client:null}}),[n,e,s]),N=b.useMemo(()=>({connections:C,addConnection:v,removeConnection:y,getConnection:w,autoConnect:c,setAutoConnect:S,connectServer:T,disconnectServer:x,updateConnectionConfig:_}),[C,v,y,w,c,S,T,x,_]);return p.jsxs(o3,{value:N,children:[e.filter(k=>c||f.has(k.id)).map(k=>p.jsx(Kee,{url:k.url,name:k.name,proxyConfig:k.proxyConfig,transportType:k.transportType,onUpdate:g,onRemove:()=>y(k.id)},`${k.id}-${k.transportType||"http"}-${k.proxyConfig?.proxyAddress||""}`)),t]})}function KR(){const t=b.use(o3);if(!t)throw new Error("useMcpContext must be used within McpProvider");return t}const Xee=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Qee=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,r,n)=>n?n.toUpperCase():r.toLowerCase()),dD=t=>{const e=Qee(t);return e.charAt(0).toUpperCase()+e.slice(1)},i3=(...t)=>t.filter((e,r,n)=>!!e&&e.trim()!==""&&n.indexOf(e)===r).join(" ").trim(),Jee=t=>{for(const e in t)if(e.startsWith("aria-")||e==="role"||e==="title")return!0};var ete={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 tte=b.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:r=2,absoluteStrokeWidth:n,className:a="",children:s,iconNode:l,...c},d)=>b.createElement("svg",{ref:d,...ete,width:e,height:e,stroke:t,strokeWidth:n?Number(r)*24/Number(e):r,className:i3("lucide",a),...!s&&!Jee(c)&&{"aria-hidden":"true"},...c},[...l.map(([f,h])=>b.createElement(f,h)),...Array.isArray(s)?s:[s]]));const ot=(t,e)=>{const r=b.forwardRef(({className:n,...a},s)=>b.createElement(tte,{ref:s,iconNode:e,className:i3(`lucide-${Xee(dD(t))}`,`lucide-${t}`,n),...a}));return r.displayName=dD(t),r};const rte=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],nte=ot("arrow-up",rte);const ate=[["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"}]],ote=ot("brush",ate);const ite=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Mo=ot("check",ite);const ste=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],ZR=ot("chevron-down",ste);const lte=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],XR=ot("chevron-left",lte);const cte=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],ute=ot("chevron-up",cte);const dte=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}]],fD=ot("circle-minus",dte);const fte=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],uc=ot("clock",fte);const pte=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],mte=ot("code",pte);const hte=[["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"}]],gte=ot("cog",hte);const vte=[["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"}]],bte=ot("command",vte);const yte=[["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"}]],$n=ot("copy",yte);const Ete=[["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"}]],uh=ot("database",Ete);const Ste=[["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"}]],s3=ot("download",Ste);const xte=[["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"}]],wte=ot("ellipsis-vertical",xte);const _te=[["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"}]],pD=ot("external-link",_te);const Tte=[["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"}]],Rte=ot("eye-off",Tte);const Cte=[["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"}]],mD=ot("eye",Cte);const Ate=[["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"}]],Nte=ot("file-code",Ate);const kte=[["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"}]],Ite=ot("file-image",kte);const Ote=[["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"}]],QR=ot("file-text",Ote);const Dte=[["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"}]],Lte=ot("file",Dte);const Mte=[["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"}]],Pte=ot("folder-open",Mte);const jte=[["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"}]],Ute=ot("globe",jte);const Fte=[["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"}]],zte=ot("grip-vertical",Fte);const $te=[["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"}]],l3=ot("history",$te);const Bte=[["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"}]],c3=ot("key",Bte);const qte=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Kd=ot("loader-circle",qte);const Hte=[["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"}]],Vte=ot("maximize",Hte);const Gte=[["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"}]],Wte=ot("message-circle",Gte);const Yte=[["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"}]],yd=ot("message-square",Yte);const Kte=[["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"}]],hD=ot("monitor",Kte);const Zte=[["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"}]],Xte=ot("moon",Zte);const Qte=[["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"}]],u3=ot("play",Qte);const Jte=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],d3=ot("plus",Jte);const ere=[["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"}]],gD=ot("rotate-ccw",ere);const tre=[["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"}]],JR=ot("save",tre);const rre=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],eC=ot("search",rre);const nre=[["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"}]],are=ot("send",nre);const ore=[["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"}]],ire=ot("server",ore);const sre=[["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"}]],Hl=ot("settings",sre);const lre=[["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"}]],cre=ot("shield",lre);const ure=[["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"}]],dre=ot("square-pen",ure);const fre=[["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"}]],pre=ot("sun-dim",fre);const mre=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],oy=ot("terminal",mre);const hre=[["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"}]],fT=ot("trash-2",hre);const gre=[["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"}]],vre=ot("trash",gre);const bre=[["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"}]],Rs=ot("wrench",bre);const yre=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Zd=ot("x",yre);const Ere=[["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"}]],Ed=ot("zap",Ere);function Sre(t){if(typeof document>"u")return;let e=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",e.appendChild(r),r.styleSheet?r.styleSheet.cssText=t:r.appendChild(document.createTextNode(t))}const xre=t=>{switch(t){case"success":return Tre;case"info":return Cre;case"warning":return Rre;case"error":return Are;default:return null}},wre=Array(12).fill(0),_re=({visible:t,className:e})=>ce.createElement("div",{className:["sonner-loading-wrapper",e].filter(Boolean).join(" "),"data-visible":t},ce.createElement("div",{className:"sonner-spinner"},wre.map((r,n)=>ce.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${n}`})))),Tre=ce.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},ce.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"})),Rre=ce.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},ce.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"})),Cre=ce.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},ce.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"})),Are=ce.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},ce.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"})),Nre=ce.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"},ce.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),ce.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),kre=()=>{const[t,e]=ce.useState(document.hidden);return ce.useEffect(()=>{const r=()=>{e(document.hidden)};return document.addEventListener("visibilitychange",r),()=>window.removeEventListener("visibilitychange",r)},[]),t};let pT=1;class Ire{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{const r=this.subscribers.indexOf(e);this.subscribers.splice(r,1)}),this.publish=e=>{this.subscribers.forEach(r=>r(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]},this.create=e=>{var r;const{message:n,...a}=e,s=typeof e?.id=="number"||((r=e.id)==null?void 0:r.length)>0?e.id:pT++,l=this.toasts.find(d=>d.id===s),c=e.dismissible===void 0?!0:e.dismissible;return this.dismissedToasts.has(s)&&this.dismissedToasts.delete(s),l?this.toasts=this.toasts.map(d=>d.id===s?(this.publish({...d,...e,id:s,title:n}),{...d,...e,id:s,dismissible:c,title:n}):d):this.addToast({title:n,...a,dismissible:c,id:s}),s},this.dismiss=e=>(e?(this.dismissedToasts.add(e),requestAnimationFrame(()=>this.subscribers.forEach(r=>r({id:e,dismiss:!0})))):this.toasts.forEach(r=>{this.subscribers.forEach(n=>n({id:r.id,dismiss:!0}))}),e),this.message=(e,r)=>this.create({...r,message:e}),this.error=(e,r)=>this.create({...r,message:e,type:"error"}),this.success=(e,r)=>this.create({...r,type:"success",message:e}),this.info=(e,r)=>this.create({...r,type:"info",message:e}),this.warning=(e,r)=>this.create({...r,type:"warning",message:e}),this.loading=(e,r)=>this.create({...r,type:"loading",message:e}),this.promise=(e,r)=>{if(!r)return;let n;r.loading!==void 0&&(n=this.create({...r,promise:e,type:"loading",message:r.loading,description:typeof r.description!="function"?r.description:void 0}));const a=Promise.resolve(e instanceof Function?e():e);let s=n!==void 0,l;const c=a.then(async f=>{if(l=["resolve",f],ce.isValidElement(f))s=!1,this.create({id:n,type:"default",message:f});else if(Dre(f)&&!f.ok){s=!1;const g=typeof r.error=="function"?await r.error(`HTTP error! status: ${f.status}`):r.error,v=typeof r.description=="function"?await r.description(`HTTP error! status: ${f.status}`):r.description,w=typeof g=="object"&&!ce.isValidElement(g)?g:{message:g};this.create({id:n,type:"error",description:v,...w})}else if(f instanceof Error){s=!1;const g=typeof r.error=="function"?await r.error(f):r.error,v=typeof r.description=="function"?await r.description(f):r.description,w=typeof g=="object"&&!ce.isValidElement(g)?g:{message:g};this.create({id:n,type:"error",description:v,...w})}else if(r.success!==void 0){s=!1;const g=typeof r.success=="function"?await r.success(f):r.success,v=typeof r.description=="function"?await r.description(f):r.description,w=typeof g=="object"&&!ce.isValidElement(g)?g:{message:g};this.create({id:n,type:"success",description:v,...w})}}).catch(async f=>{if(l=["reject",f],r.error!==void 0){s=!1;const h=typeof r.error=="function"?await r.error(f):r.error,g=typeof r.description=="function"?await r.description(f):r.description,y=typeof h=="object"&&!ce.isValidElement(h)?h:{message:h};this.create({id:n,type:"error",description:g,...y})}}).finally(()=>{s&&(this.dismiss(n),n=void 0),r.finally==null||r.finally.call(r)}),d=()=>new Promise((f,h)=>c.then(()=>l[0]==="reject"?h(l[1]):f(l[1])).catch(h));return typeof n!="string"&&typeof n!="number"?{unwrap:d}:Object.assign(n,{unwrap:d})},this.custom=(e,r)=>{const n=r?.id||pT++;return this.create({jsx:e(n),id:n,...r}),n},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}}const Sn=new Ire,Ore=(t,e)=>{const r=e?.id||pT++;return Sn.addToast({title:t,...e,id:r}),r},Dre=t=>t&&typeof t=="object"&&"ok"in t&&typeof t.ok=="boolean"&&"status"in t&&typeof t.status=="number",Lre=Ore,Mre=()=>Sn.toasts,Pre=()=>Sn.getActiveToasts(),cr=Object.assign(Lre,{success:Sn.success,info:Sn.info,warning:Sn.warning,error:Sn.error,custom:Sn.custom,message:Sn.message,promise:Sn.promise,dismiss:Sn.dismiss,loading:Sn.loading},{getHistory:Mre,getToasts:Pre});Sre("[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 Ap(t){return t.label!==void 0}const jre=3,Ure="24px",Fre="16px",vD=4e3,zre=356,$re=14,Bre=45,qre=200;function Ia(...t){return t.filter(Boolean).join(" ")}function Hre(t){const[e,r]=t.split("-"),n=[];return e&&n.push(e),r&&n.push(r),n}const Vre=t=>{var e,r,n,a,s,l,c,d,f;const{invert:h,toast:g,unstyled:v,interacting:y,setHeights:w,visibleToasts:S,heights:T,index:x,toasts:_,expanded:C,removeToast:N,defaultRichColors:k,closeButton:A,style:I,cancelButtonStyle:O,actionButtonStyle:L,className:M="",descriptionClassName:P="",duration:W,position:X,gap:ee,expandByDefault:J,classNames:B,icons:Y,closeButtonAriaLabel:H="Close toast"}=t,[re,Q]=ce.useState(null),[j,q]=ce.useState(null),[z,G]=ce.useState(!1),[Z,U]=ce.useState(!1),[F,te]=ce.useState(!1),[fe,V]=ce.useState(!1),[de,le]=ce.useState(!1),[pe,Re]=ce.useState(0),[Ke,je]=ce.useState(0),ze=ce.useRef(g.duration||W||vD),_e=ce.useRef(null),Ae=ce.useRef(null),$e=x===0,oe=x+1<=S,Se=g.type,Le=g.dismissible!==!1,we=g.className||"",ke=g.descriptionClassName||"",Oe=ce.useMemo(()=>T.findIndex(rt=>rt.toastId===g.id)||0,[T,g.id]),Ve=ce.useMemo(()=>{var rt;return(rt=g.closeButton)!=null?rt:A},[g.closeButton,A]),et=ce.useMemo(()=>g.duration||W||vD,[g.duration,W]),ut=ce.useRef(0),At=ce.useRef(0),An=ce.useRef(0),vr=ce.useRef(null),[or,Mt]=X.split("-"),Zt=ce.useMemo(()=>T.reduce((rt,jt,Qt)=>Qt>=Oe?rt:rt+jt.height,0),[T,Oe]),fr=kre(),_r=g.invert||h,Bn=Se==="loading";At.current=ce.useMemo(()=>Oe*ee+Zt,[Oe,Zt]),ce.useEffect(()=>{ze.current=et},[et]),ce.useEffect(()=>{G(!0)},[]),ce.useEffect(()=>{const rt=Ae.current;if(rt){const jt=rt.getBoundingClientRect().height;return je(jt),w(Qt=>[{toastId:g.id,height:jt,position:g.position},...Qt]),()=>w(Qt=>Qt.filter(jr=>jr.toastId!==g.id))}},[w,g.id]),ce.useLayoutEffect(()=>{if(!z)return;const rt=Ae.current,jt=rt.style.height;rt.style.height="auto";const Qt=rt.getBoundingClientRect().height;rt.style.height=jt,je(Qt),w(jr=>jr.find(Xt=>Xt.toastId===g.id)?jr.map(Xt=>Xt.toastId===g.id?{...Xt,height:Qt}:Xt):[{toastId:g.id,height:Qt,position:g.position},...jr])},[z,g.title,g.description,w,g.id,g.jsx,g.action,g.cancel]);const ir=ce.useCallback(()=>{U(!0),Re(At.current),w(rt=>rt.filter(jt=>jt.toastId!==g.id)),setTimeout(()=>{N(g)},qre)},[g,N,w,At]);ce.useEffect(()=>{if(g.promise&&Se==="loading"||g.duration===1/0||g.type==="loading")return;let rt;return C||y||fr?(()=>{if(An.current<ut.current){const jr=new Date().getTime()-ut.current;ze.current=ze.current-jr}An.current=new Date().getTime()})():(()=>{ze.current!==1/0&&(ut.current=new Date().getTime(),rt=setTimeout(()=>{g.onAutoClose==null||g.onAutoClose.call(g,g),ir()},ze.current))})(),()=>clearTimeout(rt)},[C,y,g,Se,fr,ir]),ce.useEffect(()=>{g.delete&&(ir(),g.onDismiss==null||g.onDismiss.call(g,g))},[ir,g.delete]);function Gt(){var rt;if(Y?.loading){var jt;return ce.createElement("div",{className:Ia(B?.loader,g==null||(jt=g.classNames)==null?void 0:jt.loader,"sonner-loader"),"data-visible":Se==="loading"},Y.loading)}return ce.createElement(_re,{className:Ia(B?.loader,g==null||(rt=g.classNames)==null?void 0:rt.loader),visible:Se==="loading"})}const pn=g.icon||Y?.[Se]||xre(Se);var da,an;return ce.createElement("li",{tabIndex:0,ref:Ae,className:Ia(M,we,B?.toast,g==null||(e=g.classNames)==null?void 0:e.toast,B?.default,B?.[Se],g==null||(r=g.classNames)==null?void 0:r[Se]),"data-sonner-toast":"","data-rich-colors":(da=g.richColors)!=null?da:k,"data-styled":!(g.jsx||g.unstyled||v),"data-mounted":z,"data-promise":!!g.promise,"data-swiped":de,"data-removed":Z,"data-visible":oe,"data-y-position":or,"data-x-position":Mt,"data-index":x,"data-front":$e,"data-swiping":F,"data-dismissible":Le,"data-type":Se,"data-invert":_r,"data-swipe-out":fe,"data-swipe-direction":j,"data-expanded":!!(C||J&&z),"data-testid":g.testId,style:{"--index":x,"--toasts-before":x,"--z-index":_.length-x,"--offset":`${Z?pe:At.current}px`,"--initial-height":J?"auto":`${Ke}px`,...I,...g.style},onDragEnd:()=>{te(!1),Q(null),vr.current=null},onPointerDown:rt=>{rt.button!==2&&(Bn||!Le||(_e.current=new Date,Re(At.current),rt.target.setPointerCapture(rt.pointerId),rt.target.tagName!=="BUTTON"&&(te(!0),vr.current={x:rt.clientX,y:rt.clientY})))},onPointerUp:()=>{var rt,jt,Qt;if(fe||!Le)return;vr.current=null;const jr=Number(((rt=Ae.current)==null?void 0:rt.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),qn=Number(((jt=Ae.current)==null?void 0:jt.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),Xt=new Date().getTime()-((Qt=_e.current)==null?void 0:Qt.getTime()),Jr=re==="x"?jr:qn,Ta=Math.abs(Jr)/Xt;if(Math.abs(Jr)>=Bre||Ta>.11){Re(At.current),g.onDismiss==null||g.onDismiss.call(g,g),q(re==="x"?jr>0?"right":"left":qn>0?"down":"up"),ir(),V(!0);return}else{var en,Br;(en=Ae.current)==null||en.style.setProperty("--swipe-amount-x","0px"),(Br=Ae.current)==null||Br.style.setProperty("--swipe-amount-y","0px")}le(!1),te(!1),Q(null)},onPointerMove:rt=>{var jt,Qt,jr;if(!vr.current||!Le||((jt=window.getSelection())==null?void 0:jt.toString().length)>0)return;const Xt=rt.clientY-vr.current.y,Jr=rt.clientX-vr.current.x;var Ta;const en=(Ta=t.swipeDirections)!=null?Ta:Hre(X);!re&&(Math.abs(Jr)>1||Math.abs(Xt)>1)&&Q(Math.abs(Jr)>Math.abs(Xt)?"x":"y");let Br={x:0,y:0};const ae=K=>1/(1.5+Math.abs(K)/20);if(re==="y"){if(en.includes("top")||en.includes("bottom"))if(en.includes("top")&&Xt<0||en.includes("bottom")&&Xt>0)Br.y=Xt;else{const K=Xt*ae(Xt);Br.y=Math.abs(K)<Math.abs(Xt)?K:Xt}}else if(re==="x"&&(en.includes("left")||en.includes("right")))if(en.includes("left")&&Jr<0||en.includes("right")&&Jr>0)Br.x=Jr;else{const K=Jr*ae(Jr);Br.x=Math.abs(K)<Math.abs(Jr)?K:Jr}(Math.abs(Br.x)>0||Math.abs(Br.y)>0)&&le(!0),(Qt=Ae.current)==null||Qt.style.setProperty("--swipe-amount-x",`${Br.x}px`),(jr=Ae.current)==null||jr.style.setProperty("--swipe-amount-y",`${Br.y}px`)}},Ve&&!g.jsx&&Se!=="loading"?ce.createElement("button",{"aria-label":H,"data-disabled":Bn,"data-close-button":!0,onClick:Bn||!Le?()=>{}:()=>{ir(),g.onDismiss==null||g.onDismiss.call(g,g)},className:Ia(B?.closeButton,g==null||(n=g.classNames)==null?void 0:n.closeButton)},(an=Y?.close)!=null?an:Nre):null,(Se||g.icon||g.promise)&&g.icon!==null&&(Y?.[Se]!==null||g.icon)?ce.createElement("div",{"data-icon":"",className:Ia(B?.icon,g==null||(a=g.classNames)==null?void 0:a.icon)},g.promise||g.type==="loading"&&!g.icon?g.icon||Gt():null,g.type!=="loading"?pn:null):null,ce.createElement("div",{"data-content":"",className:Ia(B?.content,g==null||(s=g.classNames)==null?void 0:s.content)},ce.createElement("div",{"data-title":"",className:Ia(B?.title,g==null||(l=g.classNames)==null?void 0:l.title)},g.jsx?g.jsx:typeof g.title=="function"?g.title():g.title),g.description?ce.createElement("div",{"data-description":"",className:Ia(P,ke,B?.description,g==null||(c=g.classNames)==null?void 0:c.description)},typeof g.description=="function"?g.description():g.description):null),ce.isValidElement(g.cancel)?g.cancel:g.cancel&&Ap(g.cancel)?ce.createElement("button",{"data-button":!0,"data-cancel":!0,style:g.cancelButtonStyle||O,onClick:rt=>{Ap(g.cancel)&&Le&&(g.cancel.onClick==null||g.cancel.onClick.call(g.cancel,rt),ir())},className:Ia(B?.cancelButton,g==null||(d=g.classNames)==null?void 0:d.cancelButton)},g.cancel.label):null,ce.isValidElement(g.action)?g.action:g.action&&Ap(g.action)?ce.createElement("button",{"data-button":!0,"data-action":!0,style:g.actionButtonStyle||L,onClick:rt=>{Ap(g.action)&&(g.action.onClick==null||g.action.onClick.call(g.action,rt),!rt.defaultPrevented&&ir())},className:Ia(B?.actionButton,g==null||(f=g.classNames)==null?void 0:f.actionButton)},g.action.label):null)};function bD(){if(typeof window>"u"||typeof document>"u")return"ltr";const t=document.documentElement.getAttribute("dir");return t==="auto"||!t?window.getComputedStyle(document.documentElement).direction:t}function Gre(t,e){const r={};return[t,e].forEach((n,a)=>{const s=a===1,l=s?"--mobile-offset":"--offset",c=s?Fre:Ure;function d(f){["top","right","bottom","left"].forEach(h=>{r[`${l}-${h}`]=typeof f=="number"?`${f}px`:f})}typeof n=="number"||typeof n=="string"?d(n):typeof n=="object"?["top","right","bottom","left"].forEach(f=>{n[f]===void 0?r[`${l}-${f}`]=c:r[`${l}-${f}`]=typeof n[f]=="number"?`${n[f]}px`:n[f]}):d(c)}),r}const Wre=ce.forwardRef(function(e,r){const{id:n,invert:a,position:s="bottom-right",hotkey:l=["altKey","KeyT"],expand:c,closeButton:d,className:f,offset:h,mobileOffset:g,theme:v="light",richColors:y,duration:w,style:S,visibleToasts:T=jre,toastOptions:x,dir:_=bD(),gap:C=$re,icons:N,containerAriaLabel:k="Notifications"}=e,[A,I]=ce.useState([]),O=ce.useMemo(()=>n?A.filter(z=>z.toasterId===n):A.filter(z=>!z.toasterId),[A,n]),L=ce.useMemo(()=>Array.from(new Set([s].concat(O.filter(z=>z.position).map(z=>z.position)))),[O,s]),[M,P]=ce.useState([]),[W,X]=ce.useState(!1),[ee,J]=ce.useState(!1),[B,Y]=ce.useState(v!=="system"?v:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),H=ce.useRef(null),re=l.join("+").replace(/Key/g,"").replace(/Digit/g,""),Q=ce.useRef(null),j=ce.useRef(!1),q=ce.useCallback(z=>{I(G=>{var Z;return(Z=G.find(U=>U.id===z.id))!=null&&Z.delete||Sn.dismiss(z.id),G.filter(({id:U})=>U!==z.id)})},[]);return ce.useEffect(()=>Sn.subscribe(z=>{if(z.dismiss){requestAnimationFrame(()=>{I(G=>G.map(Z=>Z.id===z.id?{...Z,delete:!0}:Z))});return}setTimeout(()=>{V$.flushSync(()=>{I(G=>{const Z=G.findIndex(U=>U.id===z.id);return Z!==-1?[...G.slice(0,Z),{...G[Z],...z},...G.slice(Z+1)]:[z,...G]})})})}),[A]),ce.useEffect(()=>{if(v!=="system"){Y(v);return}if(v==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?Y("dark"):Y("light")),typeof window>"u")return;const z=window.matchMedia("(prefers-color-scheme: dark)");try{z.addEventListener("change",({matches:G})=>{Y(G?"dark":"light")})}catch{z.addListener(({matches:Z})=>{try{Y(Z?"dark":"light")}catch(U){console.error(U)}})}},[v]),ce.useEffect(()=>{A.length<=1&&X(!1)},[A]),ce.useEffect(()=>{const z=G=>{var Z;if(l.every(te=>G[te]||G.code===te)){var F;X(!0),(F=H.current)==null||F.focus()}G.code==="Escape"&&(document.activeElement===H.current||(Z=H.current)!=null&&Z.contains(document.activeElement))&&X(!1)};return document.addEventListener("keydown",z),()=>document.removeEventListener("keydown",z)},[l]),ce.useEffect(()=>{if(H.current)return()=>{Q.current&&(Q.current.focus({preventScroll:!0}),Q.current=null,j.current=!1)}},[H.current]),ce.createElement("section",{ref:r,"aria-label":`${k} ${re}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},L.map((z,G)=>{var Z;const[U,F]=z.split("-");return O.length?ce.createElement("ol",{key:z,dir:_==="auto"?bD():_,tabIndex:-1,ref:H,className:f,"data-sonner-toaster":!0,"data-sonner-theme":B,"data-y-position":U,"data-x-position":F,style:{"--front-toast-height":`${((Z=M[0])==null?void 0:Z.height)||0}px`,"--width":`${zre}px`,"--gap":`${C}px`,...S,...Gre(h,g)},onBlur:te=>{j.current&&!te.currentTarget.contains(te.relatedTarget)&&(j.current=!1,Q.current&&(Q.current.focus({preventScroll:!0}),Q.current=null))},onFocus:te=>{te.target instanceof HTMLElement&&te.target.dataset.dismissible==="false"||j.current||(j.current=!0,Q.current=te.relatedTarget)},onMouseEnter:()=>X(!0),onMouseMove:()=>X(!0),onMouseLeave:()=>{ee||X(!1)},onDragEnd:()=>X(!1),onPointerDown:te=>{te.target instanceof HTMLElement&&te.target.dataset.dismissible==="false"||J(!0)},onPointerUp:()=>J(!1)},O.filter(te=>!te.position&&G===0||te.position===z).map((te,fe)=>{var V,de;return ce.createElement(Vre,{key:te.id,icons:N,index:fe,toast:te,defaultRichColors:y,duration:(V=x?.duration)!=null?V:w,className:x?.className,descriptionClassName:x?.descriptionClassName,invert:a,visibleToasts:T,closeButton:(de=x?.closeButton)!=null?de:d,interacting:ee,position:z,style:x?.style,unstyled:x?.unstyled,classNames:x?.classNames,cancelButtonStyle:x?.cancelButtonStyle,actionButtonStyle:x?.actionButtonStyle,closeButtonAriaLabel:x?.closeButtonAriaLabel,removeToast:q,toasts:O.filter(le=>le.position==te.position),heights:M.filter(le=>le.position==te.position),setHeights:P,expandByDefault:c,gap:C,expanded:W,swipeDirections:e.swipeDirections})})):null}))});var dh="Dialog",[f3]=Qa(dh),[Yre,_a]=f3(dh),p3=t=>{const{__scopeDialog:e,children:r,open:n,defaultOpen:a,onOpenChange:s,modal:l=!0}=t,c=b.useRef(null),d=b.useRef(null),[f,h]=Ri({prop:n,defaultProp:a??!1,onChange:s,caller:dh});return p.jsx(Yre,{scope:e,triggerRef:c,contentRef:d,contentId:Xr(),titleId:Xr(),descriptionId:Xr(),open:f,onOpenChange:h,onOpenToggle:b.useCallback(()=>h(g=>!g),[h]),modal:l,children:r})};p3.displayName=dh;var m3="DialogTrigger",h3=b.forwardRef((t,e)=>{const{__scopeDialog:r,...n}=t,a=_a(m3,r),s=kt(e,a.triggerRef);return p.jsx(yt.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.contentId,"data-state":nC(a.open),...n,ref:s,onClick:He(t.onClick,a.onOpenToggle)})});h3.displayName=m3;var tC="DialogPortal",[Kre,g3]=f3(tC,{forceMount:void 0}),v3=t=>{const{__scopeDialog:e,forceMount:r,children:n,container:a}=t,s=_a(tC,e);return p.jsx(Kre,{scope:e,forceMount:r,children:b.Children.map(n,l=>p.jsx(ua,{present:r||s.open,children:p.jsx(Cc,{asChild:!0,container:a,children:l})}))})};v3.displayName=tC;var km="DialogOverlay",b3=b.forwardRef((t,e)=>{const r=g3(km,t.__scopeDialog),{forceMount:n=r.forceMount,...a}=t,s=_a(km,t.__scopeDialog);return s.modal?p.jsx(ua,{present:n||s.open,children:p.jsx(Xre,{...a,ref:e})}):null});b3.displayName=km;var Zre=_s("DialogOverlay.RemoveScroll"),Xre=b.forwardRef((t,e)=>{const{__scopeDialog:r,...n}=t,a=_a(km,r);return p.jsx(Vd,{as:Zre,allowPinchZoom:!0,shards:[a.contentRef],children:p.jsx(yt.div,{"data-state":nC(a.open),...n,ref:e,style:{pointerEvents:"auto",...n.style}})})}),Cs="DialogContent",y3=b.forwardRef((t,e)=>{const r=g3(Cs,t.__scopeDialog),{forceMount:n=r.forceMount,...a}=t,s=_a(Cs,t.__scopeDialog);return p.jsx(ua,{present:n||s.open,children:s.modal?p.jsx(Qre,{...a,ref:e}):p.jsx(Jre,{...a,ref:e})})});y3.displayName=Cs;var Qre=b.forwardRef((t,e)=>{const r=_a(Cs,t.__scopeDialog),n=b.useRef(null),a=kt(e,r.contentRef,n);return b.useEffect(()=>{const s=n.current;if(s)return rh(s)},[]),p.jsx(E3,{...t,ref:a,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:He(t.onCloseAutoFocus,s=>{s.preventDefault(),r.triggerRef.current?.focus()}),onPointerDownOutside:He(t.onPointerDownOutside,s=>{const l=s.detail.originalEvent,c=l.button===0&&l.ctrlKey===!0;(l.button===2||c)&&s.preventDefault()}),onFocusOutside:He(t.onFocusOutside,s=>s.preventDefault())})}),Jre=b.forwardRef((t,e)=>{const r=_a(Cs,t.__scopeDialog),n=b.useRef(!1),a=b.useRef(!1);return p.jsx(E3,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{t.onCloseAutoFocus?.(s),s.defaultPrevented||(n.current||r.triggerRef.current?.focus(),s.preventDefault()),n.current=!1,a.current=!1},onInteractOutside:s=>{t.onInteractOutside?.(s),s.defaultPrevented||(n.current=!0,s.detail.originalEvent.type==="pointerdown"&&(a.current=!0));const l=s.target;r.triggerRef.current?.contains(l)&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&a.current&&s.preventDefault()}})}),E3=b.forwardRef((t,e)=>{const{__scopeDialog:r,trapFocus:n,onOpenAutoFocus:a,onCloseAutoFocus:s,...l}=t,c=_a(Cs,r),d=b.useRef(null),f=kt(e,d);return Ym(),p.jsxs(p.Fragment,{children:[p.jsx($d,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:a,onUnmountAutoFocus:s,children:p.jsx(_c,{role:"dialog",id:c.contentId,"aria-describedby":c.descriptionId,"aria-labelledby":c.titleId,"data-state":nC(c.open),...l,ref:f,onDismiss:()=>c.onOpenChange(!1)})}),p.jsxs(p.Fragment,{children:[p.jsx(ene,{titleId:c.titleId}),p.jsx(rne,{contentRef:d,descriptionId:c.descriptionId})]})]})}),rC="DialogTitle",S3=b.forwardRef((t,e)=>{const{__scopeDialog:r,...n}=t,a=_a(rC,r);return p.jsx(yt.h2,{id:a.titleId,...n,ref:e})});S3.displayName=rC;var x3="DialogDescription",w3=b.forwardRef((t,e)=>{const{__scopeDialog:r,...n}=t,a=_a(x3,r);return p.jsx(yt.p,{id:a.descriptionId,...n,ref:e})});w3.displayName=x3;var _3="DialogClose",T3=b.forwardRef((t,e)=>{const{__scopeDialog:r,...n}=t,a=_a(_3,r);return p.jsx(yt.button,{type:"button",...n,ref:e,onClick:He(t.onClick,()=>a.onOpenChange(!1))})});T3.displayName=_3;function nC(t){return t?"open":"closed"}var R3="DialogTitleWarning",[PEe,C3]=aZ(R3,{contentName:Cs,titleName:rC,docsSlug:"dialog"}),ene=({titleId:t})=>{const e=C3(R3),r=`\`${e.contentName}\` requires a \`${e.titleName}\` for the component to be accessible for screen reader users.
|
|
65
|
+
`)},YQ=0,bl=[];function KQ(t){var e=b.useRef([]),r=b.useRef([0,0]),n=b.useRef(),a=b.useState(YQ++)[0],s=b.useState(WB)[0],l=b.useRef(t);b.useEffect(function(){l.current=t},[t]),b.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(a));var S=gQ([t.lockRef.current],(t.shards||[]).map(aD),!0).filter(Boolean);return S.forEach(function(T){return T.classList.add("allow-interactivity-".concat(a))}),function(){document.body.classList.remove("block-interactivity-".concat(a)),S.forEach(function(T){return T.classList.remove("allow-interactivity-".concat(a))})}}},[t.inert,t.lockRef.current,t.shards]);var c=b.useCallback(function(S,T){if("touches"in S&&S.touches.length===2||S.type==="wheel"&&S.ctrlKey)return!l.current.allowPinchZoom;var x=Cp(S),_=r.current,C="deltaX"in S?S.deltaX:_[0]-x[0],N="deltaY"in S?S.deltaY:_[1]-x[1],k,A=S.target,I=Math.abs(C)>Math.abs(N)?"h":"v";if("touches"in S&&I==="h"&&A.type==="range")return!1;var O=rD(I,A);if(!O)return!0;if(O?k=I:(k=I==="v"?"h":"v",O=rD(I,A)),!O)return!1;if(!n.current&&"changedTouches"in S&&(C||N)&&(n.current=k),!k)return!0;var L=n.current||k;return VQ(L,T,S,L==="h"?C:N)},[]),d=b.useCallback(function(S){var T=S;if(!(!bl.length||bl[bl.length-1]!==s)){var x="deltaY"in T?nD(T):Cp(T),_=e.current.filter(function(k){return k.name===T.type&&(k.target===T.target||T.target===k.shadowParent)&&GQ(k.delta,x)})[0];if(_&&_.should){T.cancelable&&T.preventDefault();return}if(!_){var C=(l.current.shards||[]).map(aD).filter(Boolean).filter(function(k){return k.contains(T.target)}),N=C.length>0?c(T,C[0]):!l.current.noIsolation;N&&T.cancelable&&T.preventDefault()}}},[]),f=b.useCallback(function(S,T,x,_){var C={name:S,delta:T,target:x,should:_,shadowParent:ZQ(x)};e.current.push(C),setTimeout(function(){e.current=e.current.filter(function(N){return N!==C})},1)},[]),h=b.useCallback(function(S){r.current=Cp(S),n.current=void 0},[]),g=b.useCallback(function(S){f(S.type,nD(S),S.target,c(S,t.lockRef.current))},[]),v=b.useCallback(function(S){f(S.type,Cp(S),S.target,c(S,t.lockRef.current))},[]);b.useEffect(function(){return bl.push(s),t.setCallbacks({onScrollCapture:g,onWheelCapture:g,onTouchMoveCapture:v}),document.addEventListener("wheel",d,vl),document.addEventListener("touchmove",d,vl),document.addEventListener("touchstart",h,vl),function(){bl=bl.filter(function(S){return S!==s}),document.removeEventListener("wheel",d,vl),document.removeEventListener("touchmove",d,vl),document.removeEventListener("touchstart",h,vl)}},[]);var y=t.removeScrollBar,w=t.inert;return b.createElement(b.Fragment,null,w?b.createElement(s,{styles:WQ(a)}):null,y?b.createElement(UQ,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function ZQ(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const XQ=TQ(GB,KQ);var Vd=b.forwardRef(function(t,e){return b.createElement(nh,Pa({},t,{ref:e,sideCar:XQ}))});Vd.classNames=nh.classNames;var iT=["Enter"," "],QQ=["ArrowDown","PageUp","Home"],XB=["ArrowUp","PageDown","End"],JQ=[...QQ,...XB],eJ={ltr:[...iT,"ArrowRight"],rtl:[...iT,"ArrowLeft"]},tJ={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Gd="Menu",[gd,rJ,nJ]=AR(Gd),[Os,QB]=Qa(Gd,[nJ,Oi,UB]),ah=Oi(),JB=UB(),[aJ,Ds]=Os(Gd),[oJ,Wd]=Os(Gd),e4=t=>{const{__scopeMenu:e,open:r=!1,children:n,dir:a,onOpenChange:s,modal:l=!0}=t,c=ah(e),[d,f]=b.useState(null),h=b.useRef(!1),g=Ya(s),v=NR(a);return b.useEffect(()=>{const y=()=>{h.current=!0,document.addEventListener("pointerdown",w,{capture:!0,once:!0}),document.addEventListener("pointermove",w,{capture:!0,once:!0})},w=()=>h.current=!1;return document.addEventListener("keydown",y,{capture:!0}),()=>{document.removeEventListener("keydown",y,{capture:!0}),document.removeEventListener("pointerdown",w,{capture:!0}),document.removeEventListener("pointermove",w,{capture:!0})}},[]),p.jsx(Jm,{...c,children:p.jsx(aJ,{scope:e,open:r,onOpenChange:g,content:d,onContentChange:f,children:p.jsx(oJ,{scope:e,onClose:b.useCallback(()=>g(!1),[g]),isUsingKeyboardRef:h,dir:v,modal:l,children:n})})})};e4.displayName=Gd;var iJ="MenuAnchor",UR=b.forwardRef((t,e)=>{const{__scopeMenu:r,...n}=t,a=ah(r);return p.jsx(qd,{...a,...n,ref:e})});UR.displayName=iJ;var FR="MenuPortal",[sJ,t4]=Os(FR,{forceMount:void 0}),r4=t=>{const{__scopeMenu:e,forceMount:r,children:n,container:a}=t,s=Ds(FR,e);return p.jsx(sJ,{scope:e,forceMount:r,children:p.jsx(ua,{present:r||s.open,children:p.jsx(Cc,{asChild:!0,container:a,children:n})})})};r4.displayName=FR;var ia="MenuContent",[lJ,zR]=Os(ia),n4=b.forwardRef((t,e)=>{const r=t4(ia,t.__scopeMenu),{forceMount:n=r.forceMount,...a}=t,s=Ds(ia,t.__scopeMenu),l=Wd(ia,t.__scopeMenu);return p.jsx(gd.Provider,{scope:t.__scopeMenu,children:p.jsx(ua,{present:n||s.open,children:p.jsx(gd.Slot,{scope:t.__scopeMenu,children:l.modal?p.jsx(cJ,{...a,ref:e}):p.jsx(uJ,{...a,ref:e})})})})}),cJ=b.forwardRef((t,e)=>{const r=Ds(ia,t.__scopeMenu),n=b.useRef(null),a=kt(e,n);return b.useEffect(()=>{const s=n.current;if(s)return rh(s)},[]),p.jsx($R,{...t,ref:a,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:He(t.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)})}),uJ=b.forwardRef((t,e)=>{const r=Ds(ia,t.__scopeMenu);return p.jsx($R,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)})}),dJ=_s("MenuContent.ScrollLock"),$R=b.forwardRef((t,e)=>{const{__scopeMenu:r,loop:n=!1,trapFocus:a,onOpenAutoFocus:s,onCloseAutoFocus:l,disableOutsidePointerEvents:c,onEntryFocus:d,onEscapeKeyDown:f,onPointerDownOutside:h,onFocusOutside:g,onInteractOutside:v,onDismiss:y,disableOutsideScroll:w,...S}=t,T=Ds(ia,r),x=Wd(ia,r),_=ah(r),C=JB(r),N=rJ(r),[k,A]=b.useState(null),I=b.useRef(null),O=kt(e,I,T.onContentChange),L=b.useRef(0),M=b.useRef(""),P=b.useRef(0),W=b.useRef(null),X=b.useRef("right"),ee=b.useRef(0),J=w?Vd:b.Fragment,B=w?{as:dJ,allowPinchZoom:!0}:void 0,Y=re=>{const Q=M.current+re,j=N().filter(F=>!F.disabled),q=document.activeElement,z=j.find(F=>F.ref.current===q)?.textValue,G=j.map(F=>F.textValue),Z=wJ(G,Q,z),U=j.find(F=>F.textValue===Z)?.ref.current;(function F(te){M.current=te,window.clearTimeout(L.current),te!==""&&(L.current=window.setTimeout(()=>F(""),1e3))})(Q),U&&setTimeout(()=>U.focus())};b.useEffect(()=>()=>window.clearTimeout(L.current),[]),Ym();const H=b.useCallback(re=>X.current===W.current?.side&&TJ(re,W.current?.area),[]);return p.jsx(lJ,{scope:r,searchRef:M,onItemEnter:b.useCallback(re=>{H(re)&&re.preventDefault()},[H]),onItemLeave:b.useCallback(re=>{H(re)||(I.current?.focus(),A(null))},[H]),onTriggerLeave:b.useCallback(re=>{H(re)&&re.preventDefault()},[H]),pointerGraceTimerRef:P,onPointerGraceIntentChange:b.useCallback(re=>{W.current=re},[]),children:p.jsx(J,{...B,children:p.jsx($d,{asChild:!0,trapped:a,onMountAutoFocus:He(s,re=>{re.preventDefault(),I.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:l,children:p.jsx(_c,{asChild:!0,disableOutsidePointerEvents:c,onEscapeKeyDown:f,onPointerDownOutside:h,onFocusOutside:g,onInteractOutside:v,onDismiss:y,children:p.jsx(dQ,{asChild:!0,...C,dir:x.dir,orientation:"vertical",loop:n,currentTabStopId:k,onCurrentTabStopIdChange:A,onEntryFocus:He(d,re=>{x.isUsingKeyboardRef.current||re.preventDefault()}),preventScrollOnEntryFocus:!0,children:p.jsx(eh,{role:"menu","aria-orientation":"vertical","data-state":y4(T.open),"data-radix-menu-content":"",dir:x.dir,..._,...S,ref:O,style:{outline:"none",...S.style},onKeyDown:He(S.onKeyDown,re=>{const j=re.target.closest("[data-radix-menu-content]")===re.currentTarget,q=re.ctrlKey||re.altKey||re.metaKey,z=re.key.length===1;j&&(re.key==="Tab"&&re.preventDefault(),!q&&z&&Y(re.key));const G=I.current;if(re.target!==G||!JQ.includes(re.key))return;re.preventDefault();const U=N().filter(F=>!F.disabled).map(F=>F.ref.current);XB.includes(re.key)&&U.reverse(),SJ(U)}),onBlur:He(t.onBlur,re=>{re.currentTarget.contains(re.target)||(window.clearTimeout(L.current),M.current="")}),onPointerMove:He(t.onPointerMove,vd(re=>{const Q=re.target,j=ee.current!==re.clientX;if(re.currentTarget.contains(Q)&&j){const q=re.clientX>ee.current?"right":"left";X.current=q,ee.current=re.clientX}}))})})})})})})});n4.displayName=ia;var fJ="MenuGroup",BR=b.forwardRef((t,e)=>{const{__scopeMenu:r,...n}=t;return p.jsx(yt.div,{role:"group",...n,ref:e})});BR.displayName=fJ;var pJ="MenuLabel",a4=b.forwardRef((t,e)=>{const{__scopeMenu:r,...n}=t;return p.jsx(yt.div,{...n,ref:e})});a4.displayName=pJ;var Cm="MenuItem",oD="menu.itemSelect",oh=b.forwardRef((t,e)=>{const{disabled:r=!1,onSelect:n,...a}=t,s=b.useRef(null),l=Wd(Cm,t.__scopeMenu),c=zR(Cm,t.__scopeMenu),d=kt(e,s),f=b.useRef(!1),h=()=>{const g=s.current;if(!r&&g){const v=new CustomEvent(oD,{bubbles:!0,cancelable:!0});g.addEventListener(oD,y=>n?.(y),{once:!0}),dB(g,v),v.defaultPrevented?f.current=!1:l.onClose()}};return p.jsx(o4,{...a,ref:d,disabled:r,onClick:He(t.onClick,h),onPointerDown:g=>{t.onPointerDown?.(g),f.current=!0},onPointerUp:He(t.onPointerUp,g=>{f.current||g.currentTarget?.click()}),onKeyDown:He(t.onKeyDown,g=>{const v=c.searchRef.current!=="";r||v&&g.key===" "||iT.includes(g.key)&&(g.currentTarget.click(),g.preventDefault())})})});oh.displayName=Cm;var o4=b.forwardRef((t,e)=>{const{__scopeMenu:r,disabled:n=!1,textValue:a,...s}=t,l=zR(Cm,r),c=JB(r),d=b.useRef(null),f=kt(e,d),[h,g]=b.useState(!1),[v,y]=b.useState("");return b.useEffect(()=>{const w=d.current;w&&y((w.textContent??"").trim())},[s.children]),p.jsx(gd.ItemSlot,{scope:r,disabled:n,textValue:a??v,children:p.jsx(fQ,{asChild:!0,...c,focusable:!n,children:p.jsx(yt.div,{role:"menuitem","data-highlighted":h?"":void 0,"aria-disabled":n||void 0,"data-disabled":n?"":void 0,...s,ref:f,onPointerMove:He(t.onPointerMove,vd(w=>{n?l.onItemLeave(w):(l.onItemEnter(w),w.defaultPrevented||w.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:He(t.onPointerLeave,vd(w=>l.onItemLeave(w))),onFocus:He(t.onFocus,()=>g(!0)),onBlur:He(t.onBlur,()=>g(!1))})})})}),mJ="MenuCheckboxItem",i4=b.forwardRef((t,e)=>{const{checked:r=!1,onCheckedChange:n,...a}=t;return p.jsx(d4,{scope:t.__scopeMenu,checked:r,children:p.jsx(oh,{role:"menuitemcheckbox","aria-checked":Am(r)?"mixed":r,...a,ref:e,"data-state":HR(r),onSelect:He(a.onSelect,()=>n?.(Am(r)?!0:!r),{checkForDefaultPrevented:!1})})})});i4.displayName=mJ;var s4="MenuRadioGroup",[hJ,gJ]=Os(s4,{value:void 0,onValueChange:()=>{}}),l4=b.forwardRef((t,e)=>{const{value:r,onValueChange:n,...a}=t,s=Ya(n);return p.jsx(hJ,{scope:t.__scopeMenu,value:r,onValueChange:s,children:p.jsx(BR,{...a,ref:e})})});l4.displayName=s4;var c4="MenuRadioItem",u4=b.forwardRef((t,e)=>{const{value:r,...n}=t,a=gJ(c4,t.__scopeMenu),s=r===a.value;return p.jsx(d4,{scope:t.__scopeMenu,checked:s,children:p.jsx(oh,{role:"menuitemradio","aria-checked":s,...n,ref:e,"data-state":HR(s),onSelect:He(n.onSelect,()=>a.onValueChange?.(r),{checkForDefaultPrevented:!1})})})});u4.displayName=c4;var qR="MenuItemIndicator",[d4,vJ]=Os(qR,{checked:!1}),f4=b.forwardRef((t,e)=>{const{__scopeMenu:r,forceMount:n,...a}=t,s=vJ(qR,r);return p.jsx(ua,{present:n||Am(s.checked)||s.checked===!0,children:p.jsx(yt.span,{...a,ref:e,"data-state":HR(s.checked)})})});f4.displayName=qR;var bJ="MenuSeparator",p4=b.forwardRef((t,e)=>{const{__scopeMenu:r,...n}=t;return p.jsx(yt.div,{role:"separator","aria-orientation":"horizontal",...n,ref:e})});p4.displayName=bJ;var yJ="MenuArrow",m4=b.forwardRef((t,e)=>{const{__scopeMenu:r,...n}=t,a=ah(r);return p.jsx(th,{...a,...n,ref:e})});m4.displayName=yJ;var EJ="MenuSub",[MEe,h4]=Os(EJ),Du="MenuSubTrigger",g4=b.forwardRef((t,e)=>{const r=Ds(Du,t.__scopeMenu),n=Wd(Du,t.__scopeMenu),a=h4(Du,t.__scopeMenu),s=zR(Du,t.__scopeMenu),l=b.useRef(null),{pointerGraceTimerRef:c,onPointerGraceIntentChange:d}=s,f={__scopeMenu:t.__scopeMenu},h=b.useCallback(()=>{l.current&&window.clearTimeout(l.current),l.current=null},[]);return b.useEffect(()=>h,[h]),b.useEffect(()=>{const g=c.current;return()=>{window.clearTimeout(g),d(null)}},[c,d]),p.jsx(UR,{asChild:!0,...f,children:p.jsx(o4,{id:a.triggerId,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":a.contentId,"data-state":y4(r.open),...t,ref:Ga(e,a.onTriggerChange),onClick:g=>{t.onClick?.(g),!(t.disabled||g.defaultPrevented)&&(g.currentTarget.focus(),r.open||r.onOpenChange(!0))},onPointerMove:He(t.onPointerMove,vd(g=>{s.onItemEnter(g),!g.defaultPrevented&&!t.disabled&&!r.open&&!l.current&&(s.onPointerGraceIntentChange(null),l.current=window.setTimeout(()=>{r.onOpenChange(!0),h()},100))})),onPointerLeave:He(t.onPointerLeave,vd(g=>{h();const v=r.content?.getBoundingClientRect();if(v){const y=r.content?.dataset.side,w=y==="right",S=w?-5:5,T=v[w?"left":"right"],x=v[w?"right":"left"];s.onPointerGraceIntentChange({area:[{x:g.clientX+S,y:g.clientY},{x:T,y:v.top},{x,y:v.top},{x,y:v.bottom},{x:T,y:v.bottom}],side:y}),window.clearTimeout(c.current),c.current=window.setTimeout(()=>s.onPointerGraceIntentChange(null),300)}else{if(s.onTriggerLeave(g),g.defaultPrevented)return;s.onPointerGraceIntentChange(null)}})),onKeyDown:He(t.onKeyDown,g=>{const v=s.searchRef.current!=="";t.disabled||v&&g.key===" "||eJ[n.dir].includes(g.key)&&(r.onOpenChange(!0),r.content?.focus(),g.preventDefault())})})})});g4.displayName=Du;var v4="MenuSubContent",b4=b.forwardRef((t,e)=>{const r=t4(ia,t.__scopeMenu),{forceMount:n=r.forceMount,...a}=t,s=Ds(ia,t.__scopeMenu),l=Wd(ia,t.__scopeMenu),c=h4(v4,t.__scopeMenu),d=b.useRef(null),f=kt(e,d);return p.jsx(gd.Provider,{scope:t.__scopeMenu,children:p.jsx(ua,{present:n||s.open,children:p.jsx(gd.Slot,{scope:t.__scopeMenu,children:p.jsx($R,{id:c.contentId,"aria-labelledby":c.triggerId,...a,ref:f,align:"start",side:l.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:h=>{l.isUsingKeyboardRef.current&&d.current?.focus(),h.preventDefault()},onCloseAutoFocus:h=>h.preventDefault(),onFocusOutside:He(t.onFocusOutside,h=>{h.target!==c.trigger&&s.onOpenChange(!1)}),onEscapeKeyDown:He(t.onEscapeKeyDown,h=>{l.onClose(),h.preventDefault()}),onKeyDown:He(t.onKeyDown,h=>{const g=h.currentTarget.contains(h.target),v=tJ[l.dir].includes(h.key);g&&v&&(s.onOpenChange(!1),c.trigger?.focus(),h.preventDefault())})})})})})});b4.displayName=v4;function y4(t){return t?"open":"closed"}function Am(t){return t==="indeterminate"}function HR(t){return Am(t)?"indeterminate":t?"checked":"unchecked"}function SJ(t){const e=document.activeElement;for(const r of t)if(r===e||(r.focus(),document.activeElement!==e))return}function xJ(t,e){return t.map((r,n)=>t[(e+n)%t.length])}function wJ(t,e,r){const a=e.length>1&&Array.from(e).every(f=>f===e[0])?e[0]:e,s=r?t.indexOf(r):-1;let l=xJ(t,Math.max(s,0));a.length===1&&(l=l.filter(f=>f!==r));const d=l.find(f=>f.toLowerCase().startsWith(a.toLowerCase()));return d!==r?d:void 0}function _J(t,e){const{x:r,y:n}=t;let a=!1;for(let s=0,l=e.length-1;s<e.length;l=s++){const c=e[s],d=e[l],f=c.x,h=c.y,g=d.x,v=d.y;h>n!=v>n&&r<(g-f)*(n-h)/(v-h)+f&&(a=!a)}return a}function TJ(t,e){if(!e)return!1;const r={x:t.clientX,y:t.clientY};return _J(r,e)}function vd(t){return e=>e.pointerType==="mouse"?t(e):void 0}var RJ=e4,CJ=UR,AJ=r4,NJ=n4,kJ=BR,IJ=a4,OJ=oh,DJ=i4,LJ=l4,MJ=u4,PJ=f4,jJ=p4,UJ=m4,FJ=g4,zJ=b4,ih="DropdownMenu",[$J]=Qa(ih,[QB]),fn=QB(),[BJ,E4]=$J(ih),S4=t=>{const{__scopeDropdownMenu:e,children:r,dir:n,open:a,defaultOpen:s,onOpenChange:l,modal:c=!0}=t,d=fn(e),f=b.useRef(null),[h,g]=Ri({prop:a,defaultProp:s??!1,onChange:l,caller:ih});return p.jsx(BJ,{scope:e,triggerId:Xr(),triggerRef:f,contentId:Xr(),open:h,onOpenChange:g,onOpenToggle:b.useCallback(()=>g(v=>!v),[g]),modal:c,children:p.jsx(RJ,{...d,open:h,onOpenChange:g,dir:n,modal:c,children:r})})};S4.displayName=ih;var x4="DropdownMenuTrigger",w4=b.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,disabled:n=!1,...a}=t,s=E4(x4,r),l=fn(r);return p.jsx(CJ,{asChild:!0,...l,children:p.jsx(yt.button,{type:"button",id:s.triggerId,"aria-haspopup":"menu","aria-expanded":s.open,"aria-controls":s.open?s.contentId:void 0,"data-state":s.open?"open":"closed","data-disabled":n?"":void 0,disabled:n,...a,ref:Ga(e,s.triggerRef),onPointerDown:He(t.onPointerDown,c=>{!n&&c.button===0&&c.ctrlKey===!1&&(s.onOpenToggle(),s.open||c.preventDefault())}),onKeyDown:He(t.onKeyDown,c=>{n||(["Enter"," "].includes(c.key)&&s.onOpenToggle(),c.key==="ArrowDown"&&s.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(c.key)&&c.preventDefault())})})})});w4.displayName=x4;var qJ="DropdownMenuPortal",_4=t=>{const{__scopeDropdownMenu:e,...r}=t,n=fn(e);return p.jsx(AJ,{...n,...r})};_4.displayName=qJ;var T4="DropdownMenuContent",R4=b.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,a=E4(T4,r),s=fn(r),l=b.useRef(!1);return p.jsx(NJ,{id:a.contentId,"aria-labelledby":a.triggerId,...s,...n,ref:e,onCloseAutoFocus:He(t.onCloseAutoFocus,c=>{l.current||a.triggerRef.current?.focus(),l.current=!1,c.preventDefault()}),onInteractOutside:He(t.onInteractOutside,c=>{const d=c.detail.originalEvent,f=d.button===0&&d.ctrlKey===!0,h=d.button===2||f;(!a.modal||h)&&(l.current=!0)}),style:{...t.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)"}})});R4.displayName=T4;var HJ="DropdownMenuGroup",VJ=b.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,a=fn(r);return p.jsx(kJ,{...a,...n,ref:e})});VJ.displayName=HJ;var GJ="DropdownMenuLabel",C4=b.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,a=fn(r);return p.jsx(IJ,{...a,...n,ref:e})});C4.displayName=GJ;var WJ="DropdownMenuItem",A4=b.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,a=fn(r);return p.jsx(OJ,{...a,...n,ref:e})});A4.displayName=WJ;var YJ="DropdownMenuCheckboxItem",N4=b.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,a=fn(r);return p.jsx(DJ,{...a,...n,ref:e})});N4.displayName=YJ;var KJ="DropdownMenuRadioGroup",ZJ=b.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,a=fn(r);return p.jsx(LJ,{...a,...n,ref:e})});ZJ.displayName=KJ;var XJ="DropdownMenuRadioItem",k4=b.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,a=fn(r);return p.jsx(MJ,{...a,...n,ref:e})});k4.displayName=XJ;var QJ="DropdownMenuItemIndicator",JJ=b.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,a=fn(r);return p.jsx(PJ,{...a,...n,ref:e})});JJ.displayName=QJ;var eee="DropdownMenuSeparator",I4=b.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,a=fn(r);return p.jsx(jJ,{...a,...n,ref:e})});I4.displayName=eee;var tee="DropdownMenuArrow",ree=b.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,a=fn(r);return p.jsx(UJ,{...a,...n,ref:e})});ree.displayName=tee;var nee="DropdownMenuSubTrigger",O4=b.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,a=fn(r);return p.jsx(FJ,{...a,...n,ref:e})});O4.displayName=nee;var aee="DropdownMenuSubContent",D4=b.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,a=fn(r);return p.jsx(zJ,{...a,...n,ref:e,style:{...t.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)"}})});D4.displayName=aee;var oee=S4,iee=w4,see=_4,L4=R4,M4=C4,P4=A4,lee=N4,cee=k4,j4=I4,uee=O4,dee=D4;const sT=oee,lT=iee;uee.displayName;dee.displayName;function Nm({ref:t,className:e,sideOffset:r=4,...n}){return p.jsx(see,{children:p.jsx(L4,{ref:t,sideOffset:r,className:De("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",e),...n})})}Nm.displayName=L4.displayName;function Co({ref:t,className:e,inset:r,...n}){return p.jsx(P4,{ref:t,className:De("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",r&&"pl-8",e),...n})}Co.displayName=P4.displayName;lee.displayName;cee.displayName;function cT({ref:t,className:e,inset:r,...n}){return p.jsx(M4,{ref:t,className:De("px-2 py-1.5 text-sm font-semibold",r&&"pl-8",e),...n})}cT.displayName=M4.displayName;function Lu({ref:t,className:e,...r}){return p.jsx(j4,{ref:t,className:De("-mx-1 my-1 h-px bg-muted",e),...r})}Lu.displayName=j4.displayName;var fee=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],$o=fee.reduce((t,e)=>{const r=W$(`Primitive.${e}`),n=b.forwardRef((a,s)=>{const{asChild:l,...c}=a,d=l?r:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),p.jsx(d,{...c,ref:s})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{}),pee="Label",U4=b.forwardRef((t,e)=>p.jsx($o.label,{...t,ref:e,onMouseDown:r=>{r.target.closest("button, input, select, textarea")||(t.onMouseDown?.(r),!r.defaultPrevented&&r.detail>1&&r.preventDefault())}}));U4.displayName=pee;var mee=U4;function lr({className:t,...e}){return p.jsx(mee,{"data-slot":"label",className:De("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",t),...e})}function VR({message:t,className:e="",vertical:r,noBorder:n}){return p.jsx("div",{className:De(`mt-2 rounded-md p-6 ${e}`,!n&&"border"),children:p.jsxs("p",{className:De("text-sm text-muted-foreground flex items-center gap-4",r&&"flex-col"),children:[p.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:p.jsx("g",{stroke:"none",strokeWidth:"1",fill:"none",fillRule:"evenodd",children:p.jsxs("g",{transform:"translate(5.320900, 5.320900)",fillRule:"nonzero",className:"stroke-black dark:stroke-white",strokeWidth:"4",children:[p.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"}),p.jsx("circle",{cx:"50",cy:"212.0001",r:"52.5"}),p.jsx("circle",{cx:"212.0001",cy:"50",r:"52.5"})]})})}),t]})})}function F4({className:t,color:e,children:r,grayscaled:n=!1}){const a=b.useMemo(()=>{if(e){const g=e.split("(")[1].split(")")[0].trim().split(/\s+/);return Number.parseFloat(g[1]||"0")}return n?0:.2},[e,n]),s=b.useMemo(()=>{if(e){const g=e.split("(")[1].split(")")[0].trim().split(/\s+/);return Number.parseFloat(g[0]||"0.5")}return n?.3:.4},[e,n]),l=b.useMemo(()=>{if(e){const g=e.split("(")[1].split(")")[0].trim().split(/\s+/);return Number.parseFloat(g[2]||"0")}return Math.floor(Math.random()*360)},[e]),c=b.useMemo(()=>e||`oklch(${Math.min(s,1)} ${a} ${l})`,[l,a,s]),d=b.useMemo(()=>`oklch(${Math.min(s*2,1)} ${a} ${l})`,[l,a,s,e]),f=b.useMemo(()=>Math.floor(Math.random()*360),[l]),h=b.useMemo(()=>"1000%",[]);return p.jsx("section",{className:De("relative w-full h-full overflow-hidden",t),style:{background:`${d}`},children:p.jsxs("div",{className:"isolate relative w-full h-full",children:[p.jsx("div",{className:"noise w-full h-full",style:{background:`linear-gradient(${f}deg, ${c}, transparent), url(https://grainy-gradients.vercel.app/noise.svg)`,filter:`contrast(120%) brightness(${h})`}}),r&&p.jsx("div",{className:"relative z-10 w-full h-full",children:r})]})})}function z4(t){const e=b.useRef({value:t,previous:t});return b.useMemo(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}var sh="Switch",[hee]=Qa(sh),[gee,vee]=hee(sh),$4=b.forwardRef((t,e)=>{const{__scopeSwitch:r,name:n,checked:a,defaultChecked:s,required:l,disabled:c,value:d="on",onCheckedChange:f,form:h,...g}=t,[v,y]=b.useState(null),w=kt(e,C=>y(C)),S=b.useRef(!1),T=v?h||!!v.closest("form"):!0,[x,_]=Ri({prop:a,defaultProp:s??!1,onChange:f,caller:sh});return p.jsxs(gee,{scope:r,checked:x,disabled:c,children:[p.jsx(yt.button,{type:"button",role:"switch","aria-checked":x,"aria-required":l,"data-state":V4(x),"data-disabled":c?"":void 0,disabled:c,value:d,...g,ref:w,onClick:He(t.onClick,C=>{_(N=>!N),T&&(S.current=C.isPropagationStopped(),S.current||C.stopPropagation())})}),T&&p.jsx(H4,{control:v,bubbles:!S.current,name:n,value:d,checked:x,required:l,disabled:c,form:h,style:{transform:"translateX(-100%)"}})]})});$4.displayName=sh;var B4="SwitchThumb",q4=b.forwardRef((t,e)=>{const{__scopeSwitch:r,...n}=t,a=vee(B4,r);return p.jsx(yt.span,{"data-state":V4(a.checked),"data-disabled":a.disabled?"":void 0,...n,ref:e})});q4.displayName=B4;var bee="SwitchBubbleInput",H4=b.forwardRef(({__scopeSwitch:t,control:e,checked:r,bubbles:n=!0,...a},s)=>{const l=b.useRef(null),c=kt(l,s),d=z4(r),f=CB(e);return b.useEffect(()=>{const h=l.current;if(!h)return;const g=window.HTMLInputElement.prototype,y=Object.getOwnPropertyDescriptor(g,"checked").set;if(d!==r&&y){const w=new Event("click",{bubbles:n});y.call(h,r),h.dispatchEvent(w)}},[d,r,n]),p.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:r,...a,tabIndex:-1,ref:c,style:{...a.style,...f,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});H4.displayName=bee;function V4(t){return t?"checked":"unchecked"}var G4=$4,yee=q4;function GR({ref:t,className:e,...r}){return p.jsx(G4,{className:De("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",e),...r,ref:t,children:p.jsx(yee,{className:De("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")})})}GR.displayName=G4.displayName;var W4=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"}),Eee="VisuallyHidden",Y4=b.forwardRef((t,e)=>p.jsx(yt.span,{...t,ref:e,style:{...W4,...t.style}}));Y4.displayName=Eee;var See=Y4,[lh]=Qa("Tooltip",[Oi]),ch=Oi(),K4="TooltipProvider",xee=700,uT="tooltip.open",[wee,WR]=lh(K4),Z4=t=>{const{__scopeTooltip:e,delayDuration:r=xee,skipDelayDuration:n=300,disableHoverableContent:a=!1,children:s}=t,l=b.useRef(!0),c=b.useRef(!1),d=b.useRef(0);return b.useEffect(()=>{const f=d.current;return()=>window.clearTimeout(f)},[]),p.jsx(wee,{scope:e,isOpenDelayedRef:l,delayDuration:r,onOpen:b.useCallback(()=>{window.clearTimeout(d.current),l.current=!1},[]),onClose:b.useCallback(()=>{window.clearTimeout(d.current),d.current=window.setTimeout(()=>l.current=!0,n)},[n]),isPointerInTransitRef:c,onPointerInTransitChange:b.useCallback(f=>{c.current=f},[]),disableHoverableContent:a,children:s})};Z4.displayName=K4;var bd="Tooltip",[_ee,Yd]=lh(bd),X4=t=>{const{__scopeTooltip:e,children:r,open:n,defaultOpen:a,onOpenChange:s,disableHoverableContent:l,delayDuration:c}=t,d=WR(bd,t.__scopeTooltip),f=ch(e),[h,g]=b.useState(null),v=Xr(),y=b.useRef(0),w=l??d.disableHoverableContent,S=c??d.delayDuration,T=b.useRef(!1),[x,_]=Ri({prop:n,defaultProp:a??!1,onChange:I=>{I?(d.onOpen(),document.dispatchEvent(new CustomEvent(uT))):d.onClose(),s?.(I)},caller:bd}),C=b.useMemo(()=>x?T.current?"delayed-open":"instant-open":"closed",[x]),N=b.useCallback(()=>{window.clearTimeout(y.current),y.current=0,T.current=!1,_(!0)},[_]),k=b.useCallback(()=>{window.clearTimeout(y.current),y.current=0,_(!1)},[_]),A=b.useCallback(()=>{window.clearTimeout(y.current),y.current=window.setTimeout(()=>{T.current=!0,_(!0),y.current=0},S)},[S,_]);return b.useEffect(()=>()=>{y.current&&(window.clearTimeout(y.current),y.current=0)},[]),p.jsx(Jm,{...f,children:p.jsx(_ee,{scope:e,contentId:v,open:x,stateAttribute:C,trigger:h,onTriggerChange:g,onTriggerEnter:b.useCallback(()=>{d.isOpenDelayedRef.current?A():N()},[d.isOpenDelayedRef,A,N]),onTriggerLeave:b.useCallback(()=>{w?k():(window.clearTimeout(y.current),y.current=0)},[k,w]),onOpen:N,onClose:k,disableHoverableContent:w,children:r})})};X4.displayName=bd;var dT="TooltipTrigger",Q4=b.forwardRef((t,e)=>{const{__scopeTooltip:r,...n}=t,a=Yd(dT,r),s=WR(dT,r),l=ch(r),c=b.useRef(null),d=kt(e,c,a.onTriggerChange),f=b.useRef(!1),h=b.useRef(!1),g=b.useCallback(()=>f.current=!1,[]);return b.useEffect(()=>()=>document.removeEventListener("pointerup",g),[g]),p.jsx(qd,{asChild:!0,...l,children:p.jsx(yt.button,{"aria-describedby":a.open?a.contentId:void 0,"data-state":a.stateAttribute,...n,ref:d,onPointerMove:He(t.onPointerMove,v=>{v.pointerType!=="touch"&&!h.current&&!s.isPointerInTransitRef.current&&(a.onTriggerEnter(),h.current=!0)}),onPointerLeave:He(t.onPointerLeave,()=>{a.onTriggerLeave(),h.current=!1}),onPointerDown:He(t.onPointerDown,()=>{a.open&&a.onClose(),f.current=!0,document.addEventListener("pointerup",g,{once:!0})}),onFocus:He(t.onFocus,()=>{f.current||a.onOpen()}),onBlur:He(t.onBlur,a.onClose),onClick:He(t.onClick,a.onClose)})})});Q4.displayName=dT;var YR="TooltipPortal",[Tee,Ree]=lh(YR,{forceMount:void 0}),J4=t=>{const{__scopeTooltip:e,forceMount:r,children:n,container:a}=t,s=Yd(YR,e);return p.jsx(Tee,{scope:e,forceMount:r,children:p.jsx(ua,{present:r||s.open,children:p.jsx(Cc,{asChild:!0,container:a,children:n})})})};J4.displayName=YR;var cc="TooltipContent",e3=b.forwardRef((t,e)=>{const r=Ree(cc,t.__scopeTooltip),{forceMount:n=r.forceMount,side:a="top",...s}=t,l=Yd(cc,t.__scopeTooltip);return p.jsx(ua,{present:n||l.open,children:l.disableHoverableContent?p.jsx(t3,{side:a,...s,ref:e}):p.jsx(Cee,{side:a,...s,ref:e})})}),Cee=b.forwardRef((t,e)=>{const r=Yd(cc,t.__scopeTooltip),n=WR(cc,t.__scopeTooltip),a=b.useRef(null),s=kt(e,a),[l,c]=b.useState(null),{trigger:d,onClose:f}=r,h=a.current,{onPointerInTransitChange:g}=n,v=b.useCallback(()=>{c(null),g(!1)},[g]),y=b.useCallback((w,S)=>{const T=w.currentTarget,x={x:w.clientX,y:w.clientY},_=Iee(x,T.getBoundingClientRect()),C=Oee(x,_),N=Dee(S.getBoundingClientRect()),k=Mee([...C,...N]);c(k),g(!0)},[g]);return b.useEffect(()=>()=>v(),[v]),b.useEffect(()=>{if(d&&h){const w=T=>y(T,h),S=T=>y(T,d);return d.addEventListener("pointerleave",w),h.addEventListener("pointerleave",S),()=>{d.removeEventListener("pointerleave",w),h.removeEventListener("pointerleave",S)}}},[d,h,y,v]),b.useEffect(()=>{if(l){const w=S=>{const T=S.target,x={x:S.clientX,y:S.clientY},_=d?.contains(T)||h?.contains(T),C=!Lee(x,l);_?v():C&&(v(),f())};return document.addEventListener("pointermove",w),()=>document.removeEventListener("pointermove",w)}},[d,h,l,f,v]),p.jsx(t3,{...t,ref:s})}),[Aee,Nee]=lh(bd,{isInside:!1}),kee=uZ("TooltipContent"),t3=b.forwardRef((t,e)=>{const{__scopeTooltip:r,children:n,"aria-label":a,onEscapeKeyDown:s,onPointerDownOutside:l,...c}=t,d=Yd(cc,r),f=ch(r),{onClose:h}=d;return b.useEffect(()=>(document.addEventListener(uT,h),()=>document.removeEventListener(uT,h)),[h]),b.useEffect(()=>{if(d.trigger){const g=v=>{v.target?.contains(d.trigger)&&h()};return window.addEventListener("scroll",g,{capture:!0}),()=>window.removeEventListener("scroll",g,{capture:!0})}},[d.trigger,h]),p.jsx(_c,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:l,onFocusOutside:g=>g.preventDefault(),onDismiss:h,children:p.jsxs(eh,{"data-state":d.stateAttribute,...f,...c,ref:e,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:[p.jsx(kee,{children:n}),p.jsx(Aee,{scope:r,isInside:!0,children:p.jsx(See,{id:d.contentId,role:"tooltip",children:a||n})})]})})});e3.displayName=cc;var r3="TooltipArrow",n3=b.forwardRef((t,e)=>{const{__scopeTooltip:r,...n}=t,a=ch(r);return Nee(r3,r).isInside?null:p.jsx(th,{...a,...n,ref:e})});n3.displayName=r3;function Iee(t,e){const r=Math.abs(e.top-t.y),n=Math.abs(e.bottom-t.y),a=Math.abs(e.right-t.x),s=Math.abs(e.left-t.x);switch(Math.min(r,n,a,s)){case s:return"left";case a:return"right";case r:return"top";case n:return"bottom";default:throw new Error("unreachable")}}function Oee(t,e,r=5){const n=[];switch(e){case"top":n.push({x:t.x-r,y:t.y+r},{x:t.x+r,y:t.y+r});break;case"bottom":n.push({x:t.x-r,y:t.y-r},{x:t.x+r,y:t.y-r});break;case"left":n.push({x:t.x+r,y:t.y-r},{x:t.x+r,y:t.y+r});break;case"right":n.push({x:t.x-r,y:t.y-r},{x:t.x-r,y:t.y+r});break}return n}function Dee(t){const{top:e,right:r,bottom:n,left:a}=t;return[{x:a,y:e},{x:r,y:e},{x:r,y:n},{x:a,y:n}]}function Lee(t,e){const{x:r,y:n}=t;let a=!1;for(let s=0,l=e.length-1;s<e.length;l=s++){const c=e[s],d=e[l],f=c.x,h=c.y,g=d.x,v=d.y;h>n!=v>n&&r<(g-f)*(n-h)/(v-h)+f&&(a=!a)}return a}function Mee(t){const e=t.slice();return e.sort((r,n)=>r.x<n.x?-1:r.x>n.x?1:r.y<n.y?-1:r.y>n.y?1:0),Pee(e)}function Pee(t){if(t.length<=1)return t.slice();const e=[];for(let n=0;n<t.length;n++){const a=t[n];for(;e.length>=2;){const s=e[e.length-1],l=e[e.length-2];if((s.x-l.x)*(a.y-l.y)>=(s.y-l.y)*(a.x-l.x))e.pop();else break}e.push(a)}e.pop();const r=[];for(let n=t.length-1;n>=0;n--){const a=t[n];for(;r.length>=2;){const s=r[r.length-1],l=r[r.length-2];if((s.x-l.x)*(a.y-l.y)>=(s.y-l.y)*(a.x-l.x))r.pop();else break}r.push(a)}return r.pop(),e.length===1&&r.length===1&&e[0].x===r[0].x&&e[0].y===r[0].y?e:e.concat(r)}var jee=Z4,Uee=X4,Fee=Q4,zee=J4,$ee=e3,Bee=n3;function a3({delayDuration:t=0,...e}){return p.jsx(jee,{"data-slot":"tooltip-provider",delayDuration:t,...e})}function Sr({...t}){return p.jsx(a3,{children:p.jsx(Uee,{"data-slot":"tooltip",...t})})}function xr({...t}){return p.jsx(Fee,{"data-slot":"tooltip-trigger",...t})}function wr({className:t,sideOffset:e=0,children:r,...n}){return p.jsx(zee,{children:p.jsxs($ee,{"data-slot":"tooltip-content",sideOffset:e,className:De("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",t),...n,children:[r,p.jsx(Bee,{className:"bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}class qee{name="mcp_inspector_open";properties;constructor(e){this.properties={server_url:e.serverUrl,connection_count:e.connectionCount}}}class iD{name="mcp_tool_execution";properties;constructor(e){this.properties={tool_name:e.toolName,server_id:e.serverId,success:e.success,duration:e.duration,error:e.error}}}class sD{name="mcp_resource_read";properties;constructor(e){this.properties={resource_uri:e.resourceUri,server_id:e.serverId,success:e.success,error:e.error}}}class lD{name="mcp_prompt_call";properties;constructor(e){this.properties={prompt_name:e.promptName,server_id:e.serverId,success:e.success,error:e.error}}}class cD{name="mcp_chat_message";properties;constructor(e){this.properties={server_id:e.serverId,provider:e.provider,model:e.model,message_count:e.messageCount,tool_calls_count:e.toolCallsCount,success:e.success,execution_mode:e.executionMode,duration:e.duration,error:e.error}}}class Hee{name="mcp_server_added";properties;constructor(e){this.properties={server_id:e.serverId,server_url:e.serverUrl,connection_type:e.connectionType,via_proxy:e.viaProxy}}}class Vee{name="mcp_server_removed";properties;constructor(e){this.properties={server_id:e.serverId}}}class Gee{name="mcp_command_palette_open";properties;constructor(e){this.properties={trigger:e.trigger}}}class Wee{name="mcp_tool_saved";properties;constructor(e){this.properties={tool_name:e.toolName,server_id:e.serverId}}}function ny(){try{return"0.6.0"}catch{return"0.0.0"}}var Yee={};function ay(){try{return typeof window<"u"&&typeof document<"u"}catch{return!1}}class uD{endpoint;timeout;constructor(e,r=3e3){this.endpoint=e,this.timeout=r}async logEvent(e){try{const r=new AbortController,n=setTimeout(()=>r.abort(),this.timeout),a=await fetch(this.endpoint,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),signal:r.signal});if(clearTimeout(n),!a.ok)throw new Error(`HTTP error! status: ${a.status}`)}catch{}}}function pi(t){return`mcp_inspector_telemetry_${t}`}class zr{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 e=ay(),r=this.isTelemetryDisabled();if(this._source=this.getStoredSource()||"inspector",r)this._posthogClient=null,this._scarfClient=null;else if(!e)this._posthogClient=null,this._scarfClient=null;else{try{this._posthogClient=new uD(this.POSTHOG_PROXY_URL,3e3)}catch{this._posthogClient=null}try{this._scarfClient=new uD(this.SCARF_PROXY_URL,3e3)}catch{this._scarfClient=null}}}isTelemetryDisabled(){return typeof localStorage<"u"&&localStorage.getItem(pi("disabled"))==="true"||typeof process<"u"&&Yee?.MCP_USE_ANONYMIZED_TELEMETRY==="false"}getStoredSource(){return typeof localStorage<"u"?localStorage.getItem(pi("source")):null}static getInstance(){return zr.instance||(zr.instance=new zr),zr.instance}setSource(e){this._source=e,typeof localStorage<"u"&&localStorage.setItem(pi("source"),e)}getSource(){return this._source}get userId(){if(this._currUserId)return this._currUserId;if(!ay())return this._currUserId=this.UNKNOWN_USER_ID,this._currUserId;try{const e=localStorage.getItem(pi("user_id"));if(e)this._currUserId=e;else{const r=this.generateUserId();localStorage.setItem(pi("user_id"),r),this._currUserId=r}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,e=>{const r=Math.random()*16|0;return(e==="x"?r:r&3|8).toString(16)})}async capture(e){if(!(!this._posthogClient&&!this._scarfClient)){if(this._posthogClient)try{const r={event:e.name,user_id:this.userId,properties:{...e.properties,mcp_use_version:ny(),language:"typescript",source:this._source,package:"inspector"}};await this._posthogClient.logEvent(r)}catch{}if(this._scarfClient)try{const r={};r.mcp_use_version=ny(),r.user_id=this.userId,r.event=e.name,r.language="typescript",r.source=this._source,r.package="inspector",await this._scarfClient.logEvent(r)}catch{}}}async trackPackageDownload(e){if(this._scarfClient&&ay())try{const r=ny();let n=!1,a=!1;const s=localStorage.getItem(pi("download_version"));if(s?r>s&&(n=!0,a=!1,localStorage.setItem(pi("download_version"),r)):(n=!0,a=!0,localStorage.setItem(pi("download_version"),r)),n){const l={...e||{}};l.mcp_use_version=r,l.user_id=this.userId,l.event="package_download",l.first_download=a,l.language="typescript",l.source=this._source,l.package="inspector",await this._scarfClient.logEvent(l)}}catch{}}async trackInspectorOpen(e){const r=new qee(e);await this.capture(r)}}const o3=b.createContext(void 0);function Kee({url:t,name:e,proxyConfig:r,transportType:n,onUpdate:a,onRemove:s}){const l=typeof window<"u"?new URL("/inspector/oauth/callback",window.location.origin).toString():"/inspector/oauth/callback";let c=t,d={};if(r?.proxyAddress){const v=new URL(r.proxyAddress),y=new URL(t);c=`${v.origin}${v.pathname}${y.pathname}${y.search}`,d["X-Target-URL"]=t}r?.customHeaders&&(d={...d,...r.customHeaders});const f=SR({url:c,callbackUrl:l,customHeaders:Object.keys(d).length>0?d:void 0,transportType:n||"http"}),h=b.useRef(a),g=b.useRef(null);return b.useEffect(()=>{h.current=a},[a]),b.useEffect(()=>{if(typeof queueMicrotask<"u")queueMicrotask(()=>{f.state==="ready"&&f.serverInfo&&console.log("[McpContext] Server info available:",f.serverInfo);const v={id:t,url:t,name:f.serverInfo?.name||e,state:f.state,tools:f.tools,resources:f.resources,prompts:f.prompts,error:f.error??null,authUrl:f.authUrl??null,customHeaders:d,transportType:n,proxyConfig:r,serverInfo:f.serverInfo,capabilities:f.capabilities,callTool:f.callTool,readResource:f.readResource,listPrompts:f.listPrompts,getPrompt:f.getPrompt,authenticate:f.authenticate,retry:f.retry,clearStorage:f.clearStorage,client:f.client},y=g.current;(!y||y.state!==v.state||y.error!==v.error||y.authUrl!==v.authUrl||y.name!==v.name||y.tools.length!==v.tools.length||y.resources.length!==v.resources.length||y.prompts.length!==v.prompts.length||y.serverInfo!==v.serverInfo||y.capabilities!==v.capabilities||!y.client)&&(g.current=v,h.current(v))});else{const v={id:t,url:t,name:f.serverInfo?.name||e,state:f.state,tools:f.tools,resources:f.resources,prompts:f.prompts,error:f.error??null,authUrl:f.authUrl??null,customHeaders:d,transportType:n,proxyConfig:r,serverInfo:f.serverInfo,capabilities:f.capabilities,callTool:f.callTool,readResource:f.readResource,listPrompts:f.listPrompts,getPrompt:f.getPrompt,authenticate:f.authenticate,retry:f.retry,clearStorage:f.clearStorage,client:f.client},y=g.current;(!y||y.state!==v.state||y.error!==v.error||y.authUrl!==v.authUrl||y.name!==v.name||y.tools.length!==v.tools.length||y.resources.length!==v.resources.length||y.prompts.length!==v.prompts.length||y.serverInfo!==v.serverInfo||y.capabilities!==v.capabilities||!y.client)&&(g.current=v,h.current(v))}},[t,e,n,r,f.state,f.tools,f.resources,f.prompts,f.error,f.authUrl,f.serverInfo,f.capabilities,f.client]),null}function Zee({children:t}){const[e,r]=b.useState([]),[n,a]=b.useState(new Map),[s,l]=b.useState(0),[c,d]=b.useState(!0),[f,h]=b.useState(new Set);b.useEffect(()=>{const k=localStorage.getItem("mcp-inspector-connections");if(k)try{const I=JSON.parse(k),O=Array.isArray(I)?I.filter(M=>M&&typeof M=="object"&&typeof M.id=="string"&&typeof M.url=="string"&&typeof M.name=="string").map(M=>(M.transportType||(M.transportType="http"),M)):[];(O.length!==I.length||O.some(M=>M.transportType==="http"&&!I.find(P=>P.id===M.id&&P.transportType)))&&(console.warn("Updated connections in localStorage with transport type migration"),localStorage.setItem("mcp-inspector-connections",JSON.stringify(O))),r(O)}catch(I){console.error("Failed to parse saved connections:",I),localStorage.removeItem("mcp-inspector-connections")}const A=localStorage.getItem("mcp-inspector-auto-connect");A!==null&&d(A==="true")},[]);const g=b.useCallback(k=>{a(A=>new Map(A).set(k.id,k)),l(A=>A+1),k.serverInfo?.name&&k.state==="ready"&&r(A=>{const I=A.find(O=>O.id===k.id);if(I&&I.name!==k.serverInfo.name){const O=A.map(L=>L.id===k.id?{...L,name:k.serverInfo.name}:L);return localStorage.setItem("mcp-inspector-connections",JSON.stringify(O)),O}return A})},[]),v=b.useCallback((k,A,I,O)=>{const M={id:k,url:k,name:A||k,proxyConfig:I,transportType:O||"http"};r(P=>{if(P.some(X=>X.id===k))return P;const W=[...P,M];return localStorage.setItem("mcp-inspector-connections",JSON.stringify(W)),W})},[]),y=b.useCallback(k=>{zr.getInstance().capture(new Vee({serverId:k})).catch(()=>{}),r(I=>{const O=I.filter(L=>L.id!==k);return localStorage.setItem("mcp-inspector-connections",JSON.stringify(O)),O}),a(I=>{const O=new Map(I),L=O.get(k);if(L){try{L.clearStorage()}catch(M){console.error("Failed to clear storage:",M)}O.delete(k)}return O})},[]),w=b.useCallback(k=>{const A=n.get(k);if(A)return A;const I=e.find(O=>O.id===k);if(I)return{id:I.id,url:I.url,name:I.name,state:"disconnected",tools:[],resources:[],prompts:[],error:null,authUrl:null,transportType:I.transportType,proxyConfig:I.proxyConfig,listPrompts:async O=>{throw new Error("Not connected")},getPrompt:async()=>{throw new Error("Not connected")},callTool:async()=>{throw new Error("Not connected")},readResource:async()=>{throw new Error("Not connected")},authenticate:()=>{},retry:()=>{},clearStorage:()=>{},client:null}},[n,e]),S=b.useCallback(k=>{d(k),localStorage.setItem("mcp-inspector-auto-connect",String(k)),k||h(new Set)},[]),T=b.useCallback(k=>{h(A=>new Set(A).add(k))},[]),x=b.useCallback(k=>{h(A=>{const I=new Set(A);return I.delete(k),I}),a(A=>{const I=new Map(A),O=I.get(k);if(O){try{O.clearStorage()}catch(L){console.error("Failed to clear storage:",L)}I.delete(k)}return I})},[]),_=b.useCallback((k,A)=>{r(I=>{const O=I.map(L=>L.id===k?{...L,name:A.name||L.name,proxyConfig:A.proxyConfig,transportType:A.transportType||L.transportType}:L);return localStorage.setItem("mcp-inspector-connections",JSON.stringify(O)),O})},[]),C=b.useMemo(()=>e.map(A=>{const I=n.get(A.id);return I||{id:A.id,url:A.url,name:A.name,state:"disconnected",tools:[],resources:[],prompts:[],error:null,authUrl:null,transportType:A.transportType,proxyConfig:A.proxyConfig,callTool:async()=>{throw new Error("Not connected")},readResource:async()=>{throw new Error("Not connected")},listPrompts:async O=>{throw new Error("Not connected")},getPrompt:async()=>{throw new Error("Not connected")},authenticate:()=>{},retry:()=>{},clearStorage:()=>{},client:null}}),[n,e,s]),N=b.useMemo(()=>({connections:C,addConnection:v,removeConnection:y,getConnection:w,autoConnect:c,setAutoConnect:S,connectServer:T,disconnectServer:x,updateConnectionConfig:_}),[C,v,y,w,c,S,T,x,_]);return p.jsxs(o3,{value:N,children:[e.filter(k=>c||f.has(k.id)).map(k=>p.jsx(Kee,{url:k.url,name:k.name,proxyConfig:k.proxyConfig,transportType:k.transportType,onUpdate:g,onRemove:()=>y(k.id)},`${k.id}-${k.transportType||"http"}-${k.proxyConfig?.proxyAddress||""}`)),t]})}function KR(){const t=b.use(o3);if(!t)throw new Error("useMcpContext must be used within McpProvider");return t}const Xee=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Qee=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,r,n)=>n?n.toUpperCase():r.toLowerCase()),dD=t=>{const e=Qee(t);return e.charAt(0).toUpperCase()+e.slice(1)},i3=(...t)=>t.filter((e,r,n)=>!!e&&e.trim()!==""&&n.indexOf(e)===r).join(" ").trim(),Jee=t=>{for(const e in t)if(e.startsWith("aria-")||e==="role"||e==="title")return!0};var ete={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 tte=b.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:r=2,absoluteStrokeWidth:n,className:a="",children:s,iconNode:l,...c},d)=>b.createElement("svg",{ref:d,...ete,width:e,height:e,stroke:t,strokeWidth:n?Number(r)*24/Number(e):r,className:i3("lucide",a),...!s&&!Jee(c)&&{"aria-hidden":"true"},...c},[...l.map(([f,h])=>b.createElement(f,h)),...Array.isArray(s)?s:[s]]));const ot=(t,e)=>{const r=b.forwardRef(({className:n,...a},s)=>b.createElement(tte,{ref:s,iconNode:e,className:i3(`lucide-${Xee(dD(t))}`,`lucide-${t}`,n),...a}));return r.displayName=dD(t),r};const rte=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],nte=ot("arrow-up",rte);const ate=[["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"}]],ote=ot("brush",ate);const ite=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Mo=ot("check",ite);const ste=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],ZR=ot("chevron-down",ste);const lte=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],XR=ot("chevron-left",lte);const cte=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],ute=ot("chevron-up",cte);const dte=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}]],fD=ot("circle-minus",dte);const fte=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],uc=ot("clock",fte);const pte=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],mte=ot("code",pte);const hte=[["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"}]],gte=ot("cog",hte);const vte=[["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"}]],bte=ot("command",vte);const yte=[["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"}]],$n=ot("copy",yte);const Ete=[["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"}]],uh=ot("database",Ete);const Ste=[["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"}]],s3=ot("download",Ste);const xte=[["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"}]],wte=ot("ellipsis-vertical",xte);const _te=[["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"}]],pD=ot("external-link",_te);const Tte=[["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"}]],Rte=ot("eye-off",Tte);const Cte=[["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"}]],mD=ot("eye",Cte);const Ate=[["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"}]],Nte=ot("file-code",Ate);const kte=[["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"}]],Ite=ot("file-image",kte);const Ote=[["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"}]],QR=ot("file-text",Ote);const Dte=[["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"}]],Lte=ot("file",Dte);const Mte=[["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"}]],Pte=ot("folder-open",Mte);const jte=[["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"}]],Ute=ot("globe",jte);const Fte=[["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"}]],zte=ot("grip-vertical",Fte);const $te=[["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"}]],l3=ot("history",$te);const Bte=[["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"}]],c3=ot("key",Bte);const qte=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Kd=ot("loader-circle",qte);const Hte=[["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"}]],Vte=ot("maximize",Hte);const Gte=[["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"}]],Wte=ot("message-circle",Gte);const Yte=[["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"}]],yd=ot("message-square",Yte);const Kte=[["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"}]],hD=ot("monitor",Kte);const Zte=[["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"}]],Xte=ot("moon",Zte);const Qte=[["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"}]],u3=ot("play",Qte);const Jte=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],d3=ot("plus",Jte);const ere=[["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"}]],gD=ot("rotate-ccw",ere);const tre=[["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"}]],JR=ot("save",tre);const rre=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],eC=ot("search",rre);const nre=[["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"}]],are=ot("send",nre);const ore=[["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"}]],ire=ot("server",ore);const sre=[["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"}]],Hl=ot("settings",sre);const lre=[["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"}]],cre=ot("shield",lre);const ure=[["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"}]],dre=ot("square-pen",ure);const fre=[["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"}]],pre=ot("sun-dim",fre);const mre=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],oy=ot("terminal",mre);const hre=[["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"}]],fT=ot("trash-2",hre);const gre=[["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"}]],vre=ot("trash",gre);const bre=[["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"}]],Rs=ot("wrench",bre);const yre=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Zd=ot("x",yre);const Ere=[["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"}]],Ed=ot("zap",Ere);function Sre(t){if(typeof document>"u")return;let e=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",e.appendChild(r),r.styleSheet?r.styleSheet.cssText=t:r.appendChild(document.createTextNode(t))}const xre=t=>{switch(t){case"success":return Tre;case"info":return Cre;case"warning":return Rre;case"error":return Are;default:return null}},wre=Array(12).fill(0),_re=({visible:t,className:e})=>ce.createElement("div",{className:["sonner-loading-wrapper",e].filter(Boolean).join(" "),"data-visible":t},ce.createElement("div",{className:"sonner-spinner"},wre.map((r,n)=>ce.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${n}`})))),Tre=ce.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},ce.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"})),Rre=ce.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},ce.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"})),Cre=ce.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},ce.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"})),Are=ce.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},ce.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"})),Nre=ce.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"},ce.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),ce.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),kre=()=>{const[t,e]=ce.useState(document.hidden);return ce.useEffect(()=>{const r=()=>{e(document.hidden)};return document.addEventListener("visibilitychange",r),()=>window.removeEventListener("visibilitychange",r)},[]),t};let pT=1;class Ire{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{const r=this.subscribers.indexOf(e);this.subscribers.splice(r,1)}),this.publish=e=>{this.subscribers.forEach(r=>r(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]},this.create=e=>{var r;const{message:n,...a}=e,s=typeof e?.id=="number"||((r=e.id)==null?void 0:r.length)>0?e.id:pT++,l=this.toasts.find(d=>d.id===s),c=e.dismissible===void 0?!0:e.dismissible;return this.dismissedToasts.has(s)&&this.dismissedToasts.delete(s),l?this.toasts=this.toasts.map(d=>d.id===s?(this.publish({...d,...e,id:s,title:n}),{...d,...e,id:s,dismissible:c,title:n}):d):this.addToast({title:n,...a,dismissible:c,id:s}),s},this.dismiss=e=>(e?(this.dismissedToasts.add(e),requestAnimationFrame(()=>this.subscribers.forEach(r=>r({id:e,dismiss:!0})))):this.toasts.forEach(r=>{this.subscribers.forEach(n=>n({id:r.id,dismiss:!0}))}),e),this.message=(e,r)=>this.create({...r,message:e}),this.error=(e,r)=>this.create({...r,message:e,type:"error"}),this.success=(e,r)=>this.create({...r,type:"success",message:e}),this.info=(e,r)=>this.create({...r,type:"info",message:e}),this.warning=(e,r)=>this.create({...r,type:"warning",message:e}),this.loading=(e,r)=>this.create({...r,type:"loading",message:e}),this.promise=(e,r)=>{if(!r)return;let n;r.loading!==void 0&&(n=this.create({...r,promise:e,type:"loading",message:r.loading,description:typeof r.description!="function"?r.description:void 0}));const a=Promise.resolve(e instanceof Function?e():e);let s=n!==void 0,l;const c=a.then(async f=>{if(l=["resolve",f],ce.isValidElement(f))s=!1,this.create({id:n,type:"default",message:f});else if(Dre(f)&&!f.ok){s=!1;const g=typeof r.error=="function"?await r.error(`HTTP error! status: ${f.status}`):r.error,v=typeof r.description=="function"?await r.description(`HTTP error! status: ${f.status}`):r.description,w=typeof g=="object"&&!ce.isValidElement(g)?g:{message:g};this.create({id:n,type:"error",description:v,...w})}else if(f instanceof Error){s=!1;const g=typeof r.error=="function"?await r.error(f):r.error,v=typeof r.description=="function"?await r.description(f):r.description,w=typeof g=="object"&&!ce.isValidElement(g)?g:{message:g};this.create({id:n,type:"error",description:v,...w})}else if(r.success!==void 0){s=!1;const g=typeof r.success=="function"?await r.success(f):r.success,v=typeof r.description=="function"?await r.description(f):r.description,w=typeof g=="object"&&!ce.isValidElement(g)?g:{message:g};this.create({id:n,type:"success",description:v,...w})}}).catch(async f=>{if(l=["reject",f],r.error!==void 0){s=!1;const h=typeof r.error=="function"?await r.error(f):r.error,g=typeof r.description=="function"?await r.description(f):r.description,y=typeof h=="object"&&!ce.isValidElement(h)?h:{message:h};this.create({id:n,type:"error",description:g,...y})}}).finally(()=>{s&&(this.dismiss(n),n=void 0),r.finally==null||r.finally.call(r)}),d=()=>new Promise((f,h)=>c.then(()=>l[0]==="reject"?h(l[1]):f(l[1])).catch(h));return typeof n!="string"&&typeof n!="number"?{unwrap:d}:Object.assign(n,{unwrap:d})},this.custom=(e,r)=>{const n=r?.id||pT++;return this.create({jsx:e(n),id:n,...r}),n},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}}const Sn=new Ire,Ore=(t,e)=>{const r=e?.id||pT++;return Sn.addToast({title:t,...e,id:r}),r},Dre=t=>t&&typeof t=="object"&&"ok"in t&&typeof t.ok=="boolean"&&"status"in t&&typeof t.status=="number",Lre=Ore,Mre=()=>Sn.toasts,Pre=()=>Sn.getActiveToasts(),cr=Object.assign(Lre,{success:Sn.success,info:Sn.info,warning:Sn.warning,error:Sn.error,custom:Sn.custom,message:Sn.message,promise:Sn.promise,dismiss:Sn.dismiss,loading:Sn.loading},{getHistory:Mre,getToasts:Pre});Sre("[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 Ap(t){return t.label!==void 0}const jre=3,Ure="24px",Fre="16px",vD=4e3,zre=356,$re=14,Bre=45,qre=200;function Ia(...t){return t.filter(Boolean).join(" ")}function Hre(t){const[e,r]=t.split("-"),n=[];return e&&n.push(e),r&&n.push(r),n}const Vre=t=>{var e,r,n,a,s,l,c,d,f;const{invert:h,toast:g,unstyled:v,interacting:y,setHeights:w,visibleToasts:S,heights:T,index:x,toasts:_,expanded:C,removeToast:N,defaultRichColors:k,closeButton:A,style:I,cancelButtonStyle:O,actionButtonStyle:L,className:M="",descriptionClassName:P="",duration:W,position:X,gap:ee,expandByDefault:J,classNames:B,icons:Y,closeButtonAriaLabel:H="Close toast"}=t,[re,Q]=ce.useState(null),[j,q]=ce.useState(null),[z,G]=ce.useState(!1),[Z,U]=ce.useState(!1),[F,te]=ce.useState(!1),[fe,V]=ce.useState(!1),[de,le]=ce.useState(!1),[pe,Re]=ce.useState(0),[Ke,je]=ce.useState(0),ze=ce.useRef(g.duration||W||vD),_e=ce.useRef(null),Ae=ce.useRef(null),$e=x===0,oe=x+1<=S,Se=g.type,Le=g.dismissible!==!1,we=g.className||"",ke=g.descriptionClassName||"",Oe=ce.useMemo(()=>T.findIndex(rt=>rt.toastId===g.id)||0,[T,g.id]),Ve=ce.useMemo(()=>{var rt;return(rt=g.closeButton)!=null?rt:A},[g.closeButton,A]),et=ce.useMemo(()=>g.duration||W||vD,[g.duration,W]),ut=ce.useRef(0),At=ce.useRef(0),An=ce.useRef(0),vr=ce.useRef(null),[or,Mt]=X.split("-"),Zt=ce.useMemo(()=>T.reduce((rt,jt,Qt)=>Qt>=Oe?rt:rt+jt.height,0),[T,Oe]),fr=kre(),_r=g.invert||h,Bn=Se==="loading";At.current=ce.useMemo(()=>Oe*ee+Zt,[Oe,Zt]),ce.useEffect(()=>{ze.current=et},[et]),ce.useEffect(()=>{G(!0)},[]),ce.useEffect(()=>{const rt=Ae.current;if(rt){const jt=rt.getBoundingClientRect().height;return je(jt),w(Qt=>[{toastId:g.id,height:jt,position:g.position},...Qt]),()=>w(Qt=>Qt.filter(jr=>jr.toastId!==g.id))}},[w,g.id]),ce.useLayoutEffect(()=>{if(!z)return;const rt=Ae.current,jt=rt.style.height;rt.style.height="auto";const Qt=rt.getBoundingClientRect().height;rt.style.height=jt,je(Qt),w(jr=>jr.find(Xt=>Xt.toastId===g.id)?jr.map(Xt=>Xt.toastId===g.id?{...Xt,height:Qt}:Xt):[{toastId:g.id,height:Qt,position:g.position},...jr])},[z,g.title,g.description,w,g.id,g.jsx,g.action,g.cancel]);const ir=ce.useCallback(()=>{U(!0),Re(At.current),w(rt=>rt.filter(jt=>jt.toastId!==g.id)),setTimeout(()=>{N(g)},qre)},[g,N,w,At]);ce.useEffect(()=>{if(g.promise&&Se==="loading"||g.duration===1/0||g.type==="loading")return;let rt;return C||y||fr?(()=>{if(An.current<ut.current){const jr=new Date().getTime()-ut.current;ze.current=ze.current-jr}An.current=new Date().getTime()})():(()=>{ze.current!==1/0&&(ut.current=new Date().getTime(),rt=setTimeout(()=>{g.onAutoClose==null||g.onAutoClose.call(g,g),ir()},ze.current))})(),()=>clearTimeout(rt)},[C,y,g,Se,fr,ir]),ce.useEffect(()=>{g.delete&&(ir(),g.onDismiss==null||g.onDismiss.call(g,g))},[ir,g.delete]);function Gt(){var rt;if(Y?.loading){var jt;return ce.createElement("div",{className:Ia(B?.loader,g==null||(jt=g.classNames)==null?void 0:jt.loader,"sonner-loader"),"data-visible":Se==="loading"},Y.loading)}return ce.createElement(_re,{className:Ia(B?.loader,g==null||(rt=g.classNames)==null?void 0:rt.loader),visible:Se==="loading"})}const pn=g.icon||Y?.[Se]||xre(Se);var da,an;return ce.createElement("li",{tabIndex:0,ref:Ae,className:Ia(M,we,B?.toast,g==null||(e=g.classNames)==null?void 0:e.toast,B?.default,B?.[Se],g==null||(r=g.classNames)==null?void 0:r[Se]),"data-sonner-toast":"","data-rich-colors":(da=g.richColors)!=null?da:k,"data-styled":!(g.jsx||g.unstyled||v),"data-mounted":z,"data-promise":!!g.promise,"data-swiped":de,"data-removed":Z,"data-visible":oe,"data-y-position":or,"data-x-position":Mt,"data-index":x,"data-front":$e,"data-swiping":F,"data-dismissible":Le,"data-type":Se,"data-invert":_r,"data-swipe-out":fe,"data-swipe-direction":j,"data-expanded":!!(C||J&&z),"data-testid":g.testId,style:{"--index":x,"--toasts-before":x,"--z-index":_.length-x,"--offset":`${Z?pe:At.current}px`,"--initial-height":J?"auto":`${Ke}px`,...I,...g.style},onDragEnd:()=>{te(!1),Q(null),vr.current=null},onPointerDown:rt=>{rt.button!==2&&(Bn||!Le||(_e.current=new Date,Re(At.current),rt.target.setPointerCapture(rt.pointerId),rt.target.tagName!=="BUTTON"&&(te(!0),vr.current={x:rt.clientX,y:rt.clientY})))},onPointerUp:()=>{var rt,jt,Qt;if(fe||!Le)return;vr.current=null;const jr=Number(((rt=Ae.current)==null?void 0:rt.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),qn=Number(((jt=Ae.current)==null?void 0:jt.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),Xt=new Date().getTime()-((Qt=_e.current)==null?void 0:Qt.getTime()),Jr=re==="x"?jr:qn,Ta=Math.abs(Jr)/Xt;if(Math.abs(Jr)>=Bre||Ta>.11){Re(At.current),g.onDismiss==null||g.onDismiss.call(g,g),q(re==="x"?jr>0?"right":"left":qn>0?"down":"up"),ir(),V(!0);return}else{var en,Br;(en=Ae.current)==null||en.style.setProperty("--swipe-amount-x","0px"),(Br=Ae.current)==null||Br.style.setProperty("--swipe-amount-y","0px")}le(!1),te(!1),Q(null)},onPointerMove:rt=>{var jt,Qt,jr;if(!vr.current||!Le||((jt=window.getSelection())==null?void 0:jt.toString().length)>0)return;const Xt=rt.clientY-vr.current.y,Jr=rt.clientX-vr.current.x;var Ta;const en=(Ta=t.swipeDirections)!=null?Ta:Hre(X);!re&&(Math.abs(Jr)>1||Math.abs(Xt)>1)&&Q(Math.abs(Jr)>Math.abs(Xt)?"x":"y");let Br={x:0,y:0};const ae=K=>1/(1.5+Math.abs(K)/20);if(re==="y"){if(en.includes("top")||en.includes("bottom"))if(en.includes("top")&&Xt<0||en.includes("bottom")&&Xt>0)Br.y=Xt;else{const K=Xt*ae(Xt);Br.y=Math.abs(K)<Math.abs(Xt)?K:Xt}}else if(re==="x"&&(en.includes("left")||en.includes("right")))if(en.includes("left")&&Jr<0||en.includes("right")&&Jr>0)Br.x=Jr;else{const K=Jr*ae(Jr);Br.x=Math.abs(K)<Math.abs(Jr)?K:Jr}(Math.abs(Br.x)>0||Math.abs(Br.y)>0)&&le(!0),(Qt=Ae.current)==null||Qt.style.setProperty("--swipe-amount-x",`${Br.x}px`),(jr=Ae.current)==null||jr.style.setProperty("--swipe-amount-y",`${Br.y}px`)}},Ve&&!g.jsx&&Se!=="loading"?ce.createElement("button",{"aria-label":H,"data-disabled":Bn,"data-close-button":!0,onClick:Bn||!Le?()=>{}:()=>{ir(),g.onDismiss==null||g.onDismiss.call(g,g)},className:Ia(B?.closeButton,g==null||(n=g.classNames)==null?void 0:n.closeButton)},(an=Y?.close)!=null?an:Nre):null,(Se||g.icon||g.promise)&&g.icon!==null&&(Y?.[Se]!==null||g.icon)?ce.createElement("div",{"data-icon":"",className:Ia(B?.icon,g==null||(a=g.classNames)==null?void 0:a.icon)},g.promise||g.type==="loading"&&!g.icon?g.icon||Gt():null,g.type!=="loading"?pn:null):null,ce.createElement("div",{"data-content":"",className:Ia(B?.content,g==null||(s=g.classNames)==null?void 0:s.content)},ce.createElement("div",{"data-title":"",className:Ia(B?.title,g==null||(l=g.classNames)==null?void 0:l.title)},g.jsx?g.jsx:typeof g.title=="function"?g.title():g.title),g.description?ce.createElement("div",{"data-description":"",className:Ia(P,ke,B?.description,g==null||(c=g.classNames)==null?void 0:c.description)},typeof g.description=="function"?g.description():g.description):null),ce.isValidElement(g.cancel)?g.cancel:g.cancel&&Ap(g.cancel)?ce.createElement("button",{"data-button":!0,"data-cancel":!0,style:g.cancelButtonStyle||O,onClick:rt=>{Ap(g.cancel)&&Le&&(g.cancel.onClick==null||g.cancel.onClick.call(g.cancel,rt),ir())},className:Ia(B?.cancelButton,g==null||(d=g.classNames)==null?void 0:d.cancelButton)},g.cancel.label):null,ce.isValidElement(g.action)?g.action:g.action&&Ap(g.action)?ce.createElement("button",{"data-button":!0,"data-action":!0,style:g.actionButtonStyle||L,onClick:rt=>{Ap(g.action)&&(g.action.onClick==null||g.action.onClick.call(g.action,rt),!rt.defaultPrevented&&ir())},className:Ia(B?.actionButton,g==null||(f=g.classNames)==null?void 0:f.actionButton)},g.action.label):null)};function bD(){if(typeof window>"u"||typeof document>"u")return"ltr";const t=document.documentElement.getAttribute("dir");return t==="auto"||!t?window.getComputedStyle(document.documentElement).direction:t}function Gre(t,e){const r={};return[t,e].forEach((n,a)=>{const s=a===1,l=s?"--mobile-offset":"--offset",c=s?Fre:Ure;function d(f){["top","right","bottom","left"].forEach(h=>{r[`${l}-${h}`]=typeof f=="number"?`${f}px`:f})}typeof n=="number"||typeof n=="string"?d(n):typeof n=="object"?["top","right","bottom","left"].forEach(f=>{n[f]===void 0?r[`${l}-${f}`]=c:r[`${l}-${f}`]=typeof n[f]=="number"?`${n[f]}px`:n[f]}):d(c)}),r}const Wre=ce.forwardRef(function(e,r){const{id:n,invert:a,position:s="bottom-right",hotkey:l=["altKey","KeyT"],expand:c,closeButton:d,className:f,offset:h,mobileOffset:g,theme:v="light",richColors:y,duration:w,style:S,visibleToasts:T=jre,toastOptions:x,dir:_=bD(),gap:C=$re,icons:N,containerAriaLabel:k="Notifications"}=e,[A,I]=ce.useState([]),O=ce.useMemo(()=>n?A.filter(z=>z.toasterId===n):A.filter(z=>!z.toasterId),[A,n]),L=ce.useMemo(()=>Array.from(new Set([s].concat(O.filter(z=>z.position).map(z=>z.position)))),[O,s]),[M,P]=ce.useState([]),[W,X]=ce.useState(!1),[ee,J]=ce.useState(!1),[B,Y]=ce.useState(v!=="system"?v:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),H=ce.useRef(null),re=l.join("+").replace(/Key/g,"").replace(/Digit/g,""),Q=ce.useRef(null),j=ce.useRef(!1),q=ce.useCallback(z=>{I(G=>{var Z;return(Z=G.find(U=>U.id===z.id))!=null&&Z.delete||Sn.dismiss(z.id),G.filter(({id:U})=>U!==z.id)})},[]);return ce.useEffect(()=>Sn.subscribe(z=>{if(z.dismiss){requestAnimationFrame(()=>{I(G=>G.map(Z=>Z.id===z.id?{...Z,delete:!0}:Z))});return}setTimeout(()=>{V$.flushSync(()=>{I(G=>{const Z=G.findIndex(U=>U.id===z.id);return Z!==-1?[...G.slice(0,Z),{...G[Z],...z},...G.slice(Z+1)]:[z,...G]})})})}),[A]),ce.useEffect(()=>{if(v!=="system"){Y(v);return}if(v==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?Y("dark"):Y("light")),typeof window>"u")return;const z=window.matchMedia("(prefers-color-scheme: dark)");try{z.addEventListener("change",({matches:G})=>{Y(G?"dark":"light")})}catch{z.addListener(({matches:Z})=>{try{Y(Z?"dark":"light")}catch(U){console.error(U)}})}},[v]),ce.useEffect(()=>{A.length<=1&&X(!1)},[A]),ce.useEffect(()=>{const z=G=>{var Z;if(l.every(te=>G[te]||G.code===te)){var F;X(!0),(F=H.current)==null||F.focus()}G.code==="Escape"&&(document.activeElement===H.current||(Z=H.current)!=null&&Z.contains(document.activeElement))&&X(!1)};return document.addEventListener("keydown",z),()=>document.removeEventListener("keydown",z)},[l]),ce.useEffect(()=>{if(H.current)return()=>{Q.current&&(Q.current.focus({preventScroll:!0}),Q.current=null,j.current=!1)}},[H.current]),ce.createElement("section",{ref:r,"aria-label":`${k} ${re}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},L.map((z,G)=>{var Z;const[U,F]=z.split("-");return O.length?ce.createElement("ol",{key:z,dir:_==="auto"?bD():_,tabIndex:-1,ref:H,className:f,"data-sonner-toaster":!0,"data-sonner-theme":B,"data-y-position":U,"data-x-position":F,style:{"--front-toast-height":`${((Z=M[0])==null?void 0:Z.height)||0}px`,"--width":`${zre}px`,"--gap":`${C}px`,...S,...Gre(h,g)},onBlur:te=>{j.current&&!te.currentTarget.contains(te.relatedTarget)&&(j.current=!1,Q.current&&(Q.current.focus({preventScroll:!0}),Q.current=null))},onFocus:te=>{te.target instanceof HTMLElement&&te.target.dataset.dismissible==="false"||j.current||(j.current=!0,Q.current=te.relatedTarget)},onMouseEnter:()=>X(!0),onMouseMove:()=>X(!0),onMouseLeave:()=>{ee||X(!1)},onDragEnd:()=>X(!1),onPointerDown:te=>{te.target instanceof HTMLElement&&te.target.dataset.dismissible==="false"||J(!0)},onPointerUp:()=>J(!1)},O.filter(te=>!te.position&&G===0||te.position===z).map((te,fe)=>{var V,de;return ce.createElement(Vre,{key:te.id,icons:N,index:fe,toast:te,defaultRichColors:y,duration:(V=x?.duration)!=null?V:w,className:x?.className,descriptionClassName:x?.descriptionClassName,invert:a,visibleToasts:T,closeButton:(de=x?.closeButton)!=null?de:d,interacting:ee,position:z,style:x?.style,unstyled:x?.unstyled,classNames:x?.classNames,cancelButtonStyle:x?.cancelButtonStyle,actionButtonStyle:x?.actionButtonStyle,closeButtonAriaLabel:x?.closeButtonAriaLabel,removeToast:q,toasts:O.filter(le=>le.position==te.position),heights:M.filter(le=>le.position==te.position),setHeights:P,expandByDefault:c,gap:C,expanded:W,swipeDirections:e.swipeDirections})})):null}))});var dh="Dialog",[f3]=Qa(dh),[Yre,_a]=f3(dh),p3=t=>{const{__scopeDialog:e,children:r,open:n,defaultOpen:a,onOpenChange:s,modal:l=!0}=t,c=b.useRef(null),d=b.useRef(null),[f,h]=Ri({prop:n,defaultProp:a??!1,onChange:s,caller:dh});return p.jsx(Yre,{scope:e,triggerRef:c,contentRef:d,contentId:Xr(),titleId:Xr(),descriptionId:Xr(),open:f,onOpenChange:h,onOpenToggle:b.useCallback(()=>h(g=>!g),[h]),modal:l,children:r})};p3.displayName=dh;var m3="DialogTrigger",h3=b.forwardRef((t,e)=>{const{__scopeDialog:r,...n}=t,a=_a(m3,r),s=kt(e,a.triggerRef);return p.jsx(yt.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.contentId,"data-state":nC(a.open),...n,ref:s,onClick:He(t.onClick,a.onOpenToggle)})});h3.displayName=m3;var tC="DialogPortal",[Kre,g3]=f3(tC,{forceMount:void 0}),v3=t=>{const{__scopeDialog:e,forceMount:r,children:n,container:a}=t,s=_a(tC,e);return p.jsx(Kre,{scope:e,forceMount:r,children:b.Children.map(n,l=>p.jsx(ua,{present:r||s.open,children:p.jsx(Cc,{asChild:!0,container:a,children:l})}))})};v3.displayName=tC;var km="DialogOverlay",b3=b.forwardRef((t,e)=>{const r=g3(km,t.__scopeDialog),{forceMount:n=r.forceMount,...a}=t,s=_a(km,t.__scopeDialog);return s.modal?p.jsx(ua,{present:n||s.open,children:p.jsx(Xre,{...a,ref:e})}):null});b3.displayName=km;var Zre=_s("DialogOverlay.RemoveScroll"),Xre=b.forwardRef((t,e)=>{const{__scopeDialog:r,...n}=t,a=_a(km,r);return p.jsx(Vd,{as:Zre,allowPinchZoom:!0,shards:[a.contentRef],children:p.jsx(yt.div,{"data-state":nC(a.open),...n,ref:e,style:{pointerEvents:"auto",...n.style}})})}),Cs="DialogContent",y3=b.forwardRef((t,e)=>{const r=g3(Cs,t.__scopeDialog),{forceMount:n=r.forceMount,...a}=t,s=_a(Cs,t.__scopeDialog);return p.jsx(ua,{present:n||s.open,children:s.modal?p.jsx(Qre,{...a,ref:e}):p.jsx(Jre,{...a,ref:e})})});y3.displayName=Cs;var Qre=b.forwardRef((t,e)=>{const r=_a(Cs,t.__scopeDialog),n=b.useRef(null),a=kt(e,r.contentRef,n);return b.useEffect(()=>{const s=n.current;if(s)return rh(s)},[]),p.jsx(E3,{...t,ref:a,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:He(t.onCloseAutoFocus,s=>{s.preventDefault(),r.triggerRef.current?.focus()}),onPointerDownOutside:He(t.onPointerDownOutside,s=>{const l=s.detail.originalEvent,c=l.button===0&&l.ctrlKey===!0;(l.button===2||c)&&s.preventDefault()}),onFocusOutside:He(t.onFocusOutside,s=>s.preventDefault())})}),Jre=b.forwardRef((t,e)=>{const r=_a(Cs,t.__scopeDialog),n=b.useRef(!1),a=b.useRef(!1);return p.jsx(E3,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{t.onCloseAutoFocus?.(s),s.defaultPrevented||(n.current||r.triggerRef.current?.focus(),s.preventDefault()),n.current=!1,a.current=!1},onInteractOutside:s=>{t.onInteractOutside?.(s),s.defaultPrevented||(n.current=!0,s.detail.originalEvent.type==="pointerdown"&&(a.current=!0));const l=s.target;r.triggerRef.current?.contains(l)&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&a.current&&s.preventDefault()}})}),E3=b.forwardRef((t,e)=>{const{__scopeDialog:r,trapFocus:n,onOpenAutoFocus:a,onCloseAutoFocus:s,...l}=t,c=_a(Cs,r),d=b.useRef(null),f=kt(e,d);return Ym(),p.jsxs(p.Fragment,{children:[p.jsx($d,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:a,onUnmountAutoFocus:s,children:p.jsx(_c,{role:"dialog",id:c.contentId,"aria-describedby":c.descriptionId,"aria-labelledby":c.titleId,"data-state":nC(c.open),...l,ref:f,onDismiss:()=>c.onOpenChange(!1)})}),p.jsxs(p.Fragment,{children:[p.jsx(ene,{titleId:c.titleId}),p.jsx(rne,{contentRef:d,descriptionId:c.descriptionId})]})]})}),rC="DialogTitle",S3=b.forwardRef((t,e)=>{const{__scopeDialog:r,...n}=t,a=_a(rC,r);return p.jsx(yt.h2,{id:a.titleId,...n,ref:e})});S3.displayName=rC;var x3="DialogDescription",w3=b.forwardRef((t,e)=>{const{__scopeDialog:r,...n}=t,a=_a(x3,r);return p.jsx(yt.p,{id:a.descriptionId,...n,ref:e})});w3.displayName=x3;var _3="DialogClose",T3=b.forwardRef((t,e)=>{const{__scopeDialog:r,...n}=t,a=_a(_3,r);return p.jsx(yt.button,{type:"button",...n,ref:e,onClick:He(t.onClick,()=>a.onOpenChange(!1))})});T3.displayName=_3;function nC(t){return t?"open":"closed"}var R3="DialogTitleWarning",[PEe,C3]=aZ(R3,{contentName:Cs,titleName:rC,docsSlug:"dialog"}),ene=({titleId:t})=>{const e=C3(R3),r=`\`${e.contentName}\` requires a \`${e.titleName}\` for the component to be accessible for screen reader users.
|
|
66
66
|
|
|
67
67
|
If you want to hide the \`${e.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
68
68
|
|
|
@@ -1542,7 +1542,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
1542
1542
|
<\/script>
|
|
1543
1543
|
</body>
|
|
1544
1544
|
</html>`,FH=1,K2=2,zH=3,Z2=4,$H=5,X2=Symbol.for("quilt.threads.serialize"),Qbe=Symbol.for("quilt.threads.transferable");class Jbe extends AbortController{constructor(...e){super();const r=e.find(n=>n.aborted);if(r)this.abort(r.reason);else{const n=s=>this.abort(s.target.reason),a={signal:this.signal};for(const s of e)s.addEventListener("abort",n,a)}}}class Q2 extends Error{constructor(){super("You attempted to call a function on a closed thread.")}}let eye="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";function BH(t=21){let e="",r=crypto.getRandomValues(new Uint8Array(t));for(let n=0;n<t;n++)e+=eye[63&r[n]];return e}var ju,Al,Uu,tm,KT,qH;class tye{constructor(){Ea(this,KT),Ea(this,ju,new Map),Ea(this,Al,new Map),Ea(this,Uu,new Map),Ea(this,tm,new WeakMap)}get(e){return nr(this,Al).get(e)}release(e){const r=nr(this,Al).get(e);return r&&(nr(this,Al).delete(e),nr(this,ju).delete(r)),!!r}serialize(e){let r=nr(this,ju).get(e);return r==null&&(r=BH(),nr(this,ju).set(e,r),nr(this,Al).set(r,e)),r}deserialize(e,r){var n,a;let s=(n=nr(this,Uu).get(e))==null?void 0:n.deref();return s||(s=(...l)=>{if(!nr(this,Uu).has(e))throw new Error("You attempted to call a function that was already revoked.");return r.call((c,d,f)=>{r.messages.send([zH,c,e,d],f)},l)},(a=Zr(this,KT,qH).call(this,r))==null||a.register(s,e),nr(this,Uu).set(e,new WeakRef(s)),s)}}ju=new WeakMap,Al=new WeakMap,Uu=new WeakMap,tm=new WeakMap,KT=new WeakSet,qH=function(t){let e=nr(this,tm).get(t);if(!(typeof FinalizationRegistry>"u"))return e||(e=new FinalizationRegistry(r=>{t.messages.send([$H,r])}),nr(this,tm).set(t,e)),e};function rye(t){return t!=null&&(Symbol.asyncIterator in t||Symbol.iterator in t)&&typeof t.next=="function"}function J2(t){if(t==null||typeof t!="object")return!1;const e=Object.getPrototypeOf(t);return e==null||e===Object.prototype}const m_="_@f",ez="_@i";var id,sd,na,rm,vi;class nye{constructor(e){Ea(this,na),Ea(this,id),Ea(this,sd),WT(this,id,e?.serialize),WT(this,sd,e?.deserialize)}serialize(e,r,n){return Zr(this,na,rm).call(this,e,r,n)}deserialize(e,r){return Zr(this,na,vi).call(this,e,r)}}id=new WeakMap,sd=new WeakMap,na=new WeakSet,rm=function(t,e,r,n=new Map,a=!1){if(t==null)return t;if(n.has(t))return n.get(t);if(n.set(t,void 0),typeof t=="object"){if(nr(this,id)&&!a){const c=nr(this,id).call(this,t,d=>Zr(this,na,rm).call(this,d,e,r,n,!0),e,r);if(c!==void 0)return n.set(t,c),c}if(t[Qbe])return r?.push(t),n.set(t,t),t;const s=c=>Zr(this,na,rm).call(this,c,e,r,n);if(typeof t[X2]=="function"){const c=t[X2]({serialize:s});return n.set(t,c),c}if(Array.isArray(t)){const c=t.map(d=>s(d));return n.set(t,c),c}if(t instanceof Map){const c=[...t.entries()].map(([f,h])=>[s(f),s(h)]),d=new Map(c);return n.set(t,d),d}if(t instanceof Set){const c=[...t].map(f=>s(f)),d=new Set(c);return n.set(t,d),d}const l=rye(t);if(J2(t)||l){const c={};for(const d of Object.keys(t))c[d]=s(t[d]);return l&&(c.next??(c.next=s(t.next.bind(t))),c.return??(c.return=s(t.return.bind(t))),c.throw??(c.throw=s(t.throw.bind(t))),c[ez]=!0),n.set(t,c),c}}if(typeof t=="function"){const s=e.functions.serialize(t,e,r),l={[m_]:s};return n.set(t,l),l}return n.set(t,t),t},vi=function(t,e,r=!1){if(t==null)return t;if(typeof t=="object"){if(nr(this,sd)&&!r){const a=nr(this,sd).call(this,t,s=>Zr(this,na,vi).call(this,s,e,!0),e);if(a!==void 0)return a}if(t==null)return t;if(Array.isArray(t))return t.map(a=>Zr(this,na,vi).call(this,a,e));if(t instanceof Map)return new Map([...t].map(([a,s])=>[Zr(this,na,vi).call(this,a,e),Zr(this,na,vi).call(this,s,e)]));if(t instanceof Set)return new Set([...t].map(a=>Zr(this,na,vi).call(this,a,e)));if(m_ in t)return e.functions.deserialize(t[m_],e);if(!J2(t))return t;const n={};for(const a of Object.keys(t))a===ez?n[Symbol.asyncIterator]=()=>n:n[a]=Zr(this,na,vi).call(this,t[a],e);return n}return t};var Nl,hs,bi,ZT,HH,XT,VH;class aye{constructor(e,{imports:r,exports:n,functions:a=new tye,serialization:s=new nye,signal:l}={}){Ea(this,bi),Ea(this,Nl),Ea(this,hs,new Map);var c,d,f,h;this.messages=e,WT(this,Nl,l?new Jbe(l):new AbortController),this.exports=n??{},this.imports=oye(Zr(this,bi,HH).bind(this),r),this.functions=a,this.serialization=s,(d=(c=this.functions).start)==null||d.call(c,this),(h=(f=this.serialization).start)==null||h.call(f,this),this.signal.addEventListener("abort",()=>{for(const g of nr(this,hs).keys())Zr(this,bi,XT).call(this,g,void 0,new Q2);nr(this,hs).clear()},{once:!0}),e.listen(async g=>{if(!(Array.isArray(g)&&typeof g[0]=="number"))return;const v=g;switch(v[0]){case FH:{const[,y,w,S]=v,T=this.exports[w]??(()=>{throw new Error(`No '${w}' method is exported from this thread`)});await Zr(this,bi,ZT).call(this,T,S,(x,_,C)=>{this.messages.send([K2,y,x,_],C)});break}case zH:{const[,y,w,S]=v,T=this.functions.get(w,this)??iye;await Zr(this,bi,ZT).call(this,T,S,(x,_,C)=>{this.messages.send([Z2,y,x,_],C)});break}case K2:case Z2:{Zr(this,bi,XT).call(this,...v.slice(1));break}case $H:{const y=v[1];this.functions.release(y,this);break}}},{signal:this.signal})}get signal(){return nr(this,Nl).signal}get closed(){return nr(this,Nl).signal.aborted}close(){nr(this,Nl).abort()}call(e,r){if(this.closed)return Promise.reject(new Q2);const n=[],a=this.serialization.serialize(r,this,n),s=BH(),l=Zr(this,bi,VH).call(this,s);return e(s,a,n),l}}Nl=new WeakMap,hs=new WeakMap,bi=new WeakSet,ZT=async function(t,e,r){try{const n=this.functions.call?await this.functions.call(t,e,this):await t(...this.serialization.deserialize(e,this)),a=[],s=this.serialization.serialize(n,this,a);r(s,void 0,a)}catch(n){r(void 0,this.serialization.serialize(n,this))}},HH=function(t){return(...e)=>{try{if(typeof t!="string"&&typeof t!="number")throw new Error(`Can’t call a symbol method on a thread: ${t.toString()}`);return this.call((r,n,a)=>{this.messages.send([FH,r,t,n],a)},e)}catch(r){return Promise.reject(r)}}},XT=function(...t){const e=t[0],r=nr(this,hs).get(e);r&&(r(...t),nr(this,hs).delete(e))},VH=function(t){const e=new Promise((r,n)=>{nr(this,hs).set(t,(a,s,l)=>{l==null?r(this.serialization.deserialize(s,this)):n(this.serialization.deserialize(l,this))})});return Object.defineProperty(e,Symbol.asyncIterator,{async*value(){const r=await e;Object.defineProperty(r,Symbol.asyncIterator,{value:()=>r}),yield*r}}),e};function oye(t,e){let r;if(e==null){if(typeof Proxy!="function")throw new Error("You must pass an array of callable methods in environments without Proxies.");const n=new Map;r=new Proxy({},{get(a,s){if(n.has(s))return n.get(s);const l=t(s);return n.set(s,l),l}})}else{r={};for(const n of e)Object.defineProperty(r,n,{value:t(n),writable:!1,configurable:!0,enumerable:!0})}return r}function iye(){throw new Error("You attempted to call a function that is not stored. It may have already been released.")}const sye="quilt.threads.ping",tz="quilt.threads.pong";function lye(t,{targetOrigin:e="*"}={}){let r=!1;const n=function(s,l){t.postMessage(s,e,l)},a=new Promise(s=>{const l=new AbortController;globalThis.window.addEventListener("message",c=>{c.source===t&&c.data===tz&&(r=!0,l.abort(),s())},{signal:l.signal}),l.signal.addEventListener("abort",()=>s(),{once:!0}),n(sye)});return{send(s,l){return r?n(s,l):a.then(()=>{if(r)return n(s,l)})},listen(s,{signal:l}){self.addEventListener("message",c=>{c.source===t&&c.data!==tz&&s(c.data)},{signal:l})}}}class cye extends aye{constructor(e,{targetOrigin:r="*",...n}={}){super(lye(e.contentWindow,{targetOrigin:r}),n),this.iframe=e}}const GH=ce.forwardRef(({content:t,children:e,...r},n)=>p.jsx("span",{ref:n,...r,children:t||e}));GH.displayName="UIText";const WH=ce.forwardRef(({label:t,onPress:e,onClick:r,children:n,...a},s)=>p.jsx("button",{ref:s,onClick:l=>{e&&e(),r&&r(l)},style:{padding:"8px 16px",backgroundColor:"#007bff",color:"white",border:"none",borderRadius:"4px",cursor:"pointer"},...a,children:t||n}));WH.displayName="UIButton";const YH=ce.forwardRef(({direction:t="vertical",spacing:e="8",align:r="stretch",justify:n="flex-start",children:a,...s},l)=>p.jsx("div",{ref:l,style:{display:"flex",flexDirection:t==="horizontal"?"row":"column",gap:`${e}px`,alignItems:r,justifyContent:n},...s,children:a}));YH.displayName="UIStack";const KH=ce.forwardRef(({src:t,alt:e,width:r,height:n,children:a,...s},l)=>p.jsx("img",{ref:l,src:t,alt:e,width:r,height:n,style:{maxWidth:"100%",height:"auto",borderRadius:"8px",boxShadow:"0 2px 8px rgba(0, 0, 0, 0.1)"},...s}));KH.displayName="UIImage";const cA={name:"basic",elements:[{tagName:"ui-text",component:GH,propMapping:{content:"content"},eventMapping:{}},{tagName:"ui-button",component:WH,propMapping:{label:"label"},eventMapping:{press:"onPress"}},{tagName:"ui-stack",component:YH,propMapping:{direction:"direction",spacing:"spacing",align:"align",justify:"justify"},eventMapping:{}},{tagName:"ui-image",component:KH,propMapping:{src:"src",alt:"alt",width:"width",height:"height"},eventMapping:{}}]},uye=({receiver:t})=>{const e=b.useRef(null);return b.useEffect(()=>{if(e.current)return t.connect(e.current),()=>{t.disconnect()}},[t]),p.jsx("div",{ref:e,"data-testid":"standard-dom-renderer-container"})},dye=({resource:t,library:e,remoteElements:r=[],onUIAction:n})=>{const a=b.useRef(null),s=b.useRef(null),[l,c]=b.useState(null),d=b.useMemo(()=>(t.mimeType||"").includes("framework=react")?"react":"webcomponents",[t.mimeType]),f=`${e?.name}-${d}`,{receiver:h,components:g}=b.useMemo(()=>{switch(d){case"react":{const y=new Bbe,w=e||cA,S=new Map;return w&&w.elements.forEach(T=>{const x=Ybe(T.component);S.set(T.tagName,x)}),{receiver:y,components:S}}case"webcomponents":default:return{receiver:new qbe,components:null}}},[t,e,r]);b.useEffect(()=>{function y(w){var S;if(a.current&&w.source===a.current.contentWindow){const T=w.data;if(!T)return;(S=n?.(T))==null||S.catch(x=>{console.error("Error handling UI action result in RemoteDOMResourceRenderer:",x)})}}return window.addEventListener("message",y),()=>window.removeEventListener("message",y)},[n]),b.useEffect(()=>{const y=s.current;return s.current=null,()=>{y?.close()}},[f]);const v=()=>{const y=a.current;if(!y||s.current)return;const w=new cye(y);s.current=w;const{code:S,error:T}=Dbe(t);if(T){c(T);return}if(S&&h!=null&&h.connection){const x={code:S,remoteElements:r,useReactRenderer:d==="react",componentLibrary:e?.name};w.imports.render(x,h.connection).catch(_=>console.error("Error calling remote render:",_))}};return l?p.jsx("p",{className:"text-red-500",children:l}):p.jsxs(p.Fragment,{children:[p.jsx("iframe",{ref:a,srcDoc:Xbe,sandbox:"allow-scripts",style:{display:"none"},title:"Remote DOM Sandbox",onLoad:v},f),d==="react"&&g?p.jsx(Zbe,{receiver:h,components:g}):p.jsx(uye,{receiver:h})]})};function fye(t){var e;if(t.contentType)return t.contentType;if(t.mimeType==="text/html")return"rawHtml";if(t.mimeType==="text/uri-list")return"externalUrl";if((e=t.mimeType)!=null&&e.startsWith("application/vnd.mcp-ui.remote-dom"))return"remoteDom"}const uA=t=>{const{resource:e,onUIAction:r,supportedContentTypes:n,htmlProps:a,remoteDomProps:s}=t,l=fye(e);if(n&&l&&!n.includes(l))return p.jsxs("p",{className:"text-red-500",children:["Unsupported content type: ",l,"."]});switch(l){case"rawHtml":case"externalUrl":return p.jsx(DH,{resource:e,onUIAction:r,...a});case"remoteDom":return p.jsx(dye,{resource:e,onUIAction:r,library:s?.library||cA,...s});default:return p.jsx("p",{className:"text-red-500",children:"Unsupported resource type."})}};uA.displayName="UIResourceRenderer";const pye={tagName:"ui-button",remoteAttributes:["label"],remoteEvents:["click","press"]},mye={tagName:"ui-text",remoteAttributes:["content"]},hye={tagName:"ui-stack",remoteAttributes:["direction","spacing","align","justify"]},gye={tagName:"ui-image",remoteAttributes:["src","alt","width","height"]},vye=b.memo(({resource:t})=>{const e=async r=>(r.type==="tool"||r.type==="prompt"||(r.type==="link"?r.payload.url&&window.open(r.payload.url,"_blank"):r.type==="intent"||r.type),{status:"Action received"});return t.uri?.startsWith("ui://")?p.jsx("div",{className:"my-4 p-0 border h-[350px] rounded-2xl border-zinc-200 overflow-hidden bg-card",children:p.jsx(uA,{resource:t,onUIAction:e,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 rz({toolName:t,toolArgs:e,result:r,serverId:n,readResource:a}){const[s,l]=b.useState(null),c=b.useMemo(()=>{if(typeof r=="string")try{return JSON.parse(r)}catch(g){return console.error("[ToolResultRenderer] Failed to parse result:",g),r}return r},[r]),d=b.useMemo(()=>!!(c?.content&&Array.isArray(c.content)&&c.content.some(g=>g.type==="resource"&&g.resource?.uri?.startsWith("ui://")&&g.resource?.mimeType==="text/html+skybridge")),[c]),f=b.useMemo(()=>d&&c.content.find(v=>v.type==="resource"&&v.resource?.uri?.startsWith("ui://")&&v.resource?.mimeType==="text/html+skybridge")?.resource||null,[d,c]);if(b.useEffect(()=>{(()=>{f&&l(f)})()},[f]),d&&s&&n&&a)return p.jsx(aA,{componentUrl:s.uri,toolName:t,toolArgs:e,toolResult:c,serverId:n,readResource:a,noWrapper:!0,className:"my-4",showConsole:!1});if(d&&!s)return p.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:p.jsx("p",{className:"text-sm text-blue-600 dark:text-blue-400",children:"Loading component..."})});const h=[];if(c?.content&&Array.isArray(c.content))for(const g of c.content)g.type==="resource"&&g.resource?.uri?.startsWith("ui://")&&g.resource?.mimeType!=="text/html+skybridge"&&h.push(g.resource);return h.length>0?p.jsx(p.Fragment,{children:h.map(g=>p.jsx(vye,{resource:g},`${t}-mcp-ui-${g.uri}`))}):null}function bye({content:t,timestamp:e}){return!t||t.length===0?null:p.jsx("div",{className:"flex items-start gap-3 justify-end group/user-message",children:p.jsxs("div",{className:"flex-1 min-w-0 flex flex-col items-end",children:[p.jsx("div",{className:"bg-zinc-200 dark:bg-zinc-800 text-primary rounded-3xl px-4 py-2 max-w-[80%] break-words",children:p.jsx("p",{className:"text-base leading-7 font-sans text-start break-words",children:t})}),e&&p.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:new Date(e).toLocaleTimeString()})]})})}const yye=b.memo(({messages:t,isLoading:e,serverId:r,readResource:n})=>{const a=b.useRef(null);b.useEffect(()=>{t.length>0&&a.current&&a.current.scrollIntoView({behavior:e?"auto":"smooth",block:"start"})},[t.length,e]);const s=e&&(()=>{if(t.length===0)return!0;const c=t[t.length-1];if(c.role==="user")return!0;if(c.role==="assistant"){const d=typeof c.content=="string"?c.content:Array.isArray(c.content)?c.content.map(h=>typeof h=="string"?h:h.text||JSON.stringify(h)).join(""):JSON.stringify(c.content);return!(d&&d.trim().length>0)}return!1})(),l=c=>{if(!e)return!1;const d=t[t.length-1];return c.id===d.id&&d.role==="assistant"};return p.jsxs("div",{className:"space-y-6 max-w-3xl mx-auto px-2",children:[t.map(c=>{const d=typeof c.content=="string"?c.content:Array.isArray(c.content)?c.content.map(f=>typeof f=="string"?f:f.text||JSON.stringify(f)).join(""):JSON.stringify(c.content);return c.role==="user"?p.jsx(bye,{content:d,timestamp:c.timestamp},c.id):c.role==="assistant"?p.jsx("div",{className:"space-y-4",children:c.parts&&c.parts.length>0?c.parts.map((f,h)=>{const g=f.type==="text"?`${c.id}-text-${h}-${f.text?.slice(0,20)}`:`${c.id}-tool-${f.toolInvocation?.toolName}-${h}`;return f.type==="text"?p.jsx(z2,{content:f.text||"",timestamp:h===c.parts.length-1?c.timestamp:void 0,_isStreaming:l(c)},g):f.type==="tool-invocation"&&f.toolInvocation?p.jsxs("div",{children:[p.jsx($2,{toolName:f.toolInvocation.toolName,args:f.toolInvocation.args,result:f.toolInvocation.result,state:f.toolInvocation.result?"result":"call"}),f.toolInvocation.result&&p.jsx(rz,{toolName:f.toolInvocation.toolName,toolArgs:f.toolInvocation.args,result:f.toolInvocation.result,serverId:r,readResource:n})]},g):null}):p.jsxs(p.Fragment,{children:[p.jsx(z2,{content:d,timestamp:c.timestamp,_isStreaming:l(c)}),c.toolCalls&&c.toolCalls.length>0&&p.jsx("div",{className:"space-y-2",children:c.toolCalls.map(f=>{const h=`${c.id}-${f.toolName}-${JSON.stringify(f.args).slice(0,50)}`;return p.jsxs("div",{children:[p.jsx($2,{toolName:f.toolName,args:f.args,result:f.result,state:f.result?"result":"call"}),f.result&&p.jsx(rz,{toolName:f.toolName,toolArgs:f.args,result:f.result,serverId:r,readResource:n})]},h)})})]})},c.id):null}),s&&p.jsx("div",{className:"flex items-start gap-3",children:p.jsx("div",{className:"flex-1",children:p.jsx("div",{className:"rounded-lg p-4 max-w-fit",children:p.jsx("div",{className:"flex items-center gap-2",children:p.jsx("span",{className:"text-sm",children:p.jsx(yce,{duration:2,spread:1,children:"Thinking..."})})})})})}),p.jsx("div",{ref:a})]})});function ZH(t){let e=0;for(let r=0;r<t.length;r++){const n=t.charCodeAt(r);e=(e<<5)-e+n,e=e&e}return Math.abs(e).toString(16)}function Eye({mcpServerUrl:t,llmConfig:e,authConfig:r,isConnected:n}){const[a,s]=b.useState([]),[l,c]=b.useState(!1),d=b.useCallback(async h=>{if(!h.trim()||!e||!n)return;const g={id:`user-${Date.now()}`,role:"user",content:h.trim(),timestamp:Date.now()};s(v=>[...v,g]),c(!0);try{let v=r;if(r?.type==="oauth")try{const N="mcp:auth",k=ZH(t),A=`${N}_${k}_tokens`,I=localStorage.getItem(A);if(I){const O=JSON.parse(I);v={...r,oauthTokens:O}}else console.warn("No OAuth tokens found in localStorage for key:",A)}catch(N){console.warn("Failed to retrieve OAuth tokens:",N)}const y=await fetch("/inspector/api/chat/stream",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mcpServerUrl:t,llmConfig:e,authConfig:v,messages:[...a,g].map(N=>({role:N.role,content:N.content}))})});if(!y.ok)throw new Error(`HTTP error! status: ${y.status}`);const w=`assistant-${Date.now()}`;let S="";const T=[];s(N=>[...N,{id:w,role:"assistant",content:"",timestamp:Date.now(),parts:[]}]);const x=y.body?.getReader(),_=new TextDecoder;if(!x)throw new Error("No response body");let C="";for(;;){const{done:N,value:k}=await x.read();if(N)break;C+=_.decode(k,{stream:!0});const A=C.split(`
|
|
1545
|
-
`);C=A.pop()||"";for(const I of A)if(I.trim()&&I.startsWith("data: "))try{const O=JSON.parse(I.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"){S+=O.content;const L=T[T.length-1];L&&L.type==="text"?L.text=S:T.push({type:"text",text:S}),console.log("[Parts after text]",T.length,"parts, text length:",S.length),s(M=>M.map(P=>P.id===w?{...P,parts:[...T]}:P))}else if(O.type==="tool-call")S&&(S=""),T.push({type:"tool-invocation",toolInvocation:{toolName:O.toolName,args:O.args,state:"pending"}}),console.log("[Parts after tool-call]",T.length,"parts, tool:",O.toolName),s(L=>L.map(M=>M.id===w?{...M,parts:[...T]}:M));else if(O.type==="tool-result"){const L=T.find(M=>M.type==="tool-invocation"&&M.toolInvocation?.toolName===O.toolName&&!M.toolInvocation?.result);L&&L.toolInvocation?(L.toolInvocation.result=O.result,L.toolInvocation.state="result",console.log("[Parts after tool-result]",T.length,"parts, updated:",O.toolName),s(M=>M.map(P=>P.id===w?{...P,parts:[...T]}:P))):console.warn("[tool-result] Could not find matching tool part for",O.toolName)}else if(O.type==="done")console.log("[Done] Final parts:",T.length),s(L=>L.map(M=>M.id===w?{...M,parts:[...T],content:""}:M));else if(O.type==="error")throw new Error(O.message||"Streaming error")}catch(O){console.error("Failed to parse streaming event:",O,I)}}}catch(v){let y="Unknown error occurred";if(v instanceof Error){y=v.message;const S=v;S.status&&(y=`HTTP ${S.status}: ${y}`),(S.code===401||y.includes("401")||y.includes("Unauthorized"))&&(y="Authentication failed (401). Check your Authorization header in the connection settings.")}const w={id:`error-${Date.now()}`,role:"assistant",content:`Error: ${y}`,timestamp:Date.now()};s(S=>[...S,w])}finally{c(!1)}},[e,n,t,a,r]),f=b.useCallback(()=>{s([])},[]);return{messages:a,isLoading:l,sendMessage:d,clearMessages:f}}function Sye({connection:t,llmConfig:e,isConnected:r,readResource:n}){const[a,s]=b.useState([]),[l,c]=b.useState(!1),d=b.useRef(null),f=b.useRef(null),h=b.useRef(null),g=b.useCallback(async y=>{if(!y.trim()||!e||!r)return;const w={id:`user-${Date.now()}`,role:"user",content:y.trim(),timestamp:Date.now()};s(x=>[...x,w]),c(!0),d.current=new AbortController;const S=Date.now();let T=0;try{const x=`assistant-${Date.now()}`;let _="";const C=[];if(s(N=>[...N,{id:x,role:"assistant",content:"",timestamp:Date.now(),parts:[]}]),!h.current||h.current.provider!==e.provider||h.current.model!==e.model||h.current.apiKey!==e.apiKey){let N;if(e.provider==="openai"){const{ChatOpenAI:k}=await ds(async()=>{const{ChatOpenAI:A}=await import("./index-BU8ICj9I.js");return{ChatOpenAI:A}},__vite__mapDeps([4,5,6,2,7]));N=new k({model:e.model,apiKey:e.apiKey})}else if(e.provider==="anthropic"){const{ChatAnthropic:k}=await ds(async()=>{const{ChatAnthropic:A}=await import("./index-BSl6rYpG.js");return{ChatAnthropic:A}},__vite__mapDeps([8,5,6,2]));N=new k({model:e.model,apiKey:e.apiKey})}else if(e.provider==="google"){const{ChatGoogleGenerativeAI:k}=await ds(async()=>{const{ChatGoogleGenerativeAI:A}=await import("./index-Dw0l9952.js");return{ChatGoogleGenerativeAI:A}},__vite__mapDeps([9,5,6,2,7]));N=new k({model:e.model,apiKey:e.apiKey})}else throw new Error(`Unsupported LLM provider: ${e.provider}`);h.current={instance:N,provider:e.provider,model:e.model,apiKey:e.apiKey}}if(!f.current||f.current.llm!==h.current.instance){const{MCPAgent:N}=await ds(async()=>{const{MCPAgent:k}=await import("./langfuse-C4HKZ3NL-BATVIff_.js").then(A=>A.c);return{MCPAgent:k}},__vite__mapDeps([10,6,2,1,3]));f.current=new N({llm:h.current.instance,client:t.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 f.current.initialize()}else console.log("[useChatMessagesClientSide] Reusing existing agent. History length:",f.current.conversationHistory?.length);for await(const N of f.current.streamEvents(y,10,!1,void 0)){if(d.current?.signal.aborted)break;if(N.event==="on_chat_model_stream"&&N.data?.chunk?.text){const k=N.data.chunk.text;if(typeof k=="string"&&k.length>0){_+=k;const A=C[C.length-1];A&&A.type==="text"?A.text=_:C.push({type:"text",text:_}),s(I=>I.map(O=>O.id===x?{...O,parts:[...C]}:O))}}else if(N.event==="on_tool_start"){_&&(_="");let k={};N.data?.input?k=N.data.input:N.data?.tool_input?k=N.data.tool_input:N.data&&(k=N.data),console.log("[useChatMessagesClientSide] on_tool_start:",{toolName:N.name,eventData:N.data,extractedArgs:k}),T++,C.push({type:"tool-invocation",toolInvocation:{toolName:N.name||"unknown",args:k,state:"pending"}}),s(A=>A.map(I=>I.id===x?{...I,parts:[...C]}:I))}else if(N.event==="on_tool_end"){const k=C.find(A=>A.type==="tool-invocation"&&A.toolInvocation?.toolName===N.name&&!A.toolInvocation?.result);if(console.log("[useChatMessagesClientSide] on_tool_end event:",{toolName:N.name,hasToolPart:!!k,output:N.data?.output}),k&&k.toolInvocation){let A=N.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}k.toolInvocation.result=A,k.toolInvocation.state="result";const I=A?._meta?.["openai/outputTemplate"];if(console.log("[useChatMessagesClientSide] Tool result:",{toolName:N.name,hasMeta:!!A?._meta,hasStructuredContent:!!A?.structuredContent,appsSdkUri:I}),I&&typeof I=="string"&&n){console.log("[useChatMessagesClientSide] Detected Apps SDK component, fetching resource:",I);try{const O=await n(I);console.log("[useChatMessagesClientSide] Resource fetched:",O);const L=A?.structuredContent||null;if(O?.contents&&Array.isArray(O.contents)){const M=O.contents.map(W=>({type:"resource",resource:W}));console.log("[useChatMessagesClientSide] Created MCP resources:",M);const P={...A,content:[...A.content||[],...M],structuredContent:L};k.toolInvocation.result=P,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)}}s(O=>O.map(L=>L.id===x?{...L,parts:[...C]}:L))}}}s(N=>N.map(k=>k.id===x?{...k,parts:[...C],content:""}:k)),e&&zr.getInstance().capture(new cD({serverId:t.url,provider:e.provider,model:e.model,messageCount:a.length+1,toolCallsCount:T,success:!0,executionMode:"client-side",duration:Date.now()-S})).catch(()=>{})}catch(x){console.error("Client-side agent error:",x);let _="Unknown error occurred";if(x instanceof Error){_=x.message;const N=x;N.status&&(_=`HTTP ${N.status}: ${_}`),(N.code===401||_.includes("401")||_.includes("Unauthorized"))&&(_="Authentication failed (401). Check your Authorization header in the connection settings.")}e&&zr.getInstance().capture(new cD({serverId:t.url,provider:e.provider,model:e.model,messageCount:a.length+1,toolCallsCount:T,success:!1,executionMode:"client-side",duration:Date.now()-S,error:_})).catch(()=>{});const C={id:`error-${Date.now()}`,role:"assistant",content:`Error: ${_}`,timestamp:Date.now()};s(N=>[...N,C])}finally{c(!1),d.current=null}},[t,e,r,a,n]),v=b.useCallback(()=>{s([]),f.current&&f.current.clearConversationHistory()},[]);return{messages:a,isLoading:l,sendMessage:g,clearMessages:v}}const nz={openai:"gpt-4o",anthropic:"claude-haiku-4-5-20251001",google:"gemini-2.5-flash"};function xye({mcpServerUrl:t}){const[e,r]=b.useState(null),[n,a]=b.useState(null),[s,l]=b.useState(!1),[c,d]=b.useState("openai"),[f,h]=b.useState(""),[g,v]=b.useState(nz.openai),y=b.useCallback(()=>{const L=localStorage.getItem("mcp-inspector-api-keys");if(L)try{return JSON.parse(L)}catch(M){return console.error("Failed to load API keys:",M),{}}return{}},[]),w=b.useCallback(L=>{localStorage.setItem("mcp-inspector-api-keys",JSON.stringify(L))},[]),[S,T]=b.useState("none"),[x,_]=b.useState(""),[C,N]=b.useState(""),[k,A]=b.useState("");b.useEffect(()=>{const L=localStorage.getItem("mcp-inspector-llm-config"),M=y();if(L)try{const P=JSON.parse(L);r(P),d(P.provider),h(M[P.provider]||P.apiKey||""),v(P.model)}catch(P){console.error("Failed to load LLM config:",P)}},[y]),b.useEffect(()=>{const L=localStorage.getItem("mcp-inspector-auth-config");if(L)try{const M=JSON.parse(L);a(M),T(M.type),M.username&&_(M.username),M.password&&N(M.password),M.token&&A(M.token)}catch(M){console.error("Failed to load auth config:",M)}else try{const M="mcp:auth",P=ZH(t),W=`${M}_${P}_tokens`;localStorage.getItem(W)&&(a({type:"oauth"}),T("oauth"))}catch(M){console.error("Failed to check for OAuth tokens:",M)}},[t]),b.useEffect(()=>{v(nz[c]);const L=y();h(L[c]||"")},[c,y]);const I=b.useCallback(()=>{if(!f.trim())return;const L=y();L[c]=f,w(L);const M={provider:c,apiKey:f,model:g},P={type:S,...S==="basic"&&{username:x.trim(),password:C.trim()},...S==="bearer"&&{token:k.trim()}};r(M),a(P),localStorage.setItem("mcp-inspector-llm-config",JSON.stringify(M)),localStorage.setItem("mcp-inspector-auth-config",JSON.stringify(P)),l(!1)},[c,f,g,S,x,C,k,y,w]),O=b.useCallback(()=>{r(null),a(null);const L=y();delete L[c],w(L),h(""),_(""),N(""),A(""),T("none"),localStorage.removeItem("mcp-inspector-llm-config"),localStorage.removeItem("mcp-inspector-auth-config")},[c,y,w]);return{llmConfig:e,authConfig:n,configDialogOpen:s,setConfigDialogOpen:l,tempProvider:c,setTempProvider:d,tempApiKey:f,setTempApiKey:h,tempModel:g,setTempModel:v,tempAuthType:S,saveLLMConfig:I,clearConfig:O}}function wye({connection:t,isConnected:e,useClientSide:r=!0,readResource:n}){const[a,s]=b.useState(""),l=b.useRef(null),{llmConfig:c,authConfig:d,configDialogOpen:f,setConfigDialogOpen:h,tempProvider:g,setTempProvider:v,tempApiKey:y,setTempApiKey:w,tempModel:S,setTempModel:T,saveLLMConfig:x,clearConfig:_}=xye({mcpServerUrl:t.url}),C={connection:t,llmConfig:c,isConnected:e,readResource:n},N=Eye({mcpServerUrl:t.url,llmConfig:c,authConfig:d,isConnected:e}),k=Sye(C),{messages:A,isLoading:I,sendMessage:O,clearMessages:L}=r?k:N;B5({onNewChat:L}),b.useEffect(()=>{c&&A.length===0&&l.current&&l.current.focus()},[c,A.length]),b.useEffect(()=>{!I&&A.length>0&&l.current&&l.current.focus()},[I,A.length]);const M=b.useCallback(()=>{a.trim()&&(O(a),s(""))},[a,O]),P=b.useCallback(X=>{X.key==="Enter"&&!X.shiftKey&&(X.preventDefault(),M())},[M]),W=b.useCallback(()=>{_(),L()},[_,L]);return c&&A.length===0?p.jsxs("div",{className:"flex flex-col h-full",children:[p.jsx("div",{className:"absolute top-4 right-4 z-10",children:p.jsx(BT,{open:f,onOpenChange:h,tempProvider:g,tempModel:S,tempApiKey:y,onProviderChange:v,onModelChange:T,onApiKeyChange:w,onSave:x,onClear:W,showClearButton:!0,buttonLabel:"Change API Key"})}),p.jsx(vce,{mcpServerUrl:t.url,inputValue:a,isConnected:e,isLoading:I,textareaRef:l,llmConfig:c,onInputChange:s,onKeyDown:P,onSubmit:X=>{X.preventDefault(),M()},onConfigDialogOpenChange:h})]}):p.jsxs("div",{className:"flex flex-col h-full relative",children:[p.jsx(mce,{llmConfig:c,hasMessages:A.length>0,configDialogOpen:f,onConfigDialogOpenChange:h,onClearChat:L,tempProvider:g,tempModel:S,tempApiKey:y,onProviderChange:v,onModelChange:T,onApiKeyChange:w,onSaveConfig:x,onClearConfig:W}),p.jsx("div",{className:"flex-1 overflow-y-auto p-2 sm:p-4 pt-[80px] sm:pt-[100px]",children:c?p.jsx(yye,{messages:A,isLoading:I,serverId:t.url,readResource:n}):p.jsx(bce,{onConfigureClick:()=>h(!0)})}),c&&p.jsx(hce,{inputValue:a,isConnected:e,isLoading:I,textareaRef:l,onInputChange:s,onKeyDown:P,onSendMessage:M})]})}const Nh=b.createContext(null);Nh.displayName="PanelGroupContext";const gr={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"},dA=10,ys=b.useLayoutEffect,az=Vm.useId,_ye=typeof az=="function"?az:()=>null;let Tye=0;function fA(t=null){const e=_ye(),r=b.useRef(t||e||null);return r.current===null&&(r.current=""+Tye++),t??r.current}function XH({children:t,className:e="",collapsedSize:r,collapsible:n,defaultSize:a,forwardedRef:s,id:l,maxSize:c,minSize:d,onCollapse:f,onExpand:h,onResize:g,order:v,style:y,tagName:w="div",...S}){const T=b.useContext(Nh);if(T===null)throw Error("Panel components must be rendered within a PanelGroup container");const{collapsePanel:x,expandPanel:_,getPanelSize:C,getPanelStyle:N,groupId:k,isPanelCollapsed:A,reevaluatePanelConstraints:I,registerPanel:O,resizePanel:L,unregisterPanel:M}=T,P=fA(l),W=b.useRef({callbacks:{onCollapse:f,onExpand:h,onResize:g},constraints:{collapsedSize:r,collapsible:n,defaultSize:a,maxSize:c,minSize:d},id:P,idIsFromProps:l!==void 0,order:v});b.useRef({didLogMissingDefaultSizeWarning:!1}),ys(()=>{const{callbacks:ee,constraints:J}=W.current,B={...J};W.current.id=P,W.current.idIsFromProps=l!==void 0,W.current.order=v,ee.onCollapse=f,ee.onExpand=h,ee.onResize=g,J.collapsedSize=r,J.collapsible=n,J.defaultSize=a,J.maxSize=c,J.minSize=d,(B.collapsedSize!==J.collapsedSize||B.collapsible!==J.collapsible||B.maxSize!==J.maxSize||B.minSize!==J.minSize)&&I(W.current,B)}),ys(()=>{const ee=W.current;return O(ee),()=>{M(ee)}},[v,P,O,M]),b.useImperativeHandle(s,()=>({collapse:()=>{x(W.current)},expand:ee=>{_(W.current,ee)},getId(){return P},getSize(){return C(W.current)},isCollapsed(){return A(W.current)},isExpanded(){return!A(W.current)},resize:ee=>{L(W.current,ee)}}),[x,_,C,A,P,L]);const X=N(W.current,a);return b.createElement(w,{...S,children:t,className:e,id:P,style:{...X,...y},[gr.groupId]:k,[gr.panel]:"",[gr.panelCollapsible]:n||void 0,[gr.panelId]:P,[gr.panelSize]:parseFloat(""+X.flexGrow).toFixed(1)})}const QH=b.forwardRef((t,e)=>b.createElement(XH,{...t,forwardedRef:e}));XH.displayName="Panel";QH.displayName="forwardRef(Panel)";let QT=null,nm=-1,Si=null;function Rye(t,e,r){const n=(e&nV)!==0,a=(e&aV)!==0,s=(e&oV)!==0,l=(e&iV)!==0;if(e){if(n)return s?"se-resize":l?"ne-resize":"e-resize";if(a)return s?"sw-resize":l?"nw-resize":"w-resize";if(s)return"s-resize";if(l)return"n-resize"}switch(t){case"horizontal":return"ew-resize";case"intersection":return"move";case"vertical":return"ns-resize"}}function Cye(){Si!==null&&(document.head.removeChild(Si),QT=null,Si=null,nm=-1)}function h_(t,e,r){var n,a;const s=Rye(t,e);if(QT!==s){if(QT=s,Si===null&&(Si=document.createElement("style"),document.head.appendChild(Si)),nm>=0){var l;(l=Si.sheet)===null||l===void 0||l.removeRule(nm)}nm=(n=(a=Si.sheet)===null||a===void 0?void 0:a.insertRule(`*{cursor: ${s} !important;}`))!==null&&n!==void 0?n:-1}}function JH(t){return t.type==="keydown"}function eV(t){return t.type.startsWith("pointer")}function tV(t){return t.type.startsWith("mouse")}function kh(t){if(eV(t)){if(t.isPrimary)return{x:t.clientX,y:t.clientY}}else if(tV(t))return{x:t.clientX,y:t.clientY};return{x:1/0,y:1/0}}function Aye(){if(typeof matchMedia=="function")return matchMedia("(pointer:coarse)").matches?"coarse":"fine"}function Nye(t,e,r){return t.x<e.x+e.width&&t.x+t.width>e.x&&t.y<e.y+e.height&&t.y+t.height>e.y}function kye(t,e){if(t===e)throw new Error("Cannot compare node with itself");const r={a:sz(t),b:sz(e)};let n;for(;r.a.at(-1)===r.b.at(-1);)t=r.a.pop(),e=r.b.pop(),n=t;vt(n,"Stacking order can only be calculated for elements with a common ancestor");const a={a:iz(oz(r.a)),b:iz(oz(r.b))};if(a.a===a.b){const s=n.childNodes,l={a:r.a.at(-1),b:r.b.at(-1)};let c=s.length;for(;c--;){const d=s[c];if(d===l.a)return 1;if(d===l.b)return-1}}return Math.sign(a.a-a.b)}const Iye=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function Oye(t){var e;const r=getComputedStyle((e=rV(t))!==null&&e!==void 0?e:t).display;return r==="flex"||r==="inline-flex"}function Dye(t){const e=getComputedStyle(t);return!!(e.position==="fixed"||e.zIndex!=="auto"&&(e.position!=="static"||Oye(t))||+e.opacity<1||"transform"in e&&e.transform!=="none"||"webkitTransform"in e&&e.webkitTransform!=="none"||"mixBlendMode"in e&&e.mixBlendMode!=="normal"||"filter"in e&&e.filter!=="none"||"webkitFilter"in e&&e.webkitFilter!=="none"||"isolation"in e&&e.isolation==="isolate"||Iye.test(e.willChange)||e.webkitOverflowScrolling==="touch")}function oz(t){let e=t.length;for(;e--;){const r=t[e];if(vt(r,"Missing node"),Dye(r))return r}return null}function iz(t){return t&&Number(getComputedStyle(t).zIndex)||0}function sz(t){const e=[];for(;t;)e.push(t),t=rV(t);return e}function rV(t){const{parentNode:e}=t;return e&&e instanceof ShadowRoot?e.host:e}const nV=1,aV=2,oV=4,iV=8,Lye=Aye()==="coarse";let Sa=[],Gl=!1,xi=new Map,Ih=new Map;const Nd=new Set;function Mye(t,e,r,n,a){var s;const{ownerDocument:l}=e,c={direction:r,element:e,hitAreaMargins:n,setResizeHandlerState:a},d=(s=xi.get(l))!==null&&s!==void 0?s:0;return xi.set(l,d+1),Nd.add(c),Um(),function(){var h;Ih.delete(t),Nd.delete(c);const g=(h=xi.get(l))!==null&&h!==void 0?h:1;if(xi.set(l,g-1),Um(),g===1&&xi.delete(l),Sa.includes(c)){const v=Sa.indexOf(c);v>=0&&Sa.splice(v,1),Oh(),a("up",!0,null)}}}function Pye(t){const{target:e}=t,{x:r,y:n}=kh(t);Gl=!0,pA({target:e,x:r,y:n}),Um(),Sa.length>0&&(Fm("down",t),Oh(),t.preventDefault(),sV(e)||t.stopImmediatePropagation())}function g_(t){const{x:e,y:r}=kh(t);if(Gl&&t.type!=="pointerleave"&&t.buttons===0&&(Gl=!1,Fm("up",t)),!Gl){const{target:n}=t;pA({target:n,x:e,y:r})}Fm("move",t),Oh(),Sa.length>0&&t.preventDefault()}function v_(t){const{target:e}=t,{x:r,y:n}=kh(t);Ih.clear(),Gl=!1,Sa.length>0&&(t.preventDefault(),sV(e)||t.stopImmediatePropagation()),Fm("up",t),pA({target:e,x:r,y:n}),Oh(),Um()}function sV(t){let e=t;for(;e;){if(e.hasAttribute(gr.resizeHandle))return!0;e=e.parentElement}return!1}function pA({target:t,x:e,y:r}){Sa.splice(0);let n=null;(t instanceof HTMLElement||t instanceof SVGElement)&&(n=t),Nd.forEach(a=>{const{element:s,hitAreaMargins:l}=a,c=s.getBoundingClientRect(),{bottom:d,left:f,right:h,top:g}=c,v=Lye?l.coarse:l.fine;if(e>=f-v&&e<=h+v&&r>=g-v&&r<=d+v){if(n!==null&&document.contains(n)&&s!==n&&!s.contains(n)&&!n.contains(s)&&kye(n,s)>0){let w=n,S=!1;for(;w&&!w.contains(s);){if(Nye(w.getBoundingClientRect(),c)){S=!0;break}w=w.parentElement}if(S)return}Sa.push(a)}})}function b_(t,e){Ih.set(t,e)}function Oh(){let t=!1,e=!1;Sa.forEach(n=>{const{direction:a}=n;a==="horizontal"?t=!0:e=!0});let r=0;Ih.forEach(n=>{r|=n}),t&&e?h_("intersection",r):t?h_("horizontal",r):e?h_("vertical",r):Cye()}let y_;function Um(){var t;(t=y_)===null||t===void 0||t.abort(),y_=new AbortController;const e={capture:!0,signal:y_.signal};Nd.size&&(Gl?(Sa.length>0&&xi.forEach((r,n)=>{const{body:a}=n;r>0&&(a.addEventListener("contextmenu",v_,e),a.addEventListener("pointerleave",g_,e),a.addEventListener("pointermove",g_,e))}),xi.forEach((r,n)=>{const{body:a}=n;a.addEventListener("pointerup",v_,e),a.addEventListener("pointercancel",v_,e)})):xi.forEach((r,n)=>{const{body:a}=n;r>0&&(a.addEventListener("pointerdown",Pye,e),a.addEventListener("pointermove",g_,e))}))}function Fm(t,e){Nd.forEach(r=>{const{setResizeHandlerState:n}=r,a=Sa.includes(r);n(t,a,e)})}function jye(){const[t,e]=b.useState(0);return b.useCallback(()=>e(r=>r+1),[])}function vt(t,e){if(!t)throw console.error(e),Error(e)}function Is(t,e,r=dA){return t.toFixed(r)===e.toFixed(r)?0:t>e?1:-1}function To(t,e,r=dA){return Is(t,e,r)===0}function Un(t,e,r){return Is(t,e,r)===0}function Uye(t,e,r){if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++){const a=t[n],s=e[n];if(!Un(a,s,r))return!1}return!0}function Fl({panelConstraints:t,panelIndex:e,size:r}){const n=t[e];vt(n!=null,`Panel constraints not found for index ${e}`);let{collapsedSize:a=0,collapsible:s,maxSize:l=100,minSize:c=0}=n;if(Is(r,c)<0)if(s){const d=(a+c)/2;Is(r,d)<0?r=a:r=c}else r=c;return r=Math.min(l,r),r=parseFloat(r.toFixed(dA)),r}function Fu({delta:t,initialLayout:e,panelConstraints:r,pivotIndices:n,prevLayout:a,trigger:s}){if(Un(t,0))return e;const l=[...e],[c,d]=n;vt(c!=null,"Invalid first pivot index"),vt(d!=null,"Invalid second pivot index");let f=0;if(s==="keyboard"){{const g=t<0?d:c,v=r[g];vt(v,`Panel constraints not found for index ${g}`);const{collapsedSize:y=0,collapsible:w,minSize:S=0}=v;if(w){const T=e[g];if(vt(T!=null,`Previous layout not found for panel index ${g}`),Un(T,y)){const x=S-T;Is(x,Math.abs(t))>0&&(t=t<0?0-x:x)}}}{const g=t<0?c:d,v=r[g];vt(v,`No panel constraints found for index ${g}`);const{collapsedSize:y=0,collapsible:w,minSize:S=0}=v;if(w){const T=e[g];if(vt(T!=null,`Previous layout not found for panel index ${g}`),Un(T,S)){const x=T-y;Is(x,Math.abs(t))>0&&(t=t<0?0-x:x)}}}}{const g=t<0?1:-1;let v=t<0?d:c,y=0;for(;;){const S=e[v];vt(S!=null,`Previous layout not found for panel index ${v}`);const x=Fl({panelConstraints:r,panelIndex:v,size:100})-S;if(y+=x,v+=g,v<0||v>=r.length)break}const w=Math.min(Math.abs(t),Math.abs(y));t=t<0?0-w:w}{let v=t<0?c:d;for(;v>=0&&v<r.length;){const y=Math.abs(t)-Math.abs(f),w=e[v];vt(w!=null,`Previous layout not found for panel index ${v}`);const S=w-y,T=Fl({panelConstraints:r,panelIndex:v,size:S});if(!Un(w,T)&&(f+=w-T,l[v]=T,f.toFixed(3).localeCompare(Math.abs(t).toFixed(3),void 0,{numeric:!0})>=0))break;t<0?v--:v++}}if(Uye(a,l))return a;{const g=t<0?d:c,v=e[g];vt(v!=null,`Previous layout not found for panel index ${g}`);const y=v+f,w=Fl({panelConstraints:r,panelIndex:g,size:y});if(l[g]=w,!Un(w,y)){let S=y-w,x=t<0?d:c;for(;x>=0&&x<r.length;){const _=l[x];vt(_!=null,`Previous layout not found for panel index ${x}`);const C=_+S,N=Fl({panelConstraints:r,panelIndex:x,size:C});if(Un(_,N)||(S-=N-_,l[x]=N),Un(S,0))break;t>0?x--:x++}}}const h=l.reduce((g,v)=>v+g,0);return Un(h,100)?l:a}function Fye({layout:t,panelsArray:e,pivotIndices:r}){let n=0,a=100,s=0,l=0;const c=r[0];vt(c!=null,"No pivot index found"),e.forEach((g,v)=>{const{constraints:y}=g,{maxSize:w=100,minSize:S=0}=y;v===c?(n=S,a=w):(s+=S,l+=w)});const d=Math.min(a,100-s),f=Math.max(n,100-l),h=t[c];return{valueMax:d,valueMin:f,valueNow:h}}function kd(t,e=document){return Array.from(e.querySelectorAll(`[${gr.resizeHandleId}][data-panel-group-id="${t}"]`))}function lV(t,e,r=document){const a=kd(t,r).findIndex(s=>s.getAttribute(gr.resizeHandleId)===e);return a??null}function cV(t,e,r){const n=lV(t,e,r);return n!=null?[n,n+1]:[-1,-1]}function zye(t){return t instanceof HTMLElement?!0:typeof t=="object"&&t!==null&&"tagName"in t&&"getAttribute"in t}function uV(t,e=document){if(zye(e)&&e.dataset.panelGroupId==t)return e;const r=e.querySelector(`[data-panel-group][data-panel-group-id="${t}"]`);return r||null}function Dh(t,e=document){const r=e.querySelector(`[${gr.resizeHandleId}="${t}"]`);return r||null}function $ye(t,e,r,n=document){var a,s,l,c;const d=Dh(e,n),f=kd(t,n),h=d?f.indexOf(d):-1,g=(a=(s=r[h])===null||s===void 0?void 0:s.id)!==null&&a!==void 0?a:null,v=(l=(c=r[h+1])===null||c===void 0?void 0:c.id)!==null&&l!==void 0?l:null;return[g,v]}function Bye({committedValuesRef:t,eagerValuesRef:e,groupId:r,layout:n,panelDataArray:a,panelGroupElement:s,setLayout:l}){b.useRef({didWarnAboutMissingResizeHandle:!1}),ys(()=>{if(!s)return;const c=kd(r,s);for(let d=0;d<a.length-1;d++){const{valueMax:f,valueMin:h,valueNow:g}=Fye({layout:n,panelsArray:a,pivotIndices:[d,d+1]}),v=c[d];if(v!=null){const y=a[d];vt(y,`No panel data found for index "${d}"`),v.setAttribute("aria-controls",y.id),v.setAttribute("aria-valuemax",""+Math.round(f)),v.setAttribute("aria-valuemin",""+Math.round(h)),v.setAttribute("aria-valuenow",g!=null?""+Math.round(g):"")}}return()=>{c.forEach((d,f)=>{d.removeAttribute("aria-controls"),d.removeAttribute("aria-valuemax"),d.removeAttribute("aria-valuemin"),d.removeAttribute("aria-valuenow")})}},[r,n,a,s]),b.useEffect(()=>{if(!s)return;const c=e.current;vt(c,"Eager values not found");const{panelDataArray:d}=c,f=uV(r,s);vt(f!=null,`No group found for id "${r}"`);const h=kd(r,s);vt(h,`No resize handles found for group id "${r}"`);const g=h.map(v=>{const y=v.getAttribute(gr.resizeHandleId);vt(y,"Resize handle element has no handle id attribute");const[w,S]=$ye(r,y,d,s);if(w==null||S==null)return()=>{};const T=x=>{if(!x.defaultPrevented)switch(x.key){case"Enter":{x.preventDefault();const _=d.findIndex(C=>C.id===w);if(_>=0){const C=d[_];vt(C,`No panel data found for index ${_}`);const N=n[_],{collapsedSize:k=0,collapsible:A,minSize:I=0}=C.constraints;if(N!=null&&A){const O=Fu({delta:Un(N,k)?I-k:k-N,initialLayout:n,panelConstraints:d.map(L=>L.constraints),pivotIndices:cV(r,y,s),prevLayout:n,trigger:"keyboard"});n!==O&&l(O)}}break}}};return v.addEventListener("keydown",T),()=>{v.removeEventListener("keydown",T)}});return()=>{g.forEach(v=>v())}},[s,t,e,r,n,a,l])}function lz(t,e){if(t.length!==e.length)return!1;for(let r=0;r<t.length;r++)if(t[r]!==e[r])return!1;return!0}function dV(t,e){const r=t==="horizontal",{x:n,y:a}=kh(e);return r?n:a}function qye(t,e,r,n,a){const s=r==="horizontal",l=Dh(e,a);vt(l,`No resize handle element found for id "${e}"`);const c=l.getAttribute(gr.groupId);vt(c,"Resize handle element has no group id attribute");let{initialCursorPosition:d}=n;const f=dV(r,t),h=uV(c,a);vt(h,`No group element found for id "${c}"`);const g=h.getBoundingClientRect(),v=s?g.width:g.height;return(f-d)/v*100}function Hye(t,e,r,n,a,s){if(JH(t)){const l=r==="horizontal";let c=0;t.shiftKey?c=100:a!=null?c=a:c=10;let d=0;switch(t.key){case"ArrowDown":d=l?0:c;break;case"ArrowLeft":d=l?-c:0;break;case"ArrowRight":d=l?c:0;break;case"ArrowUp":d=l?0:-c;break;case"End":d=100;break;case"Home":d=-100;break}return d}else return n==null?0:qye(t,e,r,n,s)}function Vye({panelDataArray:t}){const e=Array(t.length),r=t.map(s=>s.constraints);let n=0,a=100;for(let s=0;s<t.length;s++){const l=r[s];vt(l,`Panel constraints not found for index ${s}`);const{defaultSize:c}=l;c!=null&&(n++,e[s]=c,a-=c)}for(let s=0;s<t.length;s++){const l=r[s];vt(l,`Panel constraints not found for index ${s}`);const{defaultSize:c}=l;if(c!=null)continue;const d=t.length-n,f=a/d;n++,e[s]=f,a-=f}return e}function yl(t,e,r){e.forEach((n,a)=>{const s=t[a];vt(s,`Panel data not found for index ${a}`);const{callbacks:l,constraints:c,id:d}=s,{collapsedSize:f=0,collapsible:h}=c,g=r[d];if(g==null||n!==g){r[d]=n;const{onCollapse:v,onExpand:y,onResize:w}=l;w&&w(n,g),h&&(v||y)&&(y&&(g==null||To(g,f))&&!To(n,f)&&y(),v&&(g==null||!To(g,f))&&To(n,f)&&v())}})}function Up(t,e){if(t.length!==e.length)return!1;for(let r=0;r<t.length;r++)if(t[r]!=e[r])return!1;return!0}function Gye({defaultSize:t,dragState:e,layout:r,panelData:n,panelIndex:a,precision:s=3}){const l=r[a];let c;return l==null?c=t!=null?t.toFixed(s):"1":n.length===1?c="1":c=l.toFixed(s),{flexBasis:0,flexGrow:c,flexShrink:1,overflow:"hidden",pointerEvents:e!==null?"none":void 0}}function Wye(t,e=10){let r=null;return(...a)=>{r!==null&&clearTimeout(r),r=setTimeout(()=>{t(...a)},e)}}function cz(t){try{if(typeof localStorage<"u")t.getItem=e=>localStorage.getItem(e),t.setItem=(e,r)=>{localStorage.setItem(e,r)};else throw new Error("localStorage not supported in this environment")}catch(e){console.error(e),t.getItem=()=>null,t.setItem=()=>{}}}function fV(t){return`react-resizable-panels:${t}`}function pV(t){return t.map(e=>{const{constraints:r,id:n,idIsFromProps:a,order:s}=e;return a?n:s?`${s}:${JSON.stringify(r)}`:JSON.stringify(r)}).sort((e,r)=>e.localeCompare(r)).join(",")}function mV(t,e){try{const r=fV(t),n=e.getItem(r);if(n){const a=JSON.parse(n);if(typeof a=="object"&&a!=null)return a}}catch{}return null}function Yye(t,e,r){var n,a;const s=(n=mV(t,r))!==null&&n!==void 0?n:{},l=pV(e);return(a=s[l])!==null&&a!==void 0?a:null}function Kye(t,e,r,n,a){var s;const l=fV(t),c=pV(e),d=(s=mV(t,a))!==null&&s!==void 0?s:{};d[c]={expandToSizes:Object.fromEntries(r.entries()),layout:n};try{a.setItem(l,JSON.stringify(d))}catch(f){console.error(f)}}function uz({layout:t,panelConstraints:e}){const r=[...t],n=r.reduce((s,l)=>s+l,0);if(r.length!==e.length)throw Error(`Invalid ${e.length} panel layout: ${r.map(s=>`${s}%`).join(", ")}`);if(!Un(n,100)&&r.length>0)for(let s=0;s<e.length;s++){const l=r[s];vt(l!=null,`No layout data found for index ${s}`);const c=100/n*l;r[s]=c}let a=0;for(let s=0;s<e.length;s++){const l=r[s];vt(l!=null,`No layout data found for index ${s}`);const c=Fl({panelConstraints:e,panelIndex:s,size:l});l!=c&&(a+=l-c,r[s]=c)}if(!Un(a,0))for(let s=0;s<e.length;s++){const l=r[s];vt(l!=null,`No layout data found for index ${s}`);const c=l+a,d=Fl({panelConstraints:e,panelIndex:s,size:c});if(l!==d&&(a-=d-l,r[s]=d,Un(a,0)))break}return r}const Zye=100,zu={getItem:t=>(cz(zu),zu.getItem(t)),setItem:(t,e)=>{cz(zu),zu.setItem(t,e)}},dz={};function hV({autoSaveId:t=null,children:e,className:r="",direction:n,forwardedRef:a,id:s=null,onLayout:l=null,keyboardResizeBy:c=null,storage:d=zu,style:f,tagName:h="div",...g}){const v=fA(s),y=b.useRef(null),[w,S]=b.useState(null),[T,x]=b.useState([]),_=jye(),C=b.useRef({}),N=b.useRef(new Map),k=b.useRef(0),A=b.useRef({autoSaveId:t,direction:n,dragState:w,id:v,keyboardResizeBy:c,onLayout:l,storage:d}),I=b.useRef({layout:T,panelDataArray:[],panelDataArrayChanged:!1});b.useRef({didLogIdAndOrderWarning:!1,didLogPanelConstraintsWarning:!1,prevPanelIds:[]}),b.useImperativeHandle(a,()=>({getId:()=>A.current.id,getLayout:()=>{const{layout:z}=I.current;return z},setLayout:z=>{const{onLayout:G}=A.current,{layout:Z,panelDataArray:U}=I.current,F=uz({layout:z,panelConstraints:U.map(te=>te.constraints)});lz(Z,F)||(x(F),I.current.layout=F,G&&G(F),yl(U,F,C.current))}}),[]),ys(()=>{A.current.autoSaveId=t,A.current.direction=n,A.current.dragState=w,A.current.id=v,A.current.onLayout=l,A.current.storage=d}),Bye({committedValuesRef:A,eagerValuesRef:I,groupId:v,layout:T,panelDataArray:I.current.panelDataArray,setLayout:x,panelGroupElement:y.current}),b.useEffect(()=>{const{panelDataArray:z}=I.current;if(t){if(T.length===0||T.length!==z.length)return;let G=dz[t];G==null&&(G=Wye(Kye,Zye),dz[t]=G);const Z=[...z],U=new Map(N.current);G(t,Z,U,T,d)}},[t,T,d]),b.useEffect(()=>{});const O=b.useCallback(z=>{const{onLayout:G}=A.current,{layout:Z,panelDataArray:U}=I.current;if(z.constraints.collapsible){const F=U.map(de=>de.constraints),{collapsedSize:te=0,panelSize:fe,pivotIndices:V}=ss(U,z,Z);if(vt(fe!=null,`Panel size not found for panel "${z.id}"`),!To(fe,te)){N.current.set(z.id,fe);const le=kl(U,z)===U.length-1?fe-te:te-fe,pe=Fu({delta:le,initialLayout:Z,panelConstraints:F,pivotIndices:V,prevLayout:Z,trigger:"imperative-api"});Up(Z,pe)||(x(pe),I.current.layout=pe,G&&G(pe),yl(U,pe,C.current))}}},[]),L=b.useCallback((z,G)=>{const{onLayout:Z}=A.current,{layout:U,panelDataArray:F}=I.current;if(z.constraints.collapsible){const te=F.map(Re=>Re.constraints),{collapsedSize:fe=0,panelSize:V=0,minSize:de=0,pivotIndices:le}=ss(F,z,U),pe=G??de;if(To(V,fe)){const Re=N.current.get(z.id),Ke=Re!=null&&Re>=pe?Re:pe,ze=kl(F,z)===F.length-1?V-Ke:Ke-V,_e=Fu({delta:ze,initialLayout:U,panelConstraints:te,pivotIndices:le,prevLayout:U,trigger:"imperative-api"});Up(U,_e)||(x(_e),I.current.layout=_e,Z&&Z(_e),yl(F,_e,C.current))}}},[]),M=b.useCallback(z=>{const{layout:G,panelDataArray:Z}=I.current,{panelSize:U}=ss(Z,z,G);return vt(U!=null,`Panel size not found for panel "${z.id}"`),U},[]),P=b.useCallback((z,G)=>{const{panelDataArray:Z}=I.current,U=kl(Z,z);return Gye({defaultSize:G,dragState:w,layout:T,panelData:Z,panelIndex:U})},[w,T]),W=b.useCallback(z=>{const{layout:G,panelDataArray:Z}=I.current,{collapsedSize:U=0,collapsible:F,panelSize:te}=ss(Z,z,G);return vt(te!=null,`Panel size not found for panel "${z.id}"`),F===!0&&To(te,U)},[]),X=b.useCallback(z=>{const{layout:G,panelDataArray:Z}=I.current,{collapsedSize:U=0,collapsible:F,panelSize:te}=ss(Z,z,G);return vt(te!=null,`Panel size not found for panel "${z.id}"`),!F||Is(te,U)>0},[]),ee=b.useCallback(z=>{const{panelDataArray:G}=I.current;G.push(z),G.sort((Z,U)=>{const F=Z.order,te=U.order;return F==null&&te==null?0:F==null?-1:te==null?1:F-te}),I.current.panelDataArrayChanged=!0,_()},[_]);ys(()=>{if(I.current.panelDataArrayChanged){I.current.panelDataArrayChanged=!1;const{autoSaveId:z,onLayout:G,storage:Z}=A.current,{layout:U,panelDataArray:F}=I.current;let te=null;if(z){const V=Yye(z,F,Z);V&&(N.current=new Map(Object.entries(V.expandToSizes)),te=V.layout)}te==null&&(te=Vye({panelDataArray:F}));const fe=uz({layout:te,panelConstraints:F.map(V=>V.constraints)});lz(U,fe)||(x(fe),I.current.layout=fe,G&&G(fe),yl(F,fe,C.current))}}),ys(()=>{const z=I.current;return()=>{z.layout=[]}},[]);const J=b.useCallback(z=>{let G=!1;const Z=y.current;return Z&&window.getComputedStyle(Z,null).getPropertyValue("direction")==="rtl"&&(G=!0),function(F){F.preventDefault();const te=y.current;if(!te)return()=>null;const{direction:fe,dragState:V,id:de,keyboardResizeBy:le,onLayout:pe}=A.current,{layout:Re,panelDataArray:Ke}=I.current,{initialLayout:je}=V??{},ze=cV(de,z,te);let _e=Hye(F,z,fe,V,le,te);const Ae=fe==="horizontal";Ae&&G&&(_e=-_e);const $e=Ke.map(Le=>Le.constraints),oe=Fu({delta:_e,initialLayout:je??Re,panelConstraints:$e,pivotIndices:ze,prevLayout:Re,trigger:JH(F)?"keyboard":"mouse-or-touch"}),Se=!Up(Re,oe);(eV(F)||tV(F))&&k.current!=_e&&(k.current=_e,!Se&&_e!==0?Ae?b_(z,_e<0?nV:aV):b_(z,_e<0?oV:iV):b_(z,0)),Se&&(x(oe),I.current.layout=oe,pe&&pe(oe),yl(Ke,oe,C.current))}},[]),B=b.useCallback((z,G)=>{const{onLayout:Z}=A.current,{layout:U,panelDataArray:F}=I.current,te=F.map(Re=>Re.constraints),{panelSize:fe,pivotIndices:V}=ss(F,z,U);vt(fe!=null,`Panel size not found for panel "${z.id}"`);const le=kl(F,z)===F.length-1?fe-G:G-fe,pe=Fu({delta:le,initialLayout:U,panelConstraints:te,pivotIndices:V,prevLayout:U,trigger:"imperative-api"});Up(U,pe)||(x(pe),I.current.layout=pe,Z&&Z(pe),yl(F,pe,C.current))},[]),Y=b.useCallback((z,G)=>{const{layout:Z,panelDataArray:U}=I.current,{collapsedSize:F=0,collapsible:te}=G,{collapsedSize:fe=0,collapsible:V,maxSize:de=100,minSize:le=0}=z.constraints,{panelSize:pe}=ss(U,z,Z);pe!=null&&(te&&V&&To(pe,F)?To(F,fe)||B(z,fe):pe<le?B(z,le):pe>de&&B(z,de))},[B]),H=b.useCallback((z,G)=>{const{direction:Z}=A.current,{layout:U}=I.current;if(!y.current)return;const F=Dh(z,y.current);vt(F,`Drag handle element not found for id "${z}"`);const te=dV(Z,G);S({dragHandleId:z,dragHandleRect:F.getBoundingClientRect(),initialCursorPosition:te,initialLayout:U})},[]),re=b.useCallback(()=>{S(null)},[]),Q=b.useCallback(z=>{const{panelDataArray:G}=I.current,Z=kl(G,z);Z>=0&&(G.splice(Z,1),delete C.current[z.id],I.current.panelDataArrayChanged=!0,_())},[_]),j=b.useMemo(()=>({collapsePanel:O,direction:n,dragState:w,expandPanel:L,getPanelSize:M,getPanelStyle:P,groupId:v,isPanelCollapsed:W,isPanelExpanded:X,reevaluatePanelConstraints:Y,registerPanel:ee,registerResizeHandle:J,resizePanel:B,startDragging:H,stopDragging:re,unregisterPanel:Q,panelGroupElement:y.current}),[O,w,n,L,M,P,v,W,X,Y,ee,J,B,H,re,Q]),q={display:"flex",flexDirection:n==="horizontal"?"row":"column",height:"100%",overflow:"hidden",width:"100%"};return b.createElement(Nh.Provider,{value:j},b.createElement(h,{...g,children:e,className:r,id:s,ref:y,style:{...q,...f},[gr.group]:"",[gr.groupDirection]:n,[gr.groupId]:v}))}const gV=b.forwardRef((t,e)=>b.createElement(hV,{...t,forwardedRef:e}));hV.displayName="PanelGroup";gV.displayName="forwardRef(PanelGroup)";function kl(t,e){return t.findIndex(r=>r===e||r.id===e.id)}function ss(t,e,r){const n=kl(t,e),s=n===t.length-1?[n-1,n]:[n,n+1],l=r[n];return{...e.constraints,panelSize:l,pivotIndices:s}}function Xye({disabled:t,handleId:e,resizeHandler:r,panelGroupElement:n}){b.useEffect(()=>{if(t||r==null||n==null)return;const a=Dh(e,n);if(a==null)return;const s=l=>{if(!l.defaultPrevented)switch(l.key){case"ArrowDown":case"ArrowLeft":case"ArrowRight":case"ArrowUp":case"End":case"Home":{l.preventDefault(),r(l);break}case"F6":{l.preventDefault();const c=a.getAttribute(gr.groupId);vt(c,`No group element found for id "${c}"`);const d=kd(c,n),f=lV(c,e,n);vt(f!==null,`No resize element found for id "${e}"`);const h=l.shiftKey?f>0?f-1:d.length-1:f+1<d.length?f+1:0;d[h].focus();break}}};return a.addEventListener("keydown",s),()=>{a.removeEventListener("keydown",s)}},[n,t,e,r])}function vV({children:t=null,className:e="",disabled:r=!1,hitAreaMargins:n,id:a,onBlur:s,onClick:l,onDragging:c,onFocus:d,onPointerDown:f,onPointerUp:h,style:g={},tabIndex:v=0,tagName:y="div",...w}){var S,T;const x=b.useRef(null),_=b.useRef({onClick:l,onDragging:c,onPointerDown:f,onPointerUp:h});b.useEffect(()=>{_.current.onClick=l,_.current.onDragging=c,_.current.onPointerDown=f,_.current.onPointerUp=h});const C=b.useContext(Nh);if(C===null)throw Error("PanelResizeHandle components must be rendered within a PanelGroup container");const{direction:N,groupId:k,registerResizeHandle:A,startDragging:I,stopDragging:O,panelGroupElement:L}=C,M=fA(a),[P,W]=b.useState("inactive"),[X,ee]=b.useState(!1),[J,B]=b.useState(null),Y=b.useRef({state:P});ys(()=>{Y.current.state=P}),b.useEffect(()=>{if(r)B(null);else{const j=A(M);B(()=>j)}},[r,M,A]);const H=(S=n?.coarse)!==null&&S!==void 0?S:15,re=(T=n?.fine)!==null&&T!==void 0?T:5;b.useEffect(()=>{if(r||J==null)return;const j=x.current;vt(j,"Element ref not attached");let q=!1;return Mye(M,j,N,{coarse:H,fine:re},(G,Z,U)=>{if(!Z){W("inactive");return}switch(G){case"down":{W("drag"),q=!1,vt(U,'Expected event to be defined for "down" action'),I(M,U);const{onDragging:F,onPointerDown:te}=_.current;F?.(!0),te?.();break}case"move":{const{state:F}=Y.current;q=!0,F!=="drag"&&W("hover"),vt(U,'Expected event to be defined for "move" action'),J(U);break}case"up":{W("hover"),O();const{onClick:F,onDragging:te,onPointerUp:fe}=_.current;te?.(!1),fe?.(),q||F?.();break}}})},[H,N,r,re,A,M,J,I,O]),Xye({disabled:r,handleId:M,resizeHandler:J,panelGroupElement:L});const Q={touchAction:"none",userSelect:"none"};return b.createElement(y,{...w,children:t,className:e,id:a,onBlur:()=>{ee(!1),s?.()},onFocus:()=>{ee(!0),d?.()},ref:x,role:"separator",style:{...Q,...g},tabIndex:v,[gr.groupDirection]:N,[gr.groupId]:k,[gr.resizeHandle]:"",[gr.resizeHandleActive]:P==="drag"?"pointer":X?"keyboard":void 0,[gr.resizeHandleEnabled]:!r,[gr.resizeHandleId]:M,[gr.resizeHandleState]:P})}vV.displayName="PanelResizeHandle";function Id({className:t,...e}){return p.jsx(gV,{"data-slot":"resizable-panel-group",className:De("flex h-full w-full data-[panel-group-direction=vertical]:flex-col",t),...e})}function Fa({...t}){return p.jsx(QH,{"data-slot":"resizable-panel",...t})}function Od({withHandle:t,className:e,...r}){return p.jsx(vV,{"data-slot":"resizable-handle",className:De("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",e),...r,children:t&&p.jsx("div",{className:"bg-border z-10 flex h-4 w-3 items-center justify-center rounded-xs border",children:p.jsx(zte,{className:"size-2.5"})})})}function af({id:t,isSelected:e,isFocused:r,icon:n,title:a,description:s,metadata:l,onClick:c,className:d}){return p.jsx("button",{id:t,type:"button",onClick:c,className:De("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",e&&"bg-zinc-50 dark:bg-zinc-800 border-l-4 border-l-zinc-500",r&&"ring-2 ring-zinc-500 dark:ring-zinc-400 ring-inset",d),children:p.jsxs("div",{className:"flex items-start gap-2 sm:gap-3",children:[p.jsx("div",{className:"flex-shrink-0 mt-1",children:p.jsx("div",{className:De("p-2.5 rounded-full transition-colors",e?"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:n})}),p.jsxs("div",{className:"flex-1 min-w-0",children:[p.jsx("div",{className:"flex items-center gap-2 mb-1",children:p.jsx("h3",{className:De("font-medium truncate font-mono text-sm"),children:a})}),s&&p.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 line-clamp-2",children:s})]})]})})}function bV({className:t,...e}){return p.jsx("kbd",{"data-slot":"kbd",className:De("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",t),...e})}function yV({activeTab:t,isSearchExpanded:e,searchQuery:r,primaryTabTitle:n,secondaryTabTitle:a,primaryCount:s,secondaryCount:l,secondaryIcon:c,primaryIcon:d,searchPlaceholder:f="Search...",onSearchExpand:h,onSearchChange:g,onSearchBlur:v,onTabSwitch:y,searchInputRef:w,primaryTabName:S}){const T=t===S;return p.jsxs("div",{className:"flex flex-row items-center justify-between p-4 sm:p-4 py-3 border-r dark:border-zinc-700 gap-2",children:[p.jsx("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:e?p.jsx(Mr,{ref:w,placeholder:f,value:r,onChange:x=>g(x.target.value),onBlur:v,className:"h-8 border-gray-300 dark:border-zinc-600"}):p.jsxs(p.Fragment,{children:[p.jsx("h2",{className:"text-lg font-medium text-gray-900 dark:text-gray-100",children:T?n:a}),T&&p.jsxs(p.Fragment,{children:[p.jsx(Wa,{className:"bg-zinc-500/20 text-zinc-600 dark:text-zinc-400 border-transparent",variant:"outline",children:s}),p.jsxs(Sr,{children:[p.jsx(xr,{asChild:!0,children:p.jsx(Je,{variant:"ghost",size:"sm",onClick:h,className:"h-8 w-8 p-0",children:p.jsx(eC,{className:"h-4 w-4"})})}),p.jsxs(wr,{side:"bottom",className:"flex gap-2",children:["Search",p.jsx(bV,{children:"F"})]})]})]})]})}),p.jsxs(Je,{variant:"ghost",size:"sm",onClick:y,className:"gap-2 flex-shrink-0",children:[T?p.jsx(c,{}):p.jsx(d,{}),p.jsx("span",{className:"hidden sm:inline",children:T?a:n}),T&&l>0&&p.jsx(Wa,{className:"bg-purple-500/20 text-purple-600 dark:text-purple-400 border-transparent",variant:"outline",children:l})]})]})}function fz({prompts:t,selectedPrompt:e,onPromptSelect:r,focusedIndex:n}){return t.length===0?p.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[p.jsx(yd,{className:"h-12 w-12 text-gray-400 dark:text-gray-600 mb-3"}),p.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"No prompts available"})]}):p.jsx("div",{className:"overflow-y-auto flex-1 border-r dark:border-zinc-700 overscroll-contain",children:t.map((a,s)=>p.jsx(af,{id:`prompt-${a.name}`,isSelected:e?.name===a.name,isFocused:n===s,icon:p.jsx(yd,{className:"h-4 w-4"}),title:a.name,description:a.description,metadata:a.arguments&&a.arguments.length>0&&p.jsxs(Wa,{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:()=>r(a)},a.name))})}function pz({activeTab:t,isSearchExpanded:e,searchQuery:r,filteredPromptsCount:n,savedPromptsCount:a,onSearchExpand:s,onSearchChange:l,onSearchBlur:c,onTabSwitch:d,searchInputRef:f}){return p.jsx(yV,{activeTab:t,isSearchExpanded:e,searchQuery:r,primaryTabName:"prompts",secondaryTabName:"saved",primaryTabTitle:"Prompts",secondaryTabTitle:"History",primaryCount:n,secondaryCount:a,primaryIcon:yd,secondaryIcon:uc,searchPlaceholder:"Search prompts...",onSearchExpand:s,onSearchChange:l,onSearchBlur:c,onTabSwitch:d,searchInputRef:f})}function mz({savedPrompts:t,selectedPrompt:e,onLoadPrompt:r,onDeletePrompt:n,focusedIndex:a}){return t.length===0?p.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[p.jsx(uc,{className:"h-12 w-12 text-gray-400 dark:text-gray-600 mb-3"}),p.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"No history"}),p.jsx("p",{className:"text-sm text-gray-400 dark:text-gray-500 mt-1",children:"Prompts you execute will appear here"})]}):p.jsx("div",{className:"overflow-y-auto flex-1 border-r dark:border-zinc-700 overscroll-contain",children:t.map((s,l)=>p.jsx(af,{id:`saved-prompt-${s.id}`,isSelected:e?.id===s.id,isFocused:a===l,icon:p.jsx(uc,{className:"h-4 w-4"}),title:s.name,description:`${s.promptName} - ${new Date(s.savedAt).toLocaleString()}`,onClick:()=>r(s)},s.id))})}function Qye({selectedPrompt:t,promptArgs:e,onArgChange:r}){const n=t?.arguments||[];if(!(n.length>0))return p.jsx("div",{className:"flex items-center justify-center h-32 text-gray-500 dark:text-gray-400 text-sm",children:"No arguments required"});const s=l=>{const c=l.name,d=e[c],f=typeof d=="string"?d:JSON.stringify(d);return l.type==="boolean"?p.jsxs("div",{className:"space-y-2",children:[p.jsxs(lr,{htmlFor:c,className:"text-sm font-medium",children:[c,l.required&&p.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),p.jsxs("div",{className:"flex items-center space-x-2",children:[p.jsx("input",{id:c,type:"checkbox",checked:!!d,onChange:h=>r(c,h.target.checked),className:"rounded","aria-label":`Toggle ${c}`}),p.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400",children:l.description})]})]},c):l.type==="number"?p.jsxs("div",{className:"space-y-2",children:[p.jsxs(lr,{htmlFor:c,className:"text-sm font-medium",children:[c,l.required&&p.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),p.jsx(Mr,{id:c,type:"number",value:Number(d)||0,onChange:h=>r(c,Number(h.target.value)),placeholder:l.description||`Enter ${c}`}),l.description&&p.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:l.description})]},c):l.type==="array"||l.type==="object"?p.jsxs("div",{className:"space-y-2",children:[p.jsxs(lr,{htmlFor:c,className:"text-sm font-medium",children:[c,l.required&&p.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),p.jsx(Sh,{id:c,value:f,onChange:h=>{try{const g=JSON.parse(h.target.value);r(c,g)}catch{r(c,h.target.value)}},placeholder:l.description||`Enter ${c} as JSON`,className:"font-mono text-sm min-h-[100px]"}),l.description&&p.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:l.description})]},c):p.jsxs("div",{className:"space-y-2",children:[p.jsxs(lr,{htmlFor:c,className:"text-sm font-medium",children:[c,l.required&&p.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),p.jsx(Mr,{id:c,value:f,onChange:h=>r(c,h.target.value),placeholder:l.description||`Enter ${c}`}),l.description&&p.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:l.description})]},c)};return p.jsx("div",{className:"space-y-4",children:n.map(l=>s(l))})}function hz({selectedPrompt:t,promptArgs:e,isExecuting:r,isConnected:n,onArgChange:a,onExecute:s,onSave:l}){return t?p.jsxs("div",{className:"flex flex-col h-full",children:[p.jsx("div",{className:"flex-shrink-0 p-3 sm:p-6 pt-3 pb-4 pr-3",children:p.jsxs("div",{children:[p.jsxs("div",{className:"flex flex-row items-center justify-between mb-0 gap-2",children:[p.jsx("h3",{className:"text-base sm:text-lg font-semibold",children:t.name}),p.jsxs("div",{className:"flex gap-2 flex-shrink-0",children:[p.jsx(Je,{onClick:s,disabled:r||!n,size:"sm",className:"lg:size-default",children:r?p.jsxs(p.Fragment,{children:[p.jsx(Uo,{className:"mr-2"}),p.jsx("span",{className:"hidden sm:inline",children:"Executing..."})]}):p.jsxs(p.Fragment,{children:[p.jsx(u3,{className:"h-4 w-4 sm:mr-2"}),p.jsx("span",{className:"hidden sm:inline",children:"Execute"})]})}),p.jsxs(Je,{variant:"outline",onClick:l,disabled:r,size:"sm",className:"lg:size-default gap-2",children:[p.jsx(JR,{className:"h-4 w-4"}),p.jsx("span",{className:"hidden sm:inline",children:"Save"})]})]})]}),t.description&&p.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 leading-relaxed mt-2",children:t.description})]})}),p.jsx("div",{className:"flex-1 overflow-y-auto px-3 sm:px-6 pb-4 pr-3",children:p.jsx(Qye,{selectedPrompt:t,promptArgs:e,onArgChange:a})})]}):p.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[p.jsx("p",{className:"text-gray-500 dark:text-gray-400 mb-2",children:"Select a prompt to get started"}),p.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 gz({results:t,copiedResult:e,onCopy:r}){return p.jsx("div",{className:"flex flex-col h-full bg-white dark:bg-black border-t dark:border-zinc-700",children:p.jsx("div",{className:"flex-1 overflow-y-auto h-full",children:t.length>0?p.jsx("div",{className:"space-y-4 flex-1 h-full",children:t.map((n,a)=>p.jsxs("div",{className:"space-y-0 flex-1 h-full flex flex-col",children:[p.jsxs("div",{className:"flex items-center gap-2 px-4 pt-2 border-b border-gray-200 dark:border-zinc-600 pb-2",children:[p.jsx("h3",{className:"text-sm font-medium",children:"Response"}),p.jsxs("div",{className:"flex items-center gap-1",children:[p.jsx(uc,{className:"h-3 w-3 text-gray-400"}),p.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:new Date(n.timestamp).toLocaleTimeString()})]}),n.duration!==void 0&&p.jsxs("div",{className:"flex items-center gap-1",children:[p.jsx(Ed,{className:"h-3 w-3 text-gray-400"}),p.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:[n.duration,"ms"]})]}),p.jsx("div",{className:"flex gap-2 ml-auto",children:p.jsx(Je,{variant:"ghost",size:"sm",onClick:()=>r(a,n.result),className:"h-6 px-2",children:e===a?p.jsx(Mo,{className:"h-4 w-4"}):p.jsx($n,{className:"h-4 w-4"})})})]}),n.error?p.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:[p.jsx("p",{className:"text-red-800 dark:text-red-300 font-medium",children:"Error:"}),p.jsx("p",{className:"text-red-700 dark:text-red-400 text-sm",children:n.error})]}):p.jsx("div",{className:"px-4 pt-4",children:p.jsx(Ua,{data:n.result,filename:`prompt-result-${n.promptName}-${Date.now()}.json`})})]},a))}):p.jsx("div",{className:"flex items-center justify-center h-full",children:p.jsx("div",{className:"text-center",children:p.jsx(VR,{vertical:!0,noBorder:!0,message:"No Results yet"})})})})})}const vz="mcp-inspector-saved-prompts";function EV({ref:t,prompts:e,callPrompt:r,serverId:n,isConnected:a}){const[s,l]=b.useState(null),[c,d]=b.useState(null),{selectedPromptName:f,setSelectedPromptName:h}=tf(),[g,v]=b.useState({}),[y,w]=b.useState([]),[S,T]=b.useState(!1),[x,_]=b.useState(null),[C,N]=b.useState(""),[k,A]=b.useState("prompts"),[I,O]=b.useState([]),[L,M]=b.useState(!1),[P,W]=b.useState(""),[X,ee]=b.useState(!1),[J,B]=b.useState(-1),Y=b.useRef(null),[H,re]=b.useState(!1),[Q,j]=b.useState("list");b.useEffect(()=>{const le=()=>{re(window.innerWidth<1024)};return le(),window.addEventListener("resize",le),()=>window.removeEventListener("resize",le)},[]),b.useEffect(()=>{j(s?"detail":"list")},[s]),b.useEffect(()=>{H&&y.length>0&&!S&&j("response")},[y,S,H]),b.useImperativeHandle(t,()=>({focusSearch:()=>{ee(!0),setTimeout(()=>{Y.current&&Y.current.focus()},0)},blurSearch:()=>{N(""),ee(!1),Y.current&&Y.current.blur()}})),b.useEffect(()=>{try{const le=localStorage.getItem(vz);if(le){const pe=JSON.parse(le);O(pe)}}catch(le){console.error("[PromptsTab] Failed to load saved prompts:",le)}},[]);const q=b.useCallback(le=>{try{localStorage.setItem(vz,JSON.stringify(le))}catch(pe){console.error("[PromptsTab] Failed to save prompts:",pe)}},[]);b.useEffect(()=>{X&&Y.current&&Y.current.focus()},[X]);const z=b.useCallback(()=>{C.trim()||ee(!1)},[C]),G=b.useMemo(()=>{if(!C.trim())return e;const le=C.toLowerCase();return e.filter(pe=>pe.name.toLowerCase().includes(le)||pe.description?.toLowerCase().includes(le))},[e,C]),Z=b.useCallback(le=>{l(le);const pe={};le.arguments&&le.arguments.forEach(Re=>{Re.default!==void 0?pe[Re.name]=Re.default:Re.type==="string"?pe[Re.name]="":Re.type==="number"?pe[Re.name]=0:Re.type==="boolean"?pe[Re.name]=!1:Re.type==="array"?pe[Re.name]=[]:Re.type==="object"&&(pe[Re.name]={})}),v(pe)},[]),U=b.useCallback(le=>{const pe=e.find(Re=>Re.name===le.promptName);pe&&(l(pe),v(le.args),d(le))},[e]);b.useEffect(()=>{B(-1)},[C,k]),b.useEffect(()=>{const le=pe=>{const Re=pe.target;if(Re.tagName==="INPUT"||Re.tagName==="TEXTAREA"||Re.contentEditable==="true"||pe.metaKey||pe.ctrlKey||pe.altKey)return;const je=k==="prompts"?G:I;if(pe.key==="ArrowDown")pe.preventDefault(),B(ze=>{const _e=ze+1;return _e>=je.length?0:_e});else if(pe.key==="ArrowUp")pe.preventDefault(),B(ze=>{const _e=ze-1;return _e<0?je.length-1:_e});else if(pe.key==="Enter"&&J>=0)if(pe.preventDefault(),k==="prompts"){const ze=G[J];ze&&Z(ze)}else{const ze=I[J];ze&&U(ze)}};return document.addEventListener("keydown",le),()=>document.removeEventListener("keydown",le)},[J,G,I,k,Z,U]),b.useEffect(()=>{if(J>=0){const le=k==="prompts"?`prompt-${G[J]?.name}`:`saved-prompt-${I[J]?.id}`,pe=document.getElementById(le);pe&&pe.scrollIntoView({behavior:"smooth",block:"nearest"})}},[J,G,I,k]),b.useEffect(()=>{if(console.warn("[PromptsTab] Auto-selection effect triggered:",{selectedPromptName:f,promptsCount:e.length,currentSelectedPrompt:s?.name}),f&&e.length>0){const le=e.find(pe=>pe.name===f);if(console.warn("[PromptsTab] Prompt lookup result:",{selectedPromptName:f,promptFound:!!le,promptName:le?.name,shouldSelect:le&&s?.name!==le.name}),le&&s?.name!==le.name){console.warn("[PromptsTab] Selecting prompt:",le.name),h(null);const pe=setTimeout(()=>{Z(le);const Re=document.getElementById(`prompt-${le.name}`);Re&&(console.warn("[PromptsTab] Scrolling to prompt element"),Re.scrollIntoView({behavior:"smooth",block:"nearest"}))},100);return()=>clearTimeout(pe)}}},[f,e,s,Z,h]);const F=b.useCallback((le,pe)=>{v(Re=>({...Re,[le]:pe}))},[]),te=b.useCallback(async()=>{if(!s||S)return;T(!0);const le=Date.now();try{const pe=await r(s.name,g),Re=Date.now()-le;zr.getInstance().capture(new lD({promptName:s.name,serverId:n,success:!0})).catch(()=>{}),w(je=>[{promptName:s.name,args:g,result:pe,timestamp:le,duration:Re},...je])}catch(pe){zr.getInstance().capture(new lD({promptName:s.name,serverId:n,success:!1,error:pe instanceof Error?pe.message:"Unknown error"})).catch(()=>{});const Ke={promptName:s.name,args:g,result:null,error:pe instanceof Error?pe.message:String(pe),timestamp:le,duration:Date.now()-le};w(je=>[Ke,...je])}finally{T(!1)}},[s,g,S,r,n]),fe=b.useCallback(async(le,pe)=>{try{await navigator.clipboard.writeText(JSON.stringify(pe,null,2)),_(le),setTimeout(()=>_(null),2e3)}catch(Re){console.error("[PromptsTab] Failed to copy result:",Re)}},[]),V=b.useCallback(()=>{s&&(W(""),M(!0))},[s]),de=b.useCallback(le=>{q(I.filter(pe=>pe.id!==le)),c?.id===le&&d(null)},[I,q,c]);return H?p.jsxs("div",{className:"h-full flex flex-col overflow-hidden relative bg-background",children:[Q!=="list"&&p.jsxs("div",{className:"flex items-center gap-2 p-2 border-b shrink-0 bg-background z-10",children:[p.jsx(Je,{variant:"ghost",size:"sm",onClick:()=>{Q==="response"?j("detail"):(l(null),j("list"))},className:"p-0 h-8 w-8",children:p.jsx(XR,{className:"h-4 w-4"})}),p.jsxs("div",{className:"flex items-center text-sm font-medium",children:[p.jsx("button",{onClick:()=>{l(null),j("list")},className:"text-muted-foreground hover:text-foreground hover:underline cursor-pointer",children:"Prompts"}),Q!=="list"&&p.jsxs(p.Fragment,{children:[p.jsx("span",{className:"mx-2 text-muted-foreground",children:"/"}),p.jsx("button",{onClick:()=>{Q==="response"&&j("detail")},className:Q==="detail"?"text-foreground hover:underline":Q==="response"?"text-muted-foreground hover:text-foreground hover:underline cursor-pointer":"text-muted-foreground",children:"Execute"})]}),Q==="response"&&p.jsxs(p.Fragment,{children:[p.jsx("span",{className:"mx-2 text-muted-foreground",children:"/"}),p.jsx("span",{className:"text-foreground",children:"Response"})]})]})]}),p.jsx("div",{className:"flex-1 relative overflow-hidden",children:p.jsxs(gh,{initial:!1,mode:"popLayout",children:[Q==="list"&&p.jsxs(_n.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:[p.jsx(pz,{activeTab:k,isSearchExpanded:X,searchQuery:C,filteredPromptsCount:G.length,savedPromptsCount:I.length,onSearchExpand:()=>ee(!0),onSearchChange:N,onSearchBlur:z,onTabSwitch:()=>A(k==="prompts"?"saved":"prompts"),searchInputRef:Y}),k==="prompts"?p.jsx(fz,{prompts:G,selectedPrompt:s,onPromptSelect:Z,focusedIndex:J}):p.jsx(mz,{savedPrompts:I,selectedPrompt:c,onLoadPrompt:U,onDeletePrompt:de,focusedIndex:J})]},"list"),Q==="detail"&&p.jsx(_n.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:p.jsx(hz,{selectedPrompt:s,promptArgs:g,isExecuting:S,isConnected:a,onArgChange:F,onExecute:te,onSave:V})},"detail"),Q==="response"&&p.jsx(_n.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:p.jsx(gz,{results:y,copiedResult:x,onCopy:fe})},"response")]})})]}):p.jsxs(Id,{direction:"horizontal",className:"h-full",children:[p.jsxs(Fa,{defaultSize:33,className:"flex flex-col h-full relative",children:[p.jsx(pz,{activeTab:k,isSearchExpanded:X,searchQuery:C,filteredPromptsCount:G.length,savedPromptsCount:I.length,onSearchExpand:()=>ee(!0),onSearchChange:N,onSearchBlur:z,onTabSwitch:()=>A(k==="prompts"?"saved":"prompts"),searchInputRef:Y}),k==="prompts"?p.jsx(fz,{prompts:G,selectedPrompt:s,onPromptSelect:Z,focusedIndex:J}):p.jsx(mz,{savedPrompts:I,selectedPrompt:c,onLoadPrompt:U,onDeletePrompt:de,focusedIndex:J})]}),p.jsx(Od,{withHandle:!0}),p.jsx(Fa,{defaultSize:67,children:p.jsxs(Id,{direction:"vertical",children:[p.jsx(Fa,{defaultSize:40,children:p.jsx(hz,{selectedPrompt:s,promptArgs:g,isExecuting:S,isConnected:a,onArgChange:F,onExecute:te,onSave:V})}),p.jsx(Od,{withHandle:!0}),p.jsx(Fa,{defaultSize:60,children:p.jsx("div",{className:"flex flex-col h-full",children:p.jsx(gz,{results:y,copiedResult:x,onCopy:fe})})})]})})]})}EV.displayName="PromptsTab";function Wl(t){if(!t?.mimeType)return!1;const e=t.mimeType.toLowerCase();return e==="text/html"||e==="text/html+skybridge"||e==="text/uri-list"||e.startsWith("application/vnd.mcp-ui.remote-dom")}function Jye(t){return{uri:t.uri,mimeType:t.mimeType,text:t.text,blob:t.blob}}function SV({resource:t,onUIAction:e,className:r}){const n=async s=>e?.(s),a=Jye(t);return p.jsx("div",{className:r,children:p.jsx(uA,{resource:a,onUIAction:n,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:[mye,pye,hye,gye],library:cA}})})}function bz({result:t,isLoading:e,previewMode:r,serverId:n,readResource:a,onTogglePreview:s,onCopy:l,onDownload:c,onFullscreen:d,isCopied:f=!1}){let h=[],g;if(t?.resourceAnnotations&&(h=Object.keys(t.resourceAnnotations).filter(S=>S.startsWith("openai/")),g=t.resourceAnnotations["openai/outputTemplate"]),t?.result?.contents?.[0]?._meta){const S=t.result.contents[0]._meta,T=Object.keys(S).filter(x=>x.startsWith("openai/"));T.length>0&&(h=[...h,...T]),!g&&S["openai/outputTemplate"]&&(g=S["openai/outputTemplate"]),!g&&t.uri&&t.uri.startsWith("ui://widget/")&&(g=t.uri)}const v=!!(h.length>0&&g&&typeof g=="string"&&n&&a);if(e)return p.jsx("div",{className:"flex absolute left-0 top-0 items-center justify-center w-full h-full",children:p.jsx(Uo,{className:"size-5"})});if(!t)return p.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[p.jsx("p",{className:"text-gray-500 dark:text-gray-400 mb-2",children:"Select a resource to view its contents"}),p.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500",children:"Choose a resource from the list to see its data"})]});if(t.error)return p.jsx("div",{className:"p-4",children:p.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded p-3",children:[p.jsx("p",{className:"text-red-800 dark:text-red-300 font-medium",children:"Error:"}),p.jsx("p",{className:"text-red-700 dark:text-red-400 text-sm",children:t.error})]})});const y=t?.result?.contents&&Array.isArray(t.result.contents)&&t.result.contents.some(S=>S.mimeType&&Wl(S)),w=y?t.result.contents.filter(S=>S.mimeType&&Wl(S)):[];return p.jsxs("div",{className:"flex flex-col h-full",children:[p.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:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsxs("div",{className:"flex items-center gap-1",children:[p.jsx(uc,{className:"h-3 w-3 text-gray-400"}),p.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:new Date(t.timestamp).toLocaleTimeString()})]}),(()=>{const S=t?.duration??t.result?.duration??t.result?.metrics?.durationMs;return S!==void 0?p.jsxs("div",{className:"flex items-center gap-1",children:[p.jsx(Ed,{className:"h-3 w-3 text-gray-400"}),p.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:[S,"ms"]})]}):null})(),y&&p.jsx(Wa,{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&&p.jsx(Wa,{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"})]}),p.jsxs("div",{className:"flex items-center gap-1",children:[(y||v)&&p.jsxs(Je,{variant:"ghost",size:"sm",onClick:s,className:r?"":"text-purple-600 dark:text-purple-400",children:[r?p.jsx(mte,{className:"h-4 w-4 mr-1"}):p.jsx(ote,{className:"h-4 w-4 mr-1"}),r?"JSON":v?"Component":"Preview"]}),p.jsx(Je,{variant:"ghost",size:"sm",onClick:l,children:f?p.jsx(Mo,{className:"h-4 w-4"}):p.jsx($n,{className:"h-4 w-4"})}),p.jsx(Je,{variant:"ghost",size:"sm",onClick:c,children:p.jsx(s3,{className:"h-4 w-4"})}),p.jsx(Je,{variant:"ghost",size:"sm",onClick:d,children:p.jsx(Vte,{className:"h-4 w-4"})})]})]}),p.jsx("div",{className:"flex-1 overflow-y-auto",children:v&&n&&a&&g?r?p.jsx("div",{className:"flex-1 h-full",children:p.jsx(aA,{componentUrl:g,toolName:t.uri,toolArgs:{},toolResult:t.result,serverId:n,readResource:a,className:"w-full h-full relative flex p-4"})}):p.jsx("div",{className:"px-4 pt-4",children:p.jsx(Ua,{data:t.result,filename:`resource-${t.uri.replace(/[^a-zA-Z0-9]/g,"-")}-${Date.now()}.json`})}):y?r?p.jsxs("div",{className:"space-y-0 h-full",children:[w.map((S,T)=>p.jsx("div",{className:"mx-0 size-full",children:p.jsx("div",{className:"w-full h-full",children:p.jsx(SV,{resource:S,className:"w-full h-full"})})},`mcp-ui-${S.uri||`resource-${Date.now()}-${Math.random()}`}`)),(()=>{if(t.result.contents&&Array.isArray(t.result.contents)){const S=t.result.contents.filter(T=>!(T.mimeType&&Wl(T)));if(S.length>0)return p.jsx("div",{className:"px-4",children:p.jsx(Ua,{data:S,filename:`resource-${t.uri.replace(/[^a-zA-Z0-9]/g,"-")}-non-ui-${Date.now()}.json`})})}return null})()]}):p.jsx("div",{className:"px-4 pt-4",children:p.jsx(Ua,{data:t.result,filename:`resource-${t.uri.replace(/[^a-zA-Z0-9]/g,"-")}-mcp-ui-${Date.now()}.json`})}):p.jsx("div",{className:"px-4 pt-4",children:p.jsx(Ua,{data:t.result,filename:`resource-${t.uri.replace(/[^a-zA-Z0-9]/g,"-")}-${Date.now()}.json`})})})]})}function eEe(t,e){if(!t&&!e)return p.jsx(Lte,{className:"h-5 w-5"});const r=(t||e||"").toLowerCase();return r.includes("image")?p.jsx(Ite,{className:"h-5 w-5"}):r.includes("json")||r.includes("javascript")||r.includes("typescript")?p.jsx(Nte,{className:"h-5 w-5"}):r.includes("html")||r.includes("xml")?p.jsx(Ute,{className:"h-5 w-5"}):r.includes("database")||r.includes("sql")?p.jsx(uh,{className:"h-5 w-5"}):p.jsx(QR,{className:"h-5 w-5"})}function yz({resources:t,selectedResource:e,onResourceSelect:r,focusedIndex:n}){return t.length===0?p.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[p.jsx(uh,{className:"h-12 w-12 text-gray-400 dark:text-gray-600 mb-3"}),p.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"No resources available"})]}):p.jsx("div",{className:"overflow-y-auto flex-1 border-r dark:border-zinc-700 overscroll-contain",children:t.map((a,s)=>{const l=eEe(a.mimeType,a.uri),c=[a.description,a.mimeType&&p.jsx("span",{className:"font-mono",children:a.mimeType},"mime")].filter(Boolean);return p.jsx(af,{id:`resource-${a.uri}`,isSelected:e?.uri===a.uri,isFocused:n===s,icon:l,title:a.name,description:c.length>0?p.jsxs("span",{className:"flex flex-col gap-1",children:[a.description&&p.jsx("span",{children:a.description}),a.mimeType&&p.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-500 font-mono",children:a.mimeType})]}):void 0,onClick:()=>r(a)},a.uri)})})}function Ez({isSearchExpanded:t,searchQuery:e,filteredResourcesCount:r,onSearchExpand:n,onSearchChange:a,onSearchBlur:s,searchInputRef:l}){return p.jsx("div",{className:"flex items-center justify-between p-4 py-3 border-r dark:border-zinc-700",children:p.jsx("div",{className:"flex items-center gap-2 flex-1",children:t?p.jsx(Mr,{ref:l,placeholder:"Search resources...",value:e,onChange:c=>a(c.target.value),onBlur:s,className:"h-8 border-gray-300 dark:border-zinc-600"}):p.jsxs(p.Fragment,{children:[p.jsx("h2",{className:"text-lg font-medium text-gray-900 dark:text-gray-100",children:"Resources"}),p.jsx(Wa,{className:"bg-zinc-500/20 text-zinc-600 dark:text-zinc-400 border-transparent",variant:"outline",children:r}),p.jsxs(Sr,{children:[p.jsx(xr,{asChild:!0,children:p.jsx(Je,{variant:"ghost",size:"sm",onClick:n,className:"h-8 w-8 p-0",children:p.jsx(eC,{className:"h-4 w-4"})})}),p.jsxs(wr,{side:"bottom",className:"flex gap-2",children:["Search",p.jsx(bV,{children:"F"})]})]})]})})})}function xV({ref:t,resources:e,readResource:r,serverId:n,isConnected:a}){const[s,l]=b.useState(null),{selectedResourceUri:c,setSelectedResourceUri:d}=tf(),[f,h]=b.useState(null),[g,v]=b.useState(!1),[y,w]=b.useState(""),[S]=b.useState("resources"),[T,x]=b.useState(!0),[_,C]=b.useState(!1),[N,k]=b.useState(-1),[A,I]=b.useState(!1),O=b.useRef(null),L=b.useRef(null),[M,P]=b.useState(!1),[W,X]=b.useState("list");b.useEffect(()=>{const Q=()=>{P(window.innerWidth<1024)};return Q(),window.addEventListener("resize",Q),()=>window.removeEventListener("resize",Q)},[]),b.useEffect(()=>{X(s?"detail":"list")},[s]),b.useImperativeHandle(t,()=>({focusSearch:()=>{C(!0),setTimeout(()=>{O.current&&O.current.focus()},0)},blurSearch:()=>{w(""),C(!1),O.current&&O.current.blur()}})),b.useEffect(()=>{_&&O.current&&O.current.focus()},[_]);const ee=b.useCallback(()=>{y.trim()||C(!1)},[y]),J=b.useMemo(()=>{if(!y)return e;const Q=y.toLowerCase();return e.filter(j=>j.name.toLowerCase().includes(Q)||j.description?.toLowerCase().includes(Q)||j.uri.toLowerCase().includes(Q))},[e,y]),B=b.useCallback(async Q=>{if(l(Q),a){v(!0);const j=Date.now();try{const q=await r(Q.uri);zr.getInstance().capture(new sD({resourceUri:Q.uri,serverId:n,success:!0})).catch(()=>{}),h({uri:Q.uri,result:q,timestamp:j,resourceAnnotations:Q.annotations})}catch(q){zr.getInstance().capture(new sD({resourceUri:Q.uri,serverId:n,success:!1,error:q instanceof Error?q.message:"Unknown error"})).catch(()=>{}),h({uri:Q.uri,result:null,error:q instanceof Error?q.message:"Unknown error",timestamp:j,resourceAnnotations:Q.annotations})}finally{v(!1)}}},[r,n,a]);b.useEffect(()=>{k(-1)},[y,S]),b.useEffect(()=>{const Q=j=>{const q=j.target;if(q.tagName==="INPUT"||q.tagName==="TEXTAREA"||q.contentEditable==="true"||j.metaKey||j.ctrlKey||j.altKey)return;const G=J;if(j.key==="ArrowDown")j.preventDefault(),k(Z=>{const U=Z+1;return U>=G.length?0:U});else if(j.key==="ArrowUp")j.preventDefault(),k(Z=>{const U=Z-1;return U<0?G.length-1:U});else if(j.key==="Enter"&&N>=0){j.preventDefault();const Z=J[N];Z&&B(Z)}};return document.addEventListener("keydown",Q),()=>document.removeEventListener("keydown",Q)},[N,J,B]),b.useEffect(()=>{if(N>=0){const Q=`resource-${J[N]?.uri}`,j=document.getElementById(Q);j&&j.scrollIntoView({behavior:"smooth",block:"nearest"})}},[N,J]),b.useEffect(()=>{if(c&&e.length>0){const Q=e.find(j=>j.uri===c);Q&&s?.uri!==Q.uri&&(d(null),setTimeout(()=>{B(Q);const j=document.getElementById(`resource-${Q.uri}`);j&&j.scrollIntoView({behavior:"smooth",block:"nearest"})},100))}},[c,e,s,B,d]);const Y=b.useCallback(async()=>{if(f)try{await navigator.clipboard.writeText(JSON.stringify(f.result,null,2)),I(!0),setTimeout(()=>I(!1),2e3)}catch(Q){console.error("[ResourcesTab] Failed to copy result:",Q)}},[f]),H=b.useCallback(()=>{if(f)try{const Q=new globalThis.Blob([JSON.stringify(f.result,null,2)],{type:"application/json"}),j=URL.createObjectURL(Q),q=document.createElement("a");q.href=j,q.download=`resource-${Date.now()}.json`,document.body.appendChild(q),q.click(),document.body.removeChild(q),URL.revokeObjectURL(j)}catch(Q){console.error("[ResourcesTab] Failed to download result:",Q)}},[f]),re=b.useCallback(async()=>{if(L.current)try{document.fullscreenElement?await document.exitFullscreen():await L.current.requestFullscreen()}catch(Q){console.error("[ResourcesTab] Failed to toggle fullscreen:",Q)}},[]);return M?p.jsxs("div",{className:"h-full flex flex-col overflow-hidden relative bg-background",children:[W!=="list"&&p.jsxs("div",{className:"flex items-center gap-2 p-2 border-b shrink-0 bg-background z-10",children:[p.jsx(Je,{variant:"ghost",size:"sm",onClick:()=>{l(null),X("list")},className:"p-0 h-8 w-8",children:p.jsx(XR,{className:"h-4 w-4"})}),p.jsxs("div",{className:"flex items-center text-sm font-medium",children:[p.jsx("button",{onClick:()=>{l(null),X("list")},className:"text-muted-foreground hover:text-foreground hover:underline cursor-pointer",children:"Resources"}),W==="detail"&&p.jsxs(p.Fragment,{children:[p.jsx("span",{className:"mx-2 text-muted-foreground",children:"/"}),p.jsx("span",{className:"text-foreground",children:"Content"})]})]})]}),p.jsx("div",{className:"flex-1 relative overflow-hidden",children:p.jsxs(gh,{initial:!1,mode:"popLayout",children:[W==="list"&&p.jsxs(_n.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:[p.jsx(Ez,{activeTab:S,isSearchExpanded:_,searchQuery:y,filteredResourcesCount:J.length,onSearchExpand:()=>C(!0),onSearchChange:w,onSearchBlur:ee,onTabSwitch:()=>{},searchInputRef:O}),p.jsx("div",{className:"flex flex-col h-full",children:p.jsx(yz,{resources:J,selectedResource:s,onResourceSelect:B,focusedIndex:N})})]},"list"),W==="detail"&&p.jsx(_n.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:p.jsx("div",{ref:L,className:"h-full",children:p.jsx(bz,{result:f,isLoading:g,previewMode:T,serverId:n,readResource:r,onTogglePreview:()=>x(!T),onCopy:Y,onDownload:H,onFullscreen:re,isCopied:A})})},"detail")]})})]}):p.jsxs(Id,{direction:"horizontal",className:"h-full",children:[p.jsxs(Fa,{defaultSize:25,children:[p.jsx(Ez,{activeTab:S,isSearchExpanded:_,searchQuery:y,filteredResourcesCount:J.length,onSearchExpand:()=>C(!0),onSearchChange:w,onSearchBlur:ee,onTabSwitch:()=>{},searchInputRef:O}),p.jsx("div",{className:"flex flex-col h-full",children:p.jsx(yz,{resources:J,selectedResource:s,onResourceSelect:B,focusedIndex:N})})]}),p.jsx(Od,{}),p.jsx(Fa,{defaultSize:50,children:p.jsx("div",{ref:L,className:"h-full bg-white dark:bg-zinc-900",children:p.jsx(bz,{result:f,isLoading:g,previewMode:T,serverId:n,readResource:r,onTogglePreview:()=>x(!T),onCopy:Y,onDownload:H,onFullscreen:re,isCopied:A})})})]})}xV.displayName="ResourcesTab";function Sz({savedRequests:t,selectedRequest:e,onLoadRequest:r,onDeleteRequest:n,focusedIndex:a}){if(t.length===0)return p.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[p.jsx(uh,{className:"h-12 w-12 text-gray-400 dark:text-gray-600 mb-3"}),p.jsx("p",{className:"text-gray-500 dark:text-gray-400 mb-2",children:"No saved requests yet"}),p.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500",children:"Execute a tool and click Save to store requests"})]});const s=(l,c)=>{l.stopPropagation(),c()};return p.jsx("div",{className:"overflow-y-auto flex-1 border-r dark:border-zinc-700 overscroll-contain",children:t.map((l,c)=>p.jsxs("div",{className:"relative group",children:[p.jsx(af,{id:`saved-${l.id}`,isSelected:e?.id===l.id,isFocused:a===c,icon:p.jsx(l3,{className:"h-4 w-4"}),title:l.name,description:l.toolName,metadata:p.jsx("div",{className:"flex flex-col gap-1",children:p.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500",children:new Date(l.savedAt).toLocaleString()})}),onClick:()=>r(l)}),p.jsx("div",{className:"absolute top-1/2 right-2 -translate-y-1/2 opacity-0 group-hover:opacity-100 transition-opacity z-10",children:p.jsxs(Sr,{children:[p.jsx(xr,{asChild:!0,children:p.jsx(Je,{variant:"secondary",size:"sm",onClick:d=>s(d,()=>n(l.id)),className:"h-8 w-8 p-0",children:p.jsx(fT,{className:"h-4 w-4"})})}),p.jsx(wr,{children:p.jsx("p",{children:"Delete saved request"})})]})})]},l.id))})}function xz({isOpen:t,requestName:e,defaultPlaceholder:r,onRequestNameChange:n,onSave:a,onCancel:s}){return t?p.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",onClick:s,children:p.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:l=>l.stopPropagation(),children:[p.jsx("h3",{className:"text-lg font-semibold mb-4 text-gray-900 dark:text-gray-100",children:"Save Request"}),p.jsxs("div",{className:"space-y-4",children:[p.jsxs("div",{children:[p.jsx(lr,{htmlFor:"request-name",children:"Request Name (optional)"}),p.jsx(Mr,{id:"request-name",value:e,onChange:l=>n(l.target.value),placeholder:r,className:"mt-2",onKeyDown:l=>{l.key==="Enter"&&a()},autoFocus:!0})]}),p.jsxs("div",{className:"flex justify-end gap-2",children:[p.jsx(Je,{variant:"outline",onClick:s,children:"Cancel"}),p.jsxs(Je,{onClick:a,children:[p.jsx(JR,{className:"h-4 w-4 mr-2"}),"Save"]})]})]})]})}):null}function tEe({selectedTool:t,toolArgs:e,onArgChange:r}){const n=t?.inputSchema?.properties||{},a=t?.inputSchema?.required||[];return Object.keys(n).length>0?p.jsx("div",{className:"space-y-4",children:Object.entries(n).map(([l,c])=>{const d=c;d.required=a.includes(l);const f=e[l];let h="";return f!=null&&(typeof f=="string"?h=f:typeof f=="object"&&f!==null?h=JSON.stringify(f,null,2):h=String(f)),d.type==="object"||d.type==="array"?p.jsxs("div",{className:"space-y-2",children:[p.jsxs(lr,{htmlFor:l,className:"text-sm font-medium",children:[l,d?.required&&p.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),p.jsx(Sh,{id:l,value:h,onChange:v=>r(l,v.target.value),placeholder:d?.description||`Enter ${l}`,className:"min-h-[100px]"}),d?.description&&p.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:d.description})]},l):p.jsxs("div",{className:"space-y-2",children:[p.jsxs(lr,{htmlFor:l,className:"text-sm font-medium",children:[l,d?.required&&p.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),p.jsx(Mr,{id:l,value:h,onChange:v=>r(l,v.target.value),placeholder:d?.description||`Enter ${l}`}),d?.description&&p.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:d.description})]},l)})}):p.jsx("div",{className:"flex items-center justify-center h-32 text-gray-500 dark:text-gray-400 text-sm",children:"No parameters required"})}function wz({selectedTool:t,toolArgs:e,isExecuting:r,isConnected:n,onArgChange:a,onExecute:s,onSave:l}){return t?p.jsxs("div",{className:"flex flex-col h-full",children:[p.jsx("div",{className:"flex-shrink-0 p-3 sm:p-6 pt-3 pb-4 pr-3",children:p.jsxs("div",{children:[p.jsxs("div",{className:"flex flex-row items-center justify-between mb-0 gap-2",children:[p.jsx("h3",{className:"text-base sm:text-lg font-semibold",children:t.name}),p.jsxs("div",{className:"flex gap-2 flex-shrink-0",children:[p.jsx(Je,{onClick:s,disabled:r||!n,size:"sm",className:"lg:size-default",children:r?p.jsxs(p.Fragment,{children:[p.jsx(Uo,{className:"mr-2"}),p.jsx("span",{className:"hidden sm:inline",children:"Executing..."})]}):p.jsxs(p.Fragment,{children:[p.jsx(u3,{className:"h-4 w-4 sm:mr-2"}),p.jsx("span",{className:"hidden sm:inline",children:"Execute"})]})}),p.jsxs(Je,{variant:"outline",onClick:l,disabled:r,size:"sm",className:"lg:size-default gap-2",children:[p.jsx(JR,{className:"h-4 w-4"}),p.jsx("span",{className:"hidden sm:inline",children:"Save"})]})]})]}),t.description&&p.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 leading-relaxed mt-2",children:t.description})]})}),p.jsx("div",{className:"flex-1 overflow-y-auto px-3 sm:px-6 pb-4 pr-3",children:p.jsx(tEe,{selectedTool:t,toolArgs:e,onArgChange:a})})]}):p.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[p.jsx("p",{className:"text-gray-500 dark:text-gray-400 mb-2",children:"Select a tool to get started"}),p.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 _z({results:t,copiedResult:e,previewMode:r,serverId:n,readResource:a,onCopy:s,onTogglePreview:l}){return p.jsx("div",{className:"flex flex-col h-full bg-white dark:bg-black border-t dark:border-zinc-700",children:p.jsx("div",{className:"flex-1 overflow-y-auto h-full",children:t.length>0?p.jsx("div",{className:"space-y-4 flex-1 h-full",children:t.map((c,d)=>{const f=c.toolMeta?.["openai/outputTemplate"],h=!!(f&&typeof f=="string"&&c.appsSdkResource),g=f,v=c.result?.content||[],y=v.filter(S=>S.type==="resource"&&Wl(S.resource)),w=y.length>0;return p.jsxs("div",{className:"space-y-0 flex-1 h-full flex flex-col",children:[p.jsxs("div",{className:`flex items-center gap-2 px-4 pt-2 ${w||h?"border-b border-gray-200 dark:border-zinc-600 pb-2":""}`,children:[p.jsx("h3",{className:"text-sm font-medium hidden sm:block",children:"Response"}),p.jsxs("div",{className:"hidden sm:flex items-center gap-1",children:[p.jsx(uc,{className:"h-3 w-3 text-gray-400"}),p.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:new Date(c.timestamp).toLocaleTimeString()})]}),c.duration!==void 0&&p.jsxs("div",{className:"hidden sm:flex items-center gap-1",children:[p.jsx(Ed,{className:"h-3 w-3 text-gray-400"}),p.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:[c.duration,"ms"]})]}),h&&p.jsxs("div",{className:"flex items-center gap-4 sm:ml-4",children:[p.jsxs("span",{className:"hidden sm:inline text-xs text-gray-500 dark:text-gray-400",children:["URI: ",g||"No URI"]}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("button",{onClick:()=>l(),className:`text-xs font-medium ${r?"text-black dark:text-white":"text-zinc-500 dark:text-zinc-400"}`,children:"Component"}),p.jsx("span",{className:"text-xs text-zinc-400",children:"|"}),p.jsx("button",{onClick:()=>l(),className:`text-xs font-medium ${r?"text-zinc-500 dark:text-zinc-400":"text-black dark:text-white"}`,children:"Raw JSON"})]})]}),w&&!h&&p.jsxs("div",{className:"flex items-center gap-4 sm:ml-4",children:[p.jsxs("span",{className:"hidden sm:inline text-xs text-gray-500 dark:text-gray-400",children:["URI: ",y[0]?.resource?.uri||"No URI"]}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("button",{onClick:()=>l(),className:`text-xs font-medium ${r?"text-black dark:text-white":"text-zinc-500 dark:text-zinc-400"}`,children:"Preview"}),p.jsx("span",{className:"text-xs text-zinc-400",children:"|"}),p.jsx("button",{onClick:()=>l(),className:`text-xs font-medium ${r?"text-zinc-500 dark:text-zinc-400":"text-black dark:text-white"}`,children:"JSON"})]})]}),p.jsx(Je,{variant:"ghost",size:"sm",onClick:()=>s(d,c.result),className:"ml-auto",children:e===d?p.jsx(Mo,{className:"h-4 w-4"}):p.jsx($n,{className:"h-4 w-4"})})]}),c.error?p.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:[p.jsx("p",{className:"text-red-800 dark:text-red-300 font-medium",children:"Error:"}),p.jsx("p",{className:"text-red-700 dark:text-red-400 text-sm",children:c.error})]}):(()=>{if(h){const S=c.appsSdkResource;return S.isLoading?p.jsx(p.Fragment,{}):S.error?p.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:[p.jsx("p",{className:"text-red-800 dark:text-red-300 font-medium",children:"Resource Error:"}),p.jsx("p",{className:"text-red-700 dark:text-red-400 text-sm",children:S.error})]}):r?p.jsx("div",{className:"flex-1",children:p.jsx(aA,{componentUrl:g,toolName:c.toolName,toolArgs:c.args,toolResult:c.result,resource:S.resourceData,serverId:n,readResource:a,className:"w-full h-full relative p-4"})}):p.jsx("div",{className:"px-4 pt-4",children:p.jsx(Ua,{data:c.result,filename:`tool-result-${c.toolName}-${Date.now()}.json`})})}return w?r?p.jsxs("div",{className:"space-y-0 h-full",children:[y.map((S,T)=>p.jsx("div",{className:"mx-0 size-full",children:p.jsx(SV,{resource:S.resource,onUIAction:x=>{},className:"w-full h-full relative"})},T)),v.filter(S=>!(S.type==="resource"&&Wl(S.resource))).length>0&&p.jsx("div",{className:"px-4",children:p.jsx(Ua,{data:v.filter(S=>!(S.type==="resource"&&Wl(S.resource))),filename:`tool-result-${c.toolName}-non-ui-${Date.now()}.json`})})]}):p.jsx("div",{className:"px-4 pt-4",children:p.jsx(Ua,{data:c.result,filename:`tool-result-${c.toolName}-mcp-ui-${Date.now()}.json`})}):p.jsx("div",{className:"px-4 pt-4",children:p.jsx(Ua,{data:c.result,filename:`tool-result-${c.toolName}-${Date.now()}.json`})})})()]},d)})}):p.jsx("div",{className:"flex items-center justify-center h-full",children:p.jsx("div",{className:"text-center",children:p.jsx(VR,{vertical:!0,noBorder:!0,message:"No Results yet"})})})})})}function Tz({tools:t,selectedTool:e,onToolSelect:r,focusedIndex:n}){return t.length===0?p.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[p.jsx(Rs,{className:"h-12 w-12 text-gray-400 dark:text-gray-600 mb-3"}),p.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"No tools available"})]}):p.jsx("div",{className:"overflow-y-auto flex-1 border-r dark:border-zinc-700 overscroll-contain",children:t.map((a,s)=>p.jsx(af,{id:`tool-${a.name}`,isSelected:e?.name===a.name,isFocused:n===s,icon:p.jsx(Rs,{className:"h-4 w-4"}),title:a.name,description:a.description,metadata:a.inputSchema?.properties&&p.jsxs(Wa,{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:()=>r(a)},a.name))})}function Rz({activeTab:t,isSearchExpanded:e,searchQuery:r,filteredToolsCount:n,savedRequestsCount:a,onSearchExpand:s,onSearchChange:l,onSearchBlur:c,onTabSwitch:d,searchInputRef:f}){return p.jsx(yV,{activeTab:t,isSearchExpanded:e,searchQuery:r,primaryTabName:"tools",secondaryTabName:"saved",primaryTabTitle:"Tools",secondaryTabTitle:"Saved",primaryCount:n,secondaryCount:a,primaryIcon:Rs,secondaryIcon:uh,searchPlaceholder:"Search tools...",onSearchExpand:s,onSearchChange:l,onSearchBlur:c,onTabSwitch:d,searchInputRef:f})}const Cz="mcp-inspector-saved-requests";function wV({ref:t,tools:e,callTool:r,readResource:n,serverId:a,isConnected:s}){const[l,c]=b.useState(null),[d,f]=b.useState(null),{selectedToolName:h,setSelectedToolName:g}=tf(),[v,y]=b.useState({}),[w,S]=b.useState([]),[T,x]=b.useState(!1),[_,C]=b.useState(null),[N,k]=b.useState(""),[A,I]=b.useState("tools"),[O,L]=b.useState([]),[M,P]=b.useState(!1),[W,X]=b.useState(""),[ee,J]=b.useState(!0),[B,Y]=b.useState(!1),[H,re]=b.useState(-1),Q=b.useRef(null),[j,q]=b.useState(!1),[z,G]=b.useState("list");b.useEffect(()=>{const _e=()=>{q(window.innerWidth<1024)};return _e(),window.addEventListener("resize",_e),()=>window.removeEventListener("resize",_e)},[]),b.useEffect(()=>{G(l?"detail":"list")},[l]),b.useEffect(()=>{j&&w.length>0&&!T&&G("response")},[w,T,j]),b.useImperativeHandle(t,()=>({focusSearch:()=>{Y(!0),setTimeout(()=>{Q.current&&Q.current.focus()},0)},blurSearch:()=>{k(""),Y(!1),Q.current&&Q.current.blur()}})),b.useEffect(()=>{try{const _e=localStorage.getItem(Cz);_e&&L(JSON.parse(_e))}catch(_e){console.error("[ToolsTab] Failed to load saved requests:",_e)}},[]);const Z=b.useCallback(_e=>{try{localStorage.setItem(Cz,JSON.stringify(_e)),L(_e)}catch(Ae){console.error("[ToolsTab] Failed to save requests:",Ae)}},[]),U=b.useMemo(()=>{if(!N.trim())return e;const _e=N.toLowerCase();return e.filter(Ae=>Ae.name.toLowerCase().includes(_e)||Ae.description?.toLowerCase().includes(_e))},[e,N]),F=b.useCallback(_e=>{c(_e);const Ae={};_e.inputSchema?.properties&&Object.entries(_e.inputSchema.properties).forEach(([$e,oe])=>{const Se=oe;Se.default!==void 0?Ae[$e]=Se.default:Se.type==="string"?Ae[$e]="":Se.type==="number"?Ae[$e]=0:Se.type==="boolean"?Ae[$e]=!1:Se.type==="array"?Ae[$e]="[]":Se.type==="object"&&(Ae[$e]="{}")}),y(Ae)},[]),te=b.useCallback(_e=>{const Ae=e.find($e=>$e.name===_e.toolName);Ae&&(c(Ae),y(_e.args),f(_e))},[e]);b.useEffect(()=>{B&&Q.current&&Q.current.focus()},[B]);const fe=b.useCallback(()=>{N.trim()||Y(!1)},[N]);b.useEffect(()=>{A!=="tools"&&Y(!1)},[A]),b.useEffect(()=>{re(-1)},[N,A]),b.useEffect(()=>{const _e=Ae=>{const $e=Ae.target;if($e.tagName==="INPUT"||$e.tagName==="TEXTAREA"||$e.contentEditable==="true"||Ae.metaKey||Ae.ctrlKey||Ae.altKey)return;const Se=A==="tools"?U:O;if(Ae.key==="ArrowDown")Ae.preventDefault(),re(Le=>{const we=Le+1;return we>=Se.length?0:we});else if(Ae.key==="ArrowUp")Ae.preventDefault(),re(Le=>{const we=Le-1;return we<0?Se.length-1:we});else if(Ae.key==="Enter"&&H>=0)if(Ae.preventDefault(),A==="tools"){const Le=U[H];Le&&F(Le)}else{const Le=O[H];Le&&te(Le)}};return document.addEventListener("keydown",_e),()=>document.removeEventListener("keydown",_e)},[H,U,O,A,F,te]),b.useEffect(()=>{if(H>=0){const _e=A==="tools"?`tool-${U[H]?.name}`:`saved-${O[H]?.id}`,Ae=document.getElementById(_e);Ae&&Ae.scrollIntoView({behavior:"smooth",block:"nearest"})}},[H,U,O,A]),b.useEffect(()=>{if(h&&e.length>0){const _e=e.find(Ae=>Ae.name===h);if(_e&&l?.name!==_e.name){g(null);const Ae=setTimeout(()=>{F(_e);const $e=document.getElementById(`tool-${_e.name}`);$e&&$e.scrollIntoView({behavior:"smooth",block:"nearest"})},100);return()=>clearTimeout(Ae)}}},[h,e,l,F,g]);const V=b.useCallback((_e,Ae)=>{y($e=>{const oe={...$e};if(l?.inputSchema?.properties?.[_e]){const Le=l.inputSchema.properties[_e].type;if(Le==="object"||Le==="array")oe[_e]=Ae;else if(Le==="string")oe[_e]=Ae;else try{oe[_e]=JSON.parse(Ae)}catch{oe[_e]=Ae}}else oe[_e]=Ae;return oe})},[l]),de=b.useCallback(async()=>{if(!l||T)return;x(!0);const _e=Date.now();try{const Ae={...v};l.inputSchema?.properties&&Object.entries(l.inputSchema.properties).forEach(([Oe,Ve])=>{const ut=Ve.type,At=Ae[Oe];if((ut==="object"||ut==="array")&&typeof At=="string")try{Ae[Oe]=JSON.parse(At)}catch{}});const $e=await r(l.name,Ae),oe=Date.now()-_e;zr.getInstance().capture(new iD({toolName:l.name,serverId:a,success:!0,duration:oe})).catch(()=>{});const Le=l?._meta||l?.metadata,we=Le?.["openai/outputTemplate"];let ke;if(we&&typeof we=="string"){const Oe={toolName:l.name,args:v,result:$e,timestamp:_e,duration:oe,toolMeta:Le,appsSdkResource:{uri:we,resourceData:null,isLoading:!0}};S([Oe]);try{const Ve=await n(we);let et=null;if($e?.structuredContent)et=$e.structuredContent;else if(Array.isArray($e)&&$e[0]){const ut=$e[0];ut.output?.value?.structuredContent?et=ut.output.value.structuredContent:ut.structuredContent?et=ut.structuredContent:ut.output?.value&&(et=ut.output.value)}et||(et=$e),ke={uri:we,resourceData:{...Ve,structuredContent:et},isLoading:!1}}catch(Ve){ke={uri:we,resourceData:null,isLoading:!1,error:Ve instanceof Error?Ve.message:String(Ve)}}S(Ve=>Ve.map((et,ut)=>ut===0?{...et,appsSdkResource:ke}:et))}else S(Oe=>[{toolName:l.name,args:v,result:$e,timestamp:_e,duration:oe,toolMeta:Le},...Oe])}catch(Ae){const $e=Date.now()-_e;zr.getInstance().capture(new iD({toolName:l.name,serverId:a,success:!1,duration:$e,error:Ae instanceof Error?Ae.message:String(Ae)})).catch(()=>{});const Se=l?._meta||l?.metadata,Le={toolName:l.name,args:v,result:null,error:Ae instanceof Error?Ae.message:String(Ae),timestamp:_e,duration:$e,toolMeta:Se},we=Se?.["openai/outputTemplate"];S(we?[Le]:ke=>[Le,...ke])}finally{x(!1)}},[l,v,T,r,n,a]),le=b.useCallback(async(_e,Ae)=>{try{await navigator.clipboard.writeText(JSON.stringify(Ae,null,2)),C(_e),setTimeout(()=>C(null),2e3)}catch($e){console.error("[ToolsTab] Failed to copy result:",$e)}},[]),pe=b.useCallback(_e=>{S(Ae=>Ae.filter(($e,oe)=>oe!==_e))},[]),Re=b.useCallback(_e=>{const Ae=w[_e];if(Ae){const $e=window.open("","_blank","width=800,height=600");$e&&($e.document.write(`
|
|
1545
|
+
`);C=A.pop()||"";for(const I of A)if(I.trim()&&I.startsWith("data: "))try{const O=JSON.parse(I.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"){S+=O.content;const L=T[T.length-1];L&&L.type==="text"?L.text=S:T.push({type:"text",text:S}),console.log("[Parts after text]",T.length,"parts, text length:",S.length),s(M=>M.map(P=>P.id===w?{...P,parts:[...T]}:P))}else if(O.type==="tool-call")S&&(S=""),T.push({type:"tool-invocation",toolInvocation:{toolName:O.toolName,args:O.args,state:"pending"}}),console.log("[Parts after tool-call]",T.length,"parts, tool:",O.toolName),s(L=>L.map(M=>M.id===w?{...M,parts:[...T]}:M));else if(O.type==="tool-result"){const L=T.find(M=>M.type==="tool-invocation"&&M.toolInvocation?.toolName===O.toolName&&!M.toolInvocation?.result);L&&L.toolInvocation?(L.toolInvocation.result=O.result,L.toolInvocation.state="result",console.log("[Parts after tool-result]",T.length,"parts, updated:",O.toolName),s(M=>M.map(P=>P.id===w?{...P,parts:[...T]}:P))):console.warn("[tool-result] Could not find matching tool part for",O.toolName)}else if(O.type==="done")console.log("[Done] Final parts:",T.length),s(L=>L.map(M=>M.id===w?{...M,parts:[...T],content:""}:M));else if(O.type==="error")throw new Error(O.message||"Streaming error")}catch(O){console.error("Failed to parse streaming event:",O,I)}}}catch(v){let y="Unknown error occurred";if(v instanceof Error){y=v.message;const S=v;S.status&&(y=`HTTP ${S.status}: ${y}`),(S.code===401||y.includes("401")||y.includes("Unauthorized"))&&(y="Authentication failed (401). Check your Authorization header in the connection settings.")}const w={id:`error-${Date.now()}`,role:"assistant",content:`Error: ${y}`,timestamp:Date.now()};s(S=>[...S,w])}finally{c(!1)}},[e,n,t,a,r]),f=b.useCallback(()=>{s([])},[]);return{messages:a,isLoading:l,sendMessage:d,clearMessages:f}}function Sye({connection:t,llmConfig:e,isConnected:r,readResource:n}){const[a,s]=b.useState([]),[l,c]=b.useState(!1),d=b.useRef(null),f=b.useRef(null),h=b.useRef(null),g=b.useCallback(async y=>{if(!y.trim()||!e||!r)return;const w={id:`user-${Date.now()}`,role:"user",content:y.trim(),timestamp:Date.now()};s(x=>[...x,w]),c(!0),d.current=new AbortController;const S=Date.now();let T=0;try{const x=`assistant-${Date.now()}`;let _="";const C=[];if(s(N=>[...N,{id:x,role:"assistant",content:"",timestamp:Date.now(),parts:[]}]),!h.current||h.current.provider!==e.provider||h.current.model!==e.model||h.current.apiKey!==e.apiKey){let N;if(e.provider==="openai"){const{ChatOpenAI:k}=await ds(async()=>{const{ChatOpenAI:A}=await import("./index-D3r30E5x.js");return{ChatOpenAI:A}},__vite__mapDeps([4,5,6,2,7]));N=new k({model:e.model,apiKey:e.apiKey})}else if(e.provider==="anthropic"){const{ChatAnthropic:k}=await ds(async()=>{const{ChatAnthropic:A}=await import("./index-xRISKm6b.js");return{ChatAnthropic:A}},__vite__mapDeps([8,5,6,2]));N=new k({model:e.model,apiKey:e.apiKey})}else if(e.provider==="google"){const{ChatGoogleGenerativeAI:k}=await ds(async()=>{const{ChatGoogleGenerativeAI:A}=await import("./index-UA3z-V5S.js");return{ChatGoogleGenerativeAI:A}},__vite__mapDeps([9,5,6,2,7]));N=new k({model:e.model,apiKey:e.apiKey})}else throw new Error(`Unsupported LLM provider: ${e.provider}`);h.current={instance:N,provider:e.provider,model:e.model,apiKey:e.apiKey}}if(!f.current||f.current.llm!==h.current.instance){const{MCPAgent:N}=await ds(async()=>{const{MCPAgent:k}=await import("./langfuse-C4HKZ3NL-Dbzphj3a.js").then(A=>A.c);return{MCPAgent:k}},__vite__mapDeps([10,6,2,1,3]));f.current=new N({llm:h.current.instance,client:t.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 f.current.initialize()}else console.log("[useChatMessagesClientSide] Reusing existing agent. History length:",f.current.conversationHistory?.length);for await(const N of f.current.streamEvents(y,10,!1,void 0)){if(d.current?.signal.aborted)break;if(N.event==="on_chat_model_stream"&&N.data?.chunk?.text){const k=N.data.chunk.text;if(typeof k=="string"&&k.length>0){_+=k;const A=C[C.length-1];A&&A.type==="text"?A.text=_:C.push({type:"text",text:_}),s(I=>I.map(O=>O.id===x?{...O,parts:[...C]}:O))}}else if(N.event==="on_tool_start"){_&&(_="");let k={};N.data?.input?k=N.data.input:N.data?.tool_input?k=N.data.tool_input:N.data&&(k=N.data),console.log("[useChatMessagesClientSide] on_tool_start:",{toolName:N.name,eventData:N.data,extractedArgs:k}),T++,C.push({type:"tool-invocation",toolInvocation:{toolName:N.name||"unknown",args:k,state:"pending"}}),s(A=>A.map(I=>I.id===x?{...I,parts:[...C]}:I))}else if(N.event==="on_tool_end"){const k=C.find(A=>A.type==="tool-invocation"&&A.toolInvocation?.toolName===N.name&&!A.toolInvocation?.result);if(console.log("[useChatMessagesClientSide] on_tool_end event:",{toolName:N.name,hasToolPart:!!k,output:N.data?.output}),k&&k.toolInvocation){let A=N.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}k.toolInvocation.result=A,k.toolInvocation.state="result";const I=A?._meta?.["openai/outputTemplate"];if(console.log("[useChatMessagesClientSide] Tool result:",{toolName:N.name,hasMeta:!!A?._meta,hasStructuredContent:!!A?.structuredContent,appsSdkUri:I}),I&&typeof I=="string"&&n){console.log("[useChatMessagesClientSide] Detected Apps SDK component, fetching resource:",I);try{const O=await n(I);console.log("[useChatMessagesClientSide] Resource fetched:",O);const L=A?.structuredContent||null;if(O?.contents&&Array.isArray(O.contents)){const M=O.contents.map(W=>({type:"resource",resource:W}));console.log("[useChatMessagesClientSide] Created MCP resources:",M);const P={...A,content:[...A.content||[],...M],structuredContent:L};k.toolInvocation.result=P,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)}}s(O=>O.map(L=>L.id===x?{...L,parts:[...C]}:L))}}}s(N=>N.map(k=>k.id===x?{...k,parts:[...C],content:""}:k)),e&&zr.getInstance().capture(new cD({serverId:t.url,provider:e.provider,model:e.model,messageCount:a.length+1,toolCallsCount:T,success:!0,executionMode:"client-side",duration:Date.now()-S})).catch(()=>{})}catch(x){console.error("Client-side agent error:",x);let _="Unknown error occurred";if(x instanceof Error){_=x.message;const N=x;N.status&&(_=`HTTP ${N.status}: ${_}`),(N.code===401||_.includes("401")||_.includes("Unauthorized"))&&(_="Authentication failed (401). Check your Authorization header in the connection settings.")}e&&zr.getInstance().capture(new cD({serverId:t.url,provider:e.provider,model:e.model,messageCount:a.length+1,toolCallsCount:T,success:!1,executionMode:"client-side",duration:Date.now()-S,error:_})).catch(()=>{});const C={id:`error-${Date.now()}`,role:"assistant",content:`Error: ${_}`,timestamp:Date.now()};s(N=>[...N,C])}finally{c(!1),d.current=null}},[t,e,r,a,n]),v=b.useCallback(()=>{s([]),f.current&&f.current.clearConversationHistory()},[]);return{messages:a,isLoading:l,sendMessage:g,clearMessages:v}}const nz={openai:"gpt-4o",anthropic:"claude-haiku-4-5-20251001",google:"gemini-2.5-flash"};function xye({mcpServerUrl:t}){const[e,r]=b.useState(null),[n,a]=b.useState(null),[s,l]=b.useState(!1),[c,d]=b.useState("openai"),[f,h]=b.useState(""),[g,v]=b.useState(nz.openai),y=b.useCallback(()=>{const L=localStorage.getItem("mcp-inspector-api-keys");if(L)try{return JSON.parse(L)}catch(M){return console.error("Failed to load API keys:",M),{}}return{}},[]),w=b.useCallback(L=>{localStorage.setItem("mcp-inspector-api-keys",JSON.stringify(L))},[]),[S,T]=b.useState("none"),[x,_]=b.useState(""),[C,N]=b.useState(""),[k,A]=b.useState("");b.useEffect(()=>{const L=localStorage.getItem("mcp-inspector-llm-config"),M=y();if(L)try{const P=JSON.parse(L);r(P),d(P.provider),h(M[P.provider]||P.apiKey||""),v(P.model)}catch(P){console.error("Failed to load LLM config:",P)}},[y]),b.useEffect(()=>{const L=localStorage.getItem("mcp-inspector-auth-config");if(L)try{const M=JSON.parse(L);a(M),T(M.type),M.username&&_(M.username),M.password&&N(M.password),M.token&&A(M.token)}catch(M){console.error("Failed to load auth config:",M)}else try{const M="mcp:auth",P=ZH(t),W=`${M}_${P}_tokens`;localStorage.getItem(W)&&(a({type:"oauth"}),T("oauth"))}catch(M){console.error("Failed to check for OAuth tokens:",M)}},[t]),b.useEffect(()=>{v(nz[c]);const L=y();h(L[c]||"")},[c,y]);const I=b.useCallback(()=>{if(!f.trim())return;const L=y();L[c]=f,w(L);const M={provider:c,apiKey:f,model:g},P={type:S,...S==="basic"&&{username:x.trim(),password:C.trim()},...S==="bearer"&&{token:k.trim()}};r(M),a(P),localStorage.setItem("mcp-inspector-llm-config",JSON.stringify(M)),localStorage.setItem("mcp-inspector-auth-config",JSON.stringify(P)),l(!1)},[c,f,g,S,x,C,k,y,w]),O=b.useCallback(()=>{r(null),a(null);const L=y();delete L[c],w(L),h(""),_(""),N(""),A(""),T("none"),localStorage.removeItem("mcp-inspector-llm-config"),localStorage.removeItem("mcp-inspector-auth-config")},[c,y,w]);return{llmConfig:e,authConfig:n,configDialogOpen:s,setConfigDialogOpen:l,tempProvider:c,setTempProvider:d,tempApiKey:f,setTempApiKey:h,tempModel:g,setTempModel:v,tempAuthType:S,saveLLMConfig:I,clearConfig:O}}function wye({connection:t,isConnected:e,useClientSide:r=!0,readResource:n}){const[a,s]=b.useState(""),l=b.useRef(null),{llmConfig:c,authConfig:d,configDialogOpen:f,setConfigDialogOpen:h,tempProvider:g,setTempProvider:v,tempApiKey:y,setTempApiKey:w,tempModel:S,setTempModel:T,saveLLMConfig:x,clearConfig:_}=xye({mcpServerUrl:t.url}),C={connection:t,llmConfig:c,isConnected:e,readResource:n},N=Eye({mcpServerUrl:t.url,llmConfig:c,authConfig:d,isConnected:e}),k=Sye(C),{messages:A,isLoading:I,sendMessage:O,clearMessages:L}=r?k:N;B5({onNewChat:L}),b.useEffect(()=>{c&&A.length===0&&l.current&&l.current.focus()},[c,A.length]),b.useEffect(()=>{!I&&A.length>0&&l.current&&l.current.focus()},[I,A.length]);const M=b.useCallback(()=>{a.trim()&&(O(a),s(""))},[a,O]),P=b.useCallback(X=>{X.key==="Enter"&&!X.shiftKey&&(X.preventDefault(),M())},[M]),W=b.useCallback(()=>{_(),L()},[_,L]);return c&&A.length===0?p.jsxs("div",{className:"flex flex-col h-full",children:[p.jsx("div",{className:"absolute top-4 right-4 z-10",children:p.jsx(BT,{open:f,onOpenChange:h,tempProvider:g,tempModel:S,tempApiKey:y,onProviderChange:v,onModelChange:T,onApiKeyChange:w,onSave:x,onClear:W,showClearButton:!0,buttonLabel:"Change API Key"})}),p.jsx(vce,{mcpServerUrl:t.url,inputValue:a,isConnected:e,isLoading:I,textareaRef:l,llmConfig:c,onInputChange:s,onKeyDown:P,onSubmit:X=>{X.preventDefault(),M()},onConfigDialogOpenChange:h})]}):p.jsxs("div",{className:"flex flex-col h-full relative",children:[p.jsx(mce,{llmConfig:c,hasMessages:A.length>0,configDialogOpen:f,onConfigDialogOpenChange:h,onClearChat:L,tempProvider:g,tempModel:S,tempApiKey:y,onProviderChange:v,onModelChange:T,onApiKeyChange:w,onSaveConfig:x,onClearConfig:W}),p.jsx("div",{className:"flex-1 overflow-y-auto p-2 sm:p-4 pt-[80px] sm:pt-[100px]",children:c?p.jsx(yye,{messages:A,isLoading:I,serverId:t.url,readResource:n}):p.jsx(bce,{onConfigureClick:()=>h(!0)})}),c&&p.jsx(hce,{inputValue:a,isConnected:e,isLoading:I,textareaRef:l,onInputChange:s,onKeyDown:P,onSendMessage:M})]})}const Nh=b.createContext(null);Nh.displayName="PanelGroupContext";const gr={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"},dA=10,ys=b.useLayoutEffect,az=Vm.useId,_ye=typeof az=="function"?az:()=>null;let Tye=0;function fA(t=null){const e=_ye(),r=b.useRef(t||e||null);return r.current===null&&(r.current=""+Tye++),t??r.current}function XH({children:t,className:e="",collapsedSize:r,collapsible:n,defaultSize:a,forwardedRef:s,id:l,maxSize:c,minSize:d,onCollapse:f,onExpand:h,onResize:g,order:v,style:y,tagName:w="div",...S}){const T=b.useContext(Nh);if(T===null)throw Error("Panel components must be rendered within a PanelGroup container");const{collapsePanel:x,expandPanel:_,getPanelSize:C,getPanelStyle:N,groupId:k,isPanelCollapsed:A,reevaluatePanelConstraints:I,registerPanel:O,resizePanel:L,unregisterPanel:M}=T,P=fA(l),W=b.useRef({callbacks:{onCollapse:f,onExpand:h,onResize:g},constraints:{collapsedSize:r,collapsible:n,defaultSize:a,maxSize:c,minSize:d},id:P,idIsFromProps:l!==void 0,order:v});b.useRef({didLogMissingDefaultSizeWarning:!1}),ys(()=>{const{callbacks:ee,constraints:J}=W.current,B={...J};W.current.id=P,W.current.idIsFromProps=l!==void 0,W.current.order=v,ee.onCollapse=f,ee.onExpand=h,ee.onResize=g,J.collapsedSize=r,J.collapsible=n,J.defaultSize=a,J.maxSize=c,J.minSize=d,(B.collapsedSize!==J.collapsedSize||B.collapsible!==J.collapsible||B.maxSize!==J.maxSize||B.minSize!==J.minSize)&&I(W.current,B)}),ys(()=>{const ee=W.current;return O(ee),()=>{M(ee)}},[v,P,O,M]),b.useImperativeHandle(s,()=>({collapse:()=>{x(W.current)},expand:ee=>{_(W.current,ee)},getId(){return P},getSize(){return C(W.current)},isCollapsed(){return A(W.current)},isExpanded(){return!A(W.current)},resize:ee=>{L(W.current,ee)}}),[x,_,C,A,P,L]);const X=N(W.current,a);return b.createElement(w,{...S,children:t,className:e,id:P,style:{...X,...y},[gr.groupId]:k,[gr.panel]:"",[gr.panelCollapsible]:n||void 0,[gr.panelId]:P,[gr.panelSize]:parseFloat(""+X.flexGrow).toFixed(1)})}const QH=b.forwardRef((t,e)=>b.createElement(XH,{...t,forwardedRef:e}));XH.displayName="Panel";QH.displayName="forwardRef(Panel)";let QT=null,nm=-1,Si=null;function Rye(t,e,r){const n=(e&nV)!==0,a=(e&aV)!==0,s=(e&oV)!==0,l=(e&iV)!==0;if(e){if(n)return s?"se-resize":l?"ne-resize":"e-resize";if(a)return s?"sw-resize":l?"nw-resize":"w-resize";if(s)return"s-resize";if(l)return"n-resize"}switch(t){case"horizontal":return"ew-resize";case"intersection":return"move";case"vertical":return"ns-resize"}}function Cye(){Si!==null&&(document.head.removeChild(Si),QT=null,Si=null,nm=-1)}function h_(t,e,r){var n,a;const s=Rye(t,e);if(QT!==s){if(QT=s,Si===null&&(Si=document.createElement("style"),document.head.appendChild(Si)),nm>=0){var l;(l=Si.sheet)===null||l===void 0||l.removeRule(nm)}nm=(n=(a=Si.sheet)===null||a===void 0?void 0:a.insertRule(`*{cursor: ${s} !important;}`))!==null&&n!==void 0?n:-1}}function JH(t){return t.type==="keydown"}function eV(t){return t.type.startsWith("pointer")}function tV(t){return t.type.startsWith("mouse")}function kh(t){if(eV(t)){if(t.isPrimary)return{x:t.clientX,y:t.clientY}}else if(tV(t))return{x:t.clientX,y:t.clientY};return{x:1/0,y:1/0}}function Aye(){if(typeof matchMedia=="function")return matchMedia("(pointer:coarse)").matches?"coarse":"fine"}function Nye(t,e,r){return t.x<e.x+e.width&&t.x+t.width>e.x&&t.y<e.y+e.height&&t.y+t.height>e.y}function kye(t,e){if(t===e)throw new Error("Cannot compare node with itself");const r={a:sz(t),b:sz(e)};let n;for(;r.a.at(-1)===r.b.at(-1);)t=r.a.pop(),e=r.b.pop(),n=t;vt(n,"Stacking order can only be calculated for elements with a common ancestor");const a={a:iz(oz(r.a)),b:iz(oz(r.b))};if(a.a===a.b){const s=n.childNodes,l={a:r.a.at(-1),b:r.b.at(-1)};let c=s.length;for(;c--;){const d=s[c];if(d===l.a)return 1;if(d===l.b)return-1}}return Math.sign(a.a-a.b)}const Iye=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function Oye(t){var e;const r=getComputedStyle((e=rV(t))!==null&&e!==void 0?e:t).display;return r==="flex"||r==="inline-flex"}function Dye(t){const e=getComputedStyle(t);return!!(e.position==="fixed"||e.zIndex!=="auto"&&(e.position!=="static"||Oye(t))||+e.opacity<1||"transform"in e&&e.transform!=="none"||"webkitTransform"in e&&e.webkitTransform!=="none"||"mixBlendMode"in e&&e.mixBlendMode!=="normal"||"filter"in e&&e.filter!=="none"||"webkitFilter"in e&&e.webkitFilter!=="none"||"isolation"in e&&e.isolation==="isolate"||Iye.test(e.willChange)||e.webkitOverflowScrolling==="touch")}function oz(t){let e=t.length;for(;e--;){const r=t[e];if(vt(r,"Missing node"),Dye(r))return r}return null}function iz(t){return t&&Number(getComputedStyle(t).zIndex)||0}function sz(t){const e=[];for(;t;)e.push(t),t=rV(t);return e}function rV(t){const{parentNode:e}=t;return e&&e instanceof ShadowRoot?e.host:e}const nV=1,aV=2,oV=4,iV=8,Lye=Aye()==="coarse";let Sa=[],Gl=!1,xi=new Map,Ih=new Map;const Nd=new Set;function Mye(t,e,r,n,a){var s;const{ownerDocument:l}=e,c={direction:r,element:e,hitAreaMargins:n,setResizeHandlerState:a},d=(s=xi.get(l))!==null&&s!==void 0?s:0;return xi.set(l,d+1),Nd.add(c),Um(),function(){var h;Ih.delete(t),Nd.delete(c);const g=(h=xi.get(l))!==null&&h!==void 0?h:1;if(xi.set(l,g-1),Um(),g===1&&xi.delete(l),Sa.includes(c)){const v=Sa.indexOf(c);v>=0&&Sa.splice(v,1),Oh(),a("up",!0,null)}}}function Pye(t){const{target:e}=t,{x:r,y:n}=kh(t);Gl=!0,pA({target:e,x:r,y:n}),Um(),Sa.length>0&&(Fm("down",t),Oh(),t.preventDefault(),sV(e)||t.stopImmediatePropagation())}function g_(t){const{x:e,y:r}=kh(t);if(Gl&&t.type!=="pointerleave"&&t.buttons===0&&(Gl=!1,Fm("up",t)),!Gl){const{target:n}=t;pA({target:n,x:e,y:r})}Fm("move",t),Oh(),Sa.length>0&&t.preventDefault()}function v_(t){const{target:e}=t,{x:r,y:n}=kh(t);Ih.clear(),Gl=!1,Sa.length>0&&(t.preventDefault(),sV(e)||t.stopImmediatePropagation()),Fm("up",t),pA({target:e,x:r,y:n}),Oh(),Um()}function sV(t){let e=t;for(;e;){if(e.hasAttribute(gr.resizeHandle))return!0;e=e.parentElement}return!1}function pA({target:t,x:e,y:r}){Sa.splice(0);let n=null;(t instanceof HTMLElement||t instanceof SVGElement)&&(n=t),Nd.forEach(a=>{const{element:s,hitAreaMargins:l}=a,c=s.getBoundingClientRect(),{bottom:d,left:f,right:h,top:g}=c,v=Lye?l.coarse:l.fine;if(e>=f-v&&e<=h+v&&r>=g-v&&r<=d+v){if(n!==null&&document.contains(n)&&s!==n&&!s.contains(n)&&!n.contains(s)&&kye(n,s)>0){let w=n,S=!1;for(;w&&!w.contains(s);){if(Nye(w.getBoundingClientRect(),c)){S=!0;break}w=w.parentElement}if(S)return}Sa.push(a)}})}function b_(t,e){Ih.set(t,e)}function Oh(){let t=!1,e=!1;Sa.forEach(n=>{const{direction:a}=n;a==="horizontal"?t=!0:e=!0});let r=0;Ih.forEach(n=>{r|=n}),t&&e?h_("intersection",r):t?h_("horizontal",r):e?h_("vertical",r):Cye()}let y_;function Um(){var t;(t=y_)===null||t===void 0||t.abort(),y_=new AbortController;const e={capture:!0,signal:y_.signal};Nd.size&&(Gl?(Sa.length>0&&xi.forEach((r,n)=>{const{body:a}=n;r>0&&(a.addEventListener("contextmenu",v_,e),a.addEventListener("pointerleave",g_,e),a.addEventListener("pointermove",g_,e))}),xi.forEach((r,n)=>{const{body:a}=n;a.addEventListener("pointerup",v_,e),a.addEventListener("pointercancel",v_,e)})):xi.forEach((r,n)=>{const{body:a}=n;r>0&&(a.addEventListener("pointerdown",Pye,e),a.addEventListener("pointermove",g_,e))}))}function Fm(t,e){Nd.forEach(r=>{const{setResizeHandlerState:n}=r,a=Sa.includes(r);n(t,a,e)})}function jye(){const[t,e]=b.useState(0);return b.useCallback(()=>e(r=>r+1),[])}function vt(t,e){if(!t)throw console.error(e),Error(e)}function Is(t,e,r=dA){return t.toFixed(r)===e.toFixed(r)?0:t>e?1:-1}function To(t,e,r=dA){return Is(t,e,r)===0}function Un(t,e,r){return Is(t,e,r)===0}function Uye(t,e,r){if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++){const a=t[n],s=e[n];if(!Un(a,s,r))return!1}return!0}function Fl({panelConstraints:t,panelIndex:e,size:r}){const n=t[e];vt(n!=null,`Panel constraints not found for index ${e}`);let{collapsedSize:a=0,collapsible:s,maxSize:l=100,minSize:c=0}=n;if(Is(r,c)<0)if(s){const d=(a+c)/2;Is(r,d)<0?r=a:r=c}else r=c;return r=Math.min(l,r),r=parseFloat(r.toFixed(dA)),r}function Fu({delta:t,initialLayout:e,panelConstraints:r,pivotIndices:n,prevLayout:a,trigger:s}){if(Un(t,0))return e;const l=[...e],[c,d]=n;vt(c!=null,"Invalid first pivot index"),vt(d!=null,"Invalid second pivot index");let f=0;if(s==="keyboard"){{const g=t<0?d:c,v=r[g];vt(v,`Panel constraints not found for index ${g}`);const{collapsedSize:y=0,collapsible:w,minSize:S=0}=v;if(w){const T=e[g];if(vt(T!=null,`Previous layout not found for panel index ${g}`),Un(T,y)){const x=S-T;Is(x,Math.abs(t))>0&&(t=t<0?0-x:x)}}}{const g=t<0?c:d,v=r[g];vt(v,`No panel constraints found for index ${g}`);const{collapsedSize:y=0,collapsible:w,minSize:S=0}=v;if(w){const T=e[g];if(vt(T!=null,`Previous layout not found for panel index ${g}`),Un(T,S)){const x=T-y;Is(x,Math.abs(t))>0&&(t=t<0?0-x:x)}}}}{const g=t<0?1:-1;let v=t<0?d:c,y=0;for(;;){const S=e[v];vt(S!=null,`Previous layout not found for panel index ${v}`);const x=Fl({panelConstraints:r,panelIndex:v,size:100})-S;if(y+=x,v+=g,v<0||v>=r.length)break}const w=Math.min(Math.abs(t),Math.abs(y));t=t<0?0-w:w}{let v=t<0?c:d;for(;v>=0&&v<r.length;){const y=Math.abs(t)-Math.abs(f),w=e[v];vt(w!=null,`Previous layout not found for panel index ${v}`);const S=w-y,T=Fl({panelConstraints:r,panelIndex:v,size:S});if(!Un(w,T)&&(f+=w-T,l[v]=T,f.toFixed(3).localeCompare(Math.abs(t).toFixed(3),void 0,{numeric:!0})>=0))break;t<0?v--:v++}}if(Uye(a,l))return a;{const g=t<0?d:c,v=e[g];vt(v!=null,`Previous layout not found for panel index ${g}`);const y=v+f,w=Fl({panelConstraints:r,panelIndex:g,size:y});if(l[g]=w,!Un(w,y)){let S=y-w,x=t<0?d:c;for(;x>=0&&x<r.length;){const _=l[x];vt(_!=null,`Previous layout not found for panel index ${x}`);const C=_+S,N=Fl({panelConstraints:r,panelIndex:x,size:C});if(Un(_,N)||(S-=N-_,l[x]=N),Un(S,0))break;t>0?x--:x++}}}const h=l.reduce((g,v)=>v+g,0);return Un(h,100)?l:a}function Fye({layout:t,panelsArray:e,pivotIndices:r}){let n=0,a=100,s=0,l=0;const c=r[0];vt(c!=null,"No pivot index found"),e.forEach((g,v)=>{const{constraints:y}=g,{maxSize:w=100,minSize:S=0}=y;v===c?(n=S,a=w):(s+=S,l+=w)});const d=Math.min(a,100-s),f=Math.max(n,100-l),h=t[c];return{valueMax:d,valueMin:f,valueNow:h}}function kd(t,e=document){return Array.from(e.querySelectorAll(`[${gr.resizeHandleId}][data-panel-group-id="${t}"]`))}function lV(t,e,r=document){const a=kd(t,r).findIndex(s=>s.getAttribute(gr.resizeHandleId)===e);return a??null}function cV(t,e,r){const n=lV(t,e,r);return n!=null?[n,n+1]:[-1,-1]}function zye(t){return t instanceof HTMLElement?!0:typeof t=="object"&&t!==null&&"tagName"in t&&"getAttribute"in t}function uV(t,e=document){if(zye(e)&&e.dataset.panelGroupId==t)return e;const r=e.querySelector(`[data-panel-group][data-panel-group-id="${t}"]`);return r||null}function Dh(t,e=document){const r=e.querySelector(`[${gr.resizeHandleId}="${t}"]`);return r||null}function $ye(t,e,r,n=document){var a,s,l,c;const d=Dh(e,n),f=kd(t,n),h=d?f.indexOf(d):-1,g=(a=(s=r[h])===null||s===void 0?void 0:s.id)!==null&&a!==void 0?a:null,v=(l=(c=r[h+1])===null||c===void 0?void 0:c.id)!==null&&l!==void 0?l:null;return[g,v]}function Bye({committedValuesRef:t,eagerValuesRef:e,groupId:r,layout:n,panelDataArray:a,panelGroupElement:s,setLayout:l}){b.useRef({didWarnAboutMissingResizeHandle:!1}),ys(()=>{if(!s)return;const c=kd(r,s);for(let d=0;d<a.length-1;d++){const{valueMax:f,valueMin:h,valueNow:g}=Fye({layout:n,panelsArray:a,pivotIndices:[d,d+1]}),v=c[d];if(v!=null){const y=a[d];vt(y,`No panel data found for index "${d}"`),v.setAttribute("aria-controls",y.id),v.setAttribute("aria-valuemax",""+Math.round(f)),v.setAttribute("aria-valuemin",""+Math.round(h)),v.setAttribute("aria-valuenow",g!=null?""+Math.round(g):"")}}return()=>{c.forEach((d,f)=>{d.removeAttribute("aria-controls"),d.removeAttribute("aria-valuemax"),d.removeAttribute("aria-valuemin"),d.removeAttribute("aria-valuenow")})}},[r,n,a,s]),b.useEffect(()=>{if(!s)return;const c=e.current;vt(c,"Eager values not found");const{panelDataArray:d}=c,f=uV(r,s);vt(f!=null,`No group found for id "${r}"`);const h=kd(r,s);vt(h,`No resize handles found for group id "${r}"`);const g=h.map(v=>{const y=v.getAttribute(gr.resizeHandleId);vt(y,"Resize handle element has no handle id attribute");const[w,S]=$ye(r,y,d,s);if(w==null||S==null)return()=>{};const T=x=>{if(!x.defaultPrevented)switch(x.key){case"Enter":{x.preventDefault();const _=d.findIndex(C=>C.id===w);if(_>=0){const C=d[_];vt(C,`No panel data found for index ${_}`);const N=n[_],{collapsedSize:k=0,collapsible:A,minSize:I=0}=C.constraints;if(N!=null&&A){const O=Fu({delta:Un(N,k)?I-k:k-N,initialLayout:n,panelConstraints:d.map(L=>L.constraints),pivotIndices:cV(r,y,s),prevLayout:n,trigger:"keyboard"});n!==O&&l(O)}}break}}};return v.addEventListener("keydown",T),()=>{v.removeEventListener("keydown",T)}});return()=>{g.forEach(v=>v())}},[s,t,e,r,n,a,l])}function lz(t,e){if(t.length!==e.length)return!1;for(let r=0;r<t.length;r++)if(t[r]!==e[r])return!1;return!0}function dV(t,e){const r=t==="horizontal",{x:n,y:a}=kh(e);return r?n:a}function qye(t,e,r,n,a){const s=r==="horizontal",l=Dh(e,a);vt(l,`No resize handle element found for id "${e}"`);const c=l.getAttribute(gr.groupId);vt(c,"Resize handle element has no group id attribute");let{initialCursorPosition:d}=n;const f=dV(r,t),h=uV(c,a);vt(h,`No group element found for id "${c}"`);const g=h.getBoundingClientRect(),v=s?g.width:g.height;return(f-d)/v*100}function Hye(t,e,r,n,a,s){if(JH(t)){const l=r==="horizontal";let c=0;t.shiftKey?c=100:a!=null?c=a:c=10;let d=0;switch(t.key){case"ArrowDown":d=l?0:c;break;case"ArrowLeft":d=l?-c:0;break;case"ArrowRight":d=l?c:0;break;case"ArrowUp":d=l?0:-c;break;case"End":d=100;break;case"Home":d=-100;break}return d}else return n==null?0:qye(t,e,r,n,s)}function Vye({panelDataArray:t}){const e=Array(t.length),r=t.map(s=>s.constraints);let n=0,a=100;for(let s=0;s<t.length;s++){const l=r[s];vt(l,`Panel constraints not found for index ${s}`);const{defaultSize:c}=l;c!=null&&(n++,e[s]=c,a-=c)}for(let s=0;s<t.length;s++){const l=r[s];vt(l,`Panel constraints not found for index ${s}`);const{defaultSize:c}=l;if(c!=null)continue;const d=t.length-n,f=a/d;n++,e[s]=f,a-=f}return e}function yl(t,e,r){e.forEach((n,a)=>{const s=t[a];vt(s,`Panel data not found for index ${a}`);const{callbacks:l,constraints:c,id:d}=s,{collapsedSize:f=0,collapsible:h}=c,g=r[d];if(g==null||n!==g){r[d]=n;const{onCollapse:v,onExpand:y,onResize:w}=l;w&&w(n,g),h&&(v||y)&&(y&&(g==null||To(g,f))&&!To(n,f)&&y(),v&&(g==null||!To(g,f))&&To(n,f)&&v())}})}function Up(t,e){if(t.length!==e.length)return!1;for(let r=0;r<t.length;r++)if(t[r]!=e[r])return!1;return!0}function Gye({defaultSize:t,dragState:e,layout:r,panelData:n,panelIndex:a,precision:s=3}){const l=r[a];let c;return l==null?c=t!=null?t.toFixed(s):"1":n.length===1?c="1":c=l.toFixed(s),{flexBasis:0,flexGrow:c,flexShrink:1,overflow:"hidden",pointerEvents:e!==null?"none":void 0}}function Wye(t,e=10){let r=null;return(...a)=>{r!==null&&clearTimeout(r),r=setTimeout(()=>{t(...a)},e)}}function cz(t){try{if(typeof localStorage<"u")t.getItem=e=>localStorage.getItem(e),t.setItem=(e,r)=>{localStorage.setItem(e,r)};else throw new Error("localStorage not supported in this environment")}catch(e){console.error(e),t.getItem=()=>null,t.setItem=()=>{}}}function fV(t){return`react-resizable-panels:${t}`}function pV(t){return t.map(e=>{const{constraints:r,id:n,idIsFromProps:a,order:s}=e;return a?n:s?`${s}:${JSON.stringify(r)}`:JSON.stringify(r)}).sort((e,r)=>e.localeCompare(r)).join(",")}function mV(t,e){try{const r=fV(t),n=e.getItem(r);if(n){const a=JSON.parse(n);if(typeof a=="object"&&a!=null)return a}}catch{}return null}function Yye(t,e,r){var n,a;const s=(n=mV(t,r))!==null&&n!==void 0?n:{},l=pV(e);return(a=s[l])!==null&&a!==void 0?a:null}function Kye(t,e,r,n,a){var s;const l=fV(t),c=pV(e),d=(s=mV(t,a))!==null&&s!==void 0?s:{};d[c]={expandToSizes:Object.fromEntries(r.entries()),layout:n};try{a.setItem(l,JSON.stringify(d))}catch(f){console.error(f)}}function uz({layout:t,panelConstraints:e}){const r=[...t],n=r.reduce((s,l)=>s+l,0);if(r.length!==e.length)throw Error(`Invalid ${e.length} panel layout: ${r.map(s=>`${s}%`).join(", ")}`);if(!Un(n,100)&&r.length>0)for(let s=0;s<e.length;s++){const l=r[s];vt(l!=null,`No layout data found for index ${s}`);const c=100/n*l;r[s]=c}let a=0;for(let s=0;s<e.length;s++){const l=r[s];vt(l!=null,`No layout data found for index ${s}`);const c=Fl({panelConstraints:e,panelIndex:s,size:l});l!=c&&(a+=l-c,r[s]=c)}if(!Un(a,0))for(let s=0;s<e.length;s++){const l=r[s];vt(l!=null,`No layout data found for index ${s}`);const c=l+a,d=Fl({panelConstraints:e,panelIndex:s,size:c});if(l!==d&&(a-=d-l,r[s]=d,Un(a,0)))break}return r}const Zye=100,zu={getItem:t=>(cz(zu),zu.getItem(t)),setItem:(t,e)=>{cz(zu),zu.setItem(t,e)}},dz={};function hV({autoSaveId:t=null,children:e,className:r="",direction:n,forwardedRef:a,id:s=null,onLayout:l=null,keyboardResizeBy:c=null,storage:d=zu,style:f,tagName:h="div",...g}){const v=fA(s),y=b.useRef(null),[w,S]=b.useState(null),[T,x]=b.useState([]),_=jye(),C=b.useRef({}),N=b.useRef(new Map),k=b.useRef(0),A=b.useRef({autoSaveId:t,direction:n,dragState:w,id:v,keyboardResizeBy:c,onLayout:l,storage:d}),I=b.useRef({layout:T,panelDataArray:[],panelDataArrayChanged:!1});b.useRef({didLogIdAndOrderWarning:!1,didLogPanelConstraintsWarning:!1,prevPanelIds:[]}),b.useImperativeHandle(a,()=>({getId:()=>A.current.id,getLayout:()=>{const{layout:z}=I.current;return z},setLayout:z=>{const{onLayout:G}=A.current,{layout:Z,panelDataArray:U}=I.current,F=uz({layout:z,panelConstraints:U.map(te=>te.constraints)});lz(Z,F)||(x(F),I.current.layout=F,G&&G(F),yl(U,F,C.current))}}),[]),ys(()=>{A.current.autoSaveId=t,A.current.direction=n,A.current.dragState=w,A.current.id=v,A.current.onLayout=l,A.current.storage=d}),Bye({committedValuesRef:A,eagerValuesRef:I,groupId:v,layout:T,panelDataArray:I.current.panelDataArray,setLayout:x,panelGroupElement:y.current}),b.useEffect(()=>{const{panelDataArray:z}=I.current;if(t){if(T.length===0||T.length!==z.length)return;let G=dz[t];G==null&&(G=Wye(Kye,Zye),dz[t]=G);const Z=[...z],U=new Map(N.current);G(t,Z,U,T,d)}},[t,T,d]),b.useEffect(()=>{});const O=b.useCallback(z=>{const{onLayout:G}=A.current,{layout:Z,panelDataArray:U}=I.current;if(z.constraints.collapsible){const F=U.map(de=>de.constraints),{collapsedSize:te=0,panelSize:fe,pivotIndices:V}=ss(U,z,Z);if(vt(fe!=null,`Panel size not found for panel "${z.id}"`),!To(fe,te)){N.current.set(z.id,fe);const le=kl(U,z)===U.length-1?fe-te:te-fe,pe=Fu({delta:le,initialLayout:Z,panelConstraints:F,pivotIndices:V,prevLayout:Z,trigger:"imperative-api"});Up(Z,pe)||(x(pe),I.current.layout=pe,G&&G(pe),yl(U,pe,C.current))}}},[]),L=b.useCallback((z,G)=>{const{onLayout:Z}=A.current,{layout:U,panelDataArray:F}=I.current;if(z.constraints.collapsible){const te=F.map(Re=>Re.constraints),{collapsedSize:fe=0,panelSize:V=0,minSize:de=0,pivotIndices:le}=ss(F,z,U),pe=G??de;if(To(V,fe)){const Re=N.current.get(z.id),Ke=Re!=null&&Re>=pe?Re:pe,ze=kl(F,z)===F.length-1?V-Ke:Ke-V,_e=Fu({delta:ze,initialLayout:U,panelConstraints:te,pivotIndices:le,prevLayout:U,trigger:"imperative-api"});Up(U,_e)||(x(_e),I.current.layout=_e,Z&&Z(_e),yl(F,_e,C.current))}}},[]),M=b.useCallback(z=>{const{layout:G,panelDataArray:Z}=I.current,{panelSize:U}=ss(Z,z,G);return vt(U!=null,`Panel size not found for panel "${z.id}"`),U},[]),P=b.useCallback((z,G)=>{const{panelDataArray:Z}=I.current,U=kl(Z,z);return Gye({defaultSize:G,dragState:w,layout:T,panelData:Z,panelIndex:U})},[w,T]),W=b.useCallback(z=>{const{layout:G,panelDataArray:Z}=I.current,{collapsedSize:U=0,collapsible:F,panelSize:te}=ss(Z,z,G);return vt(te!=null,`Panel size not found for panel "${z.id}"`),F===!0&&To(te,U)},[]),X=b.useCallback(z=>{const{layout:G,panelDataArray:Z}=I.current,{collapsedSize:U=0,collapsible:F,panelSize:te}=ss(Z,z,G);return vt(te!=null,`Panel size not found for panel "${z.id}"`),!F||Is(te,U)>0},[]),ee=b.useCallback(z=>{const{panelDataArray:G}=I.current;G.push(z),G.sort((Z,U)=>{const F=Z.order,te=U.order;return F==null&&te==null?0:F==null?-1:te==null?1:F-te}),I.current.panelDataArrayChanged=!0,_()},[_]);ys(()=>{if(I.current.panelDataArrayChanged){I.current.panelDataArrayChanged=!1;const{autoSaveId:z,onLayout:G,storage:Z}=A.current,{layout:U,panelDataArray:F}=I.current;let te=null;if(z){const V=Yye(z,F,Z);V&&(N.current=new Map(Object.entries(V.expandToSizes)),te=V.layout)}te==null&&(te=Vye({panelDataArray:F}));const fe=uz({layout:te,panelConstraints:F.map(V=>V.constraints)});lz(U,fe)||(x(fe),I.current.layout=fe,G&&G(fe),yl(F,fe,C.current))}}),ys(()=>{const z=I.current;return()=>{z.layout=[]}},[]);const J=b.useCallback(z=>{let G=!1;const Z=y.current;return Z&&window.getComputedStyle(Z,null).getPropertyValue("direction")==="rtl"&&(G=!0),function(F){F.preventDefault();const te=y.current;if(!te)return()=>null;const{direction:fe,dragState:V,id:de,keyboardResizeBy:le,onLayout:pe}=A.current,{layout:Re,panelDataArray:Ke}=I.current,{initialLayout:je}=V??{},ze=cV(de,z,te);let _e=Hye(F,z,fe,V,le,te);const Ae=fe==="horizontal";Ae&&G&&(_e=-_e);const $e=Ke.map(Le=>Le.constraints),oe=Fu({delta:_e,initialLayout:je??Re,panelConstraints:$e,pivotIndices:ze,prevLayout:Re,trigger:JH(F)?"keyboard":"mouse-or-touch"}),Se=!Up(Re,oe);(eV(F)||tV(F))&&k.current!=_e&&(k.current=_e,!Se&&_e!==0?Ae?b_(z,_e<0?nV:aV):b_(z,_e<0?oV:iV):b_(z,0)),Se&&(x(oe),I.current.layout=oe,pe&&pe(oe),yl(Ke,oe,C.current))}},[]),B=b.useCallback((z,G)=>{const{onLayout:Z}=A.current,{layout:U,panelDataArray:F}=I.current,te=F.map(Re=>Re.constraints),{panelSize:fe,pivotIndices:V}=ss(F,z,U);vt(fe!=null,`Panel size not found for panel "${z.id}"`);const le=kl(F,z)===F.length-1?fe-G:G-fe,pe=Fu({delta:le,initialLayout:U,panelConstraints:te,pivotIndices:V,prevLayout:U,trigger:"imperative-api"});Up(U,pe)||(x(pe),I.current.layout=pe,Z&&Z(pe),yl(F,pe,C.current))},[]),Y=b.useCallback((z,G)=>{const{layout:Z,panelDataArray:U}=I.current,{collapsedSize:F=0,collapsible:te}=G,{collapsedSize:fe=0,collapsible:V,maxSize:de=100,minSize:le=0}=z.constraints,{panelSize:pe}=ss(U,z,Z);pe!=null&&(te&&V&&To(pe,F)?To(F,fe)||B(z,fe):pe<le?B(z,le):pe>de&&B(z,de))},[B]),H=b.useCallback((z,G)=>{const{direction:Z}=A.current,{layout:U}=I.current;if(!y.current)return;const F=Dh(z,y.current);vt(F,`Drag handle element not found for id "${z}"`);const te=dV(Z,G);S({dragHandleId:z,dragHandleRect:F.getBoundingClientRect(),initialCursorPosition:te,initialLayout:U})},[]),re=b.useCallback(()=>{S(null)},[]),Q=b.useCallback(z=>{const{panelDataArray:G}=I.current,Z=kl(G,z);Z>=0&&(G.splice(Z,1),delete C.current[z.id],I.current.panelDataArrayChanged=!0,_())},[_]),j=b.useMemo(()=>({collapsePanel:O,direction:n,dragState:w,expandPanel:L,getPanelSize:M,getPanelStyle:P,groupId:v,isPanelCollapsed:W,isPanelExpanded:X,reevaluatePanelConstraints:Y,registerPanel:ee,registerResizeHandle:J,resizePanel:B,startDragging:H,stopDragging:re,unregisterPanel:Q,panelGroupElement:y.current}),[O,w,n,L,M,P,v,W,X,Y,ee,J,B,H,re,Q]),q={display:"flex",flexDirection:n==="horizontal"?"row":"column",height:"100%",overflow:"hidden",width:"100%"};return b.createElement(Nh.Provider,{value:j},b.createElement(h,{...g,children:e,className:r,id:s,ref:y,style:{...q,...f},[gr.group]:"",[gr.groupDirection]:n,[gr.groupId]:v}))}const gV=b.forwardRef((t,e)=>b.createElement(hV,{...t,forwardedRef:e}));hV.displayName="PanelGroup";gV.displayName="forwardRef(PanelGroup)";function kl(t,e){return t.findIndex(r=>r===e||r.id===e.id)}function ss(t,e,r){const n=kl(t,e),s=n===t.length-1?[n-1,n]:[n,n+1],l=r[n];return{...e.constraints,panelSize:l,pivotIndices:s}}function Xye({disabled:t,handleId:e,resizeHandler:r,panelGroupElement:n}){b.useEffect(()=>{if(t||r==null||n==null)return;const a=Dh(e,n);if(a==null)return;const s=l=>{if(!l.defaultPrevented)switch(l.key){case"ArrowDown":case"ArrowLeft":case"ArrowRight":case"ArrowUp":case"End":case"Home":{l.preventDefault(),r(l);break}case"F6":{l.preventDefault();const c=a.getAttribute(gr.groupId);vt(c,`No group element found for id "${c}"`);const d=kd(c,n),f=lV(c,e,n);vt(f!==null,`No resize element found for id "${e}"`);const h=l.shiftKey?f>0?f-1:d.length-1:f+1<d.length?f+1:0;d[h].focus();break}}};return a.addEventListener("keydown",s),()=>{a.removeEventListener("keydown",s)}},[n,t,e,r])}function vV({children:t=null,className:e="",disabled:r=!1,hitAreaMargins:n,id:a,onBlur:s,onClick:l,onDragging:c,onFocus:d,onPointerDown:f,onPointerUp:h,style:g={},tabIndex:v=0,tagName:y="div",...w}){var S,T;const x=b.useRef(null),_=b.useRef({onClick:l,onDragging:c,onPointerDown:f,onPointerUp:h});b.useEffect(()=>{_.current.onClick=l,_.current.onDragging=c,_.current.onPointerDown=f,_.current.onPointerUp=h});const C=b.useContext(Nh);if(C===null)throw Error("PanelResizeHandle components must be rendered within a PanelGroup container");const{direction:N,groupId:k,registerResizeHandle:A,startDragging:I,stopDragging:O,panelGroupElement:L}=C,M=fA(a),[P,W]=b.useState("inactive"),[X,ee]=b.useState(!1),[J,B]=b.useState(null),Y=b.useRef({state:P});ys(()=>{Y.current.state=P}),b.useEffect(()=>{if(r)B(null);else{const j=A(M);B(()=>j)}},[r,M,A]);const H=(S=n?.coarse)!==null&&S!==void 0?S:15,re=(T=n?.fine)!==null&&T!==void 0?T:5;b.useEffect(()=>{if(r||J==null)return;const j=x.current;vt(j,"Element ref not attached");let q=!1;return Mye(M,j,N,{coarse:H,fine:re},(G,Z,U)=>{if(!Z){W("inactive");return}switch(G){case"down":{W("drag"),q=!1,vt(U,'Expected event to be defined for "down" action'),I(M,U);const{onDragging:F,onPointerDown:te}=_.current;F?.(!0),te?.();break}case"move":{const{state:F}=Y.current;q=!0,F!=="drag"&&W("hover"),vt(U,'Expected event to be defined for "move" action'),J(U);break}case"up":{W("hover"),O();const{onClick:F,onDragging:te,onPointerUp:fe}=_.current;te?.(!1),fe?.(),q||F?.();break}}})},[H,N,r,re,A,M,J,I,O]),Xye({disabled:r,handleId:M,resizeHandler:J,panelGroupElement:L});const Q={touchAction:"none",userSelect:"none"};return b.createElement(y,{...w,children:t,className:e,id:a,onBlur:()=>{ee(!1),s?.()},onFocus:()=>{ee(!0),d?.()},ref:x,role:"separator",style:{...Q,...g},tabIndex:v,[gr.groupDirection]:N,[gr.groupId]:k,[gr.resizeHandle]:"",[gr.resizeHandleActive]:P==="drag"?"pointer":X?"keyboard":void 0,[gr.resizeHandleEnabled]:!r,[gr.resizeHandleId]:M,[gr.resizeHandleState]:P})}vV.displayName="PanelResizeHandle";function Id({className:t,...e}){return p.jsx(gV,{"data-slot":"resizable-panel-group",className:De("flex h-full w-full data-[panel-group-direction=vertical]:flex-col",t),...e})}function Fa({...t}){return p.jsx(QH,{"data-slot":"resizable-panel",...t})}function Od({withHandle:t,className:e,...r}){return p.jsx(vV,{"data-slot":"resizable-handle",className:De("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",e),...r,children:t&&p.jsx("div",{className:"bg-border z-10 flex h-4 w-3 items-center justify-center rounded-xs border",children:p.jsx(zte,{className:"size-2.5"})})})}function af({id:t,isSelected:e,isFocused:r,icon:n,title:a,description:s,metadata:l,onClick:c,className:d}){return p.jsx("button",{id:t,type:"button",onClick:c,className:De("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",e&&"bg-zinc-50 dark:bg-zinc-800 border-l-4 border-l-zinc-500",r&&"ring-2 ring-zinc-500 dark:ring-zinc-400 ring-inset",d),children:p.jsxs("div",{className:"flex items-start gap-2 sm:gap-3",children:[p.jsx("div",{className:"flex-shrink-0 mt-1",children:p.jsx("div",{className:De("p-2.5 rounded-full transition-colors",e?"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:n})}),p.jsxs("div",{className:"flex-1 min-w-0",children:[p.jsx("div",{className:"flex items-center gap-2 mb-1",children:p.jsx("h3",{className:De("font-medium truncate font-mono text-sm"),children:a})}),s&&p.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 line-clamp-2",children:s})]})]})})}function bV({className:t,...e}){return p.jsx("kbd",{"data-slot":"kbd",className:De("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",t),...e})}function yV({activeTab:t,isSearchExpanded:e,searchQuery:r,primaryTabTitle:n,secondaryTabTitle:a,primaryCount:s,secondaryCount:l,secondaryIcon:c,primaryIcon:d,searchPlaceholder:f="Search...",onSearchExpand:h,onSearchChange:g,onSearchBlur:v,onTabSwitch:y,searchInputRef:w,primaryTabName:S}){const T=t===S;return p.jsxs("div",{className:"flex flex-row items-center justify-between p-4 sm:p-4 py-3 border-r dark:border-zinc-700 gap-2",children:[p.jsx("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:e?p.jsx(Mr,{ref:w,placeholder:f,value:r,onChange:x=>g(x.target.value),onBlur:v,className:"h-8 border-gray-300 dark:border-zinc-600"}):p.jsxs(p.Fragment,{children:[p.jsx("h2",{className:"text-lg font-medium text-gray-900 dark:text-gray-100",children:T?n:a}),T&&p.jsxs(p.Fragment,{children:[p.jsx(Wa,{className:"bg-zinc-500/20 text-zinc-600 dark:text-zinc-400 border-transparent",variant:"outline",children:s}),p.jsxs(Sr,{children:[p.jsx(xr,{asChild:!0,children:p.jsx(Je,{variant:"ghost",size:"sm",onClick:h,className:"h-8 w-8 p-0",children:p.jsx(eC,{className:"h-4 w-4"})})}),p.jsxs(wr,{side:"bottom",className:"flex gap-2",children:["Search",p.jsx(bV,{children:"F"})]})]})]})]})}),p.jsxs(Je,{variant:"ghost",size:"sm",onClick:y,className:"gap-2 flex-shrink-0",children:[T?p.jsx(c,{}):p.jsx(d,{}),p.jsx("span",{className:"hidden sm:inline",children:T?a:n}),T&&l>0&&p.jsx(Wa,{className:"bg-purple-500/20 text-purple-600 dark:text-purple-400 border-transparent",variant:"outline",children:l})]})]})}function fz({prompts:t,selectedPrompt:e,onPromptSelect:r,focusedIndex:n}){return t.length===0?p.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[p.jsx(yd,{className:"h-12 w-12 text-gray-400 dark:text-gray-600 mb-3"}),p.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"No prompts available"})]}):p.jsx("div",{className:"overflow-y-auto flex-1 border-r dark:border-zinc-700 overscroll-contain",children:t.map((a,s)=>p.jsx(af,{id:`prompt-${a.name}`,isSelected:e?.name===a.name,isFocused:n===s,icon:p.jsx(yd,{className:"h-4 w-4"}),title:a.name,description:a.description,metadata:a.arguments&&a.arguments.length>0&&p.jsxs(Wa,{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:()=>r(a)},a.name))})}function pz({activeTab:t,isSearchExpanded:e,searchQuery:r,filteredPromptsCount:n,savedPromptsCount:a,onSearchExpand:s,onSearchChange:l,onSearchBlur:c,onTabSwitch:d,searchInputRef:f}){return p.jsx(yV,{activeTab:t,isSearchExpanded:e,searchQuery:r,primaryTabName:"prompts",secondaryTabName:"saved",primaryTabTitle:"Prompts",secondaryTabTitle:"History",primaryCount:n,secondaryCount:a,primaryIcon:yd,secondaryIcon:uc,searchPlaceholder:"Search prompts...",onSearchExpand:s,onSearchChange:l,onSearchBlur:c,onTabSwitch:d,searchInputRef:f})}function mz({savedPrompts:t,selectedPrompt:e,onLoadPrompt:r,onDeletePrompt:n,focusedIndex:a}){return t.length===0?p.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[p.jsx(uc,{className:"h-12 w-12 text-gray-400 dark:text-gray-600 mb-3"}),p.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"No history"}),p.jsx("p",{className:"text-sm text-gray-400 dark:text-gray-500 mt-1",children:"Prompts you execute will appear here"})]}):p.jsx("div",{className:"overflow-y-auto flex-1 border-r dark:border-zinc-700 overscroll-contain",children:t.map((s,l)=>p.jsx(af,{id:`saved-prompt-${s.id}`,isSelected:e?.id===s.id,isFocused:a===l,icon:p.jsx(uc,{className:"h-4 w-4"}),title:s.name,description:`${s.promptName} - ${new Date(s.savedAt).toLocaleString()}`,onClick:()=>r(s)},s.id))})}function Qye({selectedPrompt:t,promptArgs:e,onArgChange:r}){const n=t?.arguments||[];if(!(n.length>0))return p.jsx("div",{className:"flex items-center justify-center h-32 text-gray-500 dark:text-gray-400 text-sm",children:"No arguments required"});const s=l=>{const c=l.name,d=e[c],f=typeof d=="string"?d:JSON.stringify(d);return l.type==="boolean"?p.jsxs("div",{className:"space-y-2",children:[p.jsxs(lr,{htmlFor:c,className:"text-sm font-medium",children:[c,l.required&&p.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),p.jsxs("div",{className:"flex items-center space-x-2",children:[p.jsx("input",{id:c,type:"checkbox",checked:!!d,onChange:h=>r(c,h.target.checked),className:"rounded","aria-label":`Toggle ${c}`}),p.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400",children:l.description})]})]},c):l.type==="number"?p.jsxs("div",{className:"space-y-2",children:[p.jsxs(lr,{htmlFor:c,className:"text-sm font-medium",children:[c,l.required&&p.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),p.jsx(Mr,{id:c,type:"number",value:Number(d)||0,onChange:h=>r(c,Number(h.target.value)),placeholder:l.description||`Enter ${c}`}),l.description&&p.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:l.description})]},c):l.type==="array"||l.type==="object"?p.jsxs("div",{className:"space-y-2",children:[p.jsxs(lr,{htmlFor:c,className:"text-sm font-medium",children:[c,l.required&&p.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),p.jsx(Sh,{id:c,value:f,onChange:h=>{try{const g=JSON.parse(h.target.value);r(c,g)}catch{r(c,h.target.value)}},placeholder:l.description||`Enter ${c} as JSON`,className:"font-mono text-sm min-h-[100px]"}),l.description&&p.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:l.description})]},c):p.jsxs("div",{className:"space-y-2",children:[p.jsxs(lr,{htmlFor:c,className:"text-sm font-medium",children:[c,l.required&&p.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),p.jsx(Mr,{id:c,value:f,onChange:h=>r(c,h.target.value),placeholder:l.description||`Enter ${c}`}),l.description&&p.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:l.description})]},c)};return p.jsx("div",{className:"space-y-4",children:n.map(l=>s(l))})}function hz({selectedPrompt:t,promptArgs:e,isExecuting:r,isConnected:n,onArgChange:a,onExecute:s,onSave:l}){return t?p.jsxs("div",{className:"flex flex-col h-full",children:[p.jsx("div",{className:"flex-shrink-0 p-3 sm:p-6 pt-3 pb-4 pr-3",children:p.jsxs("div",{children:[p.jsxs("div",{className:"flex flex-row items-center justify-between mb-0 gap-2",children:[p.jsx("h3",{className:"text-base sm:text-lg font-semibold",children:t.name}),p.jsxs("div",{className:"flex gap-2 flex-shrink-0",children:[p.jsx(Je,{onClick:s,disabled:r||!n,size:"sm",className:"lg:size-default",children:r?p.jsxs(p.Fragment,{children:[p.jsx(Uo,{className:"mr-2"}),p.jsx("span",{className:"hidden sm:inline",children:"Executing..."})]}):p.jsxs(p.Fragment,{children:[p.jsx(u3,{className:"h-4 w-4 sm:mr-2"}),p.jsx("span",{className:"hidden sm:inline",children:"Execute"})]})}),p.jsxs(Je,{variant:"outline",onClick:l,disabled:r,size:"sm",className:"lg:size-default gap-2",children:[p.jsx(JR,{className:"h-4 w-4"}),p.jsx("span",{className:"hidden sm:inline",children:"Save"})]})]})]}),t.description&&p.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 leading-relaxed mt-2",children:t.description})]})}),p.jsx("div",{className:"flex-1 overflow-y-auto px-3 sm:px-6 pb-4 pr-3",children:p.jsx(Qye,{selectedPrompt:t,promptArgs:e,onArgChange:a})})]}):p.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[p.jsx("p",{className:"text-gray-500 dark:text-gray-400 mb-2",children:"Select a prompt to get started"}),p.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 gz({results:t,copiedResult:e,onCopy:r}){return p.jsx("div",{className:"flex flex-col h-full bg-white dark:bg-black border-t dark:border-zinc-700",children:p.jsx("div",{className:"flex-1 overflow-y-auto h-full",children:t.length>0?p.jsx("div",{className:"space-y-4 flex-1 h-full",children:t.map((n,a)=>p.jsxs("div",{className:"space-y-0 flex-1 h-full flex flex-col",children:[p.jsxs("div",{className:"flex items-center gap-2 px-4 pt-2 border-b border-gray-200 dark:border-zinc-600 pb-2",children:[p.jsx("h3",{className:"text-sm font-medium",children:"Response"}),p.jsxs("div",{className:"flex items-center gap-1",children:[p.jsx(uc,{className:"h-3 w-3 text-gray-400"}),p.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:new Date(n.timestamp).toLocaleTimeString()})]}),n.duration!==void 0&&p.jsxs("div",{className:"flex items-center gap-1",children:[p.jsx(Ed,{className:"h-3 w-3 text-gray-400"}),p.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:[n.duration,"ms"]})]}),p.jsx("div",{className:"flex gap-2 ml-auto",children:p.jsx(Je,{variant:"ghost",size:"sm",onClick:()=>r(a,n.result),className:"h-6 px-2",children:e===a?p.jsx(Mo,{className:"h-4 w-4"}):p.jsx($n,{className:"h-4 w-4"})})})]}),n.error?p.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:[p.jsx("p",{className:"text-red-800 dark:text-red-300 font-medium",children:"Error:"}),p.jsx("p",{className:"text-red-700 dark:text-red-400 text-sm",children:n.error})]}):p.jsx("div",{className:"px-4 pt-4",children:p.jsx(Ua,{data:n.result,filename:`prompt-result-${n.promptName}-${Date.now()}.json`})})]},a))}):p.jsx("div",{className:"flex items-center justify-center h-full",children:p.jsx("div",{className:"text-center",children:p.jsx(VR,{vertical:!0,noBorder:!0,message:"No Results yet"})})})})})}const vz="mcp-inspector-saved-prompts";function EV({ref:t,prompts:e,callPrompt:r,serverId:n,isConnected:a}){const[s,l]=b.useState(null),[c,d]=b.useState(null),{selectedPromptName:f,setSelectedPromptName:h}=tf(),[g,v]=b.useState({}),[y,w]=b.useState([]),[S,T]=b.useState(!1),[x,_]=b.useState(null),[C,N]=b.useState(""),[k,A]=b.useState("prompts"),[I,O]=b.useState([]),[L,M]=b.useState(!1),[P,W]=b.useState(""),[X,ee]=b.useState(!1),[J,B]=b.useState(-1),Y=b.useRef(null),[H,re]=b.useState(!1),[Q,j]=b.useState("list");b.useEffect(()=>{const le=()=>{re(window.innerWidth<1024)};return le(),window.addEventListener("resize",le),()=>window.removeEventListener("resize",le)},[]),b.useEffect(()=>{j(s?"detail":"list")},[s]),b.useEffect(()=>{H&&y.length>0&&!S&&j("response")},[y,S,H]),b.useImperativeHandle(t,()=>({focusSearch:()=>{ee(!0),setTimeout(()=>{Y.current&&Y.current.focus()},0)},blurSearch:()=>{N(""),ee(!1),Y.current&&Y.current.blur()}})),b.useEffect(()=>{try{const le=localStorage.getItem(vz);if(le){const pe=JSON.parse(le);O(pe)}}catch(le){console.error("[PromptsTab] Failed to load saved prompts:",le)}},[]);const q=b.useCallback(le=>{try{localStorage.setItem(vz,JSON.stringify(le))}catch(pe){console.error("[PromptsTab] Failed to save prompts:",pe)}},[]);b.useEffect(()=>{X&&Y.current&&Y.current.focus()},[X]);const z=b.useCallback(()=>{C.trim()||ee(!1)},[C]),G=b.useMemo(()=>{if(!C.trim())return e;const le=C.toLowerCase();return e.filter(pe=>pe.name.toLowerCase().includes(le)||pe.description?.toLowerCase().includes(le))},[e,C]),Z=b.useCallback(le=>{l(le);const pe={};le.arguments&&le.arguments.forEach(Re=>{Re.default!==void 0?pe[Re.name]=Re.default:Re.type==="string"?pe[Re.name]="":Re.type==="number"?pe[Re.name]=0:Re.type==="boolean"?pe[Re.name]=!1:Re.type==="array"?pe[Re.name]=[]:Re.type==="object"&&(pe[Re.name]={})}),v(pe)},[]),U=b.useCallback(le=>{const pe=e.find(Re=>Re.name===le.promptName);pe&&(l(pe),v(le.args),d(le))},[e]);b.useEffect(()=>{B(-1)},[C,k]),b.useEffect(()=>{const le=pe=>{const Re=pe.target;if(Re.tagName==="INPUT"||Re.tagName==="TEXTAREA"||Re.contentEditable==="true"||pe.metaKey||pe.ctrlKey||pe.altKey)return;const je=k==="prompts"?G:I;if(pe.key==="ArrowDown")pe.preventDefault(),B(ze=>{const _e=ze+1;return _e>=je.length?0:_e});else if(pe.key==="ArrowUp")pe.preventDefault(),B(ze=>{const _e=ze-1;return _e<0?je.length-1:_e});else if(pe.key==="Enter"&&J>=0)if(pe.preventDefault(),k==="prompts"){const ze=G[J];ze&&Z(ze)}else{const ze=I[J];ze&&U(ze)}};return document.addEventListener("keydown",le),()=>document.removeEventListener("keydown",le)},[J,G,I,k,Z,U]),b.useEffect(()=>{if(J>=0){const le=k==="prompts"?`prompt-${G[J]?.name}`:`saved-prompt-${I[J]?.id}`,pe=document.getElementById(le);pe&&pe.scrollIntoView({behavior:"smooth",block:"nearest"})}},[J,G,I,k]),b.useEffect(()=>{if(console.warn("[PromptsTab] Auto-selection effect triggered:",{selectedPromptName:f,promptsCount:e.length,currentSelectedPrompt:s?.name}),f&&e.length>0){const le=e.find(pe=>pe.name===f);if(console.warn("[PromptsTab] Prompt lookup result:",{selectedPromptName:f,promptFound:!!le,promptName:le?.name,shouldSelect:le&&s?.name!==le.name}),le&&s?.name!==le.name){console.warn("[PromptsTab] Selecting prompt:",le.name),h(null);const pe=setTimeout(()=>{Z(le);const Re=document.getElementById(`prompt-${le.name}`);Re&&(console.warn("[PromptsTab] Scrolling to prompt element"),Re.scrollIntoView({behavior:"smooth",block:"nearest"}))},100);return()=>clearTimeout(pe)}}},[f,e,s,Z,h]);const F=b.useCallback((le,pe)=>{v(Re=>({...Re,[le]:pe}))},[]),te=b.useCallback(async()=>{if(!s||S)return;T(!0);const le=Date.now();try{const pe=await r(s.name,g),Re=Date.now()-le;zr.getInstance().capture(new lD({promptName:s.name,serverId:n,success:!0})).catch(()=>{}),w(je=>[{promptName:s.name,args:g,result:pe,timestamp:le,duration:Re},...je])}catch(pe){zr.getInstance().capture(new lD({promptName:s.name,serverId:n,success:!1,error:pe instanceof Error?pe.message:"Unknown error"})).catch(()=>{});const Ke={promptName:s.name,args:g,result:null,error:pe instanceof Error?pe.message:String(pe),timestamp:le,duration:Date.now()-le};w(je=>[Ke,...je])}finally{T(!1)}},[s,g,S,r,n]),fe=b.useCallback(async(le,pe)=>{try{await navigator.clipboard.writeText(JSON.stringify(pe,null,2)),_(le),setTimeout(()=>_(null),2e3)}catch(Re){console.error("[PromptsTab] Failed to copy result:",Re)}},[]),V=b.useCallback(()=>{s&&(W(""),M(!0))},[s]),de=b.useCallback(le=>{q(I.filter(pe=>pe.id!==le)),c?.id===le&&d(null)},[I,q,c]);return H?p.jsxs("div",{className:"h-full flex flex-col overflow-hidden relative bg-background",children:[Q!=="list"&&p.jsxs("div",{className:"flex items-center gap-2 p-2 border-b shrink-0 bg-background z-10",children:[p.jsx(Je,{variant:"ghost",size:"sm",onClick:()=>{Q==="response"?j("detail"):(l(null),j("list"))},className:"p-0 h-8 w-8",children:p.jsx(XR,{className:"h-4 w-4"})}),p.jsxs("div",{className:"flex items-center text-sm font-medium",children:[p.jsx("button",{onClick:()=>{l(null),j("list")},className:"text-muted-foreground hover:text-foreground hover:underline cursor-pointer",children:"Prompts"}),Q!=="list"&&p.jsxs(p.Fragment,{children:[p.jsx("span",{className:"mx-2 text-muted-foreground",children:"/"}),p.jsx("button",{onClick:()=>{Q==="response"&&j("detail")},className:Q==="detail"?"text-foreground hover:underline":Q==="response"?"text-muted-foreground hover:text-foreground hover:underline cursor-pointer":"text-muted-foreground",children:"Execute"})]}),Q==="response"&&p.jsxs(p.Fragment,{children:[p.jsx("span",{className:"mx-2 text-muted-foreground",children:"/"}),p.jsx("span",{className:"text-foreground",children:"Response"})]})]})]}),p.jsx("div",{className:"flex-1 relative overflow-hidden",children:p.jsxs(gh,{initial:!1,mode:"popLayout",children:[Q==="list"&&p.jsxs(_n.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:[p.jsx(pz,{activeTab:k,isSearchExpanded:X,searchQuery:C,filteredPromptsCount:G.length,savedPromptsCount:I.length,onSearchExpand:()=>ee(!0),onSearchChange:N,onSearchBlur:z,onTabSwitch:()=>A(k==="prompts"?"saved":"prompts"),searchInputRef:Y}),k==="prompts"?p.jsx(fz,{prompts:G,selectedPrompt:s,onPromptSelect:Z,focusedIndex:J}):p.jsx(mz,{savedPrompts:I,selectedPrompt:c,onLoadPrompt:U,onDeletePrompt:de,focusedIndex:J})]},"list"),Q==="detail"&&p.jsx(_n.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:p.jsx(hz,{selectedPrompt:s,promptArgs:g,isExecuting:S,isConnected:a,onArgChange:F,onExecute:te,onSave:V})},"detail"),Q==="response"&&p.jsx(_n.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:p.jsx(gz,{results:y,copiedResult:x,onCopy:fe})},"response")]})})]}):p.jsxs(Id,{direction:"horizontal",className:"h-full",children:[p.jsxs(Fa,{defaultSize:33,className:"flex flex-col h-full relative",children:[p.jsx(pz,{activeTab:k,isSearchExpanded:X,searchQuery:C,filteredPromptsCount:G.length,savedPromptsCount:I.length,onSearchExpand:()=>ee(!0),onSearchChange:N,onSearchBlur:z,onTabSwitch:()=>A(k==="prompts"?"saved":"prompts"),searchInputRef:Y}),k==="prompts"?p.jsx(fz,{prompts:G,selectedPrompt:s,onPromptSelect:Z,focusedIndex:J}):p.jsx(mz,{savedPrompts:I,selectedPrompt:c,onLoadPrompt:U,onDeletePrompt:de,focusedIndex:J})]}),p.jsx(Od,{withHandle:!0}),p.jsx(Fa,{defaultSize:67,children:p.jsxs(Id,{direction:"vertical",children:[p.jsx(Fa,{defaultSize:40,children:p.jsx(hz,{selectedPrompt:s,promptArgs:g,isExecuting:S,isConnected:a,onArgChange:F,onExecute:te,onSave:V})}),p.jsx(Od,{withHandle:!0}),p.jsx(Fa,{defaultSize:60,children:p.jsx("div",{className:"flex flex-col h-full",children:p.jsx(gz,{results:y,copiedResult:x,onCopy:fe})})})]})})]})}EV.displayName="PromptsTab";function Wl(t){if(!t?.mimeType)return!1;const e=t.mimeType.toLowerCase();return e==="text/html"||e==="text/html+skybridge"||e==="text/uri-list"||e.startsWith("application/vnd.mcp-ui.remote-dom")}function Jye(t){return{uri:t.uri,mimeType:t.mimeType,text:t.text,blob:t.blob}}function SV({resource:t,onUIAction:e,className:r}){const n=async s=>e?.(s),a=Jye(t);return p.jsx("div",{className:r,children:p.jsx(uA,{resource:a,onUIAction:n,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:[mye,pye,hye,gye],library:cA}})})}function bz({result:t,isLoading:e,previewMode:r,serverId:n,readResource:a,onTogglePreview:s,onCopy:l,onDownload:c,onFullscreen:d,isCopied:f=!1}){let h=[],g;if(t?.resourceAnnotations&&(h=Object.keys(t.resourceAnnotations).filter(S=>S.startsWith("openai/")),g=t.resourceAnnotations["openai/outputTemplate"]),t?.result?.contents?.[0]?._meta){const S=t.result.contents[0]._meta,T=Object.keys(S).filter(x=>x.startsWith("openai/"));T.length>0&&(h=[...h,...T]),!g&&S["openai/outputTemplate"]&&(g=S["openai/outputTemplate"]),!g&&t.uri&&t.uri.startsWith("ui://widget/")&&(g=t.uri)}const v=!!(h.length>0&&g&&typeof g=="string"&&n&&a);if(e)return p.jsx("div",{className:"flex absolute left-0 top-0 items-center justify-center w-full h-full",children:p.jsx(Uo,{className:"size-5"})});if(!t)return p.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[p.jsx("p",{className:"text-gray-500 dark:text-gray-400 mb-2",children:"Select a resource to view its contents"}),p.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500",children:"Choose a resource from the list to see its data"})]});if(t.error)return p.jsx("div",{className:"p-4",children:p.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded p-3",children:[p.jsx("p",{className:"text-red-800 dark:text-red-300 font-medium",children:"Error:"}),p.jsx("p",{className:"text-red-700 dark:text-red-400 text-sm",children:t.error})]})});const y=t?.result?.contents&&Array.isArray(t.result.contents)&&t.result.contents.some(S=>S.mimeType&&Wl(S)),w=y?t.result.contents.filter(S=>S.mimeType&&Wl(S)):[];return p.jsxs("div",{className:"flex flex-col h-full",children:[p.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:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsxs("div",{className:"flex items-center gap-1",children:[p.jsx(uc,{className:"h-3 w-3 text-gray-400"}),p.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:new Date(t.timestamp).toLocaleTimeString()})]}),(()=>{const S=t?.duration??t.result?.duration??t.result?.metrics?.durationMs;return S!==void 0?p.jsxs("div",{className:"flex items-center gap-1",children:[p.jsx(Ed,{className:"h-3 w-3 text-gray-400"}),p.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:[S,"ms"]})]}):null})(),y&&p.jsx(Wa,{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&&p.jsx(Wa,{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"})]}),p.jsxs("div",{className:"flex items-center gap-1",children:[(y||v)&&p.jsxs(Je,{variant:"ghost",size:"sm",onClick:s,className:r?"":"text-purple-600 dark:text-purple-400",children:[r?p.jsx(mte,{className:"h-4 w-4 mr-1"}):p.jsx(ote,{className:"h-4 w-4 mr-1"}),r?"JSON":v?"Component":"Preview"]}),p.jsx(Je,{variant:"ghost",size:"sm",onClick:l,children:f?p.jsx(Mo,{className:"h-4 w-4"}):p.jsx($n,{className:"h-4 w-4"})}),p.jsx(Je,{variant:"ghost",size:"sm",onClick:c,children:p.jsx(s3,{className:"h-4 w-4"})}),p.jsx(Je,{variant:"ghost",size:"sm",onClick:d,children:p.jsx(Vte,{className:"h-4 w-4"})})]})]}),p.jsx("div",{className:"flex-1 overflow-y-auto",children:v&&n&&a&&g?r?p.jsx("div",{className:"flex-1 h-full",children:p.jsx(aA,{componentUrl:g,toolName:t.uri,toolArgs:{},toolResult:t.result,serverId:n,readResource:a,className:"w-full h-full relative flex p-4"})}):p.jsx("div",{className:"px-4 pt-4",children:p.jsx(Ua,{data:t.result,filename:`resource-${t.uri.replace(/[^a-zA-Z0-9]/g,"-")}-${Date.now()}.json`})}):y?r?p.jsxs("div",{className:"space-y-0 h-full",children:[w.map((S,T)=>p.jsx("div",{className:"mx-0 size-full",children:p.jsx("div",{className:"w-full h-full",children:p.jsx(SV,{resource:S,className:"w-full h-full"})})},`mcp-ui-${S.uri||`resource-${Date.now()}-${Math.random()}`}`)),(()=>{if(t.result.contents&&Array.isArray(t.result.contents)){const S=t.result.contents.filter(T=>!(T.mimeType&&Wl(T)));if(S.length>0)return p.jsx("div",{className:"px-4",children:p.jsx(Ua,{data:S,filename:`resource-${t.uri.replace(/[^a-zA-Z0-9]/g,"-")}-non-ui-${Date.now()}.json`})})}return null})()]}):p.jsx("div",{className:"px-4 pt-4",children:p.jsx(Ua,{data:t.result,filename:`resource-${t.uri.replace(/[^a-zA-Z0-9]/g,"-")}-mcp-ui-${Date.now()}.json`})}):p.jsx("div",{className:"px-4 pt-4",children:p.jsx(Ua,{data:t.result,filename:`resource-${t.uri.replace(/[^a-zA-Z0-9]/g,"-")}-${Date.now()}.json`})})})]})}function eEe(t,e){if(!t&&!e)return p.jsx(Lte,{className:"h-5 w-5"});const r=(t||e||"").toLowerCase();return r.includes("image")?p.jsx(Ite,{className:"h-5 w-5"}):r.includes("json")||r.includes("javascript")||r.includes("typescript")?p.jsx(Nte,{className:"h-5 w-5"}):r.includes("html")||r.includes("xml")?p.jsx(Ute,{className:"h-5 w-5"}):r.includes("database")||r.includes("sql")?p.jsx(uh,{className:"h-5 w-5"}):p.jsx(QR,{className:"h-5 w-5"})}function yz({resources:t,selectedResource:e,onResourceSelect:r,focusedIndex:n}){return t.length===0?p.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[p.jsx(uh,{className:"h-12 w-12 text-gray-400 dark:text-gray-600 mb-3"}),p.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"No resources available"})]}):p.jsx("div",{className:"overflow-y-auto flex-1 border-r dark:border-zinc-700 overscroll-contain",children:t.map((a,s)=>{const l=eEe(a.mimeType,a.uri),c=[a.description,a.mimeType&&p.jsx("span",{className:"font-mono",children:a.mimeType},"mime")].filter(Boolean);return p.jsx(af,{id:`resource-${a.uri}`,isSelected:e?.uri===a.uri,isFocused:n===s,icon:l,title:a.name,description:c.length>0?p.jsxs("span",{className:"flex flex-col gap-1",children:[a.description&&p.jsx("span",{children:a.description}),a.mimeType&&p.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-500 font-mono",children:a.mimeType})]}):void 0,onClick:()=>r(a)},a.uri)})})}function Ez({isSearchExpanded:t,searchQuery:e,filteredResourcesCount:r,onSearchExpand:n,onSearchChange:a,onSearchBlur:s,searchInputRef:l}){return p.jsx("div",{className:"flex items-center justify-between p-4 py-3 border-r dark:border-zinc-700",children:p.jsx("div",{className:"flex items-center gap-2 flex-1",children:t?p.jsx(Mr,{ref:l,placeholder:"Search resources...",value:e,onChange:c=>a(c.target.value),onBlur:s,className:"h-8 border-gray-300 dark:border-zinc-600"}):p.jsxs(p.Fragment,{children:[p.jsx("h2",{className:"text-lg font-medium text-gray-900 dark:text-gray-100",children:"Resources"}),p.jsx(Wa,{className:"bg-zinc-500/20 text-zinc-600 dark:text-zinc-400 border-transparent",variant:"outline",children:r}),p.jsxs(Sr,{children:[p.jsx(xr,{asChild:!0,children:p.jsx(Je,{variant:"ghost",size:"sm",onClick:n,className:"h-8 w-8 p-0",children:p.jsx(eC,{className:"h-4 w-4"})})}),p.jsxs(wr,{side:"bottom",className:"flex gap-2",children:["Search",p.jsx(bV,{children:"F"})]})]})]})})})}function xV({ref:t,resources:e,readResource:r,serverId:n,isConnected:a}){const[s,l]=b.useState(null),{selectedResourceUri:c,setSelectedResourceUri:d}=tf(),[f,h]=b.useState(null),[g,v]=b.useState(!1),[y,w]=b.useState(""),[S]=b.useState("resources"),[T,x]=b.useState(!0),[_,C]=b.useState(!1),[N,k]=b.useState(-1),[A,I]=b.useState(!1),O=b.useRef(null),L=b.useRef(null),[M,P]=b.useState(!1),[W,X]=b.useState("list");b.useEffect(()=>{const Q=()=>{P(window.innerWidth<1024)};return Q(),window.addEventListener("resize",Q),()=>window.removeEventListener("resize",Q)},[]),b.useEffect(()=>{X(s?"detail":"list")},[s]),b.useImperativeHandle(t,()=>({focusSearch:()=>{C(!0),setTimeout(()=>{O.current&&O.current.focus()},0)},blurSearch:()=>{w(""),C(!1),O.current&&O.current.blur()}})),b.useEffect(()=>{_&&O.current&&O.current.focus()},[_]);const ee=b.useCallback(()=>{y.trim()||C(!1)},[y]),J=b.useMemo(()=>{if(!y)return e;const Q=y.toLowerCase();return e.filter(j=>j.name.toLowerCase().includes(Q)||j.description?.toLowerCase().includes(Q)||j.uri.toLowerCase().includes(Q))},[e,y]),B=b.useCallback(async Q=>{if(l(Q),a){v(!0);const j=Date.now();try{const q=await r(Q.uri);zr.getInstance().capture(new sD({resourceUri:Q.uri,serverId:n,success:!0})).catch(()=>{}),h({uri:Q.uri,result:q,timestamp:j,resourceAnnotations:Q.annotations})}catch(q){zr.getInstance().capture(new sD({resourceUri:Q.uri,serverId:n,success:!1,error:q instanceof Error?q.message:"Unknown error"})).catch(()=>{}),h({uri:Q.uri,result:null,error:q instanceof Error?q.message:"Unknown error",timestamp:j,resourceAnnotations:Q.annotations})}finally{v(!1)}}},[r,n,a]);b.useEffect(()=>{k(-1)},[y,S]),b.useEffect(()=>{const Q=j=>{const q=j.target;if(q.tagName==="INPUT"||q.tagName==="TEXTAREA"||q.contentEditable==="true"||j.metaKey||j.ctrlKey||j.altKey)return;const G=J;if(j.key==="ArrowDown")j.preventDefault(),k(Z=>{const U=Z+1;return U>=G.length?0:U});else if(j.key==="ArrowUp")j.preventDefault(),k(Z=>{const U=Z-1;return U<0?G.length-1:U});else if(j.key==="Enter"&&N>=0){j.preventDefault();const Z=J[N];Z&&B(Z)}};return document.addEventListener("keydown",Q),()=>document.removeEventListener("keydown",Q)},[N,J,B]),b.useEffect(()=>{if(N>=0){const Q=`resource-${J[N]?.uri}`,j=document.getElementById(Q);j&&j.scrollIntoView({behavior:"smooth",block:"nearest"})}},[N,J]),b.useEffect(()=>{if(c&&e.length>0){const Q=e.find(j=>j.uri===c);Q&&s?.uri!==Q.uri&&(d(null),setTimeout(()=>{B(Q);const j=document.getElementById(`resource-${Q.uri}`);j&&j.scrollIntoView({behavior:"smooth",block:"nearest"})},100))}},[c,e,s,B,d]);const Y=b.useCallback(async()=>{if(f)try{await navigator.clipboard.writeText(JSON.stringify(f.result,null,2)),I(!0),setTimeout(()=>I(!1),2e3)}catch(Q){console.error("[ResourcesTab] Failed to copy result:",Q)}},[f]),H=b.useCallback(()=>{if(f)try{const Q=new globalThis.Blob([JSON.stringify(f.result,null,2)],{type:"application/json"}),j=URL.createObjectURL(Q),q=document.createElement("a");q.href=j,q.download=`resource-${Date.now()}.json`,document.body.appendChild(q),q.click(),document.body.removeChild(q),URL.revokeObjectURL(j)}catch(Q){console.error("[ResourcesTab] Failed to download result:",Q)}},[f]),re=b.useCallback(async()=>{if(L.current)try{document.fullscreenElement?await document.exitFullscreen():await L.current.requestFullscreen()}catch(Q){console.error("[ResourcesTab] Failed to toggle fullscreen:",Q)}},[]);return M?p.jsxs("div",{className:"h-full flex flex-col overflow-hidden relative bg-background",children:[W!=="list"&&p.jsxs("div",{className:"flex items-center gap-2 p-2 border-b shrink-0 bg-background z-10",children:[p.jsx(Je,{variant:"ghost",size:"sm",onClick:()=>{l(null),X("list")},className:"p-0 h-8 w-8",children:p.jsx(XR,{className:"h-4 w-4"})}),p.jsxs("div",{className:"flex items-center text-sm font-medium",children:[p.jsx("button",{onClick:()=>{l(null),X("list")},className:"text-muted-foreground hover:text-foreground hover:underline cursor-pointer",children:"Resources"}),W==="detail"&&p.jsxs(p.Fragment,{children:[p.jsx("span",{className:"mx-2 text-muted-foreground",children:"/"}),p.jsx("span",{className:"text-foreground",children:"Content"})]})]})]}),p.jsx("div",{className:"flex-1 relative overflow-hidden",children:p.jsxs(gh,{initial:!1,mode:"popLayout",children:[W==="list"&&p.jsxs(_n.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:[p.jsx(Ez,{activeTab:S,isSearchExpanded:_,searchQuery:y,filteredResourcesCount:J.length,onSearchExpand:()=>C(!0),onSearchChange:w,onSearchBlur:ee,onTabSwitch:()=>{},searchInputRef:O}),p.jsx("div",{className:"flex flex-col h-full",children:p.jsx(yz,{resources:J,selectedResource:s,onResourceSelect:B,focusedIndex:N})})]},"list"),W==="detail"&&p.jsx(_n.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:p.jsx("div",{ref:L,className:"h-full",children:p.jsx(bz,{result:f,isLoading:g,previewMode:T,serverId:n,readResource:r,onTogglePreview:()=>x(!T),onCopy:Y,onDownload:H,onFullscreen:re,isCopied:A})})},"detail")]})})]}):p.jsxs(Id,{direction:"horizontal",className:"h-full",children:[p.jsxs(Fa,{defaultSize:25,children:[p.jsx(Ez,{activeTab:S,isSearchExpanded:_,searchQuery:y,filteredResourcesCount:J.length,onSearchExpand:()=>C(!0),onSearchChange:w,onSearchBlur:ee,onTabSwitch:()=>{},searchInputRef:O}),p.jsx("div",{className:"flex flex-col h-full",children:p.jsx(yz,{resources:J,selectedResource:s,onResourceSelect:B,focusedIndex:N})})]}),p.jsx(Od,{}),p.jsx(Fa,{defaultSize:50,children:p.jsx("div",{ref:L,className:"h-full bg-white dark:bg-zinc-900",children:p.jsx(bz,{result:f,isLoading:g,previewMode:T,serverId:n,readResource:r,onTogglePreview:()=>x(!T),onCopy:Y,onDownload:H,onFullscreen:re,isCopied:A})})})]})}xV.displayName="ResourcesTab";function Sz({savedRequests:t,selectedRequest:e,onLoadRequest:r,onDeleteRequest:n,focusedIndex:a}){if(t.length===0)return p.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[p.jsx(uh,{className:"h-12 w-12 text-gray-400 dark:text-gray-600 mb-3"}),p.jsx("p",{className:"text-gray-500 dark:text-gray-400 mb-2",children:"No saved requests yet"}),p.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500",children:"Execute a tool and click Save to store requests"})]});const s=(l,c)=>{l.stopPropagation(),c()};return p.jsx("div",{className:"overflow-y-auto flex-1 border-r dark:border-zinc-700 overscroll-contain",children:t.map((l,c)=>p.jsxs("div",{className:"relative group",children:[p.jsx(af,{id:`saved-${l.id}`,isSelected:e?.id===l.id,isFocused:a===c,icon:p.jsx(l3,{className:"h-4 w-4"}),title:l.name,description:l.toolName,metadata:p.jsx("div",{className:"flex flex-col gap-1",children:p.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500",children:new Date(l.savedAt).toLocaleString()})}),onClick:()=>r(l)}),p.jsx("div",{className:"absolute top-1/2 right-2 -translate-y-1/2 opacity-0 group-hover:opacity-100 transition-opacity z-10",children:p.jsxs(Sr,{children:[p.jsx(xr,{asChild:!0,children:p.jsx(Je,{variant:"secondary",size:"sm",onClick:d=>s(d,()=>n(l.id)),className:"h-8 w-8 p-0",children:p.jsx(fT,{className:"h-4 w-4"})})}),p.jsx(wr,{children:p.jsx("p",{children:"Delete saved request"})})]})})]},l.id))})}function xz({isOpen:t,requestName:e,defaultPlaceholder:r,onRequestNameChange:n,onSave:a,onCancel:s}){return t?p.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",onClick:s,children:p.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:l=>l.stopPropagation(),children:[p.jsx("h3",{className:"text-lg font-semibold mb-4 text-gray-900 dark:text-gray-100",children:"Save Request"}),p.jsxs("div",{className:"space-y-4",children:[p.jsxs("div",{children:[p.jsx(lr,{htmlFor:"request-name",children:"Request Name (optional)"}),p.jsx(Mr,{id:"request-name",value:e,onChange:l=>n(l.target.value),placeholder:r,className:"mt-2",onKeyDown:l=>{l.key==="Enter"&&a()},autoFocus:!0})]}),p.jsxs("div",{className:"flex justify-end gap-2",children:[p.jsx(Je,{variant:"outline",onClick:s,children:"Cancel"}),p.jsxs(Je,{onClick:a,children:[p.jsx(JR,{className:"h-4 w-4 mr-2"}),"Save"]})]})]})]})}):null}function tEe({selectedTool:t,toolArgs:e,onArgChange:r}){const n=t?.inputSchema?.properties||{},a=t?.inputSchema?.required||[];return Object.keys(n).length>0?p.jsx("div",{className:"space-y-4",children:Object.entries(n).map(([l,c])=>{const d=c;d.required=a.includes(l);const f=e[l];let h="";return f!=null&&(typeof f=="string"?h=f:typeof f=="object"&&f!==null?h=JSON.stringify(f,null,2):h=String(f)),d.type==="object"||d.type==="array"?p.jsxs("div",{className:"space-y-2",children:[p.jsxs(lr,{htmlFor:l,className:"text-sm font-medium",children:[l,d?.required&&p.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),p.jsx(Sh,{id:l,value:h,onChange:v=>r(l,v.target.value),placeholder:d?.description||`Enter ${l}`,className:"min-h-[100px]"}),d?.description&&p.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:d.description})]},l):p.jsxs("div",{className:"space-y-2",children:[p.jsxs(lr,{htmlFor:l,className:"text-sm font-medium",children:[l,d?.required&&p.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),p.jsx(Mr,{id:l,value:h,onChange:v=>r(l,v.target.value),placeholder:d?.description||`Enter ${l}`}),d?.description&&p.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:d.description})]},l)})}):p.jsx("div",{className:"flex items-center justify-center h-32 text-gray-500 dark:text-gray-400 text-sm",children:"No parameters required"})}function wz({selectedTool:t,toolArgs:e,isExecuting:r,isConnected:n,onArgChange:a,onExecute:s,onSave:l}){return t?p.jsxs("div",{className:"flex flex-col h-full",children:[p.jsx("div",{className:"flex-shrink-0 p-3 sm:p-6 pt-3 pb-4 pr-3",children:p.jsxs("div",{children:[p.jsxs("div",{className:"flex flex-row items-center justify-between mb-0 gap-2",children:[p.jsx("h3",{className:"text-base sm:text-lg font-semibold",children:t.name}),p.jsxs("div",{className:"flex gap-2 flex-shrink-0",children:[p.jsx(Je,{onClick:s,disabled:r||!n,size:"sm",className:"lg:size-default",children:r?p.jsxs(p.Fragment,{children:[p.jsx(Uo,{className:"mr-2"}),p.jsx("span",{className:"hidden sm:inline",children:"Executing..."})]}):p.jsxs(p.Fragment,{children:[p.jsx(u3,{className:"h-4 w-4 sm:mr-2"}),p.jsx("span",{className:"hidden sm:inline",children:"Execute"})]})}),p.jsxs(Je,{variant:"outline",onClick:l,disabled:r,size:"sm",className:"lg:size-default gap-2",children:[p.jsx(JR,{className:"h-4 w-4"}),p.jsx("span",{className:"hidden sm:inline",children:"Save"})]})]})]}),t.description&&p.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 leading-relaxed mt-2",children:t.description})]})}),p.jsx("div",{className:"flex-1 overflow-y-auto px-3 sm:px-6 pb-4 pr-3",children:p.jsx(tEe,{selectedTool:t,toolArgs:e,onArgChange:a})})]}):p.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[p.jsx("p",{className:"text-gray-500 dark:text-gray-400 mb-2",children:"Select a tool to get started"}),p.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 _z({results:t,copiedResult:e,previewMode:r,serverId:n,readResource:a,onCopy:s,onTogglePreview:l}){return p.jsx("div",{className:"flex flex-col h-full bg-white dark:bg-black border-t dark:border-zinc-700",children:p.jsx("div",{className:"flex-1 overflow-y-auto h-full",children:t.length>0?p.jsx("div",{className:"space-y-4 flex-1 h-full",children:t.map((c,d)=>{const f=c.toolMeta?.["openai/outputTemplate"],h=!!(f&&typeof f=="string"&&c.appsSdkResource),g=f,v=c.result?.content||[],y=v.filter(S=>S.type==="resource"&&Wl(S.resource)),w=y.length>0;return p.jsxs("div",{className:"space-y-0 flex-1 h-full flex flex-col",children:[p.jsxs("div",{className:`flex items-center gap-2 px-4 pt-2 ${w||h?"border-b border-gray-200 dark:border-zinc-600 pb-2":""}`,children:[p.jsx("h3",{className:"text-sm font-medium hidden sm:block",children:"Response"}),p.jsxs("div",{className:"hidden sm:flex items-center gap-1",children:[p.jsx(uc,{className:"h-3 w-3 text-gray-400"}),p.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:new Date(c.timestamp).toLocaleTimeString()})]}),c.duration!==void 0&&p.jsxs("div",{className:"hidden sm:flex items-center gap-1",children:[p.jsx(Ed,{className:"h-3 w-3 text-gray-400"}),p.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:[c.duration,"ms"]})]}),h&&p.jsxs("div",{className:"flex items-center gap-4 sm:ml-4",children:[p.jsxs("span",{className:"hidden sm:inline text-xs text-gray-500 dark:text-gray-400",children:["URI: ",g||"No URI"]}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("button",{onClick:()=>l(),className:`text-xs font-medium ${r?"text-black dark:text-white":"text-zinc-500 dark:text-zinc-400"}`,children:"Component"}),p.jsx("span",{className:"text-xs text-zinc-400",children:"|"}),p.jsx("button",{onClick:()=>l(),className:`text-xs font-medium ${r?"text-zinc-500 dark:text-zinc-400":"text-black dark:text-white"}`,children:"Raw JSON"})]})]}),w&&!h&&p.jsxs("div",{className:"flex items-center gap-4 sm:ml-4",children:[p.jsxs("span",{className:"hidden sm:inline text-xs text-gray-500 dark:text-gray-400",children:["URI: ",y[0]?.resource?.uri||"No URI"]}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("button",{onClick:()=>l(),className:`text-xs font-medium ${r?"text-black dark:text-white":"text-zinc-500 dark:text-zinc-400"}`,children:"Preview"}),p.jsx("span",{className:"text-xs text-zinc-400",children:"|"}),p.jsx("button",{onClick:()=>l(),className:`text-xs font-medium ${r?"text-zinc-500 dark:text-zinc-400":"text-black dark:text-white"}`,children:"JSON"})]})]}),p.jsx(Je,{variant:"ghost",size:"sm",onClick:()=>s(d,c.result),className:"ml-auto",children:e===d?p.jsx(Mo,{className:"h-4 w-4"}):p.jsx($n,{className:"h-4 w-4"})})]}),c.error?p.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:[p.jsx("p",{className:"text-red-800 dark:text-red-300 font-medium",children:"Error:"}),p.jsx("p",{className:"text-red-700 dark:text-red-400 text-sm",children:c.error})]}):(()=>{if(h){const S=c.appsSdkResource;return S.isLoading?p.jsx(p.Fragment,{}):S.error?p.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:[p.jsx("p",{className:"text-red-800 dark:text-red-300 font-medium",children:"Resource Error:"}),p.jsx("p",{className:"text-red-700 dark:text-red-400 text-sm",children:S.error})]}):r?p.jsx("div",{className:"flex-1",children:p.jsx(aA,{componentUrl:g,toolName:c.toolName,toolArgs:c.args,toolResult:c.result,resource:S.resourceData,serverId:n,readResource:a,className:"w-full h-full relative p-4"})}):p.jsx("div",{className:"px-4 pt-4",children:p.jsx(Ua,{data:c.result,filename:`tool-result-${c.toolName}-${Date.now()}.json`})})}return w?r?p.jsxs("div",{className:"space-y-0 h-full",children:[y.map((S,T)=>p.jsx("div",{className:"mx-0 size-full",children:p.jsx(SV,{resource:S.resource,onUIAction:x=>{},className:"w-full h-full relative"})},T)),v.filter(S=>!(S.type==="resource"&&Wl(S.resource))).length>0&&p.jsx("div",{className:"px-4",children:p.jsx(Ua,{data:v.filter(S=>!(S.type==="resource"&&Wl(S.resource))),filename:`tool-result-${c.toolName}-non-ui-${Date.now()}.json`})})]}):p.jsx("div",{className:"px-4 pt-4",children:p.jsx(Ua,{data:c.result,filename:`tool-result-${c.toolName}-mcp-ui-${Date.now()}.json`})}):p.jsx("div",{className:"px-4 pt-4",children:p.jsx(Ua,{data:c.result,filename:`tool-result-${c.toolName}-${Date.now()}.json`})})})()]},d)})}):p.jsx("div",{className:"flex items-center justify-center h-full",children:p.jsx("div",{className:"text-center",children:p.jsx(VR,{vertical:!0,noBorder:!0,message:"No Results yet"})})})})})}function Tz({tools:t,selectedTool:e,onToolSelect:r,focusedIndex:n}){return t.length===0?p.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[p.jsx(Rs,{className:"h-12 w-12 text-gray-400 dark:text-gray-600 mb-3"}),p.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"No tools available"})]}):p.jsx("div",{className:"overflow-y-auto flex-1 border-r dark:border-zinc-700 overscroll-contain",children:t.map((a,s)=>p.jsx(af,{id:`tool-${a.name}`,isSelected:e?.name===a.name,isFocused:n===s,icon:p.jsx(Rs,{className:"h-4 w-4"}),title:a.name,description:a.description,metadata:a.inputSchema?.properties&&p.jsxs(Wa,{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:()=>r(a)},a.name))})}function Rz({activeTab:t,isSearchExpanded:e,searchQuery:r,filteredToolsCount:n,savedRequestsCount:a,onSearchExpand:s,onSearchChange:l,onSearchBlur:c,onTabSwitch:d,searchInputRef:f}){return p.jsx(yV,{activeTab:t,isSearchExpanded:e,searchQuery:r,primaryTabName:"tools",secondaryTabName:"saved",primaryTabTitle:"Tools",secondaryTabTitle:"Saved",primaryCount:n,secondaryCount:a,primaryIcon:Rs,secondaryIcon:uh,searchPlaceholder:"Search tools...",onSearchExpand:s,onSearchChange:l,onSearchBlur:c,onTabSwitch:d,searchInputRef:f})}const Cz="mcp-inspector-saved-requests";function wV({ref:t,tools:e,callTool:r,readResource:n,serverId:a,isConnected:s}){const[l,c]=b.useState(null),[d,f]=b.useState(null),{selectedToolName:h,setSelectedToolName:g}=tf(),[v,y]=b.useState({}),[w,S]=b.useState([]),[T,x]=b.useState(!1),[_,C]=b.useState(null),[N,k]=b.useState(""),[A,I]=b.useState("tools"),[O,L]=b.useState([]),[M,P]=b.useState(!1),[W,X]=b.useState(""),[ee,J]=b.useState(!0),[B,Y]=b.useState(!1),[H,re]=b.useState(-1),Q=b.useRef(null),[j,q]=b.useState(!1),[z,G]=b.useState("list");b.useEffect(()=>{const _e=()=>{q(window.innerWidth<1024)};return _e(),window.addEventListener("resize",_e),()=>window.removeEventListener("resize",_e)},[]),b.useEffect(()=>{G(l?"detail":"list")},[l]),b.useEffect(()=>{j&&w.length>0&&!T&&G("response")},[w,T,j]),b.useImperativeHandle(t,()=>({focusSearch:()=>{Y(!0),setTimeout(()=>{Q.current&&Q.current.focus()},0)},blurSearch:()=>{k(""),Y(!1),Q.current&&Q.current.blur()}})),b.useEffect(()=>{try{const _e=localStorage.getItem(Cz);_e&&L(JSON.parse(_e))}catch(_e){console.error("[ToolsTab] Failed to load saved requests:",_e)}},[]);const Z=b.useCallback(_e=>{try{localStorage.setItem(Cz,JSON.stringify(_e)),L(_e)}catch(Ae){console.error("[ToolsTab] Failed to save requests:",Ae)}},[]),U=b.useMemo(()=>{if(!N.trim())return e;const _e=N.toLowerCase();return e.filter(Ae=>Ae.name.toLowerCase().includes(_e)||Ae.description?.toLowerCase().includes(_e))},[e,N]),F=b.useCallback(_e=>{c(_e);const Ae={};_e.inputSchema?.properties&&Object.entries(_e.inputSchema.properties).forEach(([$e,oe])=>{const Se=oe;Se.default!==void 0?Ae[$e]=Se.default:Se.type==="string"?Ae[$e]="":Se.type==="number"?Ae[$e]=0:Se.type==="boolean"?Ae[$e]=!1:Se.type==="array"?Ae[$e]="[]":Se.type==="object"&&(Ae[$e]="{}")}),y(Ae)},[]),te=b.useCallback(_e=>{const Ae=e.find($e=>$e.name===_e.toolName);Ae&&(c(Ae),y(_e.args),f(_e))},[e]);b.useEffect(()=>{B&&Q.current&&Q.current.focus()},[B]);const fe=b.useCallback(()=>{N.trim()||Y(!1)},[N]);b.useEffect(()=>{A!=="tools"&&Y(!1)},[A]),b.useEffect(()=>{re(-1)},[N,A]),b.useEffect(()=>{const _e=Ae=>{const $e=Ae.target;if($e.tagName==="INPUT"||$e.tagName==="TEXTAREA"||$e.contentEditable==="true"||Ae.metaKey||Ae.ctrlKey||Ae.altKey)return;const Se=A==="tools"?U:O;if(Ae.key==="ArrowDown")Ae.preventDefault(),re(Le=>{const we=Le+1;return we>=Se.length?0:we});else if(Ae.key==="ArrowUp")Ae.preventDefault(),re(Le=>{const we=Le-1;return we<0?Se.length-1:we});else if(Ae.key==="Enter"&&H>=0)if(Ae.preventDefault(),A==="tools"){const Le=U[H];Le&&F(Le)}else{const Le=O[H];Le&&te(Le)}};return document.addEventListener("keydown",_e),()=>document.removeEventListener("keydown",_e)},[H,U,O,A,F,te]),b.useEffect(()=>{if(H>=0){const _e=A==="tools"?`tool-${U[H]?.name}`:`saved-${O[H]?.id}`,Ae=document.getElementById(_e);Ae&&Ae.scrollIntoView({behavior:"smooth",block:"nearest"})}},[H,U,O,A]),b.useEffect(()=>{if(h&&e.length>0){const _e=e.find(Ae=>Ae.name===h);if(_e&&l?.name!==_e.name){g(null);const Ae=setTimeout(()=>{F(_e);const $e=document.getElementById(`tool-${_e.name}`);$e&&$e.scrollIntoView({behavior:"smooth",block:"nearest"})},100);return()=>clearTimeout(Ae)}}},[h,e,l,F,g]);const V=b.useCallback((_e,Ae)=>{y($e=>{const oe={...$e};if(l?.inputSchema?.properties?.[_e]){const Le=l.inputSchema.properties[_e].type;if(Le==="object"||Le==="array")oe[_e]=Ae;else if(Le==="string")oe[_e]=Ae;else try{oe[_e]=JSON.parse(Ae)}catch{oe[_e]=Ae}}else oe[_e]=Ae;return oe})},[l]),de=b.useCallback(async()=>{if(!l||T)return;x(!0);const _e=Date.now();try{const Ae={...v};l.inputSchema?.properties&&Object.entries(l.inputSchema.properties).forEach(([Oe,Ve])=>{const ut=Ve.type,At=Ae[Oe];if((ut==="object"||ut==="array")&&typeof At=="string")try{Ae[Oe]=JSON.parse(At)}catch{}});const $e=await r(l.name,Ae),oe=Date.now()-_e;zr.getInstance().capture(new iD({toolName:l.name,serverId:a,success:!0,duration:oe})).catch(()=>{});const Le=l?._meta||l?.metadata,we=Le?.["openai/outputTemplate"];let ke;if(we&&typeof we=="string"){const Oe={toolName:l.name,args:v,result:$e,timestamp:_e,duration:oe,toolMeta:Le,appsSdkResource:{uri:we,resourceData:null,isLoading:!0}};S([Oe]);try{const Ve=await n(we);let et=null;if($e?.structuredContent)et=$e.structuredContent;else if(Array.isArray($e)&&$e[0]){const ut=$e[0];ut.output?.value?.structuredContent?et=ut.output.value.structuredContent:ut.structuredContent?et=ut.structuredContent:ut.output?.value&&(et=ut.output.value)}et||(et=$e),ke={uri:we,resourceData:{...Ve,structuredContent:et},isLoading:!1}}catch(Ve){ke={uri:we,resourceData:null,isLoading:!1,error:Ve instanceof Error?Ve.message:String(Ve)}}S(Ve=>Ve.map((et,ut)=>ut===0?{...et,appsSdkResource:ke}:et))}else S(Oe=>[{toolName:l.name,args:v,result:$e,timestamp:_e,duration:oe,toolMeta:Le},...Oe])}catch(Ae){const $e=Date.now()-_e;zr.getInstance().capture(new iD({toolName:l.name,serverId:a,success:!1,duration:$e,error:Ae instanceof Error?Ae.message:String(Ae)})).catch(()=>{});const Se=l?._meta||l?.metadata,Le={toolName:l.name,args:v,result:null,error:Ae instanceof Error?Ae.message:String(Ae),timestamp:_e,duration:$e,toolMeta:Se},we=Se?.["openai/outputTemplate"];S(we?[Le]:ke=>[Le,...ke])}finally{x(!1)}},[l,v,T,r,n,a]),le=b.useCallback(async(_e,Ae)=>{try{await navigator.clipboard.writeText(JSON.stringify(Ae,null,2)),C(_e),setTimeout(()=>C(null),2e3)}catch($e){console.error("[ToolsTab] Failed to copy result:",$e)}},[]),pe=b.useCallback(_e=>{S(Ae=>Ae.filter(($e,oe)=>oe!==_e))},[]),Re=b.useCallback(_e=>{const Ae=w[_e];if(Ae){const $e=window.open("","_blank","width=800,height=600");$e&&($e.document.write(`
|
|
1546
1546
|
<html>
|
|
1547
1547
|
<head>
|
|
1548
1548
|
<title>${Ae.toolName} Result</title>
|
|
@@ -1556,4 +1556,4 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
1556
1556
|
<pre>${JSON.stringify(Ae.result,null,2)}</pre>
|
|
1557
1557
|
</body>
|
|
1558
1558
|
</html>
|
|
1559
|
-
`),$e.document.close())}},[w]),Ke=b.useCallback(()=>{l&&(X(""),P(!0))},[l]),je=b.useCallback(()=>{if(!l)return;const _e={id:`${Date.now()}-${Math.random()}`,name:W.trim()||`${l.name} - ${new Date().toLocaleString()}`,toolName:l.name,args:v,savedAt:Date.now(),serverId:l._serverId,serverName:l._serverName};Z([...O,_e]),zr.getInstance().capture(new Wee({toolName:l.name,serverId:a})).catch(()=>{}),P(!1),X("")},[l,W,v,O,Z,a]),ze=b.useCallback(_e=>{Z(O.filter(Ae=>Ae.id!==_e)),d?.id===_e&&f(null)},[O,Z,d]);return j?p.jsxs("div",{className:"h-full flex flex-col overflow-hidden relative bg-background",children:[z!=="list"&&p.jsxs("div",{className:"flex items-center gap-2 p-2 border-b shrink-0 bg-background z-10",children:[p.jsx(Je,{variant:"ghost",size:"sm",onClick:()=>{z==="response"?G("detail"):(c(null),G("list"))},className:"p-0 h-8 w-8",children:p.jsx(XR,{className:"h-4 w-4"})}),p.jsxs("div",{className:"flex items-center text-sm font-medium",children:[p.jsx("button",{onClick:()=>{c(null),G("list")},className:"text-muted-foreground hover:text-foreground hover:underline cursor-pointer",children:"Tools"}),z!=="list"&&p.jsxs(p.Fragment,{children:[p.jsx("span",{className:"mx-2 text-muted-foreground",children:"/"}),p.jsx("button",{onClick:()=>{z==="response"&&G("detail")},className:z==="detail"?"text-foreground hover:underline":z==="response"?"text-muted-foreground hover:text-foreground hover:underline cursor-pointer":"text-muted-foreground",children:"Execute"})]}),z==="response"&&p.jsxs(p.Fragment,{children:[p.jsx("span",{className:"mx-2 text-muted-foreground",children:"/"}),p.jsx("span",{className:"text-foreground",children:"Response"})]})]})]}),p.jsx("div",{className:"flex-1 relative overflow-hidden",children:p.jsxs(gh,{initial:!1,mode:"popLayout",children:[z==="list"&&p.jsxs(_n.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:[p.jsx(Rz,{activeTab:A,isSearchExpanded:B,searchQuery:N,filteredToolsCount:U.length,savedRequestsCount:O.length,onSearchExpand:()=>Y(!0),onSearchChange:k,onSearchBlur:fe,onTabSwitch:()=>I(A==="tools"?"saved":"tools"),searchInputRef:Q}),A==="tools"?p.jsx(Tz,{tools:U,selectedTool:l,onToolSelect:F,focusedIndex:H}):p.jsx(Sz,{savedRequests:O,selectedRequest:d,onLoadRequest:te,onDeleteRequest:ze,focusedIndex:H})]},"list"),z==="detail"&&p.jsx(_n.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:p.jsx(wz,{selectedTool:l,toolArgs:v,isExecuting:T,isConnected:s,onArgChange:V,onExecute:de,onSave:Ke})},"detail"),z==="response"&&p.jsx(_n.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:p.jsx(_z,{results:w,copiedResult:_,previewMode:ee,serverId:a,readResource:n,onCopy:le,onDelete:pe,onFullscreen:Re,onTogglePreview:()=>J(!ee)})},"response")]})}),p.jsx(xz,{isOpen:M,requestName:W,defaultPlaceholder:`${l?.name} - ${new Date().toLocaleString()}`,onRequestNameChange:X,onSave:je,onCancel:()=>P(!1)})]}):p.jsxs(Id,{direction:"horizontal",className:"h-full",children:[p.jsxs(Fa,{defaultSize:33,className:"flex flex-col h-full relative",children:[p.jsx(Rz,{activeTab:A,isSearchExpanded:B,searchQuery:N,filteredToolsCount:U.length,savedRequestsCount:O.length,onSearchExpand:()=>Y(!0),onSearchChange:k,onSearchBlur:fe,onTabSwitch:()=>I(A==="tools"?"saved":"tools"),searchInputRef:Q}),A==="tools"?p.jsx(Tz,{tools:U,selectedTool:l,onToolSelect:F,focusedIndex:H}):p.jsx(Sz,{savedRequests:O,selectedRequest:d,onLoadRequest:te,onDeleteRequest:ze,focusedIndex:H})]}),p.jsx(Od,{withHandle:!0}),p.jsx(Fa,{defaultSize:67,children:p.jsxs(Id,{direction:"vertical",children:[p.jsx(Fa,{defaultSize:40,children:p.jsx(wz,{selectedTool:l,toolArgs:v,isExecuting:T,isConnected:s,onArgChange:V,onExecute:de,onSave:Ke})}),p.jsx(Od,{withHandle:!0}),p.jsx(Fa,{defaultSize:60,children:p.jsx("div",{className:"flex flex-col h-full",children:p.jsx(_z,{results:w,copiedResult:_,previewMode:ee,serverId:a,readResource:n,onCopy:le,onDelete:pe,onFullscreen:Re,onTogglePreview:()=>J(!ee)})})})]})}),p.jsx(xz,{isOpen:M,requestName:W,defaultPlaceholder:`${l?.name} - ${new Date().toLocaleString()}`,onRequestNameChange:X,onSave:je,onCancel:()=>P(!1)})]})}wV.displayName="ToolsTab";function rEe({selectedServer:t,activeTab:e,toolsSearchRef:r,promptsSearchRef:n,resourcesSearchRef:a,children:s}){if(!t)return p.jsx(p.Fragment,{children:s});switch(e){case"tools":return p.jsx(wV,{ref:r,tools:t.tools,callTool:t.callTool,readResource:t.readResource,serverId:t.id,isConnected:t.state==="ready"});case"prompts":return p.jsx(EV,{ref:n,prompts:t.prompts,callPrompt:t.getPrompt,serverId:t.id,isConnected:t.state==="ready"});case"resources":return p.jsx(xV,{ref:a,resources:t.resources,readResource:t.readResource,serverId:t.id,isConnected:t.state==="ready"});case"chat":return p.jsx(wye,{connection:t,isConnected:t.state==="ready",readResource:t.readResource},t.id);default:return p.jsx(p.Fragment,{children:s})}}function Az({className:t}){return p.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentcolor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",className:t,children:[p.jsx("path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4"}),p.jsx("path",{d:"M9 18c-4.51 2-5-2-7-2"})]})}var Lh="Popover",[_V]=Qa(Lh,[Oi]),of=Oi(),[nEe,Pi]=_V(Lh),TV=t=>{const{__scopePopover:e,children:r,open:n,defaultOpen:a,onOpenChange:s,modal:l=!1}=t,c=of(e),d=b.useRef(null),[f,h]=b.useState(!1),[g,v]=Ri({prop:n,defaultProp:a??!1,onChange:s,caller:Lh});return p.jsx(Jm,{...c,children:p.jsx(nEe,{scope:e,contentId:Xr(),triggerRef:d,open:g,onOpenChange:v,onOpenToggle:b.useCallback(()=>v(y=>!y),[v]),hasCustomAnchor:f,onCustomAnchorAdd:b.useCallback(()=>h(!0),[]),onCustomAnchorRemove:b.useCallback(()=>h(!1),[]),modal:l,children:r})})};TV.displayName=Lh;var RV="PopoverAnchor",aEe=b.forwardRef((t,e)=>{const{__scopePopover:r,...n}=t,a=Pi(RV,r),s=of(r),{onCustomAnchorAdd:l,onCustomAnchorRemove:c}=a;return b.useEffect(()=>(l(),()=>c()),[l,c]),p.jsx(qd,{...s,...n,ref:e})});aEe.displayName=RV;var CV="PopoverTrigger",AV=b.forwardRef((t,e)=>{const{__scopePopover:r,...n}=t,a=Pi(CV,r),s=of(r),l=kt(e,a.triggerRef),c=p.jsx(yt.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.contentId,"data-state":DV(a.open),...n,ref:l,onClick:He(t.onClick,a.onOpenToggle)});return a.hasCustomAnchor?c:p.jsx(qd,{asChild:!0,...s,children:c})});AV.displayName=CV;var mA="PopoverPortal",[oEe,iEe]=_V(mA,{forceMount:void 0}),NV=t=>{const{__scopePopover:e,forceMount:r,children:n,container:a}=t,s=Pi(mA,e);return p.jsx(oEe,{scope:e,forceMount:r,children:p.jsx(ua,{present:r||s.open,children:p.jsx(Cc,{asChild:!0,container:a,children:n})})})};NV.displayName=mA;var mc="PopoverContent",kV=b.forwardRef((t,e)=>{const r=iEe(mc,t.__scopePopover),{forceMount:n=r.forceMount,...a}=t,s=Pi(mc,t.__scopePopover);return p.jsx(ua,{present:n||s.open,children:s.modal?p.jsx(lEe,{...a,ref:e}):p.jsx(cEe,{...a,ref:e})})});kV.displayName=mc;var sEe=_s("PopoverContent.RemoveScroll"),lEe=b.forwardRef((t,e)=>{const r=Pi(mc,t.__scopePopover),n=b.useRef(null),a=kt(e,n),s=b.useRef(!1);return b.useEffect(()=>{const l=n.current;if(l)return rh(l)},[]),p.jsx(Vd,{as:sEe,allowPinchZoom:!0,children:p.jsx(IV,{...t,ref:a,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:He(t.onCloseAutoFocus,l=>{l.preventDefault(),s.current||r.triggerRef.current?.focus()}),onPointerDownOutside:He(t.onPointerDownOutside,l=>{const c=l.detail.originalEvent,d=c.button===0&&c.ctrlKey===!0,f=c.button===2||d;s.current=f},{checkForDefaultPrevented:!1}),onFocusOutside:He(t.onFocusOutside,l=>l.preventDefault(),{checkForDefaultPrevented:!1})})})}),cEe=b.forwardRef((t,e)=>{const r=Pi(mc,t.__scopePopover),n=b.useRef(!1),a=b.useRef(!1);return p.jsx(IV,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{t.onCloseAutoFocus?.(s),s.defaultPrevented||(n.current||r.triggerRef.current?.focus(),s.preventDefault()),n.current=!1,a.current=!1},onInteractOutside:s=>{t.onInteractOutside?.(s),s.defaultPrevented||(n.current=!0,s.detail.originalEvent.type==="pointerdown"&&(a.current=!0));const l=s.target;r.triggerRef.current?.contains(l)&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&a.current&&s.preventDefault()}})}),IV=b.forwardRef((t,e)=>{const{__scopePopover:r,trapFocus:n,onOpenAutoFocus:a,onCloseAutoFocus:s,disableOutsidePointerEvents:l,onEscapeKeyDown:c,onPointerDownOutside:d,onFocusOutside:f,onInteractOutside:h,...g}=t,v=Pi(mc,r),y=of(r);return Ym(),p.jsx($d,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:a,onUnmountAutoFocus:s,children:p.jsx(_c,{asChild:!0,disableOutsidePointerEvents:l,onInteractOutside:h,onEscapeKeyDown:c,onPointerDownOutside:d,onFocusOutside:f,onDismiss:()=>v.onOpenChange(!1),children:p.jsx(eh,{"data-state":DV(v.open),role:"dialog",id:v.contentId,...y,...g,ref:e,style:{...g.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),OV="PopoverClose",uEe=b.forwardRef((t,e)=>{const{__scopePopover:r,...n}=t,a=Pi(OV,r);return p.jsx(yt.button,{type:"button",...n,ref:e,onClick:He(t.onClick,()=>a.onOpenChange(!1))})});uEe.displayName=OV;var dEe="PopoverArrow",fEe=b.forwardRef((t,e)=>{const{__scopePopover:r,...n}=t,a=of(r);return p.jsx(th,{...a,...n,ref:e})});fEe.displayName=dEe;function DV(t){return t?"open":"closed"}var pEe=TV,mEe=AV,hEe=NV,LV=kV;const gEe=pEe,vEe=mEe,MV=b.forwardRef(({className:t,align:e="center",sideOffset:r=4,...n},a)=>p.jsx(hEe,{children:p.jsx(LV,{ref:a,align:e,sideOffset:r,className:De("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none 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),...n})}));MV.displayName=LV.displayName;const PV=b.createContext(void 0);function jV(){const t=b.use(PV);if(!t)throw new Error("useTabs must be used within a TabsProvider");return t}const UV=b.createContext(void 0);function bEe(){return b.use(UV)}function JT({ref:t,children:e,defaultValue:r,value:n,onValueChange:a,className:s,...l}){const[c,d]=b.useState(r||""),f=n!==void 0,h=b.useCallback(v=>{f||d(v),a?.(v)},[f,a]),g=f?n:c;return p.jsx(PV,{value:{activeValue:g,handleValueChange:h},children:p.jsx("div",{ref:t,className:De("flex flex-col gap-2",s),...l,children:e})})}JT.displayName="Tabs";function eR({ref:t,children:e,className:r,variant:n="default",...a}){const{activeValue:s}=jV(),[l,c]=b.useState({width:0,left:0}),d=b.useRef(null),f=b.useRef(null),h=b.useRef(null),v=b.Children.toArray(e).findIndex(S=>b.isValidElement(S)&&S.props.value===s),y=b.useCallback(()=>{const S=d.current;if(!S)return;const x=S.querySelectorAll("button")[v];if(x){const _=S.getBoundingClientRect(),C=x.getBoundingClientRect();c({width:C.width,left:C.left-_.left})}},[v]),w=b.useCallback(()=>{h.current&&clearTimeout(h.current),h.current=setTimeout(y,16)},[y]);return b.useEffect(()=>{const S=setTimeout(y,10);return()=>clearTimeout(S)},[y]),b.useEffect(()=>{const S=d.current;return S?(f.current=new ResizeObserver(()=>{w()}),f.current.observe(S),S.querySelectorAll("button").forEach(x=>{f.current&&f.current.observe(x)}),()=>{f.current&&f.current.disconnect(),h.current&&clearTimeout(h.current)}):void 0},[w]),b.useEffect(()=>{const S=()=>{w()};return window.addEventListener("resize",S),()=>window.removeEventListener("resize",S)},[w]),b.useEffect(()=>{const S=d.current;if(!S)return;const T=S.querySelector("[data-width]");T&&(T.style.width=`${l.width}px`,T.style.left=`${l.left}px`)},[l]),p.jsx(UV,{value:{variant:n},children:p.jsxs("div",{ref:d,className:De("relative flex bg-none",n==="default"&&"p-1 rounded-full border border-zinc-300 dark:border-zinc-600",n==="underline"&&"border-b border-zinc-200 dark:border-zinc-700",r),...a,children:[e,p.jsx("span",{className:De("absolute transition-all duration-200 ease-out z-0",n==="default"&&"bg-white dark:bg-zinc-700 rounded-full h-[calc(100%-8px)] top-1 border border-zinc-300 dark:border-zinc-600",n==="underline"&&"bottom-0 h-0.5 bg-black dark:bg-white"),"data-width":l.width,"data-left":l.left})]})})}eR.displayName="TabsList";function tR({ref:t,children:e,value:r,className:n,disabled:a,icon:s,...l}){const{activeValue:c,handleValueChange:d}=jV(),h=bEe()?.variant||"default",g=c===r;return p.jsxs("button",{ref:t,disabled:a,onClick:()=>d(r),className:De("relative z-10 flex-1 inline-flex items-center justify-center whitespace-nowrap text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 cursor-pointer",h==="default"&&"rounded-md px-4 py-2.5",h==="underline"&&"px-6 py-3 border-b-2 border-transparent",g&&"text-foreground",!g&&"text-muted-foreground hover:text-foreground",n),...l,children:[s&&p.jsx(s,{className:"mr-2 h-4 w-4"}),e]})}tR.displayName="TabsTrigger";function Nz({className:t}){const{theme:e,setTheme:r}=Ah(),n=b.useRef(null),[a,s]=b.useState(!1);b.useEffect(()=>{s(!0)},[]);const l=()=>e==="system"?"light":e==="light"?"dark":"system",c=()=>e==="system"?p.jsx(hD,{className:"size-4"}):e==="light"?p.jsx(pre,{className:"size-5"}):p.jsx(Xte,{className:"size-4"}),d=()=>e==="system"?"Switch to light mode":e==="light"?"Switch to dark mode":"Switch to system mode",f=async()=>{if(!n.current)return;const h=l();if(typeof document<"u"&&"startViewTransition"in document){await document.startViewTransition(()=>{Sc.flushSync(()=>{r(h)})}).ready;const{top:g,left:v,width:y,height:w}=n.current.getBoundingClientRect(),S=g+w/2,T=v+y/2,x=window.innerWidth-v,_=window.innerHeight-g,C=Math.hypot(Math.max(v,x),Math.max(g,_));document.documentElement.animate({clipPath:[`circle(0px at ${T}px ${S}px)`,`circle(${C}px at ${T}px ${S}px)`]},{duration:700,easing:"ease-in-out",pseudoElement:"::view-transition-new(root)"})}else r(h)};return a?p.jsx("button",{ref:n,onClick:f,className:De(t),"aria-label":d(),title:`Current: ${e==="system"?"Auto":e==="light"?"Light":"Dark"}`,children:c()}):p.jsx("button",{ref:n,className:De(t),"aria-label":"Toggle theme",children:p.jsx(hD,{className:"size-4"})})}function kz({className:t,state:e="collapsed",href:r="https://mcp-use.com"}){const[n,a]=b.useState(!1),s=.2,l=.7,c=.6,d=4,f=s+l+c,h=0,g=s/f,v=(s+l)/f,y=1;return p.jsxs("a",{href:r,target:"_blank",rel:"noopener noreferrer",className:De("flex items-center transition-opacity -my-3",e==="expanded"?"space-x-2":"",t),onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1),children:[p.jsx("div",{className:"relative",children:p.jsxs(_n.svg,{viewBox:"0 0 303 303",initial:"rest",animate:n?"hover":"rest",className:De("text-foreground",e==="expanded"?"size-[40px]":"size-[20px]"),children:[p.jsxs(_n.g,{variants:{rest:{opacity:1},hover:{opacity:[1,0,0,1],transition:{duration:f,times:[h,g,v,y],ease:"easeInOut"}}},fill:"currentColor",fillRule:"nonzero",stroke:"currentColor",strokeWidth:d,strokeLinecap:"round",strokeLinejoin:"round",children:[p.jsx("path",{d:"m105.5 34.8.6.6c9.5 9.5 14.4 21.9 14.6 34.4a112.6 112.6 0 0 0 112.2 112.1h.6c12 .4 24 5.1 33.2 14.1l.6.6a50 50 0 0 1-70.1 71.3l-.6-.6A49.9 49.9 0 0 1 182 230 112.6 112.6 0 0 0 73.4 120.7h-.8a49.9 49.9 0 0 1-36.7-14l-.5-.6a50 50 0 0 1-.6-70.2l.6-.5a50 50 0 0 1 69.5-1.2l.6.6Z"}),p.jsx("circle",{cx:"70.3",cy:"232.3",r:"50"}),p.jsx("circle",{cx:"232.3",cy:"70.3",r:"50"})]}),p.jsxs("g",{fill:"none",stroke:"currentColor",strokeWidth:d,strokeLinecap:"round",strokeLinejoin:"round",children:[p.jsx(yEe,{d:"m105.5 34.8.6.6c9.5 9.5 14.4 21.9 14.6 34.4a112.6 112.6 0 0 0 112.2 112.1h.6c12 .4 24 5.1 33.2 14.1l.6.6a50 50 0 0 1-70.1 71.3l-.6-.6A49.9 49.9 0 0 1 182 230 112.6 112.6 0 0 0 73.4 120.7h-.8a49.9 49.9 0 0 1-36.7-14l-.5-.6a50 50 0 0 1-.6-70.2l.6-.5a50 50 0 0 1 69.5-1.2l.6.6Z",times:{T0:h,T1:g,T2:v,T3:y},total:f}),p.jsx(Iz,{cx:70.3,cy:232.3,r:50,times:{T0:h,T1:g,T2:v,T3:y},total:f}),p.jsx(Iz,{cx:232.3,cy:70.3,r:50,times:{T0:h,T1:g,T2:v,T3:y},total:f})]})]})}),e==="expanded"&&p.jsxs("div",{className:"font-ubuntu flex flex-col items-start -space-y-1 mr-3",children:[p.jsx("h1",{className:"text-xl font-medium",children:"mcp-use"}),p.jsx("span",{className:"text-lg text-muted-foreground tracking-wide font-sans font-light",children:"Inspector"})]})]})}function yEe({d:t,times:e,total:r}){const{T0:n,T1:a,T2:s,T3:l}=e;return p.jsx(_n.path,{d:t,variants:{rest:{pathLength:0,opacity:0},hover:{pathLength:[0,0,1,1],opacity:[0,0,1,1],transition:{duration:r,times:[n,a,s,l],ease:"easeInOut"}}}})}function Iz({cx:t,cy:e,r,times:n,total:a}){const{T0:s,T1:l,T2:c,T3:d}=n;return p.jsx(_n.circle,{cx:t,cy:e,r,variants:{rest:{pathLength:0,opacity:0},hover:{pathLength:[0,0,1,1],opacity:[0,0,1,1],transition:{duration:a,times:[s,l,c,d],ease:"easeInOut"}}}})}function FV({ref:t,shimmerColor:e,shimmerSize:r="0.05em",shimmerDuration:n="3s",borderRadius:a="100px",background:s,className:l,children:c,...d}){const{resolvedTheme:f}=Ah(),h=f==="dark"?"#000000":"#ffffff",g=f==="dark"?"rgba(255, 255, 255, 1)":"rgba(0, 0, 0, 1)",v=e||h,y=s||g;return p.jsxs("button",{style:{"--spread":"90deg","--shimmer-color":v,"--radius":a,"--speed":n,"--cut":r,"--bg":y},className:De("group relative z-0 flex cursor-pointer items-center justify-center overflow-hidden [border-radius:var(--radius)] border px-6 py-3 whitespace-nowrap [background:var(--bg)]","transform-gpu transition-transform duration-300 ease-in-out active:translate-y-px",f==="dark"?"border-black/10 text-black":"border-white/10 text-white",l),ref:t,...d,children:[p.jsx("div",{className:De("-z-30 blur-[2px]","[container-type:size] absolute inset-0 overflow-visible"),children:p.jsx("div",{className:"animate-shimmer-slide absolute inset-0 [aspect-ratio:1] h-[100cqh] [border-radius:0] [mask:none]",children:p.jsx("div",{className:"animate-spin-around absolute -inset-full w-auto [translate:0_0] rotate-0 [background:conic-gradient(from_calc(270deg-(var(--spread)*0.5)),transparent_0,var(--shimmer-color)_var(--spread),transparent_var(--spread))]"})})}),c,p.jsx("div",{className:De("absolute inset-0 size-full","rounded-2xl px-4 py-1.5 text-sm font-medium","transform-gpu transition-all duration-300 ease-in-out",f==="dark"?"shadow-[inset_0_-8px_10px_#0000001f] group-hover:shadow-[inset_0_-6px_10px_#0000003f] group-active:shadow-[inset_0_-10px_10px_#0000003f]":"shadow-[inset_0_-8px_10px_#ffffff1f] group-hover:shadow-[inset_0_-6px_10px_#ffffff3f] group-active:shadow-[inset_0_-10px_10px_#ffffff3f]")}),p.jsx("div",{className:De("absolute [inset:var(--cut)] -z-20 [border-radius:var(--radius)] [background:var(--bg)]")})]})}FV.displayName="ShimmerButton";function Oz({status:t}){const e=s=>{switch(s){case"ready":return{color:"bg-emerald-500",ringColor:"ring-emerald-500",tooltip:"Connected"};case"failed":return{color:"bg-red-500",ringColor:"ring-red-500",tooltip:"Failed"};default:return{color:"bg-yellow-500",ringColor:"ring-yellow-500",tooltip:s}}},{color:r,ringColor:n,tooltip:a}=e(t);return p.jsxs(Sr,{children:[p.jsx(xr,{asChild:!0,children:p.jsxs("div",{className:"relative",children:[p.jsx("div",{className:`absolute w-2 h-2 rounded-full ${n} animate-ping`}),p.jsx("div",{className:`relative w-2 h-2 rounded-full ${r}`})]})}),p.jsx(wr,{children:p.jsx("p",{children:a})})]})}function Dz({connections:t,selectedServer:e,onServerSelect:r,onOpenConnectionOptions:n,mobileMode:a=!1}){const s=Ec(),l=c=>{const d=t.find(f=>f.id===c);if(!d||d.state!=="ready"){cr.error("Server is not connected and cannot be inspected");return}r(c)};return a?p.jsx("div",{className:"flex items-center gap-2",children:p.jsx("div",{className:"relative",children:p.jsxs(sT,{children:[p.jsx(lT,{asChild:!0,children:p.jsxs(Je,{variant:"ghost",className:"h-11 px-2 bg-black dark:bg-white text-white dark:text-black border-black dark:border-white hover:bg-gray-800 dark:hover:bg-zinc-100 hover:border-gray-800 dark:hover:border-zinc-200 flex items-center gap-1.5",children:[e?p.jsx(ms,{serverUrl:e.url,serverName:e.name,size:"md"}):p.jsx(ire,{className:"h-5 w-5"}),p.jsx(ZR,{className:"h-4 w-4"})]})}),p.jsxs(Nm,{className:"w-[calc(100vw-2rem)] sm:w-[300px]",align:"start",children:[p.jsx(cT,{className:"cursor-pointer hover:bg-zinc-100 dark:hover:bg-zinc-800",onClick:()=>s("/"),children:"MCP Servers"}),p.jsx(Lu,{}),t.length===0?p.jsx("div",{className:"px-2 py-4 text-sm text-muted-foreground dark:text-zinc-400 text-center",children:"No servers connected. Go to the dashboard to add one."}):t.map(c=>p.jsxs(Co,{onClick:()=>l(c.id),className:"flex items-center gap-3",children:[p.jsx(ms,{serverUrl:c.url,serverName:c.name,size:"sm"}),p.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[p.jsx("div",{className:"font-medium",children:c.name}),p.jsx(Oz,{status:c.state})]}),p.jsx(Je,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0 hover:bg-zinc-100 dark:hover:bg-zinc-800",onClick:d=>{d.stopPropagation(),n(c.id)},children:p.jsx(Hl,{className:"h-3 w-3"})})]},c.id)),p.jsx(Lu,{}),p.jsx(Co,{onClick:()=>s("/"),children:p.jsx("span",{className:"text-blue-600 dark:text-blue-400",children:"+ Add new server"})})]})]})})}):p.jsx("div",{className:"flex items-center gap-2",children:p.jsx("div",{className:"relative",children:p.jsxs(sT,{children:[p.jsx(lT,{asChild:!0,children:p.jsxs(FV,{className:De("min-w-0 sm:min-w-[200px] p-0 px-1 text-sm h-11 justify-start bg-black dark:bg-white text-white dark:text-black border-black dark:border-white hover:bg-gray-800 dark:hover:bg-zinc-100 hover:border-gray-800 dark:hover:border-zinc-200",!e&&"pl-4",e&&"pr-10"),children:[e&&p.jsx(ms,{serverUrl:e.url,serverName:e.name,size:"md",className:"mr-2"}),p.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[p.jsx("span",{className:"truncate",children:e?e.name:"Select server to inspect"}),e&&p.jsx("div",{className:"flex items-center gap-2",children:e.error&&e.state!=="ready"?p.jsxs(Sr,{children:[p.jsx(xr,{asChild:!0,children:p.jsx("button",{onClick:c=>{c.stopPropagation()},className:"w-2 h-2 rounded-full bg-rose-500 animate-status-pulse-red hover:bg-rose-600 transition-colors",title:"Click to copy error message","aria-label":"Copy error message to clipboard"})}),p.jsx(wr,{children:p.jsx("p",{className:"max-w-xs",children:e.error})})]}):p.jsx("div",{className:`w-2 h-2 rounded-full ${e.state==="ready"?"bg-emerald-600 animate-status-pulse":e.state==="failed"?"bg-rose-600 animate-status-pulse-red":"bg-yellow-500 animate-status-pulse-yellow"}`})})]})]})}),e&&p.jsxs(Sr,{children:[p.jsx(xr,{asChild:!0,children:p.jsx("button",{type:"button",onClick:()=>{n(e.id)},className:"absolute right-2 top-1/2 -translate-y-1/2 p-1.5 hover:bg-white/10 dark:hover:bg-black/10 rounded-full transition-colors text-white dark:text-black","aria-label":"Edit connection settings",children:p.jsx(Hl,{className:"h-4 w-4"})})}),p.jsx(wr,{children:p.jsx("p",{children:"Edit connection settings"})})]}),p.jsxs(Nm,{className:"w-[calc(100vw-2rem)] sm:w-[300px]",align:"start",children:[p.jsx(cT,{className:"cursor-pointer hover:bg-zinc-100 dark:hover:bg-zinc-800",onClick:()=>s("/"),children:"MCP Servers"}),p.jsx(Lu,{}),t.length===0?p.jsx("div",{className:"px-2 py-4 text-sm text-muted-foreground dark:text-zinc-400 text-center",children:"No servers connected. Go to the dashboard to add one."}):t.map(c=>p.jsxs(Co,{onClick:()=>l(c.id),className:"flex items-center gap-3",children:[p.jsx(ms,{serverUrl:c.url,serverName:c.name,size:"sm"}),p.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[p.jsx("div",{className:"font-medium",children:c.name}),p.jsx(Oz,{status:c.state})]}),p.jsx(Je,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0 hover:bg-zinc-100 dark:hover:bg-zinc-800",onClick:d=>{d.stopPropagation(),n(c.id)},children:p.jsx(Hl,{className:"h-3 w-3"})})]},c.id)),p.jsx(Lu,{}),p.jsx(Co,{onClick:()=>s("/"),children:p.jsx("span",{className:"text-blue-600 dark:text-blue-400",children:"+ Add new server"})})]})]})})})}const Lz=[{id:"tools",label:"Tools",icon:Rs},{id:"prompts",label:"Prompts",icon:yd},{id:"resources",label:"Resources",icon:Pte},{id:"chat",label:"Chat",icon:Wte}];function EEe({connections:t,selectedServer:e,activeTab:r,onServerSelect:n,onTabChange:a,onCommandPaletteOpen:s,onOpenConnectionOptions:l}){const{tunnelUrl:c}=tf(),d=e&&c,[f,h]=b.useState(!1),g=async()=>{if(c)try{await navigator.clipboard.writeText(`${c}/mcp`),h(!0),cr.success("Tunnel URL copied to clipboard"),setTimeout(()=>h(!1),2e3)}catch{cr.error("Failed to copy URL")}};return p.jsxs("header",{className:"w-full mx-auto",children:[p.jsxs("div",{className:"flex lg:hidden flex-col gap-3",children:[p.jsxs("div",{className:"flex items-center justify-between w-full",children:[p.jsx("div",{className:"flex-1 flex justify-start",children:p.jsx(Dz,{connections:t,selectedServer:e,onServerSelect:n,onOpenConnectionOptions:l,mobileMode:!0})}),p.jsx("div",{className:"flex-shrink-0 flex justify-center",children:p.jsx("div",{className:"scale-150",children:p.jsx(kz,{state:"collapsed"})})}),p.jsxs("div",{className:"flex-1 flex justify-end items-center gap-2",children:[p.jsxs(Sr,{children:[p.jsx(xr,{asChild:!0,children:p.jsx(Je,{variant:"ghost",size:"sm",asChild:!0,children:p.jsx("a",{href:"https://github.com/mcp-use/mcp-use",target:"_blank",rel:"noopener noreferrer",className:"p-2","aria-label":"GitHub",children:p.jsx(Az,{className:"h-4 w-4"})})})}),p.jsx(wr,{children:p.jsx("p",{children:"Give us a star ⭐"})})]}),p.jsx(Nz,{className:"p-2 hover:bg-zinc-200 dark:hover:bg-zinc-800 rounded-full transition-colors cursor-pointer"})]})]}),e&&p.jsx("div",{className:"w-full",children:p.jsx(JT,{value:r,onValueChange:v=>a(v),children:p.jsx(eR,{className:"w-full justify-center",children:Lz.map(v=>{let y=0;return v.id==="tools"?y=e.tools.length:v.id==="prompts"?y=e.prompts.length:v.id==="resources"&&(y=e.resources.length),p.jsxs(tR,{value:v.id,icon:v.icon,className:"[&>svg]:mr-0 flex-1 flex-row gap-2",children:[y>0&&p.jsx("span",{className:De(r===v.id?"dark:bg-black":"dark:bg-zinc-700","bg-zinc-200 text-zinc-700 dark:text-zinc-300 text-[10px] px-1.5 py-0.5 rounded-full font-medium"),children:y}),p.jsx("span",{className:"sr-only",children:v.label})]},v.id)})})})})]}),p.jsxs("div",{className:"hidden lg:flex items-center justify-between gap-3",children:[p.jsxs("div",{className:"flex items-center flex-wrap gap-2 md:space-x-6 space-x-2",children:[p.jsx(Dz,{connections:t,selectedServer:e,onServerSelect:n,onOpenConnectionOptions:l}),e&&p.jsx(JT,{value:r,onValueChange:v=>a(v),children:p.jsx(eR,{className:"overflow-x-auto",children:Lz.map(v=>{let y=0;return v.id==="tools"?y=e.tools.length:v.id==="prompts"?y=e.prompts.length:v.id==="resources"&&(y=e.resources.length),p.jsx(tR,{value:v.id,icon:v.icon,className:"[&>svg]:mr-0 lg:[&>svg]:mr-2",children:p.jsxs("div",{className:"items-center gap-2 hidden lg:flex",children:[v.label,y>0&&p.jsx("span",{className:De(r===v.id?" dark:bg-black ":"dark:bg-zinc-700","bg-zinc-200 text-zinc-700 dark:text-zinc-300 text-xs px-2 py-0.5 rounded-full font-medium"),children:y})]})},v.id)})})}),d&&p.jsxs(gEe,{children:[p.jsx(vEe,{asChild:!0,children:p.jsxs("button",{className:"flex items-center gap-2 px-3 py-1.5 bg-gradient-to-r from-purple-500/10 to-pink-500/10 dark:from-purple-500/20 dark:to-pink-500/20 border border-purple-500/30 dark:border-purple-500/40 rounded-full hover:from-purple-500/20 hover:to-pink-500/20 dark:hover:from-purple-500/30 dark:hover:to-pink-500/30 transition-colors cursor-pointer",children:[p.jsx(Ed,{className:"size-4 text-purple-600 dark:text-purple-400 animate-pulse"}),p.jsx("span",{className:"text-xs font-medium text-purple-700 dark:text-purple-300 hidden lg:inline",children:"Tunnel"})]})}),p.jsx(MV,{className:"w-[calc(100vw-2rem)] sm:w-96",align:"start",children:p.jsxs("div",{className:"space-y-4",children:[p.jsxs("div",{children:[p.jsxs("h4",{className:"font-semibold text-sm mb-2 flex items-center gap-2",children:[p.jsx(Ed,{className:"size-4 text-purple-600 dark:text-purple-400"}),"Tunnel URL"]}),p.jsxs("div",{className:"flex items-center gap-2 p-2 py-0 bg-muted rounded-full",children:[p.jsxs("code",{className:"flex-1 text-[10px] font-mono",children:[c,"/mcp"]}),p.jsx(Je,{variant:"ghost",size:"sm",className:"h-7 px-2",onClick:g,children:f?p.jsx(Mo,{className:"size-3.5 text-green-600"}):p.jsx($n,{className:"size-3.5"})})]})]}),p.jsxs("div",{children:[p.jsx("h5",{className:"font-semibold text-sm mb-2",children:"Use in ChatGPT"}),p.jsxs("ol",{className:"space-y-2 text-xs text-muted-foreground",children:[p.jsxs("li",{className:"flex gap-2",children:[p.jsx("span",{className:"font-semibold text-foreground",children:"1."}),p.jsxs("span",{children:["Enable"," ",p.jsx("span",{className:"font-medium text-foreground",children:"dev mode"})," ","from settings"]})]}),p.jsxs("li",{className:"flex gap-2",children:[p.jsx("span",{className:"font-semibold text-foreground",children:"2."}),p.jsxs("span",{children:["In"," ",p.jsx("span",{className:"font-medium text-foreground",children:"App & Connectors"})," ","click on"," ",p.jsx("span",{className:"font-medium text-foreground",children:"create"})]})]}),p.jsxs("li",{className:"flex gap-2",children:[p.jsx("span",{className:"font-semibold text-foreground",children:"3."}),p.jsx("span",{children:"Use the tunnel URL in the input"})]})]})]})]})})]})]}),p.jsxs("div",{className:"flex items-center gap-2 sm:gap-4 flex-shrink-0",children:[p.jsxs(Sr,{children:[p.jsx(xr,{children:p.jsx(Nz,{className:"p-2 hover:bg-zinc-200 dark:hover:bg-zinc-800 rounded-full transition-colors cursor-pointer"})}),p.jsx(wr,{children:p.jsx("p",{children:"Toggle theme"})})]}),p.jsxs(Sr,{children:[p.jsx(xr,{asChild:!0,children:p.jsxs(Je,{variant:"ghost",className:"hover:bg-zinc-200 dark:hover:bg-zinc-800 rounded-full px-1 -mx-3 flex gap-1",onClick:s,children:[p.jsx(bte,{className:"size-4"}),p.jsx("span",{className:"text-base font-mono hidden sm:inline",children:"K"})]})}),p.jsx(wr,{children:p.jsx("p",{children:"Command Palette"})})]}),p.jsxs(Sr,{children:[p.jsx(xr,{asChild:!0,children:p.jsx(Je,{variant:"ghost",size:"sm",asChild:!0,children:p.jsxs("a",{href:"https://github.com/mcp-use/mcp-use",className:"flex items-center gap-2",target:"_blank",rel:"noopener noreferrer",children:[p.jsx(Az,{className:"h-4 w-4"}),p.jsx("span",{className:"hidden sm:inline",children:"Github"})]})})}),p.jsx(wr,{children:p.jsx("p",{children:"Give us a star ⭐"})})]}),p.jsx(kz,{state:"expanded"})]})]})]})}function SEe({children:t}){const e=Ec(),r=zo(),{connections:n,addConnection:a,removeConnection:s,updateConnectionConfig:l}=KR(),{selectedServerId:c,setSelectedServerId:d,activeTab:f,setActiveTab:h,navigateToItem:g,setTunnelUrl:v}=tf(),[y,w]=b.useState(!1),[S,T]=b.useState(null),x=Lle();b.useEffect(()=>{const B=new URLSearchParams(r.search).get("tunnelUrl");v(B)},[r.search,v]);const _=b.useRef(null),C=b.useRef(null),N=b.useRef(null),{isAutoConnecting:k}=Dle({connections:n,addConnection:a,removeConnection:s}),A=b.useCallback(J=>{zr.getInstance().capture(new Gee({trigger:J})).catch(()=>{}),w(!0)},[]),I=J=>{const B=n.find(Q=>Q.id===J);if(!B||B.state!=="ready"){cr.error("Server is not connected and cannot be inspected");return}d(J);const H=new URLSearchParams(r.search).get("tunnelUrl"),re=H?`/?server=${encodeURIComponent(J)}&tunnelUrl=${encodeURIComponent(H)}`:`/?server=${encodeURIComponent(J)}`;e(re)},O=b.useCallback(J=>{T(J)},[]),L=b.useCallback(J=>{S&&(J.url!==S?(s(S),a(J.url,J.name,J.proxyConfig,J.transportType)):l(S,{name:J.name,proxyConfig:J.proxyConfig,transportType:J.transportType}),T(null),cr.success("Connection settings updated"))},[S,s,a,l]),M=(J,B,Y)=>{if(console.warn("[Layout] handleCommandPaletteNavigate called:",{tab:J,itemName:B,serverId:Y}),Y){const H=n.find(q=>q.id===Y);if(console.warn("[Layout] Server lookup:",{serverId:Y,serverFound:!!H,serverState:H?.state}),!H||H.state!=="ready"){console.warn("[Layout] Server not ready, showing error"),cr.error("Server is not connected and cannot be inspected");return}console.warn("[Layout] Calling navigateToItem:",{serverId:Y,tab:J,itemName:B}),g(Y,J,B);const Q=new URLSearchParams(r.search).get("tunnelUrl"),j=Q?`/?server=${encodeURIComponent(Y)}&tunnelUrl=${encodeURIComponent(Q)}`:`/?server=${encodeURIComponent(Y)}`;console.warn("[Layout] Navigating to:",j),e(j)}else console.warn("[Layout] No serverId, just updating tab to:",J),h(J)},P=n.find(J=>J.id===c),W=P?P.tools.map(J=>({...J,_serverId:P.id})):n.flatMap(J=>J.state==="ready"?J.tools.map(B=>({...B,_serverId:J.id,_serverName:J.name})):[]),X=P?P.prompts.map(J=>({...J,_serverId:P.id})):n.flatMap(J=>J.state==="ready"?J.prompts.map(B=>({...B,_serverId:J.id,_serverName:J.name})):[]),ee=P?P.resources.map(J=>({...J,_serverId:P.id})):n.flatMap(J=>J.state==="ready"?J.resources.map(B=>({...B,_serverId:J.id,_serverName:J.name})):[]);return b.useEffect(()=>{const B=new URLSearchParams(r.search).get("server"),Y=B?decodeURIComponent(B):null;Y!==c&&d(Y)},[r.search,c,d]),b.useEffect(()=>{const B=new URLSearchParams(r.search).get("server");if(!B)return;const Y=decodeURIComponent(B),H=n.find(re=>re.id===Y);if(!H){const re=setTimeout(()=>e("/"),3e3);return()=>clearTimeout(re)}if(H.state==="failed"){const re=setTimeout(()=>e("/"),2e3);return()=>clearTimeout(re)}},[r.search,e,n]),B5({onCommandPalette:()=>A("keyboard"),onToolsTab:()=>{P&&h("tools")},onPromptsTab:()=>{P&&h("prompts")},onResourcesTab:()=>{P&&h("resources")},onChatTab:()=>{P&&h("chat")},onHome:()=>{e("/")},onFocusSearch:()=>{f==="tools"&&_.current?_.current.focusSearch():f==="prompts"&&C.current?C.current.focusSearch():f==="resources"&&N.current&&N.current.focusSearch()},onBlurSearch:()=>{f==="tools"&&_.current?_.current.blurSearch():f==="prompts"&&C.current?C.current.blurSearch():f==="resources"&&N.current&&N.current.blurSearch()}}),k?p.jsx("div",{className:"h-screen bg-white dark:bg-zinc-900 flex items-center justify-center",children:p.jsxs("div",{className:"flex flex-col items-center gap-4",children:[p.jsx(Uo,{className:"h-8 w-8 text-zinc-600 dark:text-zinc-400"}),p.jsx("p",{className:"text-sm text-zinc-600 dark:text-zinc-400",children:"Connecting to MCP server..."})]})}):p.jsx(a3,{children:p.jsxs("div",{className:"h-screen bg-[#f3f3f3] dark:bg-black flex flex-col px-2 py-2 sm:px-4 sm:py-4 gap-2 sm:gap-4",children:[p.jsx(EEe,{connections:n,selectedServer:P,activeTab:f,onServerSelect:I,onTabChange:h,onCommandPaletteOpen:()=>A("button"),onOpenConnectionOptions:O}),p.jsx("main",{className:"flex-1 w-full mx-auto bg-white dark:bg-black rounded-2xl border border-zinc-200 dark:border-zinc-700 p-0 overflow-auto",children:p.jsx(rEe,{selectedServer:P,activeTab:f,toolsSearchRef:_,promptsSearchRef:C,resourcesSearchRef:N,children:t})}),p.jsx(sce,{isOpen:y,onOpenChange:w,tools:W,prompts:X,resources:ee,savedRequests:x,connections:n,onNavigate:M,onServerSelect:I}),p.jsx(oq,{connection:S&&n.find(J=>J.id===S)||null,open:S!==null,onOpenChange:J=>{J||T(null)},onConnect:L})]})})}var xEe=(t,e,r,n,a,s,l,c)=>{let d=document.documentElement,f=["light","dark"];function h(y){(Array.isArray(t)?t:[t]).forEach(w=>{let S=w==="class",T=S&&s?a.map(x=>s[x]||x):a;S?(d.classList.remove(...T),d.classList.add(s&&s[y]?s[y]:y)):d.setAttribute(w,y)}),g(y)}function g(y){c&&f.includes(y)&&(d.style.colorScheme=y)}function v(){return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}if(n)h(n);else try{let y=localStorage.getItem(e)||r,w=l&&y==="system"?v():y;h(w)}catch{}},wEe=b.createContext(void 0),_Ee={setTheme:t=>{},themes:[]},TEe=()=>{var t;return(t=b.useContext(wEe))!=null?t:_Ee};b.memo(({forcedTheme:t,storageKey:e,attribute:r,enableSystem:n,enableColorScheme:a,defaultTheme:s,value:l,themes:c,nonce:d,scriptProps:f})=>{let h=JSON.stringify([r,e,s,t,c,l,n,a]).slice(1,-1);return b.createElement("script",{...f,suppressHydrationWarning:!0,nonce:typeof window>"u"?d:"",dangerouslySetInnerHTML:{__html:`(${xEe.toString()})(${h})`}})});function REe({...t}){const{theme:e="system"}=TEe();return p.jsx(Wre,{theme:e,className:"toaster group",style:{"--normal-bg":"var(--popover)","--normal-text":"var(--popover-foreground)","--normal-border":"var(--border)"},...t})}function CEe(){return p.jsx(dbe,{children:p.jsx(Zee,{children:p.jsxs(Ole,{children:[p.jsx(XY,{basename:"/inspector",children:p.jsx(SEe,{children:p.jsx(AY,{children:p.jsx(U$,{path:"/",element:p.jsx(Ile,{})})})})}),p.jsx(REe,{position:"top-center"})]})})})}const Mz=new URLSearchParams(window.location.search);if(Mz.has("code")||Mz.has("error"))try{T$()}catch(t){console.error("[inspector] OAuth callback error:",t)}const Pz=document.getElementById("root");Pz?U7.createRoot(Pz).render(p.jsx(CEe,{})):console.error("[inspector] Root element not found");export{_$ as B,mO as H,zz as L,g7 as M,E7 as W,ct as Z,Qe as _,T9 as a,NEe as b,Ie as c,Pr as d,Ze as e,OEe as f,hc as g,_9 as h,_t as i,IEe as j,DEe as k,mt as l,Io as m,$r as n,Pe as o,LEe as p,kEe as q,Ld as r,be as s,Me as t,dn as u,f7 as v,ds as w,K_ as x,x7 as y,T$ as z};
|
|
1559
|
+
`),$e.document.close())}},[w]),Ke=b.useCallback(()=>{l&&(X(""),P(!0))},[l]),je=b.useCallback(()=>{if(!l)return;const _e={id:`${Date.now()}-${Math.random()}`,name:W.trim()||`${l.name} - ${new Date().toLocaleString()}`,toolName:l.name,args:v,savedAt:Date.now(),serverId:l._serverId,serverName:l._serverName};Z([...O,_e]),zr.getInstance().capture(new Wee({toolName:l.name,serverId:a})).catch(()=>{}),P(!1),X("")},[l,W,v,O,Z,a]),ze=b.useCallback(_e=>{Z(O.filter(Ae=>Ae.id!==_e)),d?.id===_e&&f(null)},[O,Z,d]);return j?p.jsxs("div",{className:"h-full flex flex-col overflow-hidden relative bg-background",children:[z!=="list"&&p.jsxs("div",{className:"flex items-center gap-2 p-2 border-b shrink-0 bg-background z-10",children:[p.jsx(Je,{variant:"ghost",size:"sm",onClick:()=>{z==="response"?G("detail"):(c(null),G("list"))},className:"p-0 h-8 w-8",children:p.jsx(XR,{className:"h-4 w-4"})}),p.jsxs("div",{className:"flex items-center text-sm font-medium",children:[p.jsx("button",{onClick:()=>{c(null),G("list")},className:"text-muted-foreground hover:text-foreground hover:underline cursor-pointer",children:"Tools"}),z!=="list"&&p.jsxs(p.Fragment,{children:[p.jsx("span",{className:"mx-2 text-muted-foreground",children:"/"}),p.jsx("button",{onClick:()=>{z==="response"&&G("detail")},className:z==="detail"?"text-foreground hover:underline":z==="response"?"text-muted-foreground hover:text-foreground hover:underline cursor-pointer":"text-muted-foreground",children:"Execute"})]}),z==="response"&&p.jsxs(p.Fragment,{children:[p.jsx("span",{className:"mx-2 text-muted-foreground",children:"/"}),p.jsx("span",{className:"text-foreground",children:"Response"})]})]})]}),p.jsx("div",{className:"flex-1 relative overflow-hidden",children:p.jsxs(gh,{initial:!1,mode:"popLayout",children:[z==="list"&&p.jsxs(_n.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:[p.jsx(Rz,{activeTab:A,isSearchExpanded:B,searchQuery:N,filteredToolsCount:U.length,savedRequestsCount:O.length,onSearchExpand:()=>Y(!0),onSearchChange:k,onSearchBlur:fe,onTabSwitch:()=>I(A==="tools"?"saved":"tools"),searchInputRef:Q}),A==="tools"?p.jsx(Tz,{tools:U,selectedTool:l,onToolSelect:F,focusedIndex:H}):p.jsx(Sz,{savedRequests:O,selectedRequest:d,onLoadRequest:te,onDeleteRequest:ze,focusedIndex:H})]},"list"),z==="detail"&&p.jsx(_n.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:p.jsx(wz,{selectedTool:l,toolArgs:v,isExecuting:T,isConnected:s,onArgChange:V,onExecute:de,onSave:Ke})},"detail"),z==="response"&&p.jsx(_n.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:p.jsx(_z,{results:w,copiedResult:_,previewMode:ee,serverId:a,readResource:n,onCopy:le,onDelete:pe,onFullscreen:Re,onTogglePreview:()=>J(!ee)})},"response")]})}),p.jsx(xz,{isOpen:M,requestName:W,defaultPlaceholder:`${l?.name} - ${new Date().toLocaleString()}`,onRequestNameChange:X,onSave:je,onCancel:()=>P(!1)})]}):p.jsxs(Id,{direction:"horizontal",className:"h-full",children:[p.jsxs(Fa,{defaultSize:33,className:"flex flex-col h-full relative",children:[p.jsx(Rz,{activeTab:A,isSearchExpanded:B,searchQuery:N,filteredToolsCount:U.length,savedRequestsCount:O.length,onSearchExpand:()=>Y(!0),onSearchChange:k,onSearchBlur:fe,onTabSwitch:()=>I(A==="tools"?"saved":"tools"),searchInputRef:Q}),A==="tools"?p.jsx(Tz,{tools:U,selectedTool:l,onToolSelect:F,focusedIndex:H}):p.jsx(Sz,{savedRequests:O,selectedRequest:d,onLoadRequest:te,onDeleteRequest:ze,focusedIndex:H})]}),p.jsx(Od,{withHandle:!0}),p.jsx(Fa,{defaultSize:67,children:p.jsxs(Id,{direction:"vertical",children:[p.jsx(Fa,{defaultSize:40,children:p.jsx(wz,{selectedTool:l,toolArgs:v,isExecuting:T,isConnected:s,onArgChange:V,onExecute:de,onSave:Ke})}),p.jsx(Od,{withHandle:!0}),p.jsx(Fa,{defaultSize:60,children:p.jsx("div",{className:"flex flex-col h-full",children:p.jsx(_z,{results:w,copiedResult:_,previewMode:ee,serverId:a,readResource:n,onCopy:le,onDelete:pe,onFullscreen:Re,onTogglePreview:()=>J(!ee)})})})]})}),p.jsx(xz,{isOpen:M,requestName:W,defaultPlaceholder:`${l?.name} - ${new Date().toLocaleString()}`,onRequestNameChange:X,onSave:je,onCancel:()=>P(!1)})]})}wV.displayName="ToolsTab";function rEe({selectedServer:t,activeTab:e,toolsSearchRef:r,promptsSearchRef:n,resourcesSearchRef:a,children:s}){if(!t)return p.jsx(p.Fragment,{children:s});switch(e){case"tools":return p.jsx(wV,{ref:r,tools:t.tools,callTool:t.callTool,readResource:t.readResource,serverId:t.id,isConnected:t.state==="ready"});case"prompts":return p.jsx(EV,{ref:n,prompts:t.prompts,callPrompt:t.getPrompt,serverId:t.id,isConnected:t.state==="ready"});case"resources":return p.jsx(xV,{ref:a,resources:t.resources,readResource:t.readResource,serverId:t.id,isConnected:t.state==="ready"});case"chat":return p.jsx(wye,{connection:t,isConnected:t.state==="ready",readResource:t.readResource},t.id);default:return p.jsx(p.Fragment,{children:s})}}function Az({className:t}){return p.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentcolor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",className:t,children:[p.jsx("path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4"}),p.jsx("path",{d:"M9 18c-4.51 2-5-2-7-2"})]})}var Lh="Popover",[_V]=Qa(Lh,[Oi]),of=Oi(),[nEe,Pi]=_V(Lh),TV=t=>{const{__scopePopover:e,children:r,open:n,defaultOpen:a,onOpenChange:s,modal:l=!1}=t,c=of(e),d=b.useRef(null),[f,h]=b.useState(!1),[g,v]=Ri({prop:n,defaultProp:a??!1,onChange:s,caller:Lh});return p.jsx(Jm,{...c,children:p.jsx(nEe,{scope:e,contentId:Xr(),triggerRef:d,open:g,onOpenChange:v,onOpenToggle:b.useCallback(()=>v(y=>!y),[v]),hasCustomAnchor:f,onCustomAnchorAdd:b.useCallback(()=>h(!0),[]),onCustomAnchorRemove:b.useCallback(()=>h(!1),[]),modal:l,children:r})})};TV.displayName=Lh;var RV="PopoverAnchor",aEe=b.forwardRef((t,e)=>{const{__scopePopover:r,...n}=t,a=Pi(RV,r),s=of(r),{onCustomAnchorAdd:l,onCustomAnchorRemove:c}=a;return b.useEffect(()=>(l(),()=>c()),[l,c]),p.jsx(qd,{...s,...n,ref:e})});aEe.displayName=RV;var CV="PopoverTrigger",AV=b.forwardRef((t,e)=>{const{__scopePopover:r,...n}=t,a=Pi(CV,r),s=of(r),l=kt(e,a.triggerRef),c=p.jsx(yt.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.contentId,"data-state":DV(a.open),...n,ref:l,onClick:He(t.onClick,a.onOpenToggle)});return a.hasCustomAnchor?c:p.jsx(qd,{asChild:!0,...s,children:c})});AV.displayName=CV;var mA="PopoverPortal",[oEe,iEe]=_V(mA,{forceMount:void 0}),NV=t=>{const{__scopePopover:e,forceMount:r,children:n,container:a}=t,s=Pi(mA,e);return p.jsx(oEe,{scope:e,forceMount:r,children:p.jsx(ua,{present:r||s.open,children:p.jsx(Cc,{asChild:!0,container:a,children:n})})})};NV.displayName=mA;var mc="PopoverContent",kV=b.forwardRef((t,e)=>{const r=iEe(mc,t.__scopePopover),{forceMount:n=r.forceMount,...a}=t,s=Pi(mc,t.__scopePopover);return p.jsx(ua,{present:n||s.open,children:s.modal?p.jsx(lEe,{...a,ref:e}):p.jsx(cEe,{...a,ref:e})})});kV.displayName=mc;var sEe=_s("PopoverContent.RemoveScroll"),lEe=b.forwardRef((t,e)=>{const r=Pi(mc,t.__scopePopover),n=b.useRef(null),a=kt(e,n),s=b.useRef(!1);return b.useEffect(()=>{const l=n.current;if(l)return rh(l)},[]),p.jsx(Vd,{as:sEe,allowPinchZoom:!0,children:p.jsx(IV,{...t,ref:a,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:He(t.onCloseAutoFocus,l=>{l.preventDefault(),s.current||r.triggerRef.current?.focus()}),onPointerDownOutside:He(t.onPointerDownOutside,l=>{const c=l.detail.originalEvent,d=c.button===0&&c.ctrlKey===!0,f=c.button===2||d;s.current=f},{checkForDefaultPrevented:!1}),onFocusOutside:He(t.onFocusOutside,l=>l.preventDefault(),{checkForDefaultPrevented:!1})})})}),cEe=b.forwardRef((t,e)=>{const r=Pi(mc,t.__scopePopover),n=b.useRef(!1),a=b.useRef(!1);return p.jsx(IV,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{t.onCloseAutoFocus?.(s),s.defaultPrevented||(n.current||r.triggerRef.current?.focus(),s.preventDefault()),n.current=!1,a.current=!1},onInteractOutside:s=>{t.onInteractOutside?.(s),s.defaultPrevented||(n.current=!0,s.detail.originalEvent.type==="pointerdown"&&(a.current=!0));const l=s.target;r.triggerRef.current?.contains(l)&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&a.current&&s.preventDefault()}})}),IV=b.forwardRef((t,e)=>{const{__scopePopover:r,trapFocus:n,onOpenAutoFocus:a,onCloseAutoFocus:s,disableOutsidePointerEvents:l,onEscapeKeyDown:c,onPointerDownOutside:d,onFocusOutside:f,onInteractOutside:h,...g}=t,v=Pi(mc,r),y=of(r);return Ym(),p.jsx($d,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:a,onUnmountAutoFocus:s,children:p.jsx(_c,{asChild:!0,disableOutsidePointerEvents:l,onInteractOutside:h,onEscapeKeyDown:c,onPointerDownOutside:d,onFocusOutside:f,onDismiss:()=>v.onOpenChange(!1),children:p.jsx(eh,{"data-state":DV(v.open),role:"dialog",id:v.contentId,...y,...g,ref:e,style:{...g.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),OV="PopoverClose",uEe=b.forwardRef((t,e)=>{const{__scopePopover:r,...n}=t,a=Pi(OV,r);return p.jsx(yt.button,{type:"button",...n,ref:e,onClick:He(t.onClick,()=>a.onOpenChange(!1))})});uEe.displayName=OV;var dEe="PopoverArrow",fEe=b.forwardRef((t,e)=>{const{__scopePopover:r,...n}=t,a=of(r);return p.jsx(th,{...a,...n,ref:e})});fEe.displayName=dEe;function DV(t){return t?"open":"closed"}var pEe=TV,mEe=AV,hEe=NV,LV=kV;const gEe=pEe,vEe=mEe,MV=b.forwardRef(({className:t,align:e="center",sideOffset:r=4,...n},a)=>p.jsx(hEe,{children:p.jsx(LV,{ref:a,align:e,sideOffset:r,className:De("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none 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),...n})}));MV.displayName=LV.displayName;const PV=b.createContext(void 0);function jV(){const t=b.use(PV);if(!t)throw new Error("useTabs must be used within a TabsProvider");return t}const UV=b.createContext(void 0);function bEe(){return b.use(UV)}function JT({ref:t,children:e,defaultValue:r,value:n,onValueChange:a,className:s,...l}){const[c,d]=b.useState(r||""),f=n!==void 0,h=b.useCallback(v=>{f||d(v),a?.(v)},[f,a]),g=f?n:c;return p.jsx(PV,{value:{activeValue:g,handleValueChange:h},children:p.jsx("div",{ref:t,className:De("flex flex-col gap-2",s),...l,children:e})})}JT.displayName="Tabs";function eR({ref:t,children:e,className:r,variant:n="default",...a}){const{activeValue:s}=jV(),[l,c]=b.useState({width:0,left:0}),d=b.useRef(null),f=b.useRef(null),h=b.useRef(null),v=b.Children.toArray(e).findIndex(S=>b.isValidElement(S)&&S.props.value===s),y=b.useCallback(()=>{const S=d.current;if(!S)return;const x=S.querySelectorAll("button")[v];if(x){const _=S.getBoundingClientRect(),C=x.getBoundingClientRect();c({width:C.width,left:C.left-_.left})}},[v]),w=b.useCallback(()=>{h.current&&clearTimeout(h.current),h.current=setTimeout(y,16)},[y]);return b.useEffect(()=>{const S=setTimeout(y,10);return()=>clearTimeout(S)},[y]),b.useEffect(()=>{const S=d.current;return S?(f.current=new ResizeObserver(()=>{w()}),f.current.observe(S),S.querySelectorAll("button").forEach(x=>{f.current&&f.current.observe(x)}),()=>{f.current&&f.current.disconnect(),h.current&&clearTimeout(h.current)}):void 0},[w]),b.useEffect(()=>{const S=()=>{w()};return window.addEventListener("resize",S),()=>window.removeEventListener("resize",S)},[w]),b.useEffect(()=>{const S=d.current;if(!S)return;const T=S.querySelector("[data-width]");T&&(T.style.width=`${l.width}px`,T.style.left=`${l.left}px`)},[l]),p.jsx(UV,{value:{variant:n},children:p.jsxs("div",{ref:d,className:De("relative flex bg-none",n==="default"&&"p-1 rounded-full border border-zinc-300 dark:border-zinc-600",n==="underline"&&"border-b border-zinc-200 dark:border-zinc-700",r),...a,children:[e,p.jsx("span",{className:De("absolute transition-all duration-200 ease-out z-0",n==="default"&&"bg-white dark:bg-zinc-700 rounded-full h-[calc(100%-8px)] top-1 border border-zinc-300 dark:border-zinc-600",n==="underline"&&"bottom-0 h-0.5 bg-black dark:bg-white"),"data-width":l.width,"data-left":l.left})]})})}eR.displayName="TabsList";function tR({ref:t,children:e,value:r,className:n,disabled:a,icon:s,...l}){const{activeValue:c,handleValueChange:d}=jV(),h=bEe()?.variant||"default",g=c===r;return p.jsxs("button",{ref:t,disabled:a,onClick:()=>d(r),className:De("relative z-10 flex-1 inline-flex items-center justify-center whitespace-nowrap text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 cursor-pointer",h==="default"&&"rounded-md px-4 py-2.5",h==="underline"&&"px-6 py-3 border-b-2 border-transparent",g&&"text-foreground",!g&&"text-muted-foreground hover:text-foreground",n),...l,children:[s&&p.jsx(s,{className:"mr-2 h-4 w-4"}),e]})}tR.displayName="TabsTrigger";function Nz({className:t}){const{theme:e,setTheme:r}=Ah(),n=b.useRef(null),[a,s]=b.useState(!1);b.useEffect(()=>{s(!0)},[]);const l=()=>e==="system"?"light":e==="light"?"dark":"system",c=()=>e==="system"?p.jsx(hD,{className:"size-4"}):e==="light"?p.jsx(pre,{className:"size-5"}):p.jsx(Xte,{className:"size-4"}),d=()=>e==="system"?"Switch to light mode":e==="light"?"Switch to dark mode":"Switch to system mode",f=async()=>{if(!n.current)return;const h=l();if(typeof document<"u"&&"startViewTransition"in document){await document.startViewTransition(()=>{Sc.flushSync(()=>{r(h)})}).ready;const{top:g,left:v,width:y,height:w}=n.current.getBoundingClientRect(),S=g+w/2,T=v+y/2,x=window.innerWidth-v,_=window.innerHeight-g,C=Math.hypot(Math.max(v,x),Math.max(g,_));document.documentElement.animate({clipPath:[`circle(0px at ${T}px ${S}px)`,`circle(${C}px at ${T}px ${S}px)`]},{duration:700,easing:"ease-in-out",pseudoElement:"::view-transition-new(root)"})}else r(h)};return a?p.jsx("button",{ref:n,onClick:f,className:De(t),"aria-label":d(),title:`Current: ${e==="system"?"Auto":e==="light"?"Light":"Dark"}`,children:c()}):p.jsx("button",{ref:n,className:De(t),"aria-label":"Toggle theme",children:p.jsx(hD,{className:"size-4"})})}function kz({className:t,state:e="collapsed",href:r="https://mcp-use.com"}){const[n,a]=b.useState(!1),s=.2,l=.7,c=.6,d=4,f=s+l+c,h=0,g=s/f,v=(s+l)/f,y=1;return p.jsxs("a",{href:r,target:"_blank",rel:"noopener noreferrer",className:De("flex items-center transition-opacity -my-3",e==="expanded"?"space-x-2":"",t),onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1),children:[p.jsx("div",{className:"relative",children:p.jsxs(_n.svg,{viewBox:"0 0 303 303",initial:"rest",animate:n?"hover":"rest",className:De("text-foreground",e==="expanded"?"size-[40px]":"size-[20px]"),children:[p.jsxs(_n.g,{variants:{rest:{opacity:1},hover:{opacity:[1,0,0,1],transition:{duration:f,times:[h,g,v,y],ease:"easeInOut"}}},fill:"currentColor",fillRule:"nonzero",stroke:"currentColor",strokeWidth:d,strokeLinecap:"round",strokeLinejoin:"round",children:[p.jsx("path",{d:"m105.5 34.8.6.6c9.5 9.5 14.4 21.9 14.6 34.4a112.6 112.6 0 0 0 112.2 112.1h.6c12 .4 24 5.1 33.2 14.1l.6.6a50 50 0 0 1-70.1 71.3l-.6-.6A49.9 49.9 0 0 1 182 230 112.6 112.6 0 0 0 73.4 120.7h-.8a49.9 49.9 0 0 1-36.7-14l-.5-.6a50 50 0 0 1-.6-70.2l.6-.5a50 50 0 0 1 69.5-1.2l.6.6Z"}),p.jsx("circle",{cx:"70.3",cy:"232.3",r:"50"}),p.jsx("circle",{cx:"232.3",cy:"70.3",r:"50"})]}),p.jsxs("g",{fill:"none",stroke:"currentColor",strokeWidth:d,strokeLinecap:"round",strokeLinejoin:"round",children:[p.jsx(yEe,{d:"m105.5 34.8.6.6c9.5 9.5 14.4 21.9 14.6 34.4a112.6 112.6 0 0 0 112.2 112.1h.6c12 .4 24 5.1 33.2 14.1l.6.6a50 50 0 0 1-70.1 71.3l-.6-.6A49.9 49.9 0 0 1 182 230 112.6 112.6 0 0 0 73.4 120.7h-.8a49.9 49.9 0 0 1-36.7-14l-.5-.6a50 50 0 0 1-.6-70.2l.6-.5a50 50 0 0 1 69.5-1.2l.6.6Z",times:{T0:h,T1:g,T2:v,T3:y},total:f}),p.jsx(Iz,{cx:70.3,cy:232.3,r:50,times:{T0:h,T1:g,T2:v,T3:y},total:f}),p.jsx(Iz,{cx:232.3,cy:70.3,r:50,times:{T0:h,T1:g,T2:v,T3:y},total:f})]})]})}),e==="expanded"&&p.jsxs("div",{className:"font-ubuntu flex flex-col items-start -space-y-1 mr-3",children:[p.jsx("h1",{className:"text-xl font-medium",children:"mcp-use"}),p.jsx("span",{className:"text-lg text-muted-foreground tracking-wide font-sans font-light",children:"Inspector"})]})]})}function yEe({d:t,times:e,total:r}){const{T0:n,T1:a,T2:s,T3:l}=e;return p.jsx(_n.path,{d:t,variants:{rest:{pathLength:0,opacity:0},hover:{pathLength:[0,0,1,1],opacity:[0,0,1,1],transition:{duration:r,times:[n,a,s,l],ease:"easeInOut"}}}})}function Iz({cx:t,cy:e,r,times:n,total:a}){const{T0:s,T1:l,T2:c,T3:d}=n;return p.jsx(_n.circle,{cx:t,cy:e,r,variants:{rest:{pathLength:0,opacity:0},hover:{pathLength:[0,0,1,1],opacity:[0,0,1,1],transition:{duration:a,times:[s,l,c,d],ease:"easeInOut"}}}})}function FV({ref:t,shimmerColor:e,shimmerSize:r="0.05em",shimmerDuration:n="3s",borderRadius:a="100px",background:s,className:l,children:c,...d}){const{resolvedTheme:f}=Ah(),h=f==="dark"?"#000000":"#ffffff",g=f==="dark"?"rgba(255, 255, 255, 1)":"rgba(0, 0, 0, 1)",v=e||h,y=s||g;return p.jsxs("button",{style:{"--spread":"90deg","--shimmer-color":v,"--radius":a,"--speed":n,"--cut":r,"--bg":y},className:De("group relative z-0 flex cursor-pointer items-center justify-center overflow-hidden [border-radius:var(--radius)] border px-6 py-3 whitespace-nowrap [background:var(--bg)]","transform-gpu transition-transform duration-300 ease-in-out active:translate-y-px",f==="dark"?"border-black/10 text-black":"border-white/10 text-white",l),ref:t,...d,children:[p.jsx("div",{className:De("-z-30 blur-[2px]","[container-type:size] absolute inset-0 overflow-visible"),children:p.jsx("div",{className:"animate-shimmer-slide absolute inset-0 [aspect-ratio:1] h-[100cqh] [border-radius:0] [mask:none]",children:p.jsx("div",{className:"animate-spin-around absolute -inset-full w-auto [translate:0_0] rotate-0 [background:conic-gradient(from_calc(270deg-(var(--spread)*0.5)),transparent_0,var(--shimmer-color)_var(--spread),transparent_var(--spread))]"})})}),c,p.jsx("div",{className:De("absolute inset-0 size-full","rounded-2xl px-4 py-1.5 text-sm font-medium","transform-gpu transition-all duration-300 ease-in-out",f==="dark"?"shadow-[inset_0_-8px_10px_#0000001f] group-hover:shadow-[inset_0_-6px_10px_#0000003f] group-active:shadow-[inset_0_-10px_10px_#0000003f]":"shadow-[inset_0_-8px_10px_#ffffff1f] group-hover:shadow-[inset_0_-6px_10px_#ffffff3f] group-active:shadow-[inset_0_-10px_10px_#ffffff3f]")}),p.jsx("div",{className:De("absolute [inset:var(--cut)] -z-20 [border-radius:var(--radius)] [background:var(--bg)]")})]})}FV.displayName="ShimmerButton";function Oz({status:t}){const e=s=>{switch(s){case"ready":return{color:"bg-emerald-500",ringColor:"ring-emerald-500",tooltip:"Connected"};case"failed":return{color:"bg-red-500",ringColor:"ring-red-500",tooltip:"Failed"};default:return{color:"bg-yellow-500",ringColor:"ring-yellow-500",tooltip:s}}},{color:r,ringColor:n,tooltip:a}=e(t);return p.jsxs(Sr,{children:[p.jsx(xr,{asChild:!0,children:p.jsxs("div",{className:"relative",children:[p.jsx("div",{className:`absolute w-2 h-2 rounded-full ${n} animate-ping`}),p.jsx("div",{className:`relative w-2 h-2 rounded-full ${r}`})]})}),p.jsx(wr,{children:p.jsx("p",{children:a})})]})}function Dz({connections:t,selectedServer:e,onServerSelect:r,onOpenConnectionOptions:n,mobileMode:a=!1}){const s=Ec(),l=c=>{const d=t.find(f=>f.id===c);if(!d||d.state!=="ready"){cr.error("Server is not connected and cannot be inspected");return}r(c)};return a?p.jsx("div",{className:"flex items-center gap-2",children:p.jsx("div",{className:"relative",children:p.jsxs(sT,{children:[p.jsx(lT,{asChild:!0,children:p.jsxs(Je,{variant:"ghost",className:"h-11 px-2 bg-black dark:bg-white text-white dark:text-black border-black dark:border-white hover:bg-gray-800 dark:hover:bg-zinc-100 hover:border-gray-800 dark:hover:border-zinc-200 flex items-center gap-1.5",children:[e?p.jsx(ms,{serverUrl:e.url,serverName:e.name,size:"md"}):p.jsx(ire,{className:"h-5 w-5"}),p.jsx(ZR,{className:"h-4 w-4"})]})}),p.jsxs(Nm,{className:"w-[calc(100vw-2rem)] sm:w-[300px]",align:"start",children:[p.jsx(cT,{className:"cursor-pointer hover:bg-zinc-100 dark:hover:bg-zinc-800",onClick:()=>s("/"),children:"MCP Servers"}),p.jsx(Lu,{}),t.length===0?p.jsx("div",{className:"px-2 py-4 text-sm text-muted-foreground dark:text-zinc-400 text-center",children:"No servers connected. Go to the dashboard to add one."}):t.map(c=>p.jsxs(Co,{onClick:()=>l(c.id),className:"flex items-center gap-3",children:[p.jsx(ms,{serverUrl:c.url,serverName:c.name,size:"sm"}),p.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[p.jsx("div",{className:"font-medium",children:c.name}),p.jsx(Oz,{status:c.state})]}),p.jsx(Je,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0 hover:bg-zinc-100 dark:hover:bg-zinc-800",onClick:d=>{d.stopPropagation(),n(c.id)},children:p.jsx(Hl,{className:"h-3 w-3"})})]},c.id)),p.jsx(Lu,{}),p.jsx(Co,{onClick:()=>s("/"),children:p.jsx("span",{className:"text-blue-600 dark:text-blue-400",children:"+ Add new server"})})]})]})})}):p.jsx("div",{className:"flex items-center gap-2",children:p.jsx("div",{className:"relative",children:p.jsxs(sT,{children:[p.jsx(lT,{asChild:!0,children:p.jsxs(FV,{className:De("min-w-0 sm:min-w-[200px] p-0 px-1 text-sm h-11 justify-start bg-black dark:bg-white text-white dark:text-black border-black dark:border-white hover:bg-gray-800 dark:hover:bg-zinc-100 hover:border-gray-800 dark:hover:border-zinc-200",!e&&"pl-4",e&&"pr-10"),children:[e&&p.jsx(ms,{serverUrl:e.url,serverName:e.name,size:"md",className:"mr-2"}),p.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[p.jsx("span",{className:"truncate",children:e?e.name:"Select server to inspect"}),e&&p.jsx("div",{className:"flex items-center gap-2",children:e.error&&e.state!=="ready"?p.jsxs(Sr,{children:[p.jsx(xr,{asChild:!0,children:p.jsx("button",{onClick:c=>{c.stopPropagation()},className:"w-2 h-2 rounded-full bg-rose-500 animate-status-pulse-red hover:bg-rose-600 transition-colors",title:"Click to copy error message","aria-label":"Copy error message to clipboard"})}),p.jsx(wr,{children:p.jsx("p",{className:"max-w-xs",children:e.error})})]}):p.jsx("div",{className:`w-2 h-2 rounded-full ${e.state==="ready"?"bg-emerald-600 animate-status-pulse":e.state==="failed"?"bg-rose-600 animate-status-pulse-red":"bg-yellow-500 animate-status-pulse-yellow"}`})})]})]})}),e&&p.jsxs(Sr,{children:[p.jsx(xr,{asChild:!0,children:p.jsx("button",{type:"button",onClick:()=>{n(e.id)},className:"absolute right-2 top-1/2 -translate-y-1/2 p-1.5 hover:bg-white/10 dark:hover:bg-black/10 rounded-full transition-colors text-white dark:text-black","aria-label":"Edit connection settings",children:p.jsx(Hl,{className:"h-4 w-4"})})}),p.jsx(wr,{children:p.jsx("p",{children:"Edit connection settings"})})]}),p.jsxs(Nm,{className:"w-[calc(100vw-2rem)] sm:w-[300px]",align:"start",children:[p.jsx(cT,{className:"cursor-pointer hover:bg-zinc-100 dark:hover:bg-zinc-800",onClick:()=>s("/"),children:"MCP Servers"}),p.jsx(Lu,{}),t.length===0?p.jsx("div",{className:"px-2 py-4 text-sm text-muted-foreground dark:text-zinc-400 text-center",children:"No servers connected. Go to the dashboard to add one."}):t.map(c=>p.jsxs(Co,{onClick:()=>l(c.id),className:"flex items-center gap-3",children:[p.jsx(ms,{serverUrl:c.url,serverName:c.name,size:"sm"}),p.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[p.jsx("div",{className:"font-medium",children:c.name}),p.jsx(Oz,{status:c.state})]}),p.jsx(Je,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0 hover:bg-zinc-100 dark:hover:bg-zinc-800",onClick:d=>{d.stopPropagation(),n(c.id)},children:p.jsx(Hl,{className:"h-3 w-3"})})]},c.id)),p.jsx(Lu,{}),p.jsx(Co,{onClick:()=>s("/"),children:p.jsx("span",{className:"text-blue-600 dark:text-blue-400",children:"+ Add new server"})})]})]})})})}const Lz=[{id:"tools",label:"Tools",icon:Rs},{id:"prompts",label:"Prompts",icon:yd},{id:"resources",label:"Resources",icon:Pte},{id:"chat",label:"Chat",icon:Wte}];function EEe({connections:t,selectedServer:e,activeTab:r,onServerSelect:n,onTabChange:a,onCommandPaletteOpen:s,onOpenConnectionOptions:l}){const{tunnelUrl:c}=tf(),d=e&&c,[f,h]=b.useState(!1),g=async()=>{if(c)try{await navigator.clipboard.writeText(`${c}/mcp`),h(!0),cr.success("Tunnel URL copied to clipboard"),setTimeout(()=>h(!1),2e3)}catch{cr.error("Failed to copy URL")}};return p.jsxs("header",{className:"w-full mx-auto",children:[p.jsxs("div",{className:"flex lg:hidden flex-col gap-3",children:[p.jsxs("div",{className:"flex items-center justify-between w-full",children:[p.jsx("div",{className:"flex-1 flex justify-start",children:p.jsx(Dz,{connections:t,selectedServer:e,onServerSelect:n,onOpenConnectionOptions:l,mobileMode:!0})}),p.jsx("div",{className:"flex-shrink-0 flex justify-center",children:p.jsx("div",{className:"scale-150",children:p.jsx(kz,{state:"collapsed"})})}),p.jsxs("div",{className:"flex-1 flex justify-end items-center gap-2",children:[p.jsxs(Sr,{children:[p.jsx(xr,{asChild:!0,children:p.jsx(Je,{variant:"ghost",size:"sm",asChild:!0,children:p.jsx("a",{href:"https://github.com/mcp-use/mcp-use",target:"_blank",rel:"noopener noreferrer",className:"p-2","aria-label":"GitHub",children:p.jsx(Az,{className:"h-4 w-4"})})})}),p.jsx(wr,{children:p.jsx("p",{children:"Give us a star ⭐"})})]}),p.jsx(Nz,{className:"p-2 hover:bg-zinc-200 dark:hover:bg-zinc-800 rounded-full transition-colors cursor-pointer"})]})]}),e&&p.jsx("div",{className:"w-full",children:p.jsx(JT,{value:r,onValueChange:v=>a(v),children:p.jsx(eR,{className:"w-full justify-center",children:Lz.map(v=>{let y=0;return v.id==="tools"?y=e.tools.length:v.id==="prompts"?y=e.prompts.length:v.id==="resources"&&(y=e.resources.length),p.jsxs(tR,{value:v.id,icon:v.icon,className:"[&>svg]:mr-0 flex-1 flex-row gap-2",children:[y>0&&p.jsx("span",{className:De(r===v.id?"dark:bg-black":"dark:bg-zinc-700","bg-zinc-200 text-zinc-700 dark:text-zinc-300 text-[10px] px-1.5 py-0.5 rounded-full font-medium"),children:y}),p.jsx("span",{className:"sr-only",children:v.label})]},v.id)})})})})]}),p.jsxs("div",{className:"hidden lg:flex items-center justify-between gap-3",children:[p.jsxs("div",{className:"flex items-center flex-wrap gap-2 md:space-x-6 space-x-2",children:[p.jsx(Dz,{connections:t,selectedServer:e,onServerSelect:n,onOpenConnectionOptions:l}),e&&p.jsx(JT,{value:r,onValueChange:v=>a(v),children:p.jsx(eR,{className:"overflow-x-auto",children:Lz.map(v=>{let y=0;return v.id==="tools"?y=e.tools.length:v.id==="prompts"?y=e.prompts.length:v.id==="resources"&&(y=e.resources.length),p.jsx(tR,{value:v.id,icon:v.icon,className:"[&>svg]:mr-0 lg:[&>svg]:mr-2",children:p.jsxs("div",{className:"items-center gap-2 hidden lg:flex",children:[v.label,y>0&&p.jsx("span",{className:De(r===v.id?" dark:bg-black ":"dark:bg-zinc-700","bg-zinc-200 text-zinc-700 dark:text-zinc-300 text-xs px-2 py-0.5 rounded-full font-medium"),children:y})]})},v.id)})})}),d&&p.jsxs(gEe,{children:[p.jsx(vEe,{asChild:!0,children:p.jsxs("button",{className:"flex items-center gap-2 px-3 py-1.5 bg-gradient-to-r from-purple-500/10 to-pink-500/10 dark:from-purple-500/20 dark:to-pink-500/20 border border-purple-500/30 dark:border-purple-500/40 rounded-full hover:from-purple-500/20 hover:to-pink-500/20 dark:hover:from-purple-500/30 dark:hover:to-pink-500/30 transition-colors cursor-pointer",children:[p.jsx(Ed,{className:"size-4 text-purple-600 dark:text-purple-400 animate-pulse"}),p.jsx("span",{className:"text-xs font-medium text-purple-700 dark:text-purple-300 hidden lg:inline",children:"Tunnel"})]})}),p.jsx(MV,{className:"w-[calc(100vw-2rem)] sm:w-96",align:"start",children:p.jsxs("div",{className:"space-y-4",children:[p.jsxs("div",{children:[p.jsxs("h4",{className:"font-semibold text-sm mb-2 flex items-center gap-2",children:[p.jsx(Ed,{className:"size-4 text-purple-600 dark:text-purple-400"}),"Tunnel URL"]}),p.jsxs("div",{className:"flex items-center gap-2 p-2 py-0 bg-muted rounded-full",children:[p.jsxs("code",{className:"flex-1 text-[10px] font-mono",children:[c,"/mcp"]}),p.jsx(Je,{variant:"ghost",size:"sm",className:"h-7 px-2",onClick:g,children:f?p.jsx(Mo,{className:"size-3.5 text-green-600"}):p.jsx($n,{className:"size-3.5"})})]})]}),p.jsxs("div",{children:[p.jsx("h5",{className:"font-semibold text-sm mb-2",children:"Use in ChatGPT"}),p.jsxs("ol",{className:"space-y-2 text-xs text-muted-foreground",children:[p.jsxs("li",{className:"flex gap-2",children:[p.jsx("span",{className:"font-semibold text-foreground",children:"1."}),p.jsxs("span",{children:["Enable"," ",p.jsx("span",{className:"font-medium text-foreground",children:"dev mode"})," ","from settings"]})]}),p.jsxs("li",{className:"flex gap-2",children:[p.jsx("span",{className:"font-semibold text-foreground",children:"2."}),p.jsxs("span",{children:["In"," ",p.jsx("span",{className:"font-medium text-foreground",children:"App & Connectors"})," ","click on"," ",p.jsx("span",{className:"font-medium text-foreground",children:"create"})]})]}),p.jsxs("li",{className:"flex gap-2",children:[p.jsx("span",{className:"font-semibold text-foreground",children:"3."}),p.jsx("span",{children:"Use the tunnel URL in the input"})]})]})]})]})})]})]}),p.jsxs("div",{className:"flex items-center gap-2 sm:gap-4 flex-shrink-0",children:[p.jsxs(Sr,{children:[p.jsx(xr,{children:p.jsx(Nz,{className:"p-2 hover:bg-zinc-200 dark:hover:bg-zinc-800 rounded-full transition-colors cursor-pointer"})}),p.jsx(wr,{children:p.jsx("p",{children:"Toggle theme"})})]}),p.jsxs(Sr,{children:[p.jsx(xr,{asChild:!0,children:p.jsxs(Je,{variant:"ghost",className:"hover:bg-zinc-200 dark:hover:bg-zinc-800 rounded-full px-1 -mx-3 flex gap-1",onClick:s,children:[p.jsx(bte,{className:"size-4"}),p.jsx("span",{className:"text-base font-mono hidden sm:inline",children:"K"})]})}),p.jsx(wr,{children:p.jsx("p",{children:"Command Palette"})})]}),p.jsxs(Sr,{children:[p.jsx(xr,{asChild:!0,children:p.jsx(Je,{variant:"ghost",size:"sm",asChild:!0,children:p.jsxs("a",{href:"https://github.com/mcp-use/mcp-use",className:"flex items-center gap-2",target:"_blank",rel:"noopener noreferrer",children:[p.jsx(Az,{className:"h-4 w-4"}),p.jsx("span",{className:"hidden sm:inline",children:"Github"})]})})}),p.jsx(wr,{children:p.jsx("p",{children:"Give us a star ⭐"})})]}),p.jsx(kz,{state:"expanded"})]})]})]})}function SEe({children:t}){const e=Ec(),r=zo(),{connections:n,addConnection:a,removeConnection:s,updateConnectionConfig:l}=KR(),{selectedServerId:c,setSelectedServerId:d,activeTab:f,setActiveTab:h,navigateToItem:g,setTunnelUrl:v}=tf(),[y,w]=b.useState(!1),[S,T]=b.useState(null),x=Lle();b.useEffect(()=>{const B=new URLSearchParams(r.search).get("tunnelUrl");v(B)},[r.search,v]);const _=b.useRef(null),C=b.useRef(null),N=b.useRef(null),{isAutoConnecting:k}=Dle({connections:n,addConnection:a,removeConnection:s}),A=b.useCallback(J=>{zr.getInstance().capture(new Gee({trigger:J})).catch(()=>{}),w(!0)},[]),I=J=>{const B=n.find(Q=>Q.id===J);if(!B||B.state!=="ready"){cr.error("Server is not connected and cannot be inspected");return}d(J);const H=new URLSearchParams(r.search).get("tunnelUrl"),re=H?`/?server=${encodeURIComponent(J)}&tunnelUrl=${encodeURIComponent(H)}`:`/?server=${encodeURIComponent(J)}`;e(re)},O=b.useCallback(J=>{T(J)},[]),L=b.useCallback(J=>{S&&(J.url!==S?(s(S),a(J.url,J.name,J.proxyConfig,J.transportType)):l(S,{name:J.name,proxyConfig:J.proxyConfig,transportType:J.transportType}),T(null),cr.success("Connection settings updated"))},[S,s,a,l]),M=(J,B,Y)=>{if(console.warn("[Layout] handleCommandPaletteNavigate called:",{tab:J,itemName:B,serverId:Y}),Y){const H=n.find(q=>q.id===Y);if(console.warn("[Layout] Server lookup:",{serverId:Y,serverFound:!!H,serverState:H?.state}),!H||H.state!=="ready"){console.warn("[Layout] Server not ready, showing error"),cr.error("Server is not connected and cannot be inspected");return}console.warn("[Layout] Calling navigateToItem:",{serverId:Y,tab:J,itemName:B}),g(Y,J,B);const Q=new URLSearchParams(r.search).get("tunnelUrl"),j=Q?`/?server=${encodeURIComponent(Y)}&tunnelUrl=${encodeURIComponent(Q)}`:`/?server=${encodeURIComponent(Y)}`;console.warn("[Layout] Navigating to:",j),e(j)}else console.warn("[Layout] No serverId, just updating tab to:",J),h(J)},P=n.find(J=>J.id===c),W=P?P.tools.map(J=>({...J,_serverId:P.id})):n.flatMap(J=>J.state==="ready"?J.tools.map(B=>({...B,_serverId:J.id,_serverName:J.name})):[]),X=P?P.prompts.map(J=>({...J,_serverId:P.id})):n.flatMap(J=>J.state==="ready"?J.prompts.map(B=>({...B,_serverId:J.id,_serverName:J.name})):[]),ee=P?P.resources.map(J=>({...J,_serverId:P.id})):n.flatMap(J=>J.state==="ready"?J.resources.map(B=>({...B,_serverId:J.id,_serverName:J.name})):[]);return b.useEffect(()=>{const B=new URLSearchParams(r.search).get("server"),Y=B?decodeURIComponent(B):null;Y!==c&&d(Y)},[r.search,c,d]),b.useEffect(()=>{const B=new URLSearchParams(r.search).get("server");if(!B)return;const Y=decodeURIComponent(B),H=n.find(re=>re.id===Y);if(!H){const re=setTimeout(()=>e("/"),3e3);return()=>clearTimeout(re)}if(H.state==="failed"){const re=setTimeout(()=>e("/"),2e3);return()=>clearTimeout(re)}},[r.search,e,n]),B5({onCommandPalette:()=>A("keyboard"),onToolsTab:()=>{P&&h("tools")},onPromptsTab:()=>{P&&h("prompts")},onResourcesTab:()=>{P&&h("resources")},onChatTab:()=>{P&&h("chat")},onHome:()=>{e("/")},onFocusSearch:()=>{f==="tools"&&_.current?_.current.focusSearch():f==="prompts"&&C.current?C.current.focusSearch():f==="resources"&&N.current&&N.current.focusSearch()},onBlurSearch:()=>{f==="tools"&&_.current?_.current.blurSearch():f==="prompts"&&C.current?C.current.blurSearch():f==="resources"&&N.current&&N.current.blurSearch()}}),k?p.jsx("div",{className:"h-screen bg-white dark:bg-zinc-900 flex items-center justify-center",children:p.jsxs("div",{className:"flex flex-col items-center gap-4",children:[p.jsx(Uo,{className:"h-8 w-8 text-zinc-600 dark:text-zinc-400"}),p.jsx("p",{className:"text-sm text-zinc-600 dark:text-zinc-400",children:"Connecting to MCP server..."})]})}):p.jsx(a3,{children:p.jsxs("div",{className:"h-screen bg-[#f3f3f3] dark:bg-black flex flex-col px-2 py-2 sm:px-4 sm:py-4 gap-2 sm:gap-4",children:[p.jsx(EEe,{connections:n,selectedServer:P,activeTab:f,onServerSelect:I,onTabChange:h,onCommandPaletteOpen:()=>A("button"),onOpenConnectionOptions:O}),p.jsx("main",{className:"flex-1 w-full mx-auto bg-white dark:bg-black rounded-2xl border border-zinc-200 dark:border-zinc-700 p-0 overflow-auto",children:p.jsx(rEe,{selectedServer:P,activeTab:f,toolsSearchRef:_,promptsSearchRef:C,resourcesSearchRef:N,children:t})}),p.jsx(sce,{isOpen:y,onOpenChange:w,tools:W,prompts:X,resources:ee,savedRequests:x,connections:n,onNavigate:M,onServerSelect:I}),p.jsx(oq,{connection:S&&n.find(J=>J.id===S)||null,open:S!==null,onOpenChange:J=>{J||T(null)},onConnect:L})]})})}var xEe=(t,e,r,n,a,s,l,c)=>{let d=document.documentElement,f=["light","dark"];function h(y){(Array.isArray(t)?t:[t]).forEach(w=>{let S=w==="class",T=S&&s?a.map(x=>s[x]||x):a;S?(d.classList.remove(...T),d.classList.add(s&&s[y]?s[y]:y)):d.setAttribute(w,y)}),g(y)}function g(y){c&&f.includes(y)&&(d.style.colorScheme=y)}function v(){return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}if(n)h(n);else try{let y=localStorage.getItem(e)||r,w=l&&y==="system"?v():y;h(w)}catch{}},wEe=b.createContext(void 0),_Ee={setTheme:t=>{},themes:[]},TEe=()=>{var t;return(t=b.useContext(wEe))!=null?t:_Ee};b.memo(({forcedTheme:t,storageKey:e,attribute:r,enableSystem:n,enableColorScheme:a,defaultTheme:s,value:l,themes:c,nonce:d,scriptProps:f})=>{let h=JSON.stringify([r,e,s,t,c,l,n,a]).slice(1,-1);return b.createElement("script",{...f,suppressHydrationWarning:!0,nonce:typeof window>"u"?d:"",dangerouslySetInnerHTML:{__html:`(${xEe.toString()})(${h})`}})});function REe({...t}){const{theme:e="system"}=TEe();return p.jsx(Wre,{theme:e,className:"toaster group",style:{"--normal-bg":"var(--popover)","--normal-text":"var(--popover-foreground)","--normal-border":"var(--border)"},...t})}function CEe(){return p.jsx(dbe,{children:p.jsx(Zee,{children:p.jsxs(Ole,{children:[p.jsx(XY,{basename:"/inspector",children:p.jsx(SEe,{children:p.jsx(AY,{children:p.jsx(U$,{path:"/",element:p.jsx(Ile,{})})})})}),p.jsx(REe,{position:"top-center"})]})})})}const Mz=new URLSearchParams(window.location.search);if(Mz.has("code")||Mz.has("error"))try{T$()}catch(t){console.error("[inspector] OAuth callback error:",t)}const Pz=document.getElementById("root");Pz?U7.createRoot(Pz).render(p.jsx(CEe,{})):console.error("[inspector] Root element not found");export{$z as B,mO as H,zz as L,g7 as M,E7 as W,ct as Z,Qe as _,T9 as a,NEe as b,Ie as c,Pr as d,Ze as e,OEe as f,hc as g,_9 as h,_t as i,IEe as j,DEe as k,mt as l,Io as m,$r as n,Pe as o,LEe as p,kEe as q,Ld as r,be as s,Me as t,dn as u,f7 as v,ds as w,K_ as x,x7 as y,T$ as z};
|