xmcp 1.4.1 → 1.5.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.js ADDED
@@ -0,0 +1,77 @@
1
+ (()=>{var e,t,r={6507(e,t,r){"use strict";let o=r(5317),a=r(8388),i=r(442);function s(e,t,r){let s=a(e,t,r),n=o.spawn(s.command,s.args,s.options);return i.hookChildProcess(n,s),n}e.exports=s,e.exports.spawn=s,e.exports.sync=function(e,t,r){let s=a(e,t,r),n=o.spawnSync(s.command,s.args,s.options);return n.error=n.error||i.verifyENOENTSync(n.status,s),n},e.exports._parse=a,e.exports._enoent=i},442(e){"use strict";let t="win32"===process.platform;function r(e,t){return Object.assign(Error(`${t} ${e.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${t} ${e.command}`,path:e.command,spawnargs:e.args})}function o(e,o){return t&&1===e&&!o.file?r(o.original,"spawn"):null}e.exports={hookChildProcess:function(e,r){if(!t)return;let a=e.emit;e.emit=function(t,i){if("exit"===t){let t=o(i,r);if(t)return a.call(e,"error",t)}return a.apply(e,arguments)}},verifyENOENT:o,verifyENOENTSync:function(e,o){return t&&1===e&&!o.file?r(o.original,"spawnSync"):null},notFoundError:r}},8388(e,t,r){"use strict";let o=r(6928),a=r(3803),i=r(2077),s=r(1880),n="win32"===process.platform,l=/\.(?:com|exe)$/i,c=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;e.exports=function(e,t,r){t&&!Array.isArray(t)&&(r=t,t=null);let u={command:e,args:t=t?t.slice(0):[],options:r=Object.assign({},r),file:void 0,original:{command:e,args:t}};return r.shell?u:function(e){let t;if(!n)return e;let r=(e.file=a(e),(t=e.file&&s(e.file))?(e.args.unshift(e.file),e.command=t,a(e)):e.file),u=!l.test(r);if(e.options.forceShell||u){let t=c.test(r);e.command=o.normalize(e.command),e.command=i.command(e.command),e.args=e.args.map(e=>i.argument(e,t));let a=[e.command].concat(e.args).join(" ");e.args=["/d","/s","/c",`"${a}"`],e.command=process.env.comspec||"cmd.exe",e.options.windowsVerbatimArguments=!0}return e}(u)}},2077(e){"use strict";let t=/([()\][%!^"`<>&|;, *?])/g;e.exports.command=function(e){return e.replace(t,"^$1")},e.exports.argument=function(e,r){return e=(e=(e=`${e}`).replace(/(?=(\\+?)?)\1"/g,'$1$1\\"')).replace(/(?=(\\+?)?)\1$/,"$1$1"),e=(e=`"${e}"`).replace(t,"^$1"),r&&(e=e.replace(t,"^$1")),e}},1880(e,t,r){"use strict";let o=r(9896),a=r(600);e.exports=function(e){let t,r=Buffer.alloc(150);try{t=o.openSync(e,"r"),o.readSync(t,r,0,150,0),o.closeSync(t)}catch(e){}return a(r.toString())}},3803(e,t,r){"use strict";let o=r(6928),a=r(1905),i=r(9695);function s(e,t){let r,s=e.options.env||process.env,n=process.cwd(),l=null!=e.options.cwd,c=l&&void 0!==process.chdir&&!process.chdir.disabled;if(c)try{process.chdir(e.options.cwd)}catch(e){}try{r=a.sync(e.command,{path:s[i({env:s})],pathExt:t?o.delimiter:void 0})}catch(e){}finally{c&&process.chdir(n)}return r&&(r=o.resolve(l?e.options.cwd:"",r)),r}e.exports=function(e){return s(e)||s(e,!0)}},9344(e,t,r){var o;function a(e,t,r){if("function"==typeof t&&(r=t,t={}),!r){if("function"!=typeof Promise)throw TypeError("callback not provided");return new Promise(function(r,o){a(e,t||{},function(e,t){e?o(e):r(t)})})}o(e,t||{},function(e,o){e&&("EACCES"===e.code||t&&t.ignoreErrors)&&(e=null,o=!1),r(e,o)})}r(9896),o="win32"===process.platform||global.TESTING_WINDOWS?r(8541):r(709),e.exports=a,a.sync=function(e,t){try{return o.sync(e,t||{})}catch(e){if(t&&t.ignoreErrors||"EACCES"===e.code)return!1;throw e}}},709(e,t,r){e.exports=a,a.sync=function(e,t){return i(o.statSync(e),t)};var o=r(9896);function a(e,t,r){o.stat(e,function(e,o){r(e,!e&&i(o,t))})}function i(e,t){var r,o,a,i,s,n,l,c,u;return e.isFile()&&(r=e,o=t,a=r.mode,i=r.uid,s=r.gid,n=void 0!==o.uid?o.uid:process.getuid&&process.getuid(),l=void 0!==o.gid?o.gid:process.getgid&&process.getgid(),c=parseInt("100",8),u=parseInt("010",8),a&parseInt("001",8)||a&u&&s===l||a&c&&i===n||a&(c|u)&&0===n)}},8541(e,t,r){e.exports=i,i.sync=function(e,t){return a(o.statSync(e),e,t)};var o=r(9896);function a(e,t,r){if(!e.isSymbolicLink()&&!e.isFile())return!1;var o=void 0!==r.pathExt?r.pathExt:process.env.PATHEXT;if(!o||-1!==(o=o.split(";")).indexOf(""))return!0;for(var a=0;a<o.length;a++){var i=o[a].toLowerCase();if(i&&t.substr(-i.length).toLowerCase()===i)return!0}return!1}function i(e,t,r){o.stat(e,function(o,i){r(o,!o&&a(i,e,t))})}},9695(e){"use strict";let t=(e={})=>{let t=e.env||process.env;return"win32"!==(e.platform||process.platform)?"PATH":Object.keys(t).reverse().find(e=>"PATH"===e.toUpperCase())||"Path"};e.exports=t,e.exports.default=t},600(e,t,r){"use strict";let o=r(9638);e.exports=(e="")=>{let t=e.match(o);if(!t)return null;let[r,a]=t[0].replace(/#! ?/,"").split(" "),i=r.split("/").pop();return"env"===i?a:a?`${i} ${a}`:i}},9638(e){"use strict";e.exports=/^#!(.*)/},1905(e,t,r){let o="win32"===process.platform||"cygwin"===process.env.OSTYPE||"msys"===process.env.OSTYPE,a=r(6928),i=o?";":":",s=r(9344),n=e=>Object.assign(Error(`not found: ${e}`),{code:"ENOENT"}),l=(e,t)=>{let r=t.colon||i,a=e.match(/\//)||o&&e.match(/\\/)?[""]:[...o?[process.cwd()]:[],...(t.path||process.env.PATH||"").split(r)],s=o?t.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",n=o?s.split(r):[""];return o&&-1!==e.indexOf(".")&&""!==n[0]&&n.unshift(""),{pathEnv:a,pathExt:n,pathExtExe:s}},c=(e,t,r)=>{"function"==typeof t&&(r=t,t={}),t||(t={});let{pathEnv:o,pathExt:i,pathExtExe:c}=l(e,t),u=[],d=r=>new Promise((i,s)=>{if(r===o.length)return t.all&&u.length?i(u):s(n(e));let l=o[r],c=/^".*"$/.test(l)?l.slice(1,-1):l,d=a.join(c,e);i(p(!c&&/^\.[\\\/]/.test(e)?e.slice(0,2)+d:d,r,0))}),p=(e,r,o)=>new Promise((a,n)=>{if(o===i.length)return a(d(r+1));let l=i[o];s(e+l,{pathExt:c},(i,s)=>{if(!i&&s)if(!t.all)return a(e+l);else u.push(e+l);return a(p(e,r,o+1))})});return r?d(0).then(e=>r(null,e),r):d(0)};e.exports=c,c.sync=(e,t)=>{let{pathEnv:r,pathExt:o,pathExtExe:i}=l(e,t=t||{}),c=[];for(let n=0;n<r.length;n++){let l=r[n],u=/^".*"$/.test(l)?l.slice(1,-1):l,d=a.join(u,e),p=!u&&/^\.[\\\/]/.test(e)?e.slice(0,2)+d:d;for(let e=0;e<o.length;e++){let r=p+o[e];try{if(s.sync(r,{pathExt:i}))if(!t.all)return r;else c.push(r)}catch(e){}}}if(t.all&&c.length)return c;if(t.nothrow)return null;throw n(e)}},5317(e){"use strict";e.exports=require("child_process")},9896(e){"use strict";e.exports=require("fs")},7598(e){"use strict";e.exports=require("node:crypto")},6928(e){"use strict";e.exports=require("path")},4891(e,t,r){"use strict";let o;r.d(t,{importJWK:()=>W,importPKCS8:()=>Z,SignJWT:()=>D});let a=new TextEncoder,i=new TextDecoder;function s(e){let t=new Uint8Array(e.length);for(let r=0;r<e.length;r++){let o=e.charCodeAt(r);if(o>127)throw TypeError("non-ASCII string encountered in encode()");t[r]=o}return t}function n(e){if(Uint8Array.fromBase64)return Uint8Array.fromBase64(e);let t=atob(e),r=new Uint8Array(t.length);for(let e=0;e<t.length;e++)r[e]=t.charCodeAt(e);return r}function l(e){if(Uint8Array.fromBase64)return Uint8Array.fromBase64("string"==typeof e?e:i.decode(e),{alphabet:"base64url"});let t=e;t instanceof Uint8Array&&(t=i.decode(t)),t=t.replace(/-/g,"+").replace(/_/g,"/");try{return n(t)}catch{throw TypeError("The input to be decoded is not correctly encoded.")}}function c(e){let t=e;return("string"==typeof t&&(t=a.encode(t)),Uint8Array.prototype.toBase64)?t.toBase64({alphabet:"base64url",omitPadding:!0}):(function(e){if(Uint8Array.prototype.toBase64)return e.toBase64();let t=[];for(let r=0;r<e.length;r+=32768)t.push(String.fromCharCode.apply(null,e.subarray(r,r+32768)));return btoa(t.join(""))})(t).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}class u extends Error{static code="ERR_JOSE_GENERIC";code="ERR_JOSE_GENERIC";constructor(e,t){super(e,t),this.name=this.constructor.name,Error.captureStackTrace?.(this,this.constructor)}}class d extends u{static code="ERR_JOSE_NOT_SUPPORTED";code="ERR_JOSE_NOT_SUPPORTED"}class p extends u{static code="ERR_JWS_INVALID";code="ERR_JWS_INVALID"}class h extends u{static code="ERR_JWT_INVALID";code="ERR_JWT_INVALID"}class m extends u{[Symbol.asyncIterator];static code="ERR_JWKS_MULTIPLE_MATCHING_KEYS";code="ERR_JWKS_MULTIPLE_MATCHING_KEYS";constructor(e="multiple matching keys found in the JSON Web Key Set",t){super(e,t)}}let f=(e,t="algorithm.name")=>TypeError(`CryptoKey does not support this operation, its ${t} must be ${e}`);function y(e,t){if(parseInt(e.hash.name.slice(4),10)!==t)throw f(`SHA-${t}`,"algorithm.hash")}function g(e,t,...r){if((r=r.filter(Boolean)).length>2){let t=r.pop();e+=`one of type ${r.join(", ")}, or ${t}.`}else 2===r.length?e+=`one of type ${r[0]} or ${r[1]}.`:e+=`of type ${r[0]}.`;return null==t?e+=` Received ${t}`:"function"==typeof t&&t.name?e+=` Received function ${t.name}`:"object"==typeof t&&null!=t&&t.constructor?.name&&(e+=` Received an instance of ${t.constructor.name}`),e}let v=(e,t,...r)=>g(`Key for the ${e} algorithm must be `,t,...r);async function _(e,t,r){if(t instanceof Uint8Array){if(!e.startsWith("HS"))throw TypeError(((e,...t)=>g("Key must be ",e,...t))(t,"CryptoKey","KeyObject","JSON Web Key"));return crypto.subtle.importKey("raw",t,{hash:`SHA-${e.slice(-3)}`,name:"HMAC"},!1,[r])}return!function(e,t,r){switch(t){case"HS256":case"HS384":case"HS512":if("HMAC"!==e.algorithm.name)throw f("HMAC");y(e.algorithm,parseInt(t.slice(2),10));break;case"RS256":case"RS384":case"RS512":if("RSASSA-PKCS1-v1_5"!==e.algorithm.name)throw f("RSASSA-PKCS1-v1_5");y(e.algorithm,parseInt(t.slice(2),10));break;case"PS256":case"PS384":case"PS512":if("RSA-PSS"!==e.algorithm.name)throw f("RSA-PSS");y(e.algorithm,parseInt(t.slice(2),10));break;case"Ed25519":case"EdDSA":if("Ed25519"!==e.algorithm.name)throw f("Ed25519");break;case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":let o;if(o=e.algorithm,o.name!==t)throw f(t);break;case"ES256":case"ES384":case"ES512":{if("ECDSA"!==e.algorithm.name)throw f("ECDSA");let r=function(e){switch(e){case"ES256":return"P-256";case"ES384":return"P-384";case"ES512":return"P-521";default:throw Error("unreachable")}}(t);if(e.algorithm.namedCurve!==r)throw f(r,"algorithm.namedCurve");break}default:throw TypeError("CryptoKey does not support this operation")}if(r&&!e.usages.includes(r))throw TypeError(`CryptoKey does not support this operation, its usages must include ${r}.`)}(t,e,r),t}async function b(e,t,r){let o=await _(e,t,"sign");return!function(e,t){if(e.startsWith("RS")||e.startsWith("PS")){let{modulusLength:r}=t.algorithm;if("number"!=typeof r||r<2048)throw TypeError(`${e} requires key modulusLength to be 2048 bits or larger`)}}(e,o),new Uint8Array(await crypto.subtle.sign(function(e,t){let r=`SHA-${e.slice(-3)}`;switch(e){case"HS256":case"HS384":case"HS512":return{hash:r,name:"HMAC"};case"PS256":case"PS384":case"PS512":return{hash:r,name:"RSA-PSS",saltLength:parseInt(e.slice(-3),10)>>3};case"RS256":case"RS384":case"RS512":return{hash:r,name:"RSASSA-PKCS1-v1_5"};case"ES256":case"ES384":case"ES512":return{hash:r,name:"ECDSA",namedCurve:t.namedCurve};case"Ed25519":case"EdDSA":return{name:"Ed25519"};case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":return{name:e};default:throw new d(`alg ${e} is not supported either by JOSE or your javascript runtime`)}}(e,o.algorithm),o,r))}function S(e){if("object"!=typeof e||null===e||"[object Object]"!==Object.prototype.toString.call(e))return!1;if(null===Object.getPrototypeOf(e))return!0;let t=e;for(;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}let w=e=>S(e)&&"string"==typeof e.kty,$=e=>{if(e?.[Symbol.toStringTag]==="CryptoKey")return!0;try{return e instanceof CryptoKey}catch{return!1}},R=e=>e?.[Symbol.toStringTag]==="KeyObject",P=e=>$(e)||R(e),E=e=>e?.[Symbol.toStringTag],k=(e,t,r)=>{if(void 0!==t.use){let e;switch(r){case"sign":case"verify":e="sig";break;case"encrypt":case"decrypt":e="enc"}if(t.use!==e)throw TypeError(`Invalid key for this operation, its "use" must be "${e}" when present`)}if(void 0!==t.alg&&t.alg!==e)throw TypeError(`Invalid key for this operation, its "alg" must be "${e}" when present`);if(Array.isArray(t.key_ops)){let o;switch(!0){case"sign"===r||"verify"===r:case"dir"===e:case e.includes("CBC-HS"):o=r;break;case e.startsWith("PBES2"):o="deriveBits";break;case/^A\d{3}(?:GCM)?(?:KW)?$/.test(e):o=!e.includes("GCM")&&e.endsWith("KW")?"encrypt"===r?"wrapKey":"unwrapKey":r;break;case"encrypt"===r&&e.startsWith("RSA"):o="wrapKey";break;case"decrypt"===r:o=e.startsWith("RSA")?"unwrapKey":"deriveBits"}if(o&&t.key_ops?.includes?.(o)===!1)throw TypeError(`Invalid key for this operation, its "key_ops" must include "${o}" when present`)}return!0},x='Invalid or unsupported JWK "alg" (Algorithm) Parameter value';async function T(e){if(!e.alg)throw TypeError('"alg" argument is required when "jwk.alg" is not present');let{algorithm:t,keyUsages:r}=function(e){let t,r;switch(e.kty){case"AKP":switch(e.alg){case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":t={name:e.alg},r=e.priv?["sign"]:["verify"];break;default:throw new d(x)}break;case"RSA":switch(e.alg){case"PS256":case"PS384":case"PS512":t={name:"RSA-PSS",hash:`SHA-${e.alg.slice(-3)}`},r=e.d?["sign"]:["verify"];break;case"RS256":case"RS384":case"RS512":t={name:"RSASSA-PKCS1-v1_5",hash:`SHA-${e.alg.slice(-3)}`},r=e.d?["sign"]:["verify"];break;case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":t={name:"RSA-OAEP",hash:`SHA-${parseInt(e.alg.slice(-3),10)||1}`},r=e.d?["decrypt","unwrapKey"]:["encrypt","wrapKey"];break;default:throw new d(x)}break;case"EC":switch(e.alg){case"ES256":case"ES384":case"ES512":t={name:"ECDSA",namedCurve:({ES256:"P-256",ES384:"P-384",ES512:"P-521"})[e.alg]},r=e.d?["sign"]:["verify"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":t={name:"ECDH",namedCurve:e.crv},r=e.d?["deriveBits"]:[];break;default:throw new d(x)}break;case"OKP":switch(e.alg){case"Ed25519":case"EdDSA":t={name:"Ed25519"},r=e.d?["sign"]:["verify"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":t={name:e.crv},r=e.d?["deriveBits"]:[];break;default:throw new d(x)}break;default:throw new d('Invalid or unsupported JWK "kty" (Key Type) Parameter value')}return{algorithm:t,keyUsages:r}}(e),o={...e};return"AKP"!==o.kty&&delete o.alg,delete o.use,crypto.subtle.importKey("jwk",o,t,e.ext??(!e.d&&!e.priv),e.key_ops??r)}let C="given KeyObject instance cannot be used for this algorithm",O=async(e,t,r,a=!1)=>{let i=(o||=new WeakMap).get(e);if(i?.[r])return i[r];let s=await T({...t,alg:r});return a&&Object.freeze(e),i?i[r]=s:o.set(e,{[r]:s}),s};async function j(e,t){if(e instanceof Uint8Array||$(e))return e;if(R(e)){if("secret"===e.type)return e.export();if("toCryptoKey"in e&&"function"==typeof e.toCryptoKey)try{return((e,t)=>{let r,a=(o||=new WeakMap).get(e);if(a?.[t])return a[t];let i="public"===e.type,s=!!i;if("x25519"===e.asymmetricKeyType){switch(t){case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":break;default:throw TypeError(C)}r=e.toCryptoKey(e.asymmetricKeyType,s,i?[]:["deriveBits"])}if("ed25519"===e.asymmetricKeyType){if("EdDSA"!==t&&"Ed25519"!==t)throw TypeError(C);r=e.toCryptoKey(e.asymmetricKeyType,s,[i?"verify":"sign"])}switch(e.asymmetricKeyType){case"ml-dsa-44":case"ml-dsa-65":case"ml-dsa-87":if(t!==e.asymmetricKeyType.toUpperCase())throw TypeError(C);r=e.toCryptoKey(e.asymmetricKeyType,s,[i?"verify":"sign"])}if("rsa"===e.asymmetricKeyType){let o;switch(t){case"RSA-OAEP":o="SHA-1";break;case"RS256":case"PS256":case"RSA-OAEP-256":o="SHA-256";break;case"RS384":case"PS384":case"RSA-OAEP-384":o="SHA-384";break;case"RS512":case"PS512":case"RSA-OAEP-512":o="SHA-512";break;default:throw TypeError(C)}if(t.startsWith("RSA-OAEP"))return e.toCryptoKey({name:"RSA-OAEP",hash:o},s,i?["encrypt"]:["decrypt"]);r=e.toCryptoKey({name:t.startsWith("PS")?"RSA-PSS":"RSASSA-PKCS1-v1_5",hash:o},s,[i?"verify":"sign"])}if("ec"===e.asymmetricKeyType){let o=new Map([["prime256v1","P-256"],["secp384r1","P-384"],["secp521r1","P-521"]]).get(e.asymmetricKeyDetails?.namedCurve);if(!o)throw TypeError(C);let a={ES256:"P-256",ES384:"P-384",ES512:"P-521"};a[t]&&o===a[t]&&(r=e.toCryptoKey({name:"ECDSA",namedCurve:o},s,[i?"verify":"sign"])),t.startsWith("ECDH-ES")&&(r=e.toCryptoKey({name:"ECDH",namedCurve:o},s,i?[]:["deriveBits"]))}if(!r)throw TypeError(C);return a?a[t]=r:o.set(e,{[t]:r}),r})(e,t)}catch(e){if(e instanceof TypeError)throw e}let r=e.export({format:"jwk"});return O(e,r,t)}if(w(e))return e.k?l(e.k):O(e,e,t,!0);throw Error("unreachable")}function I(e,t){if(e)throw TypeError(`${t} can only be called once`)}Symbol();class N{#e;#t;#r;constructor(e){if(!(e instanceof Uint8Array))throw TypeError("payload must be an instance of Uint8Array");this.#e=e}setProtectedHeader(e){return I(this.#t,"setProtectedHeader"),this.#t=e,this}setUnprotectedHeader(e){return I(this.#r,"setUnprotectedHeader"),this.#r=e,this}async sign(e,t){let r,o,a,i;if(!this.#t&&!this.#r)throw new p("either setProtectedHeader or setUnprotectedHeader must be called before #sign()");if(!function(...e){let t,r=e.filter(Boolean);if(0===r.length||1===r.length)return!0;for(let e of r){let r=Object.keys(e);if(!t||0===t.size){t=new Set(r);continue}for(let e of r){if(t.has(e))return!1;t.add(e)}}return!0}(this.#t,this.#r))throw new p("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");let n={...this.#t,...this.#r},l=function(e,t,r,o,a){let i;if(void 0!==a.crit&&o?.crit===void 0)throw new e('"crit" (Critical) Header Parameter MUST be integrity protected');if(!o||void 0===o.crit)return new Set;if(!Array.isArray(o.crit)||0===o.crit.length||o.crit.some(e=>"string"!=typeof e||0===e.length))throw new e('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present');for(let s of(i=void 0!==r?new Map([...Object.entries(r),...t.entries()]):t,o.crit)){if(!i.has(s))throw new d(`Extension Header Parameter "${s}" is not recognized`);if(void 0===a[s])throw new e(`Extension Header Parameter "${s}" is missing`);if(i.get(s)&&void 0===o[s])throw new e(`Extension Header Parameter "${s}" MUST be integrity protected`)}return new Set(o.crit)}(p,new Map([["b64",!0]]),t?.crit,this.#t,n),u=!0;if(l.has("b64")&&"boolean"!=typeof(u=this.#t.b64))throw new p('The "b64" (base64url-encode payload) Header Parameter must be a boolean');let{alg:h}=n;if("string"!=typeof h||!h)throw new p('JWS "alg" (Algorithm) Header Parameter missing or invalid');var m="sign";switch(h.substring(0,2)){case"A1":case"A2":case"di":case"HS":case"PB":((e,t,r)=>{if(!(t instanceof Uint8Array)){if(w(t)){if("oct"===t.kty&&"string"==typeof t.k&&k(e,t,r))return;throw TypeError('JSON Web Key for symmetric algorithms must have JWK "kty" (Key Type) equal to "oct" and the JWK "k" (Key Value) present')}if(!P(t))throw TypeError(v(e,t,"CryptoKey","KeyObject","JSON Web Key","Uint8Array"));if("secret"!==t.type)throw TypeError(`${E(t)} instances for symmetric algorithms must be of type "secret"`)}})(h,e,m);break;default:((e,t,r)=>{if(w(t))switch(r){case"decrypt":case"sign":if("oct"!==t.kty&&("AKP"===t.kty&&"string"==typeof t.priv||"string"==typeof t.d)&&k(e,t,r))return;throw TypeError("JSON Web Key for this operation must be a private JWK");case"encrypt":case"verify":if("oct"!==t.kty&&void 0===t.d&&void 0===t.priv&&k(e,t,r))return;throw TypeError("JSON Web Key for this operation must be a public JWK")}if(!P(t))throw TypeError(v(e,t,"CryptoKey","KeyObject","JSON Web Key"));if("secret"===t.type)throw TypeError(`${E(t)} instances for asymmetric algorithms must not be of type "secret"`);if("public"===t.type)switch(r){case"sign":throw TypeError(`${E(t)} instances for asymmetric algorithm signing must be of type "private"`);case"decrypt":throw TypeError(`${E(t)} instances for asymmetric algorithm decryption must be of type "private"`)}if("private"===t.type)switch(r){case"verify":throw TypeError(`${E(t)} instances for asymmetric algorithm verifying must be of type "public"`);case"encrypt":throw TypeError(`${E(t)} instances for asymmetric algorithm encryption must be of type "public"`)}})(h,e,m)}u?o=s(r=c(this.#e)):(o=this.#e,r=""),this.#t?i=s(a=c(JSON.stringify(this.#t))):(a="",i=new Uint8Array);let f=function(...e){let t=new Uint8Array(e.reduce((e,{length:t})=>e+t,0)),r=0;for(let o of e)t.set(o,r),r+=o.length;return t}(i,s("."),o),y=await j(e,h),g={signature:c(await b(h,y,f)),payload:r};return this.#r&&(g.header=this.#r),this.#t&&(g.protected=a),g}}class A{#o;constructor(e){this.#o=new N(e)}setProtectedHeader(e){return this.#o.setProtectedHeader(e),this}async sign(e,t){let r=await this.#o.sign(e,t);if(void 0===r.payload)throw TypeError("use the flattened module for creating JWS with b64: false");return`${r.protected}.${r.payload}.${r.signature}`}}let z=e=>Math.floor(e.getTime()/1e3),q=/^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i;function M(e){let t,r=q.exec(e);if(!r||r[4]&&r[1])throw TypeError("Invalid time period format");let o=parseFloat(r[2]);switch(r[3].toLowerCase()){case"sec":case"secs":case"second":case"seconds":case"s":t=Math.round(o);break;case"minute":case"minutes":case"min":case"mins":case"m":t=Math.round(60*o);break;case"hour":case"hours":case"hr":case"hrs":case"h":t=Math.round(3600*o);break;case"day":case"days":case"d":t=Math.round(86400*o);break;case"week":case"weeks":case"w":t=Math.round(604800*o);break;default:t=Math.round(0x1e187e0*o)}return"-"===r[1]||"ago"===r[4]?-t:t}function L(e,t){if(!Number.isFinite(t))throw TypeError(`Invalid ${e} input`);return t}class U{#e;constructor(e){if(!S(e))throw TypeError("JWT Claims Set MUST be an object");this.#e=structuredClone(e)}data(){return a.encode(JSON.stringify(this.#e))}get iss(){return this.#e.iss}set iss(e){this.#e.iss=e}get sub(){return this.#e.sub}set sub(e){this.#e.sub=e}get aud(){return this.#e.aud}set aud(e){this.#e.aud=e}set jti(e){this.#e.jti=e}set nbf(e){"number"==typeof e?this.#e.nbf=L("setNotBefore",e):e instanceof Date?this.#e.nbf=L("setNotBefore",z(e)):this.#e.nbf=z(new Date)+M(e)}set exp(e){"number"==typeof e?this.#e.exp=L("setExpirationTime",e):e instanceof Date?this.#e.exp=L("setExpirationTime",z(e)):this.#e.exp=z(new Date)+M(e)}set iat(e){void 0===e?this.#e.iat=z(new Date):e instanceof Date?this.#e.iat=L("setIssuedAt",z(e)):"string"==typeof e?this.#e.iat=L("setIssuedAt",z(new Date)+M(e)):this.#e.iat=L("setIssuedAt",e)}}class D{#t;#a;constructor(e={}){this.#a=new U(e)}setIssuer(e){return this.#a.iss=e,this}setSubject(e){return this.#a.sub=e,this}setAudience(e){return this.#a.aud=e,this}setJti(e){return this.#a.jti=e,this}setNotBefore(e){return this.#a.nbf=e,this}setExpirationTime(e){return this.#a.exp=e,this}setIssuedAt(e){return this.#a.iat=e,this}setProtectedHeader(e){return this.#t=e,this}async sign(e,t){let r=new A(this.#a.data());if(r.setProtectedHeader(this.#t),Array.isArray(this.#t?.crit)&&this.#t.crit.includes("b64")&&!1===this.#t.b64)throw new h("JWTs MUST NOT use unencoded payload");return r.sign(e,t)}}let V=(e,t)=>{if(e.byteLength!==t.length)return!1;for(let r=0;r<e.byteLength;r++)if(e[r]!==t[r])return!1;return!0},H=e=>{let t=e.data[e.pos++];if(128&t){let r=127&t,o=0;for(let t=0;t<r;t++)o=o<<8|e.data[e.pos++];return o}return t},F=(e,t,r)=>{if(e.data[e.pos++]!==t)throw Error(r)},K=(e,t)=>{let r=e.data.subarray(e.pos,e.pos+t);return e.pos+=t,r},J=async(e,t,r,o)=>{let a,i,s="spki"===e,n=()=>s?["verify"]:["sign"];switch(r){case"PS256":case"PS384":case"PS512":a={name:"RSA-PSS",hash:`SHA-${r.slice(-3)}`},i=n();break;case"RS256":case"RS384":case"RS512":a={name:"RSASSA-PKCS1-v1_5",hash:`SHA-${r.slice(-3)}`},i=n();break;case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":a={name:"RSA-OAEP",hash:`SHA-${parseInt(r.slice(-3),10)||1}`},i=s?["encrypt","wrapKey"]:["decrypt","unwrapKey"];break;case"ES256":case"ES384":case"ES512":a={name:"ECDSA",namedCurve:({ES256:"P-256",ES384:"P-384",ES512:"P-521"})[r]},i=n();break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":try{let e=o.getNamedCurve(t);a="X25519"===e?{name:"X25519"}:{name:"ECDH",namedCurve:e}}catch(e){throw new d("Invalid or unsupported key format")}i=s?[]:["deriveBits"];break;case"Ed25519":case"EdDSA":a={name:"Ed25519"},i=n();break;case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":a={name:r},i=n();break;default:throw new d('Invalid or unsupported "alg" (Algorithm) value')}return crypto.subtle.importKey(e,t,a,o?.extractable??!!s,i)};async function Z(e,t,r){let o,a,i;if("string"!=typeof e||0!==e.indexOf("-----BEGIN PRIVATE KEY-----"))throw TypeError('"pkcs8" must be PKCS#8 formatted string');return o=/(?:-----(?:BEGIN|END) PRIVATE KEY-----|\s)/g,a=n(e.replace(o,"")),i=r,t?.startsWith?.("ECDH-ES")&&((i||={}).getNamedCurve=e=>{let t,r={data:e,pos:0};return F(r,48,"Invalid PKCS#8 structure"),H(r),F(r,2,"Expected version field"),t=H(r),r.pos+=t,F(r,48,"Expected algorithm identifier"),H(r),r.pos,(e=>{let t,r=(F(e,6,"Expected algorithm OID"),t=H(e),K(e,t));if(V(r,[43,101,110]))return"X25519";if(!V(r,[42,134,72,206,61,2,1]))throw Error("Unsupported key algorithm");F(e,6,"Expected curve OID");let o=H(e),a=K(e,o);for(let{name:e,oid:t}of[{name:"P-256",oid:[42,134,72,206,61,3,1,7]},{name:"P-384",oid:[43,129,4,0,34]},{name:"P-521",oid:[43,129,4,0,35]}])if(V(a,t))return e;throw Error("Unsupported named curve")})(r)}),J("pkcs8",a,t,i)}async function W(e,t,r){let o;if(!S(e))throw TypeError("JWK must be an object");switch(t??=e.alg,o??=r?.extractable??e.ext,e.kty){case"oct":if("string"!=typeof e.k||!e.k)throw TypeError('missing "k" (Key Value) Parameter value');return l(e.k);case"RSA":if("oth"in e&&void 0!==e.oth)throw new d('RSA JWK "oth" (Other Primes Info) Parameter value is not supported');return T({...e,alg:t,ext:o});case"AKP":if("string"!=typeof e.alg||!e.alg)throw TypeError('missing "alg" (Algorithm) Parameter value');if(void 0!==t&&t!==e.alg)throw TypeError("JWK alg and alg option value mismatch");return T({...e,ext:o});case"EC":case"OKP":return T({...e,alg:t,ext:o});default:throw new d('Unsupported "kty" (Key Type) Parameter value')}}},8330(e){"use strict";e.exports=JSON.parse('{"name":"xmcp","description":"The MCP framework","version":"1.5.0","author":{"name":"xmcp","email":"support@xmcp.dev","url":"https://xmcp.dev"},"contributors":[{"name":"Valentina Bearzotti","email":"valebearzotti1@gmail.com","url":"https://github.com/valebearzotti"},{"name":"Jose Rago","email":"jose@basement.studio","url":"https://github.com/ragojose"}],"license":"MIT","keywords":["mcp","modelcontextprotocol","http","stdio"],"repository":{"type":"git","url":"https://github.com/basementstudio/xmcp"},"homepage":"https://xmcp.dev","type":"commonjs","main":"./dist/index.js","types":"./dist/index.d.ts","bin":{"xmcp":"dist/cli.js"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.js","default":"./dist/index.js"},"./node":{"types":"./dist/node.d.ts","node":"./dist/node.js"},"./host-bridge":{"types":"./dist/host-bridge.d.ts","import":"./dist/host-bridge.js","require":"./dist/host-bridge.js","default":"./dist/host-bridge.js"},"./headers":{"types":"./dist/runtime/headers.d.ts","require":"./dist/runtime/headers.js","default":"./dist/runtime/headers.js"},"./cloudflare":{"types":"./dist/cloudflare.d.ts","import":"./dist/cloudflare.js","require":"./dist/cloudflare.js","default":"./dist/cloudflare.js"},"./config":{"types":"./dist/config/index.d.ts","import":"./dist/config.js","require":"./dist/config.js","default":"./dist/config.js"},"./package.json":"./package.json","./client":{"types":"./dist/client.d.ts","node":"./dist/client.js"}},"typesVersions":{"*":{"node":["dist/node.d.ts"],"host-bridge":["dist/host-bridge.d.ts"],"headers":["dist/runtime/headers.d.ts"],"cloudflare":["dist/cloudflare.d.ts"],"config":["dist/config/index.d.ts"],"client":["dist/client.d.ts"]}},"files":["dist"],"scripts":{"dev":"cross-env NODE_ENV=development tsx --watch --tsconfig ./bundler.tsconfig.json ./bundler/index.ts","build":"cross-env NODE_ENV=production tsx --tsconfig ./bundler.tsconfig.json ./bundler/index.ts","analyze":"cross-env GENERATE_STATS=true pnpm build && pnpm tsx scripts/analyze-rspack-stats.ts","bench":"tsx bench/run.mts","test:config":"pnpm --dir ../compiler test:config","test:adapters":"node --import tsx --test src/runtime/adapters/*/__tests__/*.test.ts","test:runtime":"node --import tsx --test src/runtime/utils/__tests__/*.test.ts src/runtime/utils/ui/__tests__/*.test.ts","test:client":"node --import tsx --test src/client/__tests__/*.test.ts"},"dependencies":{},"devDependencies":{"@modelcontextprotocol/client":"^2.0.0","@modelcontextprotocol/node":"^2.0.0","@modelcontextprotocol/server":"^2.0.0","@nestjs/common":"^11.1.12","@rspack/core":"^1.6.7","@types/async-retry":"^1.4.9","@types/content-type":"^1.1.9","@types/express":"^5.0.6","@types/fs-extra":"^11.0.4","@types/jsonwebtoken":"^9.0.10","@types/node":"^22.19.2","@types/react":"^19.2.7","@types/react-dom":"^19.2.3","async-retry":"^1.3.3","chalk":"^5.6.2","chokidar":"^3.6.0","ci-info":"^4.3.1","commander":"^11.1.0","content-type":"^1.0.5","cross-env":"^7.0.3","del":"^7.1.0","dotenv":"^16.6.1","express":"^4.22.1","fastify":"^5.12.5","fs-extra":"^11.3.2","glob":"^11.1.0","is-docker":"^4.0.0","is-wsl":"^3.1.0","jose":"^6.1.3","json5":"^2.2.3","jsonwebtoken":"^9.0.3","memfs":"^4.51.1","postcss-loader":"^8.2.0","raw-body":"^3.0.2","reflect-metadata":"^0.2.2","rxjs":"^7.8.2","ts-checker-rspack-plugin":"^1.2.1","tsx":"^4.21.0","typescript":"^5.9.3","zod-to-json-schema":"^3.25.0"},"peerDependencies":{"@modelcontextprotocol/client":"^2.0.0","@modelcontextprotocol/server":"^2.0.0","jose":"^6.1.3","react":">=19.0.0","react-dom":">=19.0.0","zod":"^3.25.76 || ^4.0.0"},"peerDependenciesMeta":{"@modelcontextprotocol/client":{"optional":true},"@modelcontextprotocol/server":{"optional":true},"jose":{"optional":true},"react":{"optional":true},"react-dom":{"optional":true}}}')}},o={};function a(e){var t=o[e];if(void 0!==t)return t.exports;var i=o[e]={exports:{}};return r[e](i,i.exports,a),i.exports}t=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,a.t=function(r,o){if(1&o&&(r=this(r)),8&o||"object"==typeof r&&r&&(4&o&&r.__esModule||16&o&&"function"==typeof r.then))return r;var i=Object.create(null);a.r(i);var s={};e=e||[null,t({}),t([]),t(t)];for(var n=2&o&&r;("object"==typeof n||"function"==typeof n)&&!~e.indexOf(n);n=t(n))Object.getOwnPropertyNames(n).forEach(e=>{s[e]=()=>r[e]});return s.default=()=>r,a.d(i,s),i},a.d=(e,t)=>{for(var r in t)a.o(t,r)&&!a.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),a.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i={};for(var s in(()=>{"use strict";let e,t,r,o,s,n,l,c,u,d,p,h,m,f;a.r(i),a.d(i,{createClient:()=>d0,withClient:()=>d1});var y,g,v,_,b,S,w,$=Object.create,R=Object.defineProperty,P=Object.getOwnPropertyDescriptor,E=Object.getOwnPropertyNames,k=Object.getPrototypeOf,x=Object.prototype.hasOwnProperty,T=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),C=(e,t,r)=>(r=null!=e?$(k(e)):{},((e,t,r,o)=>{if(t&&"object"==typeof t||"function"==typeof t)for(var a,i=E(t),s=0,n=i.length;s<n;s++)a=i[s],x.call(e,a)||a===r||R(e,a,{get:(e=>t[e]).bind(null,a),enumerable:!(o=P(t,a))||o.enumerable});return e})(!t&&e&&e.__esModule?r:R(r,"default",{value:e,enumerable:!0}),e));let O=new Set(["https://json-schema.org/draft/2020-12/schema","http://json-schema.org/draft/2020-12/schema"]),j=new Set(["https://json-schema.org/draft/2019-09/schema","http://json-schema.org/draft/2019-09/schema"]),I=new Set(["https://json-schema.org/draft-07/schema","http://json-schema.org/draft-07/schema"]),N=new Set(["https://json-schema.org/draft-06/schema","http://json-schema.org/draft-06/schema"]),A=Object.freeze({status:"aborted"});function z(e,t,r){function o(r,o){if(r._zod||Object.defineProperty(r,"_zod",{value:{def:o,constr:s,traits:new Set},enumerable:!1}),r._zod.traits.has(e))return;r._zod.traits.add(e),t(r,o);let a=s.prototype,i=Object.keys(a);for(let e=0;e<i.length;e++){let t=i[e];t in r||(r[t]=a[t].bind(r))}}let a=r?.Parent??Object;class i extends a{}function s(e){var t;let a=r?.Parent?new i:this;for(let r of(o(a,e),(t=a._zod).deferred??(t.deferred=[]),a._zod.deferred))r();return a}return Object.defineProperty(i,"name",{value:e}),Object.defineProperty(s,"init",{value:o}),Object.defineProperty(s,Symbol.hasInstance,{value:t=>!!r?.Parent&&t instanceof r.Parent||t?._zod?.traits?.has(e)}),Object.defineProperty(s,"name",{value:e}),s}Symbol("zod_brand");class q extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class M extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}}(b=globalThis).__zod_globalConfig??(b.__zod_globalConfig={});let L=globalThis.__zod_globalConfig;function U(e){return e&&Object.assign(L,e),L}let D=/^[cC][0-9a-z]{6,}$/,V=/^[0-9a-z]+$/,H=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,F=/^[0-9a-vA-V]{20}$/,K=/^[A-Za-z0-9]{27}$/,J=/^[a-zA-Z0-9_-]{21}$/,Z=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,W=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,B=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,G=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,X=/^(?:(?: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])$/,Y=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Q=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,ee=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,et=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,er=/^[A-Za-z0-9_-]*$/,eo=/^https?$/,ea=/^\+[1-9]\d{6,14}$/,ei="(?:(?:\\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])))",es=RegExp(`^${ei}$`);function en(e){let t="(?:[01]\\d|2[0-3]):[0-5]\\d";return"number"==typeof e.precision?-1===e.precision?`${t}`:0===e.precision?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}let el=/^-?\d+$/,ec=/^-?\d+(?:\.\d+)?$/,eu=/^(?:true|false)$/i,ed=/^null$/i,ep=/^[^A-Z]*$/,eh=/^[^a-z]*$/;function em(e){let t=Object.values(e).filter(e=>"number"==typeof e);return Object.entries(e).filter(([e,r])=>-1===t.indexOf(+e)).map(([e,t])=>t)}function ef(e,t){return"bigint"==typeof t?t.toString():t}function ey(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function eg(e){let t=+!!e.startsWith("^"),r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}let ev=Symbol("evaluating");function e_(e,t,r){let o;Object.defineProperty(e,t,{get(){if(o!==ev)return void 0===o&&(o=ev,o=r()),o},set(r){Object.defineProperty(e,t,{value:r})},configurable:!0})}function eb(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function eS(...e){let t={};for(let r of e)Object.assign(t,Object.getOwnPropertyDescriptors(r));return Object.defineProperties({},t)}function ew(e){return JSON.stringify(e)}let e$="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function eR(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}let eP=ey(()=>{if(L.jitless||"undefined"!=typeof navigator&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return Function(""),!0}catch(e){return!1}});function eE(e){if(!1===eR(e))return!1;let t=e.constructor;if(void 0===t||"function"!=typeof t)return!0;let r=t.prototype;return!1!==eR(r)&&!1!==Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")}function ek(e){return eE(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}let ex=new Set(["string","number","symbol"]);function eT(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function eC(e,t,r){let o=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(o._zod.parent=e),o}function eO(e){if(!e)return{};if("string"==typeof e)return{error:()=>e};if(e?.message!==void 0){if(e?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");e.error=e.message}return(delete e.message,"string"==typeof e.error)?{...e,error:()=>e.error}:e}let ej={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-0x80000000,0x7fffffff],uint32:[0,0xffffffff],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function eI(e,t=0){if(!0===e.aborted)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function eN(e,t){return t.map(t=>(t.path??(t.path=[]),t.path.unshift(e),t))}function eA(e){return"string"==typeof e?e:e?.message}function ez(e,t,r){let o=e.message?e.message:eA(e.inst?._zod.def?.error?.(e))??eA(t?.error?.(e))??eA(r.customError?.(e))??eA(r.localeError?.(e))??"Invalid input",{inst:a,continue:i,input:s,...n}=e;return n.path??(n.path=[]),n.message=o,t?.reportInput&&(n.input=s),n}function eq(e){return Array.isArray(e)?"array":"string"==typeof e?"string":"unknown"}function eM(...e){let[t,r,o]=e;return"string"==typeof t?{message:t,code:"custom",input:r,inst:o}:{...t}}let eL=z("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),eU={number:"number",bigint:"bigint",object:"date"},eD=z("$ZodCheckLessThan",(e,t)=>{eL.init(e,t);let r=eU[typeof t.value];e._zod.onattach.push(e=>{let r=e._zod.bag,o=(t.inclusive?r.maximum:r.exclusiveMaximum)??1/0;t.value<o&&(t.inclusive?r.maximum=t.value:r.exclusiveMaximum=t.value)}),e._zod.check=o=>{(t.inclusive?o.value<=t.value:o.value<t.value)||o.issues.push({origin:r,code:"too_big",maximum:"object"==typeof t.value?t.value.getTime():t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),eV=z("$ZodCheckGreaterThan",(e,t)=>{eL.init(e,t);let r=eU[typeof t.value];e._zod.onattach.push(e=>{let r=e._zod.bag,o=(t.inclusive?r.minimum:r.exclusiveMinimum)??-1/0;t.value>o&&(t.inclusive?r.minimum=t.value:r.exclusiveMinimum=t.value)}),e._zod.check=o=>{(t.inclusive?o.value>=t.value:o.value>t.value)||o.issues.push({origin:r,code:"too_small",minimum:"object"==typeof t.value?t.value.getTime():t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),eH=z("$ZodCheckMultipleOf",(e,t)=>{eL.init(e,t),e._zod.onattach.push(e=>{var r;(r=e._zod.bag).multipleOf??(r.multipleOf=t.value)}),e._zod.check=r=>{var o;let a,i,s;if(typeof r.value!=typeof t.value)throw Error("Cannot mix number and bigint in multiple_of check.");("bigint"==typeof r.value?r.value%t.value===BigInt(0):0==(i=Math.round(a=(o=r.value)/t.value),s=Number.EPSILON*Math.max(Math.abs(a),1),Math.abs(a-i)<s?0:a-i))||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),eF=z("$ZodCheckNumberFormat",(e,t)=>{eL.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),o=r?"int":"number",[a,i]=ej[t.format];e._zod.onattach.push(e=>{let o=e._zod.bag;o.format=t.format,o.minimum=a,o.maximum=i,r&&(o.pattern=el)}),e._zod.check=s=>{let n=s.value;if(r){if(!Number.isInteger(n))return void s.issues.push({expected:o,format:t.format,code:"invalid_type",continue:!1,input:n,inst:e});if(!Number.isSafeInteger(n))return void(n>0?s.issues.push({input:n,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,inclusive:!0,continue:!t.abort}):s.issues.push({input:n,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,inclusive:!0,continue:!t.abort}))}n<a&&s.issues.push({origin:"number",input:n,code:"too_small",minimum:a,inclusive:!0,inst:e,continue:!t.abort}),n>i&&s.issues.push({origin:"number",input:n,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}}),eK=z("$ZodCheckMaxLength",(e,t)=>{var r;eL.init(e,t),(r=e._zod.def).when??(r.when=e=>{let t=e.value;return null!=t&&void 0!==t.length}),e._zod.onattach.push(e=>{let r=e._zod.bag.maximum??1/0;t.maximum<r&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=r=>{let o=r.value;if(o.length<=t.maximum)return;let a=eq(o);r.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),eJ=z("$ZodCheckMinLength",(e,t)=>{var r;eL.init(e,t),(r=e._zod.def).when??(r.when=e=>{let t=e.value;return null!=t&&void 0!==t.length}),e._zod.onattach.push(e=>{let r=e._zod.bag.minimum??-1/0;t.minimum>r&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=r=>{let o=r.value;if(o.length>=t.minimum)return;let a=eq(o);r.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),eZ=z("$ZodCheckLengthEquals",(e,t)=>{var r;eL.init(e,t),(r=e._zod.def).when??(r.when=e=>{let t=e.value;return null!=t&&void 0!==t.length}),e._zod.onattach.push(e=>{let r=e._zod.bag;r.minimum=t.length,r.maximum=t.length,r.length=t.length}),e._zod.check=r=>{let o=r.value,a=o.length;if(a===t.length)return;let i=eq(o),s=a>t.length;r.issues.push({origin:i,...s?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),eW=z("$ZodCheckStringFormat",(e,t)=>{var r,o;eL.init(e,t),e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,t.pattern&&(r.patterns??(r.patterns=new Set),r.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=r=>{t.pattern.lastIndex=0,t.pattern.test(r.value)||r.issues.push({origin:"string",code:"invalid_format",format:t.format,input:r.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(o=e._zod).check??(o.check=()=>{})}),eB=z("$ZodCheckRegex",(e,t)=>{eW.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,t.pattern.test(r.value)||r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),eG=z("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=ep),eW.init(e,t)}),eX=z("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=eh),eW.init(e,t)}),eY=z("$ZodCheckIncludes",(e,t)=>{eL.init(e,t);let r=eT(t.includes),o=new RegExp("number"==typeof t.position?`^.{${t.position}}${r}`:r);t.pattern=o,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(o)}),e._zod.check=r=>{r.value.includes(t.includes,t.position)||r.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:r.value,inst:e,continue:!t.abort})}}),eQ=z("$ZodCheckStartsWith",(e,t)=>{eL.init(e,t);let r=RegExp(`^${eT(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(r)}),e._zod.check=r=>{r.value.startsWith(t.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),e0=z("$ZodCheckEndsWith",(e,t)=>{eL.init(e,t);let r=RegExp(`.*${eT(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(r)}),e._zod.check=r=>{r.value.endsWith(t.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}}),e1=z("$ZodCheckOverwrite",(e,t)=>{eL.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});class e2{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if("function"==typeof e){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let t=e.split("\n").filter(e=>e),r=Math.min(...t.map(e=>e.length-e.trimStart().length));for(let e of t.map(e=>e.slice(r)).map(e=>" ".repeat(2*this.indent)+e))this.content.push(e)}compile(){let e=Function,t=this?.args;return new e(...t,[...(this?.content??[""]).map(e=>` ${e}`)].join("\n"))}}let e9=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,ef,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},e4=z("$ZodError",e9),e5=z("$ZodError",e9,{Parent:Error}),e3=e=>(t,r,o,a)=>{let i=o?{...o,async:!1}:{async:!1},s=t._zod.run({value:r,issues:[]},i);if(s instanceof Promise)throw new q;if(s.issues.length){let t=new(a?.Err??e)(s.issues.map(e=>ez(e,i,U())));throw e$(t,a?.callee),t}return s.value},e6=e=>async(t,r,o,a)=>{let i=o?{...o,async:!0}:{async:!0},s=t._zod.run({value:r,issues:[]},i);if(s instanceof Promise&&(s=await s),s.issues.length){let t=new(a?.Err??e)(s.issues.map(e=>ez(e,i,U())));throw e$(t,a?.callee),t}return s.value},e8=e=>(t,r,o)=>{let a=o?{...o,async:!1}:{async:!1},i=t._zod.run({value:r,issues:[]},a);if(i instanceof Promise)throw new q;return i.issues.length?{success:!1,error:new(e??e4)(i.issues.map(e=>ez(e,a,U())))}:{success:!0,data:i.value}},e7=e8(e5),te=e=>async(t,r,o)=>{let a=o?{...o,async:!0}:{async:!0},i=t._zod.run({value:r,issues:[]},a);return i instanceof Promise&&(i=await i),i.issues.length?{success:!1,error:new e(i.issues.map(e=>ez(e,a,U())))}:{success:!0,data:i.value}},tt=te(e5),tr={major:4,minor:4,patch:3},to=z("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=tr;let o=[...e._zod.def.checks??[]];for(let t of(e._zod.traits.has("$ZodCheck")&&o.unshift(e),o))for(let r of t._zod.onattach)r(e);if(0===o.length)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(e,t,r)=>{let o,a=eI(e);for(let i of t){if(i._zod.def.when){if(function(e,t=0){if(!0===e.aborted)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue===!1)return!0;return!1}(e)||!i._zod.def.when(e))continue}else if(a)continue;let t=e.issues.length,s=i._zod.check(e);if(s instanceof Promise&&r?.async===!1)throw new q;if(o||s instanceof Promise)o=(o??Promise.resolve()).then(async()=>{await s,e.issues.length!==t&&(a||(a=eI(e,t)))});else{if(e.issues.length===t)continue;a||(a=eI(e,t))}}return o?o.then(()=>e):e},r=(r,a,i)=>{if(eI(r))return r.aborted=!0,r;let s=t(a,o,i);if(s instanceof Promise){if(!1===i.async)throw new q;return s.then(t=>e._zod.parse(t,i))}return e._zod.parse(s,i)};e._zod.run=(a,i)=>{if(i.skipChecks)return e._zod.parse(a,i);if("backward"===i.direction){let t=e._zod.parse({value:a.value,issues:[]},{...i,skipChecks:!0});return t instanceof Promise?t.then(e=>r(e,a,i)):r(t,a,i)}let s=e._zod.parse(a,i);if(s instanceof Promise){if(!1===i.async)throw new q;return s.then(e=>t(e,o,i))}return t(s,o,i)}}e_(e,"~standard",()=>({validate:t=>{try{let r=e7(e,t);return r.success?{value:r.data}:{issues:r.error?.issues}}catch(r){return tt(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:"zod",version:1}))}),ta=z("$ZodString",(e,t)=>{var r;let o;to.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??(o=(r=e._zod.bag)?`[\\s\\S]{${r?.minimum??0},${r?.maximum??""}}`:"[\\s\\S]*",RegExp(`^${o}$`)),e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=String(r.value)}catch(e){}return"string"==typeof r.value||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),ti=z("$ZodStringFormat",(e,t)=>{eW.init(e,t),ta.init(e,t)}),ts=z("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=W),ti.init(e,t)}),tn=z("$ZodUUID",(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(void 0===e)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=B(e))}else t.pattern??(t.pattern=B());ti.init(e,t)}),tl=z("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=G),ti.init(e,t)}),tc=z("$ZodURL",(e,t)=>{ti.init(e,t),e._zod.check=r=>{try{let o=r.value.trim();if(!t.normalize&&t.protocol?.source===eo.source&&!/^https?:\/\//i.test(o))return void r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});let a=new URL(o);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(a.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(a.protocol.endsWith(":")?a.protocol.slice(0,-1):a.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})),t.normalize?r.value=a.href:r.value=o;return}catch(o){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),tu=z("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),ti.init(e,t)}),td=z("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=J),ti.init(e,t)}),tp=z("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=D),ti.init(e,t)}),th=z("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=V),ti.init(e,t)}),tm=z("$ZodULID",(e,t)=>{t.pattern??(t.pattern=H),ti.init(e,t)}),tf=z("$ZodXID",(e,t)=>{t.pattern??(t.pattern=F),ti.init(e,t)}),ty=z("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=K),ti.init(e,t)}),tg=z("$ZodISODateTime",(e,t)=>{var r;let o,a,i;t.pattern??(o=en({precision:(r=t).precision}),a=["Z"],r.local&&a.push(""),r.offset&&a.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)"),i=`${o}(?:${a.join("|")})`,t.pattern=RegExp(`^${ei}T(?:${i})$`)),ti.init(e,t)}),tv=z("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=es),ti.init(e,t)}),t_=z("$ZodISOTime",(e,t)=>{var r;t.pattern??(r=t,t.pattern=RegExp(`^${en(r)}$`)),ti.init(e,t)}),tb=z("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Z),ti.init(e,t)}),tS=z("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=X),ti.init(e,t),e._zod.bag.format="ipv4"}),tw=z("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Y),ti.init(e,t),e._zod.bag.format="ipv6",e._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}}),t$=z("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Q),ti.init(e,t)}),tR=z("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=ee),ti.init(e,t),e._zod.check=r=>{let o=r.value.split("/");try{if(2!==o.length)throw Error();let[e,t]=o;if(!t)throw Error();let r=Number(t);if(`${r}`!==t||r<0||r>128)throw Error();new URL(`http://[${e}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function tP(e){if(""===e)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}let tE=z("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=et),ti.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{tP(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}}),tk=z("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=er),ti.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{!function(e){if(!er.test(e))return!1;let t=e.replace(/[-_]/g,e=>"-"===e?"+":"/");return tP(t.padEnd(4*Math.ceil(t.length/4),"="))}(r.value)&&r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),tx=z("$ZodE164",(e,t)=>{t.pattern??(t.pattern=ea),ti.init(e,t)}),tT=z("$ZodJWT",(e,t)=>{ti.init(e,t),e._zod.check=r=>{!function(e,t=null){try{let r=e.split(".");if(3!==r.length)return!1;let[o]=r;if(!o)return!1;let a=JSON.parse(atob(o));if("typ"in a&&a?.typ!=="JWT"||!a.alg||t&&(!("alg"in a)||a.alg!==t))return!1;return!0}catch{return!1}}(r.value,t.alg)&&r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),tC=z("$ZodNumber",(e,t)=>{to.init(e,t),e._zod.pattern=e._zod.bag.pattern??ec,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=Number(r.value)}catch(e){}let a=r.value;if("number"==typeof a&&!Number.isNaN(a)&&Number.isFinite(a))return r;let i="number"==typeof a?Number.isNaN(a)?"NaN":Number.isFinite(a)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:a,inst:e,...i?{received:i}:{}}),r}}),tO=z("$ZodNumberFormat",(e,t)=>{eF.init(e,t),tC.init(e,t)}),tj=z("$ZodBoolean",(e,t)=>{to.init(e,t),e._zod.pattern=eu,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=!!r.value}catch(e){}let a=r.value;return"boolean"==typeof a||r.issues.push({expected:"boolean",code:"invalid_type",input:a,inst:e}),r}}),tI=z("$ZodNull",(e,t)=>{to.init(e,t),e._zod.pattern=ed,e._zod.values=new Set([null]),e._zod.parse=(t,r)=>{let o=t.value;return null===o||t.issues.push({expected:"null",code:"invalid_type",input:o,inst:e}),t}}),tN=z("$ZodAny",(e,t)=>{to.init(e,t),e._zod.parse=e=>e}),tA=z("$ZodUnknown",(e,t)=>{to.init(e,t),e._zod.parse=e=>e}),tz=z("$ZodNever",(e,t)=>{to.init(e,t),e._zod.parse=(t,r)=>(t.issues.push({expected:"never",code:"invalid_type",input:t.value,inst:e}),t)});function tq(e,t,r){e.issues.length&&t.issues.push(...eN(r,e.issues)),t.value[r]=e.value}let tM=z("$ZodArray",(e,t)=>{to.init(e,t),e._zod.parse=(r,o)=>{let a=r.value;if(!Array.isArray(a))return r.issues.push({expected:"array",code:"invalid_type",input:a,inst:e}),r;r.value=Array(a.length);let i=[];for(let e=0;e<a.length;e++){let s=a[e],n=t.element._zod.run({value:s,issues:[]},o);n instanceof Promise?i.push(n.then(t=>tq(t,r,e))):tq(n,r,e)}return i.length?Promise.all(i).then(()=>r):r}});function tL(e,t,r,o,a,i){let s=r in o;if(e.issues.length){if(a&&i&&!s)return;t.issues.push(...eN(r,e.issues))}if(!s&&!a){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}void 0===e.value?s&&(t.value[r]=void 0):t.value[r]=e.value}function tU(e){var t;let r=Object.keys(e.shape);for(let t of r)if(!e.shape?.[t]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${t}": expected a Zod schema`);let o=Object.keys(t=e.shape).filter(e=>"optional"===t[e]._zod.optin&&"optional"===t[e]._zod.optout);return{...e,keys:r,keySet:new Set(r),numKeys:r.length,optionalKeys:new Set(o)}}function tD(e,t,r,o,a,i){let s=[],n=a.keySet,l=a.catchall._zod,c=l.def.type,u="optional"===l.optin,d="optional"===l.optout;for(let a in t){if("__proto__"===a||n.has(a))continue;if("never"===c){s.push(a);continue}let i=l.run({value:t[a],issues:[]},o);i instanceof Promise?e.push(i.then(e=>tL(e,r,a,t,u,d))):tL(i,r,a,t,u,d)}return(s.length&&r.issues.push({code:"unrecognized_keys",keys:s,input:t,inst:i}),e.length)?Promise.all(e).then(()=>r):r}let tV=z("$ZodObject",(e,t)=>{let r;to.init(e,t);let o=Object.getOwnPropertyDescriptor(t,"shape");if(!o?.get){let e=t.shape;Object.defineProperty(t,"shape",{get:()=>{let r={...e};return Object.defineProperty(t,"shape",{value:r}),r}})}let a=ey(()=>tU(t));e_(e._zod,"propValues",()=>{let e=t.shape,r={};for(let t in e){let o=e[t]._zod;if(o.values)for(let e of(r[t]??(r[t]=new Set),o.values))r[t].add(e)}return r});let i=t.catchall;e._zod.parse=(t,o)=>{r??(r=a.value);let s=t.value;if(!eR(s))return t.issues.push({expected:"object",code:"invalid_type",input:s,inst:e}),t;t.value={};let n=[],l=r.shape;for(let e of r.keys){let r=l[e],a="optional"===r._zod.optin,i="optional"===r._zod.optout,c=r._zod.run({value:s[e],issues:[]},o);c instanceof Promise?n.push(c.then(r=>tL(r,t,e,s,a,i))):tL(c,t,e,s,a,i)}return i?tD(n,s,t,o,a.value,e):n.length?Promise.all(n).then(()=>t):t}}),tH=z("$ZodObjectJIT",(e,t)=>{let r,o;tV.init(e,t);let a=e._zod.parse,i=ey(()=>tU(t)),s=!L.jitless,n=s&&eP.value,l=t.catchall;e._zod.parse=(c,u)=>{o??(o=i.value);let d=c.value;return eR(d)?s&&n&&u?.async===!1&&!0!==u.jitless?(r||(r=(e=>{let t=new e2(["shape","payload","ctx"]),r=i.value,o=e=>{let t=ew(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write("const input = payload.value;");let a=Object.create(null),s=0;for(let e of r.keys)a[e]=`key_${s++}`;for(let i of(t.write("const newResult = {};"),r.keys)){let r=a[i],s=ew(i),n=e[i],l=n?._zod?.optin==="optional",c=n?._zod?.optout==="optional";t.write(`const ${r} = ${o(i)};`),l&&c?t.write(`
2
+ if (${r}.issues.length) {
3
+ if (${s} in input) {
4
+ payload.issues = payload.issues.concat(${r}.issues.map(iss => ({
5
+ ...iss,
6
+ path: iss.path ? [${s}, ...iss.path] : [${s}]
7
+ })));
8
+ }
9
+ }
10
+
11
+ if (${r}.value === undefined) {
12
+ if (${s} in input) {
13
+ newResult[${s}] = undefined;
14
+ }
15
+ } else {
16
+ newResult[${s}] = ${r}.value;
17
+ }
18
+
19
+ `):l?t.write(`
20
+ if (${r}.issues.length) {
21
+ payload.issues = payload.issues.concat(${r}.issues.map(iss => ({
22
+ ...iss,
23
+ path: iss.path ? [${s}, ...iss.path] : [${s}]
24
+ })));
25
+ }
26
+
27
+ if (${r}.value === undefined) {
28
+ if (${s} in input) {
29
+ newResult[${s}] = undefined;
30
+ }
31
+ } else {
32
+ newResult[${s}] = ${r}.value;
33
+ }
34
+
35
+ `):t.write(`
36
+ const ${r}_present = ${s} in input;
37
+ if (${r}.issues.length) {
38
+ payload.issues = payload.issues.concat(${r}.issues.map(iss => ({
39
+ ...iss,
40
+ path: iss.path ? [${s}, ...iss.path] : [${s}]
41
+ })));
42
+ }
43
+ if (!${r}_present && !${r}.issues.length) {
44
+ payload.issues.push({
45
+ code: "invalid_type",
46
+ expected: "nonoptional",
47
+ input: undefined,
48
+ path: [${s}]
49
+ });
50
+ }
51
+
52
+ if (${r}_present) {
53
+ if (${r}.value === undefined) {
54
+ newResult[${s}] = undefined;
55
+ } else {
56
+ newResult[${s}] = ${r}.value;
57
+ }
58
+ }
59
+
60
+ `)}t.write("payload.value = newResult;"),t.write("return payload;");let n=t.compile();return(t,r)=>n(e,t,r)})(t.shape)),c=r(c,u),l)?tD([],d,c,u,o,e):c:a(c,u):(c.issues.push({expected:"object",code:"invalid_type",input:d,inst:e}),c)}});function tF(e,t,r,o){for(let r of e)if(0===r.issues.length)return t.value=r.value,t;let a=e.filter(e=>!eI(e));return 1===a.length?(t.value=a[0].value,a[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(e=>e.issues.map(e=>ez(e,o,U())))}),t)}let tK=z("$ZodUnion",(e,t)=>{to.init(e,t),e_(e._zod,"optin",()=>t.options.some(e=>"optional"===e._zod.optin)?"optional":void 0),e_(e._zod,"optout",()=>t.options.some(e=>"optional"===e._zod.optout)?"optional":void 0),e_(e._zod,"values",()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),e_(e._zod,"pattern",()=>{if(t.options.every(e=>e._zod.pattern)){let e=t.options.map(e=>e._zod.pattern);return RegExp(`^(${e.map(e=>eg(e.source)).join("|")})$`)}});let r=1===t.options.length?t.options[0]._zod.run:null;e._zod.parse=(o,a)=>{if(r)return r(o,a);let i=!1,s=[];for(let e of t.options){let t=e._zod.run({value:o.value,issues:[]},a);if(t instanceof Promise)s.push(t),i=!0;else{if(0===t.issues.length)return t;s.push(t)}}return i?Promise.all(s).then(t=>tF(t,o,e,a)):tF(s,o,e,a)}}),tJ=z("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,tK.init(e,t);let r=e._zod.parse;e_(e._zod,"propValues",()=>{let e={};for(let r of t.options){let o=r._zod.propValues;if(!o||0===Object.keys(o).length)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(r)}"`);for(let[t,r]of Object.entries(o))for(let o of(e[t]||(e[t]=new Set),r))e[t].add(o)}return e});let o=ey(()=>{let e=t.options,r=new Map;for(let o of e){let e=o._zod.propValues?.[t.discriminator];if(!e||0===e.size)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(o)}"`);for(let t of e){if(r.has(t))throw Error(`Duplicate discriminator value "${String(t)}"`);r.set(t,o)}}return r});e._zod.parse=(a,i)=>{let s=a.value;if(!eR(s))return a.issues.push({code:"invalid_type",expected:"object",input:s,inst:e}),a;let n=o.value.get(s?.[t.discriminator]);return n?n._zod.run(a,i):t.unionFallback||"backward"===i.direction?r(a,i):(a.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(o.value.keys()),input:s,path:[t.discriminator],inst:e}),a)}}),tZ=z("$ZodIntersection",(e,t)=>{to.init(e,t),e._zod.parse=(e,r)=>{let o=e.value,a=t.left._zod.run({value:o,issues:[]},r),i=t.right._zod.run({value:o,issues:[]},r);return a instanceof Promise||i instanceof Promise?Promise.all([a,i]).then(([t,r])=>tW(e,t,r)):tW(e,a,i)}});function tW(e,t,r){let o,a=new Map;for(let r of t.issues)if("unrecognized_keys"===r.code)for(let e of(o??(o=r),r.keys))a.has(e)||a.set(e,{}),a.get(e).l=!0;else e.issues.push(r);for(let t of r.issues)if("unrecognized_keys"===t.code)for(let e of t.keys)a.has(e)||a.set(e,{}),a.get(e).r=!0;else e.issues.push(t);let i=[...a].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(i.length&&o&&e.issues.push({...o,keys:i}),eI(e))return e;let s=function e(t,r){if(t===r||t instanceof Date&&r instanceof Date&&+t==+r)return{valid:!0,data:t};if(eE(t)&&eE(r)){let o=Object.keys(r),a=Object.keys(t).filter(e=>-1!==o.indexOf(e)),i={...t,...r};for(let o of a){let a=e(t[o],r[o]);if(!a.valid)return{valid:!1,mergeErrorPath:[o,...a.mergeErrorPath]};i[o]=a.data}return{valid:!0,data:i}}if(Array.isArray(t)&&Array.isArray(r)){if(t.length!==r.length)return{valid:!1,mergeErrorPath:[]};let o=[];for(let a=0;a<t.length;a++){let i=t[a],s=e(i,r[a]);if(!s.valid)return{valid:!1,mergeErrorPath:[a,...s.mergeErrorPath]};o.push(s.data)}return{valid:!0,data:o}}return{valid:!1,mergeErrorPath:[]}}(t.value,r.value);if(!s.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(s.mergeErrorPath)}`);return e.value=s.data,e}let tB=z("$ZodRecord",(e,t)=>{to.init(e,t),e._zod.parse=(r,o)=>{let a=r.value;if(!eE(a))return r.issues.push({expected:"record",code:"invalid_type",input:a,inst:e}),r;let i=[],s=t.keyType._zod.values;if(s){let n;r.value={};let l=new Set;for(let n of s)if("string"==typeof n||"number"==typeof n||"symbol"==typeof n){l.add("number"==typeof n?n.toString():n);let s=t.keyType._zod.run({value:n,issues:[]},o);if(s instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(s.issues.length){r.issues.push({code:"invalid_key",origin:"record",issues:s.issues.map(e=>ez(e,o,U())),input:n,path:[n],inst:e});continue}let c=s.value,u=t.valueType._zod.run({value:a[n],issues:[]},o);u instanceof Promise?i.push(u.then(e=>{e.issues.length&&r.issues.push(...eN(n,e.issues)),r.value[c]=e.value})):(u.issues.length&&r.issues.push(...eN(n,u.issues)),r.value[c]=u.value)}for(let e in a)l.has(e)||(n=n??[]).push(e);n&&n.length>0&&r.issues.push({code:"unrecognized_keys",input:a,inst:e,keys:n})}else for(let s of(r.value={},Reflect.ownKeys(a))){if("__proto__"===s||!Object.prototype.propertyIsEnumerable.call(a,s))continue;let n=t.keyType._zod.run({value:s,issues:[]},o);if(n instanceof Promise)throw Error("Async schemas not supported in object keys currently");if("string"==typeof s&&ec.test(s)&&n.issues.length){let e=t.keyType._zod.run({value:Number(s),issues:[]},o);if(e instanceof Promise)throw Error("Async schemas not supported in object keys currently");0===e.issues.length&&(n=e)}if(n.issues.length){"loose"===t.mode?r.value[s]=a[s]:r.issues.push({code:"invalid_key",origin:"record",issues:n.issues.map(e=>ez(e,o,U())),input:s,path:[s],inst:e});continue}let l=t.valueType._zod.run({value:a[s],issues:[]},o);l instanceof Promise?i.push(l.then(e=>{e.issues.length&&r.issues.push(...eN(s,e.issues)),r.value[n.value]=e.value})):(l.issues.length&&r.issues.push(...eN(s,l.issues)),r.value[n.value]=l.value)}return i.length?Promise.all(i).then(()=>r):r}}),tG=z("$ZodEnum",(e,t)=>{to.init(e,t);let r=em(t.entries),o=new Set(r);e._zod.values=o,e._zod.pattern=RegExp(`^(${r.filter(e=>ex.has(typeof e)).map(e=>"string"==typeof e?eT(e):e.toString()).join("|")})$`),e._zod.parse=(t,a)=>{let i=t.value;return o.has(i)||t.issues.push({code:"invalid_value",values:r,input:i,inst:e}),t}}),tX=z("$ZodLiteral",(e,t)=>{if(to.init(e,t),0===t.values.length)throw Error("Cannot create literal schema with no valid values");let r=new Set(t.values);e._zod.values=r,e._zod.pattern=RegExp(`^(${t.values.map(e=>"string"==typeof e?eT(e):e?eT(e.toString()):String(e)).join("|")})$`),e._zod.parse=(o,a)=>{let i=o.value;return r.has(i)||o.issues.push({code:"invalid_value",values:t.values,input:i,inst:e}),o}}),tY=z("$ZodTransform",(e,t)=>{to.init(e,t),e._zod.optin="optional",e._zod.parse=(r,o)=>{if("backward"===o.direction)throw new M(e.constructor.name);let a=t.transform(r.value,r);if(o.async)return(a instanceof Promise?a:Promise.resolve(a)).then(e=>(r.value=e,r.fallback=!0,r));if(a instanceof Promise)throw new q;return r.value=a,r.fallback=!0,r}});function tQ(e,t){return void 0===t&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}let t0=z("$ZodOptional",(e,t)=>{to.init(e,t),e._zod.optin="optional",e._zod.optout="optional",e_(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),e_(e._zod,"pattern",()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${eg(e.source)})?$`):void 0}),e._zod.parse=(e,r)=>{if("optional"===t.innerType._zod.optin){let o=e.value,a=t.innerType._zod.run(e,r);return a instanceof Promise?a.then(e=>tQ(e,o)):tQ(a,o)}return void 0===e.value?e:t.innerType._zod.run(e,r)}}),t1=z("$ZodExactOptional",(e,t)=>{t0.init(e,t),e_(e._zod,"values",()=>t.innerType._zod.values),e_(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(e,r)=>t.innerType._zod.run(e,r)}),t2=z("$ZodNullable",(e,t)=>{to.init(e,t),e_(e._zod,"optin",()=>t.innerType._zod.optin),e_(e._zod,"optout",()=>t.innerType._zod.optout),e_(e._zod,"pattern",()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${eg(e.source)}|null)$`):void 0}),e_(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,r)=>null===e.value?e:t.innerType._zod.run(e,r)}),t9=z("$ZodDefault",(e,t)=>{to.init(e,t),e._zod.optin="optional",e_(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,r)=>{if("backward"===r.direction)return t.innerType._zod.run(e,r);if(void 0===e.value)return e.value=t.defaultValue,e;let o=t.innerType._zod.run(e,r);return o instanceof Promise?o.then(e=>t4(e,t)):t4(o,t)}});function t4(e,t){return void 0===e.value&&(e.value=t.defaultValue),e}let t5=z("$ZodPrefault",(e,t)=>{to.init(e,t),e._zod.optin="optional",e_(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,r)=>("backward"===r.direction||void 0===e.value&&(e.value=t.defaultValue),t.innerType._zod.run(e,r))}),t3=z("$ZodNonOptional",(e,t)=>{to.init(e,t),e_(e._zod,"values",()=>{let e=t.innerType._zod.values;return e?new Set([...e].filter(e=>void 0!==e)):void 0}),e._zod.parse=(r,o)=>{let a=t.innerType._zod.run(r,o);return a instanceof Promise?a.then(t=>t6(t,e)):t6(a,e)}});function t6(e,t){return e.issues.length||void 0!==e.value||e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}let t8=z("$ZodCatch",(e,t)=>{to.init(e,t),e._zod.optin="optional",e_(e._zod,"optout",()=>t.innerType._zod.optout),e_(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,r)=>{if("backward"===r.direction)return t.innerType._zod.run(e,r);let o=t.innerType._zod.run(e,r);return o instanceof Promise?o.then(o=>(e.value=o.value,o.issues.length&&(e.value=t.catchValue({...e,error:{issues:o.issues.map(e=>ez(e,r,U()))},input:e.value}),e.issues=[],e.fallback=!0),e)):(e.value=o.value,o.issues.length&&(e.value=t.catchValue({...e,error:{issues:o.issues.map(e=>ez(e,r,U()))},input:e.value}),e.issues=[],e.fallback=!0),e)}}),t7=z("$ZodPipe",(e,t)=>{to.init(e,t),e_(e._zod,"values",()=>t.in._zod.values),e_(e._zod,"optin",()=>t.in._zod.optin),e_(e._zod,"optout",()=>t.out._zod.optout),e_(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(e,r)=>{if("backward"===r.direction){let o=t.out._zod.run(e,r);return o instanceof Promise?o.then(e=>re(e,t.in,r)):re(o,t.in,r)}let o=t.in._zod.run(e,r);return o instanceof Promise?o.then(e=>re(e,t.out,r)):re(o,t.out,r)}});function re(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},r)}let rt=z("$ZodPreprocess",(e,t)=>{t7.init(e,t)}),rr=z("$ZodReadonly",(e,t)=>{to.init(e,t),e_(e._zod,"propValues",()=>t.innerType._zod.propValues),e_(e._zod,"values",()=>t.innerType._zod.values),e_(e._zod,"optin",()=>t.innerType?._zod?.optin),e_(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(e,r)=>{if("backward"===r.direction)return t.innerType._zod.run(e,r);let o=t.innerType._zod.run(e,r);return o instanceof Promise?o.then(ro):ro(o)}});function ro(e){return e.value=Object.freeze(e.value),e}let ra=z("$ZodLazy",(e,t)=>{to.init(e,t),e_(e._zod,"innerType",()=>(t._cachedInner||(t._cachedInner=t.getter()),t._cachedInner)),e_(e._zod,"pattern",()=>e._zod.innerType?._zod?.pattern),e_(e._zod,"propValues",()=>e._zod.innerType?._zod?.propValues),e_(e._zod,"optin",()=>e._zod.innerType?._zod?.optin??void 0),e_(e._zod,"optout",()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(t,r)=>e._zod.innerType._zod.run(t,r)}),ri=z("$ZodCustom",(e,t)=>{eL.init(e,t),to.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=r=>{let o=r.value,a=t.fn(o);if(a instanceof Promise)return a.then(t=>rs(t,r,o,e));rs(a,r,o,e)}});function rs(e,t,r,o){if(!e){let e={code:"custom",input:r,inst:o,path:[...o._zod.def.path??[]],continue:!o._zod.def.abort};o._zod.def.params&&(e.params=o._zod.def.params),t.issues.push(eM(e))}}Symbol("ZodOutput"),Symbol("ZodInput");class rn{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let r=t[0];return this._map.set(e,r),r&&"object"==typeof r&&"id"in r&&this._idmap.set(r.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&"object"==typeof t&&"id"in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let r={...this.get(t)??{}};delete r.id;let o={...r,...this._map.get(e)};return Object.keys(o).length?o:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}(S=globalThis).__zod_globalRegistry??(S.__zod_globalRegistry=new rn);let rl=globalThis.__zod_globalRegistry;function rc(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...eO(t)})}function ru(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...eO(t)})}function rd(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...eO(t)})}function rp(e,t){return new eD({check:"less_than",...eO(t),value:e,inclusive:!1})}function rh(e,t){return new eD({check:"less_than",...eO(t),value:e,inclusive:!0})}function rm(e,t){return new eV({check:"greater_than",...eO(t),value:e,inclusive:!1})}function rf(e,t){return new eV({check:"greater_than",...eO(t),value:e,inclusive:!0})}function ry(e,t){return new eH({check:"multiple_of",...eO(t),value:e})}function rg(e,t){return new eK({check:"max_length",...eO(t),maximum:e})}function rv(e,t){return new eJ({check:"min_length",...eO(t),minimum:e})}function r_(e,t){return new eZ({check:"length_equals",...eO(t),length:e})}function rb(e){return new e1({check:"overwrite",tx:e})}function rS(e){let t=e?.target??"draft-2020-12";return"draft-4"===t&&(t="draft-04"),"draft-7"===t&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??rl,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function rw(e,t,r={path:[],schemaPath:[]}){var o;let a=e._zod.def,i=t.seen.get(e);if(i)return i.count++,r.schemaPath.includes(e)&&(i.cycle=r.path),i.schema;let s={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,s);let n=e._zod.toJSONSchema?.();if(n)s.schema=n;else{let o={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,s.schema,o);else{let r=s.schema,i=t.processors[a.type];if(!i)throw Error(`[toJSONSchema]: Non-representable type encountered: ${a.type}`);i(e,t,r,o)}let i=e._zod.parent;i&&(s.ref||(s.ref=i),rw(i,t,o),t.seen.get(i).isParent=!0)}let l=t.metadataRegistry.get(e);return l&&Object.assign(s.schema,l),"input"===t.io&&function e(t,r){let o=r??{seen:new Set};if(o.seen.has(t))return!1;o.seen.add(t);let a=t._zod.def;if("transform"===a.type)return!0;if("array"===a.type)return e(a.element,o);if("set"===a.type)return e(a.valueType,o);if("lazy"===a.type)return e(a.getter(),o);if("promise"===a.type||"optional"===a.type||"nonoptional"===a.type||"nullable"===a.type||"readonly"===a.type||"default"===a.type||"prefault"===a.type)return e(a.innerType,o);if("intersection"===a.type)return e(a.left,o)||e(a.right,o);if("record"===a.type||"map"===a.type)return e(a.keyType,o)||e(a.valueType,o);if("pipe"===a.type)return!!t._zod.traits.has("$ZodCodec")||e(a.in,o)||e(a.out,o);if("object"===a.type){for(let t in a.shape)if(e(a.shape[t],o))return!0;return!1}if("union"===a.type){for(let t of a.options)if(e(t,o))return!0;return!1}if("tuple"===a.type){for(let t of a.items)if(e(t,o))return!0;if(a.rest&&e(a.rest,o))return!0}return!1}(e)&&(delete s.schema.examples,delete s.schema.default),"input"===t.io&&"_prefault"in s.schema&&((o=s.schema).default??(o.default=s.schema._prefault)),delete s.schema._prefault,t.seen.get(e).schema}function r$(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");let o=new Map;for(let t of e.seen.entries()){let r=e.metadataRegistry.get(t[0])?.id;if(r){let e=o.get(r);if(e&&e!==t[0])throw Error(`Duplicate schema id "${r}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);o.set(r,t[0])}}let a=t=>{if(t[1].schema.$ref)return;let o=t[1],{ref:a,defId:i}=(t=>{let o="draft-2020-12"===e.target?"$defs":"definitions";if(e.external){let r=e.external.registry.get(t[0])?.id,a=e.external.uri??(e=>e);if(r)return{ref:a(r)};let i=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=i,{defId:i,ref:`${a("__shared")}#/${o}/${i}`}}if(t[1]===r)return{ref:"#"};let a=`#/${o}/`,i=t[1].schema.id??`__schema${e.counter++}`;return{defId:i,ref:a+i}})(t);o.def={...o.schema},i&&(o.defId=i);let s=o.schema;for(let e in s)delete s[e];s.$ref=a};if("throw"===e.cycles)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join("/")}/<root>
61
+
62
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let r of e.seen.entries()){let o=r[1];if(t===r[0]){a(r);continue}if(e.external){let o=e.external.registry.get(r[0])?.id;if(t!==r[0]&&o){a(r);continue}}if(e.metadataRegistry.get(r[0])?.id||o.cycle||o.count>1&&"ref"===e.reused){a(r);continue}}}function rR(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");let o=t=>{let r=e.seen.get(t);if(null===r.ref)return;let a=r.def??r.schema,i={...a},s=r.ref;if(r.ref=null,s){o(s);let r=e.seen.get(s),n=r.schema;if(n.$ref&&("draft-07"===e.target||"draft-04"===e.target||"openapi-3.0"===e.target)?(a.allOf=a.allOf??[],a.allOf.push(n)):Object.assign(a,n),Object.assign(a,i),t._zod.parent===s)for(let e in a)"$ref"!==e&&"allOf"!==e&&(e in i||delete a[e]);if(n.$ref&&r.def)for(let e in a)"$ref"!==e&&"allOf"!==e&&e in r.def&&JSON.stringify(a[e])===JSON.stringify(r.def[e])&&delete a[e]}let n=t._zod.parent;if(n&&n!==s){o(n);let t=e.seen.get(n);if(t?.schema.$ref&&(a.$ref=t.schema.$ref,t.def))for(let e in a)"$ref"!==e&&"allOf"!==e&&e in t.def&&JSON.stringify(a[e])===JSON.stringify(t.def[e])&&delete a[e]}e.override({zodSchema:t,jsonSchema:a,path:r.path??[]})};for(let t of[...e.seen.entries()].reverse())o(t[0]);let a={};if("draft-2020-12"===e.target?a.$schema="https://json-schema.org/draft/2020-12/schema":"draft-07"===e.target?a.$schema="http://json-schema.org/draft-07/schema#":"draft-04"===e.target?a.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){let r=e.external.registry.get(t)?.id;if(!r)throw Error("Schema is missing an `id` property");a.$id=e.external.uri(r)}Object.assign(a,r.def??r.schema);let i=e.metadataRegistry.get(t)?.id;void 0!==i&&a.id===i&&delete a.id;let s=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,s[e.defId]=e.def)}e.external||Object.keys(s).length>0&&("draft-2020-12"===e.target?a.$defs=s:a.definitions=s);try{let r=JSON.parse(JSON.stringify(a));return Object.defineProperty(r,"~standard",{value:{...t["~standard"],jsonSchema:{input:rP(t,"input",e.processors),output:rP(t,"output",e.processors)}},enumerable:!1,writable:!1}),r}catch(e){throw Error("Error converting schema to JSON.")}}let rP=(e,t,r={})=>o=>{let{libraryOptions:a,target:i}=o??{},s=rS({...a??{},target:i,io:t,processors:r});return rw(e,s),r$(s,e),rR(s,e)},rE={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},rk=(e,t,r,o)=>{r.type="string";let{minimum:a,maximum:i,format:s,patterns:n,contentEncoding:l}=e._zod.bag;if("number"==typeof a&&(r.minLength=a),"number"==typeof i&&(r.maxLength=i),s&&(r.format=rE[s]??s,""===r.format&&delete r.format,"time"===s&&delete r.format),l&&(r.contentEncoding=l),n&&n.size>0){let e=[...n];1===e.length?r.pattern=e[0].source:e.length>1&&(r.allOf=[...e.map(e=>({..."draft-07"===t.target||"draft-04"===t.target||"openapi-3.0"===t.target?{type:"string"}:{},pattern:e.source}))])}},rx=(e,t,r,o)=>{let{minimum:a,maximum:i,format:s,multipleOf:n,exclusiveMaximum:l,exclusiveMinimum:c}=e._zod.bag;"string"==typeof s&&s.includes("int")?r.type="integer":r.type="number";let u="number"==typeof c&&c>=(a??-1/0),d="number"==typeof l&&l<=(i??1/0),p="draft-04"===t.target||"openapi-3.0"===t.target;u?p?(r.minimum=c,r.exclusiveMinimum=!0):r.exclusiveMinimum=c:"number"==typeof a&&(r.minimum=a),d?p?(r.maximum=l,r.exclusiveMaximum=!0):r.exclusiveMaximum=l:"number"==typeof i&&(r.maximum=i),"number"==typeof n&&(r.multipleOf=n)},rT=(e,t,r,o)=>{r.type="boolean"},rC=(e,t,r,o)=>{"openapi-3.0"===t.target?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"},rO=(e,t,r,o)=>{r.not={}},rj=(e,t,r,o)=>{},rI=(e,t,r,o)=>{},rN=(e,t,r,o)=>{let a=em(e._zod.def.entries);a.every(e=>"number"==typeof e)&&(r.type="number"),a.every(e=>"string"==typeof e)&&(r.type="string"),r.enum=a},rA=(e,t,r,o)=>{let a=e._zod.def,i=[];for(let e of a.values)if(void 0===e){if("throw"===t.unrepresentable)throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if("bigint"==typeof e)if("throw"===t.unrepresentable)throw Error("BigInt literals cannot be represented in JSON Schema");else i.push(Number(e));else i.push(e);if(0===i.length);else if(1===i.length){let e=i[0];r.type=null===e?"null":typeof e,"draft-04"===t.target||"openapi-3.0"===t.target?r.enum=[e]:r.const=e}else i.every(e=>"number"==typeof e)&&(r.type="number"),i.every(e=>"string"==typeof e)&&(r.type="string"),i.every(e=>"boolean"==typeof e)&&(r.type="boolean"),i.every(e=>null===e)&&(r.type="null"),r.enum=i},rz=(e,t,r,o)=>{if("throw"===t.unrepresentable)throw Error("Custom types cannot be represented in JSON Schema")},rq=(e,t,r,o)=>{if("throw"===t.unrepresentable)throw Error("Transforms cannot be represented in JSON Schema")},rM=(e,t,r,o)=>{let a=e._zod.def,{minimum:i,maximum:s}=e._zod.bag;"number"==typeof i&&(r.minItems=i),"number"==typeof s&&(r.maxItems=s),r.type="array",r.items=rw(a.element,t,{...o,path:[...o.path,"items"]})},rL=(e,t,r,o)=>{let a=e._zod.def;r.type="object",r.properties={};let i=a.shape;for(let e in i)r.properties[e]=rw(i[e],t,{...o,path:[...o.path,"properties",e]});let s=new Set([...new Set(Object.keys(i))].filter(e=>{let r=a.shape[e]._zod;return"input"===t.io?void 0===r.optin:void 0===r.optout}));s.size>0&&(r.required=Array.from(s)),a.catchall?._zod.def.type==="never"?r.additionalProperties=!1:a.catchall?a.catchall&&(r.additionalProperties=rw(a.catchall,t,{...o,path:[...o.path,"additionalProperties"]})):"output"===t.io&&(r.additionalProperties=!1)},rU=(e,t,r,o)=>{let a=e._zod.def,i=!1===a.inclusive,s=a.options.map((e,r)=>rw(e,t,{...o,path:[...o.path,i?"oneOf":"anyOf",r]}));i?r.oneOf=s:r.anyOf=s},rD=(e,t,r,o)=>{let a=e._zod.def,i=rw(a.left,t,{...o,path:[...o.path,"allOf",0]}),s=rw(a.right,t,{...o,path:[...o.path,"allOf",1]}),n=e=>"allOf"in e&&1===Object.keys(e).length;r.allOf=[...n(i)?i.allOf:[i],...n(s)?s.allOf:[s]]},rV=(e,t,r,o)=>{let a=e._zod.def;r.type="object";let i=a.keyType,s=i._zod.bag,n=s?.patterns;if("loose"===a.mode&&n&&n.size>0){let e=rw(a.valueType,t,{...o,path:[...o.path,"patternProperties","*"]});for(let t of(r.patternProperties={},n))r.patternProperties[t.source]=e}else("draft-07"===t.target||"draft-2020-12"===t.target)&&(r.propertyNames=rw(a.keyType,t,{...o,path:[...o.path,"propertyNames"]})),r.additionalProperties=rw(a.valueType,t,{...o,path:[...o.path,"additionalProperties"]});let l=i._zod.values;if(l){let e=[...l].filter(e=>"string"==typeof e||"number"==typeof e);e.length>0&&(r.required=e)}},rH=(e,t,r,o)=>{let a=e._zod.def,i=rw(a.innerType,t,o),s=t.seen.get(e);"openapi-3.0"===t.target?(s.ref=a.innerType,r.nullable=!0):r.anyOf=[i,{type:"null"}]},rF=(e,t,r,o)=>{let a=e._zod.def;rw(a.innerType,t,o),t.seen.get(e).ref=a.innerType},rK=(e,t,r,o)=>{let a=e._zod.def;rw(a.innerType,t,o),t.seen.get(e).ref=a.innerType,r.default=JSON.parse(JSON.stringify(a.defaultValue))},rJ=(e,t,r,o)=>{let a=e._zod.def;rw(a.innerType,t,o),t.seen.get(e).ref=a.innerType,"input"===t.io&&(r._prefault=JSON.parse(JSON.stringify(a.defaultValue)))},rZ=(e,t,r,o)=>{let a,i=e._zod.def;rw(i.innerType,t,o),t.seen.get(e).ref=i.innerType;try{a=i.catchValue(void 0)}catch{throw Error("Dynamic catch values are not supported in JSON Schema")}r.default=a},rW=(e,t,r,o)=>{let a=e._zod.def,i=a.in._zod.traits.has("$ZodTransform"),s="input"===t.io?i?a.out:a.in:a.out;rw(s,t,o),t.seen.get(e).ref=s},rB=(e,t,r,o)=>{let a=e._zod.def;rw(a.innerType,t,o),t.seen.get(e).ref=a.innerType,r.readOnly=!0},rG=(e,t,r,o)=>{let a=e._zod.def;rw(a.innerType,t,o),t.seen.get(e).ref=a.innerType},rX=(e,t,r,o)=>{let a=e._zod.innerType;rw(a,t,o),t.seen.get(e).ref=a},rY={string:rk,number:rx,boolean:rT,bigint:(e,t,r,o)=>{if("throw"===t.unrepresentable)throw Error("BigInt cannot be represented in JSON Schema")},symbol:(e,t,r,o)=>{if("throw"===t.unrepresentable)throw Error("Symbols cannot be represented in JSON Schema")},null:rC,undefined:(e,t,r,o)=>{if("throw"===t.unrepresentable)throw Error("Undefined cannot be represented in JSON Schema")},void:(e,t,r,o)=>{if("throw"===t.unrepresentable)throw Error("Void cannot be represented in JSON Schema")},never:rO,any:rj,unknown:rI,date:(e,t,r,o)=>{if("throw"===t.unrepresentable)throw Error("Date cannot be represented in JSON Schema")},enum:rN,literal:rA,nan:(e,t,r,o)=>{if("throw"===t.unrepresentable)throw Error("NaN cannot be represented in JSON Schema")},template_literal:(e,t,r,o)=>{let a=e._zod.pattern;if(!a)throw Error("Pattern not found in template literal");r.type="string",r.pattern=a.source},file:(e,t,r,o)=>{let a={type:"string",format:"binary",contentEncoding:"binary"},{minimum:i,maximum:s,mime:n}=e._zod.bag;void 0!==i&&(a.minLength=i),void 0!==s&&(a.maxLength=s),n?1===n.length?(a.contentMediaType=n[0],Object.assign(r,a)):(Object.assign(r,a),r.anyOf=n.map(e=>({contentMediaType:e}))):Object.assign(r,a)},success:(e,t,r,o)=>{r.type="boolean"},custom:rz,function:(e,t,r,o)=>{if("throw"===t.unrepresentable)throw Error("Function types cannot be represented in JSON Schema")},transform:rq,map:(e,t,r,o)=>{if("throw"===t.unrepresentable)throw Error("Map cannot be represented in JSON Schema")},set:(e,t,r,o)=>{if("throw"===t.unrepresentable)throw Error("Set cannot be represented in JSON Schema")},array:rM,object:rL,union:rU,intersection:rD,tuple:(e,t,r,o)=>{let a=e._zod.def;r.type="array";let i="draft-2020-12"===t.target?"prefixItems":"items",s="draft-2020-12"===t.target||"openapi-3.0"===t.target?"items":"additionalItems",n=a.items.map((e,r)=>rw(e,t,{...o,path:[...o.path,i,r]})),l=a.rest?rw(a.rest,t,{...o,path:[...o.path,s,..."openapi-3.0"===t.target?[a.items.length]:[]]}):null;"draft-2020-12"===t.target?(r.prefixItems=n,l&&(r.items=l)):"openapi-3.0"===t.target?(r.items={anyOf:n},l&&r.items.anyOf.push(l),r.minItems=n.length,l||(r.maxItems=n.length)):(r.items=n,l&&(r.additionalItems=l));let{minimum:c,maximum:u}=e._zod.bag;"number"==typeof c&&(r.minItems=c),"number"==typeof u&&(r.maxItems=u)},record:rV,nullable:rH,nonoptional:rF,default:rK,prefault:rJ,catch:rZ,pipe:rW,readonly:rB,promise:(e,t,r,o)=>{let a=e._zod.def;rw(a.innerType,t,o),t.seen.get(e).ref=a.innerType},optional:rG,lazy:rX};function rQ(e,t){if("_idmap"in e){let r=rS({...t,processors:rY}),o={};for(let t of e._idmap.entries()){let[e,o]=t;rw(o,r)}let a={};for(let i of(r.external={registry:e,uri:t?.uri,defs:o},e._idmap.entries())){let[e,t]=i;r$(r,t),a[e]=rR(r,t)}return Object.keys(o).length>0&&(a.__shared={["draft-2020-12"===r.target?"$defs":"definitions"]:o}),{schemas:a}}let r=rS({...t,processors:rY});return rw(e,r),r$(r,e),rR(r,e)}let r0=z("ZodISODateTime",(e,t)=>{tg.init(e,t),of.init(e,t)});function r1(e){return new r0({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...eO(e)})}let r2=z("ZodISODate",(e,t)=>{tv.init(e,t),of.init(e,t)});function r9(e){return new r2({type:"string",format:"date",check:"string_format",...eO(e)})}let r4=z("ZodISOTime",(e,t)=>{t_.init(e,t),of.init(e,t)}),r5=z("ZodISODuration",(e,t)=>{tb.init(e,t),of.init(e,t)}),r3=z("ZodError",(e,t)=>{e4.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:t=>(function(e,t=e=>e.message){let r={_errors:[]},o=(e,a=[])=>{for(let i of e.issues)if("invalid_union"===i.code&&i.errors.length)i.errors.map(e=>o({issues:e},[...a,...i.path]));else if("invalid_key"===i.code)o({issues:i.issues},[...a,...i.path]);else if("invalid_element"===i.code)o({issues:i.issues},[...a,...i.path]);else{let e=[...a,...i.path];if(0===e.length)r._errors.push(t(i));else{let o=r,a=0;for(;a<e.length;){let r=e[a];a===e.length-1?(o[r]=o[r]||{_errors:[]},o[r]._errors.push(t(i))):o[r]=o[r]||{_errors:[]},o=o[r],a++}}}};return o(e),r})(e,t)},flatten:{value:t=>(function(e,t=e=>e.message){let r={},o=[];for(let a of e.issues)a.path.length>0?(r[a.path[0]]=r[a.path[0]]||[],r[a.path[0]].push(t(a))):o.push(t(a));return{formErrors:o,fieldErrors:r}})(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,ef,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,ef,2)}},isEmpty:{get:()=>0===e.issues.length}})},{Parent:Error}),r6=e3(r3),r8=e6(r3),r7=e8(r3),oe=te(r3),ot=(l=r3,(e,t,r)=>{let o=r?{...r,direction:"backward"}:{direction:"backward"};return e3(l)(e,t,o)}),or=(c=r3,(e,t,r)=>e3(c)(e,t,r)),oo=(u=r3,async(e,t,r)=>{let o=r?{...r,direction:"backward"}:{direction:"backward"};return e6(u)(e,t,o)}),oa=(d=r3,async(e,t,r)=>e6(d)(e,t,r)),oi=(p=r3,(e,t,r)=>{let o=r?{...r,direction:"backward"}:{direction:"backward"};return e8(p)(e,t,o)}),os=(h=r3,(e,t,r)=>e8(h)(e,t,r)),on=(m=r3,async(e,t,r)=>{let o=r?{...r,direction:"backward"}:{direction:"backward"};return te(m)(e,t,o)}),ol=(f=r3,async(e,t,r)=>te(f)(e,t,r)),oc=new WeakMap;function ou(e,t,r){let o=Object.getPrototypeOf(e),a=oc.get(o);if(a||(a=new Set,oc.set(o,a)),!a.has(t))for(let e in a.add(t),r){let t=r[e];Object.defineProperty(o,e,{configurable:!0,enumerable:!1,get(){let r=t.bind(this);return Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:r}),r},set(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:t})}})}}let od=z("ZodType",(e,t)=>(to.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:rP(e,"input"),output:rP(e,"output")}}),e.toJSONSchema=((e,t={})=>r=>{let o=rS({...r,processors:t});return rw(e,o),r$(o,e),rR(o,e)})(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(t,r)=>r6(e,t,r,{callee:e.parse}),e.safeParse=(t,r)=>r7(e,t,r),e.parseAsync=async(t,r)=>r8(e,t,r,{callee:e.parseAsync}),e.safeParseAsync=async(t,r)=>oe(e,t,r),e.spa=e.safeParseAsync,e.encode=(t,r)=>ot(e,t,r),e.decode=(t,r)=>or(e,t,r),e.encodeAsync=async(t,r)=>oo(e,t,r),e.decodeAsync=async(t,r)=>oa(e,t,r),e.safeEncode=(t,r)=>oi(e,t,r),e.safeDecode=(t,r)=>os(e,t,r),e.safeEncodeAsync=async(t,r)=>on(e,t,r),e.safeDecodeAsync=async(t,r)=>ol(e,t,r),ou(e,"ZodType",{check(...e){let t=this.def;return this.clone(eS(t,{checks:[...t.checks??[],...e.map(e=>"function"==typeof e?{_zod:{check:e,def:{check:"custom"},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return eC(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(function(e,t={}){return new ag({type:"custom",check:"custom",fn:e,...eO(t)})}(e,t))},superRefine(e,t){var r,o,a,i,s;let n,l;return this.check((r=e,o=t,a=r,i=e=>(e.addIssue=t=>{"string"==typeof t?e.issues.push(eM(t,e.value,n._zod.def)):(t.fatal&&(t.continue=!1),t.code??(t.code="custom"),t.input??(t.input=e.value),t.inst??(t.inst=n),t.continue??(t.continue=!n._zod.def.abort),e.issues.push(eM(t)))},a(e.value,e)),(l=new eL({check:"custom",...eO(s=o)}))._zod.check=i,n=l))},overwrite(e){return this.check(rb(e))},optional(){return ao(this)},exactOptional(){var e;return e=this,new aa({type:"optional",innerType:e})},nullable(){return as(this)},nullish(){return ao(as(this))},nonoptional(e){var t,r;return t=this,new ac({type:"nonoptional",innerType:t,...eO(r=e)})},array(){return oW(this)},or(e){return oQ([this,e])},and(e){return o9(this,e)},transform(e){return ap(this,at(e))},default(e){var t,r;return t=this,r=e,new an({type:"default",innerType:t,get defaultValue(){return"function"==typeof r?r():ek(r)}})},prefault(e){var t,r;return t=this,r=e,new al({type:"prefault",innerType:t,get defaultValue(){return"function"==typeof r?r():ek(r)}})},catch(e){var t,r;return t=this,new au({type:"catch",innerType:t,catchValue:"function"==typeof(r=e)?r:()=>r})},pipe(e){return ap(this,e)},readonly(){var e;return e=this,new am({type:"readonly",innerType:e})},describe(e){let t=this.clone();return rl.add(t,{description:e}),t},meta(...e){if(0===e.length)return rl.get(this);let t=this.clone();return rl.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e){return e(this)}}),Object.defineProperty(e,"description",{get:()=>rl.get(e)?.description,configurable:!0}),e)),op=z("_ZodString",(e,t)=>{ta.init(e,t),od.init(e,t),e._zod.processJSONSchema=(t,r,o)=>rk(e,t,r,o);let r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,ou(e,"_ZodString",{regex(...e){return this.check(function(e,t){return new eB({check:"string_format",format:"regex",...eO(t),pattern:e})}(...e))},includes(...e){return this.check(function(e,t){return new eY({check:"string_format",format:"includes",...eO(t),includes:e})}(...e))},startsWith(...e){return this.check(function(e,t){return new eQ({check:"string_format",format:"starts_with",...eO(t),prefix:e})}(...e))},endsWith(...e){return this.check(function(e,t){return new e0({check:"string_format",format:"ends_with",...eO(t),suffix:e})}(...e))},min(...e){return this.check(rv(...e))},max(...e){return this.check(rg(...e))},length(...e){return this.check(r_(...e))},nonempty(...e){return this.check(rv(1,...e))},lowercase(e){return this.check(new eG({check:"string_format",format:"lowercase",...eO(e)}))},uppercase(e){return this.check(new eX({check:"string_format",format:"uppercase",...eO(e)}))},trim(){return this.check(rb(e=>e.trim()))},normalize(...e){return this.check(function(e){return rb(t=>t.normalize(e))}(...e))},toLowerCase(){return this.check(rb(e=>e.toLowerCase()))},toUpperCase(){return this.check(rb(e=>e.toUpperCase()))},slugify(){return this.check(rb(e=>e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")))}})}),oh=z("ZodString",(e,t)=>{ta.init(e,t),op.init(e,t),e.email=t=>e.check(rc(oy,t)),e.url=t=>e.check(rd(o_,t)),e.jwt=t=>e.check(new oN({type:"string",format:"jwt",check:"string_format",abort:!1,...eO(t)})),e.emoji=t=>e.check(new ob({type:"string",format:"emoji",check:"string_format",abort:!1,...eO(t)})),e.guid=t=>e.check(ru(og,t)),e.uuid=t=>e.check(new ov({type:"string",format:"uuid",check:"string_format",abort:!1,...eO(t)})),e.uuidv4=t=>e.check(new ov({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...eO(t)})),e.uuidv6=t=>e.check(new ov({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...eO(t)})),e.uuidv7=t=>e.check(new ov({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...eO(t)})),e.nanoid=t=>e.check(new oS({type:"string",format:"nanoid",check:"string_format",abort:!1,...eO(t)})),e.guid=t=>e.check(ru(og,t)),e.cuid=t=>e.check(new ow({type:"string",format:"cuid",check:"string_format",abort:!1,...eO(t)})),e.cuid2=t=>e.check(new o$({type:"string",format:"cuid2",check:"string_format",abort:!1,...eO(t)})),e.ulid=t=>e.check(new oR({type:"string",format:"ulid",check:"string_format",abort:!1,...eO(t)})),e.base64=t=>e.check(new oO({type:"string",format:"base64",check:"string_format",abort:!1,...eO(t)})),e.base64url=t=>e.check(new oj({type:"string",format:"base64url",check:"string_format",abort:!1,...eO(t)})),e.xid=t=>e.check(new oP({type:"string",format:"xid",check:"string_format",abort:!1,...eO(t)})),e.ksuid=t=>e.check(new oE({type:"string",format:"ksuid",check:"string_format",abort:!1,...eO(t)})),e.ipv4=t=>e.check(new ok({type:"string",format:"ipv4",check:"string_format",abort:!1,...eO(t)})),e.ipv6=t=>e.check(new ox({type:"string",format:"ipv6",check:"string_format",abort:!1,...eO(t)})),e.cidrv4=t=>e.check(new oT({type:"string",format:"cidrv4",check:"string_format",abort:!1,...eO(t)})),e.cidrv6=t=>e.check(new oC({type:"string",format:"cidrv6",check:"string_format",abort:!1,...eO(t)})),e.e164=t=>e.check(new oI({type:"string",format:"e164",check:"string_format",abort:!1,...eO(t)})),e.datetime=t=>e.check(r1(t)),e.date=t=>e.check(r9(t)),e.time=t=>{var r;return e.check(new r4({type:"string",format:"time",check:"string_format",precision:null,...eO(r=t)}))},e.duration=t=>{var r;return e.check(new r5({type:"string",format:"duration",check:"string_format",...eO(r=t)}))}});function om(e){return new oh({type:"string",...eO(e)})}let of=z("ZodStringFormat",(e,t)=>{ti.init(e,t),op.init(e,t)}),oy=z("ZodEmail",(e,t)=>{tl.init(e,t),of.init(e,t)}),og=z("ZodGUID",(e,t)=>{ts.init(e,t),of.init(e,t)}),ov=z("ZodUUID",(e,t)=>{tn.init(e,t),of.init(e,t)}),o_=z("ZodURL",(e,t)=>{tc.init(e,t),of.init(e,t)}),ob=z("ZodEmoji",(e,t)=>{tu.init(e,t),of.init(e,t)}),oS=z("ZodNanoID",(e,t)=>{td.init(e,t),of.init(e,t)}),ow=z("ZodCUID",(e,t)=>{tp.init(e,t),of.init(e,t)}),o$=z("ZodCUID2",(e,t)=>{th.init(e,t),of.init(e,t)}),oR=z("ZodULID",(e,t)=>{tm.init(e,t),of.init(e,t)}),oP=z("ZodXID",(e,t)=>{tf.init(e,t),of.init(e,t)}),oE=z("ZodKSUID",(e,t)=>{ty.init(e,t),of.init(e,t)}),ok=z("ZodIPv4",(e,t)=>{tS.init(e,t),of.init(e,t)}),ox=z("ZodIPv6",(e,t)=>{tw.init(e,t),of.init(e,t)}),oT=z("ZodCIDRv4",(e,t)=>{t$.init(e,t),of.init(e,t)}),oC=z("ZodCIDRv6",(e,t)=>{tR.init(e,t),of.init(e,t)}),oO=z("ZodBase64",(e,t)=>{tE.init(e,t),of.init(e,t)}),oj=z("ZodBase64URL",(e,t)=>{tk.init(e,t),of.init(e,t)}),oI=z("ZodE164",(e,t)=>{tx.init(e,t),of.init(e,t)}),oN=z("ZodJWT",(e,t)=>{tT.init(e,t),of.init(e,t)}),oA=z("ZodNumber",(e,t)=>{tC.init(e,t),od.init(e,t),e._zod.processJSONSchema=(t,r,o)=>rx(e,t,r,o),ou(e,"ZodNumber",{gt(e,t){return this.check(rm(e,t))},gte(e,t){return this.check(rf(e,t))},min(e,t){return this.check(rf(e,t))},lt(e,t){return this.check(rp(e,t))},lte(e,t){return this.check(rh(e,t))},max(e,t){return this.check(rh(e,t))},int(e){return this.check(oM(e))},safe(e){return this.check(oM(e))},positive(e){return this.check(rm(0,e))},nonnegative(e){return this.check(rf(0,e))},negative(e){return this.check(rp(0,e))},nonpositive(e){return this.check(rh(0,e))},multipleOf(e,t){return this.check(ry(e,t))},step(e,t){return this.check(ry(e,t))},finite(){return this}});let r=e._zod.bag;e.minValue=Math.max(r.minimum??-1/0,r.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(r.maximum??1/0,r.exclusiveMaximum??1/0)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),e.isFinite=!0,e.format=r.format??null});function oz(e){return new oA({type:"number",checks:[],...eO(e)})}let oq=z("ZodNumberFormat",(e,t)=>{tO.init(e,t),oA.init(e,t)});function oM(e){return new oq({type:"number",check:"number_format",abort:!1,format:"safeint",...eO(e)})}let oL=z("ZodBoolean",(e,t)=>{tj.init(e,t),od.init(e,t),e._zod.processJSONSchema=(t,r,o)=>rT(e,t,r,o)});function oU(e){return new oL({type:"boolean",...eO(e)})}let oD=z("ZodNull",(e,t)=>{tI.init(e,t),od.init(e,t),e._zod.processJSONSchema=(t,r,o)=>rC(e,t,r,o)});function oV(e){return new oD({type:"null",...eO(e)})}let oH=z("ZodAny",(e,t)=>{tN.init(e,t),od.init(e,t),e._zod.processJSONSchema=(t,r,o)=>rj(e,t,r,o)}),oF=z("ZodUnknown",(e,t)=>{tA.init(e,t),od.init(e,t),e._zod.processJSONSchema=(t,r,o)=>rI(e,t,r,o)});function oK(){return new oF({type:"unknown"})}let oJ=z("ZodNever",(e,t)=>{tz.init(e,t),od.init(e,t),e._zod.processJSONSchema=(t,r,o)=>rO(e,t,r,o)}),oZ=z("ZodArray",(e,t)=>{tM.init(e,t),od.init(e,t),e._zod.processJSONSchema=(t,r,o)=>rM(e,t,r,o),e.element=t.element,ou(e,"ZodArray",{min(e,t){return this.check(rv(e,t))},nonempty(e){return this.check(rv(1,e))},max(e,t){return this.check(rg(e,t))},length(e,t){return this.check(r_(e,t))},unwrap(){return this.element}})});function oW(e,t){return new oZ({type:"array",element:e,...eO(t)})}let oB=z("ZodObject",(e,t)=>{tH.init(e,t),od.init(e,t),e._zod.processJSONSchema=(t,r,o)=>rL(e,t,r,o),e_(e,"shape",()=>t.shape),ou(e,"ZodObject",{keyof(){return o6(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:oK()})},loose(){return this.clone({...this._zod.def,catchall:oK()})},strict(){return this.clone({...this._zod.def,catchall:new oJ({type:"never",...eO(void 0)})})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return function(e,t){if(!eE(t))throw Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let r=e._zod.def.shape;for(let e in t)if(void 0!==Object.getOwnPropertyDescriptor(r,e))throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let o=eS(e._zod.def,{get shape(){let r={...e._zod.def.shape,...t};return eb(this,"shape",r),r}});return eC(e,o)}(this,e)},safeExtend(e){var t=this,r=e;if(!eE(r))throw Error("Invalid input to safeExtend: expected a plain object");let o=eS(t._zod.def,{get shape(){let e={...t._zod.def.shape,...r};return eb(this,"shape",e),e}});return eC(t,o)},merge(e){var t=this,r=e;if(t._zod.def.checks?.length)throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let o=eS(t._zod.def,{get shape(){let e={...t._zod.def.shape,...r._zod.def.shape};return eb(this,"shape",e),e},get catchall(){return r._zod.def.catchall},checks:r._zod.def.checks??[]});return eC(t,o)},pick(e){return function(e,t){let r=e._zod.def,o=r.checks;if(o&&o.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let a=eS(e._zod.def,{get shape(){let e={};for(let o in t){if(!(o in r.shape))throw Error(`Unrecognized key: "${o}"`);t[o]&&(e[o]=r.shape[o])}return eb(this,"shape",e),e},checks:[]});return eC(e,a)}(this,e)},omit(e){return function(e,t){let r=e._zod.def,o=r.checks;if(o&&o.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let a=eS(e._zod.def,{get shape(){let o={...e._zod.def.shape};for(let e in t){if(!(e in r.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete o[e]}return eb(this,"shape",o),o},checks:[]});return eC(e,a)}(this,e)},partial(...e){return function(e,t,r){let o=t._zod.def.checks;if(o&&o.length>0)throw Error(".partial() cannot be used on object schemas containing refinements");let a=eS(t._zod.def,{get shape(){let o=t._zod.def.shape,a={...o};if(r)for(let t in r){if(!(t in o))throw Error(`Unrecognized key: "${t}"`);r[t]&&(a[t]=e?new e({type:"optional",innerType:o[t]}):o[t])}else for(let t in o)a[t]=e?new e({type:"optional",innerType:o[t]}):o[t];return eb(this,"shape",a),a},checks:[]});return eC(t,a)}(ar,this,e[0])},required(...e){var t,r,o;let a;return t=ac,r=this,o=e[0],a=eS(r._zod.def,{get shape(){let e=r._zod.def.shape,a={...e};if(o)for(let r in o){if(!(r in a))throw Error(`Unrecognized key: "${r}"`);o[r]&&(a[r]=new t({type:"nonoptional",innerType:e[r]}))}else for(let r in e)a[r]=new t({type:"nonoptional",innerType:e[r]});return eb(this,"shape",a),a}}),eC(r,a)}})});function oG(e,t){return new oB({type:"object",shape:e??{},...eO(t)})}function oX(e,t){return new oB({type:"object",shape:e,catchall:oK(),...eO(t)})}let oY=z("ZodUnion",(e,t)=>{tK.init(e,t),od.init(e,t),e._zod.processJSONSchema=(t,r,o)=>rU(e,t,r,o),e.options=t.options});function oQ(e,t){return new oY({type:"union",options:e,...eO(t)})}let o0=z("ZodDiscriminatedUnion",(e,t)=>{oY.init(e,t),tJ.init(e,t)});function o1(e,t,r){return new o0({type:"union",options:t,discriminator:e,...eO(r)})}let o2=z("ZodIntersection",(e,t)=>{tZ.init(e,t),od.init(e,t),e._zod.processJSONSchema=(t,r,o)=>rD(e,t,r,o)});function o9(e,t){return new o2({type:"intersection",left:e,right:t})}let o4=z("ZodRecord",(e,t)=>{tB.init(e,t),od.init(e,t),e._zod.processJSONSchema=(t,r,o)=>rV(e,t,r,o),e.keyType=t.keyType,e.valueType=t.valueType});function o5(e,t,r){return new o4(t&&t._zod?{type:"record",keyType:e,valueType:t,...eO(r)}:{type:"record",keyType:om(),valueType:e,...eO(t)})}let o3=z("ZodEnum",(e,t)=>{tG.init(e,t),od.init(e,t),e._zod.processJSONSchema=(t,r,o)=>rN(e,t,r,o),e.enum=t.entries,e.options=Object.values(t.entries);let r=new Set(Object.keys(t.entries));e.extract=(e,o)=>{let a={};for(let o of e)if(r.has(o))a[o]=t.entries[o];else throw Error(`Key ${o} not found in enum`);return new o3({...t,checks:[],...eO(o),entries:a})},e.exclude=(e,o)=>{let a={...t.entries};for(let t of e)if(r.has(t))delete a[t];else throw Error(`Key ${t} not found in enum`);return new o3({...t,checks:[],...eO(o),entries:a})}});function o6(e,t){return new o3({type:"enum",entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...eO(t)})}let o8=z("ZodLiteral",(e,t)=>{tX.init(e,t),od.init(e,t),e._zod.processJSONSchema=(t,r,o)=>rA(e,t,r,o),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function o7(e,t){return new o8({type:"literal",values:Array.isArray(e)?e:[e],...eO(t)})}let ae=z("ZodTransform",(e,t)=>{tY.init(e,t),od.init(e,t),e._zod.processJSONSchema=(t,r,o)=>rq(e,t,r,o),e._zod.parse=(r,o)=>{if("backward"===o.direction)throw new M(e.constructor.name);r.addIssue=o=>{"string"==typeof o?r.issues.push(eM(o,r.value,t)):(o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=r.value),o.inst??(o.inst=e),r.issues.push(eM(o)))};let a=t.transform(r.value,r);return a instanceof Promise?a.then(e=>(r.value=e,r.fallback=!0,r)):(r.value=a,r.fallback=!0,r)}});function at(e){return new ae({type:"transform",transform:e})}let ar=z("ZodOptional",(e,t)=>{t0.init(e,t),od.init(e,t),e._zod.processJSONSchema=(t,r,o)=>rG(e,t,r,o),e.unwrap=()=>e._zod.def.innerType});function ao(e){return new ar({type:"optional",innerType:e})}let aa=z("ZodExactOptional",(e,t)=>{t1.init(e,t),od.init(e,t),e._zod.processJSONSchema=(t,r,o)=>rG(e,t,r,o),e.unwrap=()=>e._zod.def.innerType}),ai=z("ZodNullable",(e,t)=>{t2.init(e,t),od.init(e,t),e._zod.processJSONSchema=(t,r,o)=>rH(e,t,r,o),e.unwrap=()=>e._zod.def.innerType});function as(e){return new ai({type:"nullable",innerType:e})}let an=z("ZodDefault",(e,t)=>{t9.init(e,t),od.init(e,t),e._zod.processJSONSchema=(t,r,o)=>rK(e,t,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap}),al=z("ZodPrefault",(e,t)=>{t5.init(e,t),od.init(e,t),e._zod.processJSONSchema=(t,r,o)=>rJ(e,t,r,o),e.unwrap=()=>e._zod.def.innerType}),ac=z("ZodNonOptional",(e,t)=>{t3.init(e,t),od.init(e,t),e._zod.processJSONSchema=(t,r,o)=>rF(e,t,r,o),e.unwrap=()=>e._zod.def.innerType}),au=z("ZodCatch",(e,t)=>{t8.init(e,t),od.init(e,t),e._zod.processJSONSchema=(t,r,o)=>rZ(e,t,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap}),ad=z("ZodPipe",(e,t)=>{t7.init(e,t),od.init(e,t),e._zod.processJSONSchema=(t,r,o)=>rW(e,t,r,o),e.in=t.in,e.out=t.out});function ap(e,t){return new ad({type:"pipe",in:e,out:t})}let ah=z("ZodPreprocess",(e,t)=>{ad.init(e,t),rt.init(e,t)}),am=z("ZodReadonly",(e,t)=>{rr.init(e,t),od.init(e,t),e._zod.processJSONSchema=(t,r,o)=>rB(e,t,r,o),e.unwrap=()=>e._zod.def.innerType}),af=z("ZodLazy",(e,t)=>{ra.init(e,t),od.init(e,t),e._zod.processJSONSchema=(t,r,o)=>rX(e,t,r,o),e.unwrap=()=>e._zod.def.getter()});function ay(e){return new af({type:"lazy",getter:e})}let ag=z("ZodCustom",(e,t)=>{ri.init(e,t),od.init(e,t),e._zod.processJSONSchema=(t,r,o)=>rz(e,t,r,o)});function av(e,t){return new ah({type:"pipe",in:at(e),out:t})}let a_="custom";w||(w={});let ab="2025-11-25",aS=[ab,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],aw="io.modelcontextprotocol/protocolVersion",a$="io.modelcontextprotocol/clientInfo",aR="io.modelcontextprotocol/serverInfo",aP="io.modelcontextprotocol/clientCapabilities",aE="io.modelcontextprotocol/subscriptionId",ak="io.modelcontextprotocol/logLevel",ax=ay(()=>oQ([om(),oz(),oU(),oV(),o5(om(),ax),oW(ax)])),aT=o5(om(),ax),aC=oW(ax),aO=oQ([om(),oz().int()]),aj=om(),aI=oG({ttl:oz().optional()}),aN=oG({taskId:om()}),aA=oX({progressToken:aO.optional(),"io.modelcontextprotocol/related-task":aN.optional()}),az=oG({_meta:aA.optional()}),aq=az.extend({task:aI.optional()}),aM=oG({method:om(),params:az.loose().optional()}),aL=oG({_meta:aA.optional()}),aU=oG({method:om(),params:aL.loose().optional()}),aD=oX({get[aR](){return a2.optional().catch(void 0)}}),aV=oX({_meta:aD.optional()}),aH=oQ([om(),oz().int()]),aF=oG({jsonrpc:o7("2.0"),id:aH,...aM.shape}).strict(),aK=oG({jsonrpc:o7("2.0"),...aU.shape}).strict(),aJ=oG({jsonrpc:o7("2.0"),id:aH,result:aV}).strict(),aZ=oG({jsonrpc:o7("2.0"),id:aH.optional(),error:oG({code:oz().int(),message:om(),data:oK().optional()})}).strict(),aW=oQ([aF,aK,aJ,aZ]),aB=oQ([aJ,aZ]),aG=aV.strict(),aX=aL.extend({requestId:aH.optional(),reason:om().optional()}),aY=aU.extend({method:o7("notifications/cancelled"),params:aX}),aQ=oG({src:om(),mimeType:om().optional(),sizes:oW(om()).optional(),theme:o6(["light","dark"]).optional()}),a0=oG({icons:oW(aQ).optional()}),a1=oG({name:om(),title:om().optional()}),a2=a1.extend({...a1.shape,...a0.shape,version:om(),websiteUrl:om().optional(),description:om().optional()}),a9=o9(oG({applyDefaults:oU().optional()}),aT),a4=av(e=>e&&"object"==typeof e&&!Array.isArray(e)&&0===Object.keys(e).length?{form:{}}:e,o9(oG({form:a9.optional(),url:aT.optional()}),aT.optional())),a5=oX({list:aT.optional(),cancel:aT.optional(),requests:oX({sampling:oX({createMessage:aT.optional()}).optional(),elicitation:oX({create:aT.optional()}).optional()}).optional()}),a3=oX({list:aT.optional(),cancel:aT.optional(),requests:oX({tools:oX({call:aT.optional()}).optional()}).optional()}),a6=oG({experimental:o5(om(),aT).optional(),sampling:oG({context:aT.optional(),tools:aT.optional()}).optional(),elicitation:a4.optional(),roots:oG({listChanged:oU().optional()}).optional(),tasks:a5.optional(),extensions:o5(om(),aT).optional()}),a8=az.extend({protocolVersion:om(),capabilities:a6,clientInfo:a2}),a7=aM.extend({method:o7("initialize"),params:a8}),ie=oG({experimental:o5(om(),aT).optional(),logging:aT.optional(),completions:aT.optional(),prompts:oG({listChanged:oU().optional()}).optional(),resources:oG({subscribe:oU().optional(),listChanged:oU().optional()}).optional(),tools:oG({listChanged:oU().optional()}).optional(),tasks:a3.optional(),extensions:o5(om(),aT).optional()}),it=aV.extend({protocolVersion:om(),capabilities:ie,serverInfo:a2,instructions:om().optional()}),ir=aU.extend({method:o7("notifications/initialized"),params:aL.optional()}),io=aM.extend({method:o7("server/discover"),params:az.optional()}),ia=aV.extend({supportedVersions:oW(om()),capabilities:ie,instructions:om().optional()}),ii=aM.extend({method:o7("ping"),params:az.optional()}),is=oG({progress:oz(),total:ao(oz()),message:ao(om())}),il=oG({...aL.shape,...is.shape,progressToken:aO}),ic=aU.extend({method:o7("notifications/progress"),params:il}),iu=az.extend({cursor:aj.optional()}),id=aM.extend({params:iu.optional()}),ip=aV.extend({nextCursor:aj.optional()}),ih=oG({uri:om(),mimeType:ao(om()),_meta:o5(om(),oK()).optional()}),im=ih.extend({text:om()}),iy=om().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),ig=ih.extend({blob:iy}),iv=o6(["user","assistant"]),i_=oG({audience:oW(iv).optional(),priority:oz().min(0).max(1).optional(),lastModified:r1({offset:!0}).optional()}),ib=oG({...a1.shape,...a0.shape,uri:om(),description:ao(om()),mimeType:ao(om()),size:ao(oz()),annotations:i_.optional(),_meta:ao(oX({}))}),iS=oG({...a1.shape,...a0.shape,uriTemplate:om(),description:ao(om()),mimeType:ao(om()),annotations:i_.optional(),_meta:ao(oX({}))}),iw=id.extend({method:o7("resources/list")}),i$=ip.extend({resources:oW(ib)}),iR=id.extend({method:o7("resources/templates/list")}),iP=ip.extend({resourceTemplates:oW(iS)}),iE=az.extend({uri:om()}),ik=aM.extend({method:o7("resources/read"),params:iE}),ix=aV.extend({contents:oW(oQ([im,ig]))}),iT=aU.extend({method:o7("notifications/resources/list_changed"),params:aL.optional()}),iC=aM.extend({method:o7("resources/subscribe"),params:iE}),iO=aM.extend({method:o7("resources/unsubscribe"),params:iE}),ij=oG({toolsListChanged:oU().optional(),promptsListChanged:oU().optional(),resourcesListChanged:oU().optional(),resourceSubscriptions:oW(om()).optional()}),iI=az.extend({notifications:ij}),iN=aM.extend({method:o7("subscriptions/listen"),params:iI}),iA=aL.extend({notifications:ij}),iz=aU.extend({method:o7("notifications/subscriptions/acknowledged"),params:iA}),iq=aD.extend({[aE]:aH}),iM=aV.extend({_meta:iq}),iL=aL.extend({uri:om()}),iU=aU.extend({method:o7("notifications/resources/updated"),params:iL}),iD=oG({name:om(),description:ao(om()),required:ao(oU())}),iV=oG({...a1.shape,...a0.shape,description:ao(om()),arguments:ao(oW(iD)),_meta:ao(oX({}))}),iH=id.extend({method:o7("prompts/list")}),iF=ip.extend({prompts:oW(iV)}),iK=az.extend({name:om(),arguments:o5(om(),om()).optional()}),iJ=aM.extend({method:o7("prompts/get"),params:iK}),iZ=oG({type:o7("text"),text:om(),annotations:i_.optional(),_meta:o5(om(),oK()).optional()}),iW=oG({type:o7("image"),data:iy,mimeType:om(),annotations:i_.optional(),_meta:o5(om(),oK()).optional()}),iB=oG({type:o7("audio"),data:iy,mimeType:om(),annotations:i_.optional(),_meta:o5(om(),oK()).optional()}),iG=oG({type:o7("tool_use"),name:om(),id:om(),input:o5(om(),oK()),_meta:o5(om(),oK()).optional()}),iX=oG({type:o7("resource"),resource:oQ([im,ig]),annotations:i_.optional(),_meta:o5(om(),oK()).optional()}),iY=ib.extend({type:o7("resource_link")}),iQ=oQ([iZ,iW,iB,iY,iX]),i0=oG({role:iv,content:iQ}),i1=aV.extend({description:om().optional(),messages:oW(i0)}),i2=aU.extend({method:o7("notifications/prompts/list_changed"),params:aL.optional()}),i9=oG({title:om().optional(),readOnlyHint:oU().optional(),destructiveHint:oU().optional(),idempotentHint:oU().optional(),openWorldHint:oU().optional()}),i4=oG({taskSupport:o6(["required","optional","forbidden"]).optional()}),i5=oG({...a1.shape,...a0.shape,description:om().optional(),inputSchema:oG({type:o7("object"),properties:o5(om(),ax).optional(),required:oW(om()).optional()}).catchall(oK()),outputSchema:oX({$schema:om().optional()}).optional(),annotations:i9.optional(),execution:i4.optional(),_meta:o5(om(),oK()).optional()}),i3=id.extend({method:o7("tools/list")}),i6=ip.extend({tools:oW(i5)}),i8=aV.extend({content:oW(iQ).default([]),structuredContent:oK().optional(),isError:oU().optional()}),i7=i8.or(aV.extend({toolResult:oK()})),se=aq.extend({name:om(),arguments:o5(om(),oK()).optional()}),st=aM.extend({method:o7("tools/call"),params:se}),sr=aU.extend({method:o7("notifications/tools/list_changed"),params:aL.optional()}),so=oG({autoRefresh:oU().default(!0),debounceMs:oz().int().nonnegative().default(300)}),sa=o6(["debug","info","notice","warning","error","critical","alert","emergency"]),si=az.extend({level:sa}),ss=aM.extend({method:o7("logging/setLevel"),params:si}),sn=aL.extend({level:sa,logger:om().optional(),data:oK()}),sl=aU.extend({method:o7("notifications/message"),params:sn}),sc=oG({name:om().optional()}),su=oG({hints:oW(sc).optional(),costPriority:oz().min(0).max(1).optional(),speedPriority:oz().min(0).max(1).optional(),intelligencePriority:oz().min(0).max(1).optional()}),sd=oG({mode:o6(["auto","required","none"]).optional()}),sp=oG({type:o7("tool_result"),toolUseId:om().describe("The unique identifier for the corresponding tool call."),content:oW(iQ),structuredContent:oK().optional(),isError:oU().optional(),_meta:o5(om(),oK()).optional()}),sh=o1("type",[iZ,iW,iB]),sm=o1("type",[iZ,iW,iB,iG,sp]),sf=oG({role:iv,content:oQ([sm,oW(sm)]),_meta:o5(om(),oK()).optional()}),sy=aq.extend({messages:oW(sf),modelPreferences:su.optional(),systemPrompt:om().optional(),includeContext:o6(["none","thisServer","allServers"]).optional(),temperature:oz().optional(),maxTokens:oz().int(),stopSequences:oW(om()).optional(),metadata:aT.optional(),tools:oW(i5).optional(),toolChoice:sd.optional()}),sg=aM.extend({method:o7("sampling/createMessage"),params:sy}),sv=aV.extend({model:om(),stopReason:ao(o6(["endTurn","stopSequence","maxTokens"]).or(om())),role:iv,content:sh}),s_=aV.extend({model:om(),stopReason:ao(o6(["endTurn","stopSequence","maxTokens","toolUse"]).or(om())),role:iv,content:oQ([sm,oW(sm)])}),sb=oG({type:o7("boolean"),title:om().optional(),description:om().optional(),default:oU().optional()}),sS=oG({type:o7("string"),title:om().optional(),description:om().optional(),minLength:oz().optional(),maxLength:oz().optional(),format:o6(["email","uri","date","date-time"]).optional(),default:om().optional()}),sw=oG({type:o6(["number","integer"]),title:om().optional(),description:om().optional(),minimum:oz().optional(),maximum:oz().optional(),default:oz().optional()}),s$=oG({type:o7("string"),title:om().optional(),description:om().optional(),enum:oW(om()),default:om().optional()}),sR=oG({type:o7("string"),title:om().optional(),description:om().optional(),oneOf:oW(oG({const:om(),title:om()})),default:om().optional()}),sP=oG({type:o7("string"),title:om().optional(),description:om().optional(),enum:oW(om()),enumNames:oW(om()).optional(),default:om().optional()}),sE=oQ([s$,sR]),sk=oG({type:o7("array"),title:om().optional(),description:om().optional(),minItems:oz().optional(),maxItems:oz().optional(),items:oG({type:o7("string"),enum:oW(om())}),default:oW(om()).optional()}),sx=oG({type:o7("array"),title:om().optional(),description:om().optional(),minItems:oz().optional(),maxItems:oz().optional(),items:oG({anyOf:oW(oG({const:om(),title:om()}))}),default:oW(om()).optional()}),sT=oQ([sk,sx]),sC=oQ([sP,sE,sT]),sO=oQ([sC,sb,sS,sw]),sj=aq.extend({mode:o7("form").optional(),message:om(),requestedSchema:oG({type:o7("object"),properties:o5(om(),sO),required:oW(om()).optional()}).catchall(oK())}),sI=aq.extend({mode:o7("url"),message:om(),elicitationId:om(),url:om().url()}),sN=oQ([sj,sI]),sA=aM.extend({method:o7("elicitation/create"),params:sN}),sz=aL.extend({elicitationId:om()}),sq=aU.extend({method:o7("notifications/elicitation/complete"),params:sz}),sM=aV.extend({action:o6(["accept","decline","cancel"]),content:av(e=>null===e?void 0:e,o5(om(),oQ([om(),oz(),oU(),oW(om())])).optional())}),sL=oG({type:o7("ref/resource"),uri:om()}),sU=oG({type:o7("ref/prompt"),name:om()}),sD=az.extend({ref:oQ([sU,sL]),argument:oG({name:om(),value:om()}),context:oG({arguments:o5(om(),om()).optional()}).optional()}),sV=aM.extend({method:o7("completion/complete"),params:sD}),sH=aV.extend({completion:oX({values:oW(om()).max(100),total:ao(oz().int()),hasMore:ao(oU())})}),sF=oG({uri:om().startsWith("file://"),name:om().optional(),_meta:o5(om(),oK()).optional()}),sK=aM.extend({method:o7("roots/list"),params:az.optional()}),sJ=aV.extend({roots:oW(sF)}),sZ=aU.extend({method:o7("notifications/roots/list_changed"),params:aL.optional()}),sW=oX({ttl:oz().optional(),pollInterval:oz().optional()}),sB=o6(["working","input_required","completed","failed","cancelled"]),sG=oG({taskId:om(),status:sB,ttl:oQ([oz(),oV()]),createdAt:om(),lastUpdatedAt:om(),pollInterval:ao(oz()),statusMessage:ao(om())}),sX=aV.extend({task:sG}),sY=aL.merge(sG),sQ=aU.extend({method:o7("notifications/tasks/status"),params:sY}),s0=aM.extend({method:o7("tasks/get"),params:az.extend({taskId:om()})}),s1=aV.merge(sG),s2=aM.extend({method:o7("tasks/result"),params:az.extend({taskId:om()})}),s9=aV.loose(),s4=id.extend({method:o7("tasks/list")}),s5=ip.extend({tasks:oW(sG)}),s3=aM.extend({method:o7("tasks/cancel"),params:az.extend({taskId:om()})}),s6=aV.merge(sG),s8=oQ([ii,a7,io,sV,ss,iJ,iH,iw,iR,ik,iC,iO,iN,st,i3]),s7=oQ([aY,ic,ir,sZ]),ne=oQ([aG,sv,s_,sM,sJ]),nt=oQ([ii,sg,sA,sK]),nr=oQ([aY,ic,sl,iU,iT,sr,i2,iz,sq]),no=oQ([aG,it,ia,sH,i1,iF,i$,iP,ix,i8,i6,iM]),na=rd(o_,void 0).superRefine((e,t)=>{if(!URL.canParse(e))return t.addIssue({code:a_,message:"URL must be parseable",fatal:!0}),A}).refine(e=>{let t=new URL(e);return"javascript:"!==t.protocol&&"data:"!==t.protocol&&"vbscript:"!==t.protocol},{message:"URL cannot use javascript:, data:, or vbscript: scheme"}),ni=oX({resource:om().url(),authorization_servers:oW(na).optional(),jwks_uri:om().url().optional(),scopes_supported:oW(om()).optional(),bearer_methods_supported:oW(om()).optional(),resource_signing_alg_values_supported:oW(om()).optional(),resource_name:om().optional(),resource_documentation:om().optional(),resource_policy_uri:om().url().optional(),resource_tos_uri:om().url().optional(),tls_client_certificate_bound_access_tokens:oU().optional(),authorization_details_types_supported:oW(om()).optional(),dpop_signing_alg_values_supported:oW(om()).optional(),dpop_bound_access_tokens_required:oU().optional()}),ns=oX({issuer:om(),authorization_endpoint:na,token_endpoint:na,registration_endpoint:na.optional(),scopes_supported:oW(om()).optional(),response_types_supported:oW(om()),response_modes_supported:oW(om()).optional(),grant_types_supported:oW(om()).optional(),token_endpoint_auth_methods_supported:oW(om()).optional(),token_endpoint_auth_signing_alg_values_supported:oW(om()).optional(),service_documentation:na.optional(),revocation_endpoint:na.optional(),revocation_endpoint_auth_methods_supported:oW(om()).optional(),revocation_endpoint_auth_signing_alg_values_supported:oW(om()).optional(),introspection_endpoint:om().optional(),introspection_endpoint_auth_methods_supported:oW(om()).optional(),introspection_endpoint_auth_signing_alg_values_supported:oW(om()).optional(),code_challenge_methods_supported:oW(om()).optional(),client_id_metadata_document_supported:oU().optional(),authorization_response_iss_parameter_supported:oU().optional().catch(void 0)}),nn=oX({issuer:om(),authorization_endpoint:na,token_endpoint:na,userinfo_endpoint:na.optional(),jwks_uri:na,registration_endpoint:na.optional(),scopes_supported:oW(om()).optional(),response_types_supported:oW(om()),response_modes_supported:oW(om()).optional(),grant_types_supported:oW(om()).optional(),acr_values_supported:oW(om()).optional(),subject_types_supported:oW(om()),id_token_signing_alg_values_supported:oW(om()),id_token_encryption_alg_values_supported:oW(om()).optional(),id_token_encryption_enc_values_supported:oW(om()).optional(),userinfo_signing_alg_values_supported:oW(om()).optional(),userinfo_encryption_alg_values_supported:oW(om()).optional(),userinfo_encryption_enc_values_supported:oW(om()).optional(),request_object_signing_alg_values_supported:oW(om()).optional(),request_object_encryption_alg_values_supported:oW(om()).optional(),request_object_encryption_enc_values_supported:oW(om()).optional(),token_endpoint_auth_methods_supported:oW(om()).optional(),token_endpoint_auth_signing_alg_values_supported:oW(om()).optional(),display_values_supported:oW(om()).optional(),claim_types_supported:oW(om()).optional(),claims_supported:oW(om()).optional(),service_documentation:om().optional(),claims_locales_supported:oW(om()).optional(),ui_locales_supported:oW(om()).optional(),claims_parameter_supported:oU().optional(),request_parameter_supported:oU().optional(),request_uri_parameter_supported:oU().optional(),require_request_uri_registration:oU().optional(),op_policy_uri:na.optional(),op_tos_uri:na.optional(),client_id_metadata_document_supported:oU().optional(),authorization_response_iss_parameter_supported:oU().optional().catch(void 0)}),nl=oG({...nn.shape,...ns.pick({code_challenge_methods_supported:!0}).shape}),nc=oG({access_token:om(),id_token:om().optional(),token_type:om(),expires_in:new oA({type:"number",coerce:!0,checks:[],...eO(void 0)}).optional(),scope:om().optional(),refresh_token:om().optional()}).strip(),nu=oG({issued_token_type:o7("urn:ietf:params:oauth:token-type:id-jag"),access_token:om(),token_type:om().optional(),expires_in:oz().optional(),scope:om().optional()}).strip(),nd=oG({error:om(),error_description:om().optional(),error_uri:om().optional()}),np=na.optional().or(o7("").transform(()=>void 0)),nh=oG({redirect_uris:oW(na),token_endpoint_auth_method:om().optional(),grant_types:oW(om()).optional(),response_types:oW(om()).optional(),application_type:om().optional(),client_name:om().optional(),client_uri:na.optional(),logo_uri:np,scope:om().optional(),contacts:oW(om()).optional(),tos_uri:np,policy_uri:om().optional(),jwks_uri:na.optional(),jwks:new oH({type:"any"}).optional(),software_id:om().optional(),software_version:om().optional(),software_statement:om().optional()}).strip(),nm=oG({client_id:om(),client_secret:om().optional(),client_id_issued_at:oz().optional(),client_secret_expires_at:oz().optional()}).strip(),nf=nh.merge(nm),ny=oG({error:om(),error_description:om().optional()}).strip(),ng=oG({token:om(),token_type_hint:om().optional()}).strip(),nv=Symbol.for("mcp.sdk.errorBrands");function n_(e,t){let r=new Set,o=t;for(;"function"==typeof o;){let e=o.mcpBrand;Object.prototype.hasOwnProperty.call(o,"mcpBrand")&&"string"==typeof e&&r.add(e),o=Object.getPrototypeOf(o)}0!==r.size&&Object.defineProperty(e,nv,{value:r,enumerable:!1,configurable:!0})}function nb(e,t){try{if("object"==typeof t&&null!==t&&Object.prototype.hasOwnProperty.call(e,"mcpBrand")&&"string"==typeof e.mcpBrand&&Object.prototype.hasOwnProperty.call(t,nv)){let r=t[nv];if(r&&"function"==typeof r.has&&r.has(e.mcpBrand))return!0}}catch{}return Function.prototype[Symbol.hasInstance].call(e,t)}let nS=((y={}).InvalidRequest="invalid_request",y.InvalidClient="invalid_client",y.InvalidGrant="invalid_grant",y.UnauthorizedClient="unauthorized_client",y.UnsupportedGrantType="unsupported_grant_type",y.InvalidScope="invalid_scope",y.AccessDenied="access_denied",y.ServerError="server_error",y.TemporarilyUnavailable="temporarily_unavailable",y.UnsupportedResponseType="unsupported_response_type",y.UnsupportedTokenType="unsupported_token_type",y.InvalidToken="invalid_token",y.MethodNotAllowed="method_not_allowed",y.TooManyRequests="too_many_requests",y.InvalidClientMetadata="invalid_client_metadata",y.InvalidRedirectUri="invalid_redirect_uri",y.InsufficientScope="insufficient_scope",y.InvalidTarget="invalid_target",y);var nw=class e extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.OAuthError"})}static[Symbol.hasInstance](e){return nb(this,e)}static isInstance(e){if("function"!=typeof this)throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return nb(this,e)}constructor(e,t,r){super(t),this.code=e,this.errorUri=r,this.name="OAuthError",n_(this,new.target)}toResponseObject(){let e={error:this.code,error_description:this.message};return this.errorUri&&(e.error_uri=this.errorUri),e}static fromResponse(t){return new e(t.error,t.error_description??t.error,t.error_uri)}};let n$=((g={}).NotConnected="NOT_CONNECTED",g.AlreadyConnected="ALREADY_CONNECTED",g.NotInitialized="NOT_INITIALIZED",g.CapabilityNotSupported="CAPABILITY_NOT_SUPPORTED",g.RequestTimeout="REQUEST_TIMEOUT",g.ConnectionClosed="CONNECTION_CLOSED",g.SendFailed="SEND_FAILED",g.InvalidResult="INVALID_RESULT",g.UnsupportedResultType="UNSUPPORTED_RESULT_TYPE",g.InputRequiredRoundsExceeded="INPUT_REQUIRED_ROUNDS_EXCEEDED",g.ListPaginationExceeded="LIST_PAGINATION_EXCEEDED",g.MethodNotSupportedByProtocolVersion="METHOD_NOT_SUPPORTED_BY_PROTOCOL_VERSION",g.EraNegotiationFailed="ERA_NEGOTIATION_FAILED",g.ClientHttpNotImplemented="CLIENT_HTTP_NOT_IMPLEMENTED",g.ClientHttpAuthentication="CLIENT_HTTP_AUTHENTICATION",g.ClientHttpForbidden="CLIENT_HTTP_FORBIDDEN",g.ClientHttpUnexpectedContent="CLIENT_HTTP_UNEXPECTED_CONTENT",g.ClientHttpFailedToOpenStream="CLIENT_HTTP_FAILED_TO_OPEN_STREAM",g.ClientHttpFailedToTerminateSession="CLIENT_HTTP_FAILED_TO_TERMINATE_SESSION",g);var nR=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkError"})}static[Symbol.hasInstance](e){return nb(this,e)}static isInstance(e){if("function"!=typeof this)throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return nb(this,e)}constructor(e,t,r){super(t),this.code=e,this.data=r,this.name="SdkError",n_(this,new.target)}},nP=class extends nR{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkHttpError"})}constructor(e,t,r){super(e,t,r),this.name="SdkHttpError"}get status(){return this.data.status}get statusText(){return this.data.statusText}};let nE="2026-07-28",nk=[nE];function nx(e){return e.filter(e=>!(e>=nE))}function nT(e){return e.filter(e=>e>=nE)}function nC(e){let t=e.structuredContent;return void 0===t||!("object"!=typeof t||null===t||Array.isArray(t))||e.content?.some(e=>"text"===e.type)?e:{...e,content:[...e.content??[],{type:"text",text:JSON.stringify(t)}]}}let nO=["task","inputRequests","requestState"];function nj(e){return null===e||"object"!=typeof e||Array.isArray(e)||void 0!==e.content||nO.some(t=>t in e)?e:{...e,content:[]}}function nI(){let t,r,o,a,i,s,n,l,c,u,d,p,h,m,f,y,g,v,_,b,S,w,$,R,P,E,k,x,T,C,O,j,I,N,A,z,q,M,L,U,D,V,H,F,K,J,Z,W,B,G,X,Y,Q,ee,et,er,eo,ea,ei,es,en,el,ec,eu,ed,ep,eh,em,ef,ey,eg,ev,e_,eb,eS,ew,e$,eR,eP,eE,ek,ex,eT,eC,eO,ej,eI,eN,eA,ez,eq,eM,eL,eU,eD,eV,eH,eF,eK,eJ,eZ,eW,eB,eG,eX,eY,eQ,e0,e1,e2,e9,e4,e5,e3,e6,e8,e7,te,tt,tr,to,ta,ti,ts,tn,tl,tc,tu,td,tp,th,tm,tf,ty,tg,tv,t_,tb,tS,tw;return e??=(t=ay(()=>oQ([om(),oz(),oU(),oV(),o5(om(),t),oW(t)])),r=o5(om(),t),o=oQ([om(),oz().int()]),a=om(),i=oG({ttl:oz().optional()}),s=oG({taskId:om()}),n=oX({progressToken:o.optional(),"io.modelcontextprotocol/related-task":s.optional()}),c=(l=oG({_meta:n.optional()})).extend({task:i.optional()}),u=oG({method:om(),params:l.loose().optional()}),d=oG({_meta:n.optional()}),p=oG({method:om(),params:d.loose().optional()}),h=oX({_meta:n.optional()}),m=oQ([om(),oz().int()]),f=h.strict(),y=d.extend({requestId:m.optional(),reason:om().optional()}),g=p.extend({method:o7("notifications/cancelled"),params:y}),v=oG({src:om(),mimeType:om().optional(),sizes:oW(om()).optional(),theme:o6(["light","dark"]).optional()}),_=oG({icons:oW(v).optional()}),S=(b=oG({name:om(),title:om().optional()})).extend({...b.shape,..._.shape,version:om(),websiteUrl:om().optional(),description:om().optional()}),w=o9(oG({applyDefaults:oU().optional()}),r),$=av(e=>e&&"object"==typeof e&&!Array.isArray(e)&&0===Object.keys(e).length?{form:{}}:e,o9(oG({form:w.optional(),url:r.optional()}),r.optional())),R=oX({list:r.optional(),cancel:r.optional(),requests:oX({sampling:oX({createMessage:r.optional()}).optional(),elicitation:oX({create:r.optional()}).optional()}).optional()}),P=oX({list:r.optional(),cancel:r.optional(),requests:oX({tools:oX({call:r.optional()}).optional()}).optional()}),E=oG({experimental:o5(om(),r).optional(),sampling:oG({context:r.optional(),tools:r.optional()}).optional(),elicitation:$.optional(),roots:oG({listChanged:oU().optional()}).optional(),tasks:R.optional(),extensions:o5(om(),r).optional()}),k=l.extend({protocolVersion:om(),capabilities:E,clientInfo:S}),x=u.extend({method:o7("initialize"),params:k}),T=oG({experimental:o5(om(),r).optional(),logging:r.optional(),completions:r.optional(),prompts:oG({listChanged:oU().optional()}).optional(),resources:oG({subscribe:oU().optional(),listChanged:oU().optional()}).optional(),tools:oG({listChanged:oU().optional()}).optional(),tasks:P.optional(),extensions:o5(om(),r).optional()}),C=h.extend({protocolVersion:om(),capabilities:T,serverInfo:S,instructions:om().optional()}),O=p.extend({method:o7("notifications/initialized"),params:d.optional()}),j=u.extend({method:o7("ping"),params:l.optional()}),I=oG({progress:oz(),total:ao(oz()),message:ao(om())}),N=oG({...d.shape,...I.shape,progressToken:o}),A=p.extend({method:o7("notifications/progress"),params:N}),z=l.extend({cursor:a.optional()}),q=u.extend({params:z.optional()}),M=h.extend({nextCursor:a.optional()}),U=(L=oG({uri:om(),mimeType:ao(om()),_meta:o5(om(),oK()).optional()})).extend({text:om()}),D=om().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),V=L.extend({blob:D}),H=o6(["user","assistant"]),F=oG({audience:oW(H).optional(),priority:oz().min(0).max(1).optional(),lastModified:r1({offset:!0}).optional()}),K=oG({...b.shape,..._.shape,uri:om(),description:ao(om()),mimeType:ao(om()),size:ao(oz()),annotations:F.optional(),_meta:ao(oX({}))}),J=oG({...b.shape,..._.shape,uriTemplate:om(),description:ao(om()),mimeType:ao(om()),annotations:F.optional(),_meta:ao(oX({}))}),Z=q.extend({method:o7("resources/list")}),W=M.extend({resources:oW(K)}),B=q.extend({method:o7("resources/templates/list")}),G=M.extend({resourceTemplates:oW(J)}),X=l.extend({uri:om()}),Y=u.extend({method:o7("resources/read"),params:X}),Q=h.extend({contents:oW(oQ([U,V]))}),ee=p.extend({method:o7("notifications/resources/list_changed"),params:d.optional()}),et=u.extend({method:o7("resources/subscribe"),params:X}),er=u.extend({method:o7("resources/unsubscribe"),params:X}),eo=d.extend({uri:om()}),ea=p.extend({method:o7("notifications/resources/updated"),params:eo}),ei=oG({name:om(),description:ao(om()),required:ao(oU())}),es=oG({...b.shape,..._.shape,description:ao(om()),arguments:ao(oW(ei)),_meta:ao(oX({}))}),en=q.extend({method:o7("prompts/list")}),el=M.extend({prompts:oW(es)}),ec=l.extend({name:om(),arguments:o5(om(),om()).optional()}),eu=u.extend({method:o7("prompts/get"),params:ec}),ed=oG({type:o7("text"),text:om(),annotations:F.optional(),_meta:o5(om(),oK()).optional()}),ep=oG({type:o7("image"),data:D,mimeType:om(),annotations:F.optional(),_meta:o5(om(),oK()).optional()}),eh=oG({type:o7("audio"),data:D,mimeType:om(),annotations:F.optional(),_meta:o5(om(),oK()).optional()}),em=oG({type:o7("tool_use"),name:om(),id:om(),input:o5(om(),oK()),_meta:o5(om(),oK()).optional()}),ef=oG({type:o7("resource"),resource:oQ([U,V]),annotations:F.optional(),_meta:o5(om(),oK()).optional()}),ey=K.extend({type:o7("resource_link")}),eg=oQ([ed,ep,eh,ey,ef]),ev=oG({role:H,content:eg}),e_=h.extend({description:om().optional(),messages:oW(ev)}),eb=p.extend({method:o7("notifications/prompts/list_changed"),params:d.optional()}),eS=oG({title:om().optional(),readOnlyHint:oU().optional(),destructiveHint:oU().optional(),idempotentHint:oU().optional(),openWorldHint:oU().optional()}),ew=oG({taskSupport:o6(["required","optional","forbidden"]).optional()}),e$=oG({...b.shape,..._.shape,description:om().optional(),inputSchema:oG({type:o7("object"),properties:o5(om(),t).optional(),required:oW(om()).optional()}).catchall(oK()),outputSchema:oG({type:o7("object"),properties:o5(om(),t).optional(),required:oW(om()).optional()}).catchall(oK()).optional(),annotations:eS.optional(),execution:ew.optional(),_meta:o5(om(),oK()).optional()}),eR=q.extend({method:o7("tools/list")}),eP=M.extend({tools:oW(e$)}),eE=h.extend({content:oW(eg),structuredContent:o5(om(),oK()).optional(),isError:oU().optional()}),ek=c.extend({name:om(),arguments:o5(om(),oK()).optional()}),ex=u.extend({method:o7("tools/call"),params:ek}),eT=p.extend({method:o7("notifications/tools/list_changed"),params:d.optional()}),eC=o6(["debug","info","notice","warning","error","critical","alert","emergency"]),eO=l.extend({level:eC}),ej=u.extend({method:o7("logging/setLevel"),params:eO}),eI=d.extend({level:eC,logger:om().optional(),data:oK()}),eN=p.extend({method:o7("notifications/message"),params:eI}),eA=oG({name:om().optional()}),ez=oG({hints:oW(eA).optional(),costPriority:oz().min(0).max(1).optional(),speedPriority:oz().min(0).max(1).optional(),intelligencePriority:oz().min(0).max(1).optional()}),eq=oG({mode:o6(["auto","required","none"]).optional()}),eM=oG({type:o7("tool_result"),toolUseId:om().describe("The unique identifier for the corresponding tool call."),content:oW(eg),structuredContent:oG({}).loose().optional(),isError:oU().optional(),_meta:o5(om(),oK()).optional()}),eL=o1("type",[ed,ep,eh]),eU=o1("type",[ed,ep,eh,em,eM]),eD=oG({role:H,content:oQ([eU,oW(eU)]),_meta:o5(om(),oK()).optional()}),eV=c.extend({messages:oW(eD),modelPreferences:ez.optional(),systemPrompt:om().optional(),includeContext:o6(["none","thisServer","allServers"]).optional(),temperature:oz().optional(),maxTokens:oz().int(),stopSequences:oW(om()).optional(),metadata:r.optional(),tools:oW(e$).optional(),toolChoice:eq.optional()}),eH=u.extend({method:o7("sampling/createMessage"),params:eV}),eF=h.extend({model:om(),stopReason:ao(o6(["endTurn","stopSequence","maxTokens"]).or(om())),role:H,content:eL}),eK=h.extend({model:om(),stopReason:ao(o6(["endTurn","stopSequence","maxTokens","toolUse"]).or(om())),role:H,content:oQ([eU,oW(eU)])}),eJ=oG({type:o7("boolean"),title:om().optional(),description:om().optional(),default:oU().optional()}),eZ=oG({type:o7("string"),title:om().optional(),description:om().optional(),minLength:oz().optional(),maxLength:oz().optional(),format:o6(["email","uri","date","date-time"]).optional(),default:om().optional()}),eW=oG({type:o6(["number","integer"]),title:om().optional(),description:om().optional(),minimum:oz().optional(),maximum:oz().optional(),default:oz().optional()}),eB=oG({type:o7("string"),title:om().optional(),description:om().optional(),enum:oW(om()),default:om().optional()}),eG=oG({type:o7("string"),title:om().optional(),description:om().optional(),oneOf:oW(oG({const:om(),title:om()})),default:om().optional()}),eX=oG({type:o7("string"),title:om().optional(),description:om().optional(),enum:oW(om()),enumNames:oW(om()).optional(),default:om().optional()}),eY=oQ([eB,eG]),eQ=oG({type:o7("array"),title:om().optional(),description:om().optional(),minItems:oz().optional(),maxItems:oz().optional(),items:oG({type:o7("string"),enum:oW(om())}),default:oW(om()).optional()}),e0=oG({type:o7("array"),title:om().optional(),description:om().optional(),minItems:oz().optional(),maxItems:oz().optional(),items:oG({anyOf:oW(oG({const:om(),title:om()}))}),default:oW(om()).optional()}),e1=oQ([eQ,e0]),e2=oQ([eX,eY,e1]),e9=oQ([e2,eJ,eZ,eW]),e4=c.extend({mode:o7("form").optional(),message:om(),requestedSchema:oG({type:o7("object"),properties:o5(om(),e9),required:oW(om()).optional()}).catchall(oK())}),e5=c.extend({mode:o7("url"),message:om(),elicitationId:om(),url:om().url()}),e3=oQ([e4,e5]),e6=u.extend({method:o7("elicitation/create"),params:e3}),e8=d.extend({elicitationId:om()}),e7=p.extend({method:o7("notifications/elicitation/complete"),params:e8}),te=h.extend({action:o6(["accept","decline","cancel"]),content:av(e=>null===e?void 0:e,o5(om(),oQ([om(),oz(),oU(),oW(om())])).optional())}),tt=oG({type:o7("ref/resource"),uri:om()}),tr=oG({type:o7("ref/prompt"),name:om()}),to=l.extend({ref:oQ([tr,tt]),argument:oG({name:om(),value:om()}),context:oG({arguments:o5(om(),om()).optional()}).optional()}),ta=u.extend({method:o7("completion/complete"),params:to}),ti=h.extend({completion:oX({values:oW(om()).max(100),total:ao(oz().int()),hasMore:ao(oU())})}),ts=oG({uri:om().startsWith("file://"),name:om().optional(),_meta:o5(om(),oK()).optional()}),tn=u.extend({method:o7("roots/list"),params:l.optional()}),tl=h.extend({roots:oW(ts)}),tc=p.extend({method:o7("notifications/roots/list_changed"),params:d.optional()}),tu=oX({ttl:oz().optional(),pollInterval:oz().optional()}),td=o6(["working","input_required","completed","failed","cancelled"]),tp=oG({taskId:om(),status:td,ttl:oQ([oz(),oV()]),createdAt:om(),lastUpdatedAt:om(),pollInterval:ao(oz()),statusMessage:ao(om())}),th=h.extend({task:tp}),tm=d.merge(tp),tf=p.extend({method:o7("notifications/tasks/status"),params:tm}),ty=u.extend({method:o7("tasks/get"),params:l.extend({taskId:om()})}),tg=h.merge(tp),tv=u.extend({method:o7("tasks/result"),params:l.extend({taskId:om()})}),t_=h.loose(),tb=q.extend({method:o7("tasks/list")}),tS=M.extend({tasks:oW(tp)}),tw=u.extend({method:o7("tasks/cancel"),params:l.extend({taskId:om()})}),{JSONValueSchema:t,JSONObjectSchema:r,ProgressTokenSchema:o,CursorSchema:a,TaskMetadataSchema:i,RelatedTaskMetadataSchema:s,RequestMetaSchema:n,BaseRequestParamsSchema:l,TaskAugmentedRequestParamsSchema:c,RequestSchema:u,NotificationsParamsSchema:d,NotificationSchema:p,ResultSchema:h,RequestIdSchema:m,EmptyResultSchema:f,CancelledNotificationParamsSchema:y,CancelledNotificationSchema:g,IconSchema:v,IconsSchema:_,BaseMetadataSchema:b,ImplementationSchema:S,ClientTasksCapabilitySchema:R,ServerTasksCapabilitySchema:P,ClientCapabilitiesSchema:E,InitializeRequestParamsSchema:k,InitializeRequestSchema:x,ServerCapabilitiesSchema:T,InitializeResultSchema:C,InitializedNotificationSchema:O,PingRequestSchema:j,ProgressSchema:I,ProgressNotificationParamsSchema:N,ProgressNotificationSchema:A,PaginatedRequestParamsSchema:z,PaginatedRequestSchema:q,PaginatedResultSchema:M,ResourceContentsSchema:L,TextResourceContentsSchema:U,BlobResourceContentsSchema:V,RoleSchema:H,AnnotationsSchema:F,ResourceSchema:K,ResourceTemplateSchema:J,ListResourcesRequestSchema:Z,ListResourcesResultSchema:W,ListResourceTemplatesRequestSchema:B,ListResourceTemplatesResultSchema:G,ResourceRequestParamsSchema:X,ReadResourceRequestParamsSchema:X,ReadResourceRequestSchema:Y,ReadResourceResultSchema:Q,ResourceListChangedNotificationSchema:ee,SubscribeRequestParamsSchema:X,SubscribeRequestSchema:et,UnsubscribeRequestParamsSchema:X,UnsubscribeRequestSchema:er,ResourceUpdatedNotificationParamsSchema:eo,ResourceUpdatedNotificationSchema:ea,PromptArgumentSchema:ei,PromptSchema:es,ListPromptsRequestSchema:en,ListPromptsResultSchema:el,GetPromptRequestParamsSchema:ec,GetPromptRequestSchema:eu,TextContentSchema:ed,ImageContentSchema:ep,AudioContentSchema:eh,ToolUseContentSchema:em,EmbeddedResourceSchema:ef,ResourceLinkSchema:ey,ContentBlockSchema:eg,PromptMessageSchema:ev,GetPromptResultSchema:e_,PromptListChangedNotificationSchema:eb,ToolAnnotationsSchema:eS,ToolExecutionSchema:ew,ToolSchema:e$,ListToolsRequestSchema:eR,ListToolsResultSchema:eP,CallToolResultSchema:eE,CallToolRequestParamsSchema:ek,CallToolRequestSchema:ex,ToolListChangedNotificationSchema:eT,LoggingLevelSchema:eC,SetLevelRequestParamsSchema:eO,SetLevelRequestSchema:ej,LoggingMessageNotificationParamsSchema:eI,LoggingMessageNotificationSchema:eN,ModelHintSchema:eA,ModelPreferencesSchema:ez,ToolChoiceSchema:eq,ToolResultContentSchema:eM,SamplingContentSchema:eL,SamplingMessageContentBlockSchema:eU,SamplingMessageSchema:eD,CreateMessageRequestParamsSchema:eV,CreateMessageRequestSchema:eH,CreateMessageResultSchema:eF,CreateMessageResultWithToolsSchema:eK,BooleanSchemaSchema:eJ,StringSchemaSchema:eZ,NumberSchemaSchema:eW,UntitledSingleSelectEnumSchemaSchema:eB,TitledSingleSelectEnumSchemaSchema:eG,LegacyTitledEnumSchemaSchema:eX,SingleSelectEnumSchemaSchema:eY,UntitledMultiSelectEnumSchemaSchema:eQ,TitledMultiSelectEnumSchemaSchema:e0,MultiSelectEnumSchemaSchema:e1,EnumSchemaSchema:e2,PrimitiveSchemaDefinitionSchema:e9,ElicitRequestFormParamsSchema:e4,ElicitRequestURLParamsSchema:e5,ElicitRequestParamsSchema:e3,ElicitRequestSchema:e6,ElicitationCompleteNotificationParamsSchema:e8,ElicitationCompleteNotificationSchema:e7,ElicitResultSchema:te,ResourceTemplateReferenceSchema:tt,PromptReferenceSchema:tr,CompleteRequestParamsSchema:to,CompleteRequestSchema:ta,CompleteResultSchema:ti,RootSchema:ts,ListRootsRequestSchema:tn,ListRootsResultSchema:tl,RootsListChangedNotificationSchema:tc,TaskCreationParamsSchema:tu,TaskStatusSchema:td,TaskSchema:tp,CreateTaskResultSchema:th,TaskStatusNotificationParamsSchema:tm,TaskStatusNotificationSchema:tf,GetTaskRequestSchema:ty,GetTaskResultSchema:tg,GetTaskPayloadRequestSchema:tv,GetTaskPayloadResultSchema:t_,ListTasksRequestSchema:tb,ListTasksResultSchema:tS,CancelTaskRequestSchema:tw,CancelTaskResultSchema:h.merge(tp),ClientRequestSchema:oQ([j,x,ta,ej,eu,en,Z,B,Y,et,er,ex,eR,ty,tv,tb,tw]),ClientNotificationSchema:oQ([g,A,O,tc,tf]),ClientResultSchema:oQ([f,eF,eK,te,tl,tg,tS,th]),ServerRequestSchema:oQ([j,eH,e6,tn,ty,tv,tb,tw]),ServerNotificationSchema:oQ([g,A,eN,ea,ee,eT,eb,tf,e7]),ServerResultSchema:oQ([f,C,ti,e_,el,W,G,Q,eE,eP,tg,tS,th]),CallToolResultWireSchema:oK().superRefine((e,t)=>{if(!("object"!=typeof e||null===e||Array.isArray(e))&&void 0===e.content){for(let r of nO)if(r in e)return void t.addIssue({code:"custom",message:`content is required when the body carries '${r}' — another result family cannot default into an empty tools/call success`})}}).transform(nj).pipe(eE)})}function nN(e){return"object"!==e.type}let nA=new Set(["const","enum","default","examples"]),nz=new Set(["properties","patternProperties","$defs","definitions","dependentSchemas","dependencies"]);function nq(e){return void 0!==e&&!("string"==typeof e&&e.startsWith("#"))}let nM={ping:null,initialize:null,"completion/complete":null,"logging/setLevel":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"resources/subscribe":null,"resources/unsubscribe":null,"tools/call":null,"tools/list":null,"tasks/get":null,"tasks/result":null,"tasks/list":null,"tasks/cancel":null,"sampling/createMessage":null,"elicitation/create":null,"roots/list":null},nL={"notifications/cancelled":null,"notifications/progress":null,"notifications/initialized":null,"notifications/roots/list_changed":null,"notifications/tasks/status":null,"notifications/message":null,"notifications/resources/updated":null,"notifications/resources/list_changed":null,"notifications/tools/list_changed":null,"notifications/prompts/list_changed":null,"notifications/elicitation/complete":null},nU={ping:null,initialize:null,"completion/complete":null,"logging/setLevel":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"resources/subscribe":null,"resources/unsubscribe":null,"tools/call":null,"tools/list":null,"sampling/createMessage":null,"elicitation/create":null,"roots/list":null};function nD(){if(t)return t;let e=nI();return t={requestSchemas:{ping:e.PingRequestSchema,initialize:e.InitializeRequestSchema,"completion/complete":e.CompleteRequestSchema,"logging/setLevel":e.SetLevelRequestSchema,"prompts/get":e.GetPromptRequestSchema,"prompts/list":e.ListPromptsRequestSchema,"resources/list":e.ListResourcesRequestSchema,"resources/templates/list":e.ListResourceTemplatesRequestSchema,"resources/read":e.ReadResourceRequestSchema,"resources/subscribe":e.SubscribeRequestSchema,"resources/unsubscribe":e.UnsubscribeRequestSchema,"tools/call":e.CallToolRequestSchema,"tools/list":e.ListToolsRequestSchema,"tasks/get":e.GetTaskRequestSchema,"tasks/result":e.GetTaskPayloadRequestSchema,"tasks/list":e.ListTasksRequestSchema,"tasks/cancel":e.CancelTaskRequestSchema,"sampling/createMessage":e.CreateMessageRequestSchema,"elicitation/create":e.ElicitRequestSchema,"roots/list":e.ListRootsRequestSchema},notificationSchemas:{"notifications/cancelled":e.CancelledNotificationSchema,"notifications/progress":e.ProgressNotificationSchema,"notifications/initialized":e.InitializedNotificationSchema,"notifications/roots/list_changed":e.RootsListChangedNotificationSchema,"notifications/tasks/status":e.TaskStatusNotificationSchema,"notifications/message":e.LoggingMessageNotificationSchema,"notifications/resources/updated":e.ResourceUpdatedNotificationSchema,"notifications/resources/list_changed":e.ResourceListChangedNotificationSchema,"notifications/tools/list_changed":e.ToolListChangedNotificationSchema,"notifications/prompts/list_changed":e.PromptListChangedNotificationSchema,"notifications/elicitation/complete":e.ElicitationCompleteNotificationSchema},resultSchemas:{ping:e.EmptyResultSchema,initialize:e.InitializeResultSchema,"completion/complete":e.CompleteResultSchema,"logging/setLevel":e.EmptyResultSchema,"prompts/get":e.GetPromptResultSchema,"prompts/list":e.ListPromptsResultSchema,"resources/list":e.ListResourcesResultSchema,"resources/templates/list":e.ListResourceTemplatesResultSchema,"resources/read":e.ReadResourceResultSchema,"resources/subscribe":e.EmptyResultSchema,"resources/unsubscribe":e.EmptyResultSchema,"tools/call":e.CallToolResultWireSchema,"tools/list":e.ListToolsResultSchema,"sampling/createMessage":e.CreateMessageResultWithToolsSchema,"elicitation/create":e.ElicitResultSchema,"roots/list":e.ListRootsResultSchema}}}function nV(e){return Object.prototype.hasOwnProperty.call(nM,e)}function nH(e){return Object.prototype.hasOwnProperty.call(nL,e)}function nF(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)}function nK(e,t){if(void 0===e)return{ok:!1,reason:"not-in-era"};let r=e.safeParse(t);return r.success?{ok:!0,value:r.data}:{ok:!1,reason:"invalid",message:String(r.error)}}Object.keys(nM),Object.keys(nL);let nJ={ok:!1,reason:"not-in-era"};function nZ(e){return nF(e)&&nF(e.outputSchema)&&nN(e.outputSchema)}let nW={era:"2025-11-25",hasRequestMethod:nV,hasNotificationMethod:nH,validateRequest:(e,t)=>{var r;return nK(nV(r=e)?nD().requestSchemas[r]:void 0,t)},validateResult:(e,t)=>{var r,o;return nK((o=r=e,Object.prototype.hasOwnProperty.call(nU,o))?nD().resultSchemas[r]:void 0,t)},validateNotification:(e,t)=>{var r;return nK(nH(r=e)?nD().notificationSchemas[r]:void 0,t)},hasInputRequestMethod:()=>!1,validateInputRequest:()=>nJ,validateInputResponse:()=>nJ,samplingResultVariant:(e,t)=>{let r=nI();return nK(e?r.CreateMessageResultWithToolsSchema:r.CreateMessageResultSchema,t)},outboundEnvelope:e=>void 0,validateEnvelopeMeta:e=>[],projectCallToolResult(e,t){let r=nC(e),o=r.structuredContent;if(void 0===o)return r;let a="object"!=typeof o||null===o||Array.isArray(o),i=void 0!==t&&nN(t);return a||i?{...r,structuredContent:{result:o}}:r},decodeResult(e,t){if(nF(t)&&"resultType"in t){let e={...t};return delete e.resultType,{kind:"complete",result:e}}return{kind:"complete",result:t}},encodeResult(e,t){if("tools/list"!==e)return t;let r=t.tools;return Array.isArray(r)&&r.some(e=>nZ(e))?{...t,tools:r.map(e=>nZ(e)?{...e,outputSchema:function(e){var t;let r="string"==typeof e.$schema?e.$schema:void 0;if(nq(e.$id))return{...void 0!==r&&{$schema:r},type:"object",properties:{result:e},required:["result"]};let o="string"==typeof(t=e.$schema)&&j.has(t.replace(/#$/,""))&&!0!==e.$recursiveAnchor,a=(e,t)=>{if(Array.isArray(e))return e.map(e=>a(e,!1));if(null===e||"object"!=typeof e||!t&&nq(e.$id))return e;let r={},i=!1;for(let[s,n]of Object.entries(e))t?r[s]=a(n,!1):("$ref"===s||"$dynamicRef"===s)&&"string"==typeof n?r[s]="#"===n?"#/properties/result":n.startsWith("#/")?`#/properties/result${n.slice(1)}`:n:"$recursiveRef"===s&&"#"===n&&o?i=!0:nA.has(s)?r[s]=n:nz.has(s)?r[s]=a(n,!0):r[s]=a(n,!1);return i&&("$ref"in r?r.allOf=[...Array.isArray(r.allOf)?r.allOf:[],{$ref:"#/properties/result"}]:r.$ref="#/properties/result"),r};return{...void 0!==r&&{$schema:r},type:"object",properties:{result:a(e,!1)},required:["result"]}}(e.outputSchema)}:e)}:t},encodeErrorCode:e=>-32002===e?-32602:e,checkInboundEnvelope:e=>void 0};function nB(){return r??=function(){let e=ay(()=>oQ([om(),oz(),oU(),oV(),o5(om(),e),oW(e)])),t=o5(om(),e),r=oQ([om(),oz().int()]),o=om(),a=oQ([om(),oz().int()]),i=o6(["user","assistant"]),s=o6(["debug","info","notice","warning","error","critical","alert","emergency"]),n=om().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),l=oG({ttl:oz().optional()}),c=oG({taskId:om()}),u=oX({progressToken:r.optional(),"io.modelcontextprotocol/related-task":c.optional()}),d=oG({_meta:u.optional()}),p=d.extend({task:l.optional()}),h=oG({_meta:u.optional()}),m=oG({method:om(),params:h.loose().optional()}),f=oG({src:om(),mimeType:om().optional(),sizes:oW(om()).optional(),theme:o6(["light","dark"]).optional()}),y=oG({icons:oW(f).optional()}),g=oG({name:om(),title:om().optional()}),v=g.extend({...g.shape,...y.shape,version:om(),websiteUrl:om().optional(),description:om().optional()}),_=o9(oG({applyDefaults:oU().optional()}),t),b=av(e=>e&&"object"==typeof e&&!Array.isArray(e)&&0===Object.keys(e).length?{form:{}}:e,o9(oG({form:_.optional(),url:t.optional()}),t.optional())),S=oX({list:t.optional(),cancel:t.optional(),requests:oX({sampling:oX({createMessage:t.optional()}).optional(),elicitation:oX({create:t.optional()}).optional()}).optional()}),w=oX({list:t.optional(),cancel:t.optional(),requests:oX({tools:oX({call:t.optional()}).optional()}).optional()}),$=oG({experimental:o5(om(),t).optional(),sampling:oG({context:t.optional(),tools:t.optional()}).optional(),elicitation:b.optional(),roots:oG({listChanged:oU().optional()}).optional(),tasks:S.optional(),extensions:o5(om(),t).optional()}),R=oG({experimental:o5(om(),t).optional(),logging:t.optional(),completions:t.optional(),prompts:oG({listChanged:oU().optional()}).optional(),resources:oG({subscribe:oU().optional(),listChanged:oU().optional()}).optional(),tools:oG({listChanged:oU().optional()}).optional(),tasks:w.optional(),extensions:o5(om(),t).optional()}),P=oG({progress:oz(),total:ao(oz()),message:ao(om())}),E=oG({...h.shape,...P.shape,progressToken:r}),k=m.extend({method:o7("notifications/progress"),params:E}),x=h.extend({level:s,logger:om().optional(),data:oK()}),T=m.extend({method:o7("notifications/message"),params:x}),C=oG({uri:om(),mimeType:ao(om()),_meta:o5(om(),oK()).optional()}),O=C.extend({text:om()}),j=C.extend({blob:n}),I=oG({audience:oW(i).optional(),priority:oz().min(0).max(1).optional(),lastModified:r1({offset:!0}).optional()}),N=oG({...g.shape,...y.shape,uri:om(),description:ao(om()),mimeType:ao(om()),size:ao(oz()),annotations:I.optional(),_meta:ao(oX({}))}),A=oG({...g.shape,...y.shape,uriTemplate:om(),description:ao(om()),mimeType:ao(om()),annotations:I.optional(),_meta:ao(oX({}))}),z=m.extend({method:o7("notifications/resources/list_changed"),params:h.optional()}),q=h.extend({uri:om()}),M=m.extend({method:o7("notifications/resources/updated"),params:q}),L=oG({name:om(),description:ao(om()),required:ao(oU())}),U=oG({...g.shape,...y.shape,description:ao(om()),arguments:ao(oW(L)),_meta:ao(oX({}))}),D=m.extend({method:o7("notifications/prompts/list_changed"),params:h.optional()}),V=oG({type:o7("text"),text:om(),annotations:I.optional(),_meta:o5(om(),oK()).optional()}),H=oG({type:o7("image"),data:n,mimeType:om(),annotations:I.optional(),_meta:o5(om(),oK()).optional()}),F=oG({type:o7("audio"),data:n,mimeType:om(),annotations:I.optional(),_meta:o5(om(),oK()).optional()}),K=oG({type:o7("tool_use"),name:om(),id:om(),input:o5(om(),oK()),_meta:o5(om(),oK()).optional()}),J=oG({type:o7("resource"),resource:oQ([O,j]),annotations:I.optional(),_meta:o5(om(),oK()).optional()}),Z=N.extend({type:o7("resource_link")}),W=oQ([V,H,F,Z,J]),B=oG({role:i,content:W}),G=oG({title:om().optional(),readOnlyHint:oU().optional(),destructiveHint:oU().optional(),idempotentHint:oU().optional(),openWorldHint:oU().optional()}),X=m.extend({method:o7("notifications/tools/list_changed"),params:h.optional()}),Y=oG({name:om().optional()}),Q=oG({hints:oW(Y).optional(),costPriority:oz().min(0).max(1).optional(),speedPriority:oz().min(0).max(1).optional(),intelligencePriority:oz().min(0).max(1).optional()}),ee=oG({mode:o6(["auto","required","none"]).optional()}),et=oG({type:o7("boolean"),title:om().optional(),description:om().optional(),default:oU().optional()}),er=oG({type:o7("string"),title:om().optional(),description:om().optional(),minLength:oz().optional(),maxLength:oz().optional(),format:o6(["email","uri","date","date-time"]).optional(),default:om().optional()}),eo=oG({type:o6(["number","integer"]),title:om().optional(),description:om().optional(),minimum:oz().optional(),maximum:oz().optional(),default:oz().optional()}),ea=oG({type:o7("string"),title:om().optional(),description:om().optional(),enum:oW(om()),default:om().optional()}),ei=oG({type:o7("string"),title:om().optional(),description:om().optional(),oneOf:oW(oG({const:om(),title:om()})),default:om().optional()}),es=oG({type:o7("string"),title:om().optional(),description:om().optional(),enum:oW(om()),enumNames:oW(om()).optional(),default:om().optional()}),en=oQ([ea,ei]),el=oG({type:o7("array"),title:om().optional(),description:om().optional(),minItems:oz().optional(),maxItems:oz().optional(),items:oG({type:o7("string"),enum:oW(om())}),default:oW(om()).optional()}),ec=oG({type:o7("array"),title:om().optional(),description:om().optional(),minItems:oz().optional(),maxItems:oz().optional(),items:oG({anyOf:oW(oG({const:om(),title:om()}))}),default:oW(om()).optional()}),eu=oQ([el,ec]),ed=oQ([es,en,eu]),ep=oQ([ed,et,er,eo]),eh=p.extend({mode:o7("form").optional(),message:om(),requestedSchema:oG({type:o7("object"),properties:o5(om(),ep),required:oW(om()).optional()}).catchall(oK())}),em=oG({type:o7("ref/resource"),uri:om()}),ef=oG({type:o7("ref/prompt"),name:om()}),ey=oG({uri:om().startsWith("file://"),name:om().optional(),_meta:o5(om(),oK()).optional()}),eg=$.shape,ev=oG({experimental:eg.experimental,sampling:eg.sampling,elicitation:eg.elicitation,roots:eg.roots,extensions:eg.extensions}),e_=R.shape,eb=oG({experimental:e_.experimental,logging:e_.logging,completions:e_.completions,prompts:e_.prompts,resources:e_.resources,tools:e_.tools,extensions:e_.extensions}),eS=oX({progressToken:r.optional(),[aw]:om(),[a$]:v.optional(),[aP]:ev,[ak]:s.optional()}),ew=oG({...g.shape,...y.shape,description:om().optional(),inputSchema:oX({$schema:om().optional(),type:o7("object")}),outputSchema:oX({$schema:om().optional()}).optional(),annotations:G.optional(),_meta:o5(om(),oK()).optional()}),e$=oG({type:o7("tool_result"),toolUseId:om(),content:oW(W),structuredContent:oK().optional(),isError:oU().optional(),_meta:o5(om(),oK()).optional()}),eR=oQ([V,H,F,K,e$]),eP=oG({role:i,content:oQ([eR,oW(eR)]),_meta:o5(om(),oK()).optional()}),eE=om(),ek=oX({[aR]:v.optional().catch(void 0)}),ex=ek.optional();function eT(e){return oX({_meta:ex,resultType:eE.default("complete"),...e})}let eC=eT({}),eO=eT({nextCursor:o.optional()}),ej=eT({content:oW(W),structuredContent:oK().optional(),isError:oU().optional()}),eI=eT({ttlMs:oz().int().min(0),cacheScope:o6(["public","private"]),tools:oW(ew),nextCursor:o.optional()}),eN=eT({ttlMs:oz().int().min(0),cacheScope:o6(["public","private"]),prompts:oW(U),nextCursor:o.optional()}),eA=eT({description:om().optional(),messages:oW(B)}),ez=eT({ttlMs:oz().int().min(0),cacheScope:o6(["public","private"]),resources:oW(N),nextCursor:o.optional()}),eq=eT({ttlMs:oz().int().min(0),cacheScope:o6(["public","private"]),resourceTemplates:oW(A),nextCursor:o.optional()}),eM=eT({ttlMs:oz().int().min(0),cacheScope:o6(["public","private"]),contents:oW(oQ([O,j]))}),eL=eT({completion:oG({values:oW(om()).max(100),total:oz().int().optional(),hasMore:oU().optional()}).loose()}),eU=eT({ttlMs:oz().int().min(0),cacheScope:o6(["public","private"])}),eD=eT({ttlMs:oz().int().min(0).catch(0),cacheScope:o6(["public","private"]).catch("private"),supportedVersions:oW(om()),capabilities:eb,instructions:om().optional()}),eV=oG({messages:oW(eP),modelPreferences:Q.optional(),systemPrompt:om().optional(),includeContext:o6(["none","thisServer","allServers"]).optional(),temperature:oz().optional(),maxTokens:oz().int(),stopSequences:oW(om()).optional(),metadata:t.optional(),tools:oW(ew).optional(),toolChoice:ee.optional()}),eH=oG({method:o7("sampling/createMessage"),params:eV}),eF=oG({method:o7("roots/list"),params:oG({_meta:o5(om(),oK()).optional()}).optional()}),eK=oG({...eP.shape,model:om(),stopReason:om().optional()}),eJ=oG({roots:oW(ey)}),eZ=oG({action:o6(["accept","decline","cancel"]),content:o5(om(),oQ([om(),oz(),oU(),oW(om())])).optional()}),eW=oG({mode:o7("url"),message:om(),url:om().url()}),eB=oQ([eh,eW]),eG=oG({method:o7("elicitation/create"),params:eB}),eX=oQ([eH,eF,eG]),eY=oQ([eK,eJ,eZ]),eQ=o5(om(),eX),e0=o5(om(),eY),e1=eT({inputRequests:eQ.optional(),requestState:om().optional()}),e2={inputResponses:e0.optional(),requestState:om().optional()},e9=oG({_meta:eS,...e2}),e4=oX({progressToken:r.optional()});function e5(e,t){return oG({method:o7(e),params:oG({_meta:eS,...t})})}function e3(e,t){return oG({method:o7(e),params:oG({_meta:e4.optional(),...t}).optional()})}let e6={name:om(),arguments:o5(om(),oK()).optional(),...e2},e8={cursor:o.optional()},e7=e5("tools/call",e6),te=e5("tools/list",e8),tt=e5("prompts/list",e8),tr=e5("prompts/get",{name:om(),arguments:o5(om(),om()).optional(),...e2}),to=e5("resources/list",e8),ta=e5("resources/templates/list",e8),ti=e5("resources/read",{uri:om(),...e2}),ts={ref:oQ([ef,em]),argument:oG({name:om(),value:om()}),context:oG({arguments:o5(om(),om()).optional()}).optional()},tn=e5("completion/complete",ts),tl=e5("server/discover",{}),tc=oG({toolsListChanged:oU().optional(),promptsListChanged:oU().optional(),resourcesListChanged:oU().optional(),resourceSubscriptions:oW(om()).optional()}),tu={notifications:tc},td=e5("subscriptions/listen",tu),tp=ek.extend({"io.modelcontextprotocol/subscriptionId":a}),th=oX({_meta:tp,resultType:eE.default("complete")}),tm={"tools/call":e3("tools/call",e6),"tools/list":e3("tools/list",e8),"prompts/get":e3("prompts/get",{name:om(),arguments:o5(om(),om()).optional()}),"prompts/list":e3("prompts/list",e8),"resources/list":e3("resources/list",e8),"resources/templates/list":e3("resources/templates/list",e8),"resources/read":e3("resources/read",{uri:om()}),"completion/complete":e3("completion/complete",ts),"server/discover":e3("server/discover",{}),"subscriptions/listen":e3("subscriptions/listen",tu)};function tf(e){return oX({_meta:ex,...e})}let ty={"tools/call":tf({content:oW(W),structuredContent:oK().optional(),isError:oU().optional()}),"tools/list":tf({ttlMs:oz().int().min(0),cacheScope:o6(["public","private"]),tools:oW(ew),nextCursor:o.optional()}),"prompts/get":tf({description:om().optional(),messages:oW(B)}),"prompts/list":tf({ttlMs:oz().int().min(0),cacheScope:o6(["public","private"]),prompts:oW(U),nextCursor:o.optional()}),"resources/list":tf({ttlMs:oz().int().min(0),cacheScope:o6(["public","private"]),resources:oW(N),nextCursor:o.optional()}),"resources/templates/list":tf({ttlMs:oz().int().min(0),cacheScope:o6(["public","private"]),resourceTemplates:oW(A),nextCursor:o.optional()}),"resources/read":tf({ttlMs:oz().int().min(0),cacheScope:o6(["public","private"]),contents:oW(oQ([O,j]))}),"completion/complete":tf({completion:oG({values:oW(om()).max(100),total:oz().int().optional(),hasMore:oU().optional()}).loose()}),"server/discover":tf({ttlMs:oz().int().min(0).catch(0),cacheScope:o6(["public","private"]).catch("private"),supportedVersions:oW(om()),capabilities:eb,instructions:om().optional()}),"subscriptions/listen":tf({})},tg=oX({"io.modelcontextprotocol/subscriptionId":a.optional()}),tv=oG({method:o7("notifications/subscriptions/acknowledged"),params:oG({_meta:tg.optional(),notifications:tc})}),t_=oG({_meta:tg.optional(),requestId:a,reason:om().optional()}),tb=oG({method:o7("notifications/cancelled"),params:t_}),tS=e=>oG({jsonrpc:o7("2.0"),id:oQ([om(),oz().int()]),result:e}).strict();return{JSONValueSchema:e,JSONObjectSchema:t,ProgressTokenSchema:r,CursorSchema:o,RequestIdSchema:a,RoleSchema:i,LoggingLevelSchema:s,TaskMetadataSchema:l,RelatedTaskMetadataSchema:c,RequestMetaSchema:u,BaseRequestParamsSchema:d,TaskAugmentedRequestParamsSchema:p,NotificationsParamsSchema:h,NotificationSchema:m,IconSchema:f,IconsSchema:y,BaseMetadataSchema:g,ImplementationSchema:v,ClientTasksCapabilitySchema:S,ServerTasksCapabilitySchema:w,ClientCapabilitiesSchema:$,ServerCapabilitiesSchema:R,ProgressSchema:P,ProgressNotificationParamsSchema:E,ProgressNotificationSchema:k,LoggingMessageNotificationParamsSchema:x,LoggingMessageNotificationSchema:T,ResourceContentsSchema:C,TextResourceContentsSchema:O,BlobResourceContentsSchema:j,AnnotationsSchema:I,ResourceSchema:N,ResourceTemplateSchema:A,ResourceListChangedNotificationSchema:z,ResourceUpdatedNotificationParamsSchema:q,ResourceUpdatedNotificationSchema:M,PromptArgumentSchema:L,PromptSchema:U,PromptListChangedNotificationSchema:D,TextContentSchema:V,ImageContentSchema:H,AudioContentSchema:F,ToolUseContentSchema:K,EmbeddedResourceSchema:J,ResourceLinkSchema:Z,ContentBlockSchema:W,PromptMessageSchema:B,ToolAnnotationsSchema:G,ToolListChangedNotificationSchema:X,ModelHintSchema:Y,ModelPreferencesSchema:Q,ToolChoiceSchema:ee,BooleanSchemaSchema:et,StringSchemaSchema:er,NumberSchemaSchema:eo,UntitledSingleSelectEnumSchemaSchema:ea,TitledSingleSelectEnumSchemaSchema:ei,LegacyTitledEnumSchemaSchema:es,SingleSelectEnumSchemaSchema:en,UntitledMultiSelectEnumSchemaSchema:el,TitledMultiSelectEnumSchemaSchema:ec,MultiSelectEnumSchemaSchema:eu,EnumSchemaSchema:ed,PrimitiveSchemaDefinitionSchema:ep,ElicitRequestFormParamsSchema:eh,ResourceTemplateReferenceSchema:em,PromptReferenceSchema:ef,RootSchema:ey,ClientCapabilities2026Schema:ev,ServerCapabilities2026Schema:eb,RequestMetaEnvelopeSchema:eS,ToolSchema:ew,ToolResultContentSchema:e$,SamplingMessageContentBlockSchema:eR,SamplingMessageSchema:eP,ResultTypeSchema:eE,ResultMetaSchema:ek,ResultSchema:eC,PaginatedResultSchema:eO,CallToolResultSchema:ej,ListToolsResultSchema:eI,ListPromptsResultSchema:eN,GetPromptResultSchema:eA,ListResourcesResultSchema:ez,ListResourceTemplatesResultSchema:eq,ReadResourceResultSchema:eM,CompleteResultSchema:eL,CacheableResultSchema:eU,DiscoverResultSchema:eD,CreateMessageRequestParamsSchema:eV,CreateMessageRequestSchema:eH,ListRootsRequestSchema:eF,CreateMessageResultSchema:eK,ListRootsResultSchema:eJ,ElicitResultSchema:eZ,ElicitRequestURLParamsSchema:eW,ElicitRequestParamsSchema:eB,ElicitRequestSchema:eG,InputRequestSchema:eX,InputResponseSchema:eY,InputRequestsSchema:eQ,InputResponsesSchema:e0,InputRequiredResultSchema:e1,InputResponseRequestParamsSchema:e9,CallToolRequestSchema:e7,ListToolsRequestSchema:te,ListPromptsRequestSchema:tt,GetPromptRequestSchema:tr,ListResourcesRequestSchema:to,ListResourceTemplatesRequestSchema:ta,ReadResourceRequestSchema:ti,CompleteRequestSchema:tn,DiscoverRequestSchema:tl,SubscriptionFilterSchema:tc,SubscriptionsListenRequestSchema:td,SubscriptionsListenResultMetaSchema:tp,SubscriptionsListenResultSchema:th,dispatchRequestSchemas:tm,dispatchResultSchemas:ty,NotificationMetaSchema:tg,SubscriptionsAcknowledgedNotificationSchema:tv,CancelledNotificationParamsSchema:t_,CancelledNotificationSchema:tb,notificationSchemas2026:{"notifications/cancelled":tb,"notifications/progress":k,"notifications/message":T,"notifications/resources/updated":M,"notifications/resources/list_changed":z,"notifications/tools/list_changed":X,"notifications/prompts/list_changed":D,"notifications/subscriptions/acknowledged":tv},JSONRPCResultResponseSchema:tS(eC),CallToolResultResponseSchema:tS(oQ([ej,e1])),ListToolsResultResponseSchema:tS(eI),ListPromptsResultResponseSchema:tS(eN),GetPromptResultResponseSchema:tS(oQ([eA,e1])),ListResourcesResultResponseSchema:tS(ez),ListResourceTemplatesResultResponseSchema:tS(eq),ReadResourceResultResponseSchema:tS(oQ([eM,e1])),CompleteResultResponseSchema:tS(eL),DiscoverResultResponseSchema:tS(eD)}}()}let nG=["tools/list","prompts/list","resources/list","resources/templates/list","resources/read","server/discover"],nX=Symbol("modelcontextprotocol.resultCacheHintFallback");function nY(e){return"number"==typeof e&&Number.isSafeInteger(e)&&e>=0}function nQ(e){return"public"===e||"private"===e}let n0=((v={})[v.ParseError=-32700]="ParseError",v[v.InvalidRequest=-32600]="InvalidRequest",v[v.MethodNotFound=-32601]="MethodNotFound",v[v.InvalidParams=-32602]="InvalidParams",v[v.InternalError=-32603]="InternalError",v[v.ResourceNotFound=-32002]="ResourceNotFound",v[v.MissingRequiredClientCapability=-32021]="MissingRequiredClientCapability",v[v.UnsupportedProtocolVersion=-32022]="UnsupportedProtocolVersion",v[v.UrlElicitationRequired=-32042]="UrlElicitationRequired",v);var n1=class e extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ProtocolError"})}static[Symbol.hasInstance](e){return nb(this,e)}static isInstance(e){if("function"!=typeof this)throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return nb(this,e)}constructor(e,t,r){super(t),this.code=e,this.data=r,this.name="ProtocolError",n_(this,new.target)}static fromError(t,r,o){return t===n0.UrlElicitationRequired&&o&&o.elicitations?new n9(o.elicitations,r):t===n0.UnsupportedProtocolVersion&&o&&Array.isArray(o.supported)&&"string"==typeof o.requested?new n4({supported:o.supported,requested:o.requested},r):(t===n0.InvalidParams||t===n0.ResourceNotFound)&&"string"==typeof o?.uri&&(t===n0.ResourceNotFound||1===Object.keys(o).length)?new n2(o.uri,r):t===n0.MissingRequiredClientCapability&&o&&null!==o.requiredCapabilities&&"object"==typeof o.requiredCapabilities&&!Array.isArray(o.requiredCapabilities)?new n5({requiredCapabilities:o.requiredCapabilities},r):new e(t,r,o)}},n2=class extends n1{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ResourceNotFoundError"})}constructor(e,t=`Resource not found: ${e}`){super(n0.InvalidParams,t,{uri:e})}get uri(){return this.data.uri}},n9=class extends n1{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UrlElicitationRequiredError"})}constructor(e,t=`URL elicitation${e.length>1?"s":""} required`){super(n0.UrlElicitationRequired,t,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}},n4=class extends n1{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UnsupportedProtocolVersionError"})}constructor(e,t=`Unsupported protocol version: ${e.requested}`){super(n0.UnsupportedProtocolVersion,t,e)}get supported(){return this.data.supported}get requested(){return this.data.requested}},n5=class extends n1{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.MissingRequiredClientCapabilityError"})}constructor(e,t=`Missing required client capabilities: ${Object.keys(e.requiredCapabilities).join(", ")}`){super(n0.MissingRequiredClientCapability,t,e)}get requiredCapabilities(){return this.data.requiredCapabilities}};let n3=["tools/call","prompts/get","resources/read"],n6=["elicitation/create","sampling/createMessage","roots/list"];function n8(){if(o)return o;let e=nB();return o={request:{"elicitation/create":oG({method:o7("elicitation/create"),params:e.ElicitRequestParamsSchema}),"sampling/createMessage":oG({method:o7("sampling/createMessage"),params:e.CreateMessageRequestParamsSchema}),"roots/list":oG({method:o7("roots/list"),params:oX({}).optional()})},response:{"elicitation/create":e.ElicitResultSchema,"sampling/createMessage":e.CreateMessageResultSchema,"roots/list":e.ListRootsResultSchema}}}function n7(e){return n6.includes(e)}function le(e){return n7(e)?n8().request[e]:void 0}let lt={"tools/call":null,"tools/list":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"completion/complete":null,"server/discover":null,"subscriptions/listen":null},lr={"notifications/cancelled":null,"notifications/progress":null,"notifications/message":null,"notifications/resources/updated":null,"notifications/resources/list_changed":null,"notifications/tools/list_changed":null,"notifications/prompts/list_changed":null,"notifications/subscriptions/acknowledged":null};function lo(e){return Object.prototype.hasOwnProperty.call(lt,e)}function la(e){return Object.prototype.hasOwnProperty.call(lr,e)}function li(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)}function ls(e,t){if(void 0===e)return{ok:!1,reason:"not-in-era"};let r=e.safeParse(t);return r.success?{ok:!0,value:r.data}:{ok:!1,reason:"invalid",message:String(r.error)}}Object.keys(lt),Object.keys(lr);let ln={ok:!1,reason:"not-in-era"},ll=[aw,aP],lc={era:"2026-07-28",hasRequestMethod:lo,hasNotificationMethod:la,hasInputRequestMethod:e=>void 0!==le(e),validateRequest:(e,t)=>{var r;return ls(lo(r=e)?nB().dispatchRequestSchemas[r]:void 0,t)},validateResult:(e,t)=>{var r,o;return ls((o=r=e,Object.prototype.hasOwnProperty.call(lt,o))?nB().dispatchResultSchemas[r]:void 0,t)},validateNotification:(e,t)=>{var r;return ls(la(r=e)?nB().notificationSchemas2026[r]:void 0,t)},validateInputRequest:(e,t)=>ls(le(e),t),validateInputResponse:(e,t)=>{var r;return ls(n7(r=e)?n8().response[r]:void 0,t)},samplingResultVariant:()=>ln,outboundEnvelope:e=>({[aw]:e.protocolVersion,[a$]:e.clientInfo,[aP]:e.clientCapabilities,...void 0!==e.logLevel&&{[ak]:e.logLevel}}),validateEnvelopeMeta(e){let t=[];for(let r of ll)r in e||t.push({key:r,problem:"missing"});let r=nB().RequestMetaEnvelopeSchema.safeParse(e);if(!r.success)for(let e of r.error.issues){let r=e.path.map(String),o=r.length>0?r.join("."):"_meta";1===r.length&&t.some(e=>e.key===o&&"missing"===e.problem)||t.push({key:o,problem:e.message})}return t},projectCallToolResult:e=>nC(e),inputRequestSchema:le,decodeResult(e,t){if(!li(t))return{kind:"invalid",error:new nR(n$.InvalidResult,`Invalid result for ${e}: not an object`,{method:e})};let r=t.resultType;if(void 0===r)return{kind:"invalid",error:new nR(n$.InvalidResult,`Invalid result for ${e}: missing required resultType — servers implementing protocol revision 2026-07-28 MUST include it (the absent-means-complete bridge applies only to earlier-revision servers)`,{method:e,violation:"missing-resultType"})};if("string"!=typeof r)return{kind:"invalid",error:new nR(n$.InvalidResult,`Invalid result for ${e}: non-string resultType`,{method:e,resultType:r})};if("input_required"===r){let r=t.inputRequests,o=li(r)?r:{},a=t.requestState;return 0===Object.keys(o).length&&"string"!=typeof a?{kind:"invalid",error:new nR(n$.InvalidResult,`Invalid result for ${e}: input_required carries neither inputRequests nor requestState (every input_required result must include at least one of the two)`,{method:e,violation:"input-required-missing-both"})}:{kind:"input_required",inputRequests:o,..."string"==typeof a&&{requestState:a}}}if("complete"!==r)return{kind:"invalid",error:new nR(n$.UnsupportedResultType,`Unsupported result type '${r}' for ${e}`,{resultType:r,method:e})};let o=function(){if(s)return s;let e=nB();return s={"tools/call":e.CallToolResultSchema,"tools/list":e.ListToolsResultSchema,"prompts/get":e.GetPromptResultSchema,"prompts/list":e.ListPromptsResultSchema,"resources/list":e.ListResourcesResultSchema,"resources/templates/list":e.ListResourceTemplatesResultSchema,"resources/read":e.ReadResourceResultSchema,"completion/complete":e.CompleteResultSchema,"server/discover":e.DiscoverResultSchema}}(),a=Object.hasOwn(o,e)?o[e]:void 0;if(void 0!==a){let r=a.safeParse(t);if(!r.success)return{kind:"invalid",error:new nR(n$.InvalidResult,`Invalid result for ${e}: ${r.error}`,{method:e})}}let i={...t};return delete i.resultType,{kind:"complete",result:i}},encodeResult:(e,t,r)=>(function(e,t){var r;if(void 0===t)return e;let o=e._meta;return void 0===o?{...e,_meta:{[aR]:t}}:null===(r=o)||"object"!=typeof r||Array.isArray(r)||void 0!==o[aR]?e:{...e,_meta:{...o,[aR]:t}}})(function(e,t){var r,o,a,i;let s=t[nX];if("complete"!==t.resultType||(r=e,!nG.includes(r))){let e;return void 0===s?t:(e={...o=t},delete e[nX],e)}let n=nY(t.ttlMs)?t.ttlMs:void 0!==(a=s)&&nY(a.ttlMs)?a.ttlMs:0,l=nQ(t.cacheScope)?t.cacheScope:void 0!==(i=s)&&nQ(i.cacheScope)?i.cacheScope:"private",c={...t,ttlMs:n,cacheScope:l};return delete c[nX],c}(e,function(e,t){let r=t.resultType;if(void 0===r)return{...t,resultType:"complete"};if("complete"===r||n3.includes(e))return t;throw new n1(n0.InternalError,`Handler for ${e} returned resultType '${String(r)}', but results of ${e} only support 'complete' on protocol revision 2026-07-28`)}(e,function(e,t){let r=t,o=!1,a=()=>(o||(r={...r},o=!0),r),i=t.tools;"tools/list"===e&&Array.isArray(i)&&i.some(e=>li(e)&&"execution"in e)&&(a().tools=i.map(e=>{if(!li(e)||!("execution"in e))return e;let t={...e};return delete t.execution,t}));let s=t.capabilities;if(li(s)&&"tasks"in s){let e={...s};delete e.tasks,a().capabilities=e}return r}(e,t))),r),encodeErrorCode:e=>-32002===e?-32602:e,checkInboundEnvelope(e){if(void 0===e.envelope)return"Request is missing the required _meta envelope for protocol revision 2026-07-28 (io.modelcontextprotocol/protocolVersion, io.modelcontextprotocol/clientCapabilities)";let t=nB().RequestMetaEnvelopeSchema.safeParse(e.envelope);if(!t.success)return`Invalid _meta envelope for protocol revision 2026-07-28: ${t.error.issues.map(e=>e.message).join("; ")}`}},lu="2026-07-28";function ld(e){return void 0!==e&&e>=nE?lc:nW}function lp(e){return void 0!==e.revision?ld(e.revision).era:"modern"===e.era?lc.era:nW.era}function lh(e){return lf.some(t=>t.hasRequestMethod(e))}function lm(e){return lf.some(t=>t.hasNotificationMethod(e))}let lf=[nW,lc];var ly=((e,t)=>{let r={};for(var o in e)R(r,o,{get:e[o],enumerable:!0});return t&&R(r,Symbol.toStringTag,{value:"Module"}),r})({AnnotationsSchema:()=>i_,AudioContentSchema:()=>iB,BaseMetadataSchema:()=>a1,BaseRequestParamsSchema:()=>az,BlobResourceContentsSchema:()=>ig,BooleanSchemaSchema:()=>sb,CallToolRequestParamsSchema:()=>se,CallToolRequestSchema:()=>st,CallToolResultSchema:()=>i8,CancelTaskRequestSchema:()=>s3,CancelTaskResultSchema:()=>s6,CancelledNotificationParamsSchema:()=>aX,CancelledNotificationSchema:()=>aY,ClientCapabilitiesSchema:()=>a6,ClientNotificationSchema:()=>s7,ClientRequestSchema:()=>s8,ClientResultSchema:()=>ne,ClientTasksCapabilitySchema:()=>a5,CompatibilityCallToolResultSchema:()=>i7,CompleteRequestParamsSchema:()=>sD,CompleteRequestSchema:()=>sV,CompleteResultSchema:()=>sH,ContentBlockSchema:()=>iQ,CreateMessageRequestParamsSchema:()=>sy,CreateMessageRequestSchema:()=>sg,CreateMessageResultSchema:()=>sv,CreateMessageResultWithToolsSchema:()=>s_,CreateTaskResultSchema:()=>sX,CursorSchema:()=>aj,DiscoverRequestSchema:()=>io,DiscoverResultSchema:()=>ia,ElicitRequestFormParamsSchema:()=>sj,ElicitRequestParamsSchema:()=>sN,ElicitRequestSchema:()=>sA,ElicitRequestURLParamsSchema:()=>sI,ElicitResultSchema:()=>sM,ElicitationCompleteNotificationParamsSchema:()=>sz,ElicitationCompleteNotificationSchema:()=>sq,EmbeddedResourceSchema:()=>iX,EmptyResultSchema:()=>aG,EnumSchemaSchema:()=>sC,GetPromptRequestParamsSchema:()=>iK,GetPromptRequestSchema:()=>iJ,GetPromptResultSchema:()=>i1,GetTaskPayloadRequestSchema:()=>s2,GetTaskPayloadResultSchema:()=>s9,GetTaskRequestSchema:()=>s0,GetTaskResultSchema:()=>s1,IconSchema:()=>aQ,IconsSchema:()=>a0,ImageContentSchema:()=>iW,ImplementationSchema:()=>a2,InitializeRequestParamsSchema:()=>a8,InitializeRequestSchema:()=>a7,InitializeResultSchema:()=>it,InitializedNotificationSchema:()=>ir,JSONArraySchema:()=>aC,JSONObjectSchema:()=>aT,JSONRPCErrorResponseSchema:()=>aZ,JSONRPCMessageSchema:()=>aW,JSONRPCNotificationSchema:()=>aK,JSONRPCRequestSchema:()=>aF,JSONRPCResponseSchema:()=>aB,JSONRPCResultResponseSchema:()=>aJ,JSONValueSchema:()=>ax,LegacyTitledEnumSchemaSchema:()=>sP,ListChangedOptionsBaseSchema:()=>so,ListPromptsRequestSchema:()=>iH,ListPromptsResultSchema:()=>iF,ListResourceTemplatesRequestSchema:()=>iR,ListResourceTemplatesResultSchema:()=>iP,ListResourcesRequestSchema:()=>iw,ListResourcesResultSchema:()=>i$,ListRootsRequestSchema:()=>sK,ListRootsResultSchema:()=>sJ,ListTasksRequestSchema:()=>s4,ListTasksResultSchema:()=>s5,ListToolsRequestSchema:()=>i3,ListToolsResultSchema:()=>i6,LoggingLevelSchema:()=>sa,LoggingMessageNotificationParamsSchema:()=>sn,LoggingMessageNotificationSchema:()=>sl,ModelHintSchema:()=>sc,ModelPreferencesSchema:()=>su,MultiSelectEnumSchemaSchema:()=>sT,NotificationSchema:()=>aU,NotificationsParamsSchema:()=>aL,NumberSchemaSchema:()=>sw,PaginatedRequestParamsSchema:()=>iu,PaginatedRequestSchema:()=>id,PaginatedResultSchema:()=>ip,PingRequestSchema:()=>ii,PrimitiveSchemaDefinitionSchema:()=>sO,ProgressNotificationParamsSchema:()=>il,ProgressNotificationSchema:()=>ic,ProgressSchema:()=>is,ProgressTokenSchema:()=>aO,PromptArgumentSchema:()=>iD,PromptListChangedNotificationSchema:()=>i2,PromptMessageSchema:()=>i0,PromptReferenceSchema:()=>sU,PromptSchema:()=>iV,ReadResourceRequestParamsSchema:()=>iE,ReadResourceRequestSchema:()=>ik,ReadResourceResultSchema:()=>ix,RelatedTaskMetadataSchema:()=>aN,RequestIdSchema:()=>aH,RequestMetaSchema:()=>aA,RequestSchema:()=>aM,ResourceContentsSchema:()=>ih,ResourceLinkSchema:()=>iY,ResourceListChangedNotificationSchema:()=>iT,ResourceRequestParamsSchema:()=>iE,ResourceSchema:()=>ib,ResourceTemplateReferenceSchema:()=>sL,ResourceTemplateSchema:()=>iS,ResourceUpdatedNotificationParamsSchema:()=>iL,ResourceUpdatedNotificationSchema:()=>iU,ResultMetaObjectSchema:()=>aD,ResultSchema:()=>aV,RoleSchema:()=>iv,RootSchema:()=>sF,RootsListChangedNotificationSchema:()=>sZ,SamplingContentSchema:()=>sh,SamplingMessageContentBlockSchema:()=>sm,SamplingMessageSchema:()=>sf,ServerCapabilitiesSchema:()=>ie,ServerNotificationSchema:()=>nr,ServerRequestSchema:()=>nt,ServerResultSchema:()=>no,ServerTasksCapabilitySchema:()=>a3,SetLevelRequestParamsSchema:()=>si,SetLevelRequestSchema:()=>ss,SingleSelectEnumSchemaSchema:()=>sE,StringSchemaSchema:()=>sS,SubscribeRequestParamsSchema:()=>iE,SubscribeRequestSchema:()=>iC,SubscriptionFilterSchema:()=>ij,SubscriptionsAcknowledgedNotificationParamsSchema:()=>iA,SubscriptionsAcknowledgedNotificationSchema:()=>iz,SubscriptionsListenRequestParamsSchema:()=>iI,SubscriptionsListenRequestSchema:()=>iN,SubscriptionsListenResultMetaSchema:()=>iq,SubscriptionsListenResultSchema:()=>iM,TaskAugmentedRequestParamsSchema:()=>aq,TaskCreationParamsSchema:()=>sW,TaskMetadataSchema:()=>aI,TaskSchema:()=>sG,TaskStatusNotificationParamsSchema:()=>sY,TaskStatusNotificationSchema:()=>sQ,TaskStatusSchema:()=>sB,TextContentSchema:()=>iZ,TextResourceContentsSchema:()=>im,TitledMultiSelectEnumSchemaSchema:()=>sx,TitledSingleSelectEnumSchemaSchema:()=>sR,ToolAnnotationsSchema:()=>i9,ToolChoiceSchema:()=>sd,ToolExecutionSchema:()=>i4,ToolListChangedNotificationSchema:()=>sr,ToolResultContentSchema:()=>sp,ToolSchema:()=>i5,ToolUseContentSchema:()=>iG,UnsubscribeRequestParamsSchema:()=>iE,UnsubscribeRequestSchema:()=>iO,UntitledMultiSelectEnumSchemaSchema:()=>sk,UntitledSingleSelectEnumSchemaSchema:()=>s$});let lg=e=>aJ.safeParse(e).success,lv=e=>aZ.safeParse(e).success,l_=e=>"object"==typeof e&&null!==e&&!Array.isArray(e)&&"input_required"===e.resultType,lb="x-mcp-header",lS=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,lw=new Set(["string","integer","boolean","number"]);function l$(e){let t=[],r=new Map,o=(e,a,i)=>{if(null===e||"object"!=typeof e)return;if(lb in e){if(!i||0===a.length)return`${lE(a)}: x-mcp-header is only permitted on properties statically reachable via a chain of 'properties' keys (not under items, additionalProperties, oneOf/anyOf/allOf/not, if/then/else, or $ref)`;let o=e[lb];if("string"!=typeof o||0===o.length)return`${lE(a)}: x-mcp-header MUST be a non-empty string`;if(!lS.test(o))return`${lE(a)}: x-mcp-header '${o}' is not a valid RFC 9110 token (no spaces, control characters or HTTP delimiters)`;let s="string"==typeof e.type?e.type:void 0;if(void 0===s||!lw.has(s))return`${lE(a)}: x-mcp-header is only permitted on primitive-typed properties (string, integer, boolean); got ${s??"<none>"}`;let n=o.toLowerCase(),l=r.get(n);if(void 0!==l)return`x-mcp-header '${o}' is not case-insensitively unique (also declared as '${l}')`;r.set(n,o),t.push({path:a,headerName:o,type:s})}let s=e.properties;if(null!==s&&"object"==typeof s)for(let[e,t]of Object.entries(s)){let r=o(t,[...a,e],i);if(void 0!==r)return r}for(let t of lR){let r=e[t];if(void 0!==r)for(let e of Array.isArray(r)?r:null!==r&&"object"==typeof r&&lP.has(t)?Object.values(r):[r]){let r=o(e,[...a,`<${t}>`],!1);if(void 0!==r)return r}}},a=o(e,[],!0);return void 0===a?{valid:!0,declarations:t}:{valid:!1,reason:a}}let lR=["items","prefixItems","contains","additionalProperties","unevaluatedProperties","unevaluatedItems","propertyNames","patternProperties","dependentSchemas","oneOf","anyOf","allOf","not","if","then","else","$defs","definitions"],lP=new Set(["patternProperties","dependentSchemas","$defs","definitions"]);function lE(e){return 0===e.length?"<root>":e.join(".")}let lk="=?base64?";function lx(e){return!function(e){if(0===e.length||e.startsWith(lk)&&e.endsWith("?=")||e!==e.trim())return!0;for(let t=0;t<e.length;t++){let r=e.codePointAt(t);if(9!==r&&(!(r>=32)||!(r<=126)))return!0}return!1}(e)?e:`${lk}${function(e){let t=new TextEncoder().encode(e),r="";for(let e of t)r+=String.fromCodePoint(e);return btoa(r)}(e)}?=`}function lT(e){return new Set(e.flatMap(e=>Object.keys(e.shape)))}function lC(e){if(null==e)return!1;let t=typeof e;return("object"===t||"function"===t)&&"~standard"in e&&"function"==typeof e["~standard"]?.validate}n0.InvalidRequest,n0.UnsupportedProtocolVersion,n0.InvalidParams,n0.MethodNotFound,n0.InvalidParams,n0.MissingRequiredClientCapability,n0.ParseError,n0.InvalidRequest,n0.MethodNotFound,n0.UnsupportedProtocolVersion,n0.MissingRequiredClientCapability;let lO=!1,lj="draft-2020-12";async function lI(e,t){let r=await e["~standard"].validate(t);return r.issues&&r.issues.length>0?{success:!1,error:r.issues.map(e=>{var t;return t=e,t.path?.length?`${t.path.map(e=>String("object"==typeof e?e.key:e)).join(".")}: ${t.message}`:t.message}).join(", ")}:{success:!0,data:r.value}}let lN=/\\\.\\d\{(\d+)\}/;function lA(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}let lz=new Set(["$comment","deprecated","description","examples","readOnly","title","writeOnly"]);function lq(e){return lz.has(e)||e.startsWith("x-")}let lM=new Set(["$schema",...Object.keys(sj.shape.requestedSchema.shape)]),lL={string:lT([sS,s$,sR,sP]),number:lT([sw]),integer:lT([sw]),boolean:lT([sb]),array:lT([sk,sx])},lU=new Set(sS.shape.format.unwrap().options);async function lD(e){let{config:t,method:r,originalParams:o,requestOptions:a,hooks:i,signal:s}=e,n=e.flowStartedAt??Date.now(),l=e.firstPayload,c=0;for(;;){let e;if((c+=1)>t.maxRounds){var u,d;throw new nR(n$.InputRequiredRoundsExceeded,(u=r,d=t.maxRounds,`Multi-round-trip request '${u}' still required input after ${d} rounds (inputRequired.maxRounds)`),{rounds:t.maxRounds,lastResult:{inputRequests:l.inputRequests,...void 0!==l.requestState&&{requestState:l.requestState}}})}a.onprogress?.({progress:c,message:`Fulfilling input required by '${r}' (round ${c})`});let p=Object.entries(l.inputRequests??{});if(p.length>0){let t=function(e){let t=new AbortController,r=()=>t.abort(e?.reason);return e?.addEventListener("abort",r,{once:!0}),e?.aborted&&t.abort(e.reason),{signal:t.signal,abort:e=>t.abort(e),dispose:()=>e?.removeEventListener("abort",r)}}(s);try{let r=await Promise.all(p.map(async([e,r])=>{try{return[e,await i.dispatchInputRequest(e,r,t.signal)]}catch(e){throw t.abort(e),e}}));e=Object.fromEntries(r)}finally{t.dispose()}}else await function(e,t){return new Promise((e,r)=>{if(t?.aborted)return void r(t.reason instanceof nR?t.reason:new nR(n$.RequestTimeout,String(t.reason)));let o=setTimeout(()=>{t?.removeEventListener("abort",a),e()},250),a=()=>{clearTimeout(o),r(t?.reason instanceof nR?t.reason:new nR(n$.RequestTimeout,String(t?.reason)))};t?.addEventListener("abort",a,{once:!0})})}(0,s);let h={...void 0!==a.timeout&&{timeout:a.timeout}};if(void 0!==a.maxTotalTimeout){let e=Date.now()-n,t=a.maxTotalTimeout-e;if(t<=0)throw new nR(n$.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:a.maxTotalTimeout,totalElapsed:e});h.maxTotalTimeout=t}let m=await i.retry(function(e,t,r){let o=void 0!==t&&Object.keys(t).length>0;return o||void 0!==r?{...e,...o&&{inputResponses:t},...void 0!==r&&{requestState:r}}:e}(o,e,l.requestState),h);if(l_(m)){l={inputRequests:m.inputRequests??{},...void 0!==m.requestState&&{requestState:m.requestState}};continue}return m}}Object.assign(function(e){let t=void 0!==e.inputRequests&&Object.keys(e.inputRequests).length>0,r="string"==typeof e.requestState;if(!t&&!r)throw TypeError("inputRequired() requires at least one of inputRequests (with at least one entry) or requestState (spec: every InputRequiredResult MUST include at least one of the two)");return{resultType:"input_required",...void 0!==e.inputRequests&&{inputRequests:e.inputRequests},...void 0!==e.requestState&&{requestState:e.requestState}}},{elicit(e){try{return{method:"elicitation/create",params:function(e){var t;if(!lC(e.requestedSchema))return{...e,mode:"form",requestedSchema:e.requestedSchema};let r=e.requestedSchema["~standard"].vendor,o=function(e,t){let r={},o=[];for(let[a,i]of Object.entries(e))"properties"===a&&lA(i)?r[a]=Object.fromEntries(Object.entries(i).map(([e,r])=>[e,function(e,t,r,o){if(!lA(e))return e;let a="string"==typeof e.type&&Object.hasOwn(lL,e.type)?lL[e.type]:void 0;if(void 0===a)return e;let i={};for(let[l,c]of Object.entries(e))if(a.has(l)||lq(l))i[l]=c;else if("pattern"===l&&"string"===e.type&&"string"==typeof e.format)if(lU.has(e.format)){var s,n;"string"==typeof c&&(s=e.format,n=c,"zod"!==r||(function(e,t){var r;let o,a,i;switch(e){case"email":o=[rc(oy,void 0)];break;case"uri":o=[rd(o_,void 0)];break;case"date":o=[r9()];break;case"date-time":r=t,a=lN.exec(r),i=[void 0,-1,0],a&&i.push(Number(a[1])),o=[!1,!0].flatMap(e=>[!1,!0].flatMap(t=>i.map(r=>r1({local:e,offset:t,precision:r}))))}return new Set(o.map(e=>{let t;return t=rQ(e,{target:lj,io:"input"}),"string"==typeof t.pattern?t.pattern:void 0}).filter(e=>void 0!==e))})(s,n).has(n))||o.push(`${t}.${l}`)}else i[l]=c;else o.push(`${t}.${l}`);return i}(r,`properties.${e}`,t,o)])):lM.has(a)?r[a]=i:lq(a)||o.push(a);if(o.length>0)throw new n1(n0.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${o.join(", ")}`);return r}(function(e){try{return function(e,t="input"){let r,o=e["~standard"];if(o.jsonSchema)r=o.jsonSchema[t]({target:lj});else if("zod"===o.vendor){if(!("_zod"in e))throw Error("Schema appears to be from zod 3, which the SDK cannot convert to JSON Schema. Upgrade to zod >=4.2.0, or wrap your JSON Schema with fromJsonSchema().");lO||(lO=!0,console.warn("[mcp-sdk] Your zod version does not implement `~standard.jsonSchema` (added in zod 4.2.0). Falling back to z.toJSONSchema(). Upgrade to zod >=4.2.0 to silence this warning.")),r=rQ(e,{target:lj,io:t})}else throw Error(`Schema library "${o.vendor}" does not implement StandardJSONSchemaV1 (\`~standard.jsonSchema\`). Upgrade to a version that does, or wrap your JSON Schema with fromJsonSchema().`);if("output"===t)return void 0!==r.type||!function e(t){if("properties"in t||"patternProperties"in t||"additionalProperties"in t||"required"in t)return!0;for(let r of["oneOf","anyOf","allOf"]){let o=t[r];if(Array.isArray(o)&&o.length>0)return o.every(t=>null!==t&&"object"==typeof t&&("object"===t.type||e(t)))}return!1}(r)?r:{type:"object",...r};if(void 0!==r.type&&"object"!==r.type)throw Error(`MCP tool and prompt schemas must describe objects (got type: ${JSON.stringify(r.type)}). Wrap your schema in z.object({...}) or equivalent.`);return{type:"object",...r}}(e,"input")}catch(t){let e=t instanceof Error?t.message:String(t);throw new n1(n0.InvalidParams,`Elicitation requestedSchema must describe an object with flat primitive properties: ${e}`)}}(e.requestedSchema),r),a=(t=sj.shape.requestedSchema,r7(t,o));if(!a.success)throw new n1(n0.InvalidParams,`Elicitation requestedSchema only supports flat primitive properties (string, number, integer, boolean, and string enums): ${function(e,t){if(!lA(e.properties))return t;let r=Object.entries(e.properties).filter(([,e])=>!r7(sO,e).success).map(([e])=>`properties.${e}`);return r.length>0?r.join(", "):t}(o,a.error.message)}`);let i=function e(t,r,o=""){return Array.isArray(t)&&Array.isArray(r)?t.flatMap((t,a)=>e(t,r[a],`${o}[${a}]`)):lA(t)&&lA(r)?Object.entries(t).flatMap(([t,a])=>{let i=o?`${o}.${t}`:t;return Object.prototype.hasOwnProperty.call(r,t)?e(a,r[t],i):lq(t)?[]:[i]}):[]}(o,a.data);if(i.length>0)throw new n1(n0.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${i.join(", ")}`);let s=(a.data.required??[]).filter(e=>!Object.prototype.hasOwnProperty.call(a.data.properties,e));if(s.length>0)throw new n1(n0.InvalidParams,`Elicitation requestedSchema lists required properties that are not defined in properties: ${s.join(", ")}`);return{...e,mode:"form",requestedSchema:a.data}}(e)}}catch(e){throw e instanceof n1?TypeError(e.message,{cause:e}):e}},elicitUrl:e=>({method:"elicitation/create",params:{...e,mode:"url"}}),createMessage:e=>({method:"sampling/createMessage",params:e}),listRoots:()=>({method:"roots/list"})});let lV={},lH={};function lF(e,t){let r=e.slice(0,-6);lV[r]=t,lH[r]=e=>t.safeParse(e).success}for(let e of["AnnotationsSchema","AudioContentSchema","BaseMetadataSchema","BlobResourceContentsSchema","BooleanSchemaSchema","CallToolRequestSchema","CallToolRequestParamsSchema","CallToolResultSchema","CancelledNotificationSchema","CancelledNotificationParamsSchema","CancelTaskRequestSchema","CancelTaskResultSchema","ClientCapabilitiesSchema","ClientNotificationSchema","ClientRequestSchema","ClientResultSchema","CompatibilityCallToolResultSchema","CompleteRequestSchema","CompleteRequestParamsSchema","CompleteResultSchema","ContentBlockSchema","CreateMessageRequestSchema","CreateMessageRequestParamsSchema","CreateMessageResultSchema","CreateMessageResultWithToolsSchema","CreateTaskResultSchema","CursorSchema","DiscoverRequestSchema","DiscoverResultSchema","ElicitationCompleteNotificationSchema","ElicitationCompleteNotificationParamsSchema","ElicitRequestSchema","ElicitRequestFormParamsSchema","ElicitRequestParamsSchema","ElicitRequestURLParamsSchema","ElicitResultSchema","EmbeddedResourceSchema","EmptyResultSchema","EnumSchemaSchema","GetPromptRequestSchema","GetPromptRequestParamsSchema","GetPromptResultSchema","GetTaskPayloadRequestSchema","GetTaskPayloadResultSchema","GetTaskRequestSchema","GetTaskResultSchema","IconSchema","IconsSchema","ImageContentSchema","ImplementationSchema","InitializedNotificationSchema","InitializeRequestSchema","InitializeRequestParamsSchema","InitializeResultSchema","JSONArraySchema","JSONObjectSchema","JSONRPCErrorResponseSchema","JSONRPCMessageSchema","JSONRPCNotificationSchema","JSONRPCRequestSchema","JSONRPCResponseSchema","JSONRPCResultResponseSchema","JSONValueSchema","LegacyTitledEnumSchemaSchema","ListPromptsRequestSchema","ListPromptsResultSchema","ListResourcesRequestSchema","ListResourcesResultSchema","ListResourceTemplatesRequestSchema","ListResourceTemplatesResultSchema","ListRootsRequestSchema","ListRootsResultSchema","ListTasksRequestSchema","ListTasksResultSchema","ListToolsRequestSchema","ListToolsResultSchema","LoggingLevelSchema","LoggingMessageNotificationSchema","LoggingMessageNotificationParamsSchema","ModelHintSchema","ModelPreferencesSchema","MultiSelectEnumSchemaSchema","NotificationSchema","NumberSchemaSchema","PaginatedRequestSchema","PaginatedRequestParamsSchema","PaginatedResultSchema","PingRequestSchema","PrimitiveSchemaDefinitionSchema","ProgressSchema","ProgressNotificationSchema","ProgressNotificationParamsSchema","ProgressTokenSchema","PromptSchema","PromptArgumentSchema","PromptListChangedNotificationSchema","PromptMessageSchema","PromptReferenceSchema","ReadResourceRequestSchema","ReadResourceRequestParamsSchema","ReadResourceResultSchema","RelatedTaskMetadataSchema","RequestSchema","RequestIdSchema","RequestMetaSchema","ResourceSchema","ResourceContentsSchema","ResourceLinkSchema","ResourceListChangedNotificationSchema","ResourceRequestParamsSchema","ResourceTemplateSchema","ResourceTemplateReferenceSchema","ResourceUpdatedNotificationSchema","ResourceUpdatedNotificationParamsSchema","ResultMetaObjectSchema","ResultSchema","RoleSchema","RootSchema","RootsListChangedNotificationSchema","SamplingContentSchema","SamplingMessageSchema","SamplingMessageContentBlockSchema","ServerCapabilitiesSchema","ServerNotificationSchema","ServerRequestSchema","ServerResultSchema","SetLevelRequestSchema","SetLevelRequestParamsSchema","SingleSelectEnumSchemaSchema","StringSchemaSchema","SubscribeRequestSchema","SubscribeRequestParamsSchema","SubscriptionFilterSchema","SubscriptionsAcknowledgedNotificationSchema","SubscriptionsAcknowledgedNotificationParamsSchema","SubscriptionsListenRequestSchema","SubscriptionsListenRequestParamsSchema","SubscriptionsListenResultSchema","SubscriptionsListenResultMetaSchema","TaskAugmentedRequestParamsSchema","TaskCreationParamsSchema","TaskMetadataSchema","TaskSchema","TaskStatusSchema","TaskStatusNotificationSchema","TaskStatusNotificationParamsSchema","TextContentSchema","TextResourceContentsSchema","TitledMultiSelectEnumSchemaSchema","TitledSingleSelectEnumSchemaSchema","ToolSchema","ToolAnnotationsSchema","ToolChoiceSchema","ToolExecutionSchema","ToolListChangedNotificationSchema","ToolResultContentSchema","ToolUseContentSchema","UnsubscribeRequestSchema","UnsubscribeRequestParamsSchema","UntitledMultiSelectEnumSchemaSchema","UntitledSingleSelectEnumSchemaSchema"])lF(e,ly[e]);for(let[e,t]of Object.entries({IdJagTokenExchangeResponseSchema:nu,OAuthClientInformationFullSchema:nf,OAuthClientInformationSchema:nm,OAuthClientMetadataSchema:nh,OAuthClientRegistrationErrorSchema:ny,OAuthErrorResponseSchema:nd,OAuthMetadataSchema:ns,OAuthProtectedResourceMetadataSchema:ni,OAuthTokenRevocationRequestSchema:ng,OAuthTokensSchema:nc,OpenIdProviderDiscoveryMetadataSchema:nl,OpenIdProviderMetadataSchema:nn}))lF(e,t);Object.freeze(lV);let lK=Object.freeze(lH),lJ=[aw,a$,aP,ak],lZ=["inputResponses","requestState"];function lW(e,t){let r=e.params;if(!lY(r))return{message:e,lifted:{}};let o=r._meta,a=lY(o)?lJ.filter(e=>e in o):[],i="request"===t?lZ.filter(e=>e in r):[];if(0===a.length&&0===i.length)return{message:e,lifted:{}};let s={},n={...r};if(a.length>0&&lY(o)){let e={},t={...o};for(let r of a)e[r]=o[r],delete t[r];s.envelope=e,Object.keys(t).length>0?n._meta=t:delete n._meta}for(let e of i)"inputResponses"===e&&(s.inputResponses=n[e]),"requestState"===e&&(s.requestState=n[e]),delete n[e];return{message:{...e,params:n},lifted:s}}function lB(e,t){let r=e.validateResult(t,void 0);if(r.ok||"not-in-era"!==r.reason)return{"~standard":{version:1,vendor:"mcp-wire-codec",validate(r){let o=e.validateResult(t,r);return o.ok?{value:o.value}:{issues:[{message:"invalid"===o.reason?o.message:`not-in-era: ${t}`}]}}}}}let lG=(_=void 0,()=>_);var lX=class{_transport;_requestMessageId=0;_requestHandlers=new Map;_requestHandlerAbortControllers=new Map;_notificationHandlers=new Map;_responseHandlers=new Map;_progressHandlers=new Map;_timeoutInfo=new Map;_pendingDebouncedNotifications=new Set;_negotiatedProtocolVersion;_supportedProtocolVersions;onclose;onerror;fallbackRequestHandler;fallbackNotificationHandler;constructor(e){this._options=e,this._supportedProtocolVersions=e?.supportedProtocolVersions??aS,this.setNotificationHandler("notifications/cancelled",e=>{this._oncancel(e)}),this.setNotificationHandler("notifications/progress",e=>{this._onprogress(e)}),this.setRequestHandler("ping",e=>({}))}_shouldDropInbound(e){}_outboundMetaEnvelope(){}_envelopeOutbound(e){let t=this._outboundMetaEnvelope();if(void 0===t)return e;let r=e.params??{};return{...e,params:{...r,_meta:{...t,...r._meta}}}}_resolveNonCompleteResult(e,t){return Promise.reject(new nR(n$.UnsupportedResultType,`Unsupported result type '${e.kind}' for ${t.request.method}`,{resultType:e.kind,method:t.request.method}))}_getRequestHandler(e){return this._requestHandlers.get(e)}async _oncancel(e){e.params.requestId&&this._requestHandlerAbortControllers.get(e.params.requestId)?.abort(e.params.reason)}_setupTimeout(e,t,r,o,a=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(o,t),startTime:Date.now(),timeout:t,maxTotalTimeout:r,resetTimeoutOnProgress:a,onTimeout:o})}_resetTimeout(e){let t=this._timeoutInfo.get(e);if(!t)return!1;let r=Date.now()-t.startTime;if(t.maxTotalTimeout&&r>=t.maxTotalTimeout)throw this._timeoutInfo.delete(e),new nR(n$.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:t.maxTotalTimeout,totalElapsed:r});return clearTimeout(t.timeoutId),t.timeoutId=setTimeout(t.onTimeout,t.timeout),!0}_cleanupTimeout(e){let t=this._timeoutInfo.get(e);t&&(clearTimeout(t.timeoutId),this._timeoutInfo.delete(e))}async connect(e){this._transport=e;let t=this.transport?.onclose;this._transport.onclose=()=>{try{t?.()}finally{this._onclose()}};let r=this.transport?.onerror;this._transport.onerror=e=>{r?.(e),this._onerror(e)};let o=this._transport?.onmessage;this._transport.onmessage=(e,t)=>{if(o?.(e,t),lg(e)||lv(e))this._onresponse(e);else{let r;if(r=e,aF.safeParse(r).success)this._onrequest(e,t);else{let r;(r=e,aK.safeParse(r).success)?this._onnotification(e,t):this._onerror(Error(`Unknown message type: ${JSON.stringify(e)}`))}}},e.setSupportedProtocolVersions?.(this._supportedProtocolVersions),await this._transport.start()}_onclose(){let e=this._responseHandlers;for(let e of(this._responseHandlers=new Map,this._progressHandlers.clear(),this._pendingDebouncedNotifications.clear(),this._timeoutInfo.values()))clearTimeout(e.timeoutId);this._timeoutInfo.clear();let t=this._requestHandlerAbortControllers;this._requestHandlerAbortControllers=new Map;let r=new nR(n$.ConnectionClosed,"Connection closed");this._transport=void 0;try{this.onclose?.()}finally{for(let t of e.values())t(r);for(let e of t.values())e.abort(r)}}_onerror(e){this.onerror?.(e)}_onnotification(e,t){let{message:r}=lW(e,"notification"),o=this._negotiatedWireCodec();if(t?.classification===void 0&&"drop"===this._shouldDropInbound(e))return;if(t?.classification!==void 0){let e=lp(t.classification);if(e!==o.era)return void this._onerror(Error(`Era mismatch on inbound notification '${r.method}': classified as ${e} but this instance serves ${o.era}`))}if(lm(r.method)&&!o.hasNotificationMethod(r.method))return;let a=this._notificationHandlers.get(r.method),i=this.fallbackNotificationHandler;(void 0!==a||void 0!==i)&&Promise.resolve().then(()=>void 0===a?i(r):a(r,o)).catch(e=>this._onerror(Error(`Uncaught error in notification handler: ${e}`)))}_onrequest(e,t){var r;let{message:o,lifted:a}=lW(e,"request"),i=this._negotiatedWireCodec();if(t?.classification===void 0&&"drop"===this._shouldDropInbound(e))return void this._onerror(Error(`Dropped inbound request '${e.method}': not servable on this connection's protocol era`));let s=this._transport,n=(e,t,r)=>{let a={jsonrpc:"2.0",id:o.id,error:{code:e,message:t,...void 0!==r&&{data:r}}};s?.send(a).catch(e=>this._onerror(Error(`Failed to send an error response: ${e}`)))};if(t?.classification!==void 0){let e=lp(t.classification);if(e!==i.era){this._onerror(Error(`Era mismatch on inbound request '${o.method}': classified as ${e} but this instance serves ${i.era}`));let r=t.classification.revision??e;n(n0.UnsupportedProtocolVersion,`Unsupported protocol version: ${r}`,{supported:this._supportedProtocolVersions,requested:r});return}}if(lh(o.method)&&!i.hasRequestMethod(o.method))return void n(n0.MethodNotFound,"Method not found");let l=this._requestHandlers.get(o.method)??this.fallbackRequestHandler;if(void 0===l)return void n(n0.MethodNotFound,"Method not found");let c=i.checkInboundEnvelope(a);if(void 0!==c)return void n(n0.InvalidParams,c);let u=(e,t)=>this._notificationViaCodec(this._resolveOutboundCodec(e.method),e,{...t,relatedRequestId:o.id}),d=(e,t,r)=>this._requestWithSchemaViaCodec(this._resolveOutboundCodec(e.method),e,t,{...r,relatedRequestId:o.id}),p=new AbortController;this._requestHandlerAbortControllers.set(o.id,p);let h=void 0===a.inputResponses?void 0:function(e){let t={},r=[];if(!lQ(e))return{accepted:t,droppedKeys:r};for(let[o,a]of Object.entries(e)){if(!lQ(a)||"method"in a||"result"in a){r.push(o);continue}t[o]=a}return{accepted:t,droppedKeys:r}}(a.inputResponses),m={sessionId:s?.sessionId,mcpReq:{id:o.id,method:o.method,_meta:o.params?._meta,...void 0!==a.envelope&&{envelope:a.envelope},...void 0!==h&&{inputResponses:h.accepted},...void 0!==h&&h.droppedKeys.length>0&&{droppedInputResponseKeys:h.droppedKeys},requestState:void 0===a.requestState?lG:(r=a.requestState,()=>r),signal:p.signal,send:(e,t,r)=>{let o=this._resolveOutboundCodec(e.method);if(this._assertOutboundRequestInEra(o,e.method),lC(t))return d(e,t,r);let a=lB(o,e.method);if(void 0===a)throw TypeError(`'${e.method}' is not a spec method; pass a result schema as the second argument to ctx.mcpReq.send().`);return d(e,a,t)},notify:u},http:t?.authInfo?{authInfo:t.authInfo}:void 0},f=this.buildContext(m,t);Promise.resolve().then(()=>l(o,f)).then(async e=>{let t;if(p.signal.aborted)return;try{t=i.encodeResult(o.method,e,this._outboundServerInfo())}catch(e){this._onerror(Error(`Failed to encode result for ${o.method}: ${e}`)),n(n0.InternalError,"Internal error");return}let r={result:t,jsonrpc:"2.0",id:o.id};await s?.send(r)},async e=>{if(p.signal.aborted)return;let t=Number.isSafeInteger(e.code)?e.code:n0.InternalError,r={jsonrpc:"2.0",id:o.id,error:{code:i.encodeErrorCode(t),message:e.message??"Internal error",...void 0!==e.data&&{data:e.data}}};await s?.send(r)}).catch(e=>this._onerror(Error(`Failed to send response: ${e}`))).finally(()=>{this._requestHandlerAbortControllers.get(o.id)===p&&this._requestHandlerAbortControllers.delete(o.id)})}_onprogress(e){let{progressToken:t,...r}=e.params,o=Number(t),a=this._progressHandlers.get(o);if(!a)return void this._onerror(Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));let i=this._responseHandlers.get(o),s=this._timeoutInfo.get(o);if(s&&i&&s.resetTimeoutOnProgress)try{this._resetTimeout(o)}catch(e){this._responseHandlers.delete(o),this._progressHandlers.delete(o),this._cleanupTimeout(o),i(e);return}a(r)}_onresponse(e){let t=Number(e.id),r=this._responseHandlers.get(t);void 0===r?this._onerror(Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`)):(this._responseHandlers.delete(t),this._cleanupTimeout(t),this._progressHandlers.delete(t),r(lg(e)?e:n1.fromError(e.error.code,e.error.message,e.error.data)))}get transport(){return this._transport}async close(){await this._transport?.close()}request(e,t,r){let o=this._resolveOutboundCodec(e.method);if(this._assertOutboundRequestInEra(o,e.method),lC(t))return this._requestWithSchemaViaCodec(o,e,t,r);let a=lB(o,e.method);if(void 0===a)throw TypeError(`'${e.method}' is not a spec method; pass a result schema as the second argument to request().`);return this._requestWithSchemaViaCodec(o,e,a,t)}_negotiatedWireCodec(){return ld(this._negotiatedProtocolVersion)}_wireCodec(){return this._negotiatedWireCodec()}_resolveOutboundCodec(e){if(void 0===this._negotiatedProtocolVersion){let t=function(e){switch(e){case"initialize":case"notifications/initialized":return ld(void 0);case"server/discover":return ld(lu);default:return}}(e);if(t)return t}return this._negotiatedWireCodec()}_assertOutboundRequestInEra(e,t){if(lh(t)&&!e.hasRequestMethod(t))throw new nR(n$.MethodNotSupportedByProtocolVersion,`Method '${t}' is not supported by the negotiated protocol version (wire era ${e.era})`,{method:t,era:e.era})}_requestWithSchema(e,t,r){let o=this._resolveOutboundCodec(e.method);return this._assertOutboundRequestInEra(o,e.method),this._requestWithSchemaViaCodec(o,e,t,r)}_requestWithSchemaViaCodec(e,t,r,o){let a,i,{relatedRequestId:s,resumptionToken:n,onresumptiontoken:l,headers:c}=o??{},u=Date.now();return new Promise((d,p)=>{let h=e=>{p(e)};if(!this._transport)return void h(Error("Not connected"));if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(t.method)}catch(e){h(e);return}if(o?.signal?.aborted){let e=o.signal.reason;throw e instanceof nR?e:new nR(n$.RequestTimeout,String(e))}let m=e.era===lu&&!0===this._transport.hasPerRequestStream?new AbortController:void 0,f=this._requestMessageId++;i=f;let y={...t,jsonrpc:"2.0",id:f};o?.onprogress&&(this._progressHandlers.set(f,o.onprogress),y.params={...t.params,_meta:{...t.params?._meta,progressToken:f}});let g=this._envelopeOutbound(y),v=!1,_=e=>{v||(this._progressHandlers.delete(f),void 0===m?this._transport?.send(this._envelopeOutbound({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:f,reason:String(e)}}),{relatedRequestId:s,resumptionToken:n,onresumptiontoken:l}).catch(e=>this._onerror(Error(`Failed to send cancellation: ${e}`))):m.abort(),p(e instanceof nR?e:new nR(n$.RequestTimeout,String(e))))};this._responseHandlers.set(f,a=>{let i;if(!o?.signal?.aborted){if(v=!0,a instanceof Error)return p(a);try{i=e.decodeResult(t.method,a.result)}catch(e){return p(e instanceof Error?e:Error(String(e)))}if("invalid"===i.kind)return p(i.error);if("input_required"===i.kind){var s;return o?.allowInputRequired===!0?d({resultType:"input_required",inputRequests:(s=i).inputRequests,...void 0!==s.requestState&&{requestState:s.requestState}}):d(this._resolveNonCompleteResult(i,{codec:e,request:t,resultSchema:r,options:o,flowStartedAt:u,retry:(o,a)=>this._requestWithSchemaViaCodec(e,void 0===o?{method:t.method}:{method:t.method,params:o},r,a)}))}lI(r,i.result).then(e=>{e.success?d(e.data):p(new nR(n$.InvalidResult,`Invalid result for ${t.method}: ${e.error}`))},p)}}),a=()=>_(o?.signal?.reason),o?.signal?.addEventListener("abort",a,{once:!0});let b=o?.timeout??6e4;this._setupTimeout(f,b,o?.maxTotalTimeout,()=>_(new nR(n$.RequestTimeout,"Request timed out",{timeout:b})),o?.resetTimeoutOnProgress??!1),this._transport.send(g,{relatedRequestId:s,resumptionToken:n,onresumptiontoken:l,headers:c,requestSignal:m?.signal}).catch(e=>{this._progressHandlers.delete(f),p(e)})}).finally(()=>{a&&o?.signal?.removeEventListener("abort",a),void 0!==i&&(this._responseHandlers.delete(i),this._cleanupTimeout(i))})}async notification(e,t){return this._notificationViaCodec(this._resolveOutboundCodec(e.method),e,t)}async _notificationViaCodec(e,t,r){if(!this._transport)throw new nR(n$.NotConnected,"Not connected");if(lm(t.method)&&!e.hasNotificationMethod(t.method))throw new nR(n$.MethodNotSupportedByProtocolVersion,`Notification '${t.method}' is not supported by the negotiated protocol version (wire era ${e.era})`,{method:t.method,era:e.era});this.assertNotificationCapability(t.method);let o=this._envelopeOutbound({jsonrpc:"2.0",...t});if((this._options?.debouncedNotificationMethods??[]).includes(t.method)&&!t.params&&!r?.relatedRequestId){if(this._pendingDebouncedNotifications.has(t.method))return;this._pendingDebouncedNotifications.add(t.method),Promise.resolve().then(()=>{this._pendingDebouncedNotifications.delete(t.method),this._transport&&this._transport?.send(o,r).catch(e=>this._onerror(e))});return}await this._transport.send(o,r)}setRequestHandler(e,t,r){let o;if(this.assertRequestHandlerCapability(e),"function"==typeof t){if(!lh(e))throw TypeError(`'${e}' is not a spec request method; pass schemas as the second argument to setRequestHandler().`);o=(r,o)=>{let a=this._negotiatedWireCodec(),i=a.validateRequest(e,r);if(i.ok||"not-in-era"!==i.reason||(i=a.validateInputRequest(e,r)),!i.ok){if("not-in-era"===i.reason)throw new n1(n0.InternalError,`No wire schema for ${e} in the resolved era`);throw Error(i.message)}return Promise.resolve(t(i.value,o))}}else if(r)o=async(o,a)=>{let i=await lI(t.params,{...o.params});if(!i.success)throw new n1(n0.InvalidParams,`Invalid params for ${e}: ${i.error}`);return r(i.data,a)};else throw TypeError("setRequestHandler: handler is required");this._requestHandlers.set(e,this._wrapHandler(e,o))}_wrapHandler(e,t){return t}_outboundServerInfo(){}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,t,r){if("function"==typeof t){if(!lm(e))throw TypeError(`'${e}' is not a spec notification method; pass schemas as the second argument to setNotificationHandler().`);this._notificationHandlers.set(e,(r,o)=>{let a=o.validateNotification(e,r);if(!a.ok){if("not-in-era"===a.reason)throw new n1(n0.InternalError,`No wire schema for ${e} in the resolved era`);throw Error(a.message)}return Promise.resolve(t(a.value))});return}if(!r)throw TypeError("setNotificationHandler: handler is required");this._notificationHandlers.set(e,async o=>{let a=await lI(t.params,{...o.params});if(!a.success)throw new n1(n0.InvalidParams,`Invalid params for notification ${e}: ${a.error}`);await r(a.data,o)})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}};function lY(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)}function lQ(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}function l0(e){throw new nR(n$.SendFailed,`ctx.mcpReq.${e} is not available while fulfilling an embedded input request: the request is fulfilled locally and has no related peer request`)}async function l1(e,t,r,o,a){var i,s,n,l,c;if(!lQ(o)||"string"!=typeof o.method)throw new nR(n$.InvalidResult,`Invalid input request '${r}': each inputRequests entry must be an embedded request object with a method`,{key:r});let u=o.method;if(!t.hasInputRequestMethod(u))throw new nR(n$.InvalidResult,`Invalid input request '${r}': '${u}' is not an embedded request the ${t.era} revision defines (expected elicitation/create, sampling/createMessage, or roots/list)`,{key:r,method:u});let d=e.getRequestHandler(u);if(void 0===d)throw new nR(n$.CapabilityNotSupported,`Cannot fulfil input request '${r}': no handler is registered for '${u}' on this client. Declare the corresponding capability and register a handler, or handle input_required results manually.`,{key:r,method:u});let p=lQ(o.params)?o.params:void 0;return await d({jsonrpc:"2.0",id:r,method:u,...void 0!==p&&{params:p}},e.buildContext((i=r,s=u,n=p,l=a,{sessionId:e.sessionId,mcpReq:{id:i,method:s,_meta:n?._meta,requestState:(c=void 0,()=>c),signal:l,send:()=>l0("send"),notify:()=>l0("notify")}})))}var l2=C(T(e=>{var t=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,r=/\\([\u000b\u0020-\u00ff])/g,o=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;function a(e){this.parameters=Object.create(null),this.type=e}e.parse=function(e){if(!e)throw TypeError("argument string is required");var i,s,n,l="object"==typeof e?function(e){var t;if("function"==typeof e.getHeader?t=e.getHeader("content-type"):"object"==typeof e.headers&&(t=e.headers&&e.headers["content-type"]),"string"!=typeof t)throw TypeError("content-type header is missing from object");return t}(e):e;if("string"!=typeof l)throw TypeError("argument string is required to be a string");var c=l.indexOf(";"),u=-1!==c?l.slice(0,c).trim():l.trim();if(!o.test(u))throw TypeError("invalid media type");var d=new a(u.toLowerCase());if(-1!==c){for(t.lastIndex=c;s=t.exec(l);){if(s.index!==c)throw TypeError("invalid parameter format");c+=s[0].length,i=s[1].toLowerCase(),34===(n=s[2]).charCodeAt(0)&&-1!==(n=n.slice(1,-1)).indexOf("\\")&&(n=n.replace(r,"$1")),d.parameters[i]=n}if(c!==l.length)throw TypeError("invalid parameter format")}return d}})(),1),l9=class{_buffer;_maxBufferSize;constructor(e){this._maxBufferSize=e?.maxBufferSize??0xa00000}append(e){if((this._buffer?.length??0)+e.length>this._maxBufferSize)throw this.clear(),Error(`ReadBuffer exceeded maximum size of ${this._maxBufferSize} bytes`);this._buffer=this._buffer?Buffer.concat([this._buffer,e]):e}readMessage(){for(;this._buffer;){let t=this._buffer.indexOf("\n");if(-1===t)break;let r=this._buffer.toString("utf8",0,t).replace(/\r$/,"");this._buffer=this._buffer.subarray(t+1);try{var e;return e=r,aW.parse(JSON.parse(e))}catch(e){if(e instanceof SyntaxError)continue;throw e}}return null}clear(){this._buffer=void 0}};function l4(e){return e?e instanceof Headers?Object.fromEntries(e.entries()):Array.isArray(e)?Object.fromEntries(e):{...e}:{}}var l5=T(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.regexpCode=e.getEsmExportName=e.getProperty=e.safeStringify=e.stringify=e.strConcat=e.addCodeArg=e.str=e._=e.nil=e._Code=e.Name=e.IDENTIFIER=e._CodeOrName=void 0;var t=class{};e._CodeOrName=t,e.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var r=class extends t{constructor(t){if(super(),!e.IDENTIFIER.test(t))throw Error("CodeGen: name must be a valid identifier");this.str=t}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};e.Name=r;var o=class extends t{constructor(e){super(),this._items="string"==typeof e?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return""===e||'""'===e}get str(){var e;return null!=(e=this._str)?e:this._str=this._items.reduce((e,t)=>`${e}${t}`,"")}get names(){var e;return null!=(e=this._names)?e:this._names=this._items.reduce((e,t)=>(t instanceof r&&(e[t.str]=(e[t.str]||0)+1),e),{})}};function a(e,...t){let r=[e[0]],i=0;for(;i<t.length;)n(r,t[i]),r.push(e[++i]);return new o(r)}e._Code=o,e.nil=new o(""),e._=a;let i=new o("+");function s(e,...t){let a=[l(e[0])],c=0;for(;c<t.length;)a.push(i),n(a,t[c]),a.push(i,l(e[++c]));return function(e){let t=1;for(;t<e.length-1;){if(e[t]===i){var o,a;let i=(o=e[t-1],'""'===(a=e[t+1])?o:'""'===o?a:"string"==typeof o?a instanceof r||'"'!==o[o.length-1]?void 0:"string"!=typeof a?`${o.slice(0,-1)}${a}"`:'"'===a[0]?o.slice(0,-1)+a.slice(1):void 0:"string"!=typeof a||'"'!==a[0]||o instanceof r?void 0:`"${o}${a.slice(1)}`);if(void 0!==i){e.splice(t-1,3,i);continue}e[t++]="+"}t++}}(a),new o(a)}function n(e,t){var a;t instanceof o?e.push(...t._items):t instanceof r?e.push(t):e.push("number"==typeof(a=t)||"boolean"==typeof a||null===a?a:l(Array.isArray(a)?a.join(","):a))}function l(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}e.str=s,e.addCodeArg=n,e.strConcat=function(e,t){return t.emptyStr()?e:e.emptyStr()?t:s`${e}${t}`},e.stringify=function(e){return new o(l(e))},e.safeStringify=l,e.getProperty=function(t){return"string"==typeof t&&e.IDENTIFIER.test(t)?new o(`.${t}`):a`[${t}]`},e.getEsmExportName=function(t){if("string"==typeof t&&e.IDENTIFIER.test(t))return new o(`${t}`);throw Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)},e.regexpCode=function(e){return new o(e.toString())}}),l3=T(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ValueScope=e.ValueScopeName=e.Scope=e.varKinds=e.UsedValueState=void 0;let t=l5();var r,o,a=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}};(r=o||(e.UsedValueState=o={}))[r.Started=0]="Started",r[r.Completed=1]="Completed",e.varKinds={const:new t.Name("const"),let:new t.Name("let"),var:new t.Name("var")};var i=class{constructor({prefixes:e,parent:t}={}){this._names={},this._prefixes=e,this._parent=t}toName(e){return e instanceof t.Name?e:this.name(e)}name(e){return new t.Name(this._newName(e))}_newName(e){let t=this._names[e]||this._nameGroup(e);return`${e}${t.index++}`}_nameGroup(e){var t,r;if((null==(r=null==(t=this._parent)?void 0:t._prefixes)?void 0:r.has(e))||this._prefixes&&!this._prefixes.has(e))throw Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}};e.Scope=i;var s=class extends t.Name{constructor(e,t){super(t),this.prefix=e}setValue(e,{property:r,itemIndex:o}){this.value=e,this.scopePath=(0,t._)`.${new t.Name(r)}[${o}]`}};e.ValueScopeName=s;let n=(0,t._)`\n`;var l=class extends i{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?n:t.nil}}get(){return this._scope}name(e){return new s(e,this._newName(e))}value(e,t){var r;if(void 0===t.ref)throw Error("CodeGen: ref must be passed in value");let o=this.toName(e),{prefix:a}=o,i=null!=(r=t.key)?r:t.ref,s=this._values[a];if(s){let e=s.get(i);if(e)return e}else s=this._values[a]=new Map;s.set(i,o);let n=this._scope[a]||(this._scope[a]=[]),l=n.length;return n[l]=t.ref,o.setValue(t,{property:a,itemIndex:l}),o}getValue(e,t){let r=this._values[e];if(r)return r.get(t)}scopeRefs(e,r=this._values){return this._reduceValues(r,r=>{if(void 0===r.scopePath)throw Error(`CodeGen: name "${r}" has no value`);return(0,t._)`${e}${r.scopePath}`})}scopeCode(e=this._values,t,r){return this._reduceValues(e,e=>{if(void 0===e.value)throw Error(`CodeGen: name "${e}" has no value`);return e.value.code},t,r)}_reduceValues(r,i,s={},n){let l=t.nil;for(let c in r){let u=r[c];if(!u)continue;let d=s[c]=s[c]||new Map;u.forEach(r=>{if(d.has(r))return;d.set(r,o.Started);let s=i(r);if(s){let o=this.opts.es5?e.varKinds.var:e.varKinds.const;l=(0,t._)`${l}${o} ${r} = ${s};${this.opts._n}`}else if(s=null==n?void 0:n(r))l=(0,t._)`${l}${s}${this.opts._n}`;else throw new a(r);d.set(r,o.Completed)})}return l}};e.ValueScope=l}),l6=T(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.or=e.and=e.not=e.CodeGen=e.operators=e.varKinds=e.ValueScopeName=e.ValueScope=e.Scope=e.Name=e.regexpCode=e.stringify=e.getProperty=e.nil=e.strConcat=e.str=e._=void 0;let t=l5(),r=l3();var o=l5();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return o._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return o.str}}),Object.defineProperty(e,"strConcat",{enumerable:!0,get:function(){return o.strConcat}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return o.nil}}),Object.defineProperty(e,"getProperty",{enumerable:!0,get:function(){return o.getProperty}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return o.stringify}}),Object.defineProperty(e,"regexpCode",{enumerable:!0,get:function(){return o.regexpCode}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return o.Name}});var a=l3();Object.defineProperty(e,"Scope",{enumerable:!0,get:function(){return a.Scope}}),Object.defineProperty(e,"ValueScope",{enumerable:!0,get:function(){return a.ValueScope}}),Object.defineProperty(e,"ValueScopeName",{enumerable:!0,get:function(){return a.ValueScopeName}}),Object.defineProperty(e,"varKinds",{enumerable:!0,get:function(){return a.varKinds}}),e.operators={GT:new t._Code(">"),GTE:new t._Code(">="),LT:new t._Code("<"),LTE:new t._Code("<="),EQ:new t._Code("==="),NEQ:new t._Code("!=="),NOT:new t._Code("!"),OR:new t._Code("||"),AND:new t._Code("&&"),ADD:new t._Code("+")};var i=class{optimizeNodes(){return this}optimizeNames(e,t){return this}},s=class extends i{constructor(e,t,r){super(),this.varKind=e,this.name=t,this.rhs=r}render({es5:e,_n:t}){let o=e?r.varKinds.var:this.varKind,a=void 0===this.rhs?"":` = ${this.rhs}`;return`${o} ${this.name}${a};`+t}optimizeNames(e,t){if(e[this.name.str])return this.rhs&&(this.rhs=C(this.rhs,e,t)),this}get names(){return this.rhs instanceof t._CodeOrName?this.rhs.names:{}}},n=class extends i{constructor(e,t,r){super(),this.lhs=e,this.rhs=t,this.sideEffects=r}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,r){if(!(this.lhs instanceof t.Name)||e[this.lhs.str]||this.sideEffects)return this.rhs=C(this.rhs,e,r),this}get names(){return T(this.lhs instanceof t.Name?{}:{...this.lhs.names},this.rhs)}},l=class extends n{constructor(e,t,r,o){super(e,r,o),this.op=t}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},c=class extends i{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},u=class extends i{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}},d=class extends i{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},p=class extends i{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,t){return this.code=C(this.code,e,t),this}get names(){return this.code instanceof t._CodeOrName?this.code.names:{}}},h=class extends i{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((t,r)=>t+r.render(e),"")}optimizeNodes(){let{nodes:e}=this,t=e.length;for(;t--;){let r=e[t].optimizeNodes();Array.isArray(r)?e.splice(t,1,...r):r?e[t]=r:e.splice(t,1)}return e.length>0?this:void 0}optimizeNames(e,t){let{nodes:r}=this,o=r.length;for(;o--;){let a=r[o];a.optimizeNames(e,t)||(function(e,t){for(let r in t)e[r]=(e[r]||0)-(t[r]||0)}(e,a.names),r.splice(o,1))}return r.length>0?this:void 0}get names(){return this.nodes.reduce((e,t)=>x(e,t.names),{})}},m=class extends h{render(e){return"{"+e._n+super.render(e)+"}"+e._n}},f=class extends h{},y=class extends m{};y.kind="else";var g=class e extends m{constructor(e,t){super(t),this.condition=e}render(e){let t=`if(${this.condition})`+super.render(e);return this.else&&(t+="else "+this.else.render(e)),t}optimizeNodes(){super.optimizeNodes();let t=this.condition;if(!0===t)return this.nodes;let r=this.else;if(r){let e=r.optimizeNodes();r=this.else=Array.isArray(e)?new y(e):e}return r?!1===t?r instanceof e?r:r.nodes:this.nodes.length?this:new e(O(t),r instanceof e?[r]:r.nodes):!1!==t&&this.nodes.length?this:void 0}optimizeNames(e,t){var r;if(this.else=null==(r=this.else)?void 0:r.optimizeNames(e,t),super.optimizeNames(e,t)||this.else)return this.condition=C(this.condition,e,t),this}get names(){let e=super.names;return T(e,this.condition),this.else&&x(e,this.else.names),e}};g.kind="if";var v=class extends m{};v.kind="for";var _=class extends v{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iteration=C(this.iteration,e,t),this}get names(){return x(super.names,this.iteration.names)}},b=class extends v{constructor(e,t,r,o){super(),this.varKind=e,this.name=t,this.from=r,this.to=o}render(e){let t=e.es5?r.varKinds.var:this.varKind,{name:o,from:a,to:i}=this;return`for(${t} ${o}=${a}; ${o}<${i}; ${o}++)`+super.render(e)}get names(){return T(T(super.names,this.from),this.to)}},S=class extends v{constructor(e,t,r,o){super(),this.loop=e,this.varKind=t,this.name=r,this.iterable=o}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iterable=C(this.iterable,e,t),this}get names(){return x(super.names,this.iterable.names)}},w=class extends m{constructor(e,t,r){super(),this.name=e,this.args=t,this.async=r}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}};w.kind="func";var $=class extends h{render(e){return"return "+super.render(e)}};$.kind="return";var R=class extends m{render(e){let t="try"+super.render(e);return this.catch&&(t+=this.catch.render(e)),this.finally&&(t+=this.finally.render(e)),t}optimizeNodes(){var e,t;return super.optimizeNodes(),null==(e=this.catch)||e.optimizeNodes(),null==(t=this.finally)||t.optimizeNodes(),this}optimizeNames(e,t){var r,o;return super.optimizeNames(e,t),null==(r=this.catch)||r.optimizeNames(e,t),null==(o=this.finally)||o.optimizeNames(e,t),this}get names(){let e=super.names;return this.catch&&x(e,this.catch.names),this.finally&&x(e,this.finally.names),e}},P=class extends m{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};P.kind="catch";var E=class extends m{render(e){return"finally"+super.render(e)}};E.kind="finally";var k=class{constructor(e,t={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...t,_n:t.lines?"\n":""},this._extScope=e,this._scope=new r.Scope({parent:e}),this._nodes=[new f]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,t){let r=this._extScope.value(e,t);return(this._values[r.prefix]||(this._values[r.prefix]=new Set)).add(r),r}getScopeValue(e,t){return this._extScope.getValue(e,t)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,t,r,o){let a=this._scope.toName(t);return void 0!==r&&o&&(this._constants[a.str]=r),this._leafNode(new s(e,a,r)),a}const(e,t,o){return this._def(r.varKinds.const,e,t,o)}let(e,t,o){return this._def(r.varKinds.let,e,t,o)}var(e,t,o){return this._def(r.varKinds.var,e,t,o)}assign(e,t,r){return this._leafNode(new n(e,t,r))}add(t,r){return this._leafNode(new l(t,e.operators.ADD,r))}code(e){return"function"==typeof e?e():e!==t.nil&&this._leafNode(new p(e)),this}object(...e){let r=["{"];for(let[o,a]of e)r.length>1&&r.push(","),r.push(o),(o!==a||this.opts.es5)&&(r.push(":"),(0,t.addCodeArg)(r,a));return r.push("}"),new t._Code(r)}if(e,t,r){if(this._blockNode(new g(e)),t&&r)this.code(t).else().code(r).endIf();else if(t)this.code(t).endIf();else if(r)throw Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new g(e))}else(){return this._elseNode(new y)}endIf(){return this._endBlockNode(g,y)}_for(e,t){return this._blockNode(e),t&&this.code(t).endFor(),this}for(e,t){return this._for(new _(e),t)}forRange(e,t,o,a,i=this.opts.es5?r.varKinds.var:r.varKinds.let){let s=this._scope.toName(e);return this._for(new b(i,s,t,o),()=>a(s))}forOf(e,o,a,i=r.varKinds.const){let s=this._scope.toName(e);if(this.opts.es5){let e=o instanceof t.Name?o:this.var("_arr",o);return this.forRange("_i",0,(0,t._)`${e}.length`,r=>{this.var(s,(0,t._)`${e}[${r}]`),a(s)})}return this._for(new S("of",i,s,o),()=>a(s))}forIn(e,o,a,i=this.opts.es5?r.varKinds.var:r.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,t._)`Object.keys(${o})`,a);let s=this._scope.toName(e);return this._for(new S("in",i,s,o),()=>a(s))}endFor(){return this._endBlockNode(v)}label(e){return this._leafNode(new c(e))}break(e){return this._leafNode(new u(e))}return(e){let t=new $;if(this._blockNode(t),this.code(e),1!==t.nodes.length)throw Error('CodeGen: "return" should have one node');return this._endBlockNode($)}try(e,t,r){if(!t&&!r)throw Error('CodeGen: "try" without "catch" and "finally"');let o=new R;if(this._blockNode(o),this.code(e),t){let e=this.name("e");this._currNode=o.catch=new P(e),t(e)}return r&&(this._currNode=o.finally=new E,this.code(r)),this._endBlockNode(P,E)}throw(e){return this._leafNode(new d(e))}block(e,t){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(t),this}endBlock(e){let t=this._blockStarts.pop();if(void 0===t)throw Error("CodeGen: not in self-balancing block");let r=this._nodes.length-t;if(r<0||void 0!==e&&r!==e)throw Error(`CodeGen: wrong number of nodes: ${r} vs ${e} expected`);return this._nodes.length=t,this}func(e,r=t.nil,o,a){return this._blockNode(new w(e,r,o)),a&&this.code(a).endFunc(),this}endFunc(){return this._endBlockNode(w)}optimize(e=1){for(;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,t){let r=this._currNode;if(r instanceof e||t&&r instanceof t)return this._nodes.pop(),this;throw Error(`CodeGen: not in block "${t?`${e.kind}/${t.kind}`:e.kind}"`)}_elseNode(e){let t=this._currNode;if(!(t instanceof g))throw Error('CodeGen: "else" without "if"');return this._currNode=t.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let t=this._nodes;t[t.length-1]=e}};function x(e,t){for(let r in t)e[r]=(e[r]||0)+(t[r]||0);return e}function T(e,r){return r instanceof t._CodeOrName?x(e,r.names):e}function C(e,r,o){var a;if(e instanceof t.Name)return i(e);if(!((a=e)instanceof t._Code&&a._items.some(e=>e instanceof t.Name&&1===r[e.str]&&void 0!==o[e.str])))return e;return new t._Code(e._items.reduce((e,r)=>(r instanceof t.Name&&(r=i(r)),r instanceof t._Code?e.push(...r._items):e.push(r),e),[]));function i(e){let t=o[e.str];return void 0===t||1!==r[e.str]?e:(delete r[e.str],t)}}function O(e){return"boolean"==typeof e||"number"==typeof e||null===e?!e:(0,t._)`!${A(e)}`}e.CodeGen=k,e.not=O;let j=N(e.operators.AND);e.and=function(...e){return e.reduce(j)};let I=N(e.operators.OR);function N(e){return(r,o)=>r===t.nil?o:o===t.nil?r:(0,t._)`${A(r)} ${e} ${A(o)}`}function A(e){return e instanceof t.Name?e:(0,t._)`(${e})`}e.or=function(...e){return e.reduce(I)}}),l8=T(e=>{var t,r;Object.defineProperty(e,"__esModule",{value:!0}),e.checkStrictMode=e.getErrorPath=e.Type=e.useFunc=e.setEvaluated=e.evaluatedPropsToName=e.mergeEvaluated=e.eachItem=e.unescapeJsonPointer=e.escapeJsonPointer=e.escapeFragment=e.unescapeFragment=e.schemaRefOrVal=e.schemaHasRulesButRef=e.schemaHasRules=e.checkUnknownRules=e.alwaysValidSchema=e.toHash=void 0;let o=l6(),a=l5();function i(e,t=e.schema){let{opts:r,self:o}=e;if(!r.strictSchema||"boolean"==typeof t)return;let a=o.RULES.keywords;for(let r in t)a[r]||h(e,`unknown keyword: "${r}"`)}function s(e,t){if("boolean"==typeof e)return!e;for(let r in e)if(t[r])return!0;return!1}function n(e){return"number"==typeof e?`${e}`:e.replace(/~/g,"~0").replace(/\//g,"~1")}function l(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function c({mergeNames:e,mergeToName:t,mergeValues:r,resultToName:a}){return(i,s,n,l)=>{let c=void 0===n?s:n instanceof o.Name?(s instanceof o.Name?e(i,s,n):t(i,s,n),n):s instanceof o.Name?(t(i,n,s),s):r(s,n);return l!==o.Name||c instanceof o.Name?c:a(i,c)}}function u(e,t){if(!0===t)return e.var("props",!0);let r=e.var("props",(0,o._)`{}`);return void 0!==t&&d(e,r,t),r}function d(e,t,r){Object.keys(r).forEach(r=>e.assign((0,o._)`${t}${(0,o.getProperty)(r)}`,!0))}e.toHash=function(e){let t={};for(let r of e)t[r]=!0;return t},e.alwaysValidSchema=function(e,t){return"boolean"==typeof t?t:0===Object.keys(t).length||(i(e,t),!s(t,e.self.RULES.all))},e.checkUnknownRules=i,e.schemaHasRules=s,e.schemaHasRulesButRef=function(e,t){if("boolean"==typeof e)return!e;for(let r in e)if("$ref"!==r&&t.all[r])return!0;return!1},e.schemaRefOrVal=function({topSchemaRef:e,schemaPath:t},r,a,i){if(!i){if("number"==typeof r||"boolean"==typeof r)return r;if("string"==typeof r)return(0,o._)`${r}`}return(0,o._)`${e}${t}${(0,o.getProperty)(a)}`},e.unescapeFragment=function(e){return l(decodeURIComponent(e))},e.escapeFragment=function(e){return encodeURIComponent(n(e))},e.escapeJsonPointer=n,e.unescapeJsonPointer=l,e.eachItem=function(e,t){if(Array.isArray(e))for(let r of e)t(r);else t(e)},e.mergeEvaluated={props:c({mergeNames:(e,t,r)=>e.if((0,o._)`${r} !== true && ${t} !== undefined`,()=>{e.if((0,o._)`${t} === true`,()=>e.assign(r,!0),()=>e.assign(r,(0,o._)`${r} || {}`).code((0,o._)`Object.assign(${r}, ${t})`))}),mergeToName:(e,t,r)=>e.if((0,o._)`${r} !== true`,()=>{!0===t?e.assign(r,!0):(e.assign(r,(0,o._)`${r} || {}`),d(e,r,t))}),mergeValues:(e,t)=>!0===e||{...e,...t},resultToName:u}),items:c({mergeNames:(e,t,r)=>e.if((0,o._)`${r} !== true && ${t} !== undefined`,()=>e.assign(r,(0,o._)`${t} === true ? true : ${r} > ${t} ? ${r} : ${t}`)),mergeToName:(e,t,r)=>e.if((0,o._)`${r} !== true`,()=>e.assign(r,!0===t||(0,o._)`${r} > ${t} ? ${r} : ${t}`)),mergeValues:(e,t)=>!0===e||Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})},e.evaluatedPropsToName=u,e.setEvaluated=d;let p={};function h(e,t,r=e.opts.strictSchema){if(r){if(t=`strict mode: ${t}`,!0===r)throw Error(t);e.self.logger.warn(t)}}e.useFunc=function(e,t){return e.scopeValue("func",{ref:t,code:p[t.code]||(p[t.code]=new a._Code(t.code))})},(r=t||(e.Type=t={}))[r.Num=0]="Num",r[r.Str=1]="Str",e.getErrorPath=function(e,r,a){if(e instanceof o.Name){let i=r===t.Num;return a?i?(0,o._)`"[" + ${e} + "]"`:(0,o._)`"['" + ${e} + "']"`:i?(0,o._)`"/" + ${e}`:(0,o._)`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return a?(0,o.getProperty)(e).toString():"/"+n(e)},e.checkStrictMode=h}),l7=T(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=l6();e.default={data:new t.Name("data"),valCxt:new t.Name("valCxt"),instancePath:new t.Name("instancePath"),parentData:new t.Name("parentData"),parentDataProperty:new t.Name("parentDataProperty"),rootData:new t.Name("rootData"),dynamicAnchors:new t.Name("dynamicAnchors"),vErrors:new t.Name("vErrors"),errors:new t.Name("errors"),this:new t.Name("this"),self:new t.Name("self"),scope:new t.Name("scope"),json:new t.Name("json"),jsonPos:new t.Name("jsonPos"),jsonLen:new t.Name("jsonLen"),jsonPart:new t.Name("jsonPart")}}),ce=T(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.extendErrors=e.resetErrorsCount=e.reportExtraError=e.reportError=e.keyword$DataError=e.keywordError=void 0;let t=l6(),r=l8(),o=l7();function a(e,r){let a=e.const("err",r);e.if((0,t._)`${o.default.vErrors} === null`,()=>e.assign(o.default.vErrors,(0,t._)`[${a}]`),(0,t._)`${o.default.vErrors}.push(${a})`),e.code((0,t._)`${o.default.errors}++`)}function i(e,r){let{gen:o,validateName:a,schemaEnv:i}=e;i.$async?o.throw((0,t._)`new ${e.ValidationError}(${r})`):(o.assign((0,t._)`${a}.errors`,r),o.return(!1))}e.keywordError={message:({keyword:e})=>(0,t.str)`must pass "${e}" keyword validation`},e.keyword$DataError={message:({keyword:e,schemaType:r})=>r?(0,t.str)`"${e}" keyword must be ${r} ($data)`:(0,t.str)`"${e}" keyword is invalid ($data)`},e.reportError=function(r,o=e.keywordError,s,l){let{it:c}=r,{gen:u,compositeRule:d,allErrors:p}=c,h=n(r,o,s);(null!=l?l:d||p)?a(u,h):i(c,(0,t._)`[${h}]`)},e.reportExtraError=function(t,r=e.keywordError,s){let{it:l}=t,{gen:c,compositeRule:u,allErrors:d}=l;a(c,n(t,r,s)),u||d||i(l,o.default.vErrors)},e.resetErrorsCount=function(e,r){e.assign(o.default.errors,r),e.if((0,t._)`${o.default.vErrors} !== null`,()=>e.if(r,()=>e.assign((0,t._)`${o.default.vErrors}.length`,r),()=>e.assign(o.default.vErrors,null)))},e.extendErrors=function({gen:e,keyword:r,schemaValue:a,data:i,errsCount:s,it:n}){if(void 0===s)throw Error("ajv implementation error");let l=e.name("err");e.forRange("i",s,o.default.errors,s=>{e.const(l,(0,t._)`${o.default.vErrors}[${s}]`),e.if((0,t._)`${l}.instancePath === undefined`,()=>e.assign((0,t._)`${l}.instancePath`,(0,t.strConcat)(o.default.instancePath,n.errorPath))),e.assign((0,t._)`${l}.schemaPath`,(0,t.str)`${n.errSchemaPath}/${r}`),n.opts.verbose&&(e.assign((0,t._)`${l}.schema`,a),e.assign((0,t._)`${l}.data`,i))})};let s={keyword:new t.Name("keyword"),schemaPath:new t.Name("schemaPath"),params:new t.Name("params"),propertyName:new t.Name("propertyName"),message:new t.Name("message"),schema:new t.Name("schema"),parentSchema:new t.Name("parentSchema")};function n(e,a,i){let{createErrors:n}=e.it;return!1===n?(0,t._)`{}`:function(e,a,i={}){let{gen:n,it:l}=e,c=[function({errorPath:e},{instancePath:a}){let i=a?(0,t.str)`${e}${(0,r.getErrorPath)(a,r.Type.Str)}`:e;return[o.default.instancePath,(0,t.strConcat)(o.default.instancePath,i)]}(l,i),function({keyword:e,it:{errSchemaPath:o}},{schemaPath:a,parentSchema:i}){let n=i?o:(0,t.str)`${o}/${e}`;return a&&(n=(0,t.str)`${n}${(0,r.getErrorPath)(a,r.Type.Str)}`),[s.schemaPath,n]}(e,i)];return function(e,{params:r,message:a},i){let{keyword:n,data:l,schemaValue:c,it:u}=e,{opts:d,propertyName:p,topSchemaRef:h,schemaPath:m}=u;i.push([s.keyword,n],[s.params,"function"==typeof r?r(e):r||(0,t._)`{}`]),d.messages&&i.push([s.message,"function"==typeof a?a(e):a]),d.verbose&&i.push([s.schema,c],[s.parentSchema,(0,t._)`${h}${m}`],[o.default.data,l]),p&&i.push([s.propertyName,p])}(e,a,c),n.object(...c)}(e,a,i)}}),ct=T(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.boolOrEmptySchema=e.topBoolOrEmptySchema=void 0;let t=ce(),r=l6(),o=l7(),a={message:"boolean schema is false"};function i(e,r){let{gen:o,data:i}=e;(0,t.reportError)({gen:o,keyword:"false schema",data:i,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e},a,void 0,r)}e.topBoolOrEmptySchema=function(e){let{gen:t,schema:a,validateName:s}=e;!1===a?i(e,!1):"object"==typeof a&&!0===a.$async?t.return(o.default.data):(t.assign((0,r._)`${s}.errors`,null),t.return(!0))},e.boolOrEmptySchema=function(e,t){let{gen:r,schema:o}=e;!1===o?(r.var(t,!1),i(e)):r.var(t,!0)}}),cr=T(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getRules=e.isJSONType=void 0;let t=new Set(["string","number","integer","boolean","null","object","array"]);e.isJSONType=function(e){return"string"==typeof e&&t.has(e)},e.getRules=function(){let e={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...e,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}}}),co=T(e=>{function t(e,t){return t.rules.some(t=>r(e,t))}function r(e,t){var r;return void 0!==e[t.keyword]||(null==(r=t.definition.implements)?void 0:r.some(t=>void 0!==e[t]))}Object.defineProperty(e,"__esModule",{value:!0}),e.shouldUseRule=e.shouldUseGroup=e.schemaHasRulesForType=void 0,e.schemaHasRulesForType=function({schema:e,self:r},o){let a=r.RULES.types[o];return a&&!0!==a&&t(e,a)},e.shouldUseGroup=t,e.shouldUseRule=r}),ca=T(e=>{var t,r;Object.defineProperty(e,"__esModule",{value:!0}),e.reportTypeError=e.checkDataTypes=e.checkDataType=e.coerceAndCheckDataType=e.getJSONTypes=e.getSchemaTypes=e.DataType=void 0;let o=cr(),a=co(),i=ce(),s=l6(),n=l8();function l(e){let t=Array.isArray(e)?e:e?[e]:[];if(t.every(o.isJSONType))return t;throw Error("type must be JSONType or JSONType[]: "+t.join(","))}(r=t||(e.DataType=t={}))[r.Correct=0]="Correct",r[r.Wrong=1]="Wrong",e.getSchemaTypes=function(e){let t=l(e.type);if(t.includes("null")){if(!1===e.nullable)throw Error("type: null contradicts nullable: false")}else{if(!t.length&&void 0!==e.nullable)throw Error('"nullable" cannot be used without "type"');!0===e.nullable&&t.push("null")}return t},e.getJSONTypes=l,e.coerceAndCheckDataType=function(e,r){var o,i;let{gen:n,data:l,opts:u}=e,p=(o=r,(i=u.coerceTypes)?o.filter(e=>c.has(e)||"array"===i&&"array"===e):[]),m=r.length>0&&!(0===p.length&&1===r.length&&(0,a.schemaHasRulesForType)(e,r[0]));if(m){let o=d(r,l,u.strictNumbers,t.Wrong);n.if(o,()=>{p.length?function(e,t,r){let{gen:o,data:a,opts:i}=e,n=o.let("dataType",(0,s._)`typeof ${a}`),l=o.let("coerced",(0,s._)`undefined`);for(let e of("array"===i.coerceTypes&&o.if((0,s._)`${n} == 'object' && Array.isArray(${a}) && ${a}.length == 1`,()=>o.assign(a,(0,s._)`${a}[0]`).assign(n,(0,s._)`typeof ${a}`).if(d(t,a,i.strictNumbers),()=>o.assign(l,a))),o.if((0,s._)`${l} !== undefined`),r))(c.has(e)||"array"===e&&"array"===i.coerceTypes)&&function(e){switch(e){case"string":o.elseIf((0,s._)`${n} == "number" || ${n} == "boolean"`).assign(l,(0,s._)`"" + ${a}`).elseIf((0,s._)`${a} === null`).assign(l,(0,s._)`""`);return;case"number":o.elseIf((0,s._)`${n} == "boolean" || ${a} === null
63
+ || (${n} == "string" && ${a} && ${a} == +${a})`).assign(l,(0,s._)`+${a}`);return;case"integer":o.elseIf((0,s._)`${n} === "boolean" || ${a} === null
64
+ || (${n} === "string" && ${a} && ${a} == +${a} && !(${a} % 1))`).assign(l,(0,s._)`+${a}`);return;case"boolean":o.elseIf((0,s._)`${a} === "false" || ${a} === 0 || ${a} === null`).assign(l,!1).elseIf((0,s._)`${a} === "true" || ${a} === 1`).assign(l,!0);return;case"null":o.elseIf((0,s._)`${a} === "" || ${a} === 0 || ${a} === false`),o.assign(l,null);return;case"array":o.elseIf((0,s._)`${n} === "string" || ${n} === "number"
65
+ || ${n} === "boolean" || ${a} === null`).assign(l,(0,s._)`[${a}]`)}}(e);o.else(),h(e),o.endIf(),o.if((0,s._)`${l} !== undefined`,()=>{o.assign(a,l),function({gen:e,parentData:t,parentDataProperty:r},o){e.if((0,s._)`${t} !== undefined`,()=>e.assign((0,s._)`${t}[${r}]`,o))}(e,l)})}(e,r,p):h(e)})}return m};let c=new Set(["string","number","integer","boolean","null"]);function u(e,r,o,a=t.Correct){let i,n=a===t.Correct?s.operators.EQ:s.operators.NEQ;switch(e){case"null":return(0,s._)`${r} ${n} null`;case"array":i=(0,s._)`Array.isArray(${r})`;break;case"object":i=(0,s._)`${r} && typeof ${r} == "object" && !Array.isArray(${r})`;break;case"integer":i=l((0,s._)`!(${r} % 1) && !isNaN(${r})`);break;case"number":i=l();break;default:return(0,s._)`typeof ${r} ${n} ${e}`}return a===t.Correct?i:(0,s.not)(i);function l(e=s.nil){return(0,s.and)((0,s._)`typeof ${r} == "number"`,e,o?(0,s._)`isFinite(${r})`:s.nil)}}function d(e,t,r,o){let a;if(1===e.length)return u(e[0],t,r,o);let i=(0,n.toHash)(e);if(i.array&&i.object){let e=(0,s._)`typeof ${t} != "object"`;a=i.null?e:(0,s._)`!${t} || ${e}`,delete i.null,delete i.array,delete i.object}else a=s.nil;for(let e in i.number&&delete i.integer,i)a=(0,s.and)(a,u(e,t,r,o));return a}e.checkDataType=u,e.checkDataTypes=d;let p={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>"string"==typeof e?(0,s._)`{type: ${e}}`:(0,s._)`{type: ${t}}`};function h(e){let t=function(e){let{gen:t,data:r,schema:o}=e,a=(0,n.schemaRefOrVal)(e,o,"type");return{gen:t,keyword:"type",data:r,schema:o.type,schemaCode:a,schemaValue:a,parentSchema:o,params:{},it:e}}(e);(0,i.reportError)(t,p)}e.reportTypeError=h}),ci=T(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.assignDefaults=void 0;let t=l6(),r=l8();function o(e,o,a){let{gen:i,compositeRule:s,data:n,opts:l}=e;if(void 0===a)return;let c=(0,t._)`${n}${(0,t.getProperty)(o)}`;if(s)return void(0,r.checkStrictMode)(e,`default is ignored for: ${c}`);let u=(0,t._)`${c} === undefined`;"empty"===l.useDefaults&&(u=(0,t._)`${u} || ${c} === null || ${c} === ""`),i.if(u,(0,t._)`${c} = ${(0,t.stringify)(a)}`)}e.assignDefaults=function(e,t){let{properties:r,items:a}=e.schema;if("object"===t&&r)for(let t in r)o(e,t,r[t].default);else"array"===t&&Array.isArray(a)&&a.forEach((t,r)=>o(e,r,t.default))}}),cs=T(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateUnion=e.validateArray=e.usePattern=e.callValidateCode=e.schemaProperties=e.allSchemaProperties=e.noPropertyInData=e.propertyInData=e.isOwnProperty=e.hasPropFunc=e.reportMissingProp=e.checkMissingProp=e.checkReportMissingProp=void 0;let t=l6(),r=l8(),o=l7(),a=l8();function i(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,t._)`Object.prototype.hasOwnProperty`})}function s(e,r,o){return(0,t._)`${i(e)}.call(${r}, ${o})`}function n(e,r,o,a){let i=(0,t._)`${r}${(0,t.getProperty)(o)} === undefined`;return a?(0,t.or)(i,(0,t.not)(s(e,r,o))):i}function l(e){return e?Object.keys(e).filter(e=>"__proto__"!==e):[]}e.checkReportMissingProp=function(e,r){let{gen:o,data:a,it:i}=e;o.if(n(o,a,r,i.opts.ownProperties),()=>{e.setParams({missingProperty:(0,t._)`${r}`},!0),e.error()})},e.checkMissingProp=function({gen:e,data:r,it:{opts:o}},a,i){return(0,t.or)(...a.map(a=>(0,t.and)(n(e,r,a,o.ownProperties),(0,t._)`${i} = ${a}`)))},e.reportMissingProp=function(e,t){e.setParams({missingProperty:t},!0),e.error()},e.hasPropFunc=i,e.isOwnProperty=s,e.propertyInData=function(e,r,o,a){let i=(0,t._)`${r}${(0,t.getProperty)(o)} !== undefined`;return a?(0,t._)`${i} && ${s(e,r,o)}`:i},e.noPropertyInData=n,e.allSchemaProperties=l,e.schemaProperties=function(e,t){return l(t).filter(o=>!(0,r.alwaysValidSchema)(e,t[o]))},e.callValidateCode=function({schemaCode:e,data:r,it:{gen:a,topSchemaRef:i,schemaPath:s,errorPath:n},it:l},c,u,d){let p=d?(0,t._)`${e}, ${r}, ${i}${s}`:r,h=[[o.default.instancePath,(0,t.strConcat)(o.default.instancePath,n)],[o.default.parentData,l.parentData],[o.default.parentDataProperty,l.parentDataProperty],[o.default.rootData,o.default.rootData]];l.opts.dynamicRef&&h.push([o.default.dynamicAnchors,o.default.dynamicAnchors]);let m=(0,t._)`${p}, ${a.object(...h)}`;return u!==t.nil?(0,t._)`${c}.call(${u}, ${m})`:(0,t._)`${c}(${m})`};let c=(0,t._)`new RegExp`;e.usePattern=function({gen:e,it:{opts:r}},o){let i=r.unicodeRegExp?"u":"",{regExp:s}=r.code,n=s(o,i);return e.scopeValue("pattern",{key:n.toString(),ref:n,code:(0,t._)`${"new RegExp"===s.code?c:(0,a.useFunc)(e,s)}(${o}, ${i})`})},e.validateArray=function(e){let{gen:o,data:a,keyword:i,it:s}=e,n=o.name("valid");if(s.allErrors){let e=o.let("valid",!0);return l(()=>o.assign(e,!1)),e}return o.var(n,!0),l(()=>o.break()),n;function l(s){let l=o.const("len",(0,t._)`${a}.length`);o.forRange("i",0,l,a=>{e.subschema({keyword:i,dataProp:a,dataPropType:r.Type.Num},n),o.if((0,t.not)(n),s)})}},e.validateUnion=function(e){let{gen:o,schema:a,keyword:i,it:s}=e;if(!Array.isArray(a))throw Error("ajv implementation error");if(a.some(e=>(0,r.alwaysValidSchema)(s,e))&&!s.opts.unevaluated)return;let n=o.let("valid",!1),l=o.name("_valid");o.block(()=>a.forEach((r,a)=>{let s=e.subschema({keyword:i,schemaProp:a,compositeRule:!0},l);o.assign(n,(0,t._)`${n} || ${l}`),e.mergeValidEvaluated(s,l)||o.if((0,t.not)(n))})),e.result(n,()=>e.reset(),()=>e.error(!0))}}),cn=T(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateKeywordUsage=e.validSchemaType=e.funcKeywordCode=e.macroKeywordCode=void 0;let t=l6(),r=l7(),o=cs(),a=ce();function i(e){let{gen:r,data:o,it:a}=e;r.if(a.parentData,()=>r.assign(o,(0,t._)`${a.parentData}[${a.parentDataProperty}]`))}function s(e,r,o){if(void 0===o)throw Error(`keyword "${r}" failed to compile`);return e.scopeValue("keyword","function"==typeof o?{ref:o}:{ref:o,code:(0,t.stringify)(o)})}e.macroKeywordCode=function(e,r){let{gen:o,keyword:a,schema:i,parentSchema:n,it:l}=e,c=r.macro.call(l.self,i,n,l),u=s(o,a,c);!1!==l.opts.validateSchema&&l.self.validateSchema(c,!0);let d=o.name("valid");e.subschema({schema:c,schemaPath:t.nil,errSchemaPath:`${l.errSchemaPath}/${a}`,topSchemaRef:u,compositeRule:!0},d),e.pass(d,()=>e.error(!0))},e.funcKeywordCode=function(e,n){var l;let{gen:c,keyword:u,schema:d,parentSchema:p,$data:h,it:m}=e;!function({schemaEnv:e},t){if(t.async&&!e.$async)throw Error("async keyword in sync schema")}(m,n);let f=s(c,u,!h&&n.compile?n.compile.call(m.self,d,p,m):n.validate),y=c.let("valid");function g(a=n.async?(0,t._)`await `:t.nil){let i=m.opts.passContext?r.default.this:r.default.self,s=!("compile"in n&&!h||!1===n.schema);c.assign(y,(0,t._)`${a}${(0,o.callValidateCode)(e,f,i,s)}`,n.modifying)}function v(e){var r;c.if((0,t.not)(null!=(r=n.valid)?r:y),e)}e.block$data(y,function(){if(!1===n.errors)g(),n.modifying&&i(e),v(()=>e.error());else{let o,s,l=n.async?(o=c.let("ruleErrs",null),c.try(()=>g((0,t._)`await `),e=>c.assign(y,!1).if((0,t._)`${e} instanceof ${m.ValidationError}`,()=>c.assign(o,(0,t._)`${e}.errors`),()=>c.throw(e))),o):(s=(0,t._)`${f}.errors`,c.assign(s,null),g(t.nil),s);n.modifying&&i(e),v(()=>(function(e,o){let{gen:i}=e;i.if((0,t._)`Array.isArray(${o})`,()=>{i.assign(r.default.vErrors,(0,t._)`${r.default.vErrors} === null ? ${o} : ${r.default.vErrors}.concat(${o})`).assign(r.default.errors,(0,t._)`${r.default.vErrors}.length`),(0,a.extendErrors)(e)},()=>e.error())})(e,l))}}),e.ok(null!=(l=n.valid)?l:y)},e.validSchemaType=function(e,t,r=!1){return!t.length||t.some(t=>"array"===t?Array.isArray(e):"object"===t?e&&"object"==typeof e&&!Array.isArray(e):typeof e==t||r&&void 0===e)},e.validateKeywordUsage=function({schema:e,opts:t,self:r,errSchemaPath:o},a,i){if(Array.isArray(a.keyword)?!a.keyword.includes(i):a.keyword!==i)throw Error("ajv implementation error");let s=a.dependencies;if(null==s?void 0:s.some(t=>!Object.prototype.hasOwnProperty.call(e,t)))throw Error(`parent schema must have dependencies of ${i}: ${s.join(",")}`);if(a.validateSchema&&!a.validateSchema(e[i])){let e=`keyword "${i}" value is invalid at path "${o}": `+r.errorsText(a.validateSchema.errors);if("log"===t.validateSchema)r.logger.error(e);else throw Error(e)}}}),cl=T(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.extendSubschemaMode=e.extendSubschemaData=e.getSubschema=void 0;let t=l6(),r=l8();e.getSubschema=function(e,{keyword:o,schemaProp:a,schema:i,schemaPath:s,errSchemaPath:n,topSchemaRef:l}){if(void 0!==o&&void 0!==i)throw Error('both "keyword" and "schema" passed, only one allowed');if(void 0!==o){let i=e.schema[o];return void 0===a?{schema:i,schemaPath:(0,t._)`${e.schemaPath}${(0,t.getProperty)(o)}`,errSchemaPath:`${e.errSchemaPath}/${o}`}:{schema:i[a],schemaPath:(0,t._)`${e.schemaPath}${(0,t.getProperty)(o)}${(0,t.getProperty)(a)}`,errSchemaPath:`${e.errSchemaPath}/${o}/${(0,r.escapeFragment)(a)}`}}if(void 0!==i){if(void 0===s||void 0===n||void 0===l)throw Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:i,schemaPath:s,topSchemaRef:l,errSchemaPath:n}}throw Error('either "keyword" or "schema" must be passed')},e.extendSubschemaData=function(e,o,{dataProp:a,dataPropType:i,data:s,dataTypes:n,propertyName:l}){if(void 0!==s&&void 0!==a)throw Error('both "data" and "dataProp" passed, only one allowed');let{gen:c}=o;if(void 0!==a){let{errorPath:s,dataPathArr:n,opts:l}=o;u(c.let("data",(0,t._)`${o.data}${(0,t.getProperty)(a)}`,!0)),e.errorPath=(0,t.str)`${s}${(0,r.getErrorPath)(a,i,l.jsPropertySyntax)}`,e.parentDataProperty=(0,t._)`${a}`,e.dataPathArr=[...n,e.parentDataProperty]}function u(t){e.data=t,e.dataLevel=o.dataLevel+1,e.dataTypes=[],o.definedProperties=new Set,e.parentData=o.data,e.dataNames=[...o.dataNames,t]}void 0!==s&&(u(s instanceof t.Name?s:c.let("data",s,!0)),void 0!==l&&(e.propertyName=l)),n&&(e.dataTypes=n)},e.extendSubschemaMode=function(e,{jtdDiscriminator:t,jtdMetadata:r,compositeRule:o,createErrors:a,allErrors:i}){void 0!==o&&(e.compositeRule=o),void 0!==a&&(e.createErrors=a),void 0!==i&&(e.allErrors=i),e.jtdDiscriminator=t,e.jtdMetadata=r}}),cc=T((e,t)=>{t.exports=function e(t,r){if(t===r)return!0;if(t&&r&&"object"==typeof t&&"object"==typeof r){if(t.constructor!==r.constructor)return!1;if(Array.isArray(t)){if((o=t.length)!=r.length)return!1;for(a=o;0!=a--;)if(!e(t[a],r[a]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if((o=(i=Object.keys(t)).length)!==Object.keys(r).length)return!1;for(a=o;0!=a--;)if(!Object.prototype.hasOwnProperty.call(r,i[a]))return!1;for(a=o;0!=a--;){var o,a,i,s=i[a];if(!e(t[s],r[s]))return!1}return!0}return t!=t&&r!=r}}),cu=T((e,t)=>{var r=t.exports=function(e,t,o){"function"==typeof t&&(o=t,t={});var a="function"==typeof(o=t.cb||o)?o:o.pre||function(){};!function e(t,o,a,i,s,n,l,c,u,d){if(i&&"object"==typeof i&&!Array.isArray(i)){for(var p in o(i,s,n,l,c,u,d),i){var h,m=i[p];if(Array.isArray(m)){if(p in r.arrayKeywords)for(var f=0;f<m.length;f++)e(t,o,a,m[f],s+"/"+p+"/"+f,n,s,p,i,f)}else if(p in r.propsKeywords){if(m&&"object"==typeof m)for(var y in m){e(t,o,a,m[y],s+"/"+p+"/"+(h=y).replace(/~/g,"~0").replace(/\//g,"~1"),n,s,p,i,y)}}else(p in r.keywords||t.allKeys&&!(p in r.skipKeywords))&&e(t,o,a,m,s+"/"+p,n,s,p,i)}a(i,s,n,l,c,u,d)}}(t,a,o.post||function(){},e,"",e)};r.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0},r.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},r.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},r.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}}),cd=T(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getSchemaRefs=e.resolveUrl=e.normalizeId=e._getFullPath=e.getFullPath=e.inlineRef=void 0;let t=l8(),r=cc(),o=cu(),a=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);e.inlineRef=function(e,r=!0){return"boolean"==typeof e||(!0===r?!function e(t){for(let r in t){if(i.has(r))return!0;let o=t[r];if(Array.isArray(o)&&o.some(e)||"object"==typeof o&&e(o))return!0}return!1}(e):!!r&&function e(r){let o=0;for(let i in r)if("$ref"===i||(o++,!a.has(i)&&("object"==typeof r[i]&&(0,t.eachItem)(r[i],t=>o+=e(t)),o===1/0)))return 1/0;return o}(e)<=r)};let i=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function s(e,t="",r){return!1!==r&&(t=c(t)),n(e,e.parse(t))}function n(e,t){return e.serialize(t).split("#")[0]+"#"}e.getFullPath=s,e._getFullPath=n;let l=/#\/?$/;function c(e){return e?e.replace(l,""):""}e.normalizeId=c,e.resolveUrl=function(e,t,r){return r=c(r),e.resolve(t,r)};let u=/^[a-z_][-a-z0-9._]*$/i;e.getSchemaRefs=function(e,t){if("boolean"==typeof e)return{};let{schemaId:a,uriResolver:i}=this.opts,n=c(e[a]||t),l={"":n},d=s(i,n,!1),p={},h=new Set;return o(e,{allKeys:!0},(e,t,r,o)=>{if(void 0===o)return;let i=d+t,s=l[o];function n(t){let r=this.opts.uriResolver.resolve;if(t=c(s?r(s,t):t),h.has(t))throw f(t);h.add(t);let o=this.refs[t];return"string"==typeof o&&(o=this.refs[o]),"object"==typeof o?m(e,o.schema,t):t!==c(i)&&("#"===t[0]?(m(e,p[t],t),p[t]=e):this.refs[t]=i),t}function y(e){if("string"==typeof e){if(!u.test(e))throw Error(`invalid anchor "${e}"`);n.call(this,`#${e}`)}}"string"==typeof e[a]&&(s=n.call(this,e[a])),y.call(this,e.$anchor),y.call(this,e.$dynamicAnchor),l[t]=s}),p;function m(e,t,o){if(void 0!==t&&!r(e,t))throw f(o)}function f(e){return Error(`reference "${e}" resolves to more than one schema`)}}}),cp=T(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getData=e.KeywordCxt=e.validateFunctionCode=void 0;let t=ct(),r=ca(),o=co(),a=ca(),i=ci(),s=cn(),n=cl(),l=l6(),c=l7(),u=cd(),d=l8(),p=ce();function h({gen:e,validateName:t,schema:r,schemaEnv:o,opts:a},i){var s;a.code.es5?e.func(t,(0,l._)`${c.default.data}, ${c.default.valCxt}`,o.$async,()=>{var t,o;e.code((0,l._)`"use strict"; ${m(r,a)}`),t=e,o=a,t.if(c.default.valCxt,()=>{t.var(c.default.instancePath,(0,l._)`${c.default.valCxt}.${c.default.instancePath}`),t.var(c.default.parentData,(0,l._)`${c.default.valCxt}.${c.default.parentData}`),t.var(c.default.parentDataProperty,(0,l._)`${c.default.valCxt}.${c.default.parentDataProperty}`),t.var(c.default.rootData,(0,l._)`${c.default.valCxt}.${c.default.rootData}`),o.dynamicRef&&t.var(c.default.dynamicAnchors,(0,l._)`${c.default.valCxt}.${c.default.dynamicAnchors}`)},()=>{t.var(c.default.instancePath,(0,l._)`""`),t.var(c.default.parentData,(0,l._)`undefined`),t.var(c.default.parentDataProperty,(0,l._)`undefined`),t.var(c.default.rootData,c.default.data),o.dynamicRef&&t.var(c.default.dynamicAnchors,(0,l._)`{}`)}),e.code(i)}):e.func(t,(0,l._)`${c.default.data}, ${(s=a,(0,l._)`{${c.default.instancePath}="", ${c.default.parentData}, ${c.default.parentDataProperty}, ${c.default.rootData}=${c.default.data}${s.dynamicRef?(0,l._)`, ${c.default.dynamicAnchors}={}`:l.nil}}={}`)}`,o.$async,()=>e.code(m(r,a)).code(i))}function m(e,t){let r="object"==typeof e&&e[t.schemaId];return r&&(t.code.source||t.code.process)?(0,l._)`/*# sourceURL=${r} */`:l.nil}function f({schema:e,self:t}){if("boolean"==typeof e)return!e;for(let r in e)if(t.RULES.all[r])return!0;return!1}function y(e){return"boolean"!=typeof e.schema}function g(e){(0,d.checkUnknownRules)(e),function(e){let{schema:t,errSchemaPath:r,opts:o,self:a}=e;t.$ref&&o.ignoreKeywordsWithRef&&(0,d.schemaHasRulesButRef)(t,a.RULES)&&a.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}(e)}function v(e,t){if(e.opts.jtd)return b(e,[],!1,t);let o=(0,r.getSchemaTypes)(e.schema);b(e,o,!(0,r.coerceAndCheckDataType)(e,o),t)}function _({gen:e,schemaEnv:t,schema:r,errSchemaPath:o,opts:a}){let i=r.$comment;if(!0===a.$comment)e.code((0,l._)`${c.default.self}.logger.log(${i})`);else if("function"==typeof a.$comment){let r=(0,l.str)`${o}/$comment`,a=e.scopeValue("root",{ref:t.root});e.code((0,l._)`${c.default.self}.opts.$comment(${i}, ${r}, ${a}.schema)`)}}function b(e,t,r,i){var s,n,u,p;let{gen:h,schema:m,data:f,allErrors:y,opts:g,self:v}=e,{RULES:_}=v;if(m.$ref&&(g.ignoreKeywordsWithRef||!(0,d.schemaHasRulesButRef)(m,_)))return void h.block(()=>P(e,"$ref",_.all.$ref.definition));function b(s){(0,o.shouldUseGroup)(m,s)&&(s.type?(h.if((0,a.checkDataType)(s.type,f,g.strictNumbers)),S(e,s),1===t.length&&t[0]===s.type&&r&&(h.else(),(0,a.reportTypeError)(e)),h.endIf()):S(e,s),y||h.if((0,l._)`${c.default.errors} === ${i||0}`))}g.jtd||(s=e,n=t,!s.schemaEnv.meta&&s.opts.strictTypes&&(function(e,t){if(t.length){if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach(t=>{w(e.dataTypes,t)||$(e,`type "${t}" not allowed by context "${e.dataTypes.join(",")}"`)}),function(e,t){let r=[];for(let o of e.dataTypes)w(t,o)?r.push(o):t.includes("integer")&&"number"===o&&r.push("integer");e.dataTypes=r}(e,t)}}(s,n),s.opts.allowUnionTypes||(u=s,(p=n).length>1&&!(2===p.length&&p.includes("null"))&&$(u,"use allowUnionTypes to allow union type keyword")),function(e,t){let r=e.self.RULES.all;for(let a in r){let i=r[a];if("object"==typeof i&&(0,o.shouldUseRule)(e.schema,i)){let{type:r}=i.definition;r.length&&!r.some(e=>{var r,o;return r=t,o=e,r.includes(o)||"number"===o&&r.includes("integer")})&&$(e,`missing type "${r.join(",")}" for keyword "${a}"`)}}}(s,s.dataTypes))),h.block(()=>{for(let e of _.rules)b(e);b(_.post)})}function S(e,t){let{gen:r,schema:a,opts:{useDefaults:s}}=e;s&&(0,i.assignDefaults)(e,t.type),r.block(()=>{for(let r of t.rules)(0,o.shouldUseRule)(a,r)&&P(e,r.keyword,r.definition,t.type)})}function w(e,t){return e.includes(t)||"integer"===t&&e.includes("number")}function $(e,t){let r=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${r}" (strictTypes)`,(0,d.checkStrictMode)(e,t,e.opts.strictTypes)}e.validateFunctionCode=function(e){y(e)&&(g(e),f(e))?function(e){let{schema:t,opts:r,gen:o}=e;h(e,()=>{r.$comment&&t.$comment&&_(e),function(e){let{schema:t,opts:r}=e;void 0!==t.default&&r.useDefaults&&r.strictSchema&&(0,d.checkStrictMode)(e,"default is ignored in the schema root")}(e),o.let(c.default.vErrors,null),o.let(c.default.errors,0),r.unevaluated&&function(e){let{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",(0,l._)`${r}.evaluated`),t.if((0,l._)`${e.evaluated}.dynamicProps`,()=>t.assign((0,l._)`${e.evaluated}.props`,(0,l._)`undefined`)),t.if((0,l._)`${e.evaluated}.dynamicItems`,()=>t.assign((0,l._)`${e.evaluated}.items`,(0,l._)`undefined`))}(e),v(e),function(e){let{gen:t,schemaEnv:r,validateName:o,ValidationError:a,opts:i}=e;r.$async?t.if((0,l._)`${c.default.errors} === 0`,()=>t.return(c.default.data),()=>t.throw((0,l._)`new ${a}(${c.default.vErrors})`)):(t.assign((0,l._)`${o}.errors`,c.default.vErrors),i.unevaluated&&function({gen:e,evaluated:t,props:r,items:o}){r instanceof l.Name&&e.assign((0,l._)`${t}.props`,r),o instanceof l.Name&&e.assign((0,l._)`${t}.items`,o)}(e),t.return((0,l._)`${c.default.errors} === 0`))}(e)})}(e):h(e,()=>(0,t.topBoolOrEmptySchema)(e))};var R=class{constructor(e,t,r){if((0,s.validateKeywordUsage)(e,t,r),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=r,this.data=e.data,this.schema=e.schema[r],this.$data=t.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,d.schemaRefOrVal)(e,this.schema,r,this.$data),this.schemaType=t.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=t,this.$data)this.schemaCode=e.gen.const("vSchema",x(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,s.validSchemaType)(this.schema,t.schemaType,t.allowUndefined))throw Error(`${r} value must be ${JSON.stringify(t.schemaType)}`);("code"in t?t.trackErrors:!1!==t.errors)&&(this.errsCount=e.gen.const("_errs",c.default.errors))}result(e,t,r){this.failResult((0,l.not)(e),t,r)}failResult(e,t,r){this.gen.if(e),r?r():this.error(),t?(this.gen.else(),t(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(e,t){this.failResult((0,l.not)(e),void 0,t)}fail(e){if(void 0===e){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(e),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);let{schemaCode:t}=this;this.fail((0,l._)`${t} !== undefined && (${(0,l.or)(this.invalid$data(),e)})`)}error(e,t,r){if(t){this.setParams(t),this._error(e,r),this.setParams({});return}this._error(e,r)}_error(e,t){(e?p.reportExtraError:p.reportError)(this,this.def.error,t)}$dataError(){(0,p.reportError)(this,this.def.$dataError||p.keyword$DataError)}reset(){if(void 0===this.errsCount)throw Error('add "trackErrors" to keyword definition');(0,p.resetErrorsCount)(this.gen,this.errsCount)}ok(e){this.allErrors||this.gen.if(e)}setParams(e,t){t?Object.assign(this.params,e):this.params=e}block$data(e,t,r=l.nil){this.gen.block(()=>{this.check$data(e,r),t()})}check$data(e=l.nil,t=l.nil){if(!this.$data)return;let{gen:r,schemaCode:o,schemaType:a,def:i}=this;r.if((0,l.or)((0,l._)`${o} === undefined`,t)),e!==l.nil&&r.assign(e,!0),(a.length||i.validateSchema)&&(r.elseIf(this.invalid$data()),this.$dataError(),e!==l.nil&&r.assign(e,!1)),r.else()}invalid$data(){let{gen:e,schemaCode:t,schemaType:r,def:o,it:i}=this;return(0,l.or)(function(){if(r.length){if(!(t instanceof l.Name))throw Error("ajv implementation error");let e=Array.isArray(r)?r:[r];return(0,l._)`${(0,a.checkDataTypes)(e,t,i.opts.strictNumbers,a.DataType.Wrong)}`}return l.nil}(),function(){if(o.validateSchema){let r=e.scopeValue("validate$data",{ref:o.validateSchema});return(0,l._)`!${r}(${t})`}return l.nil}())}subschema(e,r){let o=(0,n.getSubschema)(this.it,e);(0,n.extendSubschemaData)(o,this.it,e),(0,n.extendSubschemaMode)(o,e);let a={...this.it,...o,items:void 0,props:void 0};return!function(e,r){if(y(e)&&(g(e),f(e)))return function(e,t){var r;let o,{schema:a,gen:i,opts:s}=e;s.$comment&&a.$comment&&_(e),(o=(r=e).schema[r.opts.schemaId])&&(r.baseId=(0,u.resolveUrl)(r.opts.uriResolver,r.baseId,o)),function(e){if(e.schema.$async&&!e.schemaEnv.$async)throw Error("async schema in sync schema")}(e);let n=i.const("_errs",c.default.errors);v(e,n),i.var(t,(0,l._)`${n} === ${c.default.errors}`)}(e,r);(0,t.boolOrEmptySchema)(e,r)}(a,r),a}mergeEvaluated(e,t){let{it:r,gen:o}=this;r.opts.unevaluated&&(!0!==r.props&&void 0!==e.props&&(r.props=d.mergeEvaluated.props(o,e.props,r.props,t)),!0!==r.items&&void 0!==e.items&&(r.items=d.mergeEvaluated.items(o,e.items,r.items,t)))}mergeValidEvaluated(e,t){let{it:r,gen:o}=this;if(r.opts.unevaluated&&(!0!==r.props||!0!==r.items))return o.if(t,()=>this.mergeEvaluated(e,l.Name)),!0}};function P(e,t,r,o){let a=new R(e,r,t);"code"in r?r.code(a,o):a.$data&&r.validate?(0,s.funcKeywordCode)(a,r):"macro"in r?(0,s.macroKeywordCode)(a,r):(r.compile||r.validate)&&(0,s.funcKeywordCode)(a,r)}e.KeywordCxt=R;let E=/^\/(?:[^~]|~0|~1)*$/,k=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function x(e,{dataLevel:t,dataNames:r,dataPathArr:o}){let a,i;if(""===e)return c.default.rootData;if("/"===e[0]){if(!E.test(e))throw Error(`Invalid JSON-pointer: ${e}`);a=e,i=c.default.rootData}else{let s=k.exec(e);if(!s)throw Error(`Invalid JSON-pointer: ${e}`);let l=+s[1];if("#"===(a=s[2])){if(l>=t)throw Error(n("property/index",l));return o[t-l]}if(l>t)throw Error(n("data",l));if(i=r[t-l],!a)return i}let s=i;for(let e of a.split("/"))e&&(i=(0,l._)`${i}${(0,l.getProperty)((0,d.unescapeJsonPointer)(e))}`,s=(0,l._)`${s} && ${i}`);return s;function n(e,r){return`Cannot access ${e} ${r} levels up, current level is ${t}`}}e.getData=x}),ch=T(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=class extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}}}),cm=T(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=cd();e.default=class extends Error{constructor(e,r,o,a){super(a||`can't resolve reference ${o} from id ${r}`),this.missingRef=(0,t.resolveUrl)(e,r,o),this.missingSchema=(0,t.normalizeId)((0,t.getFullPath)(e,this.missingRef))}}}),cf=T(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.resolveSchema=e.getCompilingSchema=e.resolveRef=e.compileSchema=e.SchemaEnv=void 0;let t=l6(),r=ch(),o=l7(),a=cd(),i=l8(),s=cp();var n=class{constructor(e){var t;let r;this.refs={},this.dynamicAnchors={},"object"==typeof e.schema&&(r=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=null!=(t=e.baseId)?t:(0,a.normalizeId)(null==r?void 0:r[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=null==r?void 0:r.$async,this.refs={}}};function l(e){let i,n,l=u.call(this,e);if(l)return l;let c=(0,a.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:d,lines:p}=this.opts.code,{ownProperties:h}=this.opts,m=new t.CodeGen(this.scope,{es5:d,lines:p,ownProperties:h});e.$async&&(i=m.scopeValue("Error",{ref:r.default,code:(0,t._)`require("ajv/dist/runtime/validation_error").default`}));let f=m.scopeName("validate");e.validateName=f;let y={gen:m,allErrors:this.opts.allErrors,data:o.default.data,parentData:o.default.parentData,parentDataProperty:o.default.parentDataProperty,dataNames:[o.default.data],dataPathArr:[t.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:m.scopeValue("schema",!0===this.opts.code.source?{ref:e.schema,code:(0,t.stringify)(e.schema)}:{ref:e.schema}),validateName:f,ValidationError:i,schema:e.schema,schemaEnv:e,rootId:c,baseId:e.baseId||c,schemaPath:t.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,t._)`""`,opts:this.opts,self:this};try{this._compilations.add(e),(0,s.validateFunctionCode)(y),m.optimize(this.opts.code.optimize);let r=m.toString();n=`${m.scopeRefs(o.default.scope)}return ${r}`,this.opts.code.process&&(n=this.opts.code.process(n,e));let a=Function(`${o.default.self}`,`${o.default.scope}`,n)(this,this.scope.get());if(this.scope.value(f,{ref:a}),a.errors=null,a.schema=e.schema,a.schemaEnv=e,e.$async&&(a.$async=!0),!0===this.opts.code.source&&(a.source={validateName:f,validateCode:r,scopeValues:m._values}),this.opts.unevaluated){let{props:e,items:r}=y;a.evaluated={props:e instanceof t.Name?void 0:e,items:r instanceof t.Name?void 0:r,dynamicProps:e instanceof t.Name,dynamicItems:r instanceof t.Name},a.source&&(a.source.evaluated=(0,t.stringify)(a.evaluated))}return e.validate=a,e}catch(t){throw delete e.validate,delete e.validateName,n&&this.logger.error("Error compiling schema, function code:",n),t}finally{this._compilations.delete(e)}}function c(e){return(0,a.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:l.call(this,e)}function u(e){for(let o of this._compilations){var t,r;if(t=o,r=e,t.schema===r.schema&&t.root===r.root&&t.baseId===r.baseId)return o}}function d(e,t){let r;for(;"string"==typeof(r=this.refs[t]);)t=r;return r||this.schemas[t]||p.call(this,e,t)}function p(e,t){let r=this.opts.uriResolver.parse(t),o=(0,a._getFullPath)(this.opts.uriResolver,r),i=(0,a.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&o===i)return m.call(this,r,e);let s=(0,a.normalizeId)(o),c=this.refs[s]||this.schemas[s];if("string"==typeof c){let t=p.call(this,e,c);if("object"!=typeof(null==t?void 0:t.schema))return;return m.call(this,r,t)}if("object"==typeof(null==c?void 0:c.schema)){if(c.validate||l.call(this,c),s===(0,a.normalizeId)(t)){let{schema:t}=c,{schemaId:r}=this.opts,o=t[r];return o&&(i=(0,a.resolveUrl)(this.opts.uriResolver,i,o)),new n({schema:t,schemaId:r,root:e,baseId:i})}return m.call(this,r,c)}}e.SchemaEnv=n,e.compileSchema=l,e.resolveRef=function(e,t,r){var o;r=(0,a.resolveUrl)(this.opts.uriResolver,t,r);let i=e.refs[r];if(i)return i;let s=d.call(this,e,r);if(void 0===s){let a=null==(o=e.localRefs)?void 0:o[r],{schemaId:i}=this.opts;a&&(s=new n({schema:a,schemaId:i,root:e,baseId:t}))}if(void 0!==s)return e.refs[r]=c.call(this,s)},e.getCompilingSchema=u,e.resolveSchema=p;let h=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function m(e,{baseId:t,schema:r,root:o}){var s;let l;if((null==(s=e.fragment)?void 0:s[0])!=="/")return;for(let o of e.fragment.slice(1).split("/")){if("boolean"==typeof r)return;let e=r[(0,i.unescapeFragment)(o)];if(void 0===e)return;let s="object"==typeof(r=e)&&r[this.opts.schemaId];!h.has(o)&&s&&(t=(0,a.resolveUrl)(this.opts.uriResolver,t,s))}if("boolean"!=typeof r&&r.$ref&&!(0,i.schemaHasRulesButRef)(r,this.RULES)){let e=(0,a.resolveUrl)(this.opts.uriResolver,t,r.$ref);l=p.call(this,o,e)}let{schemaId:c}=this.opts;if((l=l||new n({schema:r,schemaId:c,root:o,baseId:t})).schema!==l.root.schema)return l}}),cy=T((e,t)=>{t.exports={$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON AnySchema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}}),cg=T((e,t)=>{let r=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),o=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);function a(e){let t="",r=0,o=0;for(o=0;o<e.length;o++)if(48!==(r=e[o].charCodeAt(0))){if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[o];break}for(o+=1;o<e.length;o++){if(!((r=e[o].charCodeAt(0))>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[o]}return t}let i=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function s(e){return e.length=0,!0}function n(e,t,r){if(e.length){let o=a(e);if(""===o)return r.error=!0,!1;t.push(o),e.length=0}return!0}function l(e){if(2>function(e,t){let r=0;for(let t=0;t<e.length;t++)":"===e[t]&&r++;return r}(e,":"))return{host:e,isIPV6:!1};let t=function(e){let t=0,r={error:!1,address:"",zone:""},o=[],i=[],l=!1,c=!1,u=n;for(let a=0;a<e.length;a++){let n=e[a];if("["!==n&&"]"!==n)if(":"===n){if(!0===l&&(c=!0),!u(i,o,r))break;if(++t>7){r.error=!0;break}a>0&&":"===e[a-1]&&(l=!0),o.push(":");continue}else if("%"===n){if(!u(i,o,r))break;u=s}else{i.push(n);continue}}return i.length&&(u===s?r.zone=i.join(""):c?o.push(i.join("")):o.push(a(i))),r.address=o.join(""),r}(e);if(t.error)return{host:e,isIPV6:!1};{let e=t.address,r=t.address;return t.zone&&(e+="%"+t.zone,r+="%25"+t.zone),{host:e,isIPV6:!0,escapedHost:r}}}t.exports={nonSimpleDomain:i,recomposeAuthority:function(e){let t=[];if(void 0!==e.userinfo&&(t.push(e.userinfo),t.push("@")),void 0!==e.host){let r=unescape(e.host);if(!o(r)){let t=l(r);r=!0===t.isIPV6?`[${t.escapedHost}]`:e.host}t.push(r)}return("number"==typeof e.port||"string"==typeof e.port)&&(t.push(":"),t.push(String(e.port))),t.length?t.join(""):void 0},normalizeComponentEncoding:function(e,t){let r=!0!==t?escape:unescape;return void 0!==e.scheme&&(e.scheme=r(e.scheme)),void 0!==e.userinfo&&(e.userinfo=r(e.userinfo)),void 0!==e.host&&(e.host=r(e.host)),void 0!==e.path&&(e.path=r(e.path)),void 0!==e.query&&(e.query=r(e.query)),void 0!==e.fragment&&(e.fragment=r(e.fragment)),e},removeDotSegments:function(e){let t=e,r=[],o=-1,a=0;for(;a=t.length;){if(1===a)if("."===t)break;else if("/"===t){r.push("/");break}else{r.push(t);break}if(2===a){if("."===t[0]){if("."===t[1])break;else if("/"===t[1]){t=t.slice(2);continue}}else if("/"===t[0]&&("."===t[1]||"/"===t[1])){r.push("/");break}}else if(3===a&&"/.."===t){0!==r.length&&r.pop(),r.push("/");break}if("."===t[0]){if("."===t[1]){if("/"===t[2]){t=t.slice(3);continue}}else if("/"===t[1]){t=t.slice(2);continue}}else if("/"===t[0]&&"."===t[1]){if("/"===t[2]){t=t.slice(2);continue}else if("."===t[2]&&"/"===t[3]){t=t.slice(3),0!==r.length&&r.pop();continue}}if(-1===(o=t.indexOf("/",1))){r.push(t);break}r.push(t.slice(0,o)),t=t.slice(o)}return r.join("")},isIPv4:o,isUUID:r,normalizeIPv6:l,stringArrayToHexStripped:a}}),cv=T((e,t)=>{let{isUUID:r}=cg(),o=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,a=["http","https","ws","wss","urn","urn:uuid"];function i(e){return!0===e.secure||!1!==e.secure&&!!e.scheme&&3===e.scheme.length&&("w"===e.scheme[0]||"W"===e.scheme[0])&&("s"===e.scheme[1]||"S"===e.scheme[1])&&("s"===e.scheme[2]||"S"===e.scheme[2])}function s(e){return e.host||(e.error=e.error||"HTTP URIs must have a host."),e}function n(e){let t="https"===String(e.scheme).toLowerCase();return(e.port===(t?443:80)||""===e.port)&&(e.port=void 0),e.path||(e.path="/"),e}let l={scheme:"http",domainHost:!0,parse:s,serialize:n},c={scheme:"https",domainHost:l.domainHost,parse:s,serialize:n},u={scheme:"ws",domainHost:!0,parse:function(e){return e.secure=i(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e},serialize:function(e){if((e.port===(i(e)?443:80)||""===e.port)&&(e.port=void 0),"boolean"==typeof e.secure&&(e.scheme=e.secure?"wss":"ws",e.secure=void 0),e.resourceName){let[t,r]=e.resourceName.split("?");e.path=t&&"/"!==t?t:void 0,e.query=r,e.resourceName=void 0}return e.fragment=void 0,e}},d={scheme:"wss",domainHost:u.domainHost,parse:u.parse,serialize:u.serialize},p={http:l,https:c,ws:u,wss:d,urn:{scheme:"urn",parse:function(e,t){if(!e.path)return e.error="URN can not be parsed",e;let r=e.path.match(o);if(r){let o=t.scheme||e.scheme||"urn";e.nid=r[1].toLowerCase(),e.nss=r[2];let a=h(`${o}:${t.nid||e.nid}`);e.path=void 0,a&&(e=a.parse(e,t))}else e.error=e.error||"URN can not be parsed.";return e},serialize:function(e,t){if(void 0===e.nid)throw Error("URN without nid cannot be serialized");let r=t.scheme||e.scheme||"urn",o=e.nid.toLowerCase(),a=h(`${r}:${t.nid||o}`);a&&(e=a.serialize(e,t));let i=e,s=e.nss;return i.path=`${o||t.nid}:${s}`,t.skipEscape=!0,i},skipNormalize:!0},"urn:uuid":{scheme:"urn:uuid",parse:function(e,t){return e.uuid=e.nss,e.nss=void 0,t.tolerant||e.uuid&&r(e.uuid)||(e.error=e.error||"UUID is not valid."),e},serialize:function(e){return e.nss=(e.uuid||"").toLowerCase(),e},skipNormalize:!0}};function h(e){return e&&(p[e]||p[e.toLowerCase()])||void 0}Object.setPrototypeOf(p,null),t.exports={wsIsSecure:i,SCHEMES:p,isValidSchemeName:function(e){return -1!==a.indexOf(e)},getSchemeHandler:h}}),c_=T((e,t)=>{let{normalizeIPv6:r,removeDotSegments:o,recomposeAuthority:a,normalizeComponentEncoding:i,isIPv4:s,nonSimpleDomain:n}=cg(),{SCHEMES:l,getSchemeHandler:c}=cv();function u(e,t,r,a){let i={};return a||(e=h(d(e,r),r),t=h(d(t,r),r)),!(r=r||{}).tolerant&&t.scheme?(i.scheme=t.scheme,i.userinfo=t.userinfo,i.host=t.host,i.port=t.port,i.path=o(t.path||""),i.query=t.query):(void 0!==t.userinfo||void 0!==t.host||void 0!==t.port?(i.userinfo=t.userinfo,i.host=t.host,i.port=t.port,i.path=o(t.path||""),i.query=t.query):(t.path?("/"===t.path[0]?i.path=o(t.path):(void 0===e.userinfo&&void 0===e.host&&void 0===e.port||e.path?e.path?i.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path:i.path=t.path:i.path="/"+t.path,i.path=o(i.path)),i.query=t.query):(i.path=e.path,void 0!==t.query?i.query=t.query:i.query=e.query),i.userinfo=e.userinfo,i.host=e.host,i.port=e.port),i.scheme=e.scheme),i.fragment=t.fragment,i}function d(e,t){let r={host:e.host,scheme:e.scheme,userinfo:e.userinfo,port:e.port,path:e.path,query:e.query,nid:e.nid,nss:e.nss,uuid:e.uuid,fragment:e.fragment,reference:e.reference,resourceName:e.resourceName,secure:e.secure,error:""},i=Object.assign({},t),s=[],n=c(i.scheme||r.scheme);n&&n.serialize&&n.serialize(r,i),void 0!==r.path&&(i.skipEscape?r.path=unescape(r.path):(r.path=escape(r.path),void 0!==r.scheme&&(r.path=r.path.split("%3A").join(":")))),"suffix"!==i.reference&&r.scheme&&s.push(r.scheme,":");let l=a(r);if(void 0!==l&&("suffix"!==i.reference&&s.push("//"),s.push(l),r.path&&"/"!==r.path[0]&&s.push("/")),void 0!==r.path){let e=r.path;i.absolutePath||n&&n.absolutePath||(e=o(e)),void 0===l&&"/"===e[0]&&"/"===e[1]&&(e="/%2F"+e.slice(2)),s.push(e)}return void 0!==r.query&&s.push("?",r.query),void 0!==r.fragment&&s.push("#",r.fragment),s.join("")}let p=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function h(e,t){let o=Object.assign({},t),a={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},i=!1;"suffix"===o.reference&&(e=o.scheme?o.scheme+":"+e:"//"+e);let l=e.match(p);if(l){if(a.scheme=l[1],a.userinfo=l[3],a.host=l[4],a.port=parseInt(l[5],10),a.path=l[6]||"",a.query=l[7],a.fragment=l[8],isNaN(a.port)&&(a.port=l[5]),a.host)if(!1===s(a.host)){let e=r(a.host);a.host=e.host.toLowerCase(),i=e.isIPV6}else i=!0;void 0!==a.scheme||void 0!==a.userinfo||void 0!==a.host||void 0!==a.port||void 0!==a.query||a.path?void 0===a.scheme?a.reference="relative":void 0===a.fragment?a.reference="absolute":a.reference="uri":a.reference="same-document",o.reference&&"suffix"!==o.reference&&o.reference!==a.reference&&(a.error=a.error||"URI is not a "+o.reference+" reference.");let t=c(o.scheme||a.scheme);if(!o.unicodeSupport&&(!t||!t.unicodeSupport)&&a.host&&(o.domainHost||t&&t.domainHost)&&!1===i&&n(a.host))try{a.host=URL.domainToASCII(a.host.toLowerCase())}catch(e){a.error=a.error||"Host's domain name can not be converted to ASCII: "+e}(!t||t&&!t.skipNormalize)&&(-1!==e.indexOf("%")&&(void 0!==a.scheme&&(a.scheme=unescape(a.scheme)),void 0!==a.host&&(a.host=unescape(a.host))),a.path&&(a.path=escape(unescape(a.path))),a.fragment&&(a.fragment=encodeURI(decodeURIComponent(a.fragment)))),t&&t.parse&&t.parse(a,o)}else a.error=a.error||"URI can not be parsed.";return a}let m={SCHEMES:l,normalize:function(e,t){return"string"==typeof e?e=d(h(e,t),t):"object"==typeof e&&(e=h(d(e,t),t)),e},resolve:function(e,t,r){let o=r?Object.assign({scheme:"null"},r):{scheme:"null"},a=u(h(e,o),h(t,o),o,!0);return o.skipEscape=!0,d(a,o)},resolveComponent:u,equal:function(e,t,r){return"string"==typeof e?e=d(i(h(e=unescape(e),r),!0),{...r,skipEscape:!0}):"object"==typeof e&&(e=d(i(e,!0),{...r,skipEscape:!0})),"string"==typeof t?t=d(i(h(t=unescape(t),r),!0),{...r,skipEscape:!0}):"object"==typeof t&&(t=d(i(t,!0),{...r,skipEscape:!0})),e.toLowerCase()===t.toLowerCase()},serialize:d,parse:h};t.exports=m,t.exports.default=m,t.exports.fastUri=m}),cb=T(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=c_();t.code='require("ajv/dist/runtime/uri").default',e.default=t}),cS=T(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=void 0;var t=cp();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return t.KeywordCxt}});var r=l6();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return r._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return r.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return r.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return r.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return r.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return r.CodeGen}});let o=ch(),a=cm(),i=cr(),s=cf(),n=l6(),l=cd(),c=ca(),u=l8(),d=cy(),p=cb(),h=(e,t)=>new RegExp(e,t);h.code="new RegExp";let m=["removeAdditional","useDefaults","coerceTypes"],f=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),y={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},g={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'};var v=class{constructor(e={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...function(e){var t,r,o,a,i,s,n,l,c,u,d,m,f,y,g,v,_,b,S,w,$,R,P,E,k;let x=e.strict,T=null==(t=e.code)?void 0:t.optimize,C=!0===T||void 0===T?1:T||0,O=null!=(o=null==(r=e.code)?void 0:r.regExp)?o:h,j=null!=(a=e.uriResolver)?a:p.default;return{strictSchema:null==(s=null!=(i=e.strictSchema)?i:x)||s,strictNumbers:null==(l=null!=(n=e.strictNumbers)?n:x)||l,strictTypes:null!=(u=null!=(c=e.strictTypes)?c:x)?u:"log",strictTuples:null!=(m=null!=(d=e.strictTuples)?d:x)?m:"log",strictRequired:null!=(y=null!=(f=e.strictRequired)?f:x)&&y,code:e.code?{...e.code,optimize:C,regExp:O}:{optimize:C,regExp:O},loopRequired:null!=(g=e.loopRequired)?g:200,loopEnum:null!=(v=e.loopEnum)?v:200,meta:null==(_=e.meta)||_,messages:null==(b=e.messages)||b,inlineRefs:null==(S=e.inlineRefs)||S,schemaId:null!=(w=e.schemaId)?w:"$id",addUsedSchema:null==($=e.addUsedSchema)||$,validateSchema:null==(R=e.validateSchema)||R,validateFormats:null==(P=e.validateFormats)||P,unicodeRegExp:null==(E=e.unicodeRegExp)||E,int32range:null==(k=e.int32range)||k,uriResolver:j}}(e)};const{es5:t,lines:r}=this.opts.code;this.scope=new n.ValueScope({scope:{},prefixes:f,es5:t,lines:r}),this.logger=function(e){if(!1===e)return P;if(void 0===e)return console;if(e.log&&e.warn&&e.error)return e;throw Error("logger must implement log, warn and error methods")}(e.logger);const o=e.validateFormats;e.validateFormats=!1,this.RULES=(0,i.getRules)(),_.call(this,y,e,"NOT SUPPORTED"),_.call(this,g,e,"DEPRECATED","warn"),this._metaOpts=R.call(this),e.formats&&w.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&$.call(this,e.keywords),"object"==typeof e.meta&&this.addMetaSchema(e.meta),S.call(this),e.validateFormats=o}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:t,schemaId:r}=this.opts,o=d;"id"===r&&((o={...d}).id=o.$id,delete o.$id),t&&e&&this.addMetaSchema(o,o[r],!1)}defaultMeta(){let{meta:e,schemaId:t}=this.opts;return this.opts.defaultMeta="object"==typeof e?e[t]||e:void 0}validate(e,t){let r;if("string"==typeof e){if(!(r=this.getSchema(e)))throw Error(`no schema with key or ref "${e}"`)}else r=this.compile(e);let o=r(t);return"$async"in r||(this.errors=r.errors),o}compile(e,t){let r=this._addSchema(e,t);return r.validate||this._compileSchemaEnv(r)}compileAsync(e,t){if("function"!=typeof this.opts.loadSchema)throw Error("options.loadSchema should be a function");let{loadSchema:r}=this.opts;return o.call(this,e,t);async function o(e,t){await i.call(this,e.$schema);let r=this._addSchema(e,t);return r.validate||s.call(this,r)}async function i(e){e&&!this.getSchema(e)&&await o.call(this,{$ref:e},!0)}async function s(e){try{return this._compileSchemaEnv(e)}catch(t){if(!(t instanceof a.default))throw t;return n.call(this,t),await l.call(this,t.missingSchema),s.call(this,e)}}function n({missingSchema:e,missingRef:t}){if(this.refs[e])throw Error(`AnySchema ${e} is loaded but ${t} cannot be resolved`)}async function l(e){let r=await c.call(this,e);this.refs[e]||await i.call(this,r.$schema),this.refs[e]||this.addSchema(r,e,t)}async function c(e){let t=this._loading[e];if(t)return t;try{return await (this._loading[e]=r(e))}finally{delete this._loading[e]}}}addSchema(e,t,r,o=this.opts.validateSchema){let a;if(Array.isArray(e)){for(let t of e)this.addSchema(t,void 0,r,o);return this}if("object"==typeof e){let{schemaId:t}=this.opts;if(void 0!==(a=e[t])&&"string"!=typeof a)throw Error(`schema ${t} must be string`)}return t=(0,l.normalizeId)(t||a),this._checkUnique(t),this.schemas[t]=this._addSchema(e,r,t,o,!0),this}addMetaSchema(e,t,r=this.opts.validateSchema){return this.addSchema(e,t,!0,r),this}validateSchema(e,t){let r;if("boolean"==typeof e)return!0;if(void 0!==(r=e.$schema)&&"string"!=typeof r)throw Error("$schema must be a string");if(!(r=r||this.opts.defaultMeta||this.defaultMeta()))return this.logger.warn("meta-schema not available"),this.errors=null,!0;let o=this.validate(r,e);if(!o&&t){let e="schema is invalid: "+this.errorsText();if("log"===this.opts.validateSchema)this.logger.error(e);else throw Error(e)}return o}getSchema(e){let t;for(;"string"==typeof(t=b.call(this,e));)e=t;if(void 0===t){let{schemaId:r}=this.opts,o=new s.SchemaEnv({schema:{},schemaId:r});if(!(t=s.resolveSchema.call(this,o,e)))return;this.refs[e]=t}return t.validate||this._compileSchemaEnv(t)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let t=b.call(this,e);return"object"==typeof t&&this._cache.delete(t.schema),delete this.schemas[e],delete this.refs[e],this}case"object":{this._cache.delete(e);let t=e[this.opts.schemaId];return t&&(t=(0,l.normalizeId)(t),delete this.schemas[t],delete this.refs[t]),this}default:throw Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(let t of e)this.addKeyword(t);return this}addKeyword(e,t){let r;if("string"==typeof e)r=e,"object"==typeof t&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),t.keyword=r);else if("object"==typeof e&&void 0===t){if(Array.isArray(r=(t=e).keyword)&&!r.length)throw Error("addKeywords: keyword must be string or non-empty array")}else throw Error("invalid addKeywords parameters");if(k.call(this,r,t),!t)return(0,u.eachItem)(r,e=>x.call(this,e)),this;C.call(this,t);let o={...t,type:(0,c.getJSONTypes)(t.type),schemaType:(0,c.getJSONTypes)(t.schemaType)};return(0,u.eachItem)(r,0===o.type.length?e=>x.call(this,e,o):e=>o.type.forEach(t=>x.call(this,e,o,t))),this}getKeyword(e){let t=this.RULES.all[e];return"object"==typeof t?t.definition:!!t}removeKeyword(e){let{RULES:t}=this;for(let r of(delete t.keywords[e],delete t.all[e],t.rules)){let t=r.rules.findIndex(t=>t.keyword===e);t>=0&&r.rules.splice(t,1)}return this}addFormat(e,t){return"string"==typeof t&&(t=new RegExp(t)),this.formats[e]=t,this}errorsText(e=this.errors,{separator:t=", ",dataVar:r="data"}={}){return e&&0!==e.length?e.map(e=>`${r}${e.instancePath} ${e.message}`).reduce((e,r)=>e+t+r):"No errors"}$dataMetaSchema(e,t){let r=this.RULES.all;for(let o of(e=JSON.parse(JSON.stringify(e)),t)){let t=o.split("/").slice(1),a=e;for(let e of t)a=a[e];for(let e in r){let t=r[e];if("object"!=typeof t)continue;let{$data:o}=t.definition,i=a[e];o&&i&&(a[e]=j(i))}}return e}_removeAllSchemas(e,t){for(let r in e){let o=e[r];(!t||t.test(r))&&("string"==typeof o?delete e[r]:o&&!o.meta&&(this._cache.delete(o.schema),delete e[r]))}}_addSchema(e,t,r,o=this.opts.validateSchema,a=this.opts.addUsedSchema){let i,{schemaId:n}=this.opts;if("object"==typeof e)i=e[n];else if(this.opts.jtd)throw Error("schema must be object");else if("boolean"!=typeof e)throw Error("schema must be object or boolean");let c=this._cache.get(e);if(void 0!==c)return c;r=(0,l.normalizeId)(i||r);let u=l.getSchemaRefs.call(this,e,r);return c=new s.SchemaEnv({schema:e,schemaId:n,meta:t,baseId:r,localRefs:u}),this._cache.set(c.schema,c),a&&!r.startsWith("#")&&(r&&this._checkUnique(r),this.refs[r]=c),o&&this.validateSchema(e,!0),c}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta?this._compileMetaSchema(e):s.compileSchema.call(this,e),!e.validate)throw Error("ajv implementation error");return e.validate}_compileMetaSchema(e){let t=this.opts;this.opts=this._metaOpts;try{s.compileSchema.call(this,e)}finally{this.opts=t}}};function _(e,t,r,o="error"){for(let a in e)a in t&&this.logger[o](`${r}: option ${a}. ${e[a]}`)}function b(e){return e=(0,l.normalizeId)(e),this.schemas[e]||this.refs[e]}function S(){let e=this.opts.schemas;if(e)if(Array.isArray(e))this.addSchema(e);else for(let t in e)this.addSchema(e[t],t)}function w(){for(let e in this.opts.formats){let t=this.opts.formats[e];t&&this.addFormat(e,t)}}function $(e){if(Array.isArray(e))return void this.addVocabulary(e);for(let t in this.logger.warn("keywords option as map is deprecated, pass array"),e){let r=e[t];r.keyword||(r.keyword=t),this.addKeyword(r)}}function R(){let e={...this.opts};for(let t of m)delete e[t];return e}v.ValidationError=o.default,v.MissingRefError=a.default,e.default=v;let P={log(){},warn(){},error(){}},E=/^[a-z_$][a-z0-9_$:-]*$/i;function k(e,t){let{RULES:r}=this;if((0,u.eachItem)(e,e=>{if(r.keywords[e])throw Error(`Keyword ${e} is already defined`);if(!E.test(e))throw Error(`Keyword ${e} has invalid name`)}),t&&t.$data&&!("code"in t||"validate"in t))throw Error('$data keyword must have "code" or "validate" function')}function x(e,t,r){var o;let a=null==t?void 0:t.post;if(r&&a)throw Error('keyword with "post" flag cannot have "type"');let{RULES:i}=this,s=a?i.post:i.rules.find(({type:e})=>e===r);if(s||(s={type:r,rules:[]},i.rules.push(s)),i.keywords[e]=!0,!t)return;let n={keyword:e,definition:{...t,type:(0,c.getJSONTypes)(t.type),schemaType:(0,c.getJSONTypes)(t.schemaType)}};t.before?T.call(this,s,n,t.before):s.rules.push(n),i.all[e]=n,null==(o=t.implements)||o.forEach(e=>this.addKeyword(e))}function T(e,t,r){let o=e.rules.findIndex(e=>e.keyword===r);o>=0?e.rules.splice(o,0,t):(e.rules.push(t),this.logger.warn(`rule ${r} is not defined`))}function C(e){let{metaSchema:t}=e;void 0!==t&&(e.$data&&this.opts.$data&&(t=j(t)),e.validateSchema=this.compile(t,!0))}let O={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function j(e){return{anyOf:[e,O]}}}),cw=T(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default={keyword:"id",code(){throw Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}}}),c$=T(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.callRef=e.getValidate=void 0;let t=cm(),r=cs(),o=l6(),a=l7(),i=cf(),s=l8();function n(e,t){let{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):(0,o._)`${r.scopeValue("wrapper",{ref:t})}.validate`}function l(e,t,i,n){let{gen:l,it:c}=e,{allErrors:u,schemaEnv:d,opts:p}=c,h=p.passContext?a.default.this:o.nil;function m(e){let t=(0,o._)`${e}.errors`;l.assign(a.default.vErrors,(0,o._)`${a.default.vErrors} === null ? ${t} : ${a.default.vErrors}.concat(${t})`),l.assign(a.default.errors,(0,o._)`${a.default.vErrors}.length`)}function f(e){var t;if(!c.opts.unevaluated)return;let r=null==(t=null==i?void 0:i.validate)?void 0:t.evaluated;if(!0!==c.props)if(r&&!r.dynamicProps)void 0!==r.props&&(c.props=s.mergeEvaluated.props(l,r.props,c.props));else{let t=l.var("props",(0,o._)`${e}.evaluated.props`);c.props=s.mergeEvaluated.props(l,t,c.props,o.Name)}if(!0!==c.items)if(r&&!r.dynamicItems)void 0!==r.items&&(c.items=s.mergeEvaluated.items(l,r.items,c.items));else{let t=l.var("items",(0,o._)`${e}.evaluated.items`);c.items=s.mergeEvaluated.items(l,t,c.items,o.Name)}}n?function(){if(!d.$async)throw Error("async schema referenced by sync schema");let a=l.let("valid");l.try(()=>{l.code((0,o._)`await ${(0,r.callValidateCode)(e,t,h)}`),f(t),u||l.assign(a,!0)},e=>{l.if((0,o._)`!(${e} instanceof ${c.ValidationError})`,()=>l.throw(e)),m(e),u||l.assign(a,!1)}),e.ok(a)}():e.result((0,r.callValidateCode)(e,t,h),()=>f(t),()=>m(t))}e.getValidate=n,e.callRef=l,e.default={keyword:"$ref",schemaType:"string",code(e){var r,a;let s,c,u,{gen:d,schema:p,it:h}=e,{baseId:m,schemaEnv:f,validateName:y,opts:g,self:v}=h,{root:_}=f;if(("#"===p||"#/"===p)&&m===_.baseId){if(f===_)return l(e,y,f,f.$async);let t=d.scopeValue("root",{ref:_});return l(e,(0,o._)`${t}.validate`,_,_.$async)}let b=i.resolveRef.call(v,_,m,p);if(void 0===b)throw new t.default(h.opts.uriResolver,m,p);return b instanceof i.SchemaEnv?void l(e,n(e,r=b),r,r.$async):(a=b,s=d.scopeValue("schema",!0===g.code.source?{ref:a,code:(0,o.stringify)(a)}:{ref:a}),c=d.name("valid"),u=e.subschema({schema:a,dataTypes:[],schemaPath:o.nil,topSchemaRef:s,errSchemaPath:p},c),void(e.mergeEvaluated(u),e.ok(c)))}}}),cR=T(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=cw(),r=c$();e.default=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",t.default,r.default]}),cP=T(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=l6(),r=t.operators,o={maximum:{okStr:"<=",ok:r.LTE,fail:r.GT},minimum:{okStr:">=",ok:r.GTE,fail:r.LT},exclusiveMaximum:{okStr:"<",ok:r.LT,fail:r.GTE},exclusiveMinimum:{okStr:">",ok:r.GT,fail:r.LTE}};e.default={keyword:Object.keys(o),type:"number",schemaType:"number",$data:!0,error:{message:({keyword:e,schemaCode:r})=>(0,t.str)`must be ${o[e].okStr} ${r}`,params:({keyword:e,schemaCode:r})=>(0,t._)`{comparison: ${o[e].okStr}, limit: ${r}}`},code(e){let{keyword:r,data:a,schemaCode:i}=e;e.fail$data((0,t._)`${a} ${o[r].fail} ${i} || isNaN(${a})`)}}}),cE=T(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=l6();e.default={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:{message:({schemaCode:e})=>(0,t.str)`must be multiple of ${e}`,params:({schemaCode:e})=>(0,t._)`{multipleOf: ${e}}`},code(e){let{gen:r,data:o,schemaCode:a,it:i}=e,s=i.opts.multipleOfPrecision,n=r.let("res"),l=s?(0,t._)`Math.abs(Math.round(${n}) - ${n}) > 1e-${s}`:(0,t._)`${n} !== parseInt(${n})`;e.fail$data((0,t._)`(${a} === 0 || (${n} = ${o}/${a}, ${l}))`)}}}),ck=T(e=>{function t(e){let t,r=e.length,o=0,a=0;for(;a<r;)o++,(t=e.charCodeAt(a++))>=55296&&t<=56319&&a<r&&(64512&(t=e.charCodeAt(a)))==56320&&a++;return o}Object.defineProperty(e,"__esModule",{value:!0}),e.default=t,t.code='require("ajv/dist/runtime/ucs2length").default'}),cx=T(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=l6(),r=l8(),o=ck();e.default={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:{message:({keyword:e,schemaCode:r})=>(0,t.str)`must NOT have ${"maxLength"===e?"more":"fewer"} than ${r} characters`,params:({schemaCode:e})=>(0,t._)`{limit: ${e}}`},code(e){let{keyword:a,data:i,schemaCode:s,it:n}=e,l="maxLength"===a?t.operators.GT:t.operators.LT,c=!1===n.opts.unicode?(0,t._)`${i}.length`:(0,t._)`${(0,r.useFunc)(e.gen,o.default)}(${i})`;e.fail$data((0,t._)`${c} ${l} ${s}`)}}}),cT=T(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=cs(),r=l8(),o=l6();e.default={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:{message:({schemaCode:e})=>(0,o.str)`must match pattern "${e}"`,params:({schemaCode:e})=>(0,o._)`{pattern: ${e}}`},code(e){let{gen:a,data:i,$data:s,schema:n,schemaCode:l,it:c}=e,u=c.opts.unicodeRegExp?"u":"";if(s){let{regExp:t}=c.opts.code,s="new RegExp"===t.code?(0,o._)`new RegExp`:(0,r.useFunc)(a,t),n=a.let("valid");a.try(()=>a.assign(n,(0,o._)`${s}(${l}, ${u}).test(${i})`),()=>a.assign(n,!1)),e.fail$data((0,o._)`!${n}`)}else{let r=(0,t.usePattern)(e,n);e.fail$data((0,o._)`!${r}.test(${i})`)}}}}),cC=T(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=l6();e.default={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:{message:({keyword:e,schemaCode:r})=>(0,t.str)`must NOT have ${"maxProperties"===e?"more":"fewer"} than ${r} properties`,params:({schemaCode:e})=>(0,t._)`{limit: ${e}}`},code(e){let{keyword:r,data:o,schemaCode:a}=e,i="maxProperties"===r?t.operators.GT:t.operators.LT;e.fail$data((0,t._)`Object.keys(${o}).length ${i} ${a}`)}}}),cO=T(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=cs(),r=l6(),o=l8();e.default={keyword:"required",type:"object",schemaType:"array",$data:!0,error:{message:({params:{missingProperty:e}})=>(0,r.str)`must have required property '${e}'`,params:({params:{missingProperty:e}})=>(0,r._)`{missingProperty: ${e}}`},code(e){let{gen:a,schema:i,schemaCode:s,data:n,$data:l,it:c}=e,{opts:u}=c;if(!l&&0===i.length)return;let d=i.length>=u.loopRequired;if(c.allErrors?function(){if(d||l)e.block$data(r.nil,p);else for(let r of i)(0,t.checkReportMissingProp)(e,r)}():function(){let o=a.let("missing");if(d||l){let i=a.let("valid",!0);e.block$data(i,()=>{var l,c;return l=o,c=i,void(e.setParams({missingProperty:l}),a.forOf(l,s,()=>{a.assign(c,(0,t.propertyInData)(a,n,l,u.ownProperties)),a.if((0,r.not)(c),()=>{e.error(),a.break()})},r.nil))}),e.ok(i)}else a.if((0,t.checkMissingProp)(e,i,o)),(0,t.reportMissingProp)(e,o),a.else()}(),u.strictRequired){let t=e.parentSchema.properties,{definedProperties:r}=e.it;for(let e of i)if((null==t?void 0:t[e])===void 0&&!r.has(e)){let t=`required property "${e}" is not defined at "${c.schemaEnv.baseId+c.errSchemaPath}" (strictRequired)`;(0,o.checkStrictMode)(c,t,c.opts.strictRequired)}}function p(){a.forOf("prop",s,r=>{e.setParams({missingProperty:r}),a.if((0,t.noPropertyInData)(a,n,r,u.ownProperties),()=>e.error())})}}}}),cj=T(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=l6();e.default={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:{message:({keyword:e,schemaCode:r})=>(0,t.str)`must NOT have ${"maxItems"===e?"more":"fewer"} than ${r} items`,params:({schemaCode:e})=>(0,t._)`{limit: ${e}}`},code(e){let{keyword:r,data:o,schemaCode:a}=e,i="maxItems"===r?t.operators.GT:t.operators.LT;e.fail$data((0,t._)`${o}.length ${i} ${a}`)}}}),cI=T(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=cc();t.code='require("ajv/dist/runtime/equal").default',e.default=t}),cN=T(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=ca(),r=l6(),o=l8(),a=cI();e.default={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:{message:({params:{i:e,j:t}})=>(0,r.str)`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>(0,r._)`{i: ${e}, j: ${t}}`},code(e){let{gen:i,data:s,$data:n,schema:l,parentSchema:c,schemaCode:u,it:d}=e;if(!n&&!l)return;let p=i.let("valid"),h=c.items?(0,t.getSchemaTypes)(c.items):[];e.block$data(p,function(){let n=i.let("i",(0,r._)`${s}.length`),l=i.let("j");e.setParams({i:n,j:l}),i.assign(p,!0),i.if((0,r._)`${n} > 1`,()=>(h.length>0&&!h.some(e=>"object"===e||"array"===e)?function(o,a){let n=i.name("item"),l=(0,t.checkDataTypes)(h,n,d.opts.strictNumbers,t.DataType.Wrong),c=i.const("indices",(0,r._)`{}`);i.for((0,r._)`;${o}--;`,()=>{i.let(n,(0,r._)`${s}[${o}]`),i.if(l,(0,r._)`continue`),h.length>1&&i.if((0,r._)`typeof ${n} == "string"`,(0,r._)`${n} += "_"`),i.if((0,r._)`typeof ${c}[${n}] == "number"`,()=>{i.assign(a,(0,r._)`${c}[${n}]`),e.error(),i.assign(p,!1).break()}).code((0,r._)`${c}[${n}] = ${o}`)})}:function(t,n){let l=(0,o.useFunc)(i,a.default),c=i.name("outer");i.label(c).for((0,r._)`;${t}--;`,()=>i.for((0,r._)`${n} = ${t}; ${n}--;`,()=>i.if((0,r._)`${l}(${s}[${t}], ${s}[${n}])`,()=>{e.error(),i.assign(p,!1).break(c)})))})(n,l))},(0,r._)`${u} === false`),e.ok(p)}}}),cA=T(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=l6(),r=l8(),o=cI();e.default={keyword:"const",$data:!0,error:{message:"must be equal to constant",params:({schemaCode:e})=>(0,t._)`{allowedValue: ${e}}`},code(e){let{gen:a,data:i,$data:s,schemaCode:n,schema:l}=e;s||l&&"object"==typeof l?e.fail$data((0,t._)`!${(0,r.useFunc)(a,o.default)}(${i}, ${n})`):e.fail((0,t._)`${l} !== ${i}`)}}}),cz=T(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=l6(),r=l8(),o=cI();e.default={keyword:"enum",schemaType:"array",$data:!0,error:{message:"must be equal to one of the allowed values",params:({schemaCode:e})=>(0,t._)`{allowedValues: ${e}}`},code(e){let a,i,{gen:s,data:n,$data:l,schema:c,schemaCode:u,it:d}=e;if(!l&&0===c.length)throw Error("enum must have non-empty array");let p=c.length>=d.opts.loopEnum,h=()=>null!=a?a:a=(0,r.useFunc)(s,o.default);if(p||l)i=s.let("valid"),e.block$data(i,function(){s.assign(i,!1),s.forOf("v",u,e=>s.if((0,t._)`${h()}(${n}, ${e})`,()=>s.assign(i,!0).break()))});else{if(!Array.isArray(c))throw Error("ajv implementation error");let e=s.const("vSchema",u);i=(0,t.or)(...c.map((r,o)=>{var a,i;let s;return a=e,"object"==typeof(s=c[i=o])&&null!==s?(0,t._)`${h()}(${n}, ${a}[${i}])`:(0,t._)`${n} === ${s}`}))}e.pass(i)}}}),cq=T(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=cP(),r=cE(),o=cx(),a=cT(),i=cC(),s=cO(),n=cj(),l=cN(),c=cA(),u=cz();e.default=[t.default,r.default,o.default,a.default,i.default,s.default,n.default,l.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},c.default,u.default]}),cM=T(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateAdditionalItems=void 0;let t=l6(),r=l8();function o(e,o){let{gen:a,schema:i,data:s,keyword:n,it:l}=e;l.items=!0;let c=a.const("len",(0,t._)`${s}.length`);if(!1===i)e.setParams({len:o.length}),e.pass((0,t._)`${c} <= ${o.length}`);else if("object"==typeof i&&!(0,r.alwaysValidSchema)(l,i)){let i=a.var("valid",(0,t._)`${c} <= ${o.length}`);a.if((0,t.not)(i),()=>{var s;return s=i,void a.forRange("i",o.length,c,o=>{e.subschema({keyword:n,dataProp:o,dataPropType:r.Type.Num},s),l.allErrors||a.if((0,t.not)(s),()=>a.break())})}),e.ok(i)}}e.validateAdditionalItems=o,e.default={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:{message:({params:{len:e}})=>(0,t.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,t._)`{limit: ${e}}`},code(e){let{parentSchema:t,it:a}=e,{items:i}=t;Array.isArray(i)?o(e,i):(0,r.checkStrictMode)(a,'"additionalItems" is ignored when "items" is not an array of schemas')}}}),cL=T(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateTuple=void 0;let t=l6(),r=l8(),o=cs();function a(e,o,i=e.schema){let{gen:s,parentSchema:n,data:l,keyword:c,it:u}=e;(function(e){let{opts:t,errSchemaPath:a}=u,s=i.length,n=s===e.minItems&&(s===e.maxItems||!1===e[o]);if(t.strictTuples&&!n){let e=`"${c}" is ${s}-tuple, but minItems or maxItems/${o} are not specified or different at path "${a}"`;(0,r.checkStrictMode)(u,e,t.strictTuples)}})(n),u.opts.unevaluated&&i.length&&!0!==u.items&&(u.items=r.mergeEvaluated.items(s,i.length,u.items));let d=s.name("valid"),p=s.const("len",(0,t._)`${l}.length`);i.forEach((o,a)=>{(0,r.alwaysValidSchema)(u,o)||(s.if((0,t._)`${p} > ${a}`,()=>e.subschema({keyword:c,schemaProp:a,dataProp:a},d)),e.ok(d))})}e.validateTuple=a,e.default={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){let{schema:t,it:i}=e;if(Array.isArray(t))return a(e,"additionalItems",t);i.items=!0,(0,r.alwaysValidSchema)(i,t)||e.ok((0,o.validateArray)(e))}}}),cU=T(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=cL();e.default={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:e=>(0,t.validateTuple)(e,"items")}}),cD=T(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=l6(),r=l8(),o=cs(),a=cM();e.default={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:{message:({params:{len:e}})=>(0,t.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,t._)`{limit: ${e}}`},code(e){let{schema:t,parentSchema:i,it:s}=e,{prefixItems:n}=i;s.items=!0,(0,r.alwaysValidSchema)(s,t)||(n?(0,a.validateAdditionalItems)(e,n):e.ok((0,o.validateArray)(e)))}}}),cV=T(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=l6(),r=l8();e.default={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:{message:({params:{min:e,max:r}})=>void 0===r?(0,t.str)`must contain at least ${e} valid item(s)`:(0,t.str)`must contain at least ${e} and no more than ${r} valid item(s)`,params:({params:{min:e,max:r}})=>void 0===r?(0,t._)`{minContains: ${e}}`:(0,t._)`{minContains: ${e}, maxContains: ${r}}`},code(e){let o,a,{gen:i,schema:s,parentSchema:n,data:l,it:c}=e,{minContains:u,maxContains:d}=n;c.opts.next?(o=void 0===u?1:u,a=d):o=1;let p=i.const("len",(0,t._)`${l}.length`);if(e.setParams({min:o,max:a}),void 0===a&&0===o)return void(0,r.checkStrictMode)(c,'"minContains" == 0 without "maxContains": "contains" keyword ignored');if(void 0!==a&&o>a){(0,r.checkStrictMode)(c,'"minContains" > "maxContains" is always invalid'),e.fail();return}if((0,r.alwaysValidSchema)(c,s)){let r=(0,t._)`${p} >= ${o}`;void 0!==a&&(r=(0,t._)`${r} && ${p} <= ${a}`),e.pass(r);return}c.items=!0;let h=i.name("valid");function m(){let e=i.name("_valid"),r=i.let("count",0);f(e,()=>i.if(e,()=>{var e;return e=r,void(i.code((0,t._)`${e}++`),void 0===a?i.if((0,t._)`${e} >= ${o}`,()=>i.assign(h,!0).break()):(i.if((0,t._)`${e} > ${a}`,()=>i.assign(h,!1).break()),1===o?i.assign(h,!0):i.if((0,t._)`${e} >= ${o}`,()=>i.assign(h,!0))))}))}function f(t,o){i.forRange("i",0,p,a=>{e.subschema({keyword:"contains",dataProp:a,dataPropType:r.Type.Num,compositeRule:!0},t),o()})}void 0===a&&1===o?f(h,()=>i.if(h,()=>i.break())):0===o?(i.let(h,!0),void 0!==a&&i.if((0,t._)`${l}.length > 0`,m)):(i.let(h,!1),m()),e.result(h,()=>e.reset())}}}),cH=T(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateSchemaDeps=e.validatePropertyDeps=e.error=void 0;let t=l6(),r=l8(),o=cs();e.error={message:({params:{property:e,depsCount:r,deps:o}})=>(0,t.str)`must have ${1===r?"property":"properties"} ${o} when property ${e} is present`,params:({params:{property:e,depsCount:r,deps:o,missingProperty:a}})=>(0,t._)`{property: ${e},
66
+ missingProperty: ${a},
67
+ depsCount: ${r},
68
+ deps: ${o}}`};let a={keyword:"dependencies",type:"object",schemaType:"object",error:e.error,code(e){let[t,r]=function({schema:e}){let t={},r={};for(let o in e)"__proto__"!==o&&((Array.isArray(e[o])?t:r)[o]=e[o]);return[t,r]}(e);i(e,t),s(e,r)}};function i(e,r=e.schema){let{gen:a,data:s,it:n}=e;if(0===Object.keys(r).length)return;let l=a.let("missing");for(let i in r){let c=r[i];if(0===c.length)continue;let u=(0,o.propertyInData)(a,s,i,n.opts.ownProperties);e.setParams({property:i,depsCount:c.length,deps:c.join(", ")}),n.allErrors?a.if(u,()=>{for(let t of c)(0,o.checkReportMissingProp)(e,t)}):(a.if((0,t._)`${u} && (${(0,o.checkMissingProp)(e,c,l)})`),(0,o.reportMissingProp)(e,l),a.else())}}function s(e,t=e.schema){let{gen:a,data:i,keyword:n,it:l}=e,c=a.name("valid");for(let s in t)(0,r.alwaysValidSchema)(l,t[s])||(a.if((0,o.propertyInData)(a,i,s,l.opts.ownProperties),()=>{let t=e.subschema({keyword:n,schemaProp:s},c);e.mergeValidEvaluated(t,c)},()=>a.var(c,!0)),e.ok(c))}e.validatePropertyDeps=i,e.validateSchemaDeps=s,e.default=a}),cF=T(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=l6(),r=l8();e.default={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:{message:"property name must be valid",params:({params:e})=>(0,t._)`{propertyName: ${e.propertyName}}`},code(e){let{gen:o,schema:a,data:i,it:s}=e;if((0,r.alwaysValidSchema)(s,a))return;let n=o.name("valid");o.forIn("key",i,r=>{e.setParams({propertyName:r}),e.subschema({keyword:"propertyNames",data:r,dataTypes:["string"],propertyName:r,compositeRule:!0},n),o.if((0,t.not)(n),()=>{e.error(!0),s.allErrors||o.break()})}),e.ok(n)}}}),cK=T(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=cs(),r=l6(),o=l7(),a=l8();e.default={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:{message:"must NOT have additional properties",params:({params:e})=>(0,r._)`{additionalProperty: ${e.additionalProperty}}`},code(e){let{gen:i,schema:s,parentSchema:n,data:l,errsCount:c,it:u}=e;if(!c)throw Error("ajv implementation error");let{allErrors:d,opts:p}=u;if(u.props=!0,"all"!==p.removeAdditional&&(0,a.alwaysValidSchema)(u,s))return;let h=(0,t.allSchemaProperties)(n.properties),m=(0,t.allSchemaProperties)(n.patternProperties);function f(e){i.code((0,r._)`delete ${l}[${e}]`)}function y(t){if("all"===p.removeAdditional||p.removeAdditional&&!1===s)return void f(t);if(!1===s){e.setParams({additionalProperty:t}),e.error(),d||i.break();return}if("object"==typeof s&&!(0,a.alwaysValidSchema)(u,s)){let o=i.name("valid");"failing"===p.removeAdditional?(g(t,o,!1),i.if((0,r.not)(o),()=>{e.reset(),f(t)})):(g(t,o),d||i.if((0,r.not)(o),()=>i.break()))}}function g(t,r,o){let i={keyword:"additionalProperties",dataProp:t,dataPropType:a.Type.Str};!1===o&&Object.assign(i,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(i,r)}i.forIn("key",l,o=>{h.length||m.length?i.if(function(o){let s;if(h.length>8){let e=(0,a.schemaRefOrVal)(u,n.properties,"properties");s=(0,t.isOwnProperty)(i,e,o)}else s=h.length?(0,r.or)(...h.map(e=>(0,r._)`${o} === ${e}`)):r.nil;return m.length&&(s=(0,r.or)(s,...m.map(a=>(0,r._)`${(0,t.usePattern)(e,a)}.test(${o})`))),(0,r.not)(s)}(o),()=>y(o)):y(o)}),e.ok((0,r._)`${c} === ${o.default.errors}`)}}}),cJ=T(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=cp(),r=cs(),o=l8(),a=cK();e.default={keyword:"properties",type:"object",schemaType:"object",code(e){let{gen:i,schema:s,parentSchema:n,data:l,it:c}=e;"all"===c.opts.removeAdditional&&void 0===n.additionalProperties&&a.default.code(new t.KeywordCxt(c,a.default,"additionalProperties"));let u=(0,r.allSchemaProperties)(s);for(let e of u)c.definedProperties.add(e);c.opts.unevaluated&&u.length&&!0!==c.props&&(c.props=o.mergeEvaluated.props(i,(0,o.toHash)(u),c.props));let d=u.filter(e=>!(0,o.alwaysValidSchema)(c,s[e]));if(0===d.length)return;let p=i.name("valid");for(let t of d){var h;(h=t,c.opts.useDefaults&&!c.compositeRule&&void 0!==s[h].default)?m(t):(i.if((0,r.propertyInData)(i,l,t,c.opts.ownProperties)),m(t),c.allErrors||i.else().var(p,!0),i.endIf()),e.it.definedProperties.add(t),e.ok(p)}function m(t){e.subschema({keyword:"properties",schemaProp:t,dataProp:t},p)}}}}),cZ=T(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=cs(),r=l6(),o=l8(),a=l8();e.default={keyword:"patternProperties",type:"object",schemaType:"object",code(e){let{gen:i,schema:s,data:n,parentSchema:l,it:c}=e,{opts:u}=c,d=(0,t.allSchemaProperties)(s),p=d.filter(e=>(0,o.alwaysValidSchema)(c,s[e]));if(0===d.length||p.length===d.length&&(!c.opts.unevaluated||!0===c.props))return;let h=u.strictSchema&&!u.allowMatchingProperties&&l.properties,m=i.name("valid");!0===c.props||c.props instanceof r.Name||(c.props=(0,a.evaluatedPropsToName)(i,c.props));let{props:f}=c;for(let e of d)h&&function(e){for(let t in h)new RegExp(e).test(t)&&(0,o.checkStrictMode)(c,`property ${t} matches pattern ${e} (use allowMatchingProperties)`)}(e),c.allErrors?y(e):(i.var(m,!0),y(e),i.if(m));function y(o){i.forIn("key",n,s=>{i.if((0,r._)`${(0,t.usePattern)(e,o)}.test(${s})`,()=>{let t=p.includes(o);t||e.subschema({keyword:"patternProperties",schemaProp:o,dataProp:s,dataPropType:a.Type.Str},m),c.opts.unevaluated&&!0!==f?i.assign((0,r._)`${f}[${s}]`,!0):t||c.allErrors||i.if((0,r.not)(m),()=>i.break())})})}}}}),cW=T(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=l8();e.default={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){let{gen:r,schema:o,it:a}=e;if((0,t.alwaysValidSchema)(a,o))return void e.fail();let i=r.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},i),e.failResult(i,()=>e.reset(),()=>e.error())},error:{message:"must NOT be valid"}}}),cB=T(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:cs().validateUnion,error:{message:"must match a schema in anyOf"}}}),cG=T(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=l6(),r=l8();e.default={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:{message:"must match exactly one schema in oneOf",params:({params:e})=>(0,t._)`{passingSchemas: ${e.passing}}`},code(e){let{gen:o,schema:a,parentSchema:i,it:s}=e;if(!Array.isArray(a))throw Error("ajv implementation error");if(s.opts.discriminator&&i.discriminator)return;let n=o.let("valid",!1),l=o.let("passing",null),c=o.name("_valid");e.setParams({passing:l}),o.block(function(){a.forEach((a,i)=>{let u;(0,r.alwaysValidSchema)(s,a)?o.var(c,!0):u=e.subschema({keyword:"oneOf",schemaProp:i,compositeRule:!0},c),i>0&&o.if((0,t._)`${c} && ${n}`).assign(n,!1).assign(l,(0,t._)`[${l}, ${i}]`).else(),o.if(c,()=>{o.assign(n,!0),o.assign(l,i),u&&e.mergeEvaluated(u,t.Name)})})}),e.result(n,()=>e.reset(),()=>e.error(!0))}}}),cX=T(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=l8();e.default={keyword:"allOf",schemaType:"array",code(e){let{gen:r,schema:o,it:a}=e;if(!Array.isArray(o))throw Error("ajv implementation error");let i=r.name("valid");o.forEach((r,o)=>{if((0,t.alwaysValidSchema)(a,r))return;let s=e.subschema({keyword:"allOf",schemaProp:o},i);e.ok(i),e.mergeEvaluated(s)})}}}),cY=T(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=l6(),r=l8();function o(e,t){let o=e.schema[t];return void 0!==o&&!(0,r.alwaysValidSchema)(e,o)}e.default={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:{message:({params:e})=>(0,t.str)`must match "${e.ifClause}" schema`,params:({params:e})=>(0,t._)`{failingKeyword: ${e.ifClause}}`},code(e){let a,{gen:i,parentSchema:s,it:n}=e;void 0===s.then&&void 0===s.else&&(0,r.checkStrictMode)(n,'"if" without "then" and "else" is ignored');let l=o(n,"then"),c=o(n,"else");if(!l&&!c)return;let u=i.let("valid",!0),d=i.name("_valid");if(a=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},d),e.mergeEvaluated(a),e.reset(),l&&c){let t=i.let("ifClause");e.setParams({ifClause:t}),i.if(d,p("then",t),p("else",t))}else l?i.if(d,p("then")):i.if((0,t.not)(d),p("else"));function p(r,o){return()=>{let a=e.subschema({keyword:r},d);i.assign(u,d),e.mergeValidEvaluated(a,u),o?i.assign(o,(0,t._)`${r}`):e.setParams({ifClause:r})}}e.pass(u,()=>e.error(!0))}}}),cQ=T(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=l8();e.default={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:r,it:o}){void 0===r.if&&(0,t.checkStrictMode)(o,`"${e}" without "if" is ignored`)}}}),c0=T(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=cM(),r=cU(),o=cL(),a=cD(),i=cV(),s=cH(),n=cF(),l=cK(),c=cJ(),u=cZ(),d=cW(),p=cB(),h=cG(),m=cX(),f=cY(),y=cQ();e.default=function(e=!1){let g=[d.default,p.default,h.default,m.default,f.default,y.default,n.default,l.default,s.default,c.default,u.default];return e?g.push(r.default,a.default):g.push(t.default,o.default),g.push(i.default),g}}),c1=T(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=l6();e.default={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:{message:({schemaCode:e})=>(0,t.str)`must match format "${e}"`,params:({schemaCode:e})=>(0,t._)`{format: ${e}}`},code(e,r){let o,a,i,s,n,l,{gen:c,data:u,$data:d,schema:p,schemaCode:h,it:m}=e,{opts:f,errSchemaPath:y,schemaEnv:g,self:v}=m;f.validateFormats&&(d?(o=c.scopeValue("formats",{ref:v.formats,code:f.code.formats}),a=c.const("fDef",(0,t._)`${o}[${h}]`),i=c.let("fType"),s=c.let("format"),c.if((0,t._)`typeof ${a} == "object" && !(${a} instanceof RegExp)`,()=>c.assign(i,(0,t._)`${a}.type || "string"`).assign(s,(0,t._)`${a}.validate`),()=>c.assign(i,(0,t._)`"string"`).assign(s,a)),e.fail$data((0,t.or)(!1===f.strictSchema?t.nil:(0,t._)`${h} && !${s}`,(n=g.$async?(0,t._)`(${a}.async ? await ${s}(${u}) : ${s}(${u}))`:(0,t._)`${s}(${u})`,l=(0,t._)`(typeof ${s} == "function" ? ${n} : ${s}.test(${u}))`,(0,t._)`${s} && ${s} !== true && ${i} === ${r} && !${l}`)))):function(){var o;let a,i,s=v.formats[p];if(!s){if(!1===f.strictSchema)return v.logger.warn(n());throw Error(n());function n(){return`unknown format "${p}" ignored in schema at path "${y}"`}}if(!0===s)return;let[l,d,h]=(a=(o=s)instanceof RegExp?(0,t.regexpCode)(o):f.code.formats?(0,t._)`${f.code.formats}${(0,t.getProperty)(p)}`:void 0,i=c.scopeValue("formats",{key:p,ref:o,code:a}),"object"!=typeof o||o instanceof RegExp?["string",o,i]:[o.type||"string",o.validate,(0,t._)`${i}.validate`]);l===r&&e.pass(function(){if("object"==typeof s&&!(s instanceof RegExp)&&s.async){if(!g.$async)throw Error("async format in sync schema");return(0,t._)`await ${h}(${u})`}return"function"==typeof d?(0,t._)`${h}(${u})`:(0,t._)`${h}.test(${u})`}())}())}}}),c2=T(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=[c1().default]}),c9=T(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.contentVocabulary=e.metadataVocabulary=void 0,e.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"],e.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]}),c4=T(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=cR(),r=cq(),o=c0(),a=c2(),i=c9();e.default=[t.default,r.default,(0,o.default)(),a.default,i.metadataVocabulary,i.contentVocabulary]}),c5=T(e=>{var t,r;Object.defineProperty(e,"__esModule",{value:!0}),e.DiscrError=void 0,(r=t||(e.DiscrError=t={})).Tag="tag",r.Mapping="mapping"}),c3=T(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=l6(),r=c5(),o=cf(),a=cm(),i=l8();e.default={keyword:"discriminator",type:"object",schemaType:"object",error:{message:({params:{discrError:e,tagName:t}})=>e===r.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:r,tagName:o}})=>(0,t._)`{error: ${e}, tag: ${o}, tagValue: ${r}}`},code(e){let{gen:s,data:n,schema:l,parentSchema:c,it:u}=e,{oneOf:d}=c;if(!u.opts.discriminator)throw Error("discriminator: requires discriminator option");let p=l.propertyName;if("string"!=typeof p)throw Error("discriminator: requires propertyName");if(l.mapping)throw Error("discriminator: mapping is not supported");if(!d)throw Error("discriminator: requires oneOf keyword");let h=s.let("valid",!1),m=s.const("tag",(0,t._)`${n}${(0,t.getProperty)(p)}`);s.if((0,t._)`typeof ${m} == "string"`,()=>(function(){let n=function(){var e;let t={},r=n(c),s=!0;for(let t=0;t<d.length;t++){let c=d[t];if((null==c?void 0:c.$ref)&&!(0,i.schemaHasRulesButRef)(c,u.self.RULES)){let e=c.$ref;if((c=o.resolveRef.call(u.self,u.schemaEnv.root,u.baseId,e))instanceof o.SchemaEnv&&(c=c.schema),void 0===c)throw new a.default(u.opts.uriResolver,u.baseId,e)}let h=null==(e=null==c?void 0:c.properties)?void 0:e[p];if("object"!=typeof h)throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${p}"`);s=s&&(r||n(c)),function(e,t){if(e.const)l(e.const,t);else if(e.enum)for(let r of e.enum)l(r,t);else throw Error(`discriminator: "properties/${p}" must have "const" or "enum"`)}(h,t)}if(!s)throw Error(`discriminator: "${p}" must be required`);return t;function n({required:e}){return Array.isArray(e)&&e.includes(p)}function l(e,r){if("string"!=typeof e||e in t)throw Error(`discriminator: "${p}" values must be unique strings`);t[e]=r}}();for(let r in s.if(!1),n)s.elseIf((0,t._)`${m} === ${r}`),s.assign(h,function(r){let o=s.name("valid"),a=e.subschema({keyword:"oneOf",schemaProp:r},o);return e.mergeEvaluated(a,t.Name),o}(n[r]));s.else(),e.error(!1,{discrError:r.DiscrError.Mapping,tag:m,tagName:p}),s.endIf()})(),()=>e.error(!1,{discrError:r.DiscrError.Tag,tag:m,tagName:p})),e.ok(h)}}}),c6=T((e,t)=>{t.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{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:[]}},type:["object","boolean"],properties:{$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:"#"}},default:!0}}),c8=T((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MissingRefError=e.ValidationError=e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=e.Ajv=void 0;let r=cS(),o=c4(),a=c3(),i=c6(),s=["/properties"],n="http://json-schema.org/draft-07/schema";var l=class extends r.default{_addVocabularies(){super._addVocabularies(),o.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(a.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(i,s):i;this.addMetaSchema(e,n,!1),this.refs["http://json-schema.org/schema"]=n}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(n)?n:void 0)}};e.Ajv=l,t.exports=e=l,t.exports.Ajv=l,Object.defineProperty(e,"__esModule",{value:!0}),e.default=l;var c=cp();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return c.KeywordCxt}});var u=l6();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return u._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return u.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return u.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return u.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return u.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return u.CodeGen}});var d=ch();Object.defineProperty(e,"ValidationError",{enumerable:!0,get:function(){return d.default}});var p=cm();Object.defineProperty(e,"MissingRefError",{enumerable:!0,get:function(){return p.default}})}),c7=T(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.dynamicAnchor=void 0;let t=l6(),r=l7(),o=cf(),a=c$();function i(e,i){let{gen:s,it:n}=e;n.schemaEnv.root.dynamicAnchors[i]=!0;let l=(0,t._)`${r.default.dynamicAnchors}${(0,t.getProperty)(i)}`,c="#"===n.errSchemaPath?n.validateName:function(e){let{schemaEnv:t,schema:r,self:i}=e.it,{root:s,baseId:n,localRefs:l,meta:c}=t.root,{schemaId:u}=i.opts,d=new o.SchemaEnv({schema:r,schemaId:u,root:s,baseId:n,localRefs:l,meta:c});return o.compileSchema.call(i,d),(0,a.getValidate)(e,d)}(e);s.if((0,t._)`!${l}`,()=>s.assign(l,c))}e.dynamicAnchor=i,e.default={keyword:"$dynamicAnchor",schemaType:"string",code:e=>i(e,e.schema)}}),ue=T(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.dynamicRef=void 0;let t=l6(),r=l7(),o=c$();function a(e,a){let{gen:i,keyword:s,it:n}=e;if("#"!==a[0])throw Error(`"${s}" only supports hash fragment reference`);let l=a.slice(1);if(n.allErrors)c();else{let t=i.let("valid",!1);c(t),e.ok(t)}function c(e){if(n.schemaEnv.root.dynamicAnchors[l]){let o=i.let("_v",(0,t._)`${r.default.dynamicAnchors}${(0,t.getProperty)(l)}`);i.if(o,u(o,e),u(n.validateName,e))}else u(n.validateName,e)()}function u(t,r){return r?()=>i.block(()=>{(0,o.callRef)(e,t),i.let(r,!0)}):()=>(0,o.callRef)(e,t)}}e.dynamicRef=a,e.default={keyword:"$dynamicRef",schemaType:"string",code:e=>a(e,e.schema)}}),ut=T(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=c7(),r=l8();e.default={keyword:"$recursiveAnchor",schemaType:"boolean",code(e){e.schema?(0,t.dynamicAnchor)(e,""):(0,r.checkStrictMode)(e.it,"$recursiveAnchor: false is ignored")}}}),ur=T(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=ue();e.default={keyword:"$recursiveRef",schemaType:"string",code:e=>(0,t.dynamicRef)(e,e.schema)}}),uo=T(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=c7(),r=ue(),o=ut(),a=ur();e.default=[t.default,r.default,o.default,a.default]}),ua=T(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=cH();e.default={keyword:"dependentRequired",type:"object",schemaType:"object",error:t.error,code:e=>(0,t.validatePropertyDeps)(e)}}),ui=T(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=cH();e.default={keyword:"dependentSchemas",type:"object",schemaType:"object",code:e=>(0,t.validateSchemaDeps)(e)}}),us=T(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=l8();e.default={keyword:["maxContains","minContains"],type:"array",schemaType:"number",code({keyword:e,parentSchema:r,it:o}){void 0===r.contains&&(0,t.checkStrictMode)(o,`"${e}" without "contains" is ignored`)}}}),un=T(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=ua(),r=ui(),o=us();e.default=[t.default,r.default,o.default]}),ul=T(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=l6(),r=l8(),o=l7();e.default={keyword:"unevaluatedProperties",type:"object",schemaType:["boolean","object"],trackErrors:!0,error:{message:"must NOT have unevaluated properties",params:({params:e})=>(0,t._)`{unevaluatedProperty: ${e.unevaluatedProperty}}`},code(e){let{gen:a,schema:i,data:s,errsCount:n,it:l}=e;if(!n)throw Error("ajv implementation error");let{allErrors:c,props:u}=l;function d(o){if(!1===i){e.setParams({unevaluatedProperty:o}),e.error(),c||a.break();return}if(!(0,r.alwaysValidSchema)(l,i)){let i=a.name("valid");e.subschema({keyword:"unevaluatedProperties",dataProp:o,dataPropType:r.Type.Str},i),c||a.if((0,t.not)(i),()=>a.break())}}u instanceof t.Name?a.if((0,t._)`${u} !== true`,()=>a.forIn("key",s,e=>{var r,o;return a.if((r=u,o=e,(0,t._)`!${r} || !${r}[${o}]`),()=>d(e))})):!0!==u&&a.forIn("key",s,e=>void 0===u?d(e):a.if(function(e,r){let o=[];for(let a in e)!0===e[a]&&o.push((0,t._)`${r} !== ${a}`);return(0,t.and)(...o)}(u,e),()=>d(e))),l.props=!0,e.ok((0,t._)`${n} === ${o.default.errors}`)}}}),uc=T(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=l6(),r=l8();e.default={keyword:"unevaluatedItems",type:"array",schemaType:["boolean","object"],error:{message:({params:{len:e}})=>(0,t.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,t._)`{limit: ${e}}`},code(e){let{gen:o,schema:a,data:i,it:s}=e,n=s.items||0;if(!0===n)return;let l=o.const("len",(0,t._)`${i}.length`);if(!1===a)e.setParams({len:n}),e.fail((0,t._)`${l} > ${n}`);else if("object"==typeof a&&!(0,r.alwaysValidSchema)(s,a)){let a=o.var("valid",(0,t._)`${l} <= ${n}`);o.if((0,t.not)(a),()=>{var i,c;return i=a,c=n,void o.forRange("i",c,l,a=>{e.subschema({keyword:"unevaluatedItems",dataProp:a,dataPropType:r.Type.Num},i),s.allErrors||o.if((0,t.not)(i),()=>o.break())})}),e.ok(a)}s.items=!0}}}),uu=T(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=ul(),r=uc();e.default=[t.default,r.default]}),ud=T((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/schema",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/core":!0,"https://json-schema.org/draft/2019-09/vocab/applicator":!0,"https://json-schema.org/draft/2019-09/vocab/validation":!0,"https://json-schema.org/draft/2019-09/vocab/meta-data":!0,"https://json-schema.org/draft/2019-09/vocab/format":!1,"https://json-schema.org/draft/2019-09/vocab/content":!0},$recursiveAnchor:!0,title:"Core and Validation specifications meta-schema",allOf:[{$ref:"meta/core"},{$ref:"meta/applicator"},{$ref:"meta/validation"},{$ref:"meta/meta-data"},{$ref:"meta/format"},{$ref:"meta/content"}],type:["object","boolean"],properties:{definitions:{$comment:"While no longer an official keyword as it is replaced by $defs, this keyword is retained in the meta-schema to prevent incompatible extensions as it remains in common use.",type:"object",additionalProperties:{$recursiveRef:"#"},default:{}},dependencies:{$comment:'"dependencies" is no longer a keyword, but schema authors should avoid redefining it to facilitate a smooth transition to "dependentSchemas" and "dependentRequired"',type:"object",additionalProperties:{anyOf:[{$recursiveRef:"#"},{$ref:"meta/validation#/$defs/stringArray"}]}}}}}),up=T((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/applicator",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/applicator":!0},$recursiveAnchor:!0,title:"Applicator vocabulary meta-schema",type:["object","boolean"],properties:{additionalItems:{$recursiveRef:"#"},unevaluatedItems:{$recursiveRef:"#"},items:{anyOf:[{$recursiveRef:"#"},{$ref:"#/$defs/schemaArray"}]},contains:{$recursiveRef:"#"},additionalProperties:{$recursiveRef:"#"},unevaluatedProperties:{$recursiveRef:"#"},properties:{type:"object",additionalProperties:{$recursiveRef:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$recursiveRef:"#"},propertyNames:{format:"regex"},default:{}},dependentSchemas:{type:"object",additionalProperties:{$recursiveRef:"#"}},propertyNames:{$recursiveRef:"#"},if:{$recursiveRef:"#"},then:{$recursiveRef:"#"},else:{$recursiveRef:"#"},allOf:{$ref:"#/$defs/schemaArray"},anyOf:{$ref:"#/$defs/schemaArray"},oneOf:{$ref:"#/$defs/schemaArray"},not:{$recursiveRef:"#"}},$defs:{schemaArray:{type:"array",minItems:1,items:{$recursiveRef:"#"}}}}}),uh=T((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/content",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/content":!0},$recursiveAnchor:!0,title:"Content vocabulary meta-schema",type:["object","boolean"],properties:{contentMediaType:{type:"string"},contentEncoding:{type:"string"},contentSchema:{$recursiveRef:"#"}}}}),um=T((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/core",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/core":!0},$recursiveAnchor:!0,title:"Core vocabulary meta-schema",type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference",$comment:"Non-empty fragments not allowed.",pattern:"^[^#]*#?$"},$schema:{type:"string",format:"uri"},$anchor:{type:"string",pattern:"^[A-Za-z][-A-Za-z0-9.:_]*$"},$ref:{type:"string",format:"uri-reference"},$recursiveRef:{type:"string",format:"uri-reference"},$recursiveAnchor:{type:"boolean",default:!1},$vocabulary:{type:"object",propertyNames:{type:"string",format:"uri"},additionalProperties:{type:"boolean"}},$comment:{type:"string"},$defs:{type:"object",additionalProperties:{$recursiveRef:"#"},default:{}}}}}),uf=T((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/format",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/format":!0},$recursiveAnchor:!0,title:"Format vocabulary meta-schema",type:["object","boolean"],properties:{format:{type:"string"}}}}),uy=T((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/meta-data",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/meta-data":!0},$recursiveAnchor:!0,title:"Meta-data vocabulary meta-schema",type:["object","boolean"],properties:{title:{type:"string"},description:{type:"string"},default:!0,deprecated:{type:"boolean",default:!1},readOnly:{type:"boolean",default:!1},writeOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0}}}}),ug=T((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/validation",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/validation":!0},$recursiveAnchor:!0,title:"Validation vocabulary meta-schema",type:["object","boolean"],properties:{multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/$defs/nonNegativeInteger"},minLength:{$ref:"#/$defs/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},maxItems:{$ref:"#/$defs/nonNegativeInteger"},minItems:{$ref:"#/$defs/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},maxContains:{$ref:"#/$defs/nonNegativeInteger"},minContains:{$ref:"#/$defs/nonNegativeInteger",default:1},maxProperties:{$ref:"#/$defs/nonNegativeInteger"},minProperties:{$ref:"#/$defs/nonNegativeIntegerDefault0"},required:{$ref:"#/$defs/stringArray"},dependentRequired:{type:"object",additionalProperties:{$ref:"#/$defs/stringArray"}},const:!0,enum:{type:"array",items:!0},type:{anyOf:[{$ref:"#/$defs/simpleTypes"},{type:"array",items:{$ref:"#/$defs/simpleTypes"},minItems:1,uniqueItems:!0}]}},$defs:{nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{$ref:"#/$defs/nonNegativeInteger",default:0},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}}}}),uv=T(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=ud(),r=up(),o=uh(),a=um(),i=uf(),s=uy(),n=ug(),l=["/properties"];e.default=function(e){return[t,r,o,a,c(this,i),s,c(this,n)].forEach(e=>this.addMetaSchema(e,void 0,!1)),this;function c(t,r){return e?t.$dataMetaSchema(r,l):r}}}),u_=T((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MissingRefError=e.ValidationError=e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=e.Ajv2019=void 0;let r=cS(),o=c4(),a=uo(),i=un(),s=uu(),n=c3(),l=uv(),c="https://json-schema.org/draft/2019-09/schema";var u=class extends r.default{constructor(e={}){super({...e,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){super._addVocabularies(),this.addVocabulary(a.default),o.default.forEach(e=>this.addVocabulary(e)),this.addVocabulary(i.default),this.addVocabulary(s.default),this.opts.discriminator&&this.addKeyword(n.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();let{$data:e,meta:t}=this.opts;t&&(l.default.call(this,e),this.refs["http://json-schema.org/schema"]=c)}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(c)?c:void 0)}};e.Ajv2019=u,t.exports=e=u,t.exports.Ajv2019=u,Object.defineProperty(e,"__esModule",{value:!0}),e.default=u;var d=cp();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return d.KeywordCxt}});var p=l6();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return p._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return p.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return p.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return p.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return p.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return p.CodeGen}});var h=ch();Object.defineProperty(e,"ValidationError",{enumerable:!0,get:function(){return h.default}});var m=cm();Object.defineProperty(e,"MissingRefError",{enumerable:!0,get:function(){return m.default}})}),ub=T(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=cR(),r=cq(),o=c0(),a=uo(),i=un(),s=uu(),n=c2(),l=c9();e.default=[a.default,t.default,r.default,(0,o.default)(!0),n.default,l.metadataVocabulary,l.contentVocabulary,i.default,s.default]}),uS=T((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/schema",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/core":!0,"https://json-schema.org/draft/2020-12/vocab/applicator":!0,"https://json-schema.org/draft/2020-12/vocab/unevaluated":!0,"https://json-schema.org/draft/2020-12/vocab/validation":!0,"https://json-schema.org/draft/2020-12/vocab/meta-data":!0,"https://json-schema.org/draft/2020-12/vocab/format-annotation":!0,"https://json-schema.org/draft/2020-12/vocab/content":!0},$dynamicAnchor:"meta",title:"Core and Validation specifications meta-schema",allOf:[{$ref:"meta/core"},{$ref:"meta/applicator"},{$ref:"meta/unevaluated"},{$ref:"meta/validation"},{$ref:"meta/meta-data"},{$ref:"meta/format-annotation"},{$ref:"meta/content"}],type:["object","boolean"],$comment:"This meta-schema also defines keywords that have appeared in previous drafts in order to prevent incompatible extensions as they remain in common use.",properties:{definitions:{$comment:'"definitions" has been replaced by "$defs".',type:"object",additionalProperties:{$dynamicRef:"#meta"},deprecated:!0,default:{}},dependencies:{$comment:'"dependencies" has been split and replaced by "dependentSchemas" and "dependentRequired" in order to serve their differing semantics.',type:"object",additionalProperties:{anyOf:[{$dynamicRef:"#meta"},{$ref:"meta/validation#/$defs/stringArray"}]},deprecated:!0,default:{}},$recursiveAnchor:{$comment:'"$recursiveAnchor" has been replaced by "$dynamicAnchor".',$ref:"meta/core#/$defs/anchorString",deprecated:!0},$recursiveRef:{$comment:'"$recursiveRef" has been replaced by "$dynamicRef".',$ref:"meta/core#/$defs/uriReferenceString",deprecated:!0}}}}),uw=T((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/applicator",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/applicator":!0},$dynamicAnchor:"meta",title:"Applicator vocabulary meta-schema",type:["object","boolean"],properties:{prefixItems:{$ref:"#/$defs/schemaArray"},items:{$dynamicRef:"#meta"},contains:{$dynamicRef:"#meta"},additionalProperties:{$dynamicRef:"#meta"},properties:{type:"object",additionalProperties:{$dynamicRef:"#meta"},default:{}},patternProperties:{type:"object",additionalProperties:{$dynamicRef:"#meta"},propertyNames:{format:"regex"},default:{}},dependentSchemas:{type:"object",additionalProperties:{$dynamicRef:"#meta"},default:{}},propertyNames:{$dynamicRef:"#meta"},if:{$dynamicRef:"#meta"},then:{$dynamicRef:"#meta"},else:{$dynamicRef:"#meta"},allOf:{$ref:"#/$defs/schemaArray"},anyOf:{$ref:"#/$defs/schemaArray"},oneOf:{$ref:"#/$defs/schemaArray"},not:{$dynamicRef:"#meta"}},$defs:{schemaArray:{type:"array",minItems:1,items:{$dynamicRef:"#meta"}}}}}),u$=T((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/unevaluated",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/unevaluated":!0},$dynamicAnchor:"meta",title:"Unevaluated applicator vocabulary meta-schema",type:["object","boolean"],properties:{unevaluatedItems:{$dynamicRef:"#meta"},unevaluatedProperties:{$dynamicRef:"#meta"}}}}),uR=T((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/content",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/content":!0},$dynamicAnchor:"meta",title:"Content vocabulary meta-schema",type:["object","boolean"],properties:{contentEncoding:{type:"string"},contentMediaType:{type:"string"},contentSchema:{$dynamicRef:"#meta"}}}}),uP=T((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/core",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/core":!0},$dynamicAnchor:"meta",title:"Core vocabulary meta-schema",type:["object","boolean"],properties:{$id:{$ref:"#/$defs/uriReferenceString",$comment:"Non-empty fragments not allowed.",pattern:"^[^#]*#?$"},$schema:{$ref:"#/$defs/uriString"},$ref:{$ref:"#/$defs/uriReferenceString"},$anchor:{$ref:"#/$defs/anchorString"},$dynamicRef:{$ref:"#/$defs/uriReferenceString"},$dynamicAnchor:{$ref:"#/$defs/anchorString"},$vocabulary:{type:"object",propertyNames:{$ref:"#/$defs/uriString"},additionalProperties:{type:"boolean"}},$comment:{type:"string"},$defs:{type:"object",additionalProperties:{$dynamicRef:"#meta"}}},$defs:{anchorString:{type:"string",pattern:"^[A-Za-z_][-A-Za-z0-9._]*$"},uriString:{type:"string",format:"uri"},uriReferenceString:{type:"string",format:"uri-reference"}}}}),uE=T((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/format-annotation",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/format-annotation":!0},$dynamicAnchor:"meta",title:"Format vocabulary meta-schema for annotation results",type:["object","boolean"],properties:{format:{type:"string"}}}}),uk=T((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/meta-data",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/meta-data":!0},$dynamicAnchor:"meta",title:"Meta-data vocabulary meta-schema",type:["object","boolean"],properties:{title:{type:"string"},description:{type:"string"},default:!0,deprecated:{type:"boolean",default:!1},readOnly:{type:"boolean",default:!1},writeOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0}}}}),ux=T((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/validation",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/validation":!0},$dynamicAnchor:"meta",title:"Validation vocabulary meta-schema",type:["object","boolean"],properties:{type:{anyOf:[{$ref:"#/$defs/simpleTypes"},{type:"array",items:{$ref:"#/$defs/simpleTypes"},minItems:1,uniqueItems:!0}]},const:!0,enum:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/$defs/nonNegativeInteger"},minLength:{$ref:"#/$defs/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},maxItems:{$ref:"#/$defs/nonNegativeInteger"},minItems:{$ref:"#/$defs/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},maxContains:{$ref:"#/$defs/nonNegativeInteger"},minContains:{$ref:"#/$defs/nonNegativeInteger",default:1},maxProperties:{$ref:"#/$defs/nonNegativeInteger"},minProperties:{$ref:"#/$defs/nonNegativeIntegerDefault0"},required:{$ref:"#/$defs/stringArray"},dependentRequired:{type:"object",additionalProperties:{$ref:"#/$defs/stringArray"}}},$defs:{nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{$ref:"#/$defs/nonNegativeInteger",default:0},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}}}}),uT=T(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=uS(),r=uw(),o=u$(),a=uR(),i=uP(),s=uE(),n=uk(),l=ux(),c=["/properties"];e.default=function(e){return[t,r,o,a,i,u(this,s),n,u(this,l)].forEach(e=>this.addMetaSchema(e,void 0,!1)),this;function u(t,r){return e?t.$dataMetaSchema(r,c):r}}}),uC=T((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MissingRefError=e.ValidationError=e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=e.Ajv2020=void 0;let r=cS(),o=ub(),a=c3(),i=uT(),s="https://json-schema.org/draft/2020-12/schema";var n=class extends r.default{constructor(e={}){super({...e,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){super._addVocabularies(),o.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(a.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();let{$data:e,meta:t}=this.opts;t&&(i.default.call(this,e),this.refs["http://json-schema.org/schema"]=s)}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(s)?s:void 0)}};e.Ajv2020=n,t.exports=e=n,t.exports.Ajv2020=n,Object.defineProperty(e,"__esModule",{value:!0}),e.default=n;var l=cp();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return l.KeywordCxt}});var c=l6();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return c._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return c.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return c.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return c.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return c.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return c.CodeGen}});var u=ch();Object.defineProperty(e,"ValidationError",{enumerable:!0,get:function(){return u.default}});var d=cm();Object.defineProperty(e,"MissingRefError",{enumerable:!0,get:function(){return d.default}})}),uO=T(e=>{function t(e,t){return{validate:e,compare:t}}Object.defineProperty(e,"__esModule",{value:!0}),e.formatNames=e.fastFormats=e.fullFormats=void 0,e.fullFormats={date:t(a,i),time:t(n(!0),l),"date-time":t(d(!0),p),"iso-time":t(n(),c),"iso-date-time":t(d(),h),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:function(e){return m.test(e)&&f.test(e)},"uri-reference":/^(?:[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,"uri-template":/^(?:(?:[^\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,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,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:/^(?=.{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,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([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}))|:)))$/i,regex:function(e){if(b.test(e))return!1;try{return new RegExp(e),!0}catch(e){return!1}},uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:function(e){return y.lastIndex=0,y.test(e)},int32:{type:"number",validate:function(e){return Number.isInteger(e)&&e<=v&&e>=g}},int64:{type:"number",validate:function(e){return Number.isInteger(e)}},float:{type:"number",validate:_},double:{type:"number",validate:_},password:!0,binary:!0},e.fastFormats={...e.fullFormats,date:t(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,i),time:t(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,l),"date-time":t(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,p),"iso-time":t(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,c),"iso-date-time":t(/^\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,h),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,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},e.formatNames=Object.keys(e.fullFormats);let r=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,o=[0,31,28,31,30,31,30,31,31,30,31,30,31];function a(e){var t;let a=r.exec(e);if(!a)return!1;let i=+a[1],s=+a[2],n=+a[3];return s>=1&&s<=12&&n>=1&&n<=(2===s&&(t=i)%4==0&&(t%100!=0||t%400==0)?29:o[s])}function i(e,t){if(e&&t)return e>t?1:e<t?-1:0}let s=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function n(e){return function(t){let r=s.exec(t);if(!r)return!1;let o=+r[1],a=+r[2],i=+r[3],n=r[4],l="-"===r[5]?-1:1,c=+(r[6]||0),u=+(r[7]||0);if(c>23||u>59||e&&!n)return!1;if(o<=23&&a<=59&&i<60)return!0;let d=a-u*l,p=o-c*l-(d<0);return(23===p||-1===p)&&(59===d||-1===d)&&i<61}}function l(e,t){if(!(e&&t))return;let r=new Date("2020-01-01T"+e).valueOf(),o=new Date("2020-01-01T"+t).valueOf();if(r&&o)return r-o}function c(e,t){if(!(e&&t))return;let r=s.exec(e),o=s.exec(t);if(r&&o)return(e=r[1]+r[2]+r[3])>(t=o[1]+o[2]+o[3])?1:e<t?-1:0}let u=/t|\s/i;function d(e){let t=n(e);return function(e){let r=e.split(u);return 2===r.length&&a(r[0])&&t(r[1])}}function p(e,t){if(!(e&&t))return;let r=new Date(e).valueOf(),o=new Date(t).valueOf();if(r&&o)return r-o}function h(e,t){if(!(e&&t))return;let[r,o]=e.split(u),[a,s]=t.split(u),n=i(r,a);if(void 0!==n)return n||l(o,s)}let m=/\/|:/,f=/^(?:[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,y=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm,g=-0x80000000,v=0x80000000-1;function _(){return!0}let b=/[^\\]\\Z/}),uj=T(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.formatLimitDefinition=void 0;let t=c8(),r=l6(),o=r.operators,a={formatMaximum:{okStr:"<=",ok:o.LTE,fail:o.GT},formatMinimum:{okStr:">=",ok:o.GTE,fail:o.LT},formatExclusiveMaximum:{okStr:"<",ok:o.LT,fail:o.GTE},formatExclusiveMinimum:{okStr:">",ok:o.GT,fail:o.LTE}};e.formatLimitDefinition={keyword:Object.keys(a),type:"string",schemaType:"string",$data:!0,error:{message:({keyword:e,schemaCode:t})=>(0,r.str)`should be ${a[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,r._)`{comparison: ${a[e].okStr}, limit: ${t}}`},code(e){let o,i,{gen:s,data:n,schemaCode:l,keyword:c,it:u}=e,{opts:d,self:p}=u;if(!d.validateFormats)return;let h=new t.KeywordCxt(u,p.RULES.all.format.definition,"format");function m(e){return(0,r._)`${e}.compare(${n}, ${l}) ${a[c].fail} 0`}h.$data?(o=s.scopeValue("formats",{ref:p.formats,code:d.code.formats}),i=s.const("fmt",(0,r._)`${o}[${h.schemaCode}]`),e.fail$data((0,r.or)((0,r._)`typeof ${i} != "object"`,(0,r._)`${i} instanceof RegExp`,(0,r._)`typeof ${i}.compare != "function"`,m(i)))):function(){let t=h.schema,o=p.formats[t];if(!o||!0===o)return;if("object"!=typeof o||o instanceof RegExp||"function"!=typeof o.compare)throw Error(`"${c}": format "${t}" does not define "compare" function`);let a=s.scopeValue("formats",{key:t,ref:o,code:d.code.formats?(0,r._)`${d.code.formats}${(0,r.getProperty)(t)}`:void 0});e.fail$data(m(a))}()},dependencies:["format"]},e.default=t=>(t.addKeyword(e.formatLimitDefinition),t)}),uI=T((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0});let r=uO(),o=uj(),a=l6(),i=new a.Name("fullFormats"),s=new a.Name("fastFormats"),n=(e,t={keywords:!0})=>{if(Array.isArray(t))return l(e,t,r.fullFormats,i),e;let[a,n]="fast"===t.mode?[r.fastFormats,s]:[r.fullFormats,i];return l(e,t.formats||r.formatNames,a,n),t.keywords&&(0,o.default)(e),e};function l(e,t,r,o){var i;for(let s of(null!=(i=e.opts.code).formats||(i.formats=(0,a._)`require("ajv-formats/dist/formats").${o}`),t))e.addFormat(s,r[s])}n.get=(e,t="full")=>{let o=("fast"===t?r.fastFormats:r.fullFormats)[e];if(!o)throw Error(`Unknown format "${e}"`);return o},t.exports=e=n,Object.defineProperty(e,"__esModule",{value:!0}),e.default=n}),uN=c8(),uA=u_(),uz=uC();let uq=C(uI(),1).default;function uM(e){let t=new e({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return uq(t),t}var uL=class{_ajv;_ajvDraft7;_ajv2019;_userAjv;constructor(e){this._userAjv=void 0!==e,this._ajv=e}get ajv(){return this._ajv??=uM(uz.Ajv2020)}_engineFor(e){if(this._userAjv)return this.ajv;let t=function(e,t){if(!("$schema"in e)||"string"!=typeof e.$schema)return"2020-12";let r=e.$schema.replace(/#$/,"");if(O.has(r))return"2020-12";if(j.has(r))return"2019-09";if(I.has(r)||N.has(r))return"draft-7";throw Error(`JSON Schema declares an unsupported dialect ("$schema": "${e.$schema.slice(0,200)}"). The default validator supports JSON Schema 2020-12, 2019-09, draft-07, and draft-06; ${t}`)}(e,"pass a pre-configured Ajv instance to AjvJsonSchemaValidator(ajv) to validate other dialects.");return"2020-12"===t?this.ajv:"2019-09"===t?this._ajv2019??=uM(uA.Ajv2019):this._ajvDraft7??=uM(uN.Ajv)}getValidator(e){let t=this._engineFor(e),r="$id"in e&&"string"==typeof e.$id?t.getSchema(e.$id)??t.compile(e):t.compile(e);return e=>r(e)?{valid:!0,data:e,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:t.errorsText(r.errors)}}};async function uU(e){return(await n).getRandomValues(new Uint8Array(e))}async function uD(e){let t="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~",r=256-256%t.length,o="";for(;o.length<e;)for(let a of(await uU(e-o.length)))a<r&&(o+=t[a%t.length]);return o}async function uV(e){return await uD(e)}async function uH(e){return btoa(String.fromCharCode(...new Uint8Array(await (await n).subtle.digest("SHA-256",new TextEncoder().encode(e))))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}async function uF(e){if(e||(e=43),e<43||e>128)throw`Expected a length between 43 and 128. Received ${e}.`;let t=await uV(e),r=await uH(t);return{code_verifier:t,code_challenge:r}}uN.Ajv,n=globalThis.crypto?.webcrypto??globalThis.crypto??Promise.resolve().then(a.t.bind(a,7598,19)).then(e=>e.webcrypto);class uK extends Error{constructor(e,t){super(e),this.name="ParseError",this.type=t.type,this.field=t.field,this.value=t.value,this.line=t.line}}function uJ(e){}function uZ(e,t,r){return 100===r&&97===e.charCodeAt(t+1)&&116===e.charCodeAt(t+2)&&97===e.charCodeAt(t+3)&&58===e.charCodeAt(t+4)}function uW(e,t,r){return 101===r&&118===e.charCodeAt(t+1)&&101===e.charCodeAt(t+2)&&110===e.charCodeAt(t+3)&&116===e.charCodeAt(t+4)&&58===e.charCodeAt(t+5)}class uB extends TransformStream{constructor({onError:e,onRetry:t,onComment:r,maxBufferSize:o}={}){let a;super({start(i){a=function(e){if("function"==typeof e)throw TypeError("`config` must be an object, got a function instead. Did you mean `createParser({onEvent: fn})`?");let{onEvent:t=uJ,onError:r=uJ,onRetry:o=uJ,onComment:a,maxBufferSize:i}=e,s=[],n=0,l=!0,c,u="",d=0,p,h=!1;function m(){void 0!==i&&(n+u.length<=i||(h=!0,s.length=0,n=0,c=void 0,u="",d=0,p=void 0,r(new uK(`Buffered data exceeded max buffer size of ${i} characters`,{type:"max-buffer-size-exceeded"}))))}function f(e){let r=0;if(-1===e.indexOf("\r")){let o=e.indexOf(`
69
+ `,r);for(;-1!==o;){if(r===o){d>0&&t({id:c,event:p,data:u}),c=void 0,u="",d=0,p=void 0,r=o+1,o=e.indexOf(`
70
+ `,r);continue}let a=e.charCodeAt(r);if(uZ(e,r,a)){let a=32===e.charCodeAt(r+5)?r+6:r+5,i=e.slice(a,o);if(0===d&&10===e.charCodeAt(o+1)){t({id:c,event:p,data:i}),c=void 0,u="",p=void 0,r=o+2,o=e.indexOf(`
71
+ `,r);continue}u=0===d?i:`${u}
72
+ ${i}`,d++}else uW(e,r,a)?p=e.slice(32===e.charCodeAt(r+6)?r+7:r+6,o)||void 0:y(e,r,o);r=o+1,o=e.indexOf(`
73
+ `,r)}return e.slice(r)}for(;r<e.length;){let t=e.indexOf("\r",r),o=e.indexOf(`
74
+ `,r),a=-1;if(-1!==t&&-1!==o?a=t<o?t:o:-1!==t?a=t===e.length-1?-1:t:-1!==o&&(a=o),-1===a)break;y(e,r,a),r=a+1,13===e.charCodeAt(r-1)&&10===e.charCodeAt(r)&&r++}return e.slice(r)}function y(e,r,o){if(r===o)return void(d>0&&t({id:c,event:p,data:u}),c=void 0,u="",d=0,p=void 0);let i=e.charCodeAt(r);if(uZ(e,r,i)){let t=32===e.charCodeAt(r+5)?r+6:r+5,a=e.slice(t,o);u=0===d?a:`${u}
75
+ ${a}`,d++;return}if(uW(e,r,i)){p=e.slice(32===e.charCodeAt(r+6)?r+7:r+6,o)||void 0;return}if(105===i&&100===e.charCodeAt(r+1)&&58===e.charCodeAt(r+2)){let t=e.slice(32===e.charCodeAt(r+3)?r+4:r+3,o);c=t.includes("\0")?void 0:t;return}if(58===i){a&&a(e.slice(r,o).slice(32===e.charCodeAt(r+1)?2:1));return}let s=e.slice(r,o),n=s.indexOf(":");if(-1===n)return void g(s,"",s);let l=s.slice(0,n),h=32===s.charCodeAt(n+1)?2:1;g(l,s.slice(n+h),s)}function g(e,t,a){switch(e){case"event":p=t||void 0;break;case"data":u=0===d?t:`${u}
76
+ ${t}`,d++;break;case"id":c=t.includes("\0")?void 0:t;break;case"retry":/^\d+$/.test(t)?o(parseInt(t,10)):r(new uK(`Invalid \`retry\` value: "${t}"`,{type:"invalid-retry",value:t,line:a}));break;default:r(new uK(`Unknown field "${e.length>20?`${e.slice(0,20)}\u2026`:e}"`,{type:"unknown-field",field:e,value:t,line:a}))}}return{feed:function(e){if(h)throw Error("Cannot feed parser: it was terminated after exceeding the configured max buffer size. Call `reset()` to resume parsing.");if(l&&(l=!1,239===e.charCodeAt(0)&&187===e.charCodeAt(1)&&191===e.charCodeAt(2)&&(e=e.slice(3))),0===s.length){let t=f(e);""!==t&&(s.push(t),n=t.length),m();return}if(-1===e.indexOf(`
77
+ `)&&-1===e.indexOf("\r")){s.push(e),n+=e.length,m();return}s.push(e);let t=s.join("");s.length=0,n=0;let r=f(t);""!==r&&(s.push(r),n=r.length),m()},reset:function(e={}){if(e.consume&&s.length>0){let e=s.join("");y(e,0,e.length)}l=!0,c=void 0,u="",d=0,p=void 0,s.length=0,n=0,h=!1}}}({onEvent:e=>{i.enqueue(e)},onError(t){"function"==typeof e&&e(t),("terminate"===e||"max-buffer-size-exceeded"===t.type)&&i.error(t)},onRetry:t,onComment:r,maxBufferSize:o})},transform(e){a.feed(e)}})}}var uG=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.OAuthClientFlowError"})}static[Symbol.hasInstance](e){return nb(this,e)}static isInstance(e){if("function"!=typeof this)throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return nb(this,e)}constructor(e){super(e),this.name=new.target.name,n_(this,new.target)}},uX=class extends uG{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.IssuerMismatchError"})}kind;expected;received;constructor(e,t,r){super(`Issuer mismatch in ${"metadata"===e?"authorization server metadata (RFC 8414 \xa73.3)":"authorization response (RFC 9207)"}: expected ${JSON.stringify(t)}, received ${JSON.stringify(r)}`),this.kind=e,this.expected=t,this.received=r}},uY=class extends uG{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.RegistrationRejectedError"})}status;body;submittedMetadata;constructor(e){super(`Dynamic Client Registration rejected (HTTP ${e.status}): ${e.body}`),this.status=e.status,this.body=e.body,this.submittedMetadata=e.submittedMetadata}},uQ=class extends uG{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.InsecureTokenEndpointError"})}tokenEndpoint;constructor(e){super(`Refusing to send credentials to non-https token endpoint '${e}'. OAuth token requests MUST use TLS (localhost / 127.0.0.1 / ::1 are exempt).`),this.tokenEndpoint=e}},u0=class extends uG{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.AuthorizationServerMismatchError"})}constructor(e,t){super(`Authorization server changed between redirect and callback (redirected to ${JSON.stringify(e)}, callback resolved ${JSON.stringify(t)}); refusing to send authorization_code/code_verifier to a different token endpoint`),this.recordedIssuer=e,this.currentIssuer=t}},u1=class extends uG{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.InsufficientScopeError"})}requiredScope;resourceMetadataUrl;errorDescription;constructor(e){super(`Insufficient scope${e.requiredScope?`: required "${e.requiredScope}"`:""}`),this.requiredScope=e.requiredScope,this.resourceMetadataUrl=e.resourceMetadataUrl,this.errorDescription=e.errorDescription}};function u2(e,t,r){if(void 0!==e)return void 0===e.issuer?(r?.canPersistStamp!==!1&&console.warn("[mcp-sdk] SEP-2352: stored OAuth credential has no 'issuer' stamp (pre-upgrade storage or provider not round-tripping the value). SEP-2352 isolation is inactive for this read; ensure your provider round-trips the issuer field."),e):u9(e.issuer,t)?e:void 0}function u9(e,t){return e===t||e.endsWith("/")&&e.slice(0,-1)===t||t.endsWith("/")&&t.slice(0,-1)===e}async function u4(e,t,r){let{resourceMetadataUrl:o,scope:a}=dl(t.response);if(await di(e,{serverUrl:t.serverUrl,resourceMetadataUrl:o,scope:a,fetchFn:t.fetchFn,...r})!=="AUTHORIZED")throw new u5}var u5=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UnauthorizedError"})}static[Symbol.hasInstance](e){return nb(this,e)}static isInstance(e){if("function"!=typeof this)throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return nb(this,e)}constructor(e){super(e??"Unauthorized"),this.name="UnauthorizedError",n_(this,new.target)}};function u3(e){return e?.authorization_response_iss_parameter_supported===!0}function u6({iss:e,expectedIssuer:t,issParameterSupported:r}){if(void 0!==t){if(void 0===e){if(r)throw new uX("authorization_response",t,void 0);return}if(e!==t)throw new uX("authorization_response",t,e)}}function u8(...e){let t=new Set;for(let r of e)if(r)for(let e of r.split(/\s+/))e&&t.add(e);return t.size>0?[...t].join(" "):void 0}async function u7(e,t,r,o,a){if("string"==typeof e)return{authorizationCode:e,iss:t};let i=e.get("iss")??void 0,s=e.get("code");if(s)return{authorizationCode:s,iss:i};let n=(await r.discoveryState?.())?.authorizationServerMetadata;if(!n)try{n=(await df(o,a)).authorizationServerMetadata}catch{n=void 0}if(!n)throw new u5("Authorization callback failed and the issuer could not be verified");u6({iss:i,expectedIssuer:n.issuer,issParameterSupported:u3(n)});let l=e.get("error");if(l)throw new nw(l,e.get("error_description")??l,e.get("error_uri")??void 0);throw new u5("Authorization callback contained neither `code` nor `error`")}let de="code",dt="S256";function dr(e){return"localhost"===e||"127.0.0.1"===e||"[::1]"===e||"::1"===e}async function da(e){let t=e instanceof Response?e.status:void 0,r=e instanceof Response?await e.text():e;try{let e=nd.parse(JSON.parse(r));return nw.fromResponse(e)}catch(o){let e=`${t?`HTTP ${t}: `:""}Invalid OAuth error response: ${o}. Raw body: ${r}`;return new nw(nS.ServerError,e)}}async function di(e,t){try{return await ds(e,t)}catch(r){if(r instanceof nw){if(r.code===nS.InvalidClient||r.code===nS.UnauthorizedClient)return await e.invalidateCredentials?.("client"),await e.invalidateCredentials?.("tokens"),await ds(e,t);else if(r.code===nS.InvalidGrant)return await e.invalidateCredentials?.("tokens"),await ds(e,t)}throw r}}async function ds(e,{serverUrl:t,authorizationCode:r,iss:o,scope:a,resourceMetadataUrl:i,fetchFn:s,skipIssuerMetadataValidation:n,forceReauthorization:l}){var c;let u,d,p,h,m,f={...m=(c=e).clientMetadata,grant_types:m.grant_types??(void 0===c.redirectUrl?void 0:["authorization_code","refresh_token"]),application_type:m.application_type??function(e){for(let t of e??[]){let e;try{e=new URL(t)}catch{continue}if("http:"!==e.protocol&&"https:"!==e.protocol||dr(e.hostname))return"native"}return"web"}(m.redirect_uris)},y=await e.discoveryState?.(),g=i;if(!g&&y?.resourceMetadataUrl&&(g=new URL(y.resourceMetadataUrl)),y?.authorizationServerUrl){if(d=y.authorizationServerUrl,u=y.resourceMetadata,p=y.authorizationServerMetadata??await dm(d,{fetchFn:s,skipIssuerValidation:n}),!u)try{u=await du(t,{resourceMetadataUrl:g},s)}catch(e){if(e instanceof TypeError)throw e}(p!==y.authorizationServerMetadata||u!==y.resourceMetadata)&&await e.saveDiscoveryState?.({authorizationServerUrl:String(d),resourceMetadataUrl:g?.toString(),resourceMetadata:u,authorizationServerMetadata:p})}else{let e=await df(t,{resourceMetadataUrl:g,fetchFn:s,skipIssuerMetadataValidation:n});d=e.authorizationServerUrl,p=e.authorizationServerMetadata,u=e.resourceMetadata,h={authorizationServerUrl:String(d),resourceMetadataUrl:g?.toString(),resourceMetadata:u,authorizationServerMetadata:p}}let v=p?.issuer??String(d),_={issuer:v};if(await e.saveAuthorizationServerUrl?.(v),void 0!==r){let t=y?.authorizationServerMetadata?.issuer??y?.authorizationServerUrl;if(void 0===t){if(void 0!==e.saveDiscoveryState)throw new u0("discoveryState was not available on the callback leg; ensure your provider persists discoveryState alongside codeVerifier",v);console.warn("[mcp-sdk] OAuthClientProvider does not implement saveDiscoveryState()/discoveryState(); the SEP-2352 callback-leg authorization-server binding cannot be checked. Implement discoveryState (persist alongside codeVerifier) — see docs/migration/upgrade-to-v2.md \xa7SEP-2352.")}else if(!u9(t,v))throw new u0(t,v)}h&&await e.saveDiscoveryState?.(h);let b=await dn(t,e,u);b&&await e.saveResourceUrl?.(String(b));let S=function(e){let{requestedScope:t,resourceMetadata:r,authServerMetadata:o,clientMetadata:a}=e,i=t||r?.scopes_supported?.join(" ")||a.scope;return i&&o?.scopes_supported?.includes("offline_access")&&!i.split(" ").includes("offline_access")&&a.grant_types?.includes("refresh_token")&&(i=`${i} offline_access`),i}({requestedScope:a,resourceMetadata:u,authServerMetadata:p,clientMetadata:e.clientMetadata}),w=await Promise.resolve(e.clientInformation(_)),$=u2(w,v,{canPersistStamp:void 0!==e.saveClientInformation});if(void 0===$&&w?.issuer&&void 0===e.saveClientInformation)throw new u0(w.issuer,v);if($&&void 0===$.issuer&&($={...$,issuer:v},await e.saveClientInformation?.($,_)),!$){if(void 0!==r)throw Error("Existing OAuth client information is required when exchanging an authorization code");let t=p?.client_id_metadata_document_supported===!0,o=e.clientMetadataUrl;if(o&&!function(e){if(!e)return!1;try{let t=new URL(e);return"https:"===t.protocol&&"/"!==t.pathname}catch{return!1}}(o))throw new nw(nS.InvalidClientMetadata,`clientMetadataUrl must be a valid HTTPS URL with a non-root pathname, got: ${o}`);if(t&&o)$={client_id:o,issuer:v},await e.saveClientInformation?.($,_);else{if(!e.saveClientInformation)throw Error("OAuth client information must be saveable for dynamic registration");$={...await db(d,{metadata:p,clientMetadata:f,scope:S,fetchFn:s}),issuer:v},await e.saveClientInformation($,_)}}let R=!e.redirectUrl;if(void 0!==r||R){void 0!==r&&u6({iss:o,expectedIssuer:p?.issuer,issParameterSupported:u3(p)});let t=await d_(e,d,{metadata:p,resource:b,authorizationCode:r,iss:o,scope:S,fetchFn:s});return await e.saveTokens({...t,issuer:v},_),"AUTHORIZED"}let P=u2(await e.tokens(_),v);if(P&&void 0===P.issuer&&(P={...P,issuer:v},await e.saveTokens(P,_)),P?.refresh_token&&!l)try{let t=await dv(d,{metadata:p,clientInformation:$,refreshToken:P.refresh_token,resource:b,addClientAuthentication:e.addClientAuthentication,fetchFn:s});return await e.saveTokens({...t,issuer:v},_),"AUTHORIZED"}catch(e){if(e instanceof uQ||e instanceof nw&&e.code!==nS.ServerError)throw e}let E=e.state?await e.state():void 0,{authorizationUrl:k,codeVerifier:x}=await dy(d,{metadata:p,clientInformation:$,state:E,redirectUrl:e.redirectUrl,scope:S,resource:b});return await e.saveCodeVerifier(x),await e.redirectToAuthorization(k),"REDIRECT"}async function dn(e,t,r){var o;let a,i=((a=new URL("string"==typeof(o=e)?o:o.href)).hash="",a);if(t.validateResourceURL)return await t.validateResourceURL(i,r?.resource);if(r){if(!function({requestedResource:e,configuredResource:t}){let r=new URL("string"==typeof e?e:e.href),o=new URL("string"==typeof t?t:t.href);if(r.origin!==o.origin||r.pathname.length<o.pathname.length)return!1;let a=r.pathname.endsWith("/")?r.pathname:r.pathname+"/",i=o.pathname.endsWith("/")?o.pathname:o.pathname+"/";return a.startsWith(i)}({requestedResource:i,configuredResource:r.resource}))throw Error(`Protected resource ${r.resource} does not match expected ${i} (or origin)`);return new URL(r.resource)}}function dl(e){let t,r=e.headers.get("WWW-Authenticate");if(!r)return{};let[o,a]=r.split(" ");if(o?.toLowerCase()!=="bearer"||!a)return{};let i=dc(e,"resource_metadata")||void 0;if(i)try{t=new URL(i)}catch{}let s=dc(e,"scope")||void 0,n=dc(e,"error")||void 0;return{resourceMetadataUrl:t,scope:s,error:n,errorDescription:dc(e,"error_description")||void 0}}function dc(e,t){let r=e.headers.get("WWW-Authenticate");if(!r)return null;let o=new RegExp(String.raw`${t}=(?:"([^"]+)"|([^\s,]+))`),a=r.match(o);if(a){let e=a[1]||a[2];if(e)return e}return null}async function du(e,t,r=fetch){let o=await dh(e,"oauth-protected-resource",r,{protocolVersion:t?.protocolVersion,metadataUrl:t?.resourceMetadataUrl});if(!o||404===o.status)throw await o?.text?.().catch(()=>{}),Error("Resource server does not implement OAuth 2.0 Protected Resource Metadata.");if(!o.ok)throw await o.text?.().catch(()=>{}),Error(`HTTP ${o.status} trying to load well-known OAuth protected resource metadata.`);return ni.parse(await o.json())}async function dd(e,t,r=fetch){try{return await r(e,{headers:t})}catch(e){throw e}}async function dp(e,t,r=fetch){return await dd(e,{"MCP-Protocol-Version":t},r)}async function dh(e,t,r,o){var a,i;let s,n=new URL(e),l=o?.protocolVersion??ab;o?.metadataUrl?s=new URL(o.metadataUrl):(s=new URL(function(e,t="",r={}){return t.endsWith("/")&&(t=t.slice(0,-1)),r.prependPathname?`${t}/.well-known/${e}`:`/.well-known/${e}${t}`}(t,n.pathname),o?.metadataServerUrl??n)).search=n.search;let c=await dp(s,l,r);return!o?.metadataUrl&&(a=c,i=n.pathname,!a||"/"!==i&&(a.status>=400&&a.status<500||502===a.status))&&(c=await dp(new URL(`/.well-known/${t}`,n),l,r)),c}async function dm(e,{fetchFn:t=fetch,protocolVersion:r=ab,skipIssuerValidation:o=!1}={}){let a={"MCP-Protocol-Version":r,Accept:"application/json"};for(let{url:r,type:i}of function(e){let t="string"==typeof e?new URL(e):e,r="/"!==t.pathname,o=[];if(!r)return o.push({url:new URL("/.well-known/oauth-authorization-server",t.origin),type:"oauth"},{url:new URL("/.well-known/openid-configuration",t.origin),type:"oidc"}),o;let a=t.pathname;return a.endsWith("/")&&(a=a.slice(0,-1)),o.push({url:new URL(`/.well-known/oauth-authorization-server${a}`,t.origin),type:"oauth"},{url:new URL(`/.well-known/openid-configuration${a}`,t.origin),type:"oidc"},{url:new URL(`${a}/.well-known/openid-configuration`,t.origin),type:"oidc"}),o}(e)){let s=await dd(r,a,t);if(!s)continue;if(!s.ok){if(await s.text?.().catch(()=>{}),s.status>=400&&s.status<500||502===s.status)continue;throw Error(`HTTP ${s.status} trying to load ${"oauth"===i?"OAuth":"OpenID provider"} metadata from ${r}`)}let n="oauth"===i?ns.parse(await s.json()):nl.parse(await s.json());if(!o){let t="string"==typeof e?e:e.href;if(!(n.issuer===t||t.endsWith("/")&&n.issuer===t.slice(0,-1)))throw new uX("metadata",t,n.issuer)}return n}}async function df(e,t){let r,o;try{(r=await du(e,{resourceMetadataUrl:t?.resourceMetadataUrl},t?.fetchFn)).authorization_servers&&r.authorization_servers.length>0&&(o=r.authorization_servers[0])}catch(e){if(e instanceof TypeError)throw e}o||(o=String(new URL("/",e)));let a=await dm(o,{fetchFn:t?.fetchFn,skipIssuerValidation:t?.skipIssuerMetadataValidation});return{authorizationServerUrl:o,authorizationServerMetadata:a,resourceMetadata:r}}async function dy(e,{metadata:t,clientInformation:r,redirectUrl:o,scope:a,state:i,resource:s}){let n;if(t){if(n=new URL(t.authorization_endpoint),!t.response_types_supported.includes(de))throw Error(`Incompatible auth server: does not support response type ${de}`);if(t.code_challenge_methods_supported&&!t.code_challenge_methods_supported.includes(dt))throw Error(`Incompatible auth server: does not support code challenge method ${dt}`)}else n=new URL("/authorize",e);let l=await uF(),c=l.code_verifier,u=l.code_challenge;return n.searchParams.set("response_type",de),n.searchParams.set("client_id",r.client_id),n.searchParams.set("code_challenge",u),n.searchParams.set("code_challenge_method",dt),n.searchParams.set("redirect_uri",String(o)),i&&n.searchParams.set("state",i),a&&n.searchParams.set("scope",a),a?.split(" ").includes("offline_access")&&n.searchParams.append("prompt","consent"),s&&n.searchParams.set("resource",s.href),{authorizationUrl:n,codeVerifier:c}}async function dg(e,{metadata:t,tokenRequestParams:r,clientInformation:o,addClientAuthentication:a,resource:i,fetchFn:s}){var n,l;let c,u=function(e){let t=new URL(String(e));if("https:"!==t.protocol&&!dr(t.hostname))throw new uQ(t.href);return t}(t?.token_endpoint??new URL("/token",e)),d=new Headers({"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"});i&&r.set("resource",i.href),a?await a(d,r,u,t):o&&function(e,t,r,o){let{client_id:a,client_secret:i}=t;switch(e){case"client_secret_basic":var s,n,l,c,u=a,d=i,p=r;if(!d)throw Error("client_secret_basic authentication requires a client_secret");let h=btoa(`${u}:${d}`);p.set("Authorization",`Basic ${h}`);return;case"client_secret_post":s=a,n=i,(l=o).set("client_id",s),n&&l.set("client_secret",n);return;case"none":c=a,o.set("client_id",c);return;default:throw Error(`Unsupported client authentication method: ${e}`)}}((n=o,l=t?.token_endpoint_auth_methods_supported??[],c=void 0!==n.client_secret,"token_endpoint_auth_method"in n&&n.token_endpoint_auth_method&&["client_secret_basic","client_secret_post","none"].includes(n.token_endpoint_auth_method)&&(0===l.length||l.includes(n.token_endpoint_auth_method))?n.token_endpoint_auth_method:0===l.length?c?"client_secret_basic":"none":c&&l.includes("client_secret_basic")?"client_secret_basic":c&&l.includes("client_secret_post")?"client_secret_post":l.includes("none")?"none":c?"client_secret_post":"none"),o,d,r);let p=await (s??fetch)(u,{method:"POST",headers:d,body:r});if(!p.ok)throw await da(p);let h=await p.json();try{return nc.parse(h)}catch(e){if("object"==typeof h&&null!==h&&"error"in h)throw await da(JSON.stringify(h));throw e}}async function dv(e,{metadata:t,clientInformation:r,refreshToken:o,resource:a,addClientAuthentication:i,fetchFn:s}){return{refresh_token:o,...await dg(e,{metadata:t,tokenRequestParams:new URLSearchParams({grant_type:"refresh_token",refresh_token:o}),clientInformation:r,addClientAuthentication:i,resource:a,fetchFn:s})}}async function d_(e,t,{metadata:r,resource:o,authorizationCode:a,iss:i,scope:s,fetchFn:n}={}){let l;void 0!==a&&u6({iss:i,expectedIssuer:r?.issuer,issParameterSupported:u3(r)});let c=s??e.clientMetadata.scope;if(e.prepareTokenRequest&&(l=await e.prepareTokenRequest(c)),!l){var u,d;if(!a)throw Error("Either provider.prepareTokenRequest() or authorizationCode is required");if(!e.redirectUrl)throw Error("redirectUrl is required for authorization_code flow");u=a,d=await e.codeVerifier(),l=new URLSearchParams({grant_type:"authorization_code",code:u,code_verifier:d,redirect_uri:String(e.redirectUrl)})}let p=await e.clientInformation({issuer:r?.issuer??String(t)});return dg(t,{metadata:r,tokenRequestParams:l,clientInformation:p??void 0,addClientAuthentication:e.addClientAuthentication,resource:o,fetchFn:n})}async function db(e,{metadata:t,clientMetadata:r,scope:o,fetchFn:a}){let i;if(t){if(!t.registration_endpoint)throw Error("Incompatible auth server: does not support dynamic client registration");i=new URL(t.registration_endpoint)}else i=new URL("/register",e);let s={...r,...void 0===o?{}:{scope:o}},n=await (a??fetch)(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(!n.ok)throw new uY({status:n.status,body:await n.text(),submittedMetadata:s});return nf.parse(await n.json())}let dS=new Set(["tools/list","prompts/list","resources/list","resources/templates/list","server/discover"]);var dw=class{_entries=new Map;_maxEntries;_stamp=0;_cappedSize=0;constructor(e){this._maxEntries=e?.maxEntries??512}get size(){return this._entries.size}get(e){return this._entries.get(d$(e))}set(e,t){let r=d$(e),o=dS.has(e.method),a=!this._entries.has(r);if(!o&&a&&this._maxEntries>0&&this._cappedSize>=this._maxEntries){for(let e of this._entries.keys())if(!dS.has(e.slice(0,e.indexOf("\0")))){this._entries.delete(e),this._cappedSize--;break}}let i=++this._stamp;return this._entries.set(r,{...t,stamp:i}),a&&!o&&this._cappedSize++,i}delete(e){this._entries.delete(d$(e))&&!dS.has(e.method)&&this._cappedSize--}evict(e){let t=`${e}\0`,r=dS.has(e);for(let e of this._entries.keys())e.startsWith(t)&&(this._entries.delete(e),!r&&this._cappedSize--)}clear(){this._entries.clear(),this._cappedSize=0}};function d$(e){return`${e.method}\0${JSON.stringify([e.partition??"",e.params??""])}`}function dR(e,t){return void 0===t?e:`${e}\0${t}`}var dP=class{_evictionGeneration=new Map;_toolIndex;_toolOutputValidatorIndex;_serverIdentity="";constructor(e,t,r=()=>{},o="",a=Date.now){this._store=e,this._isUserSupplied=t,this._reportError=r,this._cachePartition=o,this._now=a}now(){return this._now()}setServerIdentity(e){this._serverIdentity=e}_partitionFor(e){return JSON.stringify([this._serverIdentity,"public"===e?"":this._cachePartition])}async _probe(e,t){let r={method:e,params:t??""},o=this._partitionFor("private"),a=await this._store.get({...r,partition:o});if(void 0!==a)return a;let i=this._partitionFor("public");if(i===o)return;let s=await this._store.get({...r,partition:i});return s?.scope==="public"?s:void 0}async evict(e){this._evictionGeneration.set(e,(this._evictionGeneration.get(e)??0)+1),await this._deleteBoth(e,"")}async _deleteBoth(e,t){let r=this._partitionFor("private"),o=this._partitionFor("public");try{await this._store.delete({method:e,params:t,partition:r})}catch(e){this._reportError(e)}if(o!==r)try{await this._store.delete({method:e,params:t,partition:o})}catch(e){this._reportError(e)}}async evictKey(e,t){let r=dR(e,t),o=this._evictionGeneration.get(r);void 0!==o&&this._evictionGeneration.set(r,o+1),await this._deleteBoth(e,t)}captureGeneration(e,t){let r=dR(e,t),o=this._evictionGeneration.get(r)??0;return this._evictionGeneration.set(r,o),o}async write(e,t,r,o){if((this._evictionGeneration.get(dR(e,o?.params))??0)!==r)return;let a=o?.params??"",i=this._partitionFor("private"),s=this._partitionFor("public"),n=(o?.scope??"private")==="public"?s:i;try{await this._store.set({method:e,params:a,partition:n},{value:function(e){let t;try{t=JSON.stringify(e)}catch(e){throw TypeError(`cache value is not JSON-serializable: ${e instanceof Error?e.message:String(e)}`)}if("string"!=typeof t)throw TypeError("cache value is not JSON-serializable: it has no JSON representation");return t}(t),expiresAt:o?.expiresAt,scope:o?.scope})}catch(e){this._reportError(e)}if(s!==i)try{await this._store.delete({method:e,params:a,partition:n===i?s:i})}catch(e){this._reportError(e)}}async read(e,t){let r=await this._probe(e,t);if(r?.expiresAt!==void 0&&r.expiresAt>this.now())try{let e=JSON.parse(r.value);if("object"!=typeof e||null===e||Array.isArray(e))throw TypeError("cached document is not an object");return{value:e}}catch(r){this._reportError(r),await this._deleteBoth(e,t??"");return}}resetForReconnect(){this._isUserSupplied||this._store.clear(),this._evictionGeneration.clear(),this._toolIndex=void 0,this._toolOutputValidatorIndex=void 0,this._serverIdentity=""}async toolDefinition(e){let t=await this._probe("tools/list");if(void 0===t){this._toolIndex=void 0;return}if(this._toolIndex?.stamp!==t.stamp){let e=this._decodeListTools(t),r=new Map;if(void 0!==e)for(let t of e.tools)r.set(t.name,t);this._toolIndex={stamp:t.stamp,byName:r}}return this._toolIndex.byName.get(e)}async outputValidator(e,t){let r=await this._probe("tools/list");if(void 0===r){this._toolOutputValidatorIndex=void 0;return}if(this._toolOutputValidatorIndex?.stamp!==r.stamp){let e=this._decodeListTools(r)??{tools:[]},o=new Map;for(let r of e.tools){let e=t(r);void 0!==e&&o.set(r.name,e)}this._toolOutputValidatorIndex={stamp:r.stamp,byName:o}}return this._toolOutputValidatorIndex.byName.get(e)}_decodeListTools(e){try{let t=JSON.parse(e.value);if(!Array.isArray(t?.tools)||!t.tools.every(e=>null!==e&&"object"==typeof e))throw TypeError("cached tools/list document has a malformed tools array");return t}catch(e){this._reportError(e);return}}};let dE=Symbol.for("mcp.authSeamEscape");function dk(e){if("object"==typeof e&&null!==e||"function"==typeof e)try{Object.defineProperty(e,dE,{value:!0,configurable:!0})}catch{}return e}let dx=new Set([-32001,-32020,-32021]);function dT(e,t){let{code:r,message:o,data:a}=e;if(-32022===r){let e=function(e){if("object"!=typeof e||null===e)return;let t=e.supported;if(Array.isArray(t)&&0!==t.length&&t.every(e=>"string"==typeof e))return t}(a);if(void 0===e)return{kind:"legacy"};let r=new n4({supported:e,requested:function(e){if("object"!=typeof e||null===e)return;let t=e.requested;return"string"==typeof t?t:void 0}(a)??t.requestedVersion},o),i=nT(e),s=t.clientModernVersions.find(e=>i.includes(e));return void 0!==s?{kind:"corrective",version:s,error:r}:i.length>0?{kind:"error",error:r}:t.fallbackAvailable?{kind:"legacy"}:{kind:"error",error:r}}return dx.has(r),{kind:"legacy"}}function dC(e,t){var r,o;return"browser"===t.environment&&((r=e)instanceof TypeError||r instanceof Error&&"TypeError"===r.name)?{kind:"legacy"}:{kind:"error",error:new nR(n$.EraNegotiationFailed,`Version negotiation probe failed: ${(o=e)instanceof Error?o.message:String(o)}`,{cause:e})}}function dO(){let e=globalThis;return void 0!==e.window&&void 0!==e.document?"browser":"node"}function dj(e){return"stderr"in e&&"pid"in e?"stdio":"http"}var dI=class e{_pending;_probeCounter=0;_savedOnMessage;_savedOnError;_savedOnClose;_closeDelivered=!1;constructor(e){this._transport=e,this._savedOnMessage=e.onmessage,this._savedOnError=e.onerror,this._savedOnClose=e.onclose}static async open(t){let r=new e(t);t.onmessage=e=>{let t=r._pending;if(void 0!==t&&(lg(e)||lv(e))&&e.id===t.id){r._pending=void 0,lg(e)?t.resolve({kind:"response",result:e.result}):t.resolve({kind:"response",error:e.error});return}},t.onerror=e=>{r._savedOnError?.(e)},t.onclose=()=>{let e=r._pending;void 0!==e&&(r._pending=void 0,e.resolve({kind:"closed"})),r._closeDelivered=!0,r._savedOnClose?.()};try{await t.start()}catch(e){throw r.detach(),e}return r}async exchange(e,t){let r=`server-discover-probe-${++this._probeCounter}`;return new Promise(o=>{let a=!1,i=e=>{a||(a=!0,clearTimeout(s),this._pending?.id===r&&(this._pending=void 0),o(e))},s=setTimeout(()=>i({kind:"timeout"}),t);this._pending={id:r,resolve:i},this._transport.send(e(r)).catch(e=>i({kind:"send-error",error:e}))})}detach(){if(this._pending=void 0,this._transport.onmessage=this._savedOnMessage,this._transport.onerror=this._savedOnError,this._closeDelivered&&void 0!==this._savedOnClose){let e=this._savedOnClose,t=this._transport,r=!1,o=()=>{if(!r){r=!0;return}e()};t.onclose=o,dN.set(t,()=>{t.onclose===o&&(t.onclose=e)})}else this._transport.onclose=this._savedOnClose}release(){this.detach();let e=this._transport,t=e.start,r=!0;e.start=async function(){if(r){r=!1,e.start=t;return}return t.call(e)}}};let dN=new WeakMap;function dA(e){let t=dN.get(e);dN.delete(e),t?.()}async function dz(e,t){let r,o=e.probe.timeoutMs??t.defaultTimeoutMs,a=Math.max(0,e.probe.maxRetries??0),i="pin"===e.kind?[e.version]:e.modernVersions,s="auto"===e.kind&&e.fallbackAvailable,n=await dI.open(t.transport),l=async()=>{let r=i[0],l=!1,c=a;for(;;){let a=await n.exchange(e=>{var o,a,i,s;return o=e,a=r,i=t.clientInfo,s=t.capabilities,{jsonrpc:"2.0",id:o,method:"server/discover",params:{_meta:ld(a).outboundEnvelope({protocolVersion:a,clientInfo:i,clientCapabilities:s})}}},o);if("timeout"===a.kind&&c>0){c--;continue}let u=function(e,t){switch(e.kind){case"response":return void 0===e.error?{kind:"result",result:e.result}:{kind:"rpc-error",...e.error};case"send-error":{var r;let t=e.error;if(("object"==typeof(r=t)&&null!==r||"function"==typeof r)&&!0===r[dE]||t instanceof u5||t instanceof Error&&"UnauthorizedError"===t.name)return{kind:"auth-required",error:t};if(t instanceof nP){let e=t.data?.text;return{kind:"http-error",status:t.data.status,body:"string"==typeof e?e:void 0,statusText:t.data.statusText}}return{kind:"network-error",error:t}}case"closed":return{kind:"closed"};case"timeout":return{kind:"timeout",timeoutMs:t}}}(a,o),d=function(e,t){switch(e.kind){case"result":return function(e,t){let r=ld(lu).validateResult("server/discover",e);if(!r.ok)return{kind:"legacy"};let o=r.value.supportedVersions,a=t.clientModernVersions.find(e=>o.includes(e));return void 0!==a?{kind:"modern",version:a,discover:r.value}:t.fallbackAvailable?{kind:"legacy"}:{kind:"error",error:new n4({supported:[...o],requested:t.requestedVersion})}}(e.result,t);case"rpc-error":return dT(e,t);case"http-error":return function(e,t){if(401===e.status||403===e.status){let t=403===e.status;return{kind:"error",error:new nP(t?n$.ClientHttpForbidden:n$.ClientHttpAuthentication,`Version negotiation failed: ${t?"the server denied access (HTTP 403)":"the server requires authorization (HTTP 401)"}`,{status:e.status,statusText:e.statusText,text:e.body})}}if(e.status>=500)return{kind:"error",error:new nP(n$.EraNegotiationFailed,`Version negotiation failed: the server answered the probe with HTTP ${e.status}`,{status:e.status,statusText:e.statusText,text:e.body})};let r=function(e){let t;if(void 0===e||""===e)return;try{t=JSON.parse(e)}catch{return}if("object"!=typeof t||null===t)return;let r=t.error;if("object"!=typeof r||null===r)return;let{code:o,message:a,data:i}=r;if("number"==typeof o)return{code:o,message:"string"==typeof a?a:"",data:i}}(e.body);return void 0!==r?dT(r,t):{kind:"legacy"}}(e,t);case"network-error":return dC(e.error,t);case"auth-required":return{kind:"error",error:e.error};case"closed":if("stdio"===t.transportKind)return{kind:"legacy"};return dC(Error("Connection closed during the version negotiation probe"),t);case"timeout":if("stdio"===t.transportKind)return{kind:"legacy"};return{kind:"error",error:new nR(n$.RequestTimeout,`Version negotiation probe timed out after ${e.timeoutMs}ms`,{timeout:e.timeoutMs})}}}(u,{clientModernVersions:i,requestedVersion:r,fallbackAvailable:s,environment:t.environment,transportKind:t.transportKind});switch(d.kind){case"modern":return{era:"modern",version:d.version,discover:d.discover};case"corrective":if(l)throw d.error;l=!0,r=d.version;continue;case"legacy":{let r="closed"===u.kind?"the connection closed during the server/discover probe":void 0;if("pin"===e.kind)throw new nR(n$.EraNegotiationFailed,void 0===r?`Version negotiation failed: the server did not offer pinned protocol version ${e.version} via server/discover (no fallback in pin mode)`:`Version negotiation failed: ${r} before the server offered pinned protocol version ${e.version} (no fallback in pin mode)`);if(!e.fallbackAvailable)throw new nR(n$.EraNegotiationFailed,void 0===r?"Version negotiation failed: the server gave no modern evidence and this client supports no pre-2026-07-28 protocol version to fall back to":`Version negotiation failed: ${r} and this client supports no pre-2026-07-28 protocol version to fall back to`);if(void 0!==r&&!0!==t.disposableProbe)throw new nR(n$.EraNegotiationFailed,`Version negotiation failed: ${r} (this transport probed in place — the disposable sibling probe requires the SDK's base StdioClientTransport)`);return{era:"legacy"}}case"error":throw d.error}}};try{r=await l()}catch(e){throw n.detach(),e}return n.release(),r}async function dq(e,t,r,o){let a,i,s=new t.constructor({...r,stderr:"ignore"}),n=t.close,l=!1,c=new Promise((e,t)=>{a=()=>t(dM())});t.close=async function(){return l=!0,a?.(),n.call(t)};try{let t=dz(e,{...o,transport:s,transportKind:"stdio",disposableProbe:!0});t.catch(()=>{}),i=await Promise.race([t,c])}finally{await dL(s),t.close=n}if(l)throw dM();return i}function dM(){return new nR(n$.EraNegotiationFailed,"Version negotiation failed: the transport was closed during the server/discover probe")}async function dL(e){try{let t=e._dispose;await ("function"==typeof t?t.call(e):e.close())}catch{}}function dU(e){let t=e._meta?.[aR];return lK.Implementation(t)?t:void 0}let dD={"notifications/tools/list_changed":["tools/list"],"notifications/prompts/list_changed":["prompts/list"],"notifications/resources/list_changed":["resources/list","resources/templates/list"]};var dV=class extends lX{_serverCapabilities;_serverVersion;_capabilities;_instructions;_jsonSchemaValidator;_cache;_defaultCacheTtlMs;_listMaxPages;_listChangedDebounceTimers=new Map;_listChangedConfig;_enforceStrictCapabilities;_versionNegotiation;_supportedProtocolVersionsOption;_inputRequiredDriverConfig;_listenState=new Map;_nextListenId=0;_autoOpenedSubscription;_discoverResult;_resetConnectionState(){if(this._negotiatedProtocolVersion=void 0,this._serverCapabilities=void 0,this._serverVersion=void 0,this._instructions=void 0,this._discoverResult=void 0,this._autoOpenedSubscription=void 0,this._listenState.size>0){let e=new nR(n$.ConnectionClosed,"subscriptions/listen: client reconnected or closed; subscription state from the previous connection was reset");for(let t of this._listenState.values())t.settle({cause:"remote",error:e})}for(let e of(this._listenState.clear(),this._listChangedDebounceTimers.values()))clearTimeout(e);this._listChangedDebounceTimers.clear(),this._cache.resetForReconnect()}async close(){try{await super.close()}finally{this._resetConnectionState()}}constructor(e,t){super(t),this._clientInfo=e,this._capabilities=t?.capabilities?{...t.capabilities}:{},this._jsonSchemaValidator=t?.jsonSchemaValidator??new uL,this._enforceStrictCapabilities=t?.enforceStrictCapabilities??!1,this._versionNegotiation=t?.versionNegotiation,this._supportedProtocolVersionsOption=t?.supportedProtocolVersions,this._inputRequiredDriverConfig=function(e){return{autoFulfill:e?.autoFulfill??!0,maxRounds:e?.maxRounds??10}}(t?.inputRequired),this._cache=new dP(t?.responseCacheStore??new dw,t?.responseCacheStore!==void 0,e=>this._reportStoreError(e),t?.cachePartition??""),this._defaultCacheTtlMs=t?.defaultCacheTtlMs??0,this._listMaxPages=t?.listMaxPages??64,t?.listChanged&&(this._listChangedConfig=t.listChanged)}buildContext(e,t){return e}_shouldDropInbound(e){let t;if(void 0!==this._negotiatedProtocolVersion&&this._negotiatedProtocolVersion>=nE&&(t=e,aF.safeParse(t).success))return"drop"}_outboundMetaEnvelope(){let e=this._negotiatedProtocolVersion;if(void 0!==e)return this._wireCodec().outboundEnvelope({protocolVersion:e,clientInfo:this._clientInfo,clientCapabilities:this._capabilities})}_resolveNonCompleteResult(e,t){return this._inputRequiredDriverConfig.autoFulfill?function(e,t,r,o){let{codec:a,request:i,options:s,flowStartedAt:n}=o,l={inputRequests:r.inputRequests,...void 0!==r.requestState&&{requestState:r.requestState}};return lD({config:t,method:i.method,originalParams:i.params,firstPayload:l,flowStartedAt:n,signal:s?.signal,requestOptions:{...s?.timeout!==void 0&&{timeout:s.timeout},...s?.maxTotalTimeout!==void 0&&{maxTotalTimeout:s.maxTotalTimeout},...s?.onprogress!==void 0&&{onprogress:s.onprogress}},hooks:{dispatchInputRequest:(t,r,o)=>l1(e,a,t,r,o),retry:(e,t)=>{var r,a;return o.retry(e,(r=s,a=t,{...r?.signal!==void 0&&{signal:r.signal},...r?.onprogress!==void 0&&{onprogress:r.onprogress},...r?.resetTimeoutOnProgress!==void 0&&{resetTimeoutOnProgress:r.resetTimeoutOnProgress},...r?.headers!==void 0&&{headers:r.headers},...void 0!==a.timeout&&{timeout:a.timeout},...void 0!==a.maxTotalTimeout&&{maxTotalTimeout:a.maxTotalTimeout},allowInputRequired:!0}))}}})}({getRequestHandler:e=>this._getRequestHandler(e),buildContext:e=>this.buildContext(e,void 0),sessionId:this.transport?.sessionId},this._inputRequiredDriverConfig,e,t):Promise.reject(new nR(n$.UnsupportedResultType,`Unsupported result type 'input_required' for ${t.request.method}: multi-round-trip auto-fulfilment is not enabled on this instance — pass allowInputRequired: true to handle it manually, or enable inputRequired.autoFulfill`,{resultType:"input_required",method:t.request.method}))}_setupListChangedHandlers(e){e.tools&&this._serverCapabilities?.tools?.listChanged&&this._setupListChangedHandler("tools","notifications/tools/list_changed",e.tools,async()=>(await this.listTools(void 0,{cacheMode:"refresh"})).tools),e.prompts&&this._serverCapabilities?.prompts?.listChanged&&this._setupListChangedHandler("prompts","notifications/prompts/list_changed",e.prompts,async()=>(await this.listPrompts(void 0,{cacheMode:"refresh"})).prompts),e.resources&&this._serverCapabilities?.resources?.listChanged&&this._setupListChangedHandler("resources","notifications/resources/list_changed",e.resources,async()=>(await this.listResources(void 0,{cacheMode:"refresh"})).resources)}registerCapabilities(e){if(this.transport)throw Error("Cannot register capabilities after connecting to transport");this._capabilities=function(e,t){let r={...e};for(let e in t){let o=t[e];if(void 0===o)continue;let a=r[e];r[e]=lY(a)&&lY(o)?{...a,...o}:o}return r}(this._capabilities,e)}setVersionNegotiation(e){if(this.transport)throw Error("Cannot configure version negotiation after connecting to transport");this._versionNegotiation=e}_wrapHandler(e,t){return"elicitation/create"===e?async(e,r)=>{let o=ld(this._negotiatedProtocolVersion),a=o.validateRequest("elicitation/create",e);if(a.ok||"not-in-era"!==a.reason||(a=o.validateInputRequest("elicitation/create",e)),!a.ok)throw new n1("not-in-era"===a.reason?n0.InternalError:n0.InvalidParams,"not-in-era"===a.reason?"No wire schema for elicitation/create in the resolved era":`Invalid elicitation request: ${a.message}`);let{params:i}=a.value;i.mode=i.mode??"form";let{supportsFormMode:s,supportsUrlMode:n}=function(e){if(!e)return{supportsFormMode:!1,supportsUrlMode:!1};let t=void 0!==e.form,r=void 0!==e.url;return{supportsFormMode:t||!t&&!r,supportsUrlMode:r}}(this._capabilities.elicitation);if("form"===i.mode&&!s)throw new n1(n0.InvalidParams,"Client does not support form-mode elicitation requests");if("url"===i.mode&&!n)throw new n1(n0.InvalidParams,"Client does not support URL-mode elicitation requests");let l=await t(e,r),c=o.validateResult("elicitation/create",l);if(c.ok||"not-in-era"!==c.reason||(c=o.validateInputResponse("elicitation/create",l)),!c.ok)throw new n1("not-in-era"===c.reason?n0.InternalError:n0.InvalidParams,"not-in-era"===c.reason?"No wire schema for elicitation/create in the resolved era":`Invalid elicitation result: ${c.message}`);let u=c.value,d="form"===i.mode?i.requestedSchema:void 0;if("form"===i.mode&&"accept"===u.action&&u.content&&d&&this._capabilities.elicitation?.form?.applyDefaults)try{!function e(t,r){if(t&&null!==r&&"object"==typeof r){if("object"===t.type&&t.properties&&"object"==typeof t.properties){let o=t.properties;for(let t of Object.keys(o)){let a=o[t];void 0===r[t]&&Object.prototype.hasOwnProperty.call(a,"default")&&(r[t]=a.default),void 0!==r[t]&&e(a,r[t])}}if(Array.isArray(t.anyOf))for(let o of t.anyOf)"boolean"!=typeof o&&e(o,r);if(Array.isArray(t.oneOf))for(let o of t.oneOf)"boolean"!=typeof o&&e(o,r)}}(d,u.content)}catch{}return u}:"sampling/createMessage"===e?async(e,r)=>{let o=ld(this._negotiatedProtocolVersion),a=o.validateRequest("sampling/createMessage",e);if(a.ok||"not-in-era"!==a.reason||(a=o.validateInputRequest("sampling/createMessage",e)),!a.ok)throw new n1("not-in-era"===a.reason?n0.InternalError:n0.InvalidParams,"not-in-era"===a.reason?"No wire schema for sampling/createMessage in the resolved era":`Invalid sampling request: ${a.message}`);let{params:i}=a.value,s=await t(e,r),n=!!(i.tools||i.toolChoice),l=o.samplingResultVariant(n,s);if(l.ok||"not-in-era"!==l.reason||(l=o.validateInputResponse("sampling/createMessage",s)),!l.ok)throw new n1("not-in-era"===l.reason?n0.InternalError:n0.InvalidParams,"not-in-era"===l.reason?"No result schema for sampling/createMessage in the resolved era":`Invalid sampling result: ${l.message}`);return l.value}:t}assertCapability(e,t){if(!this._serverCapabilities?.[e])throw new nR(n$.CapabilityNotSupported,`Server does not support ${e} (required for ${t})`)}async connect(e,t){if(t?.prior!=null)return this._connectFromPrior(e,function(e){if("object"==typeof e&&null!==e&&("legacy"===e.kind&&!("supportedVersions"in e)&&!("discover"in e)||"modern"===e.kind&&ia.safeParse(e.discover).success))return e;throw new nR(n$.EraNegotiationFailed,"connect({ prior }): unrecognized prior — expected { kind: 'modern', discover } or { kind: 'legacy' }")}(t.prior),t);let r=function(e,t){let r=e?.mode??"legacy";if("legacy"===r)return{kind:"legacy"};let o=e?.probe??{};if("object"==typeof r){if(!(r.pin>=nE))throw TypeError(`versionNegotiation: { pin: '${r.pin}' } is not a modern protocol revision — pinning is for 2026-07-28 and later; omit versionNegotiation (or use mode: 'legacy') for 2025-era servers.`);return{kind:"pin",version:r.pin,probe:o}}let a=t?nT(t):[];return{kind:"auto",modernVersions:a.length>0?a:[...nk],fallbackAvailable:!t||nx(t).length>0,probe:o}}(this._versionNegotiation,this._supportedProtocolVersionsOption);return"legacy"!==r.kind?this._connectNegotiated(e,r,t):this._connectPlainLegacy(e,t)}async _connectPlainLegacy(e,t){if(await super.connect(e),void 0!==e.sessionId){let t=this._negotiatedProtocolVersion;void 0!==t&&e.setProtocolVersion?.(t);return}this._resetConnectionState(),await this._legacyHandshake(e,t)}async _legacyHandshake(e,t){let r=nx(this._supportedProtocolVersions);try{let o=r[0];if(void 0===o)throw new nR(n$.EraNegotiationFailed,"Cannot run the initialize handshake: supportedProtocolVersions contains no pre-2026-07-28 protocol version");let a=await this.request({method:"initialize",params:{protocolVersion:o,capabilities:this._capabilities,clientInfo:this._clientInfo}},t);if(void 0===a)throw Error(`Server sent invalid initialize result: ${a}`);if(!r.includes(a.protocolVersion))throw Error(`Server's protocol version is not supported: ${a.protocolVersion}`);this._serverCapabilities=a.capabilities,this._serverVersion=a.serverInfo,this._cache.setServerIdentity(this._deriveServerIdentity(e)),e.setProtocolVersion&&e.setProtocolVersion(a.protocolVersion),this._instructions=a.instructions,await this.notification({method:"notifications/initialized"}),this._negotiatedProtocolVersion=a.protocolVersion,this._listChangedConfig&&this._setupListChangedHandlers(this._listChangedConfig)}catch(e){throw this.close(),e}}async _connectNegotiated(e,t,r){let o;if(void 0!==e.sessionId){await super.connect(e);let t=this._negotiatedProtocolVersion;void 0!==t&&e.setProtocolVersion&&e.setProtocolVersion(t);return}this._resetConnectionState();try{let a=dj(e),i={clientInfo:this._clientInfo,capabilities:this._capabilities,environment:dO(),defaultTimeoutMs:r?.timeout??6e4},s="stdio"===a?function(e){let t=Object.getPrototypeOf(e);if(null===t||!Object.prototype.hasOwnProperty.call(t,"_dispose"))return;let r=e._serverParams;return"object"==typeof r&&null!==r&&"string"==typeof r.command?r:void 0}(e):void 0;o=void 0===s?await dz(t,{...i,transport:e,transportKind:a}):await dq(t,e,s,i)}catch(t){throw await e.close().catch(()=>{}),dA(e),t}if(dA(e),await super.connect(e),"legacy"===o.era)return void await this._legacyHandshake(e,r);if(this._serverCapabilities=o.discover.capabilities,this._serverVersion=dU(o.discover),this._cache.setServerIdentity(this._deriveServerIdentity(e)),this._instructions=o.discover.instructions,this._discoverResult=o.discover,this._negotiatedProtocolVersion=o.version,e.setProtocolVersion&&e.setProtocolVersion(o.version),this._listChangedConfig){let e=this._listChangedConfig,t=this._serverCapabilities,o={...e.tools&&t?.tools?.listChanged&&{tools:e.tools},...e.prompts&&t?.prompts?.listChanged&&{prompts:e.prompts},...e.resources&&t?.resources?.listChanged&&{resources:e.resources}},a=!0;try{this._setupListChangedHandlers(o)}catch(e){a=!1,this.onerror?.(e instanceof Error?e:Error(String(e)))}let i=a?{...o.tools&&{toolsListChanged:!0},...o.prompts&&{promptsListChanged:!0},...o.resources&&{resourcesListChanged:!0}}:{};if(Object.keys(i).length>0){let e=new AbortController,t=()=>e.abort(r?.signal?.reason);r?.signal?.aborted&&t(),r?.signal?.addEventListener("abort",t);try{this._autoOpenedSubscription=await this.listen(i,{timeout:r?.timeout,signal:e.signal})}catch(e){if(r?.signal?.aborted)throw await this.close().catch(()=>{}),e;this.onerror?.(e instanceof Error?e:Error(String(e)))}finally{r?.signal?.removeEventListener("abort",t)}}}}async _connectFromPrior(e,t,r){if("legacy"===t.kind)return this._connectPlainLegacy(e,r);let o=t.discover;this._resetConnectionState();let a=this._supportedProtocolVersionsOption,i=(a&&nT(a).length>0?nT(a):nk).find(e=>o.supportedVersions.includes(e));if(void 0===i)throw new nR(n$.EraNegotiationFailed,"connect({ prior }) with a modern verdict requires a 2026-07-28+ mutual protocol version; the supplied DiscoverResult and this client's supportedProtocolVersions have no modern overlap. For a server known to be legacy, pass prior: { kind: 'legacy' } to skip the probe and initialize directly, or use versionNegotiation: { mode: 'auto' } to re-probe with legacy fallback.");if(await super.connect(e),this._discoverResult=o,this._serverCapabilities=o.capabilities,this._serverVersion=dU(o),this._cache.setServerIdentity(this._deriveServerIdentity(e)),this._instructions=o.instructions,this._negotiatedProtocolVersion=i,e.setProtocolVersion?.(i),this._listChangedConfig)try{this._setupListChangedHandlers(this._listChangedConfig)}catch(e){this.onerror?.(e instanceof Error?e:Error(String(e)))}}getServerCapabilities(){return this._serverCapabilities}getServerVersion(){return this._serverVersion}_deriveServerIdentity(e){let t=this._serverVersion;return void 0!==t?`${t.name}@${t.version}`:e.sessionId??`anonymous:${Date.now()}-${Math.random().toString(36).slice(2)}`}getNegotiatedProtocolVersion(){return this._negotiatedProtocolVersion}getProtocolEra(){let e=this._negotiatedProtocolVersion;if(void 0!==e)return e>=nE?"modern":"legacy"}getInstructions(){return this._instructions}getDiscoverResult(){return this._discoverResult}assertCapabilityForMethod(e){switch(e){case"logging/setLevel":if(!this._serverCapabilities?.logging)throw new nR(n$.CapabilityNotSupported,`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._serverCapabilities?.prompts)throw new nR(n$.CapabilityNotSupported,`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(!this._serverCapabilities?.resources)throw new nR(n$.CapabilityNotSupported,`Server does not support resources (required for ${e})`);if("resources/subscribe"===e&&!this._serverCapabilities.resources.subscribe)throw new nR(n$.CapabilityNotSupported,`Server does not support resource subscriptions (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._serverCapabilities?.tools)throw new nR(n$.CapabilityNotSupported,`Server does not support tools (required for ${e})`);break;case"completion/complete":if(!this._serverCapabilities?.completions)throw new nR(n$.CapabilityNotSupported,`Server does not support completions (required for ${e})`)}}assertNotificationCapability(e){if("notifications/roots/list_changed"===e&&!this._capabilities.roots?.listChanged)throw new nR(n$.CapabilityNotSupported,`Client does not support roots list changed notifications (required for ${e})`)}assertRequestHandlerCapability(e){switch(e){case"sampling/createMessage":if(!this._capabilities.sampling)throw new nR(n$.CapabilityNotSupported,`Client does not support sampling capability (required for ${e})`);break;case"elicitation/create":if(!this._capabilities.elicitation)throw new nR(n$.CapabilityNotSupported,`Client does not support elicitation capability (required for ${e})`);break;case"roots/list":if(!this._capabilities.roots)throw new nR(n$.CapabilityNotSupported,`Client does not support roots capability (required for ${e})`)}}async ping(e){return this.request({method:"ping"},e)}async discover(e){let t=await this._requestWithSchema({method:"server/discover"},ia,e);return this._discoverResult=t,t}async complete(e,t){return this.request({method:"completion/complete",params:e},t)}async setLoggingLevel(e,t){return this.request({method:"logging/setLevel",params:{level:e}},t)}async getPrompt(e,t){return this.request({method:"prompts/get",params:e},t)}async listPrompts(e,t){if(!this._serverCapabilities?.prompts&&!this._enforceStrictCapabilities)return console.debug("Client.listPrompts() called but server does not advertise prompts capability - returning empty list"),{prompts:[]};if(e?.cursor!==void 0)return this.request({method:"prompts/list",params:e},t);let r=await this._serveFromCache("prompts/list",void 0,t);return void 0!==r?r:this._listAllPages("prompts/list",e,t,(e,t)=>e.prompts.push(...t.prompts))}async listResources(e,t){if(!this._serverCapabilities?.resources&&!this._enforceStrictCapabilities)return console.debug("Client.listResources() called but server does not advertise resources capability - returning empty list"),{resources:[]};if(e?.cursor!==void 0)return this.request({method:"resources/list",params:e},t);let r=await this._serveFromCache("resources/list",void 0,t);return void 0!==r?r:this._listAllPages("resources/list",e,t,(e,t)=>e.resources.push(...t.resources))}async listResourceTemplates(e,t){if(!this._serverCapabilities?.resources&&!this._enforceStrictCapabilities)return console.debug("Client.listResourceTemplates() called but server does not advertise resources capability - returning empty list"),{resourceTemplates:[]};if(e?.cursor!==void 0)return this.request({method:"resources/templates/list",params:e},t);let r=await this._serveFromCache("resources/templates/list",void 0,t);return void 0!==r?r:this._listAllPages("resources/templates/list",e,t,(e,t)=>e.resourceTemplates.push(...t.resourceTemplates))}async _listAllPages(e,t,r,o,a){let i=r?.cacheMode==="bypass",s=this._cache.captureGeneration(e),n=await this.request({method:e,...t&&{params:{...t}}},r),l=n.nextCursor,c=new Set,u=1;for(;void 0!==l&&!c.has(l);){if(0!==this._listMaxPages&&u>=this._listMaxPages)throw new nR(n$.ListPaginationExceeded,`${e}: exceeded listMaxPages (${this._listMaxPages}); server pagination did not terminate`,{method:e,listMaxPages:this._listMaxPages});c.add(l);let a=await this.request({method:e,params:{...t,cursor:l}},r);o(n,a),l=a.nextCursor,u++}return delete n.nextCursor,a?.(n),i||await this._cache.write(e,n,s,this._freshness(n)),n}_freshness(e,t){let r="number"==typeof e.ttlMs?e.ttlMs:this._defaultCacheTtlMs,o="public"===e.cacheScope?"public":"private";return{expiresAt:this._cache.now()+Math.min(Math.max(0,r),864e5),scope:o,params:t}}async _serveFromCache(e,t,r){if(r?.cacheMode==="bypass"||r?.cacheMode==="refresh")return;let o=await this._cache.read(e,t).catch(e=>void this._reportStoreError(e));if(void 0!==o){if(r?.signal?.aborted){let e=r.signal.reason;throw e instanceof nR?e:new nR(n$.RequestTimeout,String(e))}return o.value}}_reportStoreError(e){this.onerror?.(e instanceof Error?e:Error(String(e)))}_compileOutputValidator(e){if(e.outputSchema)try{return{ok:!0,validator:this._jsonSchemaValidator.getValidator(e.outputSchema)}}catch(e){return{ok:!1,compileError:e}}}async _resolveXMcpHeaderScan(e,t){let r=t??await this._cache.toolDefinition(e);return void 0===r?void 0:l$(r.inputSchema)}async readResource(e,t){let r=await this._serveFromCache("resources/read",e.uri,t);if(void 0!==r)return r;let o=this._cache.captureGeneration("resources/read",e.uri),a=await this.request({method:"resources/read",params:e},t);if(t?.cacheMode!=="bypass"){let r=this._freshness(a,e.uri);r.expiresAt>this._cache.now()?await this._cache.write("resources/read",a,o,r):t?.cacheMode==="refresh"&&await this._cache.evictKey("resources/read",e.uri)}return a}async subscribeResource(e,t){return this.request({method:"resources/subscribe",params:e},t)}async unsubscribeResource(e,t){return this.request({method:"resources/unsubscribe",params:e},t)}async listen(e,t){let r,o,a,i,s;if(void 0===this.transport)throw new nR(n$.NotConnected,"Not connected");let n=this._negotiatedProtocolVersion;if(void 0===n||!(n>=nE))throw new nR(n$.MethodNotSupportedByProtocolVersion,`subscriptions/listen requires a 2026-07-28-era connection (negotiated: ${n??"none"}). On a 2025-era connection, change notifications are delivered unsolicited: use ClientOptions.listChanged and resources/subscribe instead.`,{method:"subscriptions/listen",protocolVersion:n});if(t?.signal?.aborted){let e=t.signal.reason;throw e instanceof nR?e:new nR(n$.RequestTimeout,String(e))}let l=new AbortController,c=`listen:${this._nextListenId++}`,u="opening",d=new Promise((e,t)=>{a=e,i=t}),p=new Promise(e=>{s=e}),h=e=>{if("closed"===u)return;let n="opening"===u;if(void 0!==r&&(clearTimeout(r),r=void 0),"ack"in e){u="open",a(e.ack);return}u="closed",void 0!==o&&t?.signal?.removeEventListener("abort",o),this._listenState.delete(c),l.abort(),s(e.cause),n&&i(e.error??new nR(n$.ConnectionClosed,"subscriptions/listen closed before the server acknowledged"))},m=async()=>{l.abort(),await this.notification({method:"notifications/cancelled",params:{requestId:c}}).catch(()=>{})},f=async()=>{"closed"!==u&&(h({cause:"local"}),await m())};this._listenState.set(c,{settle:h});let y=t?.timeout??6e4;if(r=setTimeout(()=>{h({cause:"remote",error:new nR(n$.RequestTimeout,"subscriptions/listen ack timed out",{timeout:y})}),m().catch(()=>{})},y),t?.signal){let e=t.signal;o=()=>{if("closed"===u)return;let t=e.reason;h({cause:"local",error:t instanceof Error?t:Error(String(t??"Aborted"))}),m().catch(()=>{})},e.addEventListener("abort",o,{once:!0})}let g={jsonrpc:"2.0",id:c,method:"subscriptions/listen",params:{_meta:{...this._outboundMetaEnvelope()},notifications:e}};try{await this.transport.send(g,{requestSignal:l.signal,onRequestStreamEnd:()=>h({cause:"remote",error:Error("subscriptions/listen: stream ended")})})}catch(e){h({cause:"remote",error:e instanceof Error?e:Error(String(e))})}return{honoredFilter:await d,close:f,closed:p}}get autoOpenedSubscription(){return this._autoOpenedSubscription}_onnotification(e,t){let r=Object.hasOwn(dD,e.method)?dD[e.method]:void 0;if("notifications/resources/updated"===e.method){let t=e.params?.uri;"string"==typeof t&&this._cache.evictKey("resources/read",t)}else if(void 0!==r)for(let e of r)this._cache.evict(e);if("notifications/subscriptions/acknowledged"===e.method){let t=e.params?._meta?.[aE],r="string"==typeof t?this._listenState.get(t):void 0;if(void 0!==r){let t=this._wireCodec().validateNotification("notifications/subscriptions/acknowledged",e);r.settle({ack:t.ok?t.value.params.notifications:{}});return}}if("notifications/cancelled"===e.method){let t=e.params?.requestId,r="string"==typeof t?this._listenState.get(t):void 0;if(void 0!==r)return void r.settle({cause:"remote",error:Error("subscriptions/listen: server cancelled the subscription")})}super._onnotification(e,t)}_onresponse(e){let t=e.id,r="string"==typeof t?this._listenState.get(t):void 0;void 0!==r?lv(e)?r.settle({cause:"remote",error:n1.fromError(e.error.code,e.error.message,e.error.data)}):r.settle({cause:"graceful",error:new nR(n$.ConnectionClosed,"subscriptions/listen: server closed the subscription gracefully before acknowledging")}):super._onresponse(e)}_onclose(){if(this._listenState.size>0){let e=new nR(n$.ConnectionClosed,"Connection closed");for(let t of this._listenState.values())t.settle({cause:"remote",error:e});this._listenState.clear()}super._onclose()}async callTool(e,t){let r,o="modern"===this.getProtocolEra()&&"browser"!==dO(),a=async()=>{let r;if(!o)return t;try{r=await this._resolveXMcpHeaderScan(e.name,t?.toolDefinition)}catch(e){this._reportStoreError(e)}if(!r?.valid||0===r.declarations.length)return t;let a=function(e,t){let r={};for(let o of e){let e=function(e,t){let r=e;for(let e of t){if(null===r||"object"!=typeof r)return;r=r[e]}return r}(t,o.path);if(null==e)continue;let a=function(e){if("string"==typeof e)return e;if("boolean"==typeof e)return e?"true":"false";if("number"==typeof e){if(!Number.isFinite(e)||Number.isInteger(e)&&!Number.isSafeInteger(e))return;return String(e)}}(e);void 0!==a&&(r[`Mcp-Param-${o.headerName}`]=lx(a))}return r}(r.declarations,e.arguments);return 0===Object.keys(a).length?t:{...t,headers:{...t?.headers,...a}}},i=t?.toolDefinition===void 0?await this._cache.outputValidator(e.name,e=>this._compileOutputValidator(e)).catch(e=>void this._reportStoreError(e)):this._compileOutputValidator(t.toolDefinition),s=()=>{if(void 0===i||i.ok)return;let t=i.compileError,r=(t instanceof Error?t.message:String(t)).slice(0,200);throw new n1(n0.InvalidParams,`Tool '${e.name}' has an invalid outputSchema: ${r}`)};s();try{r=await this.request({method:"tools/call",params:e},await a())}catch(c){let n=c instanceof n1&&-32020===c.code;if(!o||!n||t?.toolDefinition!==void 0)throw c;let l={signal:t?.signal,timeout:t?.timeout,cacheMode:"refresh"};await this._cache.evict("tools/list"),await this.listTools(void 0,l).catch(e=>this._reportStoreError(e)),i=await this._cache.outputValidator(e.name,e=>this._compileOutputValidator(e)).catch(e=>void this._reportStoreError(e)),s(),r=await this.request({method:"tools/call",params:e},await a())}let n=void 0!==i&&i.ok?i.validator:void 0;if(n){if(void 0===r.structuredContent&&!r.isError)throw new n1(n0.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`);if(void 0!==r.structuredContent&&!r.isError)try{let e=n(r.structuredContent);if(!e.valid)throw new n1(n0.InvalidParams,`Structured content does not match the tool's output schema: ${e.errorMessage}`)}catch(e){if(e instanceof n1)throw e;throw new n1(n0.InvalidParams,`Failed to validate structured content: ${e instanceof Error?e.message:String(e)}`)}}return r}async listTools(e,t){if(!this._serverCapabilities?.tools&&!this._enforceStrictCapabilities)return console.debug("Client.listTools() called but server does not advertise tools capability - returning empty list"),{tools:[]};if(e?.cursor!==void 0){let r=await this.request({method:"tools/list",params:e},t);return this._excludeInvalidXMcpHeaderTools(r),r}let r=await this._serveFromCache("tools/list",void 0,t);return void 0!==r?r:this._listAllPages("tools/list",e,t,(e,t)=>e.tools.push(...t.tools),e=>this._excludeInvalidXMcpHeaderTools(e))}_excludeInvalidXMcpHeaderTools(e){if("modern"!==this.getProtocolEra()||!this.transport||"stdio"===dj(this.transport))return;let t=e.tools.filter(e=>{let t=l$(e.inputSchema);return!!t.valid||(console.warn(`[mcp-sdk] excluding tool '${e.name}' from tools/list: invalid x-mcp-header declaration — ${t.reason}`),!1)});t.length!==e.tools.length&&(e.tools=t)}_setupListChangedHandler(e,t,r,o){let a=r7(so,r);if(!a.success)throw Error(`Invalid ${e} listChanged options: ${a.error.message}`);if("function"!=typeof r.onChanged)throw TypeError(`Invalid ${e} listChanged options: onChanged must be a function`);let{autoRefresh:i,debounceMs:s}=a.data,{onChanged:n}=r,l=async()=>{if(!i)return void n(null,null);try{n(null,await o())}catch(e){n(e instanceof Error?e:Error(String(e)),null)}},c=()=>{if(s){let t=this._listChangedDebounceTimers.get(e);t&&clearTimeout(t);let r=setTimeout(l,s);this._listChangedDebounceTimers.set(e,r)}else l()};this.setNotificationHandler(t,c)}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}};(class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SseError"})}static[Symbol.hasInstance](e){return nb(this,e)}static isInstance(e){if("function"!=typeof this)throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return nb(this,e)}constructor(e,t,r){super(`SSE error: ${t}`),this.code=e,this.event=r,n_(this,new.target)}});let dH={initialReconnectionDelay:1e3,maxReconnectionDelay:3e4,reconnectionDelayGrowFactor:1.5,maxRetries:2},dF=new Set(["authorization","content-type","mcp-protocol-version","mcp-method","mcp-name","mcp-session-id"]);function dK(e,t){if("function"==typeof AbortSignal.any)return AbortSignal.any([e,t]);let r=new AbortController;if(e.aborted)return r.abort(e.reason),r.signal;if(t.aborted)return r.abort(t.reason),r.signal;let o=()=>{e.removeEventListener("abort",a),t.removeEventListener("abort",i)};function a(){o(),r.abort(e.reason)}function i(){o(),r.abort(t.reason)}return e.addEventListener("abort",a,{once:!0}),t.addEventListener("abort",i,{once:!0}),r.signal}var dJ=class{_abortController;_url;_resourceMetadataUrl;_scope;_requestInit;_authProvider;_oauthProvider;_skipIssuerMetadataValidation;_fetch;_fetchWithInit;_sessionId;_reconnectionOptions;_protocolVersion;_onInsufficientScope;_maxStepUpRetries;_serverRetryMs;_reconnectionScheduler;_cancelReconnection;onclose;onerror;onmessage;hasPerRequestStream=!0;constructor(e,t){this._url=e,this._resourceMetadataUrl=void 0,this._scope=void 0,this._requestInit=t?.requestInit,this._skipIssuerMetadataValidation=t?.skipIssuerMetadataValidation,function(e){return null!=e&&"function"==typeof e.tokens&&"function"==typeof e.clientInformation}(t?.authProvider)?(this._oauthProvider=t.authProvider,this._authProvider=function(e,t){return{token:async()=>(await e.tokens())?.access_token,onUnauthorized:async r=>u4(e,r,t)}}(t.authProvider,{skipIssuerMetadataValidation:t.skipIssuerMetadataValidation})):this._authProvider=t?.authProvider,this._fetch=t?.fetch,this._fetchWithInit=function(e=fetch,t){return t?async(r,o)=>e(r,{...t,...o,headers:o?.headers?{...l4(t.headers),...l4(o.headers)}:t.headers}):e}(t?.fetch,t?.requestInit),this._sessionId=t?.sessionId,this._protocolVersion=t?.protocolVersion,this._reconnectionOptions=t?.reconnectionOptions??dH,this._reconnectionScheduler=t?.reconnectionScheduler,this._onInsufficientScope=t?.onInsufficientScope??"reauthorize",this._maxStepUpRetries=Math.max(0,t?.maxStepUpRetries??1)}async _stepUpAuthorize(e,t){try{return await this._stepUpAuthorizeInner(e,t)}catch(e){throw dk(e)}}async _stepUpAuthorizeInner(e,t){if("throw"===this._onInsufficientScope||!this._oauthProvider)throw new u1({requiredScope:e.scope,resourceMetadataUrl:e.resourceMetadataUrl,errorDescription:e.errorDescription});if(t>=this._maxStepUpRetries)throw new nP(n$.ClientHttpForbidden,`Server returned 403 insufficient_scope after step-up re-authorization (retry limit ${this._maxStepUpRetries} reached)`,{status:403,statusText:e.statusText??"Forbidden",text:e.text});e.resourceMetadataUrl&&(this._resourceMetadataUrl=e.resourceMetadataUrl);let r=await this._oauthProvider.tokens(),o=u8(this._scope,r?.scope,e.scope);this._scope=o;let a=function(e,t){if(!e)return!1;let r=new Set((t??"").split(/\s+/).filter(Boolean));for(let t of e.split(/\s+/))if(t&&!r.has(t))return!0;return!1}(o,r?.scope);return di(this._oauthProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:o,forceReauthorization:a,fetchFn:this._fetchWithInit,skipIssuerMetadataValidation:this._skipIssuerMetadataValidation})}async _commonHeaders(){let e,t={};try{e=await this._authProvider?.token()}catch(e){throw dk(e)}e&&(t.Authorization=`Bearer ${e}`),this._sessionId&&(t["mcp-session-id"]=this._sessionId),this._protocolVersion&&(t["mcp-protocol-version"]=this._protocolVersion);let r=l4(this._requestInit?.headers);return new Headers({...t,...r})}_applyBodyDerivedHeaders(e,t){let r;if(Array.isArray(t)||(r=t,!aF.safeParse(r).success))return;let o=t.params?._meta?.[aw];if("string"!=typeof o)return;e.set("mcp-protocol-version",o),e.set("mcp-method",t.method);let a=t.params,i="resources/read"===t.method?"string"==typeof a?.uri?a.uri:void 0:"string"==typeof a?.name?a.name:void 0;void 0!==i&&e.set("mcp-name",lx(i))}_isModernEnvelopedRequest(e){let t;if(Array.isArray(e)||(t=e,!aF.safeParse(t).success))return!1;let r=e.params?._meta?.[aw];return"string"==typeof r&&r>=nE}async _startOrAuthSse(e,t=!1,r=0){let{resumptionToken:o,requestSignal:a}=e,i=()=>this._abortController?.signal.aborted===!0||a?.aborted===!0;try{let i=await this._commonHeaders(),s=[...i.get("accept")?.split(",").map(e=>e.trim().toLowerCase())??[],"text/event-stream"];i.set("accept",[...new Set(s)].join(", ")),o&&i.set("last-event-id",o);let n=this._abortController?.signal,l=void 0!==a&&void 0!==n?dK(n,a):a??n,c=await (this._fetch??fetch)(this._url,{...this._requestInit,method:"GET",headers:i,signal:l});if(!c.ok){if(401===c.status&&this._authProvider){if(c.headers.has("www-authenticate")){let{resourceMetadataUrl:e,scope:t}=dl(c);this._resourceMetadataUrl=e,this._scope=u8(this._scope,t)}if(this._authProvider.onUnauthorized&&!t){try{await this._authProvider.onUnauthorized({response:c,serverUrl:this._url,fetchFn:this._fetchWithInit})}catch(e){throw dk(e)}return await c.text?.().catch(()=>{}),this._startOrAuthSse(e,!0,r)}if(await c.text?.().catch(()=>{}),t)throw dk(new nP(n$.ClientHttpAuthentication,"Server returned 401 after re-authentication",{status:401,statusText:c.statusText}));throw dk(new u5)}if(403===c.status){let{resourceMetadataUrl:o,scope:a,error:i,errorDescription:s}=dl(c);if("insufficient_scope"===i){let i=await c.text?.().catch(()=>null);if(await this._stepUpAuthorize({scope:a,resourceMetadataUrl:o,errorDescription:s,statusText:c.statusText,text:i},r)!=="AUTHORIZED")throw dk(new u5);return this._startOrAuthSse(e,t,r+1)}}if(await c.text?.().catch(()=>{}),405===c.status)return void e.onRequestStreamEnd?.();throw new nP(n$.ClientHttpFailedToOpenStream,`Failed to open SSE stream: ${c.statusText}`,{status:c.status,statusText:c.statusText})}this._handleSseStream(c.body,e,!0)}catch(e){throw i()||this.onerror?.(e),e}}_getNextReconnectionDelay(e){if(void 0!==this._serverRetryMs)return this._serverRetryMs;let t=this._reconnectionOptions.initialReconnectionDelay,r=this._reconnectionOptions.reconnectionDelayGrowFactor;return Math.min(t*Math.pow(r,e),this._reconnectionOptions.maxReconnectionDelay)}_scheduleReconnection(e,t=0){let r=this._reconnectionOptions.maxRetries;if(t>=r){this.onerror?.(Error(`Maximum reconnection attempts (${r}) exceeded.`)),e.onRequestStreamEnd?.();return}let o=this._getNextReconnectionDelay(t),a=()=>{this._cancelReconnection=void 0,this._abortController?.signal.aborted||e.requestSignal?.aborted||this._startOrAuthSse(e).catch(r=>{if(!(this._abortController?.signal.aborted||e.requestSignal?.aborted)){this.onerror?.(Error(`Failed to reconnect SSE stream: ${r instanceof Error?r.message:String(r)}`));try{this._scheduleReconnection(e,t+1)}catch(e){this.onerror?.(e instanceof Error?e:Error(String(e)))}}})};if(this._reconnectionScheduler){let e=this._reconnectionScheduler(a,o,t);this._cancelReconnection="function"==typeof e?e:void 0}else{let e=setTimeout(a,o);this._cancelReconnection=()=>clearTimeout(e)}}_handleSseStream(e,t,r){let o;if(!e)return void t.onRequestStreamEnd?.();let{onresumptiontoken:a,replayMessageId:i,requestSignal:s,onRequestStreamEnd:n}=t,l=()=>this._abortController?.signal.aborted===!0||s?.aborted===!0,c=!1,u=!1;(async()=>{try{let t=e.pipeThrough(new TextDecoderStream).pipeThrough(new uB({onRetry:e=>{this._serverRetryMs=e}})).getReader();for(;;){let{value:e,done:r}=await t.read();if(r)break;if((e.id&&(o=e.id,c=!0,a?.(e.id)),e.data)&&(!e.event||"message"===e.event))try{let t=aW.parse(JSON.parse(e.data));(lg(t)||lv(t))&&(u=!0,void 0!==i&&(t.id=i)),this.onmessage?.(t)}catch(e){this.onerror?.(e)}}(r||c)&&!u&&this._abortController&&!l()?this._scheduleReconnection({resumptionToken:o,onresumptiontoken:a,replayMessageId:i,requestSignal:s,onRequestStreamEnd:n},0):l()||n?.()}catch(e){if(l())return;if(this.onerror?.(Error(`SSE stream disconnected: ${e}`)),(r||c)&&!u&&this._abortController&&!l())try{this._scheduleReconnection({resumptionToken:o,onresumptiontoken:a,replayMessageId:i,requestSignal:s,onRequestStreamEnd:n},0)}catch(e){this.onerror?.(Error(`Failed to reconnect: ${e instanceof Error?e.message:String(e)}`)),n?.()}else n?.()}})()}async start(){if(this._abortController)throw Error("StreamableHTTPClientTransport already started! If using Client class, note that connect() calls start() automatically.");this._abortController=new AbortController}async finishAuth(e,t){if(!this._oauthProvider)throw new u5("finishAuth requires an OAuthClientProvider");let{authorizationCode:r,iss:o}=await u7(e,t,this._oauthProvider,this._url,{fetchFn:this._fetchWithInit,resourceMetadataUrl:this._resourceMetadataUrl});if(await di(this._oauthProvider,{serverUrl:this._url,authorizationCode:r,iss:o,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit,skipIssuerMetadataValidation:this._skipIssuerMetadataValidation})!=="AUTHORIZED")throw new u5("Failed to authorize")}async close(){try{this._cancelReconnection?.()}finally{this._cancelReconnection=void 0,this._abortController?.abort(),this.onclose?.()}}async send(e,t){return this._send(e,t,!1)}async _send(e,t,r,o=0){try{let a,{resumptionToken:i,onresumptiontoken:s}=t||{};if(i){let r;return void this._startOrAuthSse({resumptionToken:i,replayMessageId:(r=e,aF.safeParse(r).success)?e.id:void 0,requestSignal:t?.requestSignal}).catch(e=>this.onerror?.(e))}let n=await this._commonHeaders();this._applyBodyDerivedHeaders(n,e);let l=Array.isArray(e)?e.some(e=>{let t;return t=e,a7.safeParse(t).success}):(a=e,a7.safeParse(a).success);if(l&&n.delete("mcp-session-id"),t?.headers!==void 0)for(let[e,r]of Object.entries(t.headers))dF.has(e.toLowerCase())||n.set(e,r);n.set("content-type","application/json");let c=[...n.get("accept")?.split(",").map(e=>e.trim().toLowerCase())??[],"application/json","text/event-stream"];n.set("accept",[...new Set(c)].join(", "));let u=this._abortController?.signal,d=t?.requestSignal!==void 0&&void 0!==u?dK(u,t.requestSignal):t?.requestSignal??u,p={...this._requestInit,method:"POST",headers:n,body:JSON.stringify(e),signal:d},h=await (this._fetch??fetch)(this._url,p);if(l&&h.ok&&(this._sessionId=h.headers.get("mcp-session-id")||void 0),!h.ok){if(401===h.status&&this._authProvider){if(h.headers.has("www-authenticate")){let{resourceMetadataUrl:e,scope:t}=dl(h);this._resourceMetadataUrl=e,this._scope=u8(this._scope,t)}if(this._authProvider.onUnauthorized&&!r){try{await this._authProvider.onUnauthorized({response:h,serverUrl:this._url,fetchFn:this._fetchWithInit})}catch(e){throw dk(e)}return await h.text?.().catch(()=>{}),this._send(e,t,!0,o)}if(await h.text?.().catch(()=>{}),r)throw dk(new nP(n$.ClientHttpAuthentication,"Server returned 401 after re-authentication",{status:401,statusText:h.statusText}));throw dk(new u5)}let a=await h.text?.().catch(()=>null);if(403===h.status){let{resourceMetadataUrl:i,scope:s,error:n,errorDescription:l}=dl(h);if("insufficient_scope"===n){if(await this._stepUpAuthorize({scope:s,resourceMetadataUrl:i,errorDescription:l,statusText:h.statusText,text:a},o)!=="AUTHORIZED")throw dk(new u5);return this._send(e,t,r,o+1)}}if(400===h.status&&"string"==typeof a&&this._isModernEnvelopedRequest(e))try{let t=aW.parse(JSON.parse(a)),r=(Array.isArray(e)?e:[e]).filter(e=>{let t;return t=e,aF.safeParse(t).success});if(lv(t)&&r.some(e=>e.id===t.id))return void this.onmessage?.(t)}catch{}throw new nP(n$.ClientHttpNotImplemented,`Error POSTing to endpoint: ${a}`,{status:h.status,statusText:h.statusText,text:a})}if(202===h.status){let t;await h.text?.().catch(()=>{}),t=e,ir.safeParse(t).success&&this._startOrAuthSse({resumptionToken:void 0}).catch(e=>this.onerror?.(e));return}let m=(Array.isArray(e)?e:[e]).some(e=>"method"in e&&"id"in e&&void 0!==e.id),f=h.headers.get("content-type"),y=function(e){if(e)try{return l2.parse(e).type}catch{let t=(e.split(";",1)[0]??"").trim().toLowerCase();if(""===t||e.slice(t.length).includes(","))return;return t}}(f);if(m)if("text/event-stream"===y)this._handleSseStream(h.body,{onresumptiontoken:s,requestSignal:t?.requestSignal,onRequestStreamEnd:t?.onRequestStreamEnd},!1);else if("application/json"===y){let e=await h.json();for(let t of Array.isArray(e)?e.map(e=>aW.parse(e)):[aW.parse(e)])this.onmessage?.(t)}else throw await h.text?.().catch(()=>{}),new nR(n$.ClientHttpUnexpectedContent,`Unexpected content type: ${f}`,{contentType:f});else await h.text?.().catch(()=>{})}catch(e){throw t?.requestSignal?.aborted!==!0&&this.onerror?.(e),e}}get sessionId(){return this._sessionId}async terminateSession(){if(this._sessionId)try{let e=await this._commonHeaders(),t={...this._requestInit,method:"DELETE",headers:e,signal:this._abortController?.signal},r=await (this._fetch??fetch)(this._url,t);if(await r.text?.().catch(()=>{}),!r.ok&&405!==r.status)throw new nP(n$.ClientHttpFailedToTerminateSession,`Failed to terminate session: ${r.statusText}`,{status:r.status,statusText:r.statusText});this._sessionId=void 0}catch(e){throw this.onerror?.(e),e}}setProtocolVersion(e){this._protocolVersion=e}get protocolVersion(){return this._protocolVersion}async resumeStream(e,t){await this._startOrAuthSse({resumptionToken:e,onresumptiontoken:t?.onresumptiontoken})}};let dZ=require("node:process"),dW=require("node:stream");var dB=a(6507);let dG="win32"===dZ.platform?["APPDATA","HOMEDRIVE","HOMEPATH","LOCALAPPDATA","PATH","PROCESSOR_ARCHITECTURE","SYSTEMDRIVE","SYSTEMROOT","TEMP","USERNAME","USERPROFILE","PROGRAMFILES"]:["HOME","LOGNAME","PATH","SHELL","TERM","USER"];var dX=class{_process;_readBuffer;_serverParams;_stderrStream=null;onclose;onerror;onmessage;constructor(e){this._serverParams=e,this._readBuffer=new l9({maxBufferSize:e.maxBufferSize}),("pipe"===e.stderr||"overlapped"===e.stderr)&&(this._stderrStream=new dW.PassThrough)}async start(){if(this._process)throw Error("StdioClientTransport already started! If using Client class, note that connect() calls start() automatically.");return new Promise((e,t)=>{this._process=dB(this._serverParams.command,this._serverParams.args??[],{env:{...function(){let e={};for(let t of dG){let r=dZ.env[t];void 0!==r&&(r.startsWith("()")||(e[t]=r))}return e}(),...this._serverParams.env},stdio:["pipe","pipe",this._serverParams.stderr??"inherit"],shell:!1,windowsHide:"win32"===dZ.platform,cwd:this._serverParams.cwd}),this._process.on("error",e=>{t(e),this.onerror?.(e)}),this._process.on("spawn",()=>{e()}),this._process.on("close",e=>{this._process=void 0,this.onclose?.()}),this._process.stdin?.on("error",e=>{this.onerror?.(e)}),this._process.stdout?.on("data",e=>{try{this._readBuffer.append(e),this.processReadBuffer()}catch(e){this.onerror?.(e),this.close().catch(()=>{})}}),this._process.stdout?.on("error",e=>{this.onerror?.(e)}),this._stderrStream&&this._process.stderr&&this._process.stderr.pipe(this._stderrStream)})}get stderr(){return this._stderrStream?this._stderrStream:this._process?.stderr??null}get pid(){return this._process?.pid??null}processReadBuffer(){for(;;)try{let e=this._readBuffer.readMessage();if(null===e)break;this.onmessage?.(e)}catch(e){this.onerror?.(e)}}async _dispose(){let e=this._process;if(this._process=void 0,e&&null===e.exitCode&&null===e.signalCode){let t=new Promise(t=>e.once("exit",()=>t()));try{e.stdin?.end()}catch{}try{e.kill("SIGTERM")}catch{}if(await Promise.race([t,new Promise(e=>setTimeout(e,1e3).unref())]),null===e.exitCode&&null===e.signalCode)try{e.kill("SIGKILL")}catch{}await t}try{e?.stdout?.destroy()}catch{}try{e?.stdin?.destroy()}catch{}try{e?.stderr?.destroy()}catch{}this._readBuffer.clear()}async close(){if(this._process){let e=this._process;this._process=void 0;let t=new Promise(t=>{e.once("close",()=>{t()})});try{e.stdin?.end()}catch{}if(await Promise.race([t,new Promise(e=>setTimeout(e,2e3).unref())]),null===e.exitCode){try{e.kill("SIGTERM")}catch{}await Promise.race([t,new Promise(e=>setTimeout(e,2e3).unref())])}if(null===e.exitCode)try{e.kill("SIGKILL")}catch{}}this._readBuffer.clear()}send(e){return new Promise(t=>{if(!this._process?.stdin)throw new nR(n$.NotConnected,"Not connected");let r=JSON.stringify(e)+"\n";this._process.stdin.write(r)?t():this._process.stdin.once("drain",t)})}};let dY=a(8330),dQ={name:dY.name,version:dY.version};async function d0(e,t={}){var r;let o,a,{handlers:i={}}=t,s={};i.sampling&&(s.sampling={}),i.elicitation&&(s.elicitation={form:{},url:{}}),i.roots&&(s.roots={});let n=new dV(dQ,{capabilities:s,versionNegotiation:t.versionNegotiation??{mode:"auto"}});i.sampling&&n.setRequestHandler("sampling/createMessage",i.sampling),i.elicitation&&n.setRequestHandler("elicitation/create",i.elicitation),i.roots&&n.setRequestHandler("roots/list",i.roots);let l="http"===e.type?new dJ(new URL(e.url),{requestInit:{headers:(r=e.headers??[],a={},r.forEach(e=>{let t,r=e.name.trim();if("env"in(t=e)&&"string"==typeof t.env){let t=process.env[e.env];if(void 0===t)throw Error(`Environment variable "${e.env}" is not set (required for header "${r}")`);a[r]=t}else a[r]=e.value.trim()}),a)}}):new dX({command:e.command,args:e.args,env:e.env,cwd:e.cwd,stderr:e.stderr??(t.onStderrData?"pipe":"inherit")});l instanceof dX&&l.stderr?.on("data",t.onStderrData??(e=>{process.stderr.write(e)}));let c=l.close.bind(l);l.close=()=>o??(o=c());let u=n.close.bind(n);n.close=async()=>{try{await u()}finally{await l.close()}};let d=t.connect?.signal,p=()=>{l.close().catch(()=>{})};try{return d?.throwIfAborted(),d?.addEventListener("abort",p,{once:!0}),await n.connect(l,t.connect),d?.throwIfAborted(),n}catch(e){try{await n.close()}catch(t){throw AggregateError([e,t],"Client connection and cleanup failed",{cause:e})}throw d?.throwIfAborted(),e}finally{d?.removeEventListener("abort",p)}}async function d1(e,t,r){let o=await d0(e,r);try{return await t(o)}finally{await o.close()}}})(),exports.createClient=i.createClient,exports.withClient=i.withClient,i)-1===["createClient","withClient"].indexOf(s)&&(exports[s]=i[s]);Object.defineProperty(exports,"__esModule",{value:!0})})();