xmcp 1.5.0 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client.js +53 -60
- package/dist/config/index.d.ts +5 -5
- package/dist/config/schemas/experimental/index.d.ts +4 -4
- package/dist/config.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +59 -66
- package/dist/runtime/adapter-express.js +83 -88
- package/dist/runtime/adapter-fastify.js +83 -88
- package/dist/runtime/adapter-fetch-cloudflare.js +235 -0
- package/dist/runtime/adapter-fetch.js +239 -0
- package/dist/runtime/adapter-nestjs.js +83 -88
- package/dist/runtime/adapter-nextjs.js +82 -87
- package/dist/runtime/cloudflare-worker.js +87 -92
- package/dist/runtime/http.js +92 -97
- package/dist/runtime/stdio.js +71 -76
- package/dist/runtime/vercel.js +92 -97
- package/package.json +1 -1
- package/dist/runtime/adapter-tanstack-cloudflare.js +0 -240
- package/dist/runtime/adapter-tanstack.js +0 -244
package/dist/client.js
CHANGED
|
@@ -1,77 +1,70 @@
|
|
|
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
|
-
|
|
3
|
-
if (${s} in input) {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
1
|
+
(()=>{var t,r,o={6507(t,r,o){"use strict";let i=o(5317),a=o(8388),n=o(442);function s(t,r,o){let s=a(t,r,o),l=i.spawn(s.command,s.args,s.options);return n.hookChildProcess(l,s),l}t.exports=s,t.exports.spawn=s,t.exports.sync=function(t,r,o){let s=a(t,r,o),l=i.spawnSync(s.command,s.args,s.options);return l.error=l.error||n.verifyENOENTSync(l.status,s),l},t.exports._parse=a,t.exports._enoent=n},442(t){"use strict";let r="win32"===process.platform;function o(t,r){return Object.assign(Error(`${r} ${t.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${r} ${t.command}`,path:t.command,spawnargs:t.args})}function i(t,i){return r&&1===t&&!i.file?o(i.original,"spawn"):null}t.exports={hookChildProcess:function(t,o){if(!r)return;let a=t.emit;t.emit=function(r,n){if("exit"===r){let r=i(n,o);if(r)return a.call(t,"error",r)}return a.apply(t,arguments)}},verifyENOENT:i,verifyENOENTSync:function(t,i){return r&&1===t&&!i.file?o(i.original,"spawnSync"):null},notFoundError:o}},8388(t,r,o){"use strict";let i=o(6928),a=o(3803),n=o(2077),s=o(1880),l="win32"===process.platform,c=/\.(?:com|exe)$/i,u=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;t.exports=function(t,r,o){r&&!Array.isArray(r)&&(o=r,r=null);let d={command:t,args:r=r?r.slice(0):[],options:o=Object.assign({},o),file:void 0,original:{command:t,args:r}};return o.shell?d:function(t){let r;if(!l)return t;let o=(t.file=a(t),(r=t.file&&s(t.file))?(t.args.unshift(t.file),t.command=r,a(t)):t.file),d=!c.test(o);if(t.options.forceShell||d){let r=u.test(o);t.command=i.normalize(t.command),t.command=n.command(t.command),t.args=t.args.map(t=>n.argument(t,r));let a=[t.command].concat(t.args).join(" ");t.args=["/d","/s","/c",`"${a}"`],t.command=process.env.comspec||"cmd.exe",t.options.windowsVerbatimArguments=!0}return t}(d)}},2077(t){"use strict";let r=/([()\][%!^"`<>&|;, *?])/g;t.exports.command=function(t){return t.replace(r,"^$1")},t.exports.argument=function(t,o){return t=(t=(t=`${t}`).replace(/(?=(\\+?)?)\1"/g,'$1$1\\"')).replace(/(?=(\\+?)?)\1$/,"$1$1"),t=(t=`"${t}"`).replace(r,"^$1"),o&&(t=t.replace(r,"^$1")),t}},1880(t,r,o){"use strict";let i=o(9896),a=o(600);t.exports=function(t){let r,o=Buffer.alloc(150);try{r=i.openSync(t,"r"),i.readSync(r,o,0,150,0),i.closeSync(r)}catch(t){}return a(o.toString())}},3803(t,r,o){"use strict";let i=o(6928),a=o(1905),n=o(9695);function s(t,r){let o,s=t.options.env||process.env,l=process.cwd(),c=null!=t.options.cwd,u=c&&void 0!==process.chdir&&!process.chdir.disabled;if(u)try{process.chdir(t.options.cwd)}catch(t){}try{o=a.sync(t.command,{path:s[n({env:s})],pathExt:r?i.delimiter:void 0})}catch(t){}finally{u&&process.chdir(l)}return o&&(o=i.resolve(c?t.options.cwd:"",o)),o}t.exports=function(t){return s(t)||s(t,!0)}},9344(t,r,o){var i;function a(t,r,o){if("function"==typeof r&&(o=r,r={}),!o){if("function"!=typeof Promise)throw TypeError("callback not provided");return new Promise(function(o,i){a(t,r||{},function(t,r){t?i(t):o(r)})})}i(t,r||{},function(t,i){t&&("EACCES"===t.code||r&&r.ignoreErrors)&&(t=null,i=!1),o(t,i)})}o(9896),i="win32"===process.platform||global.TESTING_WINDOWS?o(8541):o(709),t.exports=a,a.sync=function(t,r){try{return i.sync(t,r||{})}catch(t){if(r&&r.ignoreErrors||"EACCES"===t.code)return!1;throw t}}},709(t,r,o){t.exports=a,a.sync=function(t,r){return n(i.statSync(t),r)};var i=o(9896);function a(t,r,o){i.stat(t,function(t,i){o(t,!t&&n(i,r))})}function n(t,r){var o,i,a,n,s,l,c,u,d;return t.isFile()&&(o=t,i=r,a=o.mode,n=o.uid,s=o.gid,l=void 0!==i.uid?i.uid:process.getuid&&process.getuid(),c=void 0!==i.gid?i.gid:process.getgid&&process.getgid(),u=parseInt("100",8),d=parseInt("010",8),a&parseInt("001",8)||a&d&&s===c||a&u&&n===l||a&(u|d)&&0===l)}},8541(t,r,o){t.exports=n,n.sync=function(t,r){return a(i.statSync(t),t,r)};var i=o(9896);function a(t,r,o){if(!t.isSymbolicLink()&&!t.isFile())return!1;var i=void 0!==o.pathExt?o.pathExt:process.env.PATHEXT;if(!i||-1!==(i=i.split(";")).indexOf(""))return!0;for(var a=0;a<i.length;a++){var n=i[a].toLowerCase();if(n&&r.substr(-n.length).toLowerCase()===n)return!0}return!1}function n(t,r,o){i.stat(t,function(i,n){o(i,!i&&a(n,t,r))})}},9695(t){"use strict";let r=(t={})=>{let r=t.env||process.env;return"win32"!==(t.platform||process.platform)?"PATH":Object.keys(r).reverse().find(t=>"PATH"===t.toUpperCase())||"Path"};t.exports=r,t.exports.default=r},600(t,r,o){"use strict";let i=o(9638);t.exports=(t="")=>{let r=t.match(i);if(!r)return null;let[o,a]=r[0].replace(/#! ?/,"").split(" "),n=o.split("/").pop();return"env"===n?a:a?`${n} ${a}`:n}},9638(t){"use strict";t.exports=/^#!(.*)/},1905(t,r,o){let i="win32"===process.platform||"cygwin"===process.env.OSTYPE||"msys"===process.env.OSTYPE,a=o(6928),n=i?";":":",s=o(9344),l=t=>Object.assign(Error(`not found: ${t}`),{code:"ENOENT"}),c=(t,r)=>{let o=r.colon||n,a=t.match(/\//)||i&&t.match(/\\/)?[""]:[...i?[process.cwd()]:[],...(r.path||process.env.PATH||"").split(o)],s=i?r.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",l=i?s.split(o):[""];return i&&-1!==t.indexOf(".")&&""!==l[0]&&l.unshift(""),{pathEnv:a,pathExt:l,pathExtExe:s}},u=(t,r,o)=>{"function"==typeof r&&(o=r,r={}),r||(r={});let{pathEnv:i,pathExt:n,pathExtExe:u}=c(t,r),d=[],p=o=>new Promise((n,s)=>{if(o===i.length)return r.all&&d.length?n(d):s(l(t));let c=i[o],u=/^".*"$/.test(c)?c.slice(1,-1):c,p=a.join(u,t);n(h(!u&&/^\.[\\\/]/.test(t)?t.slice(0,2)+p:p,o,0))}),h=(t,o,i)=>new Promise((a,l)=>{if(i===n.length)return a(p(o+1));let c=n[i];s(t+c,{pathExt:u},(n,s)=>{if(!n&&s)if(!r.all)return a(t+c);else d.push(t+c);return a(h(t,o,i+1))})});return o?p(0).then(t=>o(null,t),o):p(0)};t.exports=u,u.sync=(t,r)=>{let{pathEnv:o,pathExt:i,pathExtExe:n}=c(t,r=r||{}),u=[];for(let l=0;l<o.length;l++){let c=o[l],d=/^".*"$/.test(c)?c.slice(1,-1):c,p=a.join(d,t),h=!d&&/^\.[\\\/]/.test(t)?t.slice(0,2)+p:p;for(let t=0;t<i.length;t++){let o=h+i[t];try{if(s.sync(o,{pathExt:n}))if(!r.all)return o;else u.push(o)}catch(t){}}}if(r.all&&u.length)return u;if(r.nothrow)return null;throw l(t)}},5317(t){"use strict";t.exports=require("child_process")},9896(t){"use strict";t.exports=require("fs")},7598(t){"use strict";t.exports=require("node:crypto")},6928(t){"use strict";t.exports=require("path")},4891(t,r,o){"use strict";let i;o.d(r,{importJWK:()=>B,importPKCS8:()=>W,SignJWT:()=>V});let a=new TextEncoder,n=new TextDecoder;function s(t){let r=new Uint8Array(t.length);for(let o=0;o<t.length;o++){let i=t.charCodeAt(o);if(i>127)throw TypeError("non-ASCII string encountered in encode()");r[o]=i}return r}function l(t){if(Uint8Array.fromBase64)return Uint8Array.fromBase64(t);let r=atob(t),o=new Uint8Array(r.length);for(let t=0;t<r.length;t++)o[t]=r.charCodeAt(t);return o}function c(t){if(Uint8Array.fromBase64)return Uint8Array.fromBase64("string"==typeof t?t:n.decode(t),{alphabet:"base64url"});let r=t;r instanceof Uint8Array&&(r=n.decode(r)),r=r.replace(/-/g,"+").replace(/_/g,"/");try{return l(r)}catch{throw TypeError("The input to be decoded is not correctly encoded.")}}function u(t){let r=t;return("string"==typeof r&&(r=a.encode(r)),Uint8Array.prototype.toBase64)?r.toBase64({alphabet:"base64url",omitPadding:!0}):(function(t){if(Uint8Array.prototype.toBase64)return t.toBase64();let r=[];for(let o=0;o<t.length;o+=32768)r.push(String.fromCharCode.apply(null,t.subarray(o,o+32768)));return btoa(r.join(""))})(r).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}class d extends Error{static code="ERR_JOSE_GENERIC";code="ERR_JOSE_GENERIC";constructor(t,r){super(t,r),this.name=this.constructor.name,Error.captureStackTrace?.(this,this.constructor)}}class p extends d{static code="ERR_JOSE_NOT_SUPPORTED";code="ERR_JOSE_NOT_SUPPORTED"}class h extends d{static code="ERR_JWS_INVALID";code="ERR_JWS_INVALID"}class m extends d{static code="ERR_JWT_INVALID";code="ERR_JWT_INVALID"}class f extends d{[Symbol.asyncIterator];static code="ERR_JWKS_MULTIPLE_MATCHING_KEYS";code="ERR_JWKS_MULTIPLE_MATCHING_KEYS";constructor(t="multiple matching keys found in the JSON Web Key Set",r){super(t,r)}}let y=(t,r="algorithm.name")=>TypeError(`CryptoKey does not support this operation, its ${r} must be ${t}`);function g(t,r){if(parseInt(t.hash.name.slice(4),10)!==r)throw y(`SHA-${r}`,"algorithm.hash")}function v(t,r,...o){if((o=o.filter(Boolean)).length>2){let r=o.pop();t+=`one of type ${o.join(", ")}, or ${r}.`}else 2===o.length?t+=`one of type ${o[0]} or ${o[1]}.`:t+=`of type ${o[0]}.`;return null==r?t+=` Received ${r}`:"function"==typeof r&&r.name?t+=` Received function ${r.name}`:"object"==typeof r&&null!=r&&r.constructor?.name&&(t+=` Received an instance of ${r.constructor.name}`),t}let _=(t,r,...o)=>v(`Key for the ${t} algorithm must be `,r,...o);async function b(t,r,o){if(r instanceof Uint8Array){if(!t.startsWith("HS"))throw TypeError(((t,...r)=>v("Key must be ",t,...r))(r,"CryptoKey","KeyObject","JSON Web Key"));return crypto.subtle.importKey("raw",r,{hash:`SHA-${t.slice(-3)}`,name:"HMAC"},!1,[o])}return!function(t,r,o){switch(r){case"HS256":case"HS384":case"HS512":if("HMAC"!==t.algorithm.name)throw y("HMAC");g(t.algorithm,parseInt(r.slice(2),10));break;case"RS256":case"RS384":case"RS512":if("RSASSA-PKCS1-v1_5"!==t.algorithm.name)throw y("RSASSA-PKCS1-v1_5");g(t.algorithm,parseInt(r.slice(2),10));break;case"PS256":case"PS384":case"PS512":if("RSA-PSS"!==t.algorithm.name)throw y("RSA-PSS");g(t.algorithm,parseInt(r.slice(2),10));break;case"Ed25519":case"EdDSA":if("Ed25519"!==t.algorithm.name)throw y("Ed25519");break;case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":let i;if(i=t.algorithm,i.name!==r)throw y(r);break;case"ES256":case"ES384":case"ES512":{if("ECDSA"!==t.algorithm.name)throw y("ECDSA");let o=function(t){switch(t){case"ES256":return"P-256";case"ES384":return"P-384";case"ES512":return"P-521";default:throw Error("unreachable")}}(r);if(t.algorithm.namedCurve!==o)throw y(o,"algorithm.namedCurve");break}default:throw TypeError("CryptoKey does not support this operation")}if(o&&!t.usages.includes(o))throw TypeError(`CryptoKey does not support this operation, its usages must include ${o}.`)}(r,t,o),r}async function S(t,r,o){let i=await b(t,r,"sign");return!function(t,r){if(t.startsWith("RS")||t.startsWith("PS")){let{modulusLength:o}=r.algorithm;if("number"!=typeof o||o<2048)throw TypeError(`${t} requires key modulusLength to be 2048 bits or larger`)}}(t,i),new Uint8Array(await crypto.subtle.sign(function(t,r){let o=`SHA-${t.slice(-3)}`;switch(t){case"HS256":case"HS384":case"HS512":return{hash:o,name:"HMAC"};case"PS256":case"PS384":case"PS512":return{hash:o,name:"RSA-PSS",saltLength:parseInt(t.slice(-3),10)>>3};case"RS256":case"RS384":case"RS512":return{hash:o,name:"RSASSA-PKCS1-v1_5"};case"ES256":case"ES384":case"ES512":return{hash:o,name:"ECDSA",namedCurve:r.namedCurve};case"Ed25519":case"EdDSA":return{name:"Ed25519"};case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":return{name:t};default:throw new p(`alg ${t} is not supported either by JOSE or your javascript runtime`)}}(t,i.algorithm),i,o))}function w(t){if("object"!=typeof t||null===t||"[object Object]"!==Object.prototype.toString.call(t))return!1;if(null===Object.getPrototypeOf(t))return!0;let r=t;for(;null!==Object.getPrototypeOf(r);)r=Object.getPrototypeOf(r);return Object.getPrototypeOf(t)===r}let $=t=>w(t)&&"string"==typeof t.kty,P=t=>{if(t?.[Symbol.toStringTag]==="CryptoKey")return!0;try{return t instanceof CryptoKey}catch{return!1}},R=t=>t?.[Symbol.toStringTag]==="KeyObject",E=t=>P(t)||R(t),k=t=>t?.[Symbol.toStringTag],x=(t,r,o)=>{if(void 0!==r.use){let t;switch(o){case"sign":case"verify":t="sig";break;case"encrypt":case"decrypt":t="enc"}if(r.use!==t)throw TypeError(`Invalid key for this operation, its "use" must be "${t}" when present`)}if(void 0!==r.alg&&r.alg!==t)throw TypeError(`Invalid key for this operation, its "alg" must be "${t}" when present`);if(Array.isArray(r.key_ops)){let i;switch(!0){case"sign"===o||"verify"===o:case"dir"===t:case t.includes("CBC-HS"):i=o;break;case t.startsWith("PBES2"):i="deriveBits";break;case/^A\d{3}(?:GCM)?(?:KW)?$/.test(t):i=!t.includes("GCM")&&t.endsWith("KW")?"encrypt"===o?"wrapKey":"unwrapKey":o;break;case"encrypt"===o&&t.startsWith("RSA"):i="wrapKey";break;case"decrypt"===o:i=t.startsWith("RSA")?"unwrapKey":"deriveBits"}if(i&&r.key_ops?.includes?.(i)===!1)throw TypeError(`Invalid key for this operation, its "key_ops" must include "${i}" when present`)}return!0},T='Invalid or unsupported JWK "alg" (Algorithm) Parameter value';async function O(t){if(!t.alg)throw TypeError('"alg" argument is required when "jwk.alg" is not present');let{algorithm:r,keyUsages:o}=function(t){let r,o;switch(t.kty){case"AKP":switch(t.alg){case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":r={name:t.alg},o=t.priv?["sign"]:["verify"];break;default:throw new p(T)}break;case"RSA":switch(t.alg){case"PS256":case"PS384":case"PS512":r={name:"RSA-PSS",hash:`SHA-${t.alg.slice(-3)}`},o=t.d?["sign"]:["verify"];break;case"RS256":case"RS384":case"RS512":r={name:"RSASSA-PKCS1-v1_5",hash:`SHA-${t.alg.slice(-3)}`},o=t.d?["sign"]:["verify"];break;case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":r={name:"RSA-OAEP",hash:`SHA-${parseInt(t.alg.slice(-3),10)||1}`},o=t.d?["decrypt","unwrapKey"]:["encrypt","wrapKey"];break;default:throw new p(T)}break;case"EC":switch(t.alg){case"ES256":case"ES384":case"ES512":r={name:"ECDSA",namedCurve:({ES256:"P-256",ES384:"P-384",ES512:"P-521"})[t.alg]},o=t.d?["sign"]:["verify"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":r={name:"ECDH",namedCurve:t.crv},o=t.d?["deriveBits"]:[];break;default:throw new p(T)}break;case"OKP":switch(t.alg){case"Ed25519":case"EdDSA":r={name:"Ed25519"},o=t.d?["sign"]:["verify"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":r={name:t.crv},o=t.d?["deriveBits"]:[];break;default:throw new p(T)}break;default:throw new p('Invalid or unsupported JWK "kty" (Key Type) Parameter value')}return{algorithm:r,keyUsages:o}}(t),i={...t};return"AKP"!==i.kty&&delete i.alg,delete i.use,crypto.subtle.importKey("jwk",i,r,t.ext??(!t.d&&!t.priv),t.key_ops??o)}let C="given KeyObject instance cannot be used for this algorithm",j=async(t,r,o,a=!1)=>{let n=(i||=new WeakMap).get(t);if(n?.[o])return n[o];let s=await O({...r,alg:o});return a&&Object.freeze(t),n?n[o]=s:i.set(t,{[o]:s}),s};async function I(t,r){if(t instanceof Uint8Array||P(t))return t;if(R(t)){if("secret"===t.type)return t.export();if("toCryptoKey"in t&&"function"==typeof t.toCryptoKey)try{return((t,r)=>{let o,a=(i||=new WeakMap).get(t);if(a?.[r])return a[r];let n="public"===t.type,s=!!n;if("x25519"===t.asymmetricKeyType){switch(r){case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":break;default:throw TypeError(C)}o=t.toCryptoKey(t.asymmetricKeyType,s,n?[]:["deriveBits"])}if("ed25519"===t.asymmetricKeyType){if("EdDSA"!==r&&"Ed25519"!==r)throw TypeError(C);o=t.toCryptoKey(t.asymmetricKeyType,s,[n?"verify":"sign"])}switch(t.asymmetricKeyType){case"ml-dsa-44":case"ml-dsa-65":case"ml-dsa-87":if(r!==t.asymmetricKeyType.toUpperCase())throw TypeError(C);o=t.toCryptoKey(t.asymmetricKeyType,s,[n?"verify":"sign"])}if("rsa"===t.asymmetricKeyType){let i;switch(r){case"RSA-OAEP":i="SHA-1";break;case"RS256":case"PS256":case"RSA-OAEP-256":i="SHA-256";break;case"RS384":case"PS384":case"RSA-OAEP-384":i="SHA-384";break;case"RS512":case"PS512":case"RSA-OAEP-512":i="SHA-512";break;default:throw TypeError(C)}if(r.startsWith("RSA-OAEP"))return t.toCryptoKey({name:"RSA-OAEP",hash:i},s,n?["encrypt"]:["decrypt"]);o=t.toCryptoKey({name:r.startsWith("PS")?"RSA-PSS":"RSASSA-PKCS1-v1_5",hash:i},s,[n?"verify":"sign"])}if("ec"===t.asymmetricKeyType){let i=new Map([["prime256v1","P-256"],["secp384r1","P-384"],["secp521r1","P-521"]]).get(t.asymmetricKeyDetails?.namedCurve);if(!i)throw TypeError(C);let a={ES256:"P-256",ES384:"P-384",ES512:"P-521"};a[r]&&i===a[r]&&(o=t.toCryptoKey({name:"ECDSA",namedCurve:i},s,[n?"verify":"sign"])),r.startsWith("ECDH-ES")&&(o=t.toCryptoKey({name:"ECDH",namedCurve:i},s,n?[]:["deriveBits"]))}if(!o)throw TypeError(C);return a?a[r]=o:i.set(t,{[r]:o}),o})(t,r)}catch(t){if(t instanceof TypeError)throw t}let o=t.export({format:"jwk"});return j(t,o,r)}if($(t))return t.k?c(t.k):j(t,t,r,!0);throw Error("unreachable")}function N(t,r){if(t)throw TypeError(`${r} can only be called once`)}Symbol();class A{#e;#t;#r;constructor(t){if(!(t instanceof Uint8Array))throw TypeError("payload must be an instance of Uint8Array");this.#e=t}setProtectedHeader(t){return N(this.#t,"setProtectedHeader"),this.#t=t,this}setUnprotectedHeader(t){return N(this.#r,"setUnprotectedHeader"),this.#r=t,this}async sign(t,r){let o,i,a,n;if(!this.#t&&!this.#r)throw new h("either setProtectedHeader or setUnprotectedHeader must be called before #sign()");if(!function(...t){let r,o=t.filter(Boolean);if(0===o.length||1===o.length)return!0;for(let t of o){let o=Object.keys(t);if(!r||0===r.size){r=new Set(o);continue}for(let t of o){if(r.has(t))return!1;r.add(t)}}return!0}(this.#t,this.#r))throw new h("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");let l={...this.#t,...this.#r},c=function(t,r,o,i,a){let n;if(void 0!==a.crit&&i?.crit===void 0)throw new t('"crit" (Critical) Header Parameter MUST be integrity protected');if(!i||void 0===i.crit)return new Set;if(!Array.isArray(i.crit)||0===i.crit.length||i.crit.some(t=>"string"!=typeof t||0===t.length))throw new t('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present');for(let s of(n=void 0!==o?new Map([...Object.entries(o),...r.entries()]):r,i.crit)){if(!n.has(s))throw new p(`Extension Header Parameter "${s}" is not recognized`);if(void 0===a[s])throw new t(`Extension Header Parameter "${s}" is missing`);if(n.get(s)&&void 0===i[s])throw new t(`Extension Header Parameter "${s}" MUST be integrity protected`)}return new Set(i.crit)}(h,new Map([["b64",!0]]),r?.crit,this.#t,l),d=!0;if(c.has("b64")&&"boolean"!=typeof(d=this.#t.b64))throw new h('The "b64" (base64url-encode payload) Header Parameter must be a boolean');let{alg:m}=l;if("string"!=typeof m||!m)throw new h('JWS "alg" (Algorithm) Header Parameter missing or invalid');var f="sign";switch(m.substring(0,2)){case"A1":case"A2":case"di":case"HS":case"PB":((t,r,o)=>{if(!(r instanceof Uint8Array)){if($(r)){if("oct"===r.kty&&"string"==typeof r.k&&x(t,r,o))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(!E(r))throw TypeError(_(t,r,"CryptoKey","KeyObject","JSON Web Key","Uint8Array"));if("secret"!==r.type)throw TypeError(`${k(r)} instances for symmetric algorithms must be of type "secret"`)}})(m,t,f);break;default:((t,r,o)=>{if($(r))switch(o){case"decrypt":case"sign":if("oct"!==r.kty&&("AKP"===r.kty&&"string"==typeof r.priv||"string"==typeof r.d)&&x(t,r,o))return;throw TypeError("JSON Web Key for this operation must be a private JWK");case"encrypt":case"verify":if("oct"!==r.kty&&void 0===r.d&&void 0===r.priv&&x(t,r,o))return;throw TypeError("JSON Web Key for this operation must be a public JWK")}if(!E(r))throw TypeError(_(t,r,"CryptoKey","KeyObject","JSON Web Key"));if("secret"===r.type)throw TypeError(`${k(r)} instances for asymmetric algorithms must not be of type "secret"`);if("public"===r.type)switch(o){case"sign":throw TypeError(`${k(r)} instances for asymmetric algorithm signing must be of type "private"`);case"decrypt":throw TypeError(`${k(r)} instances for asymmetric algorithm decryption must be of type "private"`)}if("private"===r.type)switch(o){case"verify":throw TypeError(`${k(r)} instances for asymmetric algorithm verifying must be of type "public"`);case"encrypt":throw TypeError(`${k(r)} instances for asymmetric algorithm encryption must be of type "public"`)}})(m,t,f)}d?i=s(o=u(this.#e)):(i=this.#e,o=""),this.#t?n=s(a=u(JSON.stringify(this.#t))):(a="",n=new Uint8Array);let y=function(...t){let r=new Uint8Array(t.reduce((t,{length:r})=>t+r,0)),o=0;for(let i of t)r.set(i,o),o+=i.length;return r}(n,s("."),i),g=await I(t,m),v={signature:u(await S(m,g,y)),payload:o};return this.#r&&(v.header=this.#r),this.#t&&(v.protected=a),v}}class z{#o;constructor(t){this.#o=new A(t)}setProtectedHeader(t){return this.#o.setProtectedHeader(t),this}async sign(t,r){let o=await this.#o.sign(t,r);if(void 0===o.payload)throw TypeError("use the flattened module for creating JWS with b64: false");return`${o.protected}.${o.payload}.${o.signature}`}}let q=t=>Math.floor(t.getTime()/1e3),M=/^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i;function L(t){let r,o=M.exec(t);if(!o||o[4]&&o[1])throw TypeError("Invalid time period format");let i=parseFloat(o[2]);switch(o[3].toLowerCase()){case"sec":case"secs":case"second":case"seconds":case"s":r=Math.round(i);break;case"minute":case"minutes":case"min":case"mins":case"m":r=Math.round(60*i);break;case"hour":case"hours":case"hr":case"hrs":case"h":r=Math.round(3600*i);break;case"day":case"days":case"d":r=Math.round(86400*i);break;case"week":case"weeks":case"w":r=Math.round(604800*i);break;default:r=Math.round(0x1e187e0*i)}return"-"===o[1]||"ago"===o[4]?-r:r}function D(t,r){if(!Number.isFinite(r))throw TypeError(`Invalid ${t} input`);return r}class U{#e;constructor(t){if(!w(t))throw TypeError("JWT Claims Set MUST be an object");this.#e=structuredClone(t)}data(){return a.encode(JSON.stringify(this.#e))}get iss(){return this.#e.iss}set iss(t){this.#e.iss=t}get sub(){return this.#e.sub}set sub(t){this.#e.sub=t}get aud(){return this.#e.aud}set aud(t){this.#e.aud=t}set jti(t){this.#e.jti=t}set nbf(t){"number"==typeof t?this.#e.nbf=D("setNotBefore",t):t instanceof Date?this.#e.nbf=D("setNotBefore",q(t)):this.#e.nbf=q(new Date)+L(t)}set exp(t){"number"==typeof t?this.#e.exp=D("setExpirationTime",t):t instanceof Date?this.#e.exp=D("setExpirationTime",q(t)):this.#e.exp=q(new Date)+L(t)}set iat(t){void 0===t?this.#e.iat=q(new Date):t instanceof Date?this.#e.iat=D("setIssuedAt",q(t)):"string"==typeof t?this.#e.iat=D("setIssuedAt",q(new Date)+L(t)):this.#e.iat=D("setIssuedAt",t)}}class V{#t;#i;constructor(t={}){this.#i=new U(t)}setIssuer(t){return this.#i.iss=t,this}setSubject(t){return this.#i.sub=t,this}setAudience(t){return this.#i.aud=t,this}setJti(t){return this.#i.jti=t,this}setNotBefore(t){return this.#i.nbf=t,this}setExpirationTime(t){return this.#i.exp=t,this}setIssuedAt(t){return this.#i.iat=t,this}setProtectedHeader(t){return this.#t=t,this}async sign(t,r){let o=new z(this.#i.data());if(o.setProtectedHeader(this.#t),Array.isArray(this.#t?.crit)&&this.#t.crit.includes("b64")&&!1===this.#t.b64)throw new m("JWTs MUST NOT use unencoded payload");return o.sign(t,r)}}let H=(t,r)=>{if(t.byteLength!==r.length)return!1;for(let o=0;o<t.byteLength;o++)if(t[o]!==r[o])return!1;return!0},F=t=>{let r=t.data[t.pos++];if(128&r){let o=127&r,i=0;for(let r=0;r<o;r++)i=i<<8|t.data[t.pos++];return i}return r},K=(t,r,o)=>{if(t.data[t.pos++]!==r)throw Error(o)},J=(t,r)=>{let o=t.data.subarray(t.pos,t.pos+r);return t.pos+=r,o},Z=async(t,r,o,i)=>{let a,n,s="spki"===t,l=()=>s?["verify"]:["sign"];switch(o){case"PS256":case"PS384":case"PS512":a={name:"RSA-PSS",hash:`SHA-${o.slice(-3)}`},n=l();break;case"RS256":case"RS384":case"RS512":a={name:"RSASSA-PKCS1-v1_5",hash:`SHA-${o.slice(-3)}`},n=l();break;case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":a={name:"RSA-OAEP",hash:`SHA-${parseInt(o.slice(-3),10)||1}`},n=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"})[o]},n=l();break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":try{let t=i.getNamedCurve(r);a="X25519"===t?{name:"X25519"}:{name:"ECDH",namedCurve:t}}catch(t){throw new p("Invalid or unsupported key format")}n=s?[]:["deriveBits"];break;case"Ed25519":case"EdDSA":a={name:"Ed25519"},n=l();break;case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":a={name:o},n=l();break;default:throw new p('Invalid or unsupported "alg" (Algorithm) value')}return crypto.subtle.importKey(t,r,a,i?.extractable??!!s,n)};async function W(t,r,o){let i,a,n;if("string"!=typeof t||0!==t.indexOf("-----BEGIN PRIVATE KEY-----"))throw TypeError('"pkcs8" must be PKCS#8 formatted string');return i=/(?:-----(?:BEGIN|END) PRIVATE KEY-----|\s)/g,a=l(t.replace(i,"")),n=o,r?.startsWith?.("ECDH-ES")&&((n||={}).getNamedCurve=t=>{let r,o={data:t,pos:0};return K(o,48,"Invalid PKCS#8 structure"),F(o),K(o,2,"Expected version field"),r=F(o),o.pos+=r,K(o,48,"Expected algorithm identifier"),F(o),o.pos,(t=>{let r,o=(K(t,6,"Expected algorithm OID"),r=F(t),J(t,r));if(H(o,[43,101,110]))return"X25519";if(!H(o,[42,134,72,206,61,2,1]))throw Error("Unsupported key algorithm");K(t,6,"Expected curve OID");let i=F(t),a=J(t,i);for(let{name:t,oid:r}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(H(a,r))return t;throw Error("Unsupported named curve")})(o)}),Z("pkcs8",a,r,n)}async function B(t,r,o){let i;if(!w(t))throw TypeError("JWK must be an object");switch(r??=t.alg,i??=o?.extractable??t.ext,t.kty){case"oct":if("string"!=typeof t.k||!t.k)throw TypeError('missing "k" (Key Value) Parameter value');return c(t.k);case"RSA":if("oth"in t&&void 0!==t.oth)throw new p('RSA JWK "oth" (Other Primes Info) Parameter value is not supported');return O({...t,alg:r,ext:i});case"AKP":if("string"!=typeof t.alg||!t.alg)throw TypeError('missing "alg" (Algorithm) Parameter value');if(void 0!==r&&r!==t.alg)throw TypeError("JWK alg and alg option value mismatch");return O({...t,ext:i});case"EC":case"OKP":return O({...t,alg:r,ext:i});default:throw new p('Unsupported "kty" (Key Type) Parameter value')}}},8330(t){"use strict";t.exports=JSON.parse('{"name":"xmcp","description":"The MCP framework","version":"1.6.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}}}')}},i={};function a(t){var r=i[t];if(void 0!==r)return r.exports;var n=i[t]={exports:{}};return o[t](n,n.exports,a),n.exports}r=Object.getPrototypeOf?t=>Object.getPrototypeOf(t):t=>t.__proto__,a.t=function(o,i){if(1&i&&(o=this(o)),8&i||"object"==typeof o&&o&&(4&i&&o.__esModule||16&i&&"function"==typeof o.then))return o;var n=Object.create(null);a.r(n);var s={};t=t||[null,r({}),r([]),r(r)];for(var l=2&i&&o;("object"==typeof l||"function"==typeof l)&&!~t.indexOf(l);l=r(l))Object.getOwnPropertyNames(l).forEach(t=>{s[t]=()=>o[t]});return s.default=()=>o,a.d(n,s),n},a.d=(t,r)=>{for(var o in r)a.o(r,o)&&!a.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:r[o]})},a.o=(t,r)=>Object.prototype.hasOwnProperty.call(t,r),a.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var n={};for(var s in(()=>{"use strict";let t,r,o,i,s,l,c,u,d,p,h,m,f,y,g,v,_,b,S,w;a.r(n),a.d(n,{createClient:()=>hl,withClient:()=>hc});var $,P,R,E,k,x,T,O,C=Object.create,j=Object.defineProperty,I=Object.getOwnPropertyDescriptor,N=Object.getOwnPropertyNames,A=Object.getPrototypeOf,z=Object.prototype.hasOwnProperty,q=(t,r)=>()=>(r||t((r={exports:{}}).exports,r),r.exports),M=(t,r,o)=>(o=null!=t?C(A(t)):{},((t,r,o,i)=>{if(r&&"object"==typeof r||"function"==typeof r)for(var a,n=N(r),s=0,l=n.length;s<l;s++)a=n[s],z.call(t,a)||a===o||j(t,a,{get:(t=>r[t]).bind(null,a),enumerable:!(i=I(r,a))||i.enumerable});return t})(!r&&t&&t.__esModule?o:j(o,"default",{value:t,enumerable:!0}),t));let L=new Set(["https://json-schema.org/draft/2020-12/schema","http://json-schema.org/draft/2020-12/schema"]),D=new Set(["https://json-schema.org/draft/2019-09/schema","http://json-schema.org/draft/2019-09/schema"]),U=new Set(["https://json-schema.org/draft-07/schema","http://json-schema.org/draft-07/schema"]),V=new Set(["https://json-schema.org/draft-06/schema","http://json-schema.org/draft-06/schema"]);function H(t){let r=Object.values(t).filter(t=>"number"==typeof t);return Object.entries(t).filter(([t,o])=>-1===r.indexOf(+t)).map(([t,r])=>r)}function F(t,r="|"){return t.map(t=>ep(t)).join(r)}function K(t,r){return"bigint"==typeof r?r.toString():r}class J{constructor(t){this._getter=t,this._value=void 0}get value(){let t=this._getter;return void 0!==t&&(this._value=t(),this._getter=void 0),this._value}}function Z(t){return new J(t)}function W(t){let r=+!!t.startsWith("^"),o=t.endsWith("$")?t.length-1:t.length;return t.slice(r,o)}let B=Symbol("evaluating");function G(t,r,o){Object.defineProperty(t,r,{value:o,writable:!0,enumerable:!0,configurable:!0})}function X(t){let r=Object.getOwnPropertyDescriptor(t,"shape");return r?.get?r.get.raw:r?.value}function Y(t){return X(t._zod.def)??t._zod.def.shape}function Q(t,r,o){Object.defineProperty(t,r,{get(){let t=o();return G(this,r,t),t},enumerable:!0,configurable:!0})}function ee(t,r,o){r in t?G(t,r,o):t[r]=o}function et(t,r,o,i){let a=Y(r);for(let n of o){let o=Object.getOwnPropertyDescriptor(a,n);o.enumerable&&(o.get?Q(t,n,()=>{let t=r._zod.def.shape[n];return i?i(t,n):t}):ee(t,n,i?i(o.value,n):o.value))}}function er(...t){let r={};for(let o of t)Object.assign(r,Object.getOwnPropertyDescriptors(o));return Object.defineProperties({},r)}let eo="captureStackTrace"in Error?Error.captureStackTrace:(...t)=>{};function ei(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}let ea=Z(()=>{if(eM.jitless||"undefined"!=typeof navigator&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return Function(""),!0}catch(t){return!1}});function en(t){if(!1===ei(t))return!1;let r=t.constructor;if(void 0===r||"function"!=typeof r)return!0;let o=r.prototype;return!1!==ei(o)&&!1!==Object.prototype.hasOwnProperty.call(o,"isPrototypeOf")}function es(t){return en(t)?{...t}:Array.isArray(t)?[...t]:t instanceof Map?new Map(t):t instanceof Set?new Set(t):t}let el=new Set(["string","number","symbol"]);function ec(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function eu(t,r,o){let i=new t._zod.constr(r??t._zod.def);return(!r||o?.parent)&&(i._zod.parent=t),i}function ed(t){if(!t)return{};if("string"==typeof t)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return(delete t.message,"string"==typeof t.error)?{...t,error:()=>t.error}:t}function ep(t){return"bigint"==typeof t?t.toString()+"n":"string"==typeof t?`"${t}"`:`${t}`}let eh={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]},em={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function ef(t,r){let o=Y(t),i=[];for(let t of Reflect.ownKeys(r)){if(!Object.getOwnPropertyDescriptor(o,t)?.enumerable)throw Error(`Unrecognized key: "${String(t)}"`);r[t]&&i.push(t)}return i}function ey(t,r){let o={};et(o,t,Reflect.ownKeys(Y(t)));var i=o,a=r;for(let t of Reflect.ownKeys(a)){let r=Object.getOwnPropertyDescriptor(a,t);r.enumerable&&(r.get?Q(i,t,()=>a[t]):ee(i,t,r.value))}return o}function eg(t,r,o,i="partial"){let a=r._zod.def.checks;if(a&&a.length>0)throw Error(`.${i}() cannot be used on object schemas containing refinements`);let n=o?new Set(ef(r,o)):void 0,s={};return et(s,r,Reflect.ownKeys(Y(r)),t&&((r,o)=>n&&!n.has(o)?r:new t({type:"optional",innerType:r}))),eu(r,er(r._zod.def,{shape:s,checks:[]}))}function ev(t,r=0){if(!0===t.aborted)return!0;for(let o=r;o<t.issues.length;o++)if(t.issues[o]?.continue!==!0)return!0;return!1}function e_(t,r){return r.map(r=>(r.path??(r.path=[]),r.path.unshift(t),r))}function eb(t){return"string"==typeof t?t:t?.message}function eS(t,r,o){var i;for(let a=r;a<t.length;a++)(i=t[a]).schema??(i.schema=o)}function ew(t,r,o){let i=t.inst?._zod?.traits;i?.has("$ZodType")&&(i.has("$ZodCheck")?t.schema??(t.schema=t.inst):t.schema=t.inst);let a=t.schema!==t.inst?t.schema?._zod.def?.error:void 0,n=t.message?t.message:eb(t.inst?._zod.def?.error?.(t))??eb(a?.(t))??eb(r?.error?.(t))??eb(o.customError?.(t))??eb(o.localeError?.(t))??"Invalid input",s={};for(let r of Object.keys(t))"inst"!==r&&"schema"!==r&&"continue"!==r&&"input"!==r&&"__proto__"!==r&&(s[r]=t[r]);return s.path??(s.path=[]),s.message=n,r?.reportInput&&(s.input=t.input),s}let e$=/[\uD800-\uDBFF]/;function eP(t){let r=t.length;if(!e$.test(t))return r;let o=r;for(let i=0;i<r-1;i++)(64512&t.charCodeAt(i))==55296&&(64512&t.charCodeAt(i+1))==56320&&(o--,i++);return o}function eR(t){return Array.isArray(t)?"array":"string"==typeof t?"string":"unknown"}function eE(...t){let[r,o,i]=t;return"string"==typeof r?{message:r,code:"custom",input:o,inst:i}:{...r}}function ek(t,r,o,i=!0){return Object.defineProperty(t,r,{configurable:!0,writable:!0,enumerable:i,value:o}),o}function ex(t,r){for(let o in t){let i=t[o];Object.defineProperty(r,o,{configurable:!0,enumerable:!0,get(){return ek(this,o,i(this))},set(t){ek(this,o,t)}})}return r}let eT=!1,eO={configurable:!0,get(){eT=!0}};function eC(r,o,i){let a=Object.getPrototypeOf(r._zod);if(o in a&&t!==r._zod){t=void 0;return}t=r._zod,Object.defineProperty(a,o,{configurable:!0,get(){Object.defineProperty(this,o,eO);let t=eT;eT=!1;try{let r=i(this);return eT?delete this[o]:Object.defineProperty(this,o,{configurable:!0,writable:!0,value:r}),eT=eT||t,r}catch(r){throw delete this[o],eT=eT||t,r}},set(t){Object.defineProperty(this,o,{configurable:!0,writable:!0,value:t})}})}let ej=Object.freeze({status:"aborted"}),eI={value:void 0,enumerable:!1},eN="captureStackTrace"in Error?Error:null;function eA(t,r,o,i){function a(t){this.def=t,this.constr=u,this.traits=new Set}a.prototype={};let n=o&&new WeakSet;function s(i,s){if(i._zod){if(i._zod.traits.has(t))return}else{eI.value=new a(s);try{Object.defineProperty(i,"_zod",eI)}finally{eI.value=void 0}}if(i._zod.traits.add(t),r(i,s),n){let t=Object.getPrototypeOf(i),r=i._zod.constr.prototype,a=t;for(;a&&a!==r;)a=Object.getPrototypeOf(a);let s=a??t;if(!n.has(s)){n.add(s);var l=s,c=o;for(let t in c){let r=Object.getOwnPropertyDescriptor(c,t);r.get?Object.defineProperty(l,t,{...r,enumerable:!1}):function(t,r,o){Object.defineProperty(t,r,{configurable:!0,get(){return this==null?o:ek(this,r,o.bind(this))},set(t){ek(this,r,t)}})}(l,t,r.value)}}}let d=u.prototype;for(let t in d)Object.prototype.hasOwnProperty.call(d,t)&&(t in i||(i[t]=d[t].bind(i)))}let l=i?.Parent??Object;class c extends l{}function u(t){let r=i?.Parent?function(t){let r=eN;if(r){let o=r.stackTraceLimit;if("number"==typeof o){try{r.stackTraceLimit=0}catch{return eN=null,new t}try{return new t}finally{r.stackTraceLimit=o}}}return new t}(c):this;s(r,t);let o=r._zod.deferred;if(o){for(let t of o)t();r._zod.deferred=void 0}let a=globalThis.__zod_globalConfig?.postProcessor;return a&&a(r),r}return Object.defineProperty(c,"name",{value:t}),Object.defineProperty(u,"init",{value:s}),Object.defineProperty(u,Symbol.hasInstance,{value:r=>!!i?.Parent&&r instanceof i.Parent||r?._zod?.traits?.has(t)}),Object.defineProperty(u,"name",{value:t}),u}class ez extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class eq extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}(x=globalThis).__zod_globalConfig??(x.__zod_globalConfig={});let eM=globalThis.__zod_globalConfig;function eL(t){return t&&Object.assign(eM,t),eM}class eD extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform"),this.name="ZodCyclicError"}}let eU="~memo",eV=[];function eH(t){return null!==t&&"object"==typeof t}function eF(t){return t.map(t=>t.path?{...t,path:t.path.slice()}:{...t})}let eK=new WeakMap,eJ=[],eZ={alloc(t,o,i){let a=r;if(!a)return i;r=void 0;let n={value:i,issues:null};return a.set(o.value,n),eJ.push(n),i},guard(t){var r;(r=t._zod).deferred??(r.deferred=[]),t._zod.deferred.push(()=>{let r=t._zod.parse,o=(t,o)=>{var i,a;let n;if("backward"!==o.direction&&(i=o,a=t.value,void 0!==(n=i[eU]?.backEdges)&&eH(a)&&n.has(a)))throw new eD;return r(t,o)};t._zod.parse=o,t._zod.run===r&&(t._zod.run=o)})},attach(t){var o;let i,a,n,s=!1;(o=t._zod).deferred??(o.deferred=[]),t._zod.deferred.push(()=>{let o=t._zod.parse,l=(c,u)=>{let d;if(void 0===i){let r=function t(r,o,i){var a,n;let s=eK.get(r);if(void 0!==s)return 2*!!s;if(o.has(r))return 2;o.add(r);let l=0,c=r=>{if(2!==l&&r?._zod){let a=t(r,o,i);a>l&&(l=a)}},u=t=>{t>l&&(l=t)},d=r._zod.def;switch(d.type){case"object":{let r=X(d);u(r?((r,a)=>{let n=0;for(let s of Reflect.ownKeys(r)){let l=Object.getOwnPropertyDescriptor(r,s);if(a&&!l.enumerable)continue;let c=l.get?1:l.value?._zod?t(l.value,o,i):0;c>n&&(n=c)}return n})(r,!0):1),c(d.catchall);break}case"array":c(d.element);break;case"tuple":for(let t of d.items)c(t);c(d.rest);break;case"record":case"map":c(d.keyType),c(d.valueType);break;case"set":c(d.valueType);break;case"union":for(let t of d.options)c(t);break;case"intersection":c(d.left),c(d.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":c(d.innerType);break;case"pipe":c(d.in),c(d.out);break;case"function":c(d.input),c(d.output);break;case"lazy":{let a=d._cachedInner??(i?r._zod.innerType:void 0);u(a?t(a,o,!1):1);break}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":break;default:for(let t in d){let r=Object.getOwnPropertyDescriptor(d,t);if(!r||r.get)continue;let o=r.value;if(o&&"object"==typeof o){if(o._zod)c(o);else if(Array.isArray(o))for(let t of o)c(t)}}}return o.delete(r),a=r,1!==(n=l)&&eK.set(a,2===n),n}(t,new Set,!1);if(0===r)return t._zod.parse=o,t._zod.run===l&&(t._zod.run=o),o(c,u);2===r||s?i=!0:s=!0}let p=c.value;if(!eH(p))return o(c,u);let h=u[eU];if(h||(h={buckets:new WeakMap,backEdges:void 0},u[eU]=h),a===u)d=n;else{var m,f;let r;m=h,f=t,(r=m.buckets.get(f))||(r=new WeakMap,m.buckets.set(f,r)),d=r,a=u,n=d}let y=d.get(p);if(y)return c.value=y.value,y.issues?y.issues.length&&c.issues.push(...eF(y.issues)):(c.memo=!0,h.backEdges??(h.backEdges=new WeakSet),h.backEdges.add(y.value)),c;r=d;let g=eJ.length,v=o(c,u);r=void 0;let _=eJ.length>g?eJ.pop():void 0;return v instanceof Promise?v.then(t=>(_&&(_.issues=t.issues.length?eF(t.issues):eV),t)):(_&&(_.issues=v.issues.length?eF(v.issues):eV),v)};t._zod.parse=l,t._zod.run===o&&(t._zod.run=l)})}},eW=/^[cC][0-9a-z]{6,}$/,eB=/^[0-9a-z]+$/,eG=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,eX=/^[0-9a-vA-V]{20}$/,eY=/^[A-Za-z0-9]{27}$/,eQ=/^[a-zA-Z0-9_-]{21}$/,e0=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,e1=/^([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})$/,e2=t=>t?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${t}[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)$/,e9=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,e4=`^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`,e5=/^(?:(?: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])$/,e3=/^(([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}|:))$/,e6=/^((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])$/,e8=/^(([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}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,e7=/^https?$/,te=/^\+[1-9]\d{6,14}$/,tt="(?:(?:\\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])))",tr=($=tt,RegExp(`^${$}$`));function to(t){let r="(?:[01]\\d|2[0-3]):[0-5]\\d";return"number"==typeof t.precision?-1===t.precision?`${r}`:0===t.precision?`${r}:[0-5]\\d`:`${r}:[0-5]\\d\\.\\d{${t.precision}}`:t.seconds?`${r}:[0-5]\\d(?:\\.\\d+)?`:`${r}(?::[0-5]\\d(?:\\.\\d+)?)?`}let ti=/^[\s\S]{0,}$/,ta=/^-?\d+$/,tn=/^-?\d+(?:\.\d+)?$/,ts=/^(?:true|false)$/i,tl=/^null$/i,tc=/^[^A-Z]*$/,tu=/^[^a-z]*$/,td=eA("$ZodCheck",(t,r)=>{var o;t._zod??(t._zod={}),t._zod.def=r,(o=t._zod).onattach??(o.onattach=[])}),tp=t=>{let r=t.value;return null!=r&&void 0!==r.length},th={number:"number",bigint:"bigint",object:"date"},tm=eA("$ZodCheckLessThan",(t,r)=>{td.init(t,r);let o=th[typeof r.value];t._zod.check=i=>{(r.inclusive?i.value<=r.value:i.value<r.value)||i.issues.push({origin:th[typeof i.value]??o,code:"too_big",maximum:"object"==typeof r.value?r.value.getTime():r.value,input:i.value,inclusive:r.inclusive,inst:t,continue:!r.abort})}}),tf=eA("$ZodCheckGreaterThan",(t,r)=>{td.init(t,r);let o=th[typeof r.value];t._zod.check=i=>{(r.inclusive?i.value>=r.value:i.value>r.value)||i.issues.push({origin:th[typeof i.value]??o,code:"too_small",minimum:"object"==typeof r.value?r.value.getTime():r.value,input:i.value,inclusive:r.inclusive,inst:t,continue:!r.abort})}}),ty=eA("$ZodCheckMultipleOf",(t,r)=>{td.init(t,r),t._zod.check=o=>{var i;let a,n,s;if(typeof o.value!=typeof r.value)throw Error("Cannot mix number and bigint in multiple_of check.");("bigint"==typeof o.value?r.value!==BigInt(0)&&o.value%r.value===BigInt(0):0==(n=Math.round(a=(i=o.value)/r.value),s=4*Number.EPSILON*Math.max(Math.abs(a),1),Math.abs(a-n)<s?0:a-n))||o.issues.push({origin:typeof o.value,code:"not_multiple_of",divisor:r.value,input:o.value,inst:t,continue:!r.abort})}}),tg=eA("$ZodCheckNumberFormat",(t,r)=>{td.init(t,r),r.format=r.format||"float64";let o=r.format?.includes("int"),i=o?"int":"number",[a,n]=eh[r.format];t._zod.check=s=>{let l=s.value;if(o){if(!Number.isInteger(l))return void s.issues.push({expected:i,format:r.format,code:"invalid_type",continue:!1,input:l,inst:t});if(!Number.isSafeInteger(l))return void(l>0?s.issues.push({input:l,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:i,inclusive:!0,continue:!r.abort}):s.issues.push({input:l,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:i,inclusive:!0,continue:!r.abort}))}l<a&&s.issues.push({origin:"number",input:l,code:"too_small",minimum:a,inclusive:!0,inst:t,continue:!r.abort}),l>n&&s.issues.push({origin:"number",input:l,code:"too_big",maximum:n,inclusive:!0,inst:t,continue:!r.abort})}}),tv=eA("$ZodCheckMaxLength",(t,r)=>{var o;td.init(t,r),(o=t._zod.def).when??(o.when=tp),t._zod.check=o=>{let i=o.value,a=i.length;if(("string"==typeof i&&a>r.maximum?eP(i):a)<=r.maximum)return;let n=eR(i);o.issues.push({origin:n,code:"too_big",maximum:r.maximum,inclusive:!0,input:i,inst:t,continue:!r.abort})}}),t_=eA("$ZodCheckMinLength",(t,r)=>{var o;td.init(t,r),(o=t._zod.def).when??(o.when=tp),t._zod.check=o=>{let i=o.value,a=i.length;if(("string"==typeof i&&a>=r.minimum&&a<2*r.minimum?eP(i):a)>=r.minimum)return;let n=eR(i);o.issues.push({origin:n,code:"too_small",minimum:r.minimum,inclusive:!0,input:i,inst:t,continue:!r.abort})}}),tb=eA("$ZodCheckLengthEquals",(t,r)=>{var o;td.init(t,r),(o=t._zod.def).when??(o.when=tp),t._zod.check=o=>{let i=o.value,a=i.length,n="string"==typeof i&&a>=r.length&&a<=2*r.length?eP(i):a;if(n===r.length)return;let s=eR(i),l=n>r.length;o.issues.push({origin:s,...l?{code:"too_big",maximum:r.length}:{code:"too_small",minimum:r.length},inclusive:!0,exact:!0,input:o.value,inst:t,continue:!r.abort})}}),tS=eA("$ZodCheckStringFormat",(t,r)=>{var o,i;td.init(t,r),r.pattern?(o=t._zod).check??(o.check=o=>{r.pattern.lastIndex=0,r.pattern.test(o.value)||o.issues.push({origin:"string",code:"invalid_format",format:r.format,input:o.value,...r.pattern?{pattern:r.pattern.toString()}:{},inst:t,continue:!r.abort})}):(i=t._zod).check??(i.check=()=>{})}),tw=eA("$ZodCheckRegex",(t,r)=>{tS.init(t,r),t._zod.check=o=>{r.pattern.lastIndex=0,r.pattern.test(o.value)||o.issues.push({origin:"string",code:"invalid_format",format:"regex",input:o.value,pattern:r.pattern.toString(),inst:t,continue:!r.abort})}}),t$=eA("$ZodCheckLowerCase",(t,r)=>{r.pattern??(r.pattern=tc),tS.init(t,r)}),tP=eA("$ZodCheckUpperCase",(t,r)=>{r.pattern??(r.pattern=tu),tS.init(t,r)}),tR=eA("$ZodCheckIncludes",(t,r)=>{td.init(t,r);let o=ec(r.includes),i=new RegExp("number"==typeof r.position?`^.{${r.position},}${o}`:o);r.pattern=i,t._zod.check=o=>{o.value.includes(r.includes,r.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:r.includes,input:o.value,inst:t,continue:!r.abort})}}),tE=eA("$ZodCheckStartsWith",(t,r)=>{td.init(t,r);let o=RegExp(`^${ec(r.prefix)}.*`);r.pattern??(r.pattern=o),t._zod.check=o=>{o.value.startsWith(r.prefix)||o.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:r.prefix,input:o.value,inst:t,continue:!r.abort})}}),tk=eA("$ZodCheckEndsWith",(t,r)=>{td.init(t,r);let o=RegExp(`.*${ec(r.suffix)}$`);r.pattern??(r.pattern=o),t._zod.check=o=>{o.value.endsWith(r.suffix)||o.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:r.suffix,input:o.value,inst:t,continue:!r.abort})}}),tx=eA("$ZodCheckOverwrite",(t,r)=>{td.init(t,r),t._zod.check=t=>{t.value=r.tx(t.value)}});class tT{constructor(t=[],r={}){this.content=[],this.indent=0,this.args=t,this.closed=r}indented(t){this.indent+=1;try{t(this)}finally{this.indent-=1}}write(t){if("function"==typeof t){t(this,{execution:"sync"}),t(this,{execution:"async"});return}let r=t.split("\n").filter(t=>t),o=Math.min(...r.map(t=>t.length-t.trimStart().length));for(let t of r.map(t=>t.slice(o)).map(t=>" ".repeat(2*this.indent)+t))this.content.push(t)}compile(){let t=Function,r=this?.content??[""];return new t(...Object.keys(this.closed),`return function (${this.args.join(", ")}) {
|
|
2
|
+
${r.join("\n")}
|
|
3
|
+
};`)(...Object.values(this.closed))}}let tO={major:4,minor:6,patch:5},tC=eA("$ZodType",(t,r)=>{var o;t??(t={}),t._zod.def=r,t._zod.bag=t._zod.bag||{},t._zod.version=tO;let i=t._zod.def.checks,a=t._zod.traits.has("$ZodCheck")?[t,...i??[]]:i?.length?[...i]:[];for(let r of a)for(let o of r._zod.onattach)o(t);if(0===a.length)(o=t._zod).deferred??(o.deferred=[]),t._zod.deferred?.push(()=>{t._zod.run=t._zod.parse});else{let r=(r,o,i)=>{let a;if(r.memo)return r;let n=ev(r);for(let s of o){if(s._zod.def.when){if(function(t,r=0){if(!0===t.aborted)return!0;for(let o=r;o<t.issues.length;o++)if(t.issues[o]?.continue===!1)return!0;return!1}(r)||!s._zod.def.when(r))continue}else if(n)continue;let o=r.issues.length,l=s._zod.check(r);if(l instanceof Promise&&i?.async===!1)throw new ez;if(a||l instanceof Promise)a=(a??Promise.resolve()).then(async()=>{await l,r.issues.length!==o&&(eS(r.issues,o,t),n||(n=ev(r,o)))});else{if(r.issues.length===o)continue;eS(r.issues,o,t),n||(n=ev(r,o))}}return a?a.then(()=>r):r},o=(o,i,n)=>{if(ev(o))return o.aborted=!0,o;let s=r(i,a,n);if(s instanceof Promise){if(!1===n.async)throw new ez;return s.then(r=>t._zod.parse(r,n))}return t._zod.parse(s,n)};t._zod.run=(i,n)=>{if(n.skipChecks)return t._zod.parse(i,n);if("backward"===n.direction){let r=t._zod.parse({value:i.value,issues:[]},{...n,skipChecks:!0});return r instanceof Promise?r.then(t=>o(t,i,n)):o(r,i,n)}let s=t._zod.parse(i,n);if(s instanceof Promise){if(!1===n.async)throw new ez;return s.then(t=>r(t,a,n))}return r(s,a,n)}}},{get"~standard"(){var tj;return tj=this,ek(tj,"~standard",tA(this),!1)},set"~standard"(value){ek(this,"~standard",value)}}),tI=(t,r)=>t.issues.length?{issues:t.issues.map(t=>ew(t,r,eL()))}:{value:t.value};async function tN(t,r){let o={async:!0};return tI(await t._zod.run({value:r,issues:[]},o),o)}function tA(t){return{validate:r=>{let o={async:!1};try{let i=t._zod.run({value:r,issues:[]},o);if(!(i instanceof Promise))return tI(i,o)}catch(t){}return tN(t,r)},vendor:"zod",version:1}}let tz=eA("$ZodString",(t,r)=>{tC.init(t,r),t._zod.pattern=r.pattern??ti,t._zod.parse=(o,i)=>{if(r.coerce)try{o.value=String(o.value)}catch(t){}return"string"==typeof o.value||o.issues.push({expected:"string",code:"invalid_type",input:o.value,inst:t}),o}}),tq=eA("$ZodStringFormat",(t,r)=>{tS.init(t,r),tz.init(t,r)}),tM=eA("$ZodGUID",(t,r)=>{r.pattern??(r.pattern=e1),tq.init(t,r)}),tL=eA("$ZodUUID",(t,r)=>{if(r.version){let t={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[r.version];if(void 0===t)throw Error(`Invalid UUID version: "${r.version}"`);r.pattern??(r.pattern=e2(t))}else r.pattern??(r.pattern=e2());tq.init(t,r)}),tD=eA("$ZodEmail",(t,r)=>{r.pattern??(r.pattern=e9),tq.init(t,r)});function tU(t){try{if("undefined"!=typeof URL&&"function"==typeof URL.canParse)return URL.canParse(t);return new URL(t),!0}catch{return!1}}let tV=/[\t\n\r]/g;function tH(t){return t.replace(tV,"")}let tF=eA("$ZodURL",(t,r)=>{tq.init(t,r),t._zod.check=o=>{try{var i,a,n,s,l,c;let u=o.value.trim(),d=(i=u,a=r,"normalize"in a||"hostname"in a||"protocol"in a?function(t,r){if(!r.normalize&&r.protocol?.source===e7.source&&!/^https?:\/\//i.test(t))return 1;try{if("undefined"!=typeof URL){let r=URL;if("function"==typeof r.parse)return r.parse(t)??2}return new URL(t)}catch{return 2}}(i,a):tU(i)||2);if(1===d)return void o.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:o.value,inst:t,continue:!r.abort});if(2===d)return void o.issues.push({code:"invalid_format",format:"url",input:o.value,inst:t,continue:!r.abort});if(!0===d){o.value=tH(u);return}r.hostname&&(n=d,(s=r.hostname).lastIndex=0,!s.test(n.hostname))&&o.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:r.hostname.source,input:o.value,inst:t,continue:!r.abort}),r.protocol&&(l=d,(c=r.protocol).lastIndex=0,!c.test(l.protocol.endsWith(":")?l.protocol.slice(0,-1):l.protocol))&&o.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:r.protocol.source,input:o.value,inst:t,continue:!r.abort}),o.value=r.normalize?d.href:tH(u);return}catch(i){o.issues.push({code:"invalid_format",format:"url",input:o.value,inst:t,continue:!r.abort})}}}),tK=eA("$ZodEmoji",(t,r)=>{r.pattern??(r.pattern=RegExp(e4,"u")),tq.init(t,r)}),tJ=eA("$ZodNanoID",(t,r)=>{var o;if(void 0!==r.length&&(!Number.isInteger(r.length)||r.length<1))throw Error(`Invalid nanoid length: ${r.length}`);r.pattern??(r.pattern=void 0===r.length?eQ:(o=r.length,RegExp(`^[a-zA-Z0-9_-]{${o}}$`))),tq.init(t,r)}),tZ=eA("$ZodCUID",(t,r)=>{r.pattern??(r.pattern=eW),tq.init(t,r)}),tW=eA("$ZodCUID2",(t,r)=>{r.pattern??(r.pattern=eB),tq.init(t,r)}),tB=eA("$ZodULID",(t,r)=>{r.pattern??(r.pattern=eG),tq.init(t,r)}),tG=eA("$ZodXID",(t,r)=>{r.pattern??(r.pattern=eX),tq.init(t,r)}),tX=eA("$ZodKSUID",(t,r)=>{r.pattern??(r.pattern=eY),tq.init(t,r)}),tY=eA("$ZodISODateTime",(t,r)=>{var o;let i,a,n;r.pattern??(i=["Z"],(o=r).offset&&i.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)"),a=`${to({precision:o.precision,seconds:!0})}(?:${i.join("|")})`,n=o.local?`${a}|${to({precision:o.precision})}`:a,r.pattern=RegExp(`^${tt}T(?:${n})$`)),tq.init(t,r)}),tQ=eA("$ZodISODate",(t,r)=>{r.pattern??(r.pattern=tr),tq.init(t,r)}),t0=eA("$ZodISOTime",(t,r)=>{var o;r.pattern??(o=r,r.pattern=RegExp(`^${to(o)}$`)),tq.init(t,r)}),t1=eA("$ZodISODuration",(t,r)=>{r.pattern??(r.pattern=e0),tq.init(t,r)}),t2=eA("$ZodIPv4",(t,r)=>{r.pattern??(r.pattern=e5),tq.init(t,r)}),t9=/^[0-9a-fA-F:.]+$/;function t4(t){return!!t9.test(t)&&tU(`http://[${t}]`)}let t5=eA("$ZodIPv6",(t,r)=>{r.pattern??(r.pattern=e3),tq.init(t,r),t._zod.check=o=>{t4(o.value)||o.issues.push({code:"invalid_format",format:"ipv6",input:o.value,inst:t,continue:!r.abort})}}),t3=eA("$ZodCIDRv4",(t,r)=>{r.pattern??(r.pattern=e6),tq.init(t,r)}),t6=eA("$ZodCIDRv6",(t,r)=>{r.pattern??(r.pattern=e8),tq.init(t,r),t._zod.check=o=>{!function(t){let r=t.split("/");if(2!==r.length)return!1;let[o,i]=r;if(!i)return!1;let a=Number(i);return`${a}`===i&&!(a<0)&&!(a>128)&&t4(o)}(o.value)&&o.issues.push({code:"invalid_format",format:"cidrv6",input:o.value,inst:t,continue:!r.abort})}});function t8(t){if(""===t)return!0;if(/\s/.test(t)||t.length%4!=0)return!1;try{return atob(t),!0}catch{return!1}}let t7=/^[0-9a-zA-Z+/]*={0,2}$/,re=eA("$ZodBase64",(t,r)=>{r.pattern??(r.pattern=t7),tq.init(t,r),t._zod.check=o=>{t8(o.value)||o.issues.push({code:"invalid_format",format:"base64",input:o.value,inst:t,continue:!r.abort})}}),rt=/^[A-Za-z0-9_-]*$/,rr=eA("$ZodBase64URL",(t,r)=>{r.pattern??(r.pattern=rt),tq.init(t,r),t._zod.check=o=>{!function(t){if(!rt.test(t))return!1;let r=t.replace(/[-_]/g,t=>"-"===t?"+":"/");return t8(r.padEnd(4*Math.ceil(r.length/4),"="))}(o.value)&&o.issues.push({code:"invalid_format",format:"base64url",input:o.value,inst:t,continue:!r.abort})}}),ro=eA("$ZodE164",(t,r)=>{r.pattern??(r.pattern=te),tq.init(t,r)}),ri=eA("$ZodJWT",(t,r)=>{tq.init(t,r),t._zod.check=o=>{!function(t,r=null){try{let o=t.split(".");if(3!==o.length)return!1;let[i]=o;if(!i)return!1;let a=JSON.parse(atob(i));if("typ"in a&&a?.typ!=="JWT"||!a.alg||r&&(!("alg"in a)||a.alg!==r))return!1;return!0}catch{return!1}}(o.value,r.alg)&&o.issues.push({code:"invalid_format",format:"jwt",input:o.value,inst:t,continue:!r.abort})}}),ra=eA("$ZodNumber",(t,r)=>{tC.init(t,r),t._zod.pattern=tn,t._zod.parse=(o,i)=>{if(r.coerce)try{o.value=Number(o.value)}catch(t){}let a=o.value;if("number"==typeof a&&!Number.isNaN(a)&&Number.isFinite(a))return o;let n="number"==typeof a?Number.isNaN(a)?"NaN":Number.isFinite(a)?void 0:String(a):void 0;return o.issues.push({expected:"number",code:"invalid_type",input:a,inst:t,...n?{received:n}:{}}),o}}),rn=eA("$ZodNumberFormat",(t,r)=>{tg.init(t,r),ra.init(t,r)}),rs=eA("$ZodBoolean",(t,r)=>{tC.init(t,r),t._zod.pattern=ts,t._zod.parse=(o,i)=>{if(r.coerce)try{o.value=!!o.value}catch(t){}let a=o.value;return"boolean"==typeof a||o.issues.push({expected:"boolean",code:"invalid_type",input:a,inst:t}),o}}),rl=eA("$ZodNull",(t,r)=>{tC.init(t,r),t._zod.pattern=tl,t._zod.values=new Set([null]),t._zod.parse=(r,o)=>{let i=r.value;return null===i||r.issues.push({expected:"null",code:"invalid_type",input:i,inst:t}),r}}),rc=eA("$ZodAny",(t,r)=>{tC.init(t,r),t._zod.parse=t=>t}),ru=eA("$ZodUnknown",(t,r)=>{tC.init(t,r),t._zod.parse=t=>t}),rd=eA("$ZodNever",(t,r)=>{tC.init(t,r),t._zod.parse=(r,o)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:t}),r)});function rp(t,r,o){t.issues.length&&r.issues.push(...e_(o,t.issues)),r.value[o]=t.value}let rh=eA("$ZodArray",(t,r)=>{tC.init(t,r);let o=eM.memoizer;o?.attach(t),t._zod.parse=(i,a)=>{let n=i.value;if(!Array.isArray(n))return i.issues.push({expected:"array",code:"invalid_type",input:n,inst:t}),i;i.value=o?o.alloc(t,i,Array(n.length),a):Array(n.length);let s=[],l=a?.abortEarly;for(let t=0;t<n.length;t++){let o=n[t],c=r.element._zod.run({value:o,issues:[]},a);if(c instanceof Promise)s.push(c.then(r=>rp(r,i,t)));else if(rp(c,i,t),l&&0!==c.issues.length&&ev(c))break}return s.length?Promise.all(s).then(()=>i):i}});function rm(t,r,o,i,a,n){let s=o in i,l="optional"===n;if(s||!l||"optional"!==a){if(t.issues.length){if(void 0!==a&&l&&!s)return;r.issues.push(...e_(o,t.issues))}if(!s&&void 0===a){t.issues.length||r.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[o]});return}void 0===t.value?(s||"defaulted"===a&&!l)&&(r.value[o]=void 0):r.value[o]=t.value}}let rf=[];function ry(t){var r;let o=Object.keys(t.shape),i=Object.getOwnPropertySymbols(t.shape),a=i.length?i:rf,n=a.length?[...o,...a]:o;for(let r of n)if(!t.shape?.[r]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${String(r)}": expected a Zod schema`);let s=Object.keys(r=t.shape).filter(t=>void 0!==r[t]._zod.optin&&"optional"===r[t]._zod.optout);return{...t,allKeys:n,symbolKeys:a,keySet:new Set(o),numKeys:o.length,optionalKeys:new Set(s)}}function rg(t,r,o,i,a,n,s){let l=[],c=a.keySet,u=a.catchall._zod,d=u.def.type,p=u.optin,h=u.optout,m=0;for(let a in r){if(s&&o.issues.length!==m){if(ev(o,m))break;m=o.issues.length}if(c.has(a))continue;if("__proto__"===a){"never"===d&&l.push(a);continue}if("never"===d){l.push(a);continue}let n=u.run({value:r[a],issues:[]},i);n instanceof Promise?t.push(n.then(t=>rm(t,o,a,r,p,h))):rm(n,o,a,r,p,h)}return(l.length&&o.issues.push({code:"unrecognized_keys",keys:l,input:r,inst:n,continue:!0}),t.length)?Promise.all(t).then(()=>o):o}let rv=eA("$ZodObject",(t,r)=>{let o;tC.init(t,r);let i=Object.getOwnPropertyDescriptor(r,"shape"),a=i?.get?i.get.raw:r.shape??{};if(a){let t=()=>{let o={...a};return Object.defineProperty(r,"shape",{value:o}),t.raw=o,o};t.raw=a,Object.defineProperty(r,"shape",{get:t})}let n=Z(()=>ry(r));eC(t,"propValues",t=>{let r=t.def.shape,o={};for(let t in r){let i=r[t]._zod;if(i.values){for(let r of(Object.prototype.hasOwnProperty.call(o,t)||G(o,t,new Set),i.values))o[t].add(r);void 0!==i.optin&&o[t].add(void 0)}}return o});let s=r.catchall,l=eM.memoizer;l?.attach(t),t._zod.parse=(r,i)=>{o??(o=n.value);let a=r.value;if(!ei(a))return r.issues.push({expected:"object",code:"invalid_type",input:a,inst:t}),r;r.value=l?l.alloc(t,r,{},i):{};let c=[],u=o.shape,d=i?.abortEarly,p=r.issues.length;for(let t of o.allKeys){if(d&&r.issues.length!==p){if(ev(r,p))break;p=r.issues.length}if("__proto__"===t)continue;let o=u[t],n=o._zod.optin,s=o._zod.optout,l=o._zod.run({value:a[t],issues:[]},i);l instanceof Promise?c.push(l.then(o=>rm(o,r,t,a,n,s))):rm(l,r,t,a,n,s)}return s?rg(c,a,r,i,n.value,t,!0===d):c.length?Promise.all(c).then(()=>r):r}}),r_=eA("$ZodObjectJIT",(t,r)=>{let o,i;rv.init(t,r);let a=t._zod.parse,n=Z(()=>ry(r)),s=eM.memoizer,l=!eM.jitless,c=l&&ea.value,u=r.catchall;t._zod.parse=(d,p)=>{i??(i=n.value);let h=d.value;return ei(h)?l&&c&&p?.async===!1&&!0!==p.jitless?(o||(o=(r=>{let o=n.value,i=o.symbolKeys,a=new tT(["payload","ctx"],{shape:r,inst:t,memo:s,syms:i}),l=t=>`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`,c=(t,r)=>`
|
|
4
|
+
let ${t}_ab = false;
|
|
5
|
+
for (let i = 0; i < ${t}.issues.length; i++) {
|
|
6
|
+
const iss = ${t}.issues[i];
|
|
7
|
+
iss.path = iss.path ? [${r}, ...iss.path] : [${r}];
|
|
8
|
+
payload.issues.push(iss);
|
|
9
|
+
if (iss.continue !== true) ${t}_ab = true;
|
|
8
10
|
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
if (${t}_ab && ctx && ctx.abortEarly) {
|
|
12
|
+
payload.value = newResult;
|
|
13
|
+
return payload;
|
|
14
|
+
}`;a.write("const input = payload.value;");let u=Object.create(null),d=0;for(let t of o.allKeys)u[t]=`key_${d++}`;for(let t of(a.write(s?"const newResult = memo.alloc(inst, payload, {}, ctx);":"const newResult = {};"),o.allKeys)){if("__proto__"===t)continue;let o=u[t],n="symbol"==typeof t?`syms[${i.indexOf(t)}]`:JSON.stringify(t),s=`${n} in input`,d=r[t],p=d?._zod?.optin,h=void 0!==p,m=d?._zod?.optout==="optional";if(a.write(`const ${o} = ${l(n)};`),h&&m){let t="optional"===p?`${o}_present`:`${o}.value !== undefined || ${o}_present`;a.write(`
|
|
15
|
+
const ${o}_present = ${s};
|
|
16
|
+
if (!${o}.issues.length || ${o}_present) {
|
|
17
|
+
if (${o}.issues.length) {${c(o,n)}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
if (${t}) {
|
|
21
|
+
newResult[${n}] = ${o}.value;
|
|
14
22
|
}
|
|
15
|
-
} else {
|
|
16
|
-
newResult[${s}] = ${r}.value;
|
|
17
23
|
}
|
|
18
|
-
|
|
19
|
-
`)
|
|
20
|
-
if (${
|
|
21
|
-
payload.issues = payload.issues.concat(${r}.issues.map(iss => ({
|
|
22
|
-
...iss,
|
|
23
|
-
path: iss.path ? [${s}, ...iss.path] : [${s}]
|
|
24
|
-
})));
|
|
24
|
+
|
|
25
|
+
`)}else h?(a.write(`
|
|
26
|
+
if (${o}.issues.length) {${c(o,n)}
|
|
25
27
|
}
|
|
26
|
-
|
|
27
|
-
if (${
|
|
28
|
-
|
|
29
|
-
newResult[${s}] = undefined;
|
|
30
|
-
}
|
|
31
|
-
} else {
|
|
32
|
-
newResult[${s}] = ${r}.value;
|
|
28
|
+
`),"defaulted"===p?a.write(`newResult[${n}] = ${o}.value;`):a.write(`
|
|
29
|
+
if (${o}.value !== undefined || ${s}) {
|
|
30
|
+
newResult[${n}] = ${o}.value;
|
|
33
31
|
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
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
|
-
})));
|
|
32
|
+
`)):a.write(`
|
|
33
|
+
const ${o}_present = ${s};
|
|
34
|
+
if (${o}.issues.length) {${c(o,n)}
|
|
42
35
|
}
|
|
43
|
-
if (!${
|
|
36
|
+
if (!${o}_present && !${o}.issues.length) {
|
|
44
37
|
payload.issues.push({
|
|
45
38
|
code: "invalid_type",
|
|
46
39
|
expected: "nonoptional",
|
|
47
40
|
input: undefined,
|
|
48
|
-
path: [${
|
|
41
|
+
path: [${n}]
|
|
49
42
|
});
|
|
43
|
+
if (ctx && ctx.abortEarly) {
|
|
44
|
+
payload.value = newResult;
|
|
45
|
+
return payload;
|
|
46
|
+
}
|
|
50
47
|
}
|
|
51
48
|
|
|
52
|
-
if (${
|
|
53
|
-
|
|
54
|
-
newResult[${s}] = undefined;
|
|
55
|
-
} else {
|
|
56
|
-
newResult[${s}] = ${r}.value;
|
|
57
|
-
}
|
|
49
|
+
if (${o}_present) {
|
|
50
|
+
newResult[${n}] = ${o}.value;
|
|
58
51
|
}
|
|
59
52
|
|
|
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>
|
|
53
|
+
`)}return a.write("payload.value = newResult;"),a.write("return payload;"),a.compile()})(r.shape)),d=o(d,p),u)?rg([],h,d,p,i,t,p?.abortEarly===!0):d:a(d,p):(d.issues.push({expected:"object",code:"invalid_type",input:h,inst:t}),d)}});function rb(t,r,o,i){for(let o of t)if(0===o.issues.length)return r.value=o.value,r;let a=t.filter(t=>!ev(t));return 1===a.length?(r.value=a[0].value,a[0]):(r.issues.push({code:"invalid_union",input:r.value,inst:o,errors:t.map(t=>t.issues.map(t=>ew(t,i,eL())))}),r)}let rS=eA("$ZodUnion",(t,r)=>{tC.init(t,r),eC(t,"optin",t=>t.def.options.some(t=>"defaulted"===t._zod.optin)?"defaulted":t.def.options.some(t=>void 0!==t._zod.optin)?"optional":void 0),eC(t,"optout",t=>t.def.options.some(t=>"optional"===t._zod.optout)?"optional":void 0),eC(t,"values",t=>{if(t.def.options.every(t=>t._zod.values))return new Set(t.def.options.flatMap(t=>Array.from(t._zod.values)))}),eC(t,"pattern",t=>{if(t.def.options.every(t=>t._zod.pattern)){let r=t.def.options.map(t=>t._zod.pattern);return RegExp(`^(${r.map(t=>W(t.source)).join("|")})$`)}});let o=1===r.options.length?r.options[0]._zod.run:null;t._zod.parse=(i,a)=>{if(o)return o(i,a);let n=!1,s=[];for(let t of r.options){let r=t._zod.run({value:i.value,issues:[]},a);if(r instanceof Promise)s.push(r),n=!0;else{if(0===r.issues.length)return r;s.push(r)}}return n?Promise.all(s).then(r=>rb(r,i,t,a)):rb(s,i,t,a)}}),rw=eA("$ZodDiscriminatedUnion",(t,r)=>{r.inclusive=!1,rS.init(t,r);let o=t._zod.parse;eC(t,"propValues",t=>{let r={},o=0;for(let i of t.def.options){let a=i._zod.propValues;if(!a||0===Object.keys(a).length)throw Error(`Invalid discriminated union option at index "${t.def.options.indexOf(i)}"`);for(let[i,n]of(a[t.def.discriminator]?.has(void 0)&&o++,Object.entries(a)))for(let t of(Object.prototype.hasOwnProperty.call(r,i)||G(r,i,new Set),n))r[i].add(t)}return!t.def.unionFallback&&o>1&&r[t.def.discriminator]?.delete(void 0),r}),r.options.forEach((t,o)=>{let i=X(t._zod.def);if(i&&!Object.prototype.hasOwnProperty.call(i,r.discriminator))throw Error(`Invalid discriminated union option at index "${o}"`)});let i=Z(()=>(function(t){let r=new Map;for(let o of t.options){let i=o._zod.propValues?.[t.discriminator];if(!i||0===i.size)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(o)}"`);for(let t of i)if(r.has(t)){if(void 0!==t)throw Error(`Duplicate discriminator value "${String(t)}"`);r.set(t,null)}else r.set(t,o)}return r})(r));t._zod.parse=(a,n)=>{let s=a.value;if(!ei(s))return a.issues.push({code:"invalid_type",expected:"object",input:s,inst:t}),a;let l=s?.[r.discriminator],c=i.value.get(l);return c&&(void 0!==l||"backward"!==n.direction)?c._zod.run(a,n):r.unionFallback||"backward"===n.direction?o(a,n):(a.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:r.discriminator,options:Array.from(i.value.keys()).filter(t=>null!==i.value.get(t)),input:s,path:[r.discriminator],inst:t}),a)}}),r$=eA("$ZodIntersection",(t,r)=>{tC.init(t,r),t._zod.parse=(t,o)=>{let i=t.value,a=r.left._zod.run({value:i,issues:[]},o),n=r.right._zod.run({value:i,issues:[]},o);return a instanceof Promise||n instanceof Promise?Promise.all([a,n]).then(([r,o])=>rP(t,r,o)):rP(t,a,n)}});function rP(t,r,o){let i,a=new Map,n=new Map,s=(t,r)=>{let o;if("unrecognized_keys"!==t.code||t.path?.length)if("invalid_key"!==t.code||"record"!==t.origin||t.path?.length!==1)return!1;else{let r=String(t.path[0]);n.has(r)||n.set(r,t),o=[r]}else i??(i=t),o=t.keys;for(let t of o)a.has(t)||a.set(t,{}),a.get(t)[r]=!0;return!0};for(let o of r.issues)s(o,"l")||t.issues.push(o);for(let r of o.issues)s(r,"r")||t.issues.push(r);let l=[...a].filter(([,t])=>t.l&&t.r).map(([t])=>t);if(l.length){let r=i?l.filter(t=>i.keys.includes(t)):[];for(let o of(r.length&&t.issues.push({...i,keys:r}),l))!r.includes(o)&&n.has(o)&&t.issues.push(n.get(o))}let c=function t(r,o){if(r===o||r instanceof Date&&o instanceof Date&&+r==+o)return{valid:!0,data:r};if(en(r)&&en(o)){let i=Object.keys(o),a=Object.keys(r).filter(t=>-1!==i.indexOf(t)),n={...r,...o};for(let i of(Object.prototype.hasOwnProperty.call(n,"__proto__")&&delete n.__proto__,a)){if("__proto__"===i)continue;let a=t(r[i],o[i]);if(!a.valid)return{valid:!1,mergeErrorPath:[i,...a.mergeErrorPath]};n[i]=a.data}return{valid:!0,data:n}}if(Array.isArray(r)&&Array.isArray(o)){if(r.length!==o.length)return{valid:!1,mergeErrorPath:[]};let i=[];for(let a=0;a<r.length;a++){let n=r[a],s=t(n,o[a]);if(!s.valid)return{valid:!1,mergeErrorPath:[a,...s.mergeErrorPath]};i.push(s.data)}return{valid:!0,data:i}}return{valid:!1,mergeErrorPath:[]}}(r.value,o.value);if(!c.valid){if(ev(t))return t;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return t.value=c.data,t}let rR=eA("$ZodRecord",(t,r)=>{tC.init(t,r);let o=eM.memoizer;o?.attach(t),t._zod.parse=(i,a)=>{let n=i.value;if(!en(n))return i.issues.push({expected:"record",code:"invalid_type",input:n,inst:t}),i;let s=[],l=r.keyType._zod.values;if(l&&!r.partial){let c;i.value=o?o.alloc(t,i,{},a):{};let u=new Set;for(let o of l)if("string"==typeof o||"number"==typeof o||"symbol"==typeof o){if(u.add("number"==typeof o?o.toString():o),"__proto__"===o)continue;let l=r.keyType._zod.run({value:o,issues:[]},a);if(l instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(l.issues.length){i.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map(t=>ew(t,a,eL())),input:o,path:[o],inst:t});continue}let c=l.value;if("__proto__"===c)continue;let d=r.valueType._zod.run({value:n[o],issues:[]},a);d instanceof Promise?s.push(d.then(t=>{t.issues.length&&i.issues.push(...e_(o,t.issues)),i.value[c]=t.value})):(d.issues.length&&i.issues.push(...e_(o,d.issues)),i.value[c]=d.value)}for(let t in n)if(!u.has(t))if("loose"===r.mode){if("__proto__"===t)continue;i.value[t]=n[t]}else(c=c??[]).push(t);c&&c.length>0&&i.issues.push({code:"unrecognized_keys",input:n,inst:t,keys:c,continue:!0})}else{let c;for(let u of(i.value=o?o.alloc(t,i,{},a):{},Reflect.ownKeys(n))){if("__proto__"===u||!Object.prototype.propertyIsEnumerable.call(n,u))continue;let o=r.keyType._zod.run({value:u,issues:[]},a);if(o instanceof Promise)throw Error("Async schemas not supported in object keys currently");if("string"==typeof u&&tn.test(u)&&o.issues.length){let t=r.keyType._zod.run({value:Number(u),issues:[]},a);if(t instanceof Promise)throw Error("Async schemas not supported in object keys currently");0===t.issues.length&&(o=t)}if(o.issues.length){"loose"===r.mode?i.value[u]=n[u]:l?(c=c??[]).push(u):i.issues.push({code:"invalid_key",origin:"record",issues:o.issues.map(t=>ew(t,a,eL())),input:u,path:[u],inst:t});continue}let d=o.value;if("__proto__"===d)continue;let p=r.valueType._zod.run({value:n[u],issues:[]},a);p instanceof Promise?s.push(p.then(t=>{t.issues.length&&i.issues.push(...e_(u,t.issues)),i.value[d]=t.value})):(p.issues.length&&i.issues.push(...e_(u,p.issues)),i.value[d]=p.value)}c&&c.length>0&&i.issues.push({code:"unrecognized_keys",input:n,inst:t,keys:c,continue:!0})}return s.length?Promise.all(s).then(()=>i):i}}),rE=eA("$ZodEnum",(t,r)=>{tC.init(t,r);let o=H(r.entries),i=new Set(o);t._zod.values=i,eC(t,"pattern",t=>{let r=H(t.def.entries).filter(t=>el.has(typeof t));return new RegExp(r.length?`^(${r.map(t=>ec(t.toString())).join("|")})$`:"^[^\\s\\S]$")}),t._zod.parse=(r,a)=>{let n=r.value;return i.has(n)||r.issues.push({code:"invalid_value",values:o,input:n,inst:t}),r}}),rk=eA("$ZodLiteral",(t,r)=>{tC.init(t,r);let o=new Set(r.values);t._zod.values=o,eC(t,"pattern",t=>{let r=t.def.values;return new RegExp(r.length?`^(${r.map(t=>"string"==typeof t?ec(t):t?ec(t.toString()):String(t)).join("|")})$`:"^[^\\s\\S]$")}),t._zod.parse=(i,a)=>{let n=i.value;return o.has(n)||i.issues.push({code:"invalid_value",values:r.values,input:n,inst:t}),i}}),rx=eA("$ZodTransform",(t,r)=>{tC.init(t,r),t._zod.optin="optional",eM.memoizer?.guard(t),t._zod.parse=(o,i)=>{if("backward"===i.direction)throw new eq(t.constructor.name);let a=r.transform(o.value,o);if(i.async)return(a instanceof Promise?a:Promise.resolve(a)).then(t=>(o.value=t,o));if(a instanceof Promise)throw new ez;return o.value=a,o}});function rT(t,r){return t.value=r.issues.length?void 0:r.value,t}let rO=eA("$ZodOptional",(t,r)=>{tC.init(t,r),eC(t,"optin",t=>"defaulted"===t.def.innerType._zod.optin?"defaulted":"optional"),t._zod.optout="optional",eC(t,"values",t=>{let r=t.def.innerType._zod.values;return r?new Set([...r,void 0]):void 0}),eC(t,"pattern",t=>{let r=t.def.innerType._zod.pattern;return r?RegExp(`^(${W(r.source)})?$`):void 0}),t._zod.parse=(t,o)=>{if(void 0===t.value){if("defaulted"!==r.innerType._zod.optin)return t;let i=r.innerType._zod.run({value:t.value,issues:[]},o);return i instanceof Promise?i.then(r=>rT(t,r)):rT(t,i)}return r.innerType._zod.run(t,o)}}),rC=eA("$ZodExactOptional",(t,r)=>{rO.init(t,r),eC(t,"values",t=>t.def.innerType._zod.values),eC(t,"pattern",t=>t.def.innerType._zod.pattern),t._zod.parse=(t,o)=>r.innerType._zod.run(t,o)}),rj=eA("$ZodNullable",(t,r)=>{tC.init(t,r),eC(t,"optin",t=>t.def.innerType._zod.optin),eC(t,"optout",t=>t.def.innerType._zod.optout),eC(t,"pattern",t=>{let r=t.def.innerType._zod.pattern;return r?RegExp(`^(${W(r.source)}|null)$`):void 0}),eC(t,"values",t=>t.def.innerType._zod.values?new Set([...t.def.innerType._zod.values,null]):void 0),t._zod.parse=(t,o)=>null===t.value?t:r.innerType._zod.run(t,o)}),rI=eA("$ZodDefault",(t,r)=>{tC.init(t,r),t._zod.optin="defaulted",eC(t,"values",t=>t.def.innerType._zod.values),t._zod.parse=(t,o)=>{if("backward"===o.direction)return r.innerType._zod.run(t,o);if(void 0===t.value)return t.value=r.defaultValue,t;let i=r.innerType._zod.run(t,o);return i instanceof Promise?i.then(t=>rN(t,r)):rN(i,r)}});function rN(t,r){return void 0===t.value&&(t.value=r.defaultValue),t}let rA=eA("$ZodPrefault",(t,r)=>{tC.init(t,r),t._zod.optin="defaulted",eC(t,"values",t=>t.def.innerType._zod.values),t._zod.parse=(t,o)=>("backward"===o.direction||void 0===t.value&&(t.value=r.defaultValue),r.innerType._zod.run(t,o))}),rz=eA("$ZodNonOptional",(t,r)=>{tC.init(t,r),eC(t,"values",t=>{let r=t.def.innerType._zod.values;return r?new Set([...r].filter(t=>void 0!==t)):void 0}),t._zod.parse=(o,i)=>{let a=r.innerType._zod.run(o,i);return a instanceof Promise?a.then(r=>rq(r,t)):rq(a,t)}});function rq(t,r){return t.issues.length||void 0!==t.value||t.issues.push({code:"invalid_type",expected:"nonoptional",input:t.value,inst:r}),t}function rM(t,r,o,i){return r.issues.length?t.value=o.catchValue({...r,value:t.value,error:{issues:r.issues.map(t=>ew(t,i,eL()))},input:t.value}):(t.value=r.value,r.memo&&(t.memo=!0)),t}let rL=eA("$ZodCatch",(t,r)=>{tC.init(t,r),eC(t,"optin",t=>"defaulted"===t.def.innerType._zod.optin?"defaulted":"optional"),eC(t,"optout",t=>t.def.innerType._zod.optout),eC(t,"values",t=>t.def.innerType._zod.values),t._zod.parse=(t,o)=>{if("backward"===o.direction)return r.innerType._zod.run(t,o);let i=r.innerType._zod.run({value:t.value,issues:[]},o);return i instanceof Promise?i.then(i=>rM(t,i,r,o)):rM(t,i,r,o)}}),rD=eA("$ZodPipe",(t,r)=>{tC.init(t,r),eC(t,"values",t=>t.def.in._zod.values),eC(t,"optin",t=>t.def.in._zod.optin),eC(t,"optout",t=>t.def.out._zod.optout),eC(t,"propValues",t=>t.def.in._zod.propValues),t._zod.parse=(t,o)=>{if("backward"===o.direction){let i=r.out._zod.run(t,o);return i instanceof Promise?i.then(t=>rU(t,r.in,o)):rU(i,r.in,o)}let i=r.in._zod.run(t,o);return i instanceof Promise?i.then(t=>rU(t,r.out,o)):rU(i,r.out,o)}});function rU(t,r,o){return t.issues.some(t=>"unrecognized_keys"!==t.code)?(t.aborted=!0,t):r._zod.run({value:t.value,issues:t.issues},o)}let rV=eA("$ZodPreprocess",(t,r)=>{rD.init(t,r)}),rH=eA("$ZodReadonly",(t,r)=>{tC.init(t,r),eC(t,"propValues",t=>t.def.innerType._zod.propValues),eC(t,"values",t=>t.def.innerType._zod.values),eC(t,"optin",t=>t.def.innerType?._zod?.optin),eC(t,"optout",t=>t.def.innerType?._zod?.optout),t._zod.parse=(t,o)=>{if("backward"===o.direction)return r.innerType._zod.run(t,o);let i=r.innerType._zod.run(t,o);return i instanceof Promise?i.then(rF):rF(i)}});function rF(t){return t.memo||(t.value=Object.freeze(t.value)),t}let rK=eA("$ZodLazy",(t,r)=>{var o,i,a;let n;tC.init(t,r),o=t._zod,i="innerType",a=()=>(r._cachedInner||(r._cachedInner=r.getter()),r._cachedInner),Object.defineProperty(o,i,{get(){if(n!==B)return void 0===n&&(n=B,n=a()),n},set(t){Object.defineProperty(o,i,{value:t})},configurable:!0}),eC(t,"pattern",t=>t.innerType?._zod?.pattern),eC(t,"propValues",t=>t.innerType?._zod?.propValues),eC(t,"optin",t=>t.innerType?._zod?.optin??void 0),eC(t,"optout",t=>t.innerType?._zod?.optout??void 0),t._zod.parse=(r,o)=>t._zod.innerType._zod.run(r,o)}),rJ=eA("$ZodCustom",(t,r)=>{td.init(t,r),tC.init(t,r),t._zod.parse=(t,r)=>t,t._zod.check=o=>{let i=o.value,a=r.fn(i);if(a instanceof Promise)return a.then(r=>rZ(r,o,i,t));rZ(a,o,i,t)}});function rZ(t,r,o,i){if(!t){let t={code:"custom",input:o,inst:i,path:[...i._zod.def.path??[]],continue:!i._zod.def.abort};i._zod.def.params&&(t.params=i._zod.def.params),r.issues.push(eE(t))}}class rW{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...r){let o=r[0];return this._map.set(t,o),o&&"object"==typeof o&&"id"in o&&this._idmap.set(o.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){let r=this._map.get(t);return r&&"object"==typeof r&&"id"in r&&this._idmap.delete(r.id),this._map.delete(t),this}get(t){let r=t._zod.parent;if(r){let o={...this.get(r)??{}};delete o.id;let i={...o,...this._map.get(t)};return Object.keys(i).length?i:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}(T=globalThis).__zod_globalRegistry??(T.__zod_globalRegistry=new rW);let rB=globalThis.__zod_globalRegistry;function rG(t){return t.checks&&(t.checks=[...t.checks]),t}function rX(t,r){return new t({type:"string",format:"email",check:"string_format",abort:!1,...ed(r)})}function rY(t,r){return new t({type:"string",format:"url",check:"string_format",abort:!1,...ed(r)})}function rQ(t,r){return new t({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...ed(r)})}function r0(t,r){return new t({type:"string",format:"date",check:"string_format",...ed(r)})}function r1(t,r){return new tm({check:"less_than",...ed(r),value:t,inclusive:!1})}function r2(t,r){return new tm({check:"less_than",...ed(r),value:t,inclusive:!0})}function r9(t,r){return new tf({check:"greater_than",...ed(r),value:t,inclusive:!1})}function r4(t,r){return new tf({check:"greater_than",...ed(r),value:t,inclusive:!0})}function r5(t,r){return new ty({check:"multiple_of",...ed(r),value:t})}function r3(t,r){return new tv({check:"max_length",...ed(r),maximum:t})}function r6(t,r){return new t_({check:"min_length",...ed(r),minimum:t})}function r8(t,r){return new tb({check:"length_equals",...ed(r),length:t})}function r7(t){return new tx({check:"overwrite",tx:t})}function oe(t,...r){for(let o of r)for(let r of Reflect.ownKeys(o))Object.prototype.propertyIsEnumerable.call(o,r)&&G(t,r,o[r]);return t}function ot(t){let r=t?.target??"draft-2020-12";return"draft-4"===r&&(r="draft-04"),"draft-7"===r&&(r="draft-07"),{processors:t.processors??{},metadataRegistry:t?.metadata??rB,target:r,unrepresentable:t?.unrepresentable??"throw",override:t?.override??(()=>{}),io:t?.io??"output",counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:t?.cycles??"ref",reused:t?.reused??"inline",intersections:[],deferred:[],external:t?.external??void 0}}function or(t,r,o,i,a){let n="function"==typeof r.unrepresentable?r.unrepresentable({zodSchema:t,path:i.path,message:a}):r.unrepresentable;if("any"===n)return!1;if(void 0===n||"throw"===n)throw Error(a);return Object.assign(o,n),!0}function oo(t,r,o={path:[],schemaPath:[]}){var i;let a=t._zod.def,n=r.seen.get(t);if(n)return n.count++,o.schemaPath.includes(t)&&(n.cycle=o.path),n.schema;let s={schema:{},count:1,cycle:void 0,path:o.path};r.seen.set(t,s),r.sharedDefsExtractedFor=void 0,r.sharedEmitDoneFor=void 0;let l=t._zod.toJSONSchema?.();if(l)s.schema=l;else{let i={...o,schemaPath:[...o.schemaPath,t],path:o.path};if(t._zod.processJSONSchema)t._zod.processJSONSchema(r,s.schema,i);else{let o=s.schema,n=r.processors[a.type];if(!n)throw Error(`[toJSONSchema]: Non-representable type encountered: ${a.type}`);n(t,r,o,i)}let n=t._zod.parent;n&&(s.ref||(s.ref=n),oo(n,r,i),r.seen.get(n).isParent=!0)}let c=r.metadataRegistry.get(t);return c&&oe(s.schema,c),"input"===r.io&&function t(r,o){let i=o??{seen:new Set};if(i.seen.has(r))return!1;i.seen.add(r);let a=r._zod.def;if("transform"===a.type)return!0;if("array"===a.type)return t(a.element,i);if("set"===a.type)return t(a.valueType,i);if("lazy"===a.type)return t(a.getter(),i);if("promise"===a.type||"optional"===a.type||"nonoptional"===a.type||"nullable"===a.type||"readonly"===a.type||"default"===a.type||"prefault"===a.type||"catch"===a.type)return t(a.innerType,i);if("intersection"===a.type)return t(a.left,i)||t(a.right,i);if("record"===a.type||"map"===a.type)return t(a.keyType,i)||t(a.valueType,i);if("pipe"===a.type)return!!r._zod.traits.has("$ZodCodec")||t(a.in,i)||t(a.out,i);if("object"===a.type){for(let r in a.shape)if(t(a.shape[r],i))return!0;return!1}if("union"===a.type){for(let r of a.options)if(t(r,i))return!0;return!1}if("tuple"===a.type){for(let r of a.items)if(t(r,i))return!0;if(a.rest&&t(a.rest,i))return!0}return!1}(t)&&(delete s.schema.examples,delete s.schema.default),"input"===r.io&&"_prefault"in s.schema&&((i=s.schema).default??(i.default=s.schema._prefault)),delete s.schema._prefault,r.seen.get(t).schema}function oi(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}function oa(t,r){let o=t.seen.get(r);if(!o)throw Error("Unprocessed schema. This is a bug in Zod.");if(t.external&&t.sharedDefsExtractedFor===t.external)return;let i=new Map;for(let r of t.seen.entries()){let o=t.metadataRegistry.get(r[0])?.id;if(o){let t=i.get(o);if(t&&t!==r[0])throw Error(`Duplicate schema id "${o}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);i.set(o,r[0])}}let a=r=>{if(r[1].schema.$ref)return;let i=r[1],{ref:a,defId:n}=(r=>{let i="draft-2020-12"===t.target?"$defs":"definitions";if(t.external){let o=t.external.registry.get(r[0])?.id,a=t.external.uri??(t=>t);if(o)return{ref:a(o)};let n=r[1].defId??r[1].schema.id??`schema${t.counter++}`;return r[1].defId=n,{defId:n,ref:`${a("__shared")}#/${i}/${oi(n)}`}}let a=`#/${i}/`;if(r[1]===o&&!r[1].schema.id)return{ref:"#"};let n=r[1].schema.id??`__schema${t.counter++}`;return{defId:n,ref:a+oi(n)}})(r);i.def={...i.schema},n&&(i.defId=n);let s=i.schema;for(let t in s)delete s[t];s.$ref=a};if("throw"===t.cycles)for(let r of t.seen.entries()){let t=r[1];if(t.cycle)throw Error(`Cycle detected: #/${t.cycle?.join("/")}/<root>
|
|
61
54
|
|
|
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
|
-
|| (${
|
|
64
|
-
|| (${
|
|
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},
|
|
55
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let o of t.seen.entries()){let i=o[1];if(r===o[0]){a(o);continue}if(t.external){let i=t.external.registry.get(o[0])?.id;if(r!==o[0]&&i){a(o);continue}}if(t.metadataRegistry.get(o[0])?.id||i.cycle){a(o);continue}i.count>1&&"ref"===t.reused&&a(o)}t.external&&(t.sharedDefsExtractedFor=t.external)}let on=new Set(["type","properties","required","additionalProperties"]),os=["oneOf","anyOf"];function ol(t){let r=t.additionalProperties;return void 0===r||!1===r||"object"!=typeof r||null===r?null:Object.keys(r).length?r:null}function oc(t){let r=[];for(let o of t){if("object"!=typeof o||"object"!==o.type)return null;for(let t in o)if(!on.has(t))return null;r.push(o)}let o={},i=new Set;for(let t of r){for(let i in t.properties){if(Object.prototype.hasOwnProperty.call(o,i))continue;let t=[];for(let o of r){let r=o.properties?.[i]??ol(o);null!=r&&(t.some(t=>JSON.stringify(t)===JSON.stringify(r))||t.push(r))}G(o,i,1===t.length?t[0]:oc(t)??{allOf:t})}for(let r of t.required??[])i.add(r)}let a={type:"object",properties:o};if(i.size&&(a.required=[...i]),r.every(t=>!1===t.additionalProperties))a.additionalProperties=!1;else{let t=[];for(let o of r){let r=ol(o);r&&!t.some(t=>JSON.stringify(t)===JSON.stringify(r))&&t.push(r)}1===t.length?a.additionalProperties=t[0]:t.length>1&&(a.additionalProperties={allOf:t})}return a}function ou(t,r){let o=t.seen.get(r);if(!o)throw Error("Unprocessed schema. This is a bug in Zod.");let i=r=>{let o=t.seen.get(r);if(null===o.ref)return;let a=o.def??o.schema,n={...a},s=o.ref;if(o.ref=null,s){i(s);let o=t.seen.get(s),l=o.schema;if(l.$ref&&("draft-07"===t.target||"draft-04"===t.target||"openapi-3.0"===t.target)?(a.allOf=a.allOf??[],a.allOf.push(l)):oe(a,l),oe(a,n),r._zod.parent===s)for(let t in a)"$ref"!==t&&"allOf"!==t&&(t in n||delete a[t]);if(l.$ref&&o.def)for(let t in a)"$ref"!==t&&"allOf"!==t&&t in o.def&&JSON.stringify(a[t])===JSON.stringify(o.def[t])&&delete a[t]}let l=r._zod.parent;if(l&&l!==s){i(l);let r=t.seen.get(l);if(r?.schema.$ref&&(a.$ref=r.schema.$ref,r.def))for(let t in a)"$ref"!==t&&"allOf"!==t&&t in r.def&&JSON.stringify(a[t])===JSON.stringify(r.def[t])&&delete a[t]}t.override({zodSchema:r,jsonSchema:a,path:o.path??[]})};if(!t.external||t.sharedEmitDoneFor!==t.external){for(let r of[...t.seen.entries()].reverse())i(r[0]);if("openapi-3.0"!==t.target)for(let r of t.seen.entries())!function t(r){let o=r.anyOf;if(!Array.isArray(o)||0===o.length||void 0!==r.type)return;let i=[];for(let r of o){if(!r||"object"!=typeof r)return;t(r);let o=Object.keys(r);if(1!==o.length||"type"!==o[0])return;let a=r.type;for(let t of Array.isArray(a)?a:[a]){if("string"!=typeof t)return;i.includes(t)||i.push(t)}}delete r.anyOf,r.type=1===i.length?i[0]:i}(r[1].def??r[1].schema);for(let r of t.deferred)r();if(t.intersections.length){let r=new Map;for(let o of t.seen.values())for(let t of[o.schema,o.def]){let o=t?.allOf;if(!Array.isArray(o))continue;let i=r.get(o);i?i.push(t):r.set(o,[t])}for(let o of t.intersections)for(let t of r.get(o)??[])!function(t){let r=t.allOf;if(!Array.isArray(r)||r.length<2)return;for(let r of on)if(r in t)return;let o=r.filter(t=>os.some(r=>Array.isArray(t[r]))),i=null;if(o.length){let t=o[0],a=os.find(r=>Array.isArray(t[r]));if(1!==Object.keys(t).length)return;let n=r.filter(r=>r!==t),s=t[a].map(t=>oc([...n,t]));if(s.some(t=>!t))return;i={[a]:s}}else i=oc(r);i&&(delete t.allOf,oe(t,i))}(t)}}let a={};if("draft-2020-12"===t.target?a.$schema="https://json-schema.org/draft/2020-12/schema":"draft-07"===t.target?a.$schema="http://json-schema.org/draft-07/schema#":"draft-04"===t.target?a.$schema="http://json-schema.org/draft-04/schema#":t.target,t.external?.uri){let o=t.external.registry.get(r)?.id;if(!o)throw Error("Schema is missing an `id` property");a.$id=t.external.uri(o)}oe(a,o.defId?o.schema:o.def??o.schema);let n=t.metadataRegistry.get(r)?.id;void 0!==n&&a.id===n&&delete a.id;let s=t.external?.defs??{};if(!t.external||t.sharedEmitDoneFor!==t.external)for(let r of t.seen.entries()){let t=r[1];t.def&&t.defId&&(t.def.id===t.defId&&delete t.def.id,G(s,t.defId,t.def))}t.external&&(t.sharedEmitDoneFor=t.external),t.external||Object.keys(s).length>0&&("draft-2020-12"===t.target?a.$defs=s:a.definitions=s);try{let o=JSON.parse(JSON.stringify(a));return Object.defineProperty(o,"~standard",{value:{...r["~standard"],jsonSchema:{input:od(r,"input",t.processors),output:od(r,"output",t.processors)}},enumerable:!1,writable:!1}),o}catch(t){throw Error("Error converting schema to JSON.")}}let od=(t,r,o={})=>i=>{let{libraryOptions:a,target:n}=i??{},s=ot({...a??{},target:n,io:r,processors:o});return oo(t,s),oa(s,t),ou(s,t)},op=(t,r,o)=>{(void 0===t[r]||o>t[r])&&(t[r]=o)},oh=(t,r,o)=>{(void 0===t[r]||o<t[r])&&(t[r]=o)},om=(t,r)=>{op(t,"minimum",r),oh(t,"maximum",r)},of=(t,r)=>{t.multipleOf??(t.multipleOf=[]),t.multipleOf.includes(r)||t.multipleOf.push(r)},oy=(t,r)=>{t.patterns??(t.patterns=new Set),t.patterns.add(r)},og=(t,r)=>{t.mime=t.mime?t.mime.filter(t=>r.includes(t)):[...r]},ov=(t,r)=>{t.format=r,r.includes("int")&&(t.isInt=!0)},o_=(t,r)=>op(t,"minimum",r.minimum),ob=(t,r)=>oh(t,"maximum",r.maximum),oS=t=>(r,o)=>{ov(r,o.format);let[i,a]=t[o.format];op(r,"minimum",i),oh(r,"maximum",a)},ow={greater_than:(t,r)=>op(t,r.inclusive?"minimum":"exclusiveMinimum",r.value),less_than:(t,r)=>oh(t,r.inclusive?"maximum":"exclusiveMaximum",r.value),multiple_of:(t,r)=>of(t,r.value),number_format:oS(eh),bigint_format:oS(em),min_length:o_,max_length:ob,length_equals:(t,r)=>om(t,r.length),min_size:o_,max_size:ob,size_equals:(t,r)=>om(t,r.size),string_format:(t,r)=>{ov(t,r.format),r.pattern&&oy(t,r.pattern),("base64"===r.format||"base64url"===r.format)&&(t.contentEncoding=r.format),(r.local||-1===r.precision)&&(t.laxFormat=!0)},mime_type:(t,r)=>og(t,r.mime)};function o$(t){let r={},o=t._zod.def;for(let i of t._zod.traits.has("$ZodCheck")?[t,...o.checks??[]]:o.checks??[])ow[i._zod.def.check]?.(r,i._zod.def);let i=t._zod.bag;for(let t of(void 0!==i.minimum&&op(r,"minimum",i.minimum),void 0!==i.exclusiveMinimum&&op(r,"exclusiveMinimum",i.exclusiveMinimum),void 0!==i.maximum&&oh(r,"maximum",i.maximum),void 0!==i.exclusiveMaximum&&oh(r,"exclusiveMaximum",i.exclusiveMaximum),void 0!==i.multipleOf&&of(r,i.multipleOf),void 0!==i.format&&(r.format??(r.format=i.format),i.format.includes("int")&&(r.isInt=!0)),i.mime&&og(r,i.mime),i.patterns??[]))oy(r,t);return r}let oP={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},oR=new Map([[t7,/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/],[rt,/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/]]),oE=t=>oR.get(t)??t,ok=(t,r,o,i)=>{o.type="string";let{minimum:a,maximum:n,format:s,patterns:l,contentEncoding:c,laxFormat:u}=o$(t);if("number"==typeof a&&(o.minLength=a),"number"==typeof n&&(o.maxLength=n),s&&(o.format=oP[s]??s,""===o.format&&delete o.format,("time"===s||u)&&delete o.format),c&&(o.contentEncoding=c),l&&l.size>0){let t=[...l].map(oE);1===t.length?o.pattern=t[0].source:t.length>1&&(o.allOf=[...t.map(t=>({..."draft-07"===r.target||"draft-04"===r.target||"openapi-3.0"===r.target?{type:"string"}:{},pattern:t.source}))])}},ox=(t,r,o,i)=>{let{minimum:a,maximum:n,multipleOf:s,exclusiveMaximum:l,exclusiveMinimum:c,isInt:u}=o$(t);o.type=u?"integer":"number";let d="number"==typeof c&&c>=(a??-1/0),p="number"==typeof l&&l<=(n??1/0),h="draft-04"===r.target||"openapi-3.0"===r.target;if(d?h?(o.minimum=c,o.exclusiveMinimum=!0):o.exclusiveMinimum=c:"number"==typeof a&&(o.minimum=a),p?h?(o.maximum=l,o.exclusiveMaximum=!0):o.exclusiveMaximum=l:"number"==typeof n&&(o.maximum=n),s){let a=new Set;for(let n of s)Number.isFinite(n)&&0!==n?a.add(Math.abs(n)):or(t,r,o,i,`A multipleOf divisor of ${n} cannot be represented in JSON Schema`);let[n,...l]=a;void 0!==n&&(o.multipleOf=n),l.length&&(o.allOf=[...o.allOf??[],...l.map(t=>({multipleOf:t}))])}},oT=(t,r,o,i)=>{o.type="boolean"},oO=(t,r,o,i)=>{"openapi-3.0"===r.target?(o.type="string",o.nullable=!0,o.enum=[null]):o.type="null"},oC=(t,r,o,i)=>{o.not={}},oj=(t,r,o,i)=>{},oI=(t,r,o,i)=>{},oN=(t,r,o,i)=>{let a=H(t._zod.def.entries);if(0===a.length){o.not={};return}a.every(t=>"number"==typeof t)&&(o.type="number"),a.every(t=>"string"==typeof t)&&(o.type="string"),o.enum=a},oA=(t,r,o,i)=>{let a=t._zod.def;if(0===a.values.length){o.not={};return}let n=[];for(let s of a.values)if(void 0===s){if(or(t,r,o,i,"Literal `undefined` cannot be represented in JSON Schema"))return}else if("bigint"==typeof s){if(or(t,r,o,i,"BigInt literals cannot be represented in JSON Schema"))return;n.push(Number(s))}else n.push(s);if(0===n.length);else if(1===n.length){let t=n[0];o.type=null===t?"null":typeof t,"draft-04"===r.target||"openapi-3.0"===r.target?o.enum=[t]:o.const=t}else n.every(t=>"number"==typeof t)&&(o.type="number"),n.every(t=>"string"==typeof t)&&(o.type="string"),n.every(t=>"boolean"==typeof t)&&(o.type="boolean"),n.every(t=>null===t)&&(o.type="null"),o.enum=n},oz=(t,r,o,i)=>{or(t,r,o,i,"Custom types cannot be represented in JSON Schema")},oq=(t,r,o,i)=>{or(t,r,o,i,"Transforms cannot be represented in JSON Schema")},oM=(t,r,o,i)=>{let a=t._zod.def,{minimum:n,maximum:s}=o$(t);"number"==typeof n&&(o.minItems=n),"number"==typeof s&&(o.maxItems=s),o.type="array",o.items=oo(a.element,r,{...i,path:[...i.path,"items"]})};function oL(t){let r=t._zod.def;return"pipe"===r.type&&r.in._zod.traits.has("$ZodTransform")?oL(r.out):"catch"===r.type?oL(r.innerType):t._zod.optin}let oD=(t,r,o,i)=>{let a=t._zod.def,n=a.shape;if(Object.getOwnPropertySymbols(n).length&&or(t,r,o,i,"Symbol keys cannot be represented in JSON Schema"))return;for(let t in o.type="object",o.properties={},n)G(o.properties,t,oo(n[t],r,{...i,path:[...i.path,"properties",t]}));let s=[];for(let t of Object.keys(n)){let o=a.shape[t];("input"===r.io?void 0===oL(o):void 0===o._zod.optout)&&s.push(t)}s.length>0&&(o.required=s),a.catchall?._zod.def.type==="never"?o.additionalProperties=!1:a.catchall?a.catchall&&(o.additionalProperties=oo(a.catchall,r,{...i,path:[...i.path,"additionalProperties"]})):"output"===r.io&&(o.additionalProperties=!1)},oU=(t,r,o,i)=>{let a=t._zod.def,n=!1===a.inclusive,s=a.options.map((t,o)=>oo(t,r,{...i,path:[...i.path,n?"oneOf":"anyOf",o]}));n?o.oneOf=s:o.anyOf=s},oV=(t,r,o,i)=>{let a=t._zod.def,n=oo(a.left,r,{...i,path:[...i.path,"allOf",0]}),s=oo(a.right,r,{...i,path:[...i.path,"allOf",1]}),l=t=>"allOf"in t&&1===Object.keys(t).length,c=[...l(n)?n.allOf:[n],...l(s)?s.allOf:[s]];o.allOf=c,r.intersections.push(c)},oH=new WeakMap,oF=(t,r,o,i)=>{let a=t._zod.def;o.type="object";let n=a.keyType,s=o$(n).patterns;if("loose"===a.mode&&s&&s.size>0){let t=oo(a.valueType,r,{...i,path:[...i.path,"patternProperties","*"]});for(let r of(o.patternProperties={},s))G(o.patternProperties,oE(r).source,t)}else{if("draft-07"===r.target||"draft-2020-12"===r.target){o.propertyNames=oo(a.keyType,r,{...i,path:[...i.path,"propertyNames"]});let n=oH.get(r);n||(n=[],oH.set(r,n),r.deferred.push(()=>(function(t){let r=new Map;for(let o of t.seen.values())o.def&&!r.has(o.schema)&&r.set(o.schema,o);let o=new Map;for(let i of oH.get(t)??[]){let a=t.seen.get(i),n=(a?.def??a?.schema)?.propertyNames;if(!n||!0===n||o.has(n))continue;let s=function t(r,o,i){if(o.$ref){if(i.has(o))return o;i.add(o);let a=r.get(o)?.def;if(!a)return o;let n=t(r,a,i);return n===a?o:n}for(let a of["anyOf","oneOf"]){let n=o[a];if(!Array.isArray(n))continue;let s=n.map(o=>t(r,o,i));s.some((t,r)=>t!==n[r])&&(o={...o,[a]:s})}let a=Array.isArray(o.type)?o.type:[o.type],n=!a.includes("string")&&a.some(t=>"number"===t||"integer"===t),s=o.enum??(void 0!==o.const?[o.const]:void 0);if(!n&&!s?.some(t=>"number"==typeof t))return o;let{minimum:l,maximum:c,exclusiveMinimum:u,exclusiveMaximum:d,multipleOf:p,format:h,id:m,...f}=o;return f.enum?f.enum=f.enum.map(t=>"number"==typeof t?String(t):t):"number"==typeof f.const&&(f.const=String(f.const)),n&&(f.type="string",s||(f.pattern=(a.includes("number")?tn:ta).source)),f}(r,n,new Set);s!==n&&o.set(n,s)}if(o.size)for(let r of t.seen.values())for(let t of[r.schema,r.def]){let r=t&&o.get(t.propertyNames);r&&(t.propertyNames=r)}})(r))),n.push(t)}o.additionalProperties=oo(a.valueType,r,{...i,path:[...i.path,"additionalProperties"]})}let l=n._zod.values,c="input"===r.io&&void 0!==oL(a.valueType);if(l&&!a.partial&&!c){let t=[...l].filter(t=>"string"==typeof t||"number"==typeof t);t.length>0&&(o.required=t.map(String))}},oK=(t,r,o,i)=>{let a=t._zod.def,n=oo(a.innerType,r,i),s=r.seen.get(t);"openapi-3.0"===r.target?(s.ref=a.innerType,o.nullable=!0):o.anyOf=[n,{type:"null"}]},oJ=(t,r,o,i)=>{let a=t._zod.def;oo(a.innerType,r,i),r.seen.get(t).ref=a.innerType},oZ=Symbol();function oW(t,r,o,i,a){let n=!1,s=JSON.stringify(t,(t,r)=>"bigint"!=typeof r?r:(n=!0,null));return n?(or(r,o,i,a,"BigInt defaults cannot be represented in JSON Schema"),oZ):JSON.parse(s)}let oB=(t,r,o,i)=>{let a=t._zod.def;oo(a.innerType,r,i),r.seen.get(t).ref=a.innerType;let n=oW(a.defaultValue,t,r,o,i);n!==oZ&&(o.default=n)},oG=(t,r,o,i)=>{let a=t._zod.def;if(oo(a.innerType,r,i),r.seen.get(t).ref=a.innerType,"input"!==r.io)return;let n=oW(a.defaultValue,t,r,o,i);n!==oZ&&(o._prefault=n)},oX=(t,r,o,i)=>{let a,n=t._zod.def;oo(n.innerType,r,i),r.seen.get(t).ref=n.innerType;try{a=n.catchValue(void 0)}catch{or(t,r,o,i,"Dynamic catch values are not supported in JSON Schema");return}o.default=a},oY=(t,r,o,i)=>{let a=t._zod.def,n=a.in._zod.traits.has("$ZodTransform"),s="input"===r.io?n?a.out:a.in:a.out;oo(s,r,i),r.seen.get(t).ref=s},oQ=(t,r,o,i)=>{let a=t._zod.def;oo(a.innerType,r,i),r.seen.get(t).ref=a.innerType,o.readOnly=!0},o0=(t,r,o,i)=>{let a=t._zod.def;oo(a.innerType,r,i),r.seen.get(t).ref=a.innerType},o1=(t,r,o,i)=>{let a=t._zod.innerType;oo(a,r,i),r.seen.get(t).ref=a},o2={string:ok,number:ox,boolean:oT,bigint:(t,r,o,i)=>{or(t,r,o,i,"BigInt cannot be represented in JSON Schema")},symbol:(t,r,o,i)=>{or(t,r,o,i,"Symbols cannot be represented in JSON Schema")},null:oO,undefined:(t,r,o,i)=>{or(t,r,o,i,"Undefined cannot be represented in JSON Schema")},void:(t,r,o,i)=>{or(t,r,o,i,"Void cannot be represented in JSON Schema")},never:oC,any:oj,unknown:oI,date:(t,r,o,i)=>{or(t,r,o,i,"Date cannot be represented in JSON Schema")},enum:oN,literal:oA,nan:(t,r,o,i)=>{or(t,r,o,i,"NaN cannot be represented in JSON Schema")},template_literal:(t,r,o,i)=>{let a=t._zod.pattern;if(!a)throw Error("Pattern not found in template literal");o.type="string",o.pattern=a.source},file:(t,r,o,i)=>{o.type="string",o.format="binary",o.contentEncoding="binary";let{minimum:a,maximum:n,mime:s}=o$(t);void 0!==a&&(o.minLength=a),void 0!==n&&(o.maxLength=n),s&&(0===s.length?o.not={}:1===s.length?o.contentMediaType=s[0]:o.anyOf=s.map(t=>({contentMediaType:t})))},success:(t,r,o,i)=>{o.type="boolean"},custom:oz,function:(t,r,o,i)=>{or(t,r,o,i,"Function types cannot be represented in JSON Schema")},transform:oq,map:(t,r,o,i)=>{or(t,r,o,i,"Map cannot be represented in JSON Schema")},set:(t,r,o,i)=>{or(t,r,o,i,"Set cannot be represented in JSON Schema")},array:oM,object:oD,union:oU,intersection:oV,tuple:(t,r,o,i)=>{let a=t._zod.def;o.type="array";let n="draft-2020-12"===r.target?"prefixItems":"items",s="draft-2020-12"===r.target||"openapi-3.0"===r.target?"items":"additionalItems",l=a.items.map((t,o)=>oo(t,r,{...i,path:[...i.path,n,o]})),c=a.rest?oo(a.rest,r,{...i,path:[...i.path,s,..."openapi-3.0"===r.target?[a.items.length]:[]]}):null,u=a.items.length;for(;u>0;){let t=a.items[u-1];if(!("input"===r.io?void 0!==oL(t):"optional"===t._zod.optout))break;u--}let d=a.items.length,p=!a.rest;"draft-2020-12"===r.target?(o.prefixItems=l,p?o.items=!1:c&&(o.items=c)):"openapi-3.0"===r.target?(o.items={anyOf:l},c&&o.items.anyOf.push(c)):(o.items=l,p?o.additionalItems=!1:c&&(o.additionalItems=c)),u>0&&(o.minItems=u),p&&(o.maxItems=d);let{minimum:h,maximum:m}=o$(t);"number"==typeof h&&(o.minItems=h),"number"==typeof m&&(o.maxItems=m)},record:oF,nullable:oK,nonoptional:oJ,default:oB,prefault:oG,catch:oX,pipe:oY,readonly:oQ,promise:(t,r,o,i)=>{let a=t._zod.def;oo(a.innerType,r,i),r.seen.get(t).ref=a.innerType},optional:o0,lazy:o1};function o9(t,r){if("_idmap"in t){let o=ot({...r,processors:o2}),i={};for(let r of t._idmap.entries()){let[t,i]=r;oo(i,o)}let a={};for(let n of(o.external={registry:t,uri:r?.uri,defs:i},t._idmap.entries())){let[t,r]=n;oa(o,r),G(a,t,ou(o,r))}return Object.keys(i).length>0&&(a.__shared={["draft-2020-12"===o.target?"$defs":"definitions"]:i}),{schemas:a}}let o=ot({...r,processors:o2});return oo(t,o),oa(o,t),ou(o,t)}let o4={get:function(){let t=this._zod;return t.message??(t.message=JSON.stringify(t.def,K,2)),t.message},set:function(t){this._zod.message=t},enumerable:!0,configurable:!0},o5={value:void 0,enumerable:!1},o3=new WeakSet([Object.prototype,Error.prototype]),o6=(t,r)=>{t.name="$ZodError",o5.value=r,Object.defineProperty(t,"issues",o5),o5.value=void 0,Object.defineProperty(t,"message",o4);let o=Object.getPrototypeOf(t);o3.has(o)||(o3.add(o),Object.defineProperty(o,"toString",{configurable:!0,enumerable:!1,get(){let t=()=>this.message;return Object.defineProperty(this,"toString",{value:t,configurable:!0,writable:!0}),t},set(t){Object.defineProperty(this,"toString",{value:t,configurable:!0,writable:!0})}}))},o8=eA("$ZodError",o6);function o7(t,r){return{callee:r?.callee??t,Err:r?.Err}}eA("$ZodError",o6,void 0,{Parent:Error});let ie=t=>{let r=(o,i,a,n)=>{let s=a?{...a,async:!1}:{async:!1},l=o._zod.run({value:i,issues:[]},s);if(l instanceof Promise)throw new ez;if(l.issues.length){let o=new(n?.Err??t)(l.issues.map(t=>ew(t,s,eL())));throw eo(o,n?.callee??r),o}return l.value};return r},it=t=>{let r=async(o,i,a,n)=>{let s=a?{...a,async:!0}:{async:!0},l=o._zod.run({value:i,issues:[]},s);if(l instanceof Promise&&(l=await l),l.issues.length){let o=new(n?.Err??t)(l.issues.map(t=>ew(t,s,eL())));throw eo(o,n?.callee??r),o}return l.value};return r},ir=t=>(r,o,i)=>{let a=i?{...i,async:!1}:{async:!1},n=r._zod.run({value:o,issues:[]},a);if(n instanceof Promise)throw new ez;return n.issues.length?io(t,n.issues,a):{success:!0,data:n.value}};function io(t,r,o){let i;return{success:!1,get error(){return i||(i=new t(r.map(t=>ew(t,o,eL()))),r=void 0,o=void 0),i},set error(e){i=e,r=void 0,o=void 0}}}let ii=t=>async(r,o,i)=>{let a=i?{...i,async:!0}:{async:!0},n=r._zod.run({value:o,issues:[]},a);return n instanceof Promise&&(n=await n),n.issues.length?io(t,n.issues,a):{success:!0,data:n.value}},ia=Symbol.for("zod.compile.invalid"),is=Symbol.for("zod.compile.fallback"),il=async(t,r,o)=>{let i=o?{...o,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},a=t._zod.run({value:r,issues:[]},i);return a instanceof Promise&&(a=await a),0===a.issues.length},ic=new WeakSet([Object.prototype,Error.prototype]);function iu(t,r,o){Object.defineProperty(t,r,{configurable:!0,enumerable:!1,get(){let t=o(this);return Object.defineProperty(this,r,{value:t,configurable:!0,writable:!0}),t},set(t){Object.defineProperty(this,r,{value:t,configurable:!0,writable:!0})}})}let id=eA("ZodError",(t,r)=>{o8.init(t,r),t.name="ZodError";let o=Object.getPrototypeOf(t);ic.has(o)||(ic.add(o),iu(o,"format",t=>r=>(function(t,r=t=>t.message){let o={_errors:[]},i=(t,a=[])=>{for(let n of t.issues)if("invalid_union"===n.code&&n.errors.length)n.errors.map(t=>i({issues:t},[...a,...n.path]));else if("invalid_key"===n.code)i({issues:n.issues},[...a,...n.path]);else if("invalid_element"===n.code)i({issues:n.issues},[...a,...n.path]);else{let t=[...a,...n.path];if(0===t.length)o._errors.push(r(n));else{let i=o,a=0;for(;a<t.length;){let o=t[a],s=a===t.length-1;if("_errors"===o){s&&i._errors.push(r(n)),a++;continue}Object.prototype.hasOwnProperty.call(i,o)||Object.defineProperty(i,o,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let l=i[o];s&&l._errors.push(r(n)),i=l,a++}}}};return i(t),o})(t,r)),iu(o,"flatten",t=>r=>(function(t,r=t=>t.message){let o={},i=[];for(let l of t.issues)if(l.path.length>0){var a,n,s;(a=o,n=l.path[0],s=()=>[],!Object.prototype.hasOwnProperty.call(a,n)&&("__proto__"===n?Object.defineProperty(a,n,{value:s(),writable:!0,enumerable:!0,configurable:!0}):a[n]=s()),a[n]).push(r(l))}else i.push(r(l));return{formErrors:i,fieldErrors:o}})(t,r)),iu(o,"addIssue",t=>r=>{t.issues.push(r),t.message=JSON.stringify(t.issues,K,2)}),iu(o,"addIssues",t=>r=>{t.issues.push(...r),t.message=JSON.stringify(t.issues,K,2)}),Object.defineProperty(o,"isEmpty",{configurable:!0,enumerable:!1,get(){return 0===this.issues.length}}))},void 0,{Parent:Error}),ip=ie(id),ih=it(id),im=ir(id),iy=ii(id),ig=(d=ie(id),p=(t,r,o,i)=>d(t,r,o?{...o,direction:"backward"}:{direction:"backward"},o7(p,i))),iv=(h=ie(id),m=(t,r,o,i)=>h(t,r,o,o7(m,i))),i_=(f=it(id),y=async(t,r,o,i)=>{let a=o?{...o,direction:"backward"}:{direction:"backward"};return await f(t,r,a,o7(y,i))}),ib=(g=it(id),v=async(t,r,o,i)=>await g(t,r,o,o7(v,i))),iS=(_=id,(t,r,o)=>{let i=o?{...o,direction:"backward"}:{direction:"backward"};return ir(_)(t,r,i)}),iw=(b=id,(t,r,o)=>ir(b)(t,r,o)),i$=(S=id,async(t,r,o)=>{let i=o?{...o,direction:"backward"}:{direction:"backward"};return ii(S)(t,r,i)}),iP=(w=id,async(t,r,o)=>ii(w)(t,r,o));function iR(){eM.memoizer||eL({memoizer:eZ})}let iE=eA("ZodType",(t,r)=>(eM.localeError||eL({localeError:(()=>{let t={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}},r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",currency_code:"currency code",credit_card:"credit card number",iban:"IBAN",jwt:"JWT",template_literal:"input"},o={nan:"NaN"};function i(t,r){return"number"!==t||"number"!=typeof r||Number.isFinite(r)?o[t]??t:String(r)}return o=>{switch(o.code){case"invalid_type":{let t=i(o.expected),r=i(function(t){let r=typeof t;switch(r){case"number":return Number.isNaN(t)?"nan":"number";case"object":if(null===t)return"null";if(Array.isArray(t))return"array";if(t&&Object.getPrototypeOf(t)!==Object.prototype&&"constructor"in t&&t.constructor)return t.constructor.name}return r}(o.input),o.input);return`Invalid input: expected ${t}, received ${r}`}case"invalid_value":if(1===o.values.length)return`Invalid input: expected ${ep(o.values[0])}`;return`Invalid option: expected one of ${F(o.values,"|")}`;case"too_big":{let r=o.exact?"exactly ":o.inclusive?"<=":"<",i=t[o.origin]??null;if(i)return`Too big: expected ${o.origin??"value"} to have ${r}${o.maximum.toString()} ${i.unit??"elements"}`;return`Too big: expected ${o.origin??"value"} to be ${r}${o.maximum.toString()}`}case"too_small":{let r=o.exact?"exactly ":o.inclusive?">=":">",i=t[o.origin]??null;if(i)return`Too small: expected ${o.origin} to have ${r}${o.minimum.toString()} ${i.unit}`;return`Too small: expected ${o.origin} to be ${r}${o.minimum.toString()}`}case"invalid_format":if("starts_with"===o.format)return`Invalid string: must start with "${o.prefix}"`;if("ends_with"===o.format)return`Invalid string: must end with "${o.suffix}"`;if("includes"===o.format)return`Invalid string: must include "${o.includes}"`;if("regex"===o.format)return`Invalid string: must match pattern ${o.pattern}`;return`Invalid ${r[o.format]??o.format}`;case"not_multiple_of":return`Invalid number: must be a multiple of ${o.divisor}`;case"unrecognized_keys":return`Unrecognized key${o.keys.length>1?"s":""}: ${F(o.keys,", ")}`;case"invalid_key":return`Invalid key in ${o.origin}`;case"invalid_union":if(o.options&&Array.isArray(o.options)&&o.options.length>0){let t=o.options.map(t=>`'${t}'`).join(" | ");return`Invalid discriminator value. Expected ${t}`}if(!1===o.inclusive)return"Invalid input: more than one option matched";return"Invalid input";case"invalid_element":return`Invalid value in ${o.origin}`;default:return"Invalid input"}}})()}),tC.init(t,r),t.def=r,t.type=r.type,t),{check(...t){let r=this.def;return this.clone(er(r,{checks:[...r.checks??[],...t.map(t=>"function"==typeof t?{_zod:{check:t,def:{check:"custom"},onattach:[]}}:t)]}),{parent:!0})},with(...t){return this.check(...t)},clone(t,r){return eu(this,t,r)},brand(){return this},register(t,r){return t.add(this,r),this},refine(t,r){return this.check(function(t,r={}){return new aq({type:"custom",check:"custom",fn:t,...ed(r)})}(t,r))},superRefine(t,r){var o,i,a,n,s;let l,c;return this.check((o=t,i=r,a=o,n=t=>(t.addIssue=r=>{"string"==typeof r?t.issues.push(eE(r,t.value,l._zod.def)):(r.fatal&&(r.continue=!1),r.code??(r.code="custom"),"input"in r||(r.input=t.value),r.inst??(r.inst=l),r.continue??(r.continue=!l._zod.def.abort),t.issues.push(eE(r)))},a(t.value,t)),(c=new td({check:"custom",...ed(s=i)}))._zod.check=n,l=c))},overwrite(t){return this.check(r7(t))},optional(){return a$(this)},exactOptional(){var t;return t=this,new aP({type:"optional",innerType:t})},nullable(){return aE(this)},nullish(){return a$(aE(this))},nonoptional(t){var r,o;return r=this,new aT({type:"nonoptional",innerType:r,...ed(o=t)})},array(){return ai(this)},or(t){return ac([this,t])},and(t){return ah(this,t)},transform(t){return aj(this,aS(t))},default(t){var r,o;return r=this,o=t,new ak({type:"default",innerType:r,get defaultValue(){return"function"==typeof o?o():es(o)}})},prefault(t){var r,o;return r=this,o=t,new ax({type:"prefault",innerType:r,get defaultValue(){return"function"==typeof o?o():es(o)}})},catch(t){var r,o,i;let a;return r=this,new aO({type:"catch",innerType:r,catchValue:"function"==typeof(o=t)?o:(i=o,(a=()=>i)["~constantCatch"]=!0,a)})},pipe(t){return aj(this,t)},readonly(){var t;return t=this,new aN({type:"readonly",innerType:t})},describe(t){let r=this.clone();return rB.add(r,{description:t}),r},meta(...t){if(0===t.length)return rB.get(this);let r=this.clone();return rB.add(r,t[0]),r},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(t,...r){return 0===r.length?t(this):t(this,...r)},get"~standard"(){var ik;return ik=this,ek(ik,"~standard",{...tA(this),jsonSchema:{input:od(this,"input"),output:od(this,"output")}},!1)},set"~standard"(value){ek(this,"~standard",value)},parse:function t(r,o){return ip(this,r,o,{callee:t})},parseAsync:async function t(r,o){return await ih(this,r,o,{callee:t})},safeParse(t,r){return im(this,t,r)},async safeParseAsync(t,r){return iy(this,t,r)},get spa(){return this?.safeParseAsync},set spa(value){ek(this,"spa",value)},validate(t,r){var o=this,i=t,a=r;let n=o._zod.bag.validator;if(void 0!==n){if(n(i)!==ia)return!0;if(!0===n.definite&&void 0===a)return!1}var s=o,l=i,c=a;let u,d=c?{...c,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},p=s._zod.bag.fallbackRun;if(p?(d[is]=!0,u=p({value:l,issues:[]},d)):u=s._zod.run({value:l,issues:[]},d),u instanceof Promise)throw new ez;return 0===u.issues.length},validateAsync(t,r){return il(this,t,r)},encode:function t(r,o){return ig(this,r,o,{callee:t})},decode:function t(r,o){return iv(this,r,o,{callee:t})},encodeAsync:async function t(r,o){return await i_(this,r,o,{callee:t})},decodeAsync:async function t(r,o){return await ib(this,r,o,{callee:t})},safeEncode(t,r){return iS(this,t,r)},safeDecode(t,r){return iw(this,t,r)},async safeEncodeAsync(t,r){return i$(this,t,r)},async safeDecodeAsync(t,r){return iP(this,t,r)},toJSONSchema(t){return((t,r={})=>o=>{let i=ot({...o,processors:r});return oo(t,i),oa(i,t),ou(i,t)})(this,{})(t)},get description(){return rB.get(this)?.description},get _def(){return this._zod.def}}),ix=eA("_ZodString",(t,r)=>{tz.init(t,r),iE.init(t,r),t._zod.processJSONSchema=(r,o,i)=>ok(t,r,o,i)},ex({format:t=>o$(t).format??null,minLength:t=>o$(t).minimum??null,maxLength:t=>o$(t).maximum??null},{regex(...t){return this.check(function(t,r){return new tw({check:"string_format",format:"regex",...ed(r),pattern:t})}(...t))},includes(...t){return this.check(function(t,r){return new tR({check:"string_format",format:"includes",...ed(r),includes:t})}(...t))},startsWith(...t){return this.check(function(t,r){return new tE({check:"string_format",format:"starts_with",...ed(r),prefix:t})}(...t))},endsWith(...t){return this.check(function(t,r){return new tk({check:"string_format",format:"ends_with",...ed(r),suffix:t})}(...t))},min(...t){return this.check(r6(...t))},max(...t){return this.check(r3(...t))},length(...t){return this.check(r8(...t))},nonempty(...t){return this.check(r6(1,...t))},lowercase(t){return this.check(new t$({check:"string_format",format:"lowercase",...ed(t)}))},uppercase(t){return this.check(new tP({check:"string_format",format:"uppercase",...ed(t)}))},trim(){return this.check(r7(t=>t.trim()))},normalize(...t){return this.check(function(t){return r7(r=>r.normalize(t))}(...t))},toLowerCase(){return this.check(r7(t=>t.toLowerCase()))},toUpperCase(){return this.check(r7(t=>t.toUpperCase()))},slugify(){return this.check(r7(t=>t.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")))}})),iT=eA("ZodString",(t,r)=>{tz.init(t,r),ix.init(t,r)},{email(t){return this.check(rX(iz,t))},url(t){return this.check(rY(iL,t))},jwt(t){return this.check(new i0({type:"string",format:"jwt",check:"string_format",abort:!1,...ed(t)}))},emoji(t){return this.check(new iD({type:"string",format:"emoji",check:"string_format",abort:!1,...ed(t)}))},guid(t){return this.check(new iq({type:"string",format:"guid",check:"string_format",abort:!1,...ed(t)}))},uuid(t){return this.check(new iM({type:"string",format:"uuid",check:"string_format",abort:!1,...ed(t)}))},uuidv4(t){return this.check(new iM({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...ed(t)}))},uuidv6(t){return this.check(new iM({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...ed(t)}))},uuidv7(t){return this.check(new iM({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...ed(t)}))},nanoid(t){return this.check(new iU({type:"string",format:"nanoid",check:"string_format",abort:!1,...ed(t)}))},cuid(t){return this.check(new iV({type:"string",format:"cuid",check:"string_format",abort:!1,...ed(t)}))},cuid2(t){return this.check(new iH({type:"string",format:"cuid2",check:"string_format",abort:!1,...ed(t)}))},ulid(t){return this.check(new iF({type:"string",format:"ulid",check:"string_format",abort:!1,...ed(t)}))},base64(t){return this.check(new iX({type:"string",format:"base64",check:"string_format",abort:!1,...ed(t)}))},base64url(t){return this.check(new iY({type:"string",format:"base64url",check:"string_format",abort:!1,...ed(t)}))},xid(t){return this.check(new iK({type:"string",format:"xid",check:"string_format",abort:!1,...ed(t)}))},ksuid(t){return this.check(new iJ({type:"string",format:"ksuid",check:"string_format",abort:!1,...ed(t)}))},ipv4(t){return this.check(new iZ({type:"string",format:"ipv4",check:"string_format",abort:!1,...ed(t)}))},ipv6(t){return this.check(new iW({type:"string",format:"ipv6",check:"string_format",abort:!1,...ed(t)}))},cidrv4(t){return this.check(new iB({type:"string",format:"cidrv4",check:"string_format",abort:!1,...ed(t)}))},cidrv6(t){return this.check(new iG({type:"string",format:"cidrv6",check:"string_format",abort:!1,...ed(t)}))},e164(t){return this.check(new iQ({type:"string",format:"e164",check:"string_format",abort:!1,...ed(t)}))},datetime(t){return this.check(rQ(ij,t))},date(t){return this.check(r0(iI,t))},time(t){return this.check(new iN({type:"string",format:"time",check:"string_format",precision:null,...ed(t)}))},duration(t){return this.check(new iA({type:"string",format:"duration",check:"string_format",...ed(t)}))}});function iO(t){return new iT(rG({type:"string",...ed(t)}))}let iC=eA("ZodStringFormat",(t,r)=>{tq.init(t,r),ix.init(t,r)}),ij=eA("ZodISODateTime",(t,r)=>{tY.init(t,r),iC.init(t,r)}),iI=eA("ZodISODate",(t,r)=>{tQ.init(t,r),iC.init(t,r)}),iN=eA("ZodISOTime",(t,r)=>{t0.init(t,r),iC.init(t,r)}),iA=eA("ZodISODuration",(t,r)=>{t1.init(t,r),iC.init(t,r)}),iz=eA("ZodEmail",(t,r)=>{tD.init(t,r),iC.init(t,r)}),iq=eA("ZodGUID",(t,r)=>{tM.init(t,r),iC.init(t,r)}),iM=eA("ZodUUID",(t,r)=>{tL.init(t,r),iC.init(t,r)}),iL=eA("ZodURL",(t,r)=>{tF.init(t,r),iC.init(t,r)}),iD=eA("ZodEmoji",(t,r)=>{tK.init(t,r),iC.init(t,r)}),iU=eA("ZodNanoID",(t,r)=>{tJ.init(t,r),iC.init(t,r)}),iV=eA("ZodCUID",(t,r)=>{tZ.init(t,r),iC.init(t,r)}),iH=eA("ZodCUID2",(t,r)=>{tW.init(t,r),iC.init(t,r)}),iF=eA("ZodULID",(t,r)=>{tB.init(t,r),iC.init(t,r)}),iK=eA("ZodXID",(t,r)=>{tG.init(t,r),iC.init(t,r)}),iJ=eA("ZodKSUID",(t,r)=>{tX.init(t,r),iC.init(t,r)}),iZ=eA("ZodIPv4",(t,r)=>{t2.init(t,r),iC.init(t,r)}),iW=eA("ZodIPv6",(t,r)=>{t5.init(t,r),iC.init(t,r)}),iB=eA("ZodCIDRv4",(t,r)=>{t3.init(t,r),iC.init(t,r)}),iG=eA("ZodCIDRv6",(t,r)=>{t6.init(t,r),iC.init(t,r)}),iX=eA("ZodBase64",(t,r)=>{re.init(t,r),iC.init(t,r)}),iY=eA("ZodBase64URL",(t,r)=>{rr.init(t,r),iC.init(t,r)}),iQ=eA("ZodE164",(t,r)=>{ro.init(t,r),iC.init(t,r)}),i0=eA("ZodJWT",(t,r)=>{ri.init(t,r),iC.init(t,r)}),i1=eA("ZodNumber",(t,r)=>{ra.init(t,r),iE.init(t,r),t._zod.processJSONSchema=(r,o,i)=>ox(t,r,o,i),t.isFinite=!0},ex({minValue:t=>{let{minimum:r,exclusiveMinimum:o}=o$(t);return Math.max(r??-1/0,o??-1/0)},maxValue:t=>{let{maximum:r,exclusiveMaximum:o}=o$(t);return Math.min(r??1/0,o??1/0)},isInt:t=>{let{isInt:r,multipleOf:o}=o$(t);return!!r||!!o?.some(Number.isSafeInteger)},format:t=>o$(t).format??null},{gt(t,r){return this.check(r9(t,r))},gte(t,r){return this.check(r4(t,r))},min(t,r){return this.check(r4(t,r))},lt(t,r){return this.check(r1(t,r))},lte(t,r){return this.check(r2(t,r))},max(t,r){return this.check(r2(t,r))},int(t){return this.check(i4(t))},safe(t){return this.check(i4(t))},positive(t){return this.check(r9(0,t))},nonnegative(t){return this.check(r4(0,t))},negative(t){return this.check(r1(0,t))},nonpositive(t){return this.check(r2(0,t))},multipleOf(t,r){return this.check(r5(t,r))},step(t,r){return this.check(r5(t,r))},finite(){return this}}));function i2(t){return new i1(rG({type:"number",checks:[],...ed(t)}))}let i9=eA("ZodNumberFormat",(t,r)=>{rn.init(t,r),i1.init(t,r)});function i4(t){return new i9({type:"number",check:"number_format",abort:!1,format:"safeint",...ed(t)})}let i5=eA("ZodBoolean",(t,r)=>{rs.init(t,r),iE.init(t,r),t._zod.processJSONSchema=(r,o,i)=>oT(t,r,o,i)});function i3(t){return new i5({type:"boolean",...ed(t)})}let i6=eA("ZodNull",(t,r)=>{rl.init(t,r),iE.init(t,r),t._zod.processJSONSchema=(r,o,i)=>oO(t,r,o,i)});function i8(t){return new i6({type:"null",...ed(t)})}let i7=eA("ZodAny",(t,r)=>{rc.init(t,r),iE.init(t,r),t._zod.processJSONSchema=(r,o,i)=>oj(t,r,o,i)}),ae=eA("ZodUnknown",(t,r)=>{ru.init(t,r),iE.init(t,r),t._zod.processJSONSchema=(r,o,i)=>oI(t,r,o,i)});function at(){return new ae({type:"unknown"})}let ar=eA("ZodNever",(t,r)=>{rd.init(t,r),iE.init(t,r),t._zod.processJSONSchema=(r,o,i)=>oC(t,r,o,i)}),ao=eA("ZodArray",(t,r)=>{iR(),rh.init(t,r),iE.init(t,r),t._zod.processJSONSchema=(r,o,i)=>oM(t,r,o,i),t.element=r.element},{min(t,r){return this.check(r6(t,r))},nonempty(t){return this.check(r6(1,t))},max(t,r){return this.check(r3(t,r))},length(t,r){return this.check(r8(t,r))},unwrap(){return this.element}});function ai(t,r){return new ao({type:"array",element:t,...ed(r)})}let aa=eA("ZodObject",(t,r)=>{var o,i,a,n,s,l;let c,u;iR(),r_.init(t,r),iE.init(t,r),t._zod.processJSONSchema=(r,o,i)=>oD(t,r,o,i),o=t,i="shape",a=t=>t._zod.def.shape,n=!1,s=o,l=i,c=Object.getPrototypeOf(s),(u=l in c?void 0:c)&&Object.defineProperty(u,i,{configurable:!0,get(){let t={configurable:!0,writable:!0,enumerable:n,value:void 0};return Object.defineProperty(this,i,t),t.value=a(this),Object.defineProperty(this,i,t),t.value},set(t){Object.defineProperty(this,i,{configurable:!0,writable:!0,enumerable:n,value:t})}})},{keyof(){return ag(Object.keys(this._zod.def.shape))},catchall(t){return this.clone(er(this._zod.def,{catchall:t}))},passthrough(){return this.clone(er(this._zod.def,{catchall:at()}))},loose(){return this.clone(er(this._zod.def,{catchall:at()}))},strict(){return this.clone(er(this._zod.def,{catchall:new ar({type:"never",...ed(void 0)})}))},strip(){return this.clone(er(this._zod.def,{catchall:void 0}))},extend(t){var r=this,o=t;if(!en(o))throw Error("Invalid input to extend: expected a plain object");let i=r._zod.def.checks;if(i&&i.length>0){let t=Y(r);for(let r of Reflect.ownKeys(o))if(void 0!==Object.getOwnPropertyDescriptor(t,r))throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return eu(r,er(r._zod.def,{shape:ey(r,o)}))},safeExtend(t){var r=this,o=t;if(!en(o))throw Error("Invalid input to safeExtend: expected a plain object");return eu(r,er(r._zod.def,{shape:ey(r,o)}))},merge(t){var r=this,o=t;if(!o?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(r._zod.def.checks?.length)throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let i={};et(i,r,Reflect.ownKeys(Y(r))),et(i,o,Reflect.ownKeys(Y(o)));let a=er(r._zod.def,{shape:i,get catchall(){return o._zod.def.catchall},checks:o._zod.def.checks??[]});return eu(r,a)},pick(t){return function(t,r){let o=t._zod.def,i=o.checks;if(i&&i.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let a={};return et(a,t,ef(t,r)),eu(t,er(o,{shape:a,checks:[]}))}(this,t)},omit(t){return function(t,r){let o=t._zod.def,i=o.checks;if(i&&i.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let a=new Set(ef(t,r)),n={};return et(n,t,Reflect.ownKeys(Y(t)).filter(t=>!a.has(t))),eu(t,er(o,{shape:n,checks:[]}))}(this,t)},partial(...t){return eg(aw,this,t[0])},exactPartial(...t){return eg(aP,this,t[0],"exactPartial")},required(...t){var r,o,i;let a,n;return r=aT,o=this,a=(i=t[0])?new Set(ef(o,i)):void 0,et(n={},o,Reflect.ownKeys(Y(o)),(t,o)=>a&&!a.has(o)?t:new r({type:"nonoptional",innerType:t})),eu(o,er(o._zod.def,{shape:n}))}});function an(t,r){return new aa({type:"object",shape:t??{},...ed(r)})}function as(t,r){return new aa({type:"object",shape:t,catchall:at(),...ed(r)})}let al=eA("ZodUnion",(t,r)=>{rS.init(t,r),iE.init(t,r),t._zod.processJSONSchema=(r,o,i)=>oU(t,r,o,i),t.options=r.options});function ac(t,r){return new al({type:"union",options:t,...ed(r)})}let au=eA("ZodDiscriminatedUnion",(t,r)=>{al.init(t,r),rw.init(t,r)});function ad(t,r,o){return new au({type:"union",options:r,discriminator:t,...ed(o)})}let ap=eA("ZodIntersection",(t,r)=>{r$.init(t,r),iE.init(t,r),t._zod.processJSONSchema=(r,o,i)=>oV(t,r,o,i)});function ah(t,r){return new ap({type:"intersection",left:t,right:r})}let am=eA("ZodRecord",(t,r)=>{iR(),rR.init(t,r),iE.init(t,r),t._zod.processJSONSchema=(r,o,i)=>oF(t,r,o,i),t.keyType=r.keyType,t.valueType=r.valueType});function af(t,r,o){return new am(r&&r._zod?{type:"record",keyType:t,valueType:r,...ed(o)}:{type:"record",keyType:iO(),valueType:t,...ed(r)})}let ay=eA("ZodEnum",(t,r)=>{rE.init(t,r),iE.init(t,r),t._zod.processJSONSchema=(r,o,i)=>oN(t,r,o,i),t.enum=r.entries,t.options=[...t._zod.values];let o=new Set(Object.keys(r.entries));t.extract=(t,i)=>{let a={};for(let i of t)if(o.has(i))a[i]=r.entries[i];else throw Error(`Key ${i} not found in enum`);return new ay({...r,checks:[],...ed(i),entries:a})},t.exclude=(t,i)=>{let a={...r.entries};for(let r of t)if(o.has(r))delete a[r];else throw Error(`Key ${r} not found in enum`);return new ay({...r,checks:[],...ed(i),entries:a})}});function ag(t,r){return new ay({type:"enum",entries:Array.isArray(t)?Object.fromEntries(t.map(t=>[t,t])):t,...ed(r)})}let av=eA("ZodLiteral",(t,r)=>{rk.init(t,r),iE.init(t,r),t._zod.processJSONSchema=(r,o,i)=>oA(t,r,o,i),t.values=new Set(r.values),Object.defineProperty(t,"value",{get(){if(r.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return r.values[0]}})});function a_(t,r){return new av({type:"literal",values:Array.isArray(t)?t:[t],...ed(r)})}let ab=eA("ZodTransform",(t,r)=>{iR(),rx.init(t,r),iE.init(t,r),t._zod.processJSONSchema=(r,o,i)=>oq(t,r,o,i),t._zod.parse=(o,i)=>{if("backward"===i.direction)throw new eq(t.constructor.name);o.addIssue=i=>{"string"==typeof i?o.issues.push(eE(i,o.value,r)):(i.fatal&&(i.continue=!1),i.code??(i.code="custom"),"input"in i||(i.input=o.value),i.inst??(i.inst=t),o.issues.push(eE(i)))};let a=r.transform(o.value,o);return a instanceof Promise?a.then(t=>(o.value=t,o)):(o.value=a,o)}});function aS(t){return new ab({type:"transform",transform:t})}let aw=eA("ZodOptional",(t,r)=>{rO.init(t,r),iE.init(t,r),t._zod.processJSONSchema=(r,o,i)=>o0(t,r,o,i),t.unwrap=()=>t._zod.def.innerType});function a$(t){return new aw({type:"optional",innerType:t})}let aP=eA("ZodExactOptional",(t,r)=>{rC.init(t,r),iE.init(t,r),t._zod.processJSONSchema=(r,o,i)=>o0(t,r,o,i),t.unwrap=()=>t._zod.def.innerType}),aR=eA("ZodNullable",(t,r)=>{rj.init(t,r),iE.init(t,r),t._zod.processJSONSchema=(r,o,i)=>oK(t,r,o,i),t.unwrap=()=>t._zod.def.innerType});function aE(t){return new aR({type:"nullable",innerType:t})}let ak=eA("ZodDefault",(t,r)=>{rI.init(t,r),iE.init(t,r),t._zod.processJSONSchema=(r,o,i)=>oB(t,r,o,i),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap}),ax=eA("ZodPrefault",(t,r)=>{rA.init(t,r),iE.init(t,r),t._zod.processJSONSchema=(r,o,i)=>oG(t,r,o,i),t.unwrap=()=>t._zod.def.innerType}),aT=eA("ZodNonOptional",(t,r)=>{rz.init(t,r),iE.init(t,r),t._zod.processJSONSchema=(r,o,i)=>oJ(t,r,o,i),t.unwrap=()=>t._zod.def.innerType}),aO=eA("ZodCatch",(t,r)=>{rL.init(t,r),iE.init(t,r),t._zod.processJSONSchema=(r,o,i)=>oX(t,r,o,i),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap}),aC=eA("ZodPipe",(t,r)=>{rD.init(t,r),iE.init(t,r),t._zod.processJSONSchema=(r,o,i)=>oY(t,r,o,i),t.in=r.in,t.out=r.out});function aj(t,r){return new aC({type:"pipe",in:t,out:r})}let aI=eA("ZodPreprocess",(t,r)=>{aC.init(t,r),rV.init(t,r)}),aN=eA("ZodReadonly",(t,r)=>{rH.init(t,r),iE.init(t,r),t._zod.processJSONSchema=(r,o,i)=>oQ(t,r,o,i),t.unwrap=()=>t._zod.def.innerType}),aA=eA("ZodLazy",(t,r)=>{rK.init(t,r),iE.init(t,r),t._zod.processJSONSchema=(r,o,i)=>o1(t,r,o,i),t.unwrap=()=>t._zod.def.getter()});function az(t){return new aA({type:"lazy",getter:t})}let aq=eA("ZodCustom",(t,r)=>{rJ.init(t,r),iE.init(t,r),t._zod.processJSONSchema=(r,o,i)=>oz(t,r,o,i)});function aM(t,r){return new aI({type:"pipe",in:aS(t),out:r})}let aL="custom";O||(O={});let aD="2025-11-25",aU=[aD,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],aV="io.modelcontextprotocol/protocolVersion",aH="io.modelcontextprotocol/clientInfo",aF="io.modelcontextprotocol/serverInfo",aK="io.modelcontextprotocol/clientCapabilities",aJ="io.modelcontextprotocol/subscriptionId",aZ="io.modelcontextprotocol/logLevel",aW=az(()=>ac([iO(),i2(),i3(),i8(),af(iO(),aW),ai(aW)])),aB=af(iO(),aW),aG=ai(aW),aX=ac([iO(),i2().int()]),aY=iO(),aQ=an({ttl:i2().optional()}),a0=an({taskId:iO()}),a1=as({progressToken:aX.optional(),"io.modelcontextprotocol/related-task":a0.optional()}),a2=an({_meta:a1.optional()}),a9=a2.extend({task:aQ.optional()}),a4=an({method:iO(),params:a2.loose().optional()}),a5=an({_meta:a1.optional()}),a3=an({method:iO(),params:a5.loose().optional()}),a6=as({get[aF](){return np.optional().catch(void 0)}}),a8=as({_meta:a6.optional()}),a7=ac([iO(),i2().int()]),ne=an({jsonrpc:a_("2.0"),id:a7,...a4.shape}).strict(),nt=an({jsonrpc:a_("2.0"),...a3.shape}).strict(),nr=an({jsonrpc:a_("2.0"),id:a7,result:a8}).strict(),no=an({jsonrpc:a_("2.0"),id:a7.optional(),error:an({code:i2().int(),message:iO(),data:at().optional()})}).strict(),ni=ac([ne,nt,nr,no]),na=ac([nr,no]),nn=a8.strict(),ns=a5.extend({requestId:a7.optional(),reason:iO().optional()}),nl=a3.extend({method:a_("notifications/cancelled"),params:ns}),nc=an({src:iO(),mimeType:iO().optional(),sizes:ai(iO()).optional(),theme:ag(["light","dark"]).optional()}),nu=an({icons:ai(nc).optional()}),nd=an({name:iO(),title:iO().optional()}),np=nd.extend({...nd.shape,...nu.shape,version:iO(),websiteUrl:iO().optional(),description:iO().optional()}),nh=ah(an({applyDefaults:i3().optional()}),aB),nm=aM(t=>t&&"object"==typeof t&&!Array.isArray(t)&&0===Object.keys(t).length?{form:{}}:t,ah(an({form:nh.optional(),url:aB.optional()}),aB.optional())),nf=as({list:aB.optional(),cancel:aB.optional(),requests:as({sampling:as({createMessage:aB.optional()}).optional(),elicitation:as({create:aB.optional()}).optional()}).optional()}),ny=as({list:aB.optional(),cancel:aB.optional(),requests:as({tools:as({call:aB.optional()}).optional()}).optional()}),ng=an({experimental:af(iO(),aB).optional(),sampling:an({context:aB.optional(),tools:aB.optional()}).optional(),elicitation:nm.optional(),roots:an({listChanged:i3().optional()}).optional(),tasks:nf.optional(),extensions:af(iO(),aB).optional()}),nv=a2.extend({protocolVersion:iO(),capabilities:ng,clientInfo:np}),n_=a4.extend({method:a_("initialize"),params:nv}),nb=an({experimental:af(iO(),aB).optional(),logging:aB.optional(),completions:aB.optional(),prompts:an({listChanged:i3().optional()}).optional(),resources:an({subscribe:i3().optional(),listChanged:i3().optional()}).optional(),tools:an({listChanged:i3().optional()}).optional(),tasks:ny.optional(),extensions:af(iO(),aB).optional()}),nS=a8.extend({protocolVersion:iO(),capabilities:nb,serverInfo:np,instructions:iO().optional()}),nw=a3.extend({method:a_("notifications/initialized"),params:a5.optional()}),n$=a4.extend({method:a_("server/discover"),params:a2.optional()}),nP=a8.extend({supportedVersions:ai(iO()),capabilities:nb,instructions:iO().optional()}),nR=a4.extend({method:a_("ping"),params:a2.optional()}),nE=an({progress:i2(),total:a$(i2()),message:a$(iO())}),nk=an({...a5.shape,...nE.shape,progressToken:aX}),nx=a3.extend({method:a_("notifications/progress"),params:nk}),nT=a2.extend({cursor:aY.optional()}),nO=a4.extend({params:nT.optional()}),nC=a8.extend({nextCursor:aY.optional()}),nj=an({uri:iO(),mimeType:a$(iO()),_meta:af(iO(),at()).optional()}),nI=nj.extend({text:iO()}),nN=iO().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),nA=nj.extend({blob:nN}),nz=ag(["user","assistant"]),nq=an({audience:ai(nz).optional(),priority:i2().min(0).max(1).optional(),lastModified:rQ(ij,{offset:!0}).optional()}),nM=an({...nd.shape,...nu.shape,uri:iO(),description:a$(iO()),mimeType:a$(iO()),size:a$(i2()),annotations:nq.optional(),_meta:a$(as({}))}),nL=an({...nd.shape,...nu.shape,uriTemplate:iO(),description:a$(iO()),mimeType:a$(iO()),annotations:nq.optional(),_meta:a$(as({}))}),nD=nO.extend({method:a_("resources/list")}),nU=nC.extend({resources:ai(nM)}),nV=nO.extend({method:a_("resources/templates/list")}),nH=nC.extend({resourceTemplates:ai(nL)}),nF=a2.extend({uri:iO()}),nK=a4.extend({method:a_("resources/read"),params:nF}),nJ=a8.extend({contents:ai(ac([nI,nA]))}),nZ=a3.extend({method:a_("notifications/resources/list_changed"),params:a5.optional()}),nW=a4.extend({method:a_("resources/subscribe"),params:nF}),nB=a4.extend({method:a_("resources/unsubscribe"),params:nF}),nG=an({toolsListChanged:i3().optional(),promptsListChanged:i3().optional(),resourcesListChanged:i3().optional(),resourceSubscriptions:ai(iO()).optional()}),nX=a2.extend({notifications:nG}),nY=a4.extend({method:a_("subscriptions/listen"),params:nX}),nQ=a5.extend({notifications:nG}),n0=a3.extend({method:a_("notifications/subscriptions/acknowledged"),params:nQ}),n1=a6.extend({[aJ]:a7}),n2=a8.extend({_meta:n1}),n9=a5.extend({uri:iO()}),n4=a3.extend({method:a_("notifications/resources/updated"),params:n9}),n5=an({name:iO(),description:a$(iO()),required:a$(i3())}),n3=an({...nd.shape,...nu.shape,description:a$(iO()),arguments:a$(ai(n5)),_meta:a$(as({}))}),n6=nO.extend({method:a_("prompts/list")}),n8=nC.extend({prompts:ai(n3)}),n7=a2.extend({name:iO(),arguments:af(iO(),iO()).optional()}),se=a4.extend({method:a_("prompts/get"),params:n7}),st=an({type:a_("text"),text:iO(),annotations:nq.optional(),_meta:af(iO(),at()).optional()}),sr=an({type:a_("image"),data:nN,mimeType:iO(),annotations:nq.optional(),_meta:af(iO(),at()).optional()}),so=an({type:a_("audio"),data:nN,mimeType:iO(),annotations:nq.optional(),_meta:af(iO(),at()).optional()}),si=an({type:a_("tool_use"),name:iO(),id:iO(),input:af(iO(),at()),_meta:af(iO(),at()).optional()}),sa=an({type:a_("resource"),resource:ac([nI,nA]),annotations:nq.optional(),_meta:af(iO(),at()).optional()}),sn=nM.extend({type:a_("resource_link")}),ss=ac([st,sr,so,sn,sa]),sl=an({role:nz,content:ss}),sc=a8.extend({description:iO().optional(),messages:ai(sl)}),su=a3.extend({method:a_("notifications/prompts/list_changed"),params:a5.optional()}),sd=an({title:iO().optional(),readOnlyHint:i3().optional(),destructiveHint:i3().optional(),idempotentHint:i3().optional(),openWorldHint:i3().optional()}),sp=an({taskSupport:ag(["required","optional","forbidden"]).optional()}),sh=an({...nd.shape,...nu.shape,description:iO().optional(),inputSchema:an({type:a_("object"),properties:af(iO(),aW).optional(),required:ai(iO()).optional()}).catchall(at()),outputSchema:as({$schema:iO().optional()}).optional(),annotations:sd.optional(),execution:sp.optional(),_meta:af(iO(),at()).optional()}),sm=nO.extend({method:a_("tools/list")}),sf=nC.extend({tools:ai(sh)}),sy=a8.extend({content:ai(ss).default([]),structuredContent:at().optional(),isError:i3().optional()}),sg=sy.or(a8.extend({toolResult:at()})),sv=a9.extend({name:iO(),arguments:af(iO(),at()).optional()}),s_=a4.extend({method:a_("tools/call"),params:sv}),sb=a3.extend({method:a_("notifications/tools/list_changed"),params:a5.optional()}),sS=an({autoRefresh:i3().default(!0),debounceMs:i2().int().nonnegative().default(300)}),sw=ag(["debug","info","notice","warning","error","critical","alert","emergency"]),s$=a2.extend({level:sw}),sP=a4.extend({method:a_("logging/setLevel"),params:s$}),sR=a5.extend({level:sw,logger:iO().optional(),data:at()}),sE=a3.extend({method:a_("notifications/message"),params:sR}),sk=an({name:iO().optional()}),sx=an({hints:ai(sk).optional(),costPriority:i2().min(0).max(1).optional(),speedPriority:i2().min(0).max(1).optional(),intelligencePriority:i2().min(0).max(1).optional()}),sT=an({mode:ag(["auto","required","none"]).optional()}),sO=an({type:a_("tool_result"),toolUseId:iO().describe("The unique identifier for the corresponding tool call."),content:ai(ss),structuredContent:at().optional(),isError:i3().optional(),_meta:af(iO(),at()).optional()}),sC=ad("type",[st,sr,so]),sj=ad("type",[st,sr,so,si,sO]),sI=an({role:nz,content:ac([sj,ai(sj)]),_meta:af(iO(),at()).optional()}),sN=a9.extend({messages:ai(sI),modelPreferences:sx.optional(),systemPrompt:iO().optional(),includeContext:ag(["none","thisServer","allServers"]).optional(),temperature:i2().optional(),maxTokens:i2().int(),stopSequences:ai(iO()).optional(),metadata:aB.optional(),tools:ai(sh).optional(),toolChoice:sT.optional()}),sA=a4.extend({method:a_("sampling/createMessage"),params:sN}),sz=a8.extend({model:iO(),stopReason:a$(ag(["endTurn","stopSequence","maxTokens"]).or(iO())),role:nz,content:sC}),sq=a8.extend({model:iO(),stopReason:a$(ag(["endTurn","stopSequence","maxTokens","toolUse"]).or(iO())),role:nz,content:ac([sj,ai(sj)])}),sM=an({type:a_("boolean"),title:iO().optional(),description:iO().optional(),default:i3().optional()}),sL=an({type:a_("string"),title:iO().optional(),description:iO().optional(),minLength:i2().optional(),maxLength:i2().optional(),format:ag(["email","uri","date","date-time"]).optional(),default:iO().optional()}),sD=an({type:ag(["number","integer"]),title:iO().optional(),description:iO().optional(),minimum:i2().optional(),maximum:i2().optional(),default:i2().optional()}),sU=an({type:a_("string"),title:iO().optional(),description:iO().optional(),enum:ai(iO()),default:iO().optional()}),sV=an({type:a_("string"),title:iO().optional(),description:iO().optional(),oneOf:ai(an({const:iO(),title:iO()})),default:iO().optional()}),sH=an({type:a_("string"),title:iO().optional(),description:iO().optional(),enum:ai(iO()),enumNames:ai(iO()).optional(),default:iO().optional()}),sF=ac([sU,sV]),sK=an({type:a_("array"),title:iO().optional(),description:iO().optional(),minItems:i2().optional(),maxItems:i2().optional(),items:an({type:a_("string"),enum:ai(iO())}),default:ai(iO()).optional()}),sJ=an({type:a_("array"),title:iO().optional(),description:iO().optional(),minItems:i2().optional(),maxItems:i2().optional(),items:an({anyOf:ai(an({const:iO(),title:iO()}))}),default:ai(iO()).optional()}),sZ=ac([sK,sJ]),sW=ac([sH,sF,sZ]),sB=ac([sW,sM,sL,sD]),sG=a9.extend({mode:a_("form").optional(),message:iO(),requestedSchema:an({type:a_("object"),properties:af(iO(),sB),required:ai(iO()).optional()}).catchall(at())}),sX=a9.extend({mode:a_("url"),message:iO(),elicitationId:iO(),url:iO().url()}),sY=ac([sG,sX]),sQ=a4.extend({method:a_("elicitation/create"),params:sY}),s0=a5.extend({elicitationId:iO()}),s1=a3.extend({method:a_("notifications/elicitation/complete"),params:s0}),s2=a8.extend({action:ag(["accept","decline","cancel"]),content:aM(t=>null===t?void 0:t,af(iO(),ac([iO(),i2(),i3(),ai(iO())])).optional())}),s9=an({type:a_("ref/resource"),uri:iO()}),s4=an({type:a_("ref/prompt"),name:iO()}),s5=a2.extend({ref:ac([s4,s9]),argument:an({name:iO(),value:iO()}),context:an({arguments:af(iO(),iO()).optional()}).optional()}),s3=a4.extend({method:a_("completion/complete"),params:s5}),s6=a8.extend({completion:as({values:ai(iO()).max(100),total:a$(i2().int()),hasMore:a$(i3())})}),s8=an({uri:iO().startsWith("file://"),name:iO().optional(),_meta:af(iO(),at()).optional()}),s7=a4.extend({method:a_("roots/list"),params:a2.optional()}),le=a8.extend({roots:ai(s8)}),lt=a3.extend({method:a_("notifications/roots/list_changed"),params:a5.optional()}),lr=as({ttl:i2().optional(),pollInterval:i2().optional()}),lo=ag(["working","input_required","completed","failed","cancelled"]),li=an({taskId:iO(),status:lo,ttl:ac([i2(),i8()]),createdAt:iO(),lastUpdatedAt:iO(),pollInterval:a$(i2()),statusMessage:a$(iO())}),la=a8.extend({task:li}),ln=a5.merge(li),ls=a3.extend({method:a_("notifications/tasks/status"),params:ln}),ll=a4.extend({method:a_("tasks/get"),params:a2.extend({taskId:iO()})}),lc=a8.merge(li),lu=a4.extend({method:a_("tasks/result"),params:a2.extend({taskId:iO()})}),ld=a8.loose(),lp=nO.extend({method:a_("tasks/list")}),lh=nC.extend({tasks:ai(li)}),lm=a4.extend({method:a_("tasks/cancel"),params:a2.extend({taskId:iO()})}),lf=a8.merge(li),ly=ac([nR,n_,n$,s3,sP,se,n6,nD,nV,nK,nW,nB,nY,s_,sm]),lg=ac([nl,nx,nw,lt]),lv=ac([nn,sz,sq,s2,le]),l_=ac([nR,sA,sQ,s7]),lb=ac([nl,nx,sE,n4,nZ,sb,su,n0,s1]),lS=ac([nn,nS,nP,s6,sc,n8,nU,nH,nJ,sy,sf,n2]),lw=rY(iL,void 0).superRefine((t,r)=>{if(!URL.canParse(t))return r.addIssue({code:aL,message:"URL must be parseable",fatal:!0}),ej}).refine(t=>{let r=new URL(t);return"javascript:"!==r.protocol&&"data:"!==r.protocol&&"vbscript:"!==r.protocol},{message:"URL cannot use javascript:, data:, or vbscript: scheme"}),l$=as({resource:iO().url(),authorization_servers:ai(lw).optional(),jwks_uri:iO().url().optional(),scopes_supported:ai(iO()).optional(),bearer_methods_supported:ai(iO()).optional(),resource_signing_alg_values_supported:ai(iO()).optional(),resource_name:iO().optional(),resource_documentation:iO().optional(),resource_policy_uri:iO().url().optional(),resource_tos_uri:iO().url().optional(),tls_client_certificate_bound_access_tokens:i3().optional(),authorization_details_types_supported:ai(iO()).optional(),dpop_signing_alg_values_supported:ai(iO()).optional(),dpop_bound_access_tokens_required:i3().optional()}),lP=as({issuer:iO(),authorization_endpoint:lw,token_endpoint:lw,registration_endpoint:lw.optional(),scopes_supported:ai(iO()).optional(),response_types_supported:ai(iO()),response_modes_supported:ai(iO()).optional(),grant_types_supported:ai(iO()).optional(),token_endpoint_auth_methods_supported:ai(iO()).optional(),token_endpoint_auth_signing_alg_values_supported:ai(iO()).optional(),service_documentation:lw.optional(),revocation_endpoint:lw.optional(),revocation_endpoint_auth_methods_supported:ai(iO()).optional(),revocation_endpoint_auth_signing_alg_values_supported:ai(iO()).optional(),introspection_endpoint:iO().optional(),introspection_endpoint_auth_methods_supported:ai(iO()).optional(),introspection_endpoint_auth_signing_alg_values_supported:ai(iO()).optional(),code_challenge_methods_supported:ai(iO()).optional(),client_id_metadata_document_supported:i3().optional(),authorization_response_iss_parameter_supported:i3().optional().catch(void 0)}),lR=as({issuer:iO(),authorization_endpoint:lw,token_endpoint:lw,userinfo_endpoint:lw.optional(),jwks_uri:lw,registration_endpoint:lw.optional(),scopes_supported:ai(iO()).optional(),response_types_supported:ai(iO()),response_modes_supported:ai(iO()).optional(),grant_types_supported:ai(iO()).optional(),acr_values_supported:ai(iO()).optional(),subject_types_supported:ai(iO()),id_token_signing_alg_values_supported:ai(iO()),id_token_encryption_alg_values_supported:ai(iO()).optional(),id_token_encryption_enc_values_supported:ai(iO()).optional(),userinfo_signing_alg_values_supported:ai(iO()).optional(),userinfo_encryption_alg_values_supported:ai(iO()).optional(),userinfo_encryption_enc_values_supported:ai(iO()).optional(),request_object_signing_alg_values_supported:ai(iO()).optional(),request_object_encryption_alg_values_supported:ai(iO()).optional(),request_object_encryption_enc_values_supported:ai(iO()).optional(),token_endpoint_auth_methods_supported:ai(iO()).optional(),token_endpoint_auth_signing_alg_values_supported:ai(iO()).optional(),display_values_supported:ai(iO()).optional(),claim_types_supported:ai(iO()).optional(),claims_supported:ai(iO()).optional(),service_documentation:iO().optional(),claims_locales_supported:ai(iO()).optional(),ui_locales_supported:ai(iO()).optional(),claims_parameter_supported:i3().optional(),request_parameter_supported:i3().optional(),request_uri_parameter_supported:i3().optional(),require_request_uri_registration:i3().optional(),op_policy_uri:lw.optional(),op_tos_uri:lw.optional(),client_id_metadata_document_supported:i3().optional(),authorization_response_iss_parameter_supported:i3().optional().catch(void 0)}),lE=an({...lR.shape,...lP.pick({code_challenge_methods_supported:!0}).shape}),lk=an({access_token:iO(),id_token:iO().optional(),token_type:iO(),expires_in:new i1(rG({type:"number",coerce:!0,checks:[],...ed(void 0)})).optional(),scope:iO().optional(),refresh_token:iO().optional()}).strip(),lx=an({issued_token_type:a_("urn:ietf:params:oauth:token-type:id-jag"),access_token:iO(),token_type:iO().optional(),expires_in:i2().optional(),scope:iO().optional()}).strip(),lT=an({error:iO(),error_description:iO().optional(),error_uri:iO().optional()}),lO=lw.optional().or(a_("").transform(()=>void 0)),lC=an({redirect_uris:ai(lw),token_endpoint_auth_method:iO().optional(),grant_types:ai(iO()).optional(),response_types:ai(iO()).optional(),application_type:iO().optional(),client_name:iO().optional(),client_uri:lw.optional(),logo_uri:lO,scope:iO().optional(),contacts:ai(iO()).optional(),tos_uri:lO,policy_uri:iO().optional(),jwks_uri:lw.optional(),jwks:new i7({type:"any"}).optional(),software_id:iO().optional(),software_version:iO().optional(),software_statement:iO().optional()}).strip(),lj=an({client_id:iO(),client_secret:iO().optional(),client_id_issued_at:i2().optional(),client_secret_expires_at:i2().optional()}).strip(),lI=lC.merge(lj),lN=an({error:iO(),error_description:iO().optional()}).strip(),lA=an({token:iO(),token_type_hint:iO().optional()}).strip(),lz=Symbol.for("mcp.sdk.errorBrands");function lq(t,r){let o=new Set,i=r;for(;"function"==typeof i;){let t=i.mcpBrand;Object.prototype.hasOwnProperty.call(i,"mcpBrand")&&"string"==typeof t&&o.add(t),i=Object.getPrototypeOf(i)}0!==o.size&&Object.defineProperty(t,lz,{value:o,enumerable:!1,configurable:!0})}function lM(t,r){try{if("object"==typeof r&&null!==r&&Object.prototype.hasOwnProperty.call(t,"mcpBrand")&&"string"==typeof t.mcpBrand&&Object.prototype.hasOwnProperty.call(r,lz)){let o=r[lz];if(o&&"function"==typeof o.has&&o.has(t.mcpBrand))return!0}}catch{}return Function.prototype[Symbol.hasInstance].call(t,r)}let lL=((P={}).InvalidRequest="invalid_request",P.InvalidClient="invalid_client",P.InvalidGrant="invalid_grant",P.UnauthorizedClient="unauthorized_client",P.UnsupportedGrantType="unsupported_grant_type",P.InvalidScope="invalid_scope",P.AccessDenied="access_denied",P.ServerError="server_error",P.TemporarilyUnavailable="temporarily_unavailable",P.UnsupportedResponseType="unsupported_response_type",P.UnsupportedTokenType="unsupported_token_type",P.InvalidToken="invalid_token",P.MethodNotAllowed="method_not_allowed",P.TooManyRequests="too_many_requests",P.InvalidClientMetadata="invalid_client_metadata",P.InvalidRedirectUri="invalid_redirect_uri",P.InsufficientScope="insufficient_scope",P.InvalidTarget="invalid_target",P);var lD=class t extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.OAuthError"})}static[Symbol.hasInstance](t){return lM(this,t)}static isInstance(t){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 lM(this,t)}constructor(t,r,o){super(r),this.code=t,this.errorUri=o,this.name="OAuthError",lq(this,new.target)}toResponseObject(){let t={error:this.code,error_description:this.message};return this.errorUri&&(t.error_uri=this.errorUri),t}static fromResponse(r){return new t(r.error,r.error_description??r.error,r.error_uri)}};let lU=((R={}).NotConnected="NOT_CONNECTED",R.AlreadyConnected="ALREADY_CONNECTED",R.NotInitialized="NOT_INITIALIZED",R.CapabilityNotSupported="CAPABILITY_NOT_SUPPORTED",R.RequestTimeout="REQUEST_TIMEOUT",R.ConnectionClosed="CONNECTION_CLOSED",R.SendFailed="SEND_FAILED",R.InvalidResult="INVALID_RESULT",R.UnsupportedResultType="UNSUPPORTED_RESULT_TYPE",R.InputRequiredRoundsExceeded="INPUT_REQUIRED_ROUNDS_EXCEEDED",R.ListPaginationExceeded="LIST_PAGINATION_EXCEEDED",R.MethodNotSupportedByProtocolVersion="METHOD_NOT_SUPPORTED_BY_PROTOCOL_VERSION",R.EraNegotiationFailed="ERA_NEGOTIATION_FAILED",R.ClientHttpNotImplemented="CLIENT_HTTP_NOT_IMPLEMENTED",R.ClientHttpAuthentication="CLIENT_HTTP_AUTHENTICATION",R.ClientHttpForbidden="CLIENT_HTTP_FORBIDDEN",R.ClientHttpUnexpectedContent="CLIENT_HTTP_UNEXPECTED_CONTENT",R.ClientHttpFailedToOpenStream="CLIENT_HTTP_FAILED_TO_OPEN_STREAM",R.ClientHttpFailedToTerminateSession="CLIENT_HTTP_FAILED_TO_TERMINATE_SESSION",R);var lV=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkError"})}static[Symbol.hasInstance](t){return lM(this,t)}static isInstance(t){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 lM(this,t)}constructor(t,r,o){super(r),this.code=t,this.data=o,this.name="SdkError",lq(this,new.target)}},lH=class extends lV{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkHttpError"})}constructor(t,r,o){super(t,r,o),this.name="SdkHttpError"}get status(){return this.data.status}get statusText(){return this.data.statusText}};let lF="2026-07-28",lK=[lF];function lJ(t){return t.filter(t=>!(t>=lF))}function lZ(t){return t.filter(t=>t>=lF)}function lW(t){let r=t.structuredContent;return void 0===r||!("object"!=typeof r||null===r||Array.isArray(r))||t.content?.some(t=>"text"===t.type)?t:{...t,content:[...t.content??[],{type:"text",text:JSON.stringify(r)}]}}let lB=["task","inputRequests","requestState"];function lG(t){return null===t||"object"!=typeof t||Array.isArray(t)||void 0!==t.content||lB.some(r=>r in t)?t:{...t,content:[]}}function lX(){let t,r,i,a,n,s,l,c,u,d,p,h,m,f,y,g,v,_,b,S,w,$,P,R,E,k,x,T,O,C,j,I,N,A,z,q,M,L,D,U,V,H,F,K,J,Z,W,B,G,X,Y,Q,ee,et,er,eo,ei,ea,en,es,el,ec,eu,ed,ep,eh,em,ef,ey,eg,ev,e_,eb,eS,ew,e$,eP,eR,eE,ek,ex,eT,eO,eC,ej,eI,eN,eA,ez,eq,eM,eL,eD,eU,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,ti,ta,tn,ts,tl,tc,tu,td,tp,th,tm,tf,ty,tg,tv,t_,tb,tS,tw,t$;return o??=(t=az(()=>ac([iO(),i2(),i3(),i8(),af(iO(),t),ai(t)])),r=af(iO(),t),i=ac([iO(),i2().int()]),a=iO(),n=an({ttl:i2().optional()}),s=an({taskId:iO()}),l=as({progressToken:i.optional(),"io.modelcontextprotocol/related-task":s.optional()}),u=(c=an({_meta:l.optional()})).extend({task:n.optional()}),d=an({method:iO(),params:c.loose().optional()}),p=an({_meta:l.optional()}),h=an({method:iO(),params:p.loose().optional()}),m=as({_meta:l.optional()}),f=ac([iO(),i2().int()]),y=m.strict(),g=p.extend({requestId:f.optional(),reason:iO().optional()}),v=h.extend({method:a_("notifications/cancelled"),params:g}),_=an({src:iO(),mimeType:iO().optional(),sizes:ai(iO()).optional(),theme:ag(["light","dark"]).optional()}),b=an({icons:ai(_).optional()}),w=(S=an({name:iO(),title:iO().optional()})).extend({...S.shape,...b.shape,version:iO(),websiteUrl:iO().optional(),description:iO().optional()}),$=ah(an({applyDefaults:i3().optional()}),r),P=aM(t=>t&&"object"==typeof t&&!Array.isArray(t)&&0===Object.keys(t).length?{form:{}}:t,ah(an({form:$.optional(),url:r.optional()}),r.optional())),R=as({list:r.optional(),cancel:r.optional(),requests:as({sampling:as({createMessage:r.optional()}).optional(),elicitation:as({create:r.optional()}).optional()}).optional()}),E=as({list:r.optional(),cancel:r.optional(),requests:as({tools:as({call:r.optional()}).optional()}).optional()}),k=an({experimental:af(iO(),r).optional(),sampling:an({context:r.optional(),tools:r.optional()}).optional(),elicitation:P.optional(),roots:an({listChanged:i3().optional()}).optional(),tasks:R.optional(),extensions:af(iO(),r).optional()}),x=c.extend({protocolVersion:iO(),capabilities:k,clientInfo:w}),T=d.extend({method:a_("initialize"),params:x}),O=an({experimental:af(iO(),r).optional(),logging:r.optional(),completions:r.optional(),prompts:an({listChanged:i3().optional()}).optional(),resources:an({subscribe:i3().optional(),listChanged:i3().optional()}).optional(),tools:an({listChanged:i3().optional()}).optional(),tasks:E.optional(),extensions:af(iO(),r).optional()}),C=m.extend({protocolVersion:iO(),capabilities:O,serverInfo:w,instructions:iO().optional()}),j=h.extend({method:a_("notifications/initialized"),params:p.optional()}),I=d.extend({method:a_("ping"),params:c.optional()}),N=an({progress:i2(),total:a$(i2()),message:a$(iO())}),A=an({...p.shape,...N.shape,progressToken:i}),z=h.extend({method:a_("notifications/progress"),params:A}),q=c.extend({cursor:a.optional()}),M=d.extend({params:q.optional()}),L=m.extend({nextCursor:a.optional()}),U=(D=an({uri:iO(),mimeType:a$(iO()),_meta:af(iO(),at()).optional()})).extend({text:iO()}),V=iO().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),H=D.extend({blob:V}),F=ag(["user","assistant"]),K=an({audience:ai(F).optional(),priority:i2().min(0).max(1).optional(),lastModified:rQ(ij,{offset:!0}).optional()}),J=an({...S.shape,...b.shape,uri:iO(),description:a$(iO()),mimeType:a$(iO()),size:a$(i2()),annotations:K.optional(),_meta:a$(as({}))}),Z=an({...S.shape,...b.shape,uriTemplate:iO(),description:a$(iO()),mimeType:a$(iO()),annotations:K.optional(),_meta:a$(as({}))}),W=M.extend({method:a_("resources/list")}),B=L.extend({resources:ai(J)}),G=M.extend({method:a_("resources/templates/list")}),X=L.extend({resourceTemplates:ai(Z)}),Y=c.extend({uri:iO()}),Q=d.extend({method:a_("resources/read"),params:Y}),ee=m.extend({contents:ai(ac([U,H]))}),et=h.extend({method:a_("notifications/resources/list_changed"),params:p.optional()}),er=d.extend({method:a_("resources/subscribe"),params:Y}),eo=d.extend({method:a_("resources/unsubscribe"),params:Y}),ei=p.extend({uri:iO()}),ea=h.extend({method:a_("notifications/resources/updated"),params:ei}),en=an({name:iO(),description:a$(iO()),required:a$(i3())}),es=an({...S.shape,...b.shape,description:a$(iO()),arguments:a$(ai(en)),_meta:a$(as({}))}),el=M.extend({method:a_("prompts/list")}),ec=L.extend({prompts:ai(es)}),eu=c.extend({name:iO(),arguments:af(iO(),iO()).optional()}),ed=d.extend({method:a_("prompts/get"),params:eu}),ep=an({type:a_("text"),text:iO(),annotations:K.optional(),_meta:af(iO(),at()).optional()}),eh=an({type:a_("image"),data:V,mimeType:iO(),annotations:K.optional(),_meta:af(iO(),at()).optional()}),em=an({type:a_("audio"),data:V,mimeType:iO(),annotations:K.optional(),_meta:af(iO(),at()).optional()}),ef=an({type:a_("tool_use"),name:iO(),id:iO(),input:af(iO(),at()),_meta:af(iO(),at()).optional()}),ey=an({type:a_("resource"),resource:ac([U,H]),annotations:K.optional(),_meta:af(iO(),at()).optional()}),eg=J.extend({type:a_("resource_link")}),ev=ac([ep,eh,em,eg,ey]),e_=an({role:F,content:ev}),eb=m.extend({description:iO().optional(),messages:ai(e_)}),eS=h.extend({method:a_("notifications/prompts/list_changed"),params:p.optional()}),ew=an({title:iO().optional(),readOnlyHint:i3().optional(),destructiveHint:i3().optional(),idempotentHint:i3().optional(),openWorldHint:i3().optional()}),e$=an({taskSupport:ag(["required","optional","forbidden"]).optional()}),eP=an({...S.shape,...b.shape,description:iO().optional(),inputSchema:an({type:a_("object"),properties:af(iO(),t).optional(),required:ai(iO()).optional()}).catchall(at()),outputSchema:an({type:a_("object"),properties:af(iO(),t).optional(),required:ai(iO()).optional()}).catchall(at()).optional(),annotations:ew.optional(),execution:e$.optional(),_meta:af(iO(),at()).optional()}),eR=M.extend({method:a_("tools/list")}),eE=L.extend({tools:ai(eP)}),ek=m.extend({content:ai(ev),structuredContent:af(iO(),at()).optional(),isError:i3().optional()}),ex=u.extend({name:iO(),arguments:af(iO(),at()).optional()}),eT=d.extend({method:a_("tools/call"),params:ex}),eO=h.extend({method:a_("notifications/tools/list_changed"),params:p.optional()}),eC=ag(["debug","info","notice","warning","error","critical","alert","emergency"]),ej=c.extend({level:eC}),eI=d.extend({method:a_("logging/setLevel"),params:ej}),eN=p.extend({level:eC,logger:iO().optional(),data:at()}),eA=h.extend({method:a_("notifications/message"),params:eN}),ez=an({name:iO().optional()}),eq=an({hints:ai(ez).optional(),costPriority:i2().min(0).max(1).optional(),speedPriority:i2().min(0).max(1).optional(),intelligencePriority:i2().min(0).max(1).optional()}),eM=an({mode:ag(["auto","required","none"]).optional()}),eL=an({type:a_("tool_result"),toolUseId:iO().describe("The unique identifier for the corresponding tool call."),content:ai(ev),structuredContent:an({}).loose().optional(),isError:i3().optional(),_meta:af(iO(),at()).optional()}),eD=ad("type",[ep,eh,em]),eU=ad("type",[ep,eh,em,ef,eL]),eV=an({role:F,content:ac([eU,ai(eU)]),_meta:af(iO(),at()).optional()}),eH=u.extend({messages:ai(eV),modelPreferences:eq.optional(),systemPrompt:iO().optional(),includeContext:ag(["none","thisServer","allServers"]).optional(),temperature:i2().optional(),maxTokens:i2().int(),stopSequences:ai(iO()).optional(),metadata:r.optional(),tools:ai(eP).optional(),toolChoice:eM.optional()}),eF=d.extend({method:a_("sampling/createMessage"),params:eH}),eK=m.extend({model:iO(),stopReason:a$(ag(["endTurn","stopSequence","maxTokens"]).or(iO())),role:F,content:eD}),eJ=m.extend({model:iO(),stopReason:a$(ag(["endTurn","stopSequence","maxTokens","toolUse"]).or(iO())),role:F,content:ac([eU,ai(eU)])}),eZ=an({type:a_("boolean"),title:iO().optional(),description:iO().optional(),default:i3().optional()}),eW=an({type:a_("string"),title:iO().optional(),description:iO().optional(),minLength:i2().optional(),maxLength:i2().optional(),format:ag(["email","uri","date","date-time"]).optional(),default:iO().optional()}),eB=an({type:ag(["number","integer"]),title:iO().optional(),description:iO().optional(),minimum:i2().optional(),maximum:i2().optional(),default:i2().optional()}),eG=an({type:a_("string"),title:iO().optional(),description:iO().optional(),enum:ai(iO()),default:iO().optional()}),eX=an({type:a_("string"),title:iO().optional(),description:iO().optional(),oneOf:ai(an({const:iO(),title:iO()})),default:iO().optional()}),eY=an({type:a_("string"),title:iO().optional(),description:iO().optional(),enum:ai(iO()),enumNames:ai(iO()).optional(),default:iO().optional()}),eQ=ac([eG,eX]),e0=an({type:a_("array"),title:iO().optional(),description:iO().optional(),minItems:i2().optional(),maxItems:i2().optional(),items:an({type:a_("string"),enum:ai(iO())}),default:ai(iO()).optional()}),e1=an({type:a_("array"),title:iO().optional(),description:iO().optional(),minItems:i2().optional(),maxItems:i2().optional(),items:an({anyOf:ai(an({const:iO(),title:iO()}))}),default:ai(iO()).optional()}),e2=ac([e0,e1]),e9=ac([eY,eQ,e2]),e4=ac([e9,eZ,eW,eB]),e5=u.extend({mode:a_("form").optional(),message:iO(),requestedSchema:an({type:a_("object"),properties:af(iO(),e4),required:ai(iO()).optional()}).catchall(at())}),e3=u.extend({mode:a_("url"),message:iO(),elicitationId:iO(),url:iO().url()}),e6=ac([e5,e3]),e8=d.extend({method:a_("elicitation/create"),params:e6}),e7=p.extend({elicitationId:iO()}),te=h.extend({method:a_("notifications/elicitation/complete"),params:e7}),tt=m.extend({action:ag(["accept","decline","cancel"]),content:aM(t=>null===t?void 0:t,af(iO(),ac([iO(),i2(),i3(),ai(iO())])).optional())}),tr=an({type:a_("ref/resource"),uri:iO()}),to=an({type:a_("ref/prompt"),name:iO()}),ti=c.extend({ref:ac([to,tr]),argument:an({name:iO(),value:iO()}),context:an({arguments:af(iO(),iO()).optional()}).optional()}),ta=d.extend({method:a_("completion/complete"),params:ti}),tn=m.extend({completion:as({values:ai(iO()).max(100),total:a$(i2().int()),hasMore:a$(i3())})}),ts=an({uri:iO().startsWith("file://"),name:iO().optional(),_meta:af(iO(),at()).optional()}),tl=d.extend({method:a_("roots/list"),params:c.optional()}),tc=m.extend({roots:ai(ts)}),tu=h.extend({method:a_("notifications/roots/list_changed"),params:p.optional()}),td=as({ttl:i2().optional(),pollInterval:i2().optional()}),tp=ag(["working","input_required","completed","failed","cancelled"]),th=an({taskId:iO(),status:tp,ttl:ac([i2(),i8()]),createdAt:iO(),lastUpdatedAt:iO(),pollInterval:a$(i2()),statusMessage:a$(iO())}),tm=m.extend({task:th}),tf=p.merge(th),ty=h.extend({method:a_("notifications/tasks/status"),params:tf}),tg=d.extend({method:a_("tasks/get"),params:c.extend({taskId:iO()})}),tv=m.merge(th),t_=d.extend({method:a_("tasks/result"),params:c.extend({taskId:iO()})}),tb=m.loose(),tS=M.extend({method:a_("tasks/list")}),tw=L.extend({tasks:ai(th)}),t$=d.extend({method:a_("tasks/cancel"),params:c.extend({taskId:iO()})}),{JSONValueSchema:t,JSONObjectSchema:r,ProgressTokenSchema:i,CursorSchema:a,TaskMetadataSchema:n,RelatedTaskMetadataSchema:s,RequestMetaSchema:l,BaseRequestParamsSchema:c,TaskAugmentedRequestParamsSchema:u,RequestSchema:d,NotificationsParamsSchema:p,NotificationSchema:h,ResultSchema:m,RequestIdSchema:f,EmptyResultSchema:y,CancelledNotificationParamsSchema:g,CancelledNotificationSchema:v,IconSchema:_,IconsSchema:b,BaseMetadataSchema:S,ImplementationSchema:w,ClientTasksCapabilitySchema:R,ServerTasksCapabilitySchema:E,ClientCapabilitiesSchema:k,InitializeRequestParamsSchema:x,InitializeRequestSchema:T,ServerCapabilitiesSchema:O,InitializeResultSchema:C,InitializedNotificationSchema:j,PingRequestSchema:I,ProgressSchema:N,ProgressNotificationParamsSchema:A,ProgressNotificationSchema:z,PaginatedRequestParamsSchema:q,PaginatedRequestSchema:M,PaginatedResultSchema:L,ResourceContentsSchema:D,TextResourceContentsSchema:U,BlobResourceContentsSchema:H,RoleSchema:F,AnnotationsSchema:K,ResourceSchema:J,ResourceTemplateSchema:Z,ListResourcesRequestSchema:W,ListResourcesResultSchema:B,ListResourceTemplatesRequestSchema:G,ListResourceTemplatesResultSchema:X,ResourceRequestParamsSchema:Y,ReadResourceRequestParamsSchema:Y,ReadResourceRequestSchema:Q,ReadResourceResultSchema:ee,ResourceListChangedNotificationSchema:et,SubscribeRequestParamsSchema:Y,SubscribeRequestSchema:er,UnsubscribeRequestParamsSchema:Y,UnsubscribeRequestSchema:eo,ResourceUpdatedNotificationParamsSchema:ei,ResourceUpdatedNotificationSchema:ea,PromptArgumentSchema:en,PromptSchema:es,ListPromptsRequestSchema:el,ListPromptsResultSchema:ec,GetPromptRequestParamsSchema:eu,GetPromptRequestSchema:ed,TextContentSchema:ep,ImageContentSchema:eh,AudioContentSchema:em,ToolUseContentSchema:ef,EmbeddedResourceSchema:ey,ResourceLinkSchema:eg,ContentBlockSchema:ev,PromptMessageSchema:e_,GetPromptResultSchema:eb,PromptListChangedNotificationSchema:eS,ToolAnnotationsSchema:ew,ToolExecutionSchema:e$,ToolSchema:eP,ListToolsRequestSchema:eR,ListToolsResultSchema:eE,CallToolResultSchema:ek,CallToolRequestParamsSchema:ex,CallToolRequestSchema:eT,ToolListChangedNotificationSchema:eO,LoggingLevelSchema:eC,SetLevelRequestParamsSchema:ej,SetLevelRequestSchema:eI,LoggingMessageNotificationParamsSchema:eN,LoggingMessageNotificationSchema:eA,ModelHintSchema:ez,ModelPreferencesSchema:eq,ToolChoiceSchema:eM,ToolResultContentSchema:eL,SamplingContentSchema:eD,SamplingMessageContentBlockSchema:eU,SamplingMessageSchema:eV,CreateMessageRequestParamsSchema:eH,CreateMessageRequestSchema:eF,CreateMessageResultSchema:eK,CreateMessageResultWithToolsSchema:eJ,BooleanSchemaSchema:eZ,StringSchemaSchema:eW,NumberSchemaSchema:eB,UntitledSingleSelectEnumSchemaSchema:eG,TitledSingleSelectEnumSchemaSchema:eX,LegacyTitledEnumSchemaSchema:eY,SingleSelectEnumSchemaSchema:eQ,UntitledMultiSelectEnumSchemaSchema:e0,TitledMultiSelectEnumSchemaSchema:e1,MultiSelectEnumSchemaSchema:e2,EnumSchemaSchema:e9,PrimitiveSchemaDefinitionSchema:e4,ElicitRequestFormParamsSchema:e5,ElicitRequestURLParamsSchema:e3,ElicitRequestParamsSchema:e6,ElicitRequestSchema:e8,ElicitationCompleteNotificationParamsSchema:e7,ElicitationCompleteNotificationSchema:te,ElicitResultSchema:tt,ResourceTemplateReferenceSchema:tr,PromptReferenceSchema:to,CompleteRequestParamsSchema:ti,CompleteRequestSchema:ta,CompleteResultSchema:tn,RootSchema:ts,ListRootsRequestSchema:tl,ListRootsResultSchema:tc,RootsListChangedNotificationSchema:tu,TaskCreationParamsSchema:td,TaskStatusSchema:tp,TaskSchema:th,CreateTaskResultSchema:tm,TaskStatusNotificationParamsSchema:tf,TaskStatusNotificationSchema:ty,GetTaskRequestSchema:tg,GetTaskResultSchema:tv,GetTaskPayloadRequestSchema:t_,GetTaskPayloadResultSchema:tb,ListTasksRequestSchema:tS,ListTasksResultSchema:tw,CancelTaskRequestSchema:t$,CancelTaskResultSchema:m.merge(th),ClientRequestSchema:ac([I,T,ta,eI,ed,el,W,G,Q,er,eo,eT,eR,tg,t_,tS,t$]),ClientNotificationSchema:ac([v,z,j,tu,ty]),ClientResultSchema:ac([y,eK,eJ,tt,tc,tv,tw,tm]),ServerRequestSchema:ac([I,eF,e8,tl,tg,t_,tS,t$]),ServerNotificationSchema:ac([v,z,eA,ea,et,eO,eS,ty,te]),ServerResultSchema:ac([y,C,tn,eb,ec,B,X,ee,ek,eE,tv,tw,tm]),CallToolResultWireSchema:at().superRefine((t,r)=>{if(!("object"!=typeof t||null===t||Array.isArray(t))&&void 0===t.content){for(let o of lB)if(o in t)return void r.addIssue({code:"custom",message:`content is required when the body carries '${o}' — another result family cannot default into an empty tools/call success`})}}).transform(lG).pipe(ek)})}function lY(t){return"object"!==t.type}let lQ=new Set(["const","enum","default","examples"]),l0=new Set(["properties","patternProperties","$defs","definitions","dependentSchemas","dependencies"]);function l1(t){return void 0!==t&&!("string"==typeof t&&t.startsWith("#"))}let l2={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},l9={"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},l4={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 l5(){if(i)return i;let t=lX();return i={requestSchemas:{ping:t.PingRequestSchema,initialize:t.InitializeRequestSchema,"completion/complete":t.CompleteRequestSchema,"logging/setLevel":t.SetLevelRequestSchema,"prompts/get":t.GetPromptRequestSchema,"prompts/list":t.ListPromptsRequestSchema,"resources/list":t.ListResourcesRequestSchema,"resources/templates/list":t.ListResourceTemplatesRequestSchema,"resources/read":t.ReadResourceRequestSchema,"resources/subscribe":t.SubscribeRequestSchema,"resources/unsubscribe":t.UnsubscribeRequestSchema,"tools/call":t.CallToolRequestSchema,"tools/list":t.ListToolsRequestSchema,"tasks/get":t.GetTaskRequestSchema,"tasks/result":t.GetTaskPayloadRequestSchema,"tasks/list":t.ListTasksRequestSchema,"tasks/cancel":t.CancelTaskRequestSchema,"sampling/createMessage":t.CreateMessageRequestSchema,"elicitation/create":t.ElicitRequestSchema,"roots/list":t.ListRootsRequestSchema},notificationSchemas:{"notifications/cancelled":t.CancelledNotificationSchema,"notifications/progress":t.ProgressNotificationSchema,"notifications/initialized":t.InitializedNotificationSchema,"notifications/roots/list_changed":t.RootsListChangedNotificationSchema,"notifications/tasks/status":t.TaskStatusNotificationSchema,"notifications/message":t.LoggingMessageNotificationSchema,"notifications/resources/updated":t.ResourceUpdatedNotificationSchema,"notifications/resources/list_changed":t.ResourceListChangedNotificationSchema,"notifications/tools/list_changed":t.ToolListChangedNotificationSchema,"notifications/prompts/list_changed":t.PromptListChangedNotificationSchema,"notifications/elicitation/complete":t.ElicitationCompleteNotificationSchema},resultSchemas:{ping:t.EmptyResultSchema,initialize:t.InitializeResultSchema,"completion/complete":t.CompleteResultSchema,"logging/setLevel":t.EmptyResultSchema,"prompts/get":t.GetPromptResultSchema,"prompts/list":t.ListPromptsResultSchema,"resources/list":t.ListResourcesResultSchema,"resources/templates/list":t.ListResourceTemplatesResultSchema,"resources/read":t.ReadResourceResultSchema,"resources/subscribe":t.EmptyResultSchema,"resources/unsubscribe":t.EmptyResultSchema,"tools/call":t.CallToolResultWireSchema,"tools/list":t.ListToolsResultSchema,"sampling/createMessage":t.CreateMessageResultWithToolsSchema,"elicitation/create":t.ElicitResultSchema,"roots/list":t.ListRootsResultSchema}}}function l3(t){return Object.prototype.hasOwnProperty.call(l2,t)}function l6(t){return Object.prototype.hasOwnProperty.call(l9,t)}function l8(t){return null!==t&&"object"==typeof t&&!Array.isArray(t)}function l7(t,r){if(void 0===t)return{ok:!1,reason:"not-in-era"};let o=t.safeParse(r);return o.success?{ok:!0,value:o.data}:{ok:!1,reason:"invalid",message:String(o.error)}}Object.keys(l2),Object.keys(l9);let ce={ok:!1,reason:"not-in-era"};function ct(t){return l8(t)&&l8(t.outputSchema)&&lY(t.outputSchema)}let cr={era:"2025-11-25",hasRequestMethod:l3,hasNotificationMethod:l6,validateRequest:(t,r)=>{var o;return l7(l3(o=t)?l5().requestSchemas[o]:void 0,r)},validateResult:(t,r)=>{var o,i;return l7((i=o=t,Object.prototype.hasOwnProperty.call(l4,i))?l5().resultSchemas[o]:void 0,r)},validateNotification:(t,r)=>{var o;return l7(l6(o=t)?l5().notificationSchemas[o]:void 0,r)},hasInputRequestMethod:()=>!1,validateInputRequest:()=>ce,validateInputResponse:()=>ce,samplingResultVariant:(t,r)=>{let o=lX();return l7(t?o.CreateMessageResultWithToolsSchema:o.CreateMessageResultSchema,r)},outboundEnvelope:t=>void 0,validateEnvelopeMeta:t=>[],projectCallToolResult(t,r){let o=lW(t),i=o.structuredContent;if(void 0===i)return o;let a="object"!=typeof i||null===i||Array.isArray(i),n=void 0!==r&&lY(r);return a||n?{...o,structuredContent:{result:i}}:o},decodeResult(t,r){if(l8(r)&&"resultType"in r){let t={...r};return delete t.resultType,{kind:"complete",result:t}}return{kind:"complete",result:r}},encodeResult(t,r){if("tools/list"!==t)return r;let o=r.tools;return Array.isArray(o)&&o.some(t=>ct(t))?{...r,tools:o.map(t=>ct(t)?{...t,outputSchema:function(t){var r;let o="string"==typeof t.$schema?t.$schema:void 0;if(l1(t.$id))return{...void 0!==o&&{$schema:o},type:"object",properties:{result:t},required:["result"]};let i="string"==typeof(r=t.$schema)&&D.has(r.replace(/#$/,""))&&!0!==t.$recursiveAnchor,a=(t,r)=>{if(Array.isArray(t))return t.map(t=>a(t,!1));if(null===t||"object"!=typeof t||!r&&l1(t.$id))return t;let o={},n=!1;for(let[s,l]of Object.entries(t))r?o[s]=a(l,!1):("$ref"===s||"$dynamicRef"===s)&&"string"==typeof l?o[s]="#"===l?"#/properties/result":l.startsWith("#/")?`#/properties/result${l.slice(1)}`:l:"$recursiveRef"===s&&"#"===l&&i?n=!0:lQ.has(s)?o[s]=l:l0.has(s)?o[s]=a(l,!0):o[s]=a(l,!1);return n&&("$ref"in o?o.allOf=[...Array.isArray(o.allOf)?o.allOf:[],{$ref:"#/properties/result"}]:o.$ref="#/properties/result"),o};return{...void 0!==o&&{$schema:o},type:"object",properties:{result:a(t,!1)},required:["result"]}}(t.outputSchema)}:t)}:r},encodeErrorCode:t=>-32002===t?-32602:t,checkInboundEnvelope:t=>void 0};function co(){return s??=function(){let t=az(()=>ac([iO(),i2(),i3(),i8(),af(iO(),t),ai(t)])),r=af(iO(),t),o=ac([iO(),i2().int()]),i=iO(),a=ac([iO(),i2().int()]),n=ag(["user","assistant"]),s=ag(["debug","info","notice","warning","error","critical","alert","emergency"]),l=iO().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),c=an({ttl:i2().optional()}),u=an({taskId:iO()}),d=as({progressToken:o.optional(),"io.modelcontextprotocol/related-task":u.optional()}),p=an({_meta:d.optional()}),h=p.extend({task:c.optional()}),m=an({_meta:d.optional()}),f=an({method:iO(),params:m.loose().optional()}),y=an({src:iO(),mimeType:iO().optional(),sizes:ai(iO()).optional(),theme:ag(["light","dark"]).optional()}),g=an({icons:ai(y).optional()}),v=an({name:iO(),title:iO().optional()}),_=v.extend({...v.shape,...g.shape,version:iO(),websiteUrl:iO().optional(),description:iO().optional()}),b=ah(an({applyDefaults:i3().optional()}),r),S=aM(t=>t&&"object"==typeof t&&!Array.isArray(t)&&0===Object.keys(t).length?{form:{}}:t,ah(an({form:b.optional(),url:r.optional()}),r.optional())),w=as({list:r.optional(),cancel:r.optional(),requests:as({sampling:as({createMessage:r.optional()}).optional(),elicitation:as({create:r.optional()}).optional()}).optional()}),$=as({list:r.optional(),cancel:r.optional(),requests:as({tools:as({call:r.optional()}).optional()}).optional()}),P=an({experimental:af(iO(),r).optional(),sampling:an({context:r.optional(),tools:r.optional()}).optional(),elicitation:S.optional(),roots:an({listChanged:i3().optional()}).optional(),tasks:w.optional(),extensions:af(iO(),r).optional()}),R=an({experimental:af(iO(),r).optional(),logging:r.optional(),completions:r.optional(),prompts:an({listChanged:i3().optional()}).optional(),resources:an({subscribe:i3().optional(),listChanged:i3().optional()}).optional(),tools:an({listChanged:i3().optional()}).optional(),tasks:$.optional(),extensions:af(iO(),r).optional()}),E=an({progress:i2(),total:a$(i2()),message:a$(iO())}),k=an({...m.shape,...E.shape,progressToken:o}),x=f.extend({method:a_("notifications/progress"),params:k}),T=m.extend({level:s,logger:iO().optional(),data:at()}),O=f.extend({method:a_("notifications/message"),params:T}),C=an({uri:iO(),mimeType:a$(iO()),_meta:af(iO(),at()).optional()}),j=C.extend({text:iO()}),I=C.extend({blob:l}),N=an({audience:ai(n).optional(),priority:i2().min(0).max(1).optional(),lastModified:rQ(ij,{offset:!0}).optional()}),A=an({...v.shape,...g.shape,uri:iO(),description:a$(iO()),mimeType:a$(iO()),size:a$(i2()),annotations:N.optional(),_meta:a$(as({}))}),z=an({...v.shape,...g.shape,uriTemplate:iO(),description:a$(iO()),mimeType:a$(iO()),annotations:N.optional(),_meta:a$(as({}))}),q=f.extend({method:a_("notifications/resources/list_changed"),params:m.optional()}),M=m.extend({uri:iO()}),L=f.extend({method:a_("notifications/resources/updated"),params:M}),D=an({name:iO(),description:a$(iO()),required:a$(i3())}),U=an({...v.shape,...g.shape,description:a$(iO()),arguments:a$(ai(D)),_meta:a$(as({}))}),V=f.extend({method:a_("notifications/prompts/list_changed"),params:m.optional()}),H=an({type:a_("text"),text:iO(),annotations:N.optional(),_meta:af(iO(),at()).optional()}),F=an({type:a_("image"),data:l,mimeType:iO(),annotations:N.optional(),_meta:af(iO(),at()).optional()}),K=an({type:a_("audio"),data:l,mimeType:iO(),annotations:N.optional(),_meta:af(iO(),at()).optional()}),J=an({type:a_("tool_use"),name:iO(),id:iO(),input:af(iO(),at()),_meta:af(iO(),at()).optional()}),Z=an({type:a_("resource"),resource:ac([j,I]),annotations:N.optional(),_meta:af(iO(),at()).optional()}),W=A.extend({type:a_("resource_link")}),B=ac([H,F,K,W,Z]),G=an({role:n,content:B}),X=an({title:iO().optional(),readOnlyHint:i3().optional(),destructiveHint:i3().optional(),idempotentHint:i3().optional(),openWorldHint:i3().optional()}),Y=f.extend({method:a_("notifications/tools/list_changed"),params:m.optional()}),Q=an({name:iO().optional()}),ee=an({hints:ai(Q).optional(),costPriority:i2().min(0).max(1).optional(),speedPriority:i2().min(0).max(1).optional(),intelligencePriority:i2().min(0).max(1).optional()}),et=an({mode:ag(["auto","required","none"]).optional()}),er=an({type:a_("boolean"),title:iO().optional(),description:iO().optional(),default:i3().optional()}),eo=an({type:a_("string"),title:iO().optional(),description:iO().optional(),minLength:i2().optional(),maxLength:i2().optional(),format:ag(["email","uri","date","date-time"]).optional(),default:iO().optional()}),ei=an({type:ag(["number","integer"]),title:iO().optional(),description:iO().optional(),minimum:i2().optional(),maximum:i2().optional(),default:i2().optional()}),ea=an({type:a_("string"),title:iO().optional(),description:iO().optional(),enum:ai(iO()),default:iO().optional()}),en=an({type:a_("string"),title:iO().optional(),description:iO().optional(),oneOf:ai(an({const:iO(),title:iO()})),default:iO().optional()}),es=an({type:a_("string"),title:iO().optional(),description:iO().optional(),enum:ai(iO()),enumNames:ai(iO()).optional(),default:iO().optional()}),el=ac([ea,en]),ec=an({type:a_("array"),title:iO().optional(),description:iO().optional(),minItems:i2().optional(),maxItems:i2().optional(),items:an({type:a_("string"),enum:ai(iO())}),default:ai(iO()).optional()}),eu=an({type:a_("array"),title:iO().optional(),description:iO().optional(),minItems:i2().optional(),maxItems:i2().optional(),items:an({anyOf:ai(an({const:iO(),title:iO()}))}),default:ai(iO()).optional()}),ed=ac([ec,eu]),ep=ac([es,el,ed]),eh=ac([ep,er,eo,ei]),em=h.extend({mode:a_("form").optional(),message:iO(),requestedSchema:an({type:a_("object"),properties:af(iO(),eh),required:ai(iO()).optional()}).catchall(at())}),ef=an({type:a_("ref/resource"),uri:iO()}),ey=an({type:a_("ref/prompt"),name:iO()}),eg=an({uri:iO().startsWith("file://"),name:iO().optional(),_meta:af(iO(),at()).optional()}),ev=P.shape,e_=an({experimental:ev.experimental,sampling:ev.sampling,elicitation:ev.elicitation,roots:ev.roots,extensions:ev.extensions}),eb=R.shape,eS=an({experimental:eb.experimental,logging:eb.logging,completions:eb.completions,prompts:eb.prompts,resources:eb.resources,tools:eb.tools,extensions:eb.extensions}),ew=as({progressToken:o.optional(),[aV]:iO(),[aH]:_.optional(),[aK]:e_,[aZ]:s.optional()}),e$=an({...v.shape,...g.shape,description:iO().optional(),inputSchema:as({$schema:iO().optional(),type:a_("object")}),outputSchema:as({$schema:iO().optional()}).optional(),annotations:X.optional(),_meta:af(iO(),at()).optional()}),eP=an({type:a_("tool_result"),toolUseId:iO(),content:ai(B),structuredContent:at().optional(),isError:i3().optional(),_meta:af(iO(),at()).optional()}),eR=ac([H,F,K,J,eP]),eE=an({role:n,content:ac([eR,ai(eR)]),_meta:af(iO(),at()).optional()}),ek=iO(),ex=as({[aF]:_.optional().catch(void 0)}),eT=ex.optional();function eO(t){return as({_meta:eT,resultType:ek.default("complete"),...t})}let eC=eO({}),ej=eO({nextCursor:i.optional()}),eI=eO({content:ai(B),structuredContent:at().optional(),isError:i3().optional()}),eN=eO({ttlMs:i2().int().min(0),cacheScope:ag(["public","private"]),tools:ai(e$),nextCursor:i.optional()}),eA=eO({ttlMs:i2().int().min(0),cacheScope:ag(["public","private"]),prompts:ai(U),nextCursor:i.optional()}),ez=eO({description:iO().optional(),messages:ai(G)}),eq=eO({ttlMs:i2().int().min(0),cacheScope:ag(["public","private"]),resources:ai(A),nextCursor:i.optional()}),eM=eO({ttlMs:i2().int().min(0),cacheScope:ag(["public","private"]),resourceTemplates:ai(z),nextCursor:i.optional()}),eL=eO({ttlMs:i2().int().min(0),cacheScope:ag(["public","private"]),contents:ai(ac([j,I]))}),eD=eO({completion:an({values:ai(iO()).max(100),total:i2().int().optional(),hasMore:i3().optional()}).loose()}),eU=eO({ttlMs:i2().int().min(0),cacheScope:ag(["public","private"])}),eV=eO({ttlMs:i2().int().min(0).catch(0),cacheScope:ag(["public","private"]).catch("private"),supportedVersions:ai(iO()),capabilities:eS,instructions:iO().optional()}),eH=an({messages:ai(eE),modelPreferences:ee.optional(),systemPrompt:iO().optional(),includeContext:ag(["none","thisServer","allServers"]).optional(),temperature:i2().optional(),maxTokens:i2().int(),stopSequences:ai(iO()).optional(),metadata:r.optional(),tools:ai(e$).optional(),toolChoice:et.optional()}),eF=an({method:a_("sampling/createMessage"),params:eH}),eK=an({method:a_("roots/list"),params:an({_meta:af(iO(),at()).optional()}).optional()}),eJ=an({...eE.shape,model:iO(),stopReason:iO().optional()}),eZ=an({roots:ai(eg)}),eW=an({action:ag(["accept","decline","cancel"]),content:af(iO(),ac([iO(),i2(),i3(),ai(iO())])).optional()}),eB=an({mode:a_("url"),message:iO(),url:iO().url()}),eG=ac([em,eB]),eX=an({method:a_("elicitation/create"),params:eG}),eY=ac([eF,eK,eX]),eQ=ac([eJ,eZ,eW]),e0=af(iO(),eY),e1=af(iO(),eQ),e2=eO({inputRequests:e0.optional(),requestState:iO().optional()}),e9={inputResponses:e1.optional(),requestState:iO().optional()},e4=an({_meta:ew,...e9}),e5=as({progressToken:o.optional()});function e3(t,r){return an({method:a_(t),params:an({_meta:ew,...r})})}function e6(t,r){return an({method:a_(t),params:an({_meta:e5.optional(),...r}).optional()})}let e8={name:iO(),arguments:af(iO(),at()).optional(),...e9},e7={cursor:i.optional()},te=e3("tools/call",e8),tt=e3("tools/list",e7),tr=e3("prompts/list",e7),to=e3("prompts/get",{name:iO(),arguments:af(iO(),iO()).optional(),...e9}),ti=e3("resources/list",e7),ta=e3("resources/templates/list",e7),tn=e3("resources/read",{uri:iO(),...e9}),ts={ref:ac([ey,ef]),argument:an({name:iO(),value:iO()}),context:an({arguments:af(iO(),iO()).optional()}).optional()},tl=e3("completion/complete",ts),tc=e3("server/discover",{}),tu=an({toolsListChanged:i3().optional(),promptsListChanged:i3().optional(),resourcesListChanged:i3().optional(),resourceSubscriptions:ai(iO()).optional()}),td={notifications:tu},tp=e3("subscriptions/listen",td),th=ex.extend({"io.modelcontextprotocol/subscriptionId":a}),tm=as({_meta:th,resultType:ek.default("complete")}),tf={"tools/call":e6("tools/call",e8),"tools/list":e6("tools/list",e7),"prompts/get":e6("prompts/get",{name:iO(),arguments:af(iO(),iO()).optional()}),"prompts/list":e6("prompts/list",e7),"resources/list":e6("resources/list",e7),"resources/templates/list":e6("resources/templates/list",e7),"resources/read":e6("resources/read",{uri:iO()}),"completion/complete":e6("completion/complete",ts),"server/discover":e6("server/discover",{}),"subscriptions/listen":e6("subscriptions/listen",td)};function ty(t){return as({_meta:eT,...t})}let tg={"tools/call":ty({content:ai(B),structuredContent:at().optional(),isError:i3().optional()}),"tools/list":ty({ttlMs:i2().int().min(0),cacheScope:ag(["public","private"]),tools:ai(e$),nextCursor:i.optional()}),"prompts/get":ty({description:iO().optional(),messages:ai(G)}),"prompts/list":ty({ttlMs:i2().int().min(0),cacheScope:ag(["public","private"]),prompts:ai(U),nextCursor:i.optional()}),"resources/list":ty({ttlMs:i2().int().min(0),cacheScope:ag(["public","private"]),resources:ai(A),nextCursor:i.optional()}),"resources/templates/list":ty({ttlMs:i2().int().min(0),cacheScope:ag(["public","private"]),resourceTemplates:ai(z),nextCursor:i.optional()}),"resources/read":ty({ttlMs:i2().int().min(0),cacheScope:ag(["public","private"]),contents:ai(ac([j,I]))}),"completion/complete":ty({completion:an({values:ai(iO()).max(100),total:i2().int().optional(),hasMore:i3().optional()}).loose()}),"server/discover":ty({ttlMs:i2().int().min(0).catch(0),cacheScope:ag(["public","private"]).catch("private"),supportedVersions:ai(iO()),capabilities:eS,instructions:iO().optional()}),"subscriptions/listen":ty({})},tv=as({"io.modelcontextprotocol/subscriptionId":a.optional()}),t_=an({method:a_("notifications/subscriptions/acknowledged"),params:an({_meta:tv.optional(),notifications:tu})}),tb=an({_meta:tv.optional(),requestId:a,reason:iO().optional()}),tS=an({method:a_("notifications/cancelled"),params:tb}),tw=t=>an({jsonrpc:a_("2.0"),id:ac([iO(),i2().int()]),result:t}).strict();return{JSONValueSchema:t,JSONObjectSchema:r,ProgressTokenSchema:o,CursorSchema:i,RequestIdSchema:a,RoleSchema:n,LoggingLevelSchema:s,TaskMetadataSchema:c,RelatedTaskMetadataSchema:u,RequestMetaSchema:d,BaseRequestParamsSchema:p,TaskAugmentedRequestParamsSchema:h,NotificationsParamsSchema:m,NotificationSchema:f,IconSchema:y,IconsSchema:g,BaseMetadataSchema:v,ImplementationSchema:_,ClientTasksCapabilitySchema:w,ServerTasksCapabilitySchema:$,ClientCapabilitiesSchema:P,ServerCapabilitiesSchema:R,ProgressSchema:E,ProgressNotificationParamsSchema:k,ProgressNotificationSchema:x,LoggingMessageNotificationParamsSchema:T,LoggingMessageNotificationSchema:O,ResourceContentsSchema:C,TextResourceContentsSchema:j,BlobResourceContentsSchema:I,AnnotationsSchema:N,ResourceSchema:A,ResourceTemplateSchema:z,ResourceListChangedNotificationSchema:q,ResourceUpdatedNotificationParamsSchema:M,ResourceUpdatedNotificationSchema:L,PromptArgumentSchema:D,PromptSchema:U,PromptListChangedNotificationSchema:V,TextContentSchema:H,ImageContentSchema:F,AudioContentSchema:K,ToolUseContentSchema:J,EmbeddedResourceSchema:Z,ResourceLinkSchema:W,ContentBlockSchema:B,PromptMessageSchema:G,ToolAnnotationsSchema:X,ToolListChangedNotificationSchema:Y,ModelHintSchema:Q,ModelPreferencesSchema:ee,ToolChoiceSchema:et,BooleanSchemaSchema:er,StringSchemaSchema:eo,NumberSchemaSchema:ei,UntitledSingleSelectEnumSchemaSchema:ea,TitledSingleSelectEnumSchemaSchema:en,LegacyTitledEnumSchemaSchema:es,SingleSelectEnumSchemaSchema:el,UntitledMultiSelectEnumSchemaSchema:ec,TitledMultiSelectEnumSchemaSchema:eu,MultiSelectEnumSchemaSchema:ed,EnumSchemaSchema:ep,PrimitiveSchemaDefinitionSchema:eh,ElicitRequestFormParamsSchema:em,ResourceTemplateReferenceSchema:ef,PromptReferenceSchema:ey,RootSchema:eg,ClientCapabilities2026Schema:e_,ServerCapabilities2026Schema:eS,RequestMetaEnvelopeSchema:ew,ToolSchema:e$,ToolResultContentSchema:eP,SamplingMessageContentBlockSchema:eR,SamplingMessageSchema:eE,ResultTypeSchema:ek,ResultMetaSchema:ex,ResultSchema:eC,PaginatedResultSchema:ej,CallToolResultSchema:eI,ListToolsResultSchema:eN,ListPromptsResultSchema:eA,GetPromptResultSchema:ez,ListResourcesResultSchema:eq,ListResourceTemplatesResultSchema:eM,ReadResourceResultSchema:eL,CompleteResultSchema:eD,CacheableResultSchema:eU,DiscoverResultSchema:eV,CreateMessageRequestParamsSchema:eH,CreateMessageRequestSchema:eF,ListRootsRequestSchema:eK,CreateMessageResultSchema:eJ,ListRootsResultSchema:eZ,ElicitResultSchema:eW,ElicitRequestURLParamsSchema:eB,ElicitRequestParamsSchema:eG,ElicitRequestSchema:eX,InputRequestSchema:eY,InputResponseSchema:eQ,InputRequestsSchema:e0,InputResponsesSchema:e1,InputRequiredResultSchema:e2,InputResponseRequestParamsSchema:e4,CallToolRequestSchema:te,ListToolsRequestSchema:tt,ListPromptsRequestSchema:tr,GetPromptRequestSchema:to,ListResourcesRequestSchema:ti,ListResourceTemplatesRequestSchema:ta,ReadResourceRequestSchema:tn,CompleteRequestSchema:tl,DiscoverRequestSchema:tc,SubscriptionFilterSchema:tu,SubscriptionsListenRequestSchema:tp,SubscriptionsListenResultMetaSchema:th,SubscriptionsListenResultSchema:tm,dispatchRequestSchemas:tf,dispatchResultSchemas:tg,NotificationMetaSchema:tv,SubscriptionsAcknowledgedNotificationSchema:t_,CancelledNotificationParamsSchema:tb,CancelledNotificationSchema:tS,notificationSchemas2026:{"notifications/cancelled":tS,"notifications/progress":x,"notifications/message":O,"notifications/resources/updated":L,"notifications/resources/list_changed":q,"notifications/tools/list_changed":Y,"notifications/prompts/list_changed":V,"notifications/subscriptions/acknowledged":t_},JSONRPCResultResponseSchema:tw(eC),CallToolResultResponseSchema:tw(ac([eI,e2])),ListToolsResultResponseSchema:tw(eN),ListPromptsResultResponseSchema:tw(eA),GetPromptResultResponseSchema:tw(ac([ez,e2])),ListResourcesResultResponseSchema:tw(eq),ListResourceTemplatesResultResponseSchema:tw(eM),ReadResourceResultResponseSchema:tw(ac([eL,e2])),CompleteResultResponseSchema:tw(eD),DiscoverResultResponseSchema:tw(eV)}}()}let ci=["tools/list","prompts/list","resources/list","resources/templates/list","resources/read","server/discover"],ca=Symbol("modelcontextprotocol.resultCacheHintFallback");function cn(t){return"number"==typeof t&&Number.isSafeInteger(t)&&t>=0}function cs(t){return"public"===t||"private"===t}let cl=((E={})[E.ParseError=-32700]="ParseError",E[E.InvalidRequest=-32600]="InvalidRequest",E[E.MethodNotFound=-32601]="MethodNotFound",E[E.InvalidParams=-32602]="InvalidParams",E[E.InternalError=-32603]="InternalError",E[E.ResourceNotFound=-32002]="ResourceNotFound",E[E.MissingRequiredClientCapability=-32021]="MissingRequiredClientCapability",E[E.UnsupportedProtocolVersion=-32022]="UnsupportedProtocolVersion",E[E.UrlElicitationRequired=-32042]="UrlElicitationRequired",E);var cc=class t extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ProtocolError"})}static[Symbol.hasInstance](t){return lM(this,t)}static isInstance(t){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 lM(this,t)}constructor(t,r,o){super(r),this.code=t,this.data=o,this.name="ProtocolError",lq(this,new.target)}static fromError(r,o,i){return r===cl.UrlElicitationRequired&&i&&i.elicitations?new cd(i.elicitations,o):r===cl.UnsupportedProtocolVersion&&i&&Array.isArray(i.supported)&&"string"==typeof i.requested?new cp({supported:i.supported,requested:i.requested},o):(r===cl.InvalidParams||r===cl.ResourceNotFound)&&"string"==typeof i?.uri&&(r===cl.ResourceNotFound||1===Object.keys(i).length)?new cu(i.uri,o):r===cl.MissingRequiredClientCapability&&i&&null!==i.requiredCapabilities&&"object"==typeof i.requiredCapabilities&&!Array.isArray(i.requiredCapabilities)?new ch({requiredCapabilities:i.requiredCapabilities},o):new t(r,o,i)}},cu=class extends cc{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ResourceNotFoundError"})}constructor(t,r=`Resource not found: ${t}`){super(cl.InvalidParams,r,{uri:t})}get uri(){return this.data.uri}},cd=class extends cc{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UrlElicitationRequiredError"})}constructor(t,r=`URL elicitation${t.length>1?"s":""} required`){super(cl.UrlElicitationRequired,r,{elicitations:t})}get elicitations(){return this.data?.elicitations??[]}},cp=class extends cc{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UnsupportedProtocolVersionError"})}constructor(t,r=`Unsupported protocol version: ${t.requested}`){super(cl.UnsupportedProtocolVersion,r,t)}get supported(){return this.data.supported}get requested(){return this.data.requested}},ch=class extends cc{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.MissingRequiredClientCapabilityError"})}constructor(t,r=`Missing required client capabilities: ${Object.keys(t.requiredCapabilities).join(", ")}`){super(cl.MissingRequiredClientCapability,r,t)}get requiredCapabilities(){return this.data.requiredCapabilities}};let cm=["tools/call","prompts/get","resources/read"],cf=["elicitation/create","sampling/createMessage","roots/list"];function cy(){if(l)return l;let t=co();return l={request:{"elicitation/create":an({method:a_("elicitation/create"),params:t.ElicitRequestParamsSchema}),"sampling/createMessage":an({method:a_("sampling/createMessage"),params:t.CreateMessageRequestParamsSchema}),"roots/list":an({method:a_("roots/list"),params:as({}).optional()})},response:{"elicitation/create":t.ElicitResultSchema,"sampling/createMessage":t.CreateMessageResultSchema,"roots/list":t.ListRootsResultSchema}}}function cg(t){return cf.includes(t)}function cv(t){return cg(t)?cy().request[t]:void 0}let c_={"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},cb={"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 cS(t){return Object.prototype.hasOwnProperty.call(c_,t)}function cw(t){return Object.prototype.hasOwnProperty.call(cb,t)}function c$(t){return null!==t&&"object"==typeof t&&!Array.isArray(t)}function cP(t,r){if(void 0===t)return{ok:!1,reason:"not-in-era"};let o=t.safeParse(r);return o.success?{ok:!0,value:o.data}:{ok:!1,reason:"invalid",message:String(o.error)}}Object.keys(c_),Object.keys(cb);let cR={ok:!1,reason:"not-in-era"},cE=[aV,aK],ck={era:"2026-07-28",hasRequestMethod:cS,hasNotificationMethod:cw,hasInputRequestMethod:t=>void 0!==cv(t),validateRequest:(t,r)=>{var o;return cP(cS(o=t)?co().dispatchRequestSchemas[o]:void 0,r)},validateResult:(t,r)=>{var o,i;return cP((i=o=t,Object.prototype.hasOwnProperty.call(c_,i))?co().dispatchResultSchemas[o]:void 0,r)},validateNotification:(t,r)=>{var o;return cP(cw(o=t)?co().notificationSchemas2026[o]:void 0,r)},validateInputRequest:(t,r)=>cP(cv(t),r),validateInputResponse:(t,r)=>{var o;return cP(cg(o=t)?cy().response[o]:void 0,r)},samplingResultVariant:()=>cR,outboundEnvelope:t=>({[aV]:t.protocolVersion,[aH]:t.clientInfo,[aK]:t.clientCapabilities,...void 0!==t.logLevel&&{[aZ]:t.logLevel}}),validateEnvelopeMeta(t){let r=[];for(let o of cE)o in t||r.push({key:o,problem:"missing"});let o=co().RequestMetaEnvelopeSchema.safeParse(t);if(!o.success)for(let t of o.error.issues){let o=t.path.map(String),i=o.length>0?o.join("."):"_meta";1===o.length&&r.some(t=>t.key===i&&"missing"===t.problem)||r.push({key:i,problem:t.message})}return r},projectCallToolResult:t=>lW(t),inputRequestSchema:cv,decodeResult(t,r){if(!c$(r))return{kind:"invalid",error:new lV(lU.InvalidResult,`Invalid result for ${t}: not an object`,{method:t})};let o=r.resultType;if(void 0===o)return{kind:"invalid",error:new lV(lU.InvalidResult,`Invalid result for ${t}: 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:t,violation:"missing-resultType"})};if("string"!=typeof o)return{kind:"invalid",error:new lV(lU.InvalidResult,`Invalid result for ${t}: non-string resultType`,{method:t,resultType:o})};if("input_required"===o){let o=r.inputRequests,i=c$(o)?o:{},a=r.requestState;return 0===Object.keys(i).length&&"string"!=typeof a?{kind:"invalid",error:new lV(lU.InvalidResult,`Invalid result for ${t}: input_required carries neither inputRequests nor requestState (every input_required result must include at least one of the two)`,{method:t,violation:"input-required-missing-both"})}:{kind:"input_required",inputRequests:i,..."string"==typeof a&&{requestState:a}}}if("complete"!==o)return{kind:"invalid",error:new lV(lU.UnsupportedResultType,`Unsupported result type '${o}' for ${t}`,{resultType:o,method:t})};let i=function(){if(c)return c;let t=co();return c={"tools/call":t.CallToolResultSchema,"tools/list":t.ListToolsResultSchema,"prompts/get":t.GetPromptResultSchema,"prompts/list":t.ListPromptsResultSchema,"resources/list":t.ListResourcesResultSchema,"resources/templates/list":t.ListResourceTemplatesResultSchema,"resources/read":t.ReadResourceResultSchema,"completion/complete":t.CompleteResultSchema,"server/discover":t.DiscoverResultSchema}}(),a=Object.hasOwn(i,t)?i[t]:void 0;if(void 0!==a){let o=a.safeParse(r);if(!o.success)return{kind:"invalid",error:new lV(lU.InvalidResult,`Invalid result for ${t}: ${o.error}`,{method:t})}}let n={...r};return delete n.resultType,{kind:"complete",result:n}},encodeResult:(t,r,o)=>(function(t,r){var o;if(void 0===r)return t;let i=t._meta;return void 0===i?{...t,_meta:{[aF]:r}}:null===(o=i)||"object"!=typeof o||Array.isArray(o)||void 0!==i[aF]?t:{...t,_meta:{...i,[aF]:r}}})(function(t,r){var o,i,a,n;let s=r[ca];if("complete"!==r.resultType||(o=t,!ci.includes(o))){let t;return void 0===s?r:(t={...i=r},delete t[ca],t)}let l=cn(r.ttlMs)?r.ttlMs:void 0!==(a=s)&&cn(a.ttlMs)?a.ttlMs:0,c=cs(r.cacheScope)?r.cacheScope:void 0!==(n=s)&&cs(n.cacheScope)?n.cacheScope:"private",u={...r,ttlMs:l,cacheScope:c};return delete u[ca],u}(t,function(t,r){let o=r.resultType;if(void 0===o)return{...r,resultType:"complete"};if("complete"===o||cm.includes(t))return r;throw new cc(cl.InternalError,`Handler for ${t} returned resultType '${String(o)}', but results of ${t} only support 'complete' on protocol revision 2026-07-28`)}(t,function(t,r){let o=r,i=!1,a=()=>(i||(o={...o},i=!0),o),n=r.tools;"tools/list"===t&&Array.isArray(n)&&n.some(t=>c$(t)&&"execution"in t)&&(a().tools=n.map(t=>{if(!c$(t)||!("execution"in t))return t;let r={...t};return delete r.execution,r}));let s=r.capabilities;if(c$(s)&&"tasks"in s){let t={...s};delete t.tasks,a().capabilities=t}return o}(t,r))),o),encodeErrorCode:t=>-32002===t?-32602:t,checkInboundEnvelope(t){if(void 0===t.envelope)return"Request is missing the required _meta envelope for protocol revision 2026-07-28 (io.modelcontextprotocol/protocolVersion, io.modelcontextprotocol/clientCapabilities)";let r=co().RequestMetaEnvelopeSchema.safeParse(t.envelope);if(!r.success)return`Invalid _meta envelope for protocol revision 2026-07-28: ${r.error.issues.map(t=>t.message).join("; ")}`}},cx="2026-07-28";function cT(t){return void 0!==t&&t>=lF?ck:cr}function cO(t){return void 0!==t.revision?cT(t.revision).era:"modern"===t.era?ck.era:cr.era}function cC(t){return cI.some(r=>r.hasRequestMethod(t))}function cj(t){return cI.some(r=>r.hasNotificationMethod(t))}let cI=[cr,ck];var cN=((t,r)=>{let o={};for(var i in t)j(o,i,{get:t[i],enumerable:!0});return r&&j(o,Symbol.toStringTag,{value:"Module"}),o})({AnnotationsSchema:()=>nq,AudioContentSchema:()=>so,BaseMetadataSchema:()=>nd,BaseRequestParamsSchema:()=>a2,BlobResourceContentsSchema:()=>nA,BooleanSchemaSchema:()=>sM,CallToolRequestParamsSchema:()=>sv,CallToolRequestSchema:()=>s_,CallToolResultSchema:()=>sy,CancelTaskRequestSchema:()=>lm,CancelTaskResultSchema:()=>lf,CancelledNotificationParamsSchema:()=>ns,CancelledNotificationSchema:()=>nl,ClientCapabilitiesSchema:()=>ng,ClientNotificationSchema:()=>lg,ClientRequestSchema:()=>ly,ClientResultSchema:()=>lv,ClientTasksCapabilitySchema:()=>nf,CompatibilityCallToolResultSchema:()=>sg,CompleteRequestParamsSchema:()=>s5,CompleteRequestSchema:()=>s3,CompleteResultSchema:()=>s6,ContentBlockSchema:()=>ss,CreateMessageRequestParamsSchema:()=>sN,CreateMessageRequestSchema:()=>sA,CreateMessageResultSchema:()=>sz,CreateMessageResultWithToolsSchema:()=>sq,CreateTaskResultSchema:()=>la,CursorSchema:()=>aY,DiscoverRequestSchema:()=>n$,DiscoverResultSchema:()=>nP,ElicitRequestFormParamsSchema:()=>sG,ElicitRequestParamsSchema:()=>sY,ElicitRequestSchema:()=>sQ,ElicitRequestURLParamsSchema:()=>sX,ElicitResultSchema:()=>s2,ElicitationCompleteNotificationParamsSchema:()=>s0,ElicitationCompleteNotificationSchema:()=>s1,EmbeddedResourceSchema:()=>sa,EmptyResultSchema:()=>nn,EnumSchemaSchema:()=>sW,GetPromptRequestParamsSchema:()=>n7,GetPromptRequestSchema:()=>se,GetPromptResultSchema:()=>sc,GetTaskPayloadRequestSchema:()=>lu,GetTaskPayloadResultSchema:()=>ld,GetTaskRequestSchema:()=>ll,GetTaskResultSchema:()=>lc,IconSchema:()=>nc,IconsSchema:()=>nu,ImageContentSchema:()=>sr,ImplementationSchema:()=>np,InitializeRequestParamsSchema:()=>nv,InitializeRequestSchema:()=>n_,InitializeResultSchema:()=>nS,InitializedNotificationSchema:()=>nw,JSONArraySchema:()=>aG,JSONObjectSchema:()=>aB,JSONRPCErrorResponseSchema:()=>no,JSONRPCMessageSchema:()=>ni,JSONRPCNotificationSchema:()=>nt,JSONRPCRequestSchema:()=>ne,JSONRPCResponseSchema:()=>na,JSONRPCResultResponseSchema:()=>nr,JSONValueSchema:()=>aW,LegacyTitledEnumSchemaSchema:()=>sH,ListChangedOptionsBaseSchema:()=>sS,ListPromptsRequestSchema:()=>n6,ListPromptsResultSchema:()=>n8,ListResourceTemplatesRequestSchema:()=>nV,ListResourceTemplatesResultSchema:()=>nH,ListResourcesRequestSchema:()=>nD,ListResourcesResultSchema:()=>nU,ListRootsRequestSchema:()=>s7,ListRootsResultSchema:()=>le,ListTasksRequestSchema:()=>lp,ListTasksResultSchema:()=>lh,ListToolsRequestSchema:()=>sm,ListToolsResultSchema:()=>sf,LoggingLevelSchema:()=>sw,LoggingMessageNotificationParamsSchema:()=>sR,LoggingMessageNotificationSchema:()=>sE,ModelHintSchema:()=>sk,ModelPreferencesSchema:()=>sx,MultiSelectEnumSchemaSchema:()=>sZ,NotificationSchema:()=>a3,NotificationsParamsSchema:()=>a5,NumberSchemaSchema:()=>sD,PaginatedRequestParamsSchema:()=>nT,PaginatedRequestSchema:()=>nO,PaginatedResultSchema:()=>nC,PingRequestSchema:()=>nR,PrimitiveSchemaDefinitionSchema:()=>sB,ProgressNotificationParamsSchema:()=>nk,ProgressNotificationSchema:()=>nx,ProgressSchema:()=>nE,ProgressTokenSchema:()=>aX,PromptArgumentSchema:()=>n5,PromptListChangedNotificationSchema:()=>su,PromptMessageSchema:()=>sl,PromptReferenceSchema:()=>s4,PromptSchema:()=>n3,ReadResourceRequestParamsSchema:()=>nF,ReadResourceRequestSchema:()=>nK,ReadResourceResultSchema:()=>nJ,RelatedTaskMetadataSchema:()=>a0,RequestIdSchema:()=>a7,RequestMetaSchema:()=>a1,RequestSchema:()=>a4,ResourceContentsSchema:()=>nj,ResourceLinkSchema:()=>sn,ResourceListChangedNotificationSchema:()=>nZ,ResourceRequestParamsSchema:()=>nF,ResourceSchema:()=>nM,ResourceTemplateReferenceSchema:()=>s9,ResourceTemplateSchema:()=>nL,ResourceUpdatedNotificationParamsSchema:()=>n9,ResourceUpdatedNotificationSchema:()=>n4,ResultMetaObjectSchema:()=>a6,ResultSchema:()=>a8,RoleSchema:()=>nz,RootSchema:()=>s8,RootsListChangedNotificationSchema:()=>lt,SamplingContentSchema:()=>sC,SamplingMessageContentBlockSchema:()=>sj,SamplingMessageSchema:()=>sI,ServerCapabilitiesSchema:()=>nb,ServerNotificationSchema:()=>lb,ServerRequestSchema:()=>l_,ServerResultSchema:()=>lS,ServerTasksCapabilitySchema:()=>ny,SetLevelRequestParamsSchema:()=>s$,SetLevelRequestSchema:()=>sP,SingleSelectEnumSchemaSchema:()=>sF,StringSchemaSchema:()=>sL,SubscribeRequestParamsSchema:()=>nF,SubscribeRequestSchema:()=>nW,SubscriptionFilterSchema:()=>nG,SubscriptionsAcknowledgedNotificationParamsSchema:()=>nQ,SubscriptionsAcknowledgedNotificationSchema:()=>n0,SubscriptionsListenRequestParamsSchema:()=>nX,SubscriptionsListenRequestSchema:()=>nY,SubscriptionsListenResultMetaSchema:()=>n1,SubscriptionsListenResultSchema:()=>n2,TaskAugmentedRequestParamsSchema:()=>a9,TaskCreationParamsSchema:()=>lr,TaskMetadataSchema:()=>aQ,TaskSchema:()=>li,TaskStatusNotificationParamsSchema:()=>ln,TaskStatusNotificationSchema:()=>ls,TaskStatusSchema:()=>lo,TextContentSchema:()=>st,TextResourceContentsSchema:()=>nI,TitledMultiSelectEnumSchemaSchema:()=>sJ,TitledSingleSelectEnumSchemaSchema:()=>sV,ToolAnnotationsSchema:()=>sd,ToolChoiceSchema:()=>sT,ToolExecutionSchema:()=>sp,ToolListChangedNotificationSchema:()=>sb,ToolResultContentSchema:()=>sO,ToolSchema:()=>sh,ToolUseContentSchema:()=>si,UnsubscribeRequestParamsSchema:()=>nF,UnsubscribeRequestSchema:()=>nB,UntitledMultiSelectEnumSchemaSchema:()=>sK,UntitledSingleSelectEnumSchemaSchema:()=>sU});let cA=t=>nr.safeParse(t).success,cz=t=>no.safeParse(t).success,cq=t=>"object"==typeof t&&null!==t&&!Array.isArray(t)&&"input_required"===t.resultType,cM="x-mcp-header",cL=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,cD=new Set(["string","integer","boolean","number"]);function cU(t){let r=[],o=new Map,i=(t,a,n)=>{if(null===t||"object"!=typeof t)return;if(cM in t){if(!n||0===a.length)return`${cF(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 i=t[cM];if("string"!=typeof i||0===i.length)return`${cF(a)}: x-mcp-header MUST be a non-empty string`;if(!cL.test(i))return`${cF(a)}: x-mcp-header '${i}' is not a valid RFC 9110 token (no spaces, control characters or HTTP delimiters)`;let s="string"==typeof t.type?t.type:void 0;if(void 0===s||!cD.has(s))return`${cF(a)}: x-mcp-header is only permitted on primitive-typed properties (string, integer, boolean); got ${s??"<none>"}`;let l=i.toLowerCase(),c=o.get(l);if(void 0!==c)return`x-mcp-header '${i}' is not case-insensitively unique (also declared as '${c}')`;o.set(l,i),r.push({path:a,headerName:i,type:s})}let s=t.properties;if(null!==s&&"object"==typeof s)for(let[t,r]of Object.entries(s)){let o=i(r,[...a,t],n);if(void 0!==o)return o}for(let r of cV){let o=t[r];if(void 0!==o)for(let t of Array.isArray(o)?o:null!==o&&"object"==typeof o&&cH.has(r)?Object.values(o):[o]){let o=i(t,[...a,`<${r}>`],!1);if(void 0!==o)return o}}},a=i(t,[],!0);return void 0===a?{valid:!0,declarations:r}:{valid:!1,reason:a}}let cV=["items","prefixItems","contains","additionalProperties","unevaluatedProperties","unevaluatedItems","propertyNames","patternProperties","dependentSchemas","oneOf","anyOf","allOf","not","if","then","else","$defs","definitions"],cH=new Set(["patternProperties","dependentSchemas","$defs","definitions"]);function cF(t){return 0===t.length?"<root>":t.join(".")}let cK="=?base64?";function cJ(t){return!function(t){if(0===t.length||t.startsWith(cK)&&t.endsWith("?=")||t!==t.trim())return!0;for(let r=0;r<t.length;r++){let o=t.codePointAt(r);if(9!==o&&(!(o>=32)||!(o<=126)))return!0}return!1}(t)?t:`${cK}${function(t){let r=new TextEncoder().encode(t),o="";for(let t of r)o+=String.fromCodePoint(t);return btoa(o)}(t)}?=`}function cZ(t){return new Set(t.flatMap(t=>Object.keys(t.shape)))}function cW(t){if(null==t)return!1;let r=typeof t;return("object"===r||"function"===r)&&"~standard"in t&&"function"==typeof t["~standard"]?.validate}cl.InvalidRequest,cl.UnsupportedProtocolVersion,cl.InvalidParams,cl.MethodNotFound,cl.InvalidParams,cl.MissingRequiredClientCapability,cl.ParseError,cl.InvalidRequest,cl.MethodNotFound,cl.UnsupportedProtocolVersion,cl.MissingRequiredClientCapability;let cB=!1,cG="draft-2020-12";async function cX(t,r){let o=await t["~standard"].validate(r);return o.issues&&o.issues.length>0?{success:!1,error:o.issues.map(t=>{var r;return r=t,r.path?.length?`${r.path.map(t=>String("object"==typeof t?t.key:t)).join(".")}: ${r.message}`:r.message}).join(", ")}:{success:!0,data:o.value}}let cY=/\\\.\\d\{(\d+)\}/;function cQ(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}let c0=new Set(["$comment","deprecated","description","examples","readOnly","title","writeOnly"]);function c1(t){return c0.has(t)||t.startsWith("x-")}let c2=new Set(["$schema",...Object.keys(sG.shape.requestedSchema.shape)]),c9={string:cZ([sL,sU,sV,sH]),number:cZ([sD]),integer:cZ([sD]),boolean:cZ([sM]),array:cZ([sK,sJ])},c4=new Set(sL.shape.format.unwrap().options);async function c5(t){let{config:r,method:o,originalParams:i,requestOptions:a,hooks:n,signal:s}=t,l=t.flowStartedAt??Date.now(),c=t.firstPayload,u=0;for(;;){let t;if((u+=1)>r.maxRounds){var d,p;throw new lV(lU.InputRequiredRoundsExceeded,(d=o,p=r.maxRounds,`Multi-round-trip request '${d}' still required input after ${p} rounds (inputRequired.maxRounds)`),{rounds:r.maxRounds,lastResult:{inputRequests:c.inputRequests,...void 0!==c.requestState&&{requestState:c.requestState}}})}a.onprogress?.({progress:u,message:`Fulfilling input required by '${o}' (round ${u})`});let h=Object.entries(c.inputRequests??{});if(h.length>0){let r=function(t){let r=new AbortController,o=()=>r.abort(t?.reason);return t?.addEventListener("abort",o,{once:!0}),t?.aborted&&r.abort(t.reason),{signal:r.signal,abort:t=>r.abort(t),dispose:()=>t?.removeEventListener("abort",o)}}(s);try{let o=await Promise.all(h.map(async([t,o])=>{try{return[t,await n.dispatchInputRequest(t,o,r.signal)]}catch(t){throw r.abort(t),t}}));t=Object.fromEntries(o)}finally{r.dispose()}}else await function(t,r){return new Promise((t,o)=>{if(r?.aborted)return void o(r.reason instanceof lV?r.reason:new lV(lU.RequestTimeout,String(r.reason)));let i=setTimeout(()=>{r?.removeEventListener("abort",a),t()},250),a=()=>{clearTimeout(i),o(r?.reason instanceof lV?r.reason:new lV(lU.RequestTimeout,String(r?.reason)))};r?.addEventListener("abort",a,{once:!0})})}(0,s);let m={...void 0!==a.timeout&&{timeout:a.timeout}};if(void 0!==a.maxTotalTimeout){let t=Date.now()-l,r=a.maxTotalTimeout-t;if(r<=0)throw new lV(lU.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:a.maxTotalTimeout,totalElapsed:t});m.maxTotalTimeout=r}let f=await n.retry(function(t,r,o){let i=void 0!==r&&Object.keys(r).length>0;return i||void 0!==o?{...t,...i&&{inputResponses:r},...void 0!==o&&{requestState:o}}:t}(i,t,c.requestState),m);if(cq(f)){c={inputRequests:f.inputRequests??{},...void 0!==f.requestState&&{requestState:f.requestState}};continue}return f}}Object.assign(function(t){let r=void 0!==t.inputRequests&&Object.keys(t.inputRequests).length>0,o="string"==typeof t.requestState;if(!r&&!o)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!==t.inputRequests&&{inputRequests:t.inputRequests},...void 0!==t.requestState&&{requestState:t.requestState}}},{elicit(t){try{return{method:"elicitation/create",params:function(t){var r;if(!cW(t.requestedSchema))return{...t,mode:"form",requestedSchema:t.requestedSchema};let o=t.requestedSchema["~standard"].vendor,i=function(t,r){let o={},i=[];for(let[a,n]of Object.entries(t))"properties"===a&&cQ(n)?o[a]=Object.fromEntries(Object.entries(n).map(([t,o])=>[t,function(t,r,o,i){if(!cQ(t))return t;let a="string"==typeof t.type&&Object.hasOwn(c9,t.type)?c9[t.type]:void 0;if(void 0===a)return t;let n={};for(let[c,u]of Object.entries(t))if(a.has(c)||c1(c))n[c]=u;else if("pattern"===c&&"string"===t.type&&"string"==typeof t.format)if(c4.has(t.format)){var s,l;"string"==typeof u&&(s=t.format,l=u,"zod"!==o||(function(t,r){var o;let i,a,n;switch(t){case"email":i=[rX(iz,void 0)];break;case"uri":i=[rY(iL,void 0)];break;case"date":i=[r0(iI,void 0)];break;case"date-time":o=r,a=cY.exec(o),n=[void 0,-1,0],a&&n.push(Number(a[1])),i=[!1,!0].flatMap(t=>[!1,!0].flatMap(r=>n.map(o=>rQ(ij,{local:t,offset:r,precision:o}))))}return new Set(i.map(t=>{let r;return r=o9(t,{target:cG,io:"input"}),"string"==typeof r.pattern?r.pattern:void 0}).filter(t=>void 0!==t))})(s,l).has(l))||i.push(`${r}.${c}`)}else n[c]=u;else i.push(`${r}.${c}`);return n}(o,`properties.${t}`,r,i)])):c2.has(a)?o[a]=n:c1(a)||i.push(a);if(i.length>0)throw new cc(cl.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${i.join(", ")}`);return o}(function(t){try{return function(t,r="input"){let o,i=t["~standard"];if(i.jsonSchema)o=i.jsonSchema[r]({target:cG});else if("zod"===i.vendor){if(!("_zod"in t))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().");cB||(cB=!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.")),o=o9(t,{target:cG,io:r})}else throw Error(`Schema library "${i.vendor}" does not implement StandardJSONSchemaV1 (\`~standard.jsonSchema\`). Upgrade to a version that does, or wrap your JSON Schema with fromJsonSchema().`);if("output"===r)return void 0!==o.type||!function t(r){if("properties"in r||"patternProperties"in r||"additionalProperties"in r||"required"in r)return!0;for(let o of["oneOf","anyOf","allOf"]){let i=r[o];if(Array.isArray(i)&&i.length>0)return i.every(r=>null!==r&&"object"==typeof r&&("object"===r.type||t(r)))}return!1}(o)?o:{type:"object",...o};if(void 0!==o.type&&"object"!==o.type)throw Error(`MCP tool and prompt schemas must describe objects (got type: ${JSON.stringify(o.type)}). Wrap your schema in z.object({...}) or equivalent.`);return{type:"object",...o}}(t,"input")}catch(r){let t=r instanceof Error?r.message:String(r);throw new cc(cl.InvalidParams,`Elicitation requestedSchema must describe an object with flat primitive properties: ${t}`)}}(t.requestedSchema),o),a=(r=sG.shape.requestedSchema,im(r,i));if(!a.success)throw new cc(cl.InvalidParams,`Elicitation requestedSchema only supports flat primitive properties (string, number, integer, boolean, and string enums): ${function(t,r){if(!cQ(t.properties))return r;let o=Object.entries(t.properties).filter(([,t])=>!im(sB,t).success).map(([t])=>`properties.${t}`);return o.length>0?o.join(", "):r}(i,a.error.message)}`);let n=function t(r,o,i=""){return Array.isArray(r)&&Array.isArray(o)?r.flatMap((r,a)=>t(r,o[a],`${i}[${a}]`)):cQ(r)&&cQ(o)?Object.entries(r).flatMap(([r,a])=>{let n=i?`${i}.${r}`:r;return Object.prototype.hasOwnProperty.call(o,r)?t(a,o[r],n):c1(r)?[]:[n]}):[]}(i,a.data);if(n.length>0)throw new cc(cl.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${n.join(", ")}`);let s=(a.data.required??[]).filter(t=>!Object.prototype.hasOwnProperty.call(a.data.properties,t));if(s.length>0)throw new cc(cl.InvalidParams,`Elicitation requestedSchema lists required properties that are not defined in properties: ${s.join(", ")}`);return{...t,mode:"form",requestedSchema:a.data}}(t)}}catch(t){throw t instanceof cc?TypeError(t.message,{cause:t}):t}},elicitUrl:t=>({method:"elicitation/create",params:{...t,mode:"url"}}),createMessage:t=>({method:"sampling/createMessage",params:t}),listRoots:()=>({method:"roots/list"})});let c3={},c6={};function c8(t,r){let o=t.slice(0,-6);c3[o]=r,c6[o]=t=>r.safeParse(t).success}for(let t 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"])c8(t,cN[t]);for(let[t,r]of Object.entries({IdJagTokenExchangeResponseSchema:lx,OAuthClientInformationFullSchema:lI,OAuthClientInformationSchema:lj,OAuthClientMetadataSchema:lC,OAuthClientRegistrationErrorSchema:lN,OAuthErrorResponseSchema:lT,OAuthMetadataSchema:lP,OAuthProtectedResourceMetadataSchema:l$,OAuthTokenRevocationRequestSchema:lA,OAuthTokensSchema:lk,OpenIdProviderDiscoveryMetadataSchema:lE,OpenIdProviderMetadataSchema:lR}))c8(t,r);Object.freeze(c3);let c7=Object.freeze(c6),ue=[aV,aH,aK,aZ],ut=["inputResponses","requestState"];function ur(t,r){let o=t.params;if(!un(o))return{message:t,lifted:{}};let i=o._meta,a=un(i)?ue.filter(t=>t in i):[],n="request"===r?ut.filter(t=>t in o):[];if(0===a.length&&0===n.length)return{message:t,lifted:{}};let s={},l={...o};if(a.length>0&&un(i)){let t={},r={...i};for(let o of a)t[o]=i[o],delete r[o];s.envelope=t,Object.keys(r).length>0?l._meta=r:delete l._meta}for(let t of n)"inputResponses"===t&&(s.inputResponses=l[t]),"requestState"===t&&(s.requestState=l[t]),delete l[t];return{message:{...t,params:l},lifted:s}}function uo(t,r){let o=t.validateResult(r,void 0);if(o.ok||"not-in-era"!==o.reason)return{"~standard":{version:1,vendor:"mcp-wire-codec",validate(o){let i=t.validateResult(r,o);return i.ok?{value:i.value}:{issues:[{message:"invalid"===i.reason?i.message:`not-in-era: ${r}`}]}}}}}let ui=(k=void 0,()=>k);var ua=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(t){this._options=t,this._supportedProtocolVersions=t?.supportedProtocolVersions??aU,this.setNotificationHandler("notifications/cancelled",t=>{this._oncancel(t)}),this.setNotificationHandler("notifications/progress",t=>{this._onprogress(t)}),this.setRequestHandler("ping",t=>({}))}_shouldDropInbound(t){}_outboundMetaEnvelope(){}_envelopeOutbound(t){let r=this._outboundMetaEnvelope();if(void 0===r)return t;let o=t.params??{};return{...t,params:{...o,_meta:{...r,...o._meta}}}}_resolveNonCompleteResult(t,r){return Promise.reject(new lV(lU.UnsupportedResultType,`Unsupported result type '${t.kind}' for ${r.request.method}`,{resultType:t.kind,method:r.request.method}))}_getRequestHandler(t){return this._requestHandlers.get(t)}async _oncancel(t){t.params.requestId&&this._requestHandlerAbortControllers.get(t.params.requestId)?.abort(t.params.reason)}_setupTimeout(t,r,o,i,a=!1){this._timeoutInfo.set(t,{timeoutId:setTimeout(i,r),startTime:Date.now(),timeout:r,maxTotalTimeout:o,resetTimeoutOnProgress:a,onTimeout:i})}_resetTimeout(t){let r=this._timeoutInfo.get(t);if(!r)return!1;let o=Date.now()-r.startTime;if(r.maxTotalTimeout&&o>=r.maxTotalTimeout)throw this._timeoutInfo.delete(t),new lV(lU.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:o});return clearTimeout(r.timeoutId),r.timeoutId=setTimeout(r.onTimeout,r.timeout),!0}_cleanupTimeout(t){let r=this._timeoutInfo.get(t);r&&(clearTimeout(r.timeoutId),this._timeoutInfo.delete(t))}async connect(t){this._transport=t;let r=this.transport?.onclose;this._transport.onclose=()=>{try{r?.()}finally{this._onclose()}};let o=this.transport?.onerror;this._transport.onerror=t=>{o?.(t),this._onerror(t)};let i=this._transport?.onmessage;this._transport.onmessage=(t,r)=>{if(i?.(t,r),cA(t)||cz(t))this._onresponse(t);else{let o;if(o=t,ne.safeParse(o).success)this._onrequest(t,r);else{let o;(o=t,nt.safeParse(o).success)?this._onnotification(t,r):this._onerror(Error(`Unknown message type: ${JSON.stringify(t)}`))}}},t.setSupportedProtocolVersions?.(this._supportedProtocolVersions),await this._transport.start()}_onclose(){let t=this._responseHandlers;for(let t of(this._responseHandlers=new Map,this._progressHandlers.clear(),this._pendingDebouncedNotifications.clear(),this._timeoutInfo.values()))clearTimeout(t.timeoutId);this._timeoutInfo.clear();let r=this._requestHandlerAbortControllers;this._requestHandlerAbortControllers=new Map;let o=new lV(lU.ConnectionClosed,"Connection closed");this._transport=void 0;try{this.onclose?.()}finally{for(let r of t.values())r(o);for(let t of r.values())t.abort(o)}}_onerror(t){this.onerror?.(t)}_onnotification(t,r){let{message:o}=ur(t,"notification"),i=this._negotiatedWireCodec();if(r?.classification===void 0&&"drop"===this._shouldDropInbound(t))return;if(r?.classification!==void 0){let t=cO(r.classification);if(t!==i.era)return void this._onerror(Error(`Era mismatch on inbound notification '${o.method}': classified as ${t} but this instance serves ${i.era}`))}if(cj(o.method)&&!i.hasNotificationMethod(o.method))return;let a=this._notificationHandlers.get(o.method),n=this.fallbackNotificationHandler;(void 0!==a||void 0!==n)&&Promise.resolve().then(()=>void 0===a?n(o):a(o,i)).catch(t=>this._onerror(Error(`Uncaught error in notification handler: ${t}`)))}_onrequest(t,r){var o;let{message:i,lifted:a}=ur(t,"request"),n=this._negotiatedWireCodec();if(r?.classification===void 0&&"drop"===this._shouldDropInbound(t))return void this._onerror(Error(`Dropped inbound request '${t.method}': not servable on this connection's protocol era`));let s=this._transport,l=(t,r,o)=>{let a={jsonrpc:"2.0",id:i.id,error:{code:t,message:r,...void 0!==o&&{data:o}}};s?.send(a).catch(t=>this._onerror(Error(`Failed to send an error response: ${t}`)))};if(r?.classification!==void 0){let t=cO(r.classification);if(t!==n.era){this._onerror(Error(`Era mismatch on inbound request '${i.method}': classified as ${t} but this instance serves ${n.era}`));let o=r.classification.revision??t;l(cl.UnsupportedProtocolVersion,`Unsupported protocol version: ${o}`,{supported:this._supportedProtocolVersions,requested:o});return}}if(cC(i.method)&&!n.hasRequestMethod(i.method))return void l(cl.MethodNotFound,"Method not found");let c=this._requestHandlers.get(i.method)??this.fallbackRequestHandler;if(void 0===c)return void l(cl.MethodNotFound,"Method not found");let u=n.checkInboundEnvelope(a);if(void 0!==u)return void l(cl.InvalidParams,u);let d=(t,r)=>this._notificationViaCodec(this._resolveOutboundCodec(t.method),t,{...r,relatedRequestId:i.id}),p=(t,r,o)=>this._requestWithSchemaViaCodec(this._resolveOutboundCodec(t.method),t,r,{...o,relatedRequestId:i.id}),h=new AbortController;this._requestHandlerAbortControllers.set(i.id,h);let m=void 0===a.inputResponses?void 0:function(t){let r={},o=[];if(!us(t))return{accepted:r,droppedKeys:o};for(let[i,a]of Object.entries(t)){if(!us(a)||"method"in a||"result"in a){o.push(i);continue}r[i]=a}return{accepted:r,droppedKeys:o}}(a.inputResponses),f={sessionId:s?.sessionId,mcpReq:{id:i.id,method:i.method,_meta:i.params?._meta,...void 0!==a.envelope&&{envelope:a.envelope},...void 0!==m&&{inputResponses:m.accepted},...void 0!==m&&m.droppedKeys.length>0&&{droppedInputResponseKeys:m.droppedKeys},requestState:void 0===a.requestState?ui:(o=a.requestState,()=>o),signal:h.signal,send:(t,r,o)=>{let i=this._resolveOutboundCodec(t.method);if(this._assertOutboundRequestInEra(i,t.method),cW(r))return p(t,r,o);let a=uo(i,t.method);if(void 0===a)throw TypeError(`'${t.method}' is not a spec method; pass a result schema as the second argument to ctx.mcpReq.send().`);return p(t,a,r)},notify:d},http:r?.authInfo?{authInfo:r.authInfo}:void 0},y=this.buildContext(f,r);Promise.resolve().then(()=>c(i,y)).then(async t=>{let r;if(h.signal.aborted)return;try{r=n.encodeResult(i.method,t,this._outboundServerInfo())}catch(t){this._onerror(Error(`Failed to encode result for ${i.method}: ${t}`)),l(cl.InternalError,"Internal error");return}let o={result:r,jsonrpc:"2.0",id:i.id};await s?.send(o)},async t=>{if(h.signal.aborted)return;let r=Number.isSafeInteger(t.code)?t.code:cl.InternalError,o={jsonrpc:"2.0",id:i.id,error:{code:n.encodeErrorCode(r),message:t.message??"Internal error",...void 0!==t.data&&{data:t.data}}};await s?.send(o)}).catch(t=>this._onerror(Error(`Failed to send response: ${t}`))).finally(()=>{this._requestHandlerAbortControllers.get(i.id)===h&&this._requestHandlerAbortControllers.delete(i.id)})}_onprogress(t){let{progressToken:r,...o}=t.params,i=Number(r),a=this._progressHandlers.get(i);if(!a)return void this._onerror(Error(`Received a progress notification for an unknown token: ${JSON.stringify(t)}`));let n=this._responseHandlers.get(i),s=this._timeoutInfo.get(i);if(s&&n&&s.resetTimeoutOnProgress)try{this._resetTimeout(i)}catch(t){this._responseHandlers.delete(i),this._progressHandlers.delete(i),this._cleanupTimeout(i),n(t);return}a(o)}_onresponse(t){let r=Number(t.id),o=this._responseHandlers.get(r);void 0===o?this._onerror(Error(`Received a response for an unknown message ID: ${JSON.stringify(t)}`)):(this._responseHandlers.delete(r),this._cleanupTimeout(r),this._progressHandlers.delete(r),o(cA(t)?t:cc.fromError(t.error.code,t.error.message,t.error.data)))}get transport(){return this._transport}async close(){await this._transport?.close()}request(t,r,o){let i=this._resolveOutboundCodec(t.method);if(this._assertOutboundRequestInEra(i,t.method),cW(r))return this._requestWithSchemaViaCodec(i,t,r,o);let a=uo(i,t.method);if(void 0===a)throw TypeError(`'${t.method}' is not a spec method; pass a result schema as the second argument to request().`);return this._requestWithSchemaViaCodec(i,t,a,r)}_negotiatedWireCodec(){return cT(this._negotiatedProtocolVersion)}_wireCodec(){return this._negotiatedWireCodec()}_resolveOutboundCodec(t){if(void 0===this._negotiatedProtocolVersion){let r=function(t){switch(t){case"initialize":case"notifications/initialized":return cT(void 0);case"server/discover":return cT(cx);default:return}}(t);if(r)return r}return this._negotiatedWireCodec()}_assertOutboundRequestInEra(t,r){if(cC(r)&&!t.hasRequestMethod(r))throw new lV(lU.MethodNotSupportedByProtocolVersion,`Method '${r}' is not supported by the negotiated protocol version (wire era ${t.era})`,{method:r,era:t.era})}_requestWithSchema(t,r,o){let i=this._resolveOutboundCodec(t.method);return this._assertOutboundRequestInEra(i,t.method),this._requestWithSchemaViaCodec(i,t,r,o)}_requestWithSchemaViaCodec(t,r,o,i){let a,n,{relatedRequestId:s,resumptionToken:l,onresumptiontoken:c,headers:u}=i??{},d=Date.now();return new Promise((p,h)=>{let m=t=>{h(t)};if(!this._transport)return void m(Error("Not connected"));if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(r.method)}catch(t){m(t);return}if(i?.signal?.aborted){let t=i.signal.reason;throw t instanceof lV?t:new lV(lU.RequestTimeout,String(t))}let f=t.era===cx&&!0===this._transport.hasPerRequestStream?new AbortController:void 0,y=this._requestMessageId++;n=y;let g={...r,jsonrpc:"2.0",id:y};i?.onprogress&&(this._progressHandlers.set(y,i.onprogress),g.params={...r.params,_meta:{...r.params?._meta,progressToken:y}});let v=this._envelopeOutbound(g),_=!1,b=t=>{_||(this._progressHandlers.delete(y),void 0===f?this._transport?.send(this._envelopeOutbound({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:y,reason:String(t)}}),{relatedRequestId:s,resumptionToken:l,onresumptiontoken:c}).catch(t=>this._onerror(Error(`Failed to send cancellation: ${t}`))):f.abort(),h(t instanceof lV?t:new lV(lU.RequestTimeout,String(t))))};this._responseHandlers.set(y,a=>{let n;if(!i?.signal?.aborted){if(_=!0,a instanceof Error)return h(a);try{n=t.decodeResult(r.method,a.result)}catch(t){return h(t instanceof Error?t:Error(String(t)))}if("invalid"===n.kind)return h(n.error);if("input_required"===n.kind){var s;return i?.allowInputRequired===!0?p({resultType:"input_required",inputRequests:(s=n).inputRequests,...void 0!==s.requestState&&{requestState:s.requestState}}):p(this._resolveNonCompleteResult(n,{codec:t,request:r,resultSchema:o,options:i,flowStartedAt:d,retry:(i,a)=>this._requestWithSchemaViaCodec(t,void 0===i?{method:r.method}:{method:r.method,params:i},o,a)}))}cX(o,n.result).then(t=>{t.success?p(t.data):h(new lV(lU.InvalidResult,`Invalid result for ${r.method}: ${t.error}`))},h)}}),a=()=>b(i?.signal?.reason),i?.signal?.addEventListener("abort",a,{once:!0});let S=i?.timeout??6e4;this._setupTimeout(y,S,i?.maxTotalTimeout,()=>b(new lV(lU.RequestTimeout,"Request timed out",{timeout:S})),i?.resetTimeoutOnProgress??!1),this._transport.send(v,{relatedRequestId:s,resumptionToken:l,onresumptiontoken:c,headers:u,requestSignal:f?.signal}).catch(t=>{this._progressHandlers.delete(y),h(t)})}).finally(()=>{a&&i?.signal?.removeEventListener("abort",a),void 0!==n&&(this._responseHandlers.delete(n),this._cleanupTimeout(n))})}async notification(t,r){return this._notificationViaCodec(this._resolveOutboundCodec(t.method),t,r)}async _notificationViaCodec(t,r,o){if(!this._transport)throw new lV(lU.NotConnected,"Not connected");if(cj(r.method)&&!t.hasNotificationMethod(r.method))throw new lV(lU.MethodNotSupportedByProtocolVersion,`Notification '${r.method}' is not supported by the negotiated protocol version (wire era ${t.era})`,{method:r.method,era:t.era});this.assertNotificationCapability(r.method);let i=this._envelopeOutbound({jsonrpc:"2.0",...r});if((this._options?.debouncedNotificationMethods??[]).includes(r.method)&&!r.params&&!o?.relatedRequestId){if(this._pendingDebouncedNotifications.has(r.method))return;this._pendingDebouncedNotifications.add(r.method),Promise.resolve().then(()=>{this._pendingDebouncedNotifications.delete(r.method),this._transport&&this._transport?.send(i,o).catch(t=>this._onerror(t))});return}await this._transport.send(i,o)}setRequestHandler(t,r,o){let i;if(this.assertRequestHandlerCapability(t),"function"==typeof r){if(!cC(t))throw TypeError(`'${t}' is not a spec request method; pass schemas as the second argument to setRequestHandler().`);i=(o,i)=>{let a=this._negotiatedWireCodec(),n=a.validateRequest(t,o);if(n.ok||"not-in-era"!==n.reason||(n=a.validateInputRequest(t,o)),!n.ok){if("not-in-era"===n.reason)throw new cc(cl.InternalError,`No wire schema for ${t} in the resolved era`);throw Error(n.message)}return Promise.resolve(r(n.value,i))}}else if(o)i=async(i,a)=>{let n=await cX(r.params,{...i.params});if(!n.success)throw new cc(cl.InvalidParams,`Invalid params for ${t}: ${n.error}`);return o(n.data,a)};else throw TypeError("setRequestHandler: handler is required");this._requestHandlers.set(t,this._wrapHandler(t,i))}_wrapHandler(t,r){return r}_outboundServerInfo(){}removeRequestHandler(t){this._requestHandlers.delete(t)}assertCanSetRequestHandler(t){if(this._requestHandlers.has(t))throw Error(`A request handler for ${t} already exists, which would be overridden`)}setNotificationHandler(t,r,o){if("function"==typeof r){if(!cj(t))throw TypeError(`'${t}' is not a spec notification method; pass schemas as the second argument to setNotificationHandler().`);this._notificationHandlers.set(t,(o,i)=>{let a=i.validateNotification(t,o);if(!a.ok){if("not-in-era"===a.reason)throw new cc(cl.InternalError,`No wire schema for ${t} in the resolved era`);throw Error(a.message)}return Promise.resolve(r(a.value))});return}if(!o)throw TypeError("setNotificationHandler: handler is required");this._notificationHandlers.set(t,async i=>{let a=await cX(r.params,{...i.params});if(!a.success)throw new cc(cl.InvalidParams,`Invalid params for notification ${t}: ${a.error}`);await o(a.data,i)})}removeNotificationHandler(t){this._notificationHandlers.delete(t)}};function un(t){return null!==t&&"object"==typeof t&&!Array.isArray(t)}function us(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}function ul(t){throw new lV(lU.SendFailed,`ctx.mcpReq.${t} is not available while fulfilling an embedded input request: the request is fulfilled locally and has no related peer request`)}async function uc(t,r,o,i,a){var n,s,l,c,u;if(!us(i)||"string"!=typeof i.method)throw new lV(lU.InvalidResult,`Invalid input request '${o}': each inputRequests entry must be an embedded request object with a method`,{key:o});let d=i.method;if(!r.hasInputRequestMethod(d))throw new lV(lU.InvalidResult,`Invalid input request '${o}': '${d}' is not an embedded request the ${r.era} revision defines (expected elicitation/create, sampling/createMessage, or roots/list)`,{key:o,method:d});let p=t.getRequestHandler(d);if(void 0===p)throw new lV(lU.CapabilityNotSupported,`Cannot fulfil input request '${o}': no handler is registered for '${d}' on this client. Declare the corresponding capability and register a handler, or handle input_required results manually.`,{key:o,method:d});let h=us(i.params)?i.params:void 0;return await p({jsonrpc:"2.0",id:o,method:d,...void 0!==h&&{params:h}},t.buildContext((n=o,s=d,l=h,c=a,{sessionId:t.sessionId,mcpReq:{id:n,method:s,_meta:l?._meta,requestState:(u=void 0,()=>u),signal:c,send:()=>ul("send"),notify:()=>ul("notify")}})))}var uu=M(q(t=>{var r=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,o=/\\([\u000b\u0020-\u00ff])/g,i=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;function a(t){this.parameters=Object.create(null),this.type=t}t.parse=function(t){if(!t)throw TypeError("argument string is required");var n,s,l,c="object"==typeof t?function(t){var r;if("function"==typeof t.getHeader?r=t.getHeader("content-type"):"object"==typeof t.headers&&(r=t.headers&&t.headers["content-type"]),"string"!=typeof r)throw TypeError("content-type header is missing from object");return r}(t):t;if("string"!=typeof c)throw TypeError("argument string is required to be a string");var u=c.indexOf(";"),d=-1!==u?c.slice(0,u).trim():c.trim();if(!i.test(d))throw TypeError("invalid media type");var p=new a(d.toLowerCase());if(-1!==u){for(r.lastIndex=u;s=r.exec(c);){if(s.index!==u)throw TypeError("invalid parameter format");u+=s[0].length,n=s[1].toLowerCase(),34===(l=s[2]).charCodeAt(0)&&-1!==(l=l.slice(1,-1)).indexOf("\\")&&(l=l.replace(o,"$1")),p.parameters[n]=l}if(u!==c.length)throw TypeError("invalid parameter format")}return p}})(),1),ud=class{_buffer;_maxBufferSize;constructor(t){this._maxBufferSize=t?.maxBufferSize??0xa00000}append(t){if((this._buffer?.length??0)+t.length>this._maxBufferSize)throw this.clear(),Error(`ReadBuffer exceeded maximum size of ${this._maxBufferSize} bytes`);this._buffer=this._buffer?Buffer.concat([this._buffer,t]):t}readMessage(){for(;this._buffer;){let r=this._buffer.indexOf("\n");if(-1===r)break;let o=this._buffer.toString("utf8",0,r).replace(/\r$/,"");this._buffer=this._buffer.subarray(r+1);try{var t;return t=o,ni.parse(JSON.parse(t))}catch(t){if(t instanceof SyntaxError)continue;throw t}}return null}clear(){this._buffer=void 0}};function up(t){return t?t instanceof Headers?Object.fromEntries(t.entries()):Array.isArray(t)?Object.fromEntries(t):{...t}:{}}var uh=q(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.regexpCode=t.getEsmExportName=t.getProperty=t.safeStringify=t.stringify=t.strConcat=t.addCodeArg=t.str=t._=t.nil=t._Code=t.Name=t.IDENTIFIER=t._CodeOrName=void 0;var r=class{};t._CodeOrName=r,t.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var o=class extends r{constructor(r){if(super(),!t.IDENTIFIER.test(r))throw Error("CodeGen: name must be a valid identifier");this.str=r}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};t.Name=o;var i=class extends r{constructor(t){super(),this._items="string"==typeof t?[t]:t}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let t=this._items[0];return""===t||'""'===t}get str(){var t;return null!=(t=this._str)?t:this._str=this._items.reduce((t,r)=>`${t}${r}`,"")}get names(){var t;return null!=(t=this._names)?t:this._names=this._items.reduce((t,r)=>(r instanceof o&&(t[r.str]=(t[r.str]||0)+1),t),{})}};function a(t,...r){let o=[t[0]],n=0;for(;n<r.length;)l(o,r[n]),o.push(t[++n]);return new i(o)}t._Code=i,t.nil=new i(""),t._=a;let n=new i("+");function s(t,...r){let a=[c(t[0])],u=0;for(;u<r.length;)a.push(n),l(a,r[u]),a.push(n,c(t[++u]));return function(t){let r=1;for(;r<t.length-1;){if(t[r]===n){var i,a;let n=(i=t[r-1],'""'===(a=t[r+1])?i:'""'===i?a:"string"==typeof i?a instanceof o||'"'!==i[i.length-1]?void 0:"string"!=typeof a?`${i.slice(0,-1)}${a}"`:'"'===a[0]?i.slice(0,-1)+a.slice(1):void 0:"string"!=typeof a||'"'!==a[0]||i instanceof o?void 0:`"${i}${a.slice(1)}`);if(void 0!==n){t.splice(r-1,3,n);continue}t[r++]="+"}r++}}(a),new i(a)}function l(t,r){var a;r instanceof i?t.push(...r._items):r instanceof o?t.push(r):t.push("number"==typeof(a=r)||"boolean"==typeof a||null===a?a:c(Array.isArray(a)?a.join(","):a))}function c(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}t.str=s,t.addCodeArg=l,t.strConcat=function(t,r){return r.emptyStr()?t:t.emptyStr()?r:s`${t}${r}`},t.stringify=function(t){return new i(c(t))},t.safeStringify=c,t.getProperty=function(r){return"string"==typeof r&&t.IDENTIFIER.test(r)?new i(`.${r}`):a`[${r}]`},t.getEsmExportName=function(r){if("string"==typeof r&&t.IDENTIFIER.test(r))return new i(`${r}`);throw Error(`CodeGen: invalid export name: ${r}, use explicit $id name mapping`)},t.regexpCode=function(t){return new i(t.toString())}}),um=q(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ValueScope=t.ValueScopeName=t.Scope=t.varKinds=t.UsedValueState=void 0;let r=uh();var o,i,a=class extends Error{constructor(t){super(`CodeGen: "code" for ${t} not defined`),this.value=t.value}};(o=i||(t.UsedValueState=i={}))[o.Started=0]="Started",o[o.Completed=1]="Completed",t.varKinds={const:new r.Name("const"),let:new r.Name("let"),var:new r.Name("var")};var n=class{constructor({prefixes:t,parent:r}={}){this._names={},this._prefixes=t,this._parent=r}toName(t){return t instanceof r.Name?t:this.name(t)}name(t){return new r.Name(this._newName(t))}_newName(t){let r=this._names[t]||this._nameGroup(t);return`${t}${r.index++}`}_nameGroup(t){var r,o;if((null==(o=null==(r=this._parent)?void 0:r._prefixes)?void 0:o.has(t))||this._prefixes&&!this._prefixes.has(t))throw Error(`CodeGen: prefix "${t}" is not allowed in this scope`);return this._names[t]={prefix:t,index:0}}};t.Scope=n;var s=class extends r.Name{constructor(t,r){super(r),this.prefix=t}setValue(t,{property:o,itemIndex:i}){this.value=t,this.scopePath=(0,r._)`.${new r.Name(o)}[${i}]`}};t.ValueScopeName=s;let l=(0,r._)`\n`;var c=class extends n{constructor(t){super(t),this._values={},this._scope=t.scope,this.opts={...t,_n:t.lines?l:r.nil}}get(){return this._scope}name(t){return new s(t,this._newName(t))}value(t,r){var o;if(void 0===r.ref)throw Error("CodeGen: ref must be passed in value");let i=this.toName(t),{prefix:a}=i,n=null!=(o=r.key)?o:r.ref,s=this._values[a];if(s){let t=s.get(n);if(t)return t}else s=this._values[a]=new Map;s.set(n,i);let l=this._scope[a]||(this._scope[a]=[]),c=l.length;return l[c]=r.ref,i.setValue(r,{property:a,itemIndex:c}),i}getValue(t,r){let o=this._values[t];if(o)return o.get(r)}scopeRefs(t,o=this._values){return this._reduceValues(o,o=>{if(void 0===o.scopePath)throw Error(`CodeGen: name "${o}" has no value`);return(0,r._)`${t}${o.scopePath}`})}scopeCode(t=this._values,r,o){return this._reduceValues(t,t=>{if(void 0===t.value)throw Error(`CodeGen: name "${t}" has no value`);return t.value.code},r,o)}_reduceValues(o,n,s={},l){let c=r.nil;for(let u in o){let d=o[u];if(!d)continue;let p=s[u]=s[u]||new Map;d.forEach(o=>{if(p.has(o))return;p.set(o,i.Started);let s=n(o);if(s){let i=this.opts.es5?t.varKinds.var:t.varKinds.const;c=(0,r._)`${c}${i} ${o} = ${s};${this.opts._n}`}else if(s=null==l?void 0:l(o))c=(0,r._)`${c}${s}${this.opts._n}`;else throw new a(o);p.set(o,i.Completed)})}return c}};t.ValueScope=c}),uf=q(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.or=t.and=t.not=t.CodeGen=t.operators=t.varKinds=t.ValueScopeName=t.ValueScope=t.Scope=t.Name=t.regexpCode=t.stringify=t.getProperty=t.nil=t.strConcat=t.str=t._=void 0;let r=uh(),o=um();var i=uh();Object.defineProperty(t,"_",{enumerable:!0,get:function(){return i._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return i.str}}),Object.defineProperty(t,"strConcat",{enumerable:!0,get:function(){return i.strConcat}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return i.nil}}),Object.defineProperty(t,"getProperty",{enumerable:!0,get:function(){return i.getProperty}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return i.stringify}}),Object.defineProperty(t,"regexpCode",{enumerable:!0,get:function(){return i.regexpCode}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return i.Name}});var a=um();Object.defineProperty(t,"Scope",{enumerable:!0,get:function(){return a.Scope}}),Object.defineProperty(t,"ValueScope",{enumerable:!0,get:function(){return a.ValueScope}}),Object.defineProperty(t,"ValueScopeName",{enumerable:!0,get:function(){return a.ValueScopeName}}),Object.defineProperty(t,"varKinds",{enumerable:!0,get:function(){return a.varKinds}}),t.operators={GT:new r._Code(">"),GTE:new r._Code(">="),LT:new r._Code("<"),LTE:new r._Code("<="),EQ:new r._Code("==="),NEQ:new r._Code("!=="),NOT:new r._Code("!"),OR:new r._Code("||"),AND:new r._Code("&&"),ADD:new r._Code("+")};var n=class{optimizeNodes(){return this}optimizeNames(t,r){return this}},s=class extends n{constructor(t,r,o){super(),this.varKind=t,this.name=r,this.rhs=o}render({es5:t,_n:r}){let i=t?o.varKinds.var:this.varKind,a=void 0===this.rhs?"":` = ${this.rhs}`;return`${i} ${this.name}${a};`+r}optimizeNames(t,r){if(t[this.name.str])return this.rhs&&(this.rhs=C(this.rhs,t,r)),this}get names(){return this.rhs instanceof r._CodeOrName?this.rhs.names:{}}},l=class extends n{constructor(t,r,o){super(),this.lhs=t,this.rhs=r,this.sideEffects=o}render({_n:t}){return`${this.lhs} = ${this.rhs};`+t}optimizeNames(t,o){if(!(this.lhs instanceof r.Name)||t[this.lhs.str]||this.sideEffects)return this.rhs=C(this.rhs,t,o),this}get names(){return O(this.lhs instanceof r.Name?{}:{...this.lhs.names},this.rhs)}},c=class extends l{constructor(t,r,o,i){super(t,o,i),this.op=r}render({_n:t}){return`${this.lhs} ${this.op}= ${this.rhs};`+t}},u=class extends n{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`${this.label}:`+t}},d=class extends n{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`break${this.label?` ${this.label}`:""};`+t}},p=class extends n{constructor(t){super(),this.error=t}render({_n:t}){return`throw ${this.error};`+t}get names(){return this.error.names}},h=class extends n{constructor(t){super(),this.code=t}render({_n:t}){return`${this.code};`+t}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(t,r){return this.code=C(this.code,t,r),this}get names(){return this.code instanceof r._CodeOrName?this.code.names:{}}},m=class extends n{constructor(t=[]){super(),this.nodes=t}render(t){return this.nodes.reduce((r,o)=>r+o.render(t),"")}optimizeNodes(){let{nodes:t}=this,r=t.length;for(;r--;){let o=t[r].optimizeNodes();Array.isArray(o)?t.splice(r,1,...o):o?t[r]=o:t.splice(r,1)}return t.length>0?this:void 0}optimizeNames(t,r){let{nodes:o}=this,i=o.length;for(;i--;){let a=o[i];a.optimizeNames(t,r)||(function(t,r){for(let o in r)t[o]=(t[o]||0)-(r[o]||0)}(t,a.names),o.splice(i,1))}return o.length>0?this:void 0}get names(){return this.nodes.reduce((t,r)=>T(t,r.names),{})}},f=class extends m{render(t){return"{"+t._n+super.render(t)+"}"+t._n}},y=class extends m{},g=class extends f{};g.kind="else";var v=class t extends f{constructor(t,r){super(r),this.condition=t}render(t){let r=`if(${this.condition})`+super.render(t);return this.else&&(r+="else "+this.else.render(t)),r}optimizeNodes(){super.optimizeNodes();let r=this.condition;if(!0===r)return this.nodes;let o=this.else;if(o){let t=o.optimizeNodes();o=this.else=Array.isArray(t)?new g(t):t}return o?!1===r?o instanceof t?o:o.nodes:this.nodes.length?this:new t(j(r),o instanceof t?[o]:o.nodes):!1!==r&&this.nodes.length?this:void 0}optimizeNames(t,r){var o;if(this.else=null==(o=this.else)?void 0:o.optimizeNames(t,r),super.optimizeNames(t,r)||this.else)return this.condition=C(this.condition,t,r),this}get names(){let t=super.names;return O(t,this.condition),this.else&&T(t,this.else.names),t}};v.kind="if";var _=class extends f{};_.kind="for";var b=class extends _{constructor(t){super(),this.iteration=t}render(t){return`for(${this.iteration})`+super.render(t)}optimizeNames(t,r){if(super.optimizeNames(t,r))return this.iteration=C(this.iteration,t,r),this}get names(){return T(super.names,this.iteration.names)}},S=class extends _{constructor(t,r,o,i){super(),this.varKind=t,this.name=r,this.from=o,this.to=i}render(t){let r=t.es5?o.varKinds.var:this.varKind,{name:i,from:a,to:n}=this;return`for(${r} ${i}=${a}; ${i}<${n}; ${i}++)`+super.render(t)}get names(){return O(O(super.names,this.from),this.to)}},w=class extends _{constructor(t,r,o,i){super(),this.loop=t,this.varKind=r,this.name=o,this.iterable=i}render(t){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(t)}optimizeNames(t,r){if(super.optimizeNames(t,r))return this.iterable=C(this.iterable,t,r),this}get names(){return T(super.names,this.iterable.names)}},$=class extends f{constructor(t,r,o){super(),this.name=t,this.args=r,this.async=o}render(t){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(t)}};$.kind="func";var P=class extends m{render(t){return"return "+super.render(t)}};P.kind="return";var R=class extends f{render(t){let r="try"+super.render(t);return this.catch&&(r+=this.catch.render(t)),this.finally&&(r+=this.finally.render(t)),r}optimizeNodes(){var t,r;return super.optimizeNodes(),null==(t=this.catch)||t.optimizeNodes(),null==(r=this.finally)||r.optimizeNodes(),this}optimizeNames(t,r){var o,i;return super.optimizeNames(t,r),null==(o=this.catch)||o.optimizeNames(t,r),null==(i=this.finally)||i.optimizeNames(t,r),this}get names(){let t=super.names;return this.catch&&T(t,this.catch.names),this.finally&&T(t,this.finally.names),t}},E=class extends f{constructor(t){super(),this.error=t}render(t){return`catch(${this.error})`+super.render(t)}};E.kind="catch";var k=class extends f{render(t){return"finally"+super.render(t)}};k.kind="finally";var x=class{constructor(t,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?"\n":""},this._extScope=t,this._scope=new o.Scope({parent:t}),this._nodes=[new y]}toString(){return this._root.render(this.opts)}name(t){return this._scope.name(t)}scopeName(t){return this._extScope.name(t)}scopeValue(t,r){let o=this._extScope.value(t,r);return(this._values[o.prefix]||(this._values[o.prefix]=new Set)).add(o),o}getScopeValue(t,r){return this._extScope.getValue(t,r)}scopeRefs(t){return this._extScope.scopeRefs(t,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(t,r,o,i){let a=this._scope.toName(r);return void 0!==o&&i&&(this._constants[a.str]=o),this._leafNode(new s(t,a,o)),a}const(t,r,i){return this._def(o.varKinds.const,t,r,i)}let(t,r,i){return this._def(o.varKinds.let,t,r,i)}var(t,r,i){return this._def(o.varKinds.var,t,r,i)}assign(t,r,o){return this._leafNode(new l(t,r,o))}add(r,o){return this._leafNode(new c(r,t.operators.ADD,o))}code(t){return"function"==typeof t?t():t!==r.nil&&this._leafNode(new h(t)),this}object(...t){let o=["{"];for(let[i,a]of t)o.length>1&&o.push(","),o.push(i),(i!==a||this.opts.es5)&&(o.push(":"),(0,r.addCodeArg)(o,a));return o.push("}"),new r._Code(o)}if(t,r,o){if(this._blockNode(new v(t)),r&&o)this.code(r).else().code(o).endIf();else if(r)this.code(r).endIf();else if(o)throw Error('CodeGen: "else" body without "then" body');return this}elseIf(t){return this._elseNode(new v(t))}else(){return this._elseNode(new g)}endIf(){return this._endBlockNode(v,g)}_for(t,r){return this._blockNode(t),r&&this.code(r).endFor(),this}for(t,r){return this._for(new b(t),r)}forRange(t,r,i,a,n=this.opts.es5?o.varKinds.var:o.varKinds.let){let s=this._scope.toName(t);return this._for(new S(n,s,r,i),()=>a(s))}forOf(t,i,a,n=o.varKinds.const){let s=this._scope.toName(t);if(this.opts.es5){let t=i instanceof r.Name?i:this.var("_arr",i);return this.forRange("_i",0,(0,r._)`${t}.length`,o=>{this.var(s,(0,r._)`${t}[${o}]`),a(s)})}return this._for(new w("of",n,s,i),()=>a(s))}forIn(t,i,a,n=this.opts.es5?o.varKinds.var:o.varKinds.const){if(this.opts.ownProperties)return this.forOf(t,(0,r._)`Object.keys(${i})`,a);let s=this._scope.toName(t);return this._for(new w("in",n,s,i),()=>a(s))}endFor(){return this._endBlockNode(_)}label(t){return this._leafNode(new u(t))}break(t){return this._leafNode(new d(t))}return(t){let r=new P;if(this._blockNode(r),this.code(t),1!==r.nodes.length)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(P)}try(t,r,o){if(!r&&!o)throw Error('CodeGen: "try" without "catch" and "finally"');let i=new R;if(this._blockNode(i),this.code(t),r){let t=this.name("e");this._currNode=i.catch=new E(t),r(t)}return o&&(this._currNode=i.finally=new k,this.code(o)),this._endBlockNode(E,k)}throw(t){return this._leafNode(new p(t))}block(t,r){return this._blockStarts.push(this._nodes.length),t&&this.code(t).endBlock(r),this}endBlock(t){let r=this._blockStarts.pop();if(void 0===r)throw Error("CodeGen: not in self-balancing block");let o=this._nodes.length-r;if(o<0||void 0!==t&&o!==t)throw Error(`CodeGen: wrong number of nodes: ${o} vs ${t} expected`);return this._nodes.length=r,this}func(t,o=r.nil,i,a){return this._blockNode(new $(t,o,i)),a&&this.code(a).endFunc(),this}endFunc(){return this._endBlockNode($)}optimize(t=1){for(;t-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(t){return this._currNode.nodes.push(t),this}_blockNode(t){this._currNode.nodes.push(t),this._nodes.push(t)}_endBlockNode(t,r){let o=this._currNode;if(o instanceof t||r&&o instanceof r)return this._nodes.pop(),this;throw Error(`CodeGen: not in block "${r?`${t.kind}/${r.kind}`:t.kind}"`)}_elseNode(t){let r=this._currNode;if(!(r instanceof v))throw Error('CodeGen: "else" without "if"');return this._currNode=r.else=t,this}get _root(){return this._nodes[0]}get _currNode(){let t=this._nodes;return t[t.length-1]}set _currNode(t){let r=this._nodes;r[r.length-1]=t}};function T(t,r){for(let o in r)t[o]=(t[o]||0)+(r[o]||0);return t}function O(t,o){return o instanceof r._CodeOrName?T(t,o.names):t}function C(t,o,i){var a;if(t instanceof r.Name)return n(t);if(!((a=t)instanceof r._Code&&a._items.some(t=>t instanceof r.Name&&1===o[t.str]&&void 0!==i[t.str])))return t;return new r._Code(t._items.reduce((t,o)=>(o instanceof r.Name&&(o=n(o)),o instanceof r._Code?t.push(...o._items):t.push(o),t),[]));function n(t){let r=i[t.str];return void 0===r||1!==o[t.str]?t:(delete o[t.str],r)}}function j(t){return"boolean"==typeof t||"number"==typeof t||null===t?!t:(0,r._)`!${z(t)}`}t.CodeGen=x,t.not=j;let I=A(t.operators.AND);t.and=function(...t){return t.reduce(I)};let N=A(t.operators.OR);function A(t){return(o,i)=>o===r.nil?i:i===r.nil?o:(0,r._)`${z(o)} ${t} ${z(i)}`}function z(t){return t instanceof r.Name?t:(0,r._)`(${t})`}t.or=function(...t){return t.reduce(N)}}),uy=q(t=>{var r,o;Object.defineProperty(t,"__esModule",{value:!0}),t.checkStrictMode=t.getErrorPath=t.Type=t.useFunc=t.setEvaluated=t.evaluatedPropsToName=t.mergeEvaluated=t.eachItem=t.unescapeJsonPointer=t.escapeJsonPointer=t.escapeFragment=t.unescapeFragment=t.schemaRefOrVal=t.schemaHasRulesButRef=t.schemaHasRules=t.checkUnknownRules=t.alwaysValidSchema=t.toHash=void 0;let i=uf(),a=uh();function n(t,r=t.schema){let{opts:o,self:i}=t;if(!o.strictSchema||"boolean"==typeof r)return;let a=i.RULES.keywords;for(let o in r)a[o]||m(t,`unknown keyword: "${o}"`)}function s(t,r){if("boolean"==typeof t)return!t;for(let o in t)if(r[o])return!0;return!1}function l(t){return"number"==typeof t?`${t}`:t.replace(/~/g,"~0").replace(/\//g,"~1")}function c(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}function u({mergeNames:t,mergeToName:r,mergeValues:o,resultToName:a}){return(n,s,l,c)=>{let u=void 0===l?s:l instanceof i.Name?(s instanceof i.Name?t(n,s,l):r(n,s,l),l):s instanceof i.Name?(r(n,l,s),s):o(s,l);return c!==i.Name||u instanceof i.Name?u:a(n,u)}}function d(t,r){if(!0===r)return t.var("props",!0);let o=t.var("props",(0,i._)`{}`);return void 0!==r&&p(t,o,r),o}function p(t,r,o){Object.keys(o).forEach(o=>t.assign((0,i._)`${r}${(0,i.getProperty)(o)}`,!0))}t.toHash=function(t){let r={};for(let o of t)r[o]=!0;return r},t.alwaysValidSchema=function(t,r){return"boolean"==typeof r?r:0===Object.keys(r).length||(n(t,r),!s(r,t.self.RULES.all))},t.checkUnknownRules=n,t.schemaHasRules=s,t.schemaHasRulesButRef=function(t,r){if("boolean"==typeof t)return!t;for(let o in t)if("$ref"!==o&&r.all[o])return!0;return!1},t.schemaRefOrVal=function({topSchemaRef:t,schemaPath:r},o,a,n){if(!n){if("number"==typeof o||"boolean"==typeof o)return o;if("string"==typeof o)return(0,i._)`${o}`}return(0,i._)`${t}${r}${(0,i.getProperty)(a)}`},t.unescapeFragment=function(t){return c(decodeURIComponent(t))},t.escapeFragment=function(t){return encodeURIComponent(l(t))},t.escapeJsonPointer=l,t.unescapeJsonPointer=c,t.eachItem=function(t,r){if(Array.isArray(t))for(let o of t)r(o);else r(t)},t.mergeEvaluated={props:u({mergeNames:(t,r,o)=>t.if((0,i._)`${o} !== true && ${r} !== undefined`,()=>{t.if((0,i._)`${r} === true`,()=>t.assign(o,!0),()=>t.assign(o,(0,i._)`${o} || {}`).code((0,i._)`Object.assign(${o}, ${r})`))}),mergeToName:(t,r,o)=>t.if((0,i._)`${o} !== true`,()=>{!0===r?t.assign(o,!0):(t.assign(o,(0,i._)`${o} || {}`),p(t,o,r))}),mergeValues:(t,r)=>!0===t||{...t,...r},resultToName:d}),items:u({mergeNames:(t,r,o)=>t.if((0,i._)`${o} !== true && ${r} !== undefined`,()=>t.assign(o,(0,i._)`${r} === true ? true : ${o} > ${r} ? ${o} : ${r}`)),mergeToName:(t,r,o)=>t.if((0,i._)`${o} !== true`,()=>t.assign(o,!0===r||(0,i._)`${o} > ${r} ? ${o} : ${r}`)),mergeValues:(t,r)=>!0===t||Math.max(t,r),resultToName:(t,r)=>t.var("items",r)})},t.evaluatedPropsToName=d,t.setEvaluated=p;let h={};function m(t,r,o=t.opts.strictSchema){if(o){if(r=`strict mode: ${r}`,!0===o)throw Error(r);t.self.logger.warn(r)}}t.useFunc=function(t,r){return t.scopeValue("func",{ref:r,code:h[r.code]||(h[r.code]=new a._Code(r.code))})},(o=r||(t.Type=r={}))[o.Num=0]="Num",o[o.Str=1]="Str",t.getErrorPath=function(t,o,a){if(t instanceof i.Name){let n=o===r.Num;return a?n?(0,i._)`"[" + ${t} + "]"`:(0,i._)`"['" + ${t} + "']"`:n?(0,i._)`"/" + ${t}`:(0,i._)`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return a?(0,i.getProperty)(t).toString():"/"+l(t)},t.checkStrictMode=m}),ug=q(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uf();t.default={data:new r.Name("data"),valCxt:new r.Name("valCxt"),instancePath:new r.Name("instancePath"),parentData:new r.Name("parentData"),parentDataProperty:new r.Name("parentDataProperty"),rootData:new r.Name("rootData"),dynamicAnchors:new r.Name("dynamicAnchors"),vErrors:new r.Name("vErrors"),errors:new r.Name("errors"),this:new r.Name("this"),self:new r.Name("self"),scope:new r.Name("scope"),json:new r.Name("json"),jsonPos:new r.Name("jsonPos"),jsonLen:new r.Name("jsonLen"),jsonPart:new r.Name("jsonPart")}}),uv=q(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.extendErrors=t.resetErrorsCount=t.reportExtraError=t.reportError=t.keyword$DataError=t.keywordError=void 0;let r=uf(),o=uy(),i=ug();function a(t,o){let a=t.const("err",o);t.if((0,r._)`${i.default.vErrors} === null`,()=>t.assign(i.default.vErrors,(0,r._)`[${a}]`),(0,r._)`${i.default.vErrors}.push(${a})`),t.code((0,r._)`${i.default.errors}++`)}function n(t,o){let{gen:i,validateName:a,schemaEnv:n}=t;n.$async?i.throw((0,r._)`new ${t.ValidationError}(${o})`):(i.assign((0,r._)`${a}.errors`,o),i.return(!1))}t.keywordError={message:({keyword:t})=>(0,r.str)`must pass "${t}" keyword validation`},t.keyword$DataError={message:({keyword:t,schemaType:o})=>o?(0,r.str)`"${t}" keyword must be ${o} ($data)`:(0,r.str)`"${t}" keyword is invalid ($data)`},t.reportError=function(o,i=t.keywordError,s,c){let{it:u}=o,{gen:d,compositeRule:p,allErrors:h}=u,m=l(o,i,s);(null!=c?c:p||h)?a(d,m):n(u,(0,r._)`[${m}]`)},t.reportExtraError=function(r,o=t.keywordError,s){let{it:c}=r,{gen:u,compositeRule:d,allErrors:p}=c;a(u,l(r,o,s)),d||p||n(c,i.default.vErrors)},t.resetErrorsCount=function(t,o){t.assign(i.default.errors,o),t.if((0,r._)`${i.default.vErrors} !== null`,()=>t.if(o,()=>t.assign((0,r._)`${i.default.vErrors}.length`,o),()=>t.assign(i.default.vErrors,null)))},t.extendErrors=function({gen:t,keyword:o,schemaValue:a,data:n,errsCount:s,it:l}){if(void 0===s)throw Error("ajv implementation error");let c=t.name("err");t.forRange("i",s,i.default.errors,s=>{t.const(c,(0,r._)`${i.default.vErrors}[${s}]`),t.if((0,r._)`${c}.instancePath === undefined`,()=>t.assign((0,r._)`${c}.instancePath`,(0,r.strConcat)(i.default.instancePath,l.errorPath))),t.assign((0,r._)`${c}.schemaPath`,(0,r.str)`${l.errSchemaPath}/${o}`),l.opts.verbose&&(t.assign((0,r._)`${c}.schema`,a),t.assign((0,r._)`${c}.data`,n))})};let s={keyword:new r.Name("keyword"),schemaPath:new r.Name("schemaPath"),params:new r.Name("params"),propertyName:new r.Name("propertyName"),message:new r.Name("message"),schema:new r.Name("schema"),parentSchema:new r.Name("parentSchema")};function l(t,a,n){let{createErrors:l}=t.it;return!1===l?(0,r._)`{}`:function(t,a,n={}){let{gen:l,it:c}=t,u=[function({errorPath:t},{instancePath:a}){let n=a?(0,r.str)`${t}${(0,o.getErrorPath)(a,o.Type.Str)}`:t;return[i.default.instancePath,(0,r.strConcat)(i.default.instancePath,n)]}(c,n),function({keyword:t,it:{errSchemaPath:i}},{schemaPath:a,parentSchema:n}){let l=n?i:(0,r.str)`${i}/${t}`;return a&&(l=(0,r.str)`${l}${(0,o.getErrorPath)(a,o.Type.Str)}`),[s.schemaPath,l]}(t,n)];return function(t,{params:o,message:a},n){let{keyword:l,data:c,schemaValue:u,it:d}=t,{opts:p,propertyName:h,topSchemaRef:m,schemaPath:f}=d;n.push([s.keyword,l],[s.params,"function"==typeof o?o(t):o||(0,r._)`{}`]),p.messages&&n.push([s.message,"function"==typeof a?a(t):a]),p.verbose&&n.push([s.schema,u],[s.parentSchema,(0,r._)`${m}${f}`],[i.default.data,c]),h&&n.push([s.propertyName,h])}(t,a,u),l.object(...u)}(t,a,n)}}),u_=q(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.boolOrEmptySchema=t.topBoolOrEmptySchema=void 0;let r=uv(),o=uf(),i=ug(),a={message:"boolean schema is false"};function n(t,o){let{gen:i,data:n}=t;(0,r.reportError)({gen:i,keyword:"false schema",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:t},a,void 0,o)}t.topBoolOrEmptySchema=function(t){let{gen:r,schema:a,validateName:s}=t;!1===a?n(t,!1):"object"==typeof a&&!0===a.$async?r.return(i.default.data):(r.assign((0,o._)`${s}.errors`,null),r.return(!0))},t.boolOrEmptySchema=function(t,r){let{gen:o,schema:i}=t;!1===i?(o.var(r,!1),n(t)):o.var(r,!0)}}),ub=q(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getRules=t.isJSONType=void 0;let r=new Set(["string","number","integer","boolean","null","object","array"]);t.isJSONType=function(t){return"string"==typeof t&&r.has(t)},t.getRules=function(){let t={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...t,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},t.number,t.string,t.array,t.object],post:{rules:[]},all:{},keywords:{}}}}),uS=q(t=>{function r(t,r){return r.rules.some(r=>o(t,r))}function o(t,r){var o;return void 0!==t[r.keyword]||(null==(o=r.definition.implements)?void 0:o.some(r=>void 0!==t[r]))}Object.defineProperty(t,"__esModule",{value:!0}),t.shouldUseRule=t.shouldUseGroup=t.schemaHasRulesForType=void 0,t.schemaHasRulesForType=function({schema:t,self:o},i){let a=o.RULES.types[i];return a&&!0!==a&&r(t,a)},t.shouldUseGroup=r,t.shouldUseRule=o}),uw=q(t=>{var r,o;Object.defineProperty(t,"__esModule",{value:!0}),t.reportTypeError=t.checkDataTypes=t.checkDataType=t.coerceAndCheckDataType=t.getJSONTypes=t.getSchemaTypes=t.DataType=void 0;let i=ub(),a=uS(),n=uv(),s=uf(),l=uy();function c(t){let r=Array.isArray(t)?t:t?[t]:[];if(r.every(i.isJSONType))return r;throw Error("type must be JSONType or JSONType[]: "+r.join(","))}(o=r||(t.DataType=r={}))[o.Correct=0]="Correct",o[o.Wrong=1]="Wrong",t.getSchemaTypes=function(t){let r=c(t.type);if(r.includes("null")){if(!1===t.nullable)throw Error("type: null contradicts nullable: false")}else{if(!r.length&&void 0!==t.nullable)throw Error('"nullable" cannot be used without "type"');!0===t.nullable&&r.push("null")}return r},t.getJSONTypes=c,t.coerceAndCheckDataType=function(t,o){var i,n;let{gen:l,data:c,opts:d}=t,h=(i=o,(n=d.coerceTypes)?i.filter(t=>u.has(t)||"array"===n&&"array"===t):[]),f=o.length>0&&!(0===h.length&&1===o.length&&(0,a.schemaHasRulesForType)(t,o[0]));if(f){let i=p(o,c,d.strictNumbers,r.Wrong);l.if(i,()=>{h.length?function(t,r,o){let{gen:i,data:a,opts:n}=t,l=i.let("dataType",(0,s._)`typeof ${a}`),c=i.let("coerced",(0,s._)`undefined`);for(let t of("array"===n.coerceTypes&&i.if((0,s._)`${l} == 'object' && Array.isArray(${a}) && ${a}.length == 1`,()=>i.assign(a,(0,s._)`${a}[0]`).assign(l,(0,s._)`typeof ${a}`).if(p(r,a,n.strictNumbers),()=>i.assign(c,a))),i.if((0,s._)`${c} !== undefined`),o))(u.has(t)||"array"===t&&"array"===n.coerceTypes)&&function(t){switch(t){case"string":i.elseIf((0,s._)`${l} == "number" || ${l} == "boolean"`).assign(c,(0,s._)`"" + ${a}`).elseIf((0,s._)`${a} === null`).assign(c,(0,s._)`""`);return;case"number":i.elseIf((0,s._)`${l} == "boolean" || ${a} === null
|
|
56
|
+
|| (${l} == "string" && ${a} && ${a} == +${a})`).assign(c,(0,s._)`+${a}`);return;case"integer":i.elseIf((0,s._)`${l} === "boolean" || ${a} === null
|
|
57
|
+
|| (${l} === "string" && ${a} && ${a} == +${a} && !(${a} % 1))`).assign(c,(0,s._)`+${a}`);return;case"boolean":i.elseIf((0,s._)`${a} === "false" || ${a} === 0 || ${a} === null`).assign(c,!1).elseIf((0,s._)`${a} === "true" || ${a} === 1`).assign(c,!0);return;case"null":i.elseIf((0,s._)`${a} === "" || ${a} === 0 || ${a} === false`),i.assign(c,null);return;case"array":i.elseIf((0,s._)`${l} === "string" || ${l} === "number"
|
|
58
|
+
|| ${l} === "boolean" || ${a} === null`).assign(c,(0,s._)`[${a}]`)}}(t);i.else(),m(t),i.endIf(),i.if((0,s._)`${c} !== undefined`,()=>{i.assign(a,c),function({gen:t,parentData:r,parentDataProperty:o},i){t.if((0,s._)`${r} !== undefined`,()=>t.assign((0,s._)`${r}[${o}]`,i))}(t,c)})}(t,o,h):m(t)})}return f};let u=new Set(["string","number","integer","boolean","null"]);function d(t,o,i,a=r.Correct){let n,l=a===r.Correct?s.operators.EQ:s.operators.NEQ;switch(t){case"null":return(0,s._)`${o} ${l} null`;case"array":n=(0,s._)`Array.isArray(${o})`;break;case"object":n=(0,s._)`${o} && typeof ${o} == "object" && !Array.isArray(${o})`;break;case"integer":n=c((0,s._)`!(${o} % 1) && !isNaN(${o})`);break;case"number":n=c();break;default:return(0,s._)`typeof ${o} ${l} ${t}`}return a===r.Correct?n:(0,s.not)(n);function c(t=s.nil){return(0,s.and)((0,s._)`typeof ${o} == "number"`,t,i?(0,s._)`isFinite(${o})`:s.nil)}}function p(t,r,o,i){let a;if(1===t.length)return d(t[0],r,o,i);let n=(0,l.toHash)(t);if(n.array&&n.object){let t=(0,s._)`typeof ${r} != "object"`;a=n.null?t:(0,s._)`!${r} || ${t}`,delete n.null,delete n.array,delete n.object}else a=s.nil;for(let t in n.number&&delete n.integer,n)a=(0,s.and)(a,d(t,r,o,i));return a}t.checkDataType=d,t.checkDataTypes=p;let h={message:({schema:t})=>`must be ${t}`,params:({schema:t,schemaValue:r})=>"string"==typeof t?(0,s._)`{type: ${t}}`:(0,s._)`{type: ${r}}`};function m(t){let r=function(t){let{gen:r,data:o,schema:i}=t,a=(0,l.schemaRefOrVal)(t,i,"type");return{gen:r,keyword:"type",data:o,schema:i.type,schemaCode:a,schemaValue:a,parentSchema:i,params:{},it:t}}(t);(0,n.reportError)(r,h)}t.reportTypeError=m}),u$=q(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.assignDefaults=void 0;let r=uf(),o=uy();function i(t,i,a){let{gen:n,compositeRule:s,data:l,opts:c}=t;if(void 0===a)return;let u=(0,r._)`${l}${(0,r.getProperty)(i)}`;if(s)return void(0,o.checkStrictMode)(t,`default is ignored for: ${u}`);let d=(0,r._)`${u} === undefined`;"empty"===c.useDefaults&&(d=(0,r._)`${d} || ${u} === null || ${u} === ""`),n.if(d,(0,r._)`${u} = ${(0,r.stringify)(a)}`)}t.assignDefaults=function(t,r){let{properties:o,items:a}=t.schema;if("object"===r&&o)for(let r in o)i(t,r,o[r].default);else"array"===r&&Array.isArray(a)&&a.forEach((r,o)=>i(t,o,r.default))}}),uP=q(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.validateUnion=t.validateArray=t.usePattern=t.callValidateCode=t.schemaProperties=t.allSchemaProperties=t.noPropertyInData=t.propertyInData=t.isOwnProperty=t.hasPropFunc=t.reportMissingProp=t.checkMissingProp=t.checkReportMissingProp=void 0;let r=uf(),o=uy(),i=ug(),a=uy();function n(t){return t.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,r._)`Object.prototype.hasOwnProperty`})}function s(t,o,i){return(0,r._)`${n(t)}.call(${o}, ${i})`}function l(t,o,i,a){let n=(0,r._)`${o}${(0,r.getProperty)(i)} === undefined`;return a?(0,r.or)(n,(0,r.not)(s(t,o,i))):n}function c(t){return t?Object.keys(t).filter(t=>"__proto__"!==t):[]}t.checkReportMissingProp=function(t,o){let{gen:i,data:a,it:n}=t;i.if(l(i,a,o,n.opts.ownProperties),()=>{t.setParams({missingProperty:(0,r._)`${o}`},!0),t.error()})},t.checkMissingProp=function({gen:t,data:o,it:{opts:i}},a,n){return(0,r.or)(...a.map(a=>(0,r.and)(l(t,o,a,i.ownProperties),(0,r._)`${n} = ${a}`)))},t.reportMissingProp=function(t,r){t.setParams({missingProperty:r},!0),t.error()},t.hasPropFunc=n,t.isOwnProperty=s,t.propertyInData=function(t,o,i,a){let n=(0,r._)`${o}${(0,r.getProperty)(i)} !== undefined`;return a?(0,r._)`${n} && ${s(t,o,i)}`:n},t.noPropertyInData=l,t.allSchemaProperties=c,t.schemaProperties=function(t,r){return c(r).filter(i=>!(0,o.alwaysValidSchema)(t,r[i]))},t.callValidateCode=function({schemaCode:t,data:o,it:{gen:a,topSchemaRef:n,schemaPath:s,errorPath:l},it:c},u,d,p){let h=p?(0,r._)`${t}, ${o}, ${n}${s}`:o,m=[[i.default.instancePath,(0,r.strConcat)(i.default.instancePath,l)],[i.default.parentData,c.parentData],[i.default.parentDataProperty,c.parentDataProperty],[i.default.rootData,i.default.rootData]];c.opts.dynamicRef&&m.push([i.default.dynamicAnchors,i.default.dynamicAnchors]);let f=(0,r._)`${h}, ${a.object(...m)}`;return d!==r.nil?(0,r._)`${u}.call(${d}, ${f})`:(0,r._)`${u}(${f})`};let u=(0,r._)`new RegExp`;t.usePattern=function({gen:t,it:{opts:o}},i){let n=o.unicodeRegExp?"u":"",{regExp:s}=o.code,l=s(i,n);return t.scopeValue("pattern",{key:l.toString(),ref:l,code:(0,r._)`${"new RegExp"===s.code?u:(0,a.useFunc)(t,s)}(${i}, ${n})`})},t.validateArray=function(t){let{gen:i,data:a,keyword:n,it:s}=t,l=i.name("valid");if(s.allErrors){let t=i.let("valid",!0);return c(()=>i.assign(t,!1)),t}return i.var(l,!0),c(()=>i.break()),l;function c(s){let c=i.const("len",(0,r._)`${a}.length`);i.forRange("i",0,c,a=>{t.subschema({keyword:n,dataProp:a,dataPropType:o.Type.Num},l),i.if((0,r.not)(l),s)})}},t.validateUnion=function(t){let{gen:i,schema:a,keyword:n,it:s}=t;if(!Array.isArray(a))throw Error("ajv implementation error");if(a.some(t=>(0,o.alwaysValidSchema)(s,t))&&!s.opts.unevaluated)return;let l=i.let("valid",!1),c=i.name("_valid");i.block(()=>a.forEach((o,a)=>{let s=t.subschema({keyword:n,schemaProp:a,compositeRule:!0},c);i.assign(l,(0,r._)`${l} || ${c}`),t.mergeValidEvaluated(s,c)||i.if((0,r.not)(l))})),t.result(l,()=>t.reset(),()=>t.error(!0))}}),uR=q(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.validateKeywordUsage=t.validSchemaType=t.funcKeywordCode=t.macroKeywordCode=void 0;let r=uf(),o=ug(),i=uP(),a=uv();function n(t){let{gen:o,data:i,it:a}=t;o.if(a.parentData,()=>o.assign(i,(0,r._)`${a.parentData}[${a.parentDataProperty}]`))}function s(t,o,i){if(void 0===i)throw Error(`keyword "${o}" failed to compile`);return t.scopeValue("keyword","function"==typeof i?{ref:i}:{ref:i,code:(0,r.stringify)(i)})}t.macroKeywordCode=function(t,o){let{gen:i,keyword:a,schema:n,parentSchema:l,it:c}=t,u=o.macro.call(c.self,n,l,c),d=s(i,a,u);!1!==c.opts.validateSchema&&c.self.validateSchema(u,!0);let p=i.name("valid");t.subschema({schema:u,schemaPath:r.nil,errSchemaPath:`${c.errSchemaPath}/${a}`,topSchemaRef:d,compositeRule:!0},p),t.pass(p,()=>t.error(!0))},t.funcKeywordCode=function(t,l){var c;let{gen:u,keyword:d,schema:p,parentSchema:h,$data:m,it:f}=t;!function({schemaEnv:t},r){if(r.async&&!t.$async)throw Error("async keyword in sync schema")}(f,l);let y=s(u,d,!m&&l.compile?l.compile.call(f.self,p,h,f):l.validate),g=u.let("valid");function v(a=l.async?(0,r._)`await `:r.nil){let n=f.opts.passContext?o.default.this:o.default.self,s=!("compile"in l&&!m||!1===l.schema);u.assign(g,(0,r._)`${a}${(0,i.callValidateCode)(t,y,n,s)}`,l.modifying)}function _(t){var o;u.if((0,r.not)(null!=(o=l.valid)?o:g),t)}t.block$data(g,function(){if(!1===l.errors)v(),l.modifying&&n(t),_(()=>t.error());else{let i,s,c=l.async?(i=u.let("ruleErrs",null),u.try(()=>v((0,r._)`await `),t=>u.assign(g,!1).if((0,r._)`${t} instanceof ${f.ValidationError}`,()=>u.assign(i,(0,r._)`${t}.errors`),()=>u.throw(t))),i):(s=(0,r._)`${y}.errors`,u.assign(s,null),v(r.nil),s);l.modifying&&n(t),_(()=>(function(t,i){let{gen:n}=t;n.if((0,r._)`Array.isArray(${i})`,()=>{n.assign(o.default.vErrors,(0,r._)`${o.default.vErrors} === null ? ${i} : ${o.default.vErrors}.concat(${i})`).assign(o.default.errors,(0,r._)`${o.default.vErrors}.length`),(0,a.extendErrors)(t)},()=>t.error())})(t,c))}}),t.ok(null!=(c=l.valid)?c:g)},t.validSchemaType=function(t,r,o=!1){return!r.length||r.some(r=>"array"===r?Array.isArray(t):"object"===r?t&&"object"==typeof t&&!Array.isArray(t):typeof t==r||o&&void 0===t)},t.validateKeywordUsage=function({schema:t,opts:r,self:o,errSchemaPath:i},a,n){if(Array.isArray(a.keyword)?!a.keyword.includes(n):a.keyword!==n)throw Error("ajv implementation error");let s=a.dependencies;if(null==s?void 0:s.some(r=>!Object.prototype.hasOwnProperty.call(t,r)))throw Error(`parent schema must have dependencies of ${n}: ${s.join(",")}`);if(a.validateSchema&&!a.validateSchema(t[n])){let t=`keyword "${n}" value is invalid at path "${i}": `+o.errorsText(a.validateSchema.errors);if("log"===r.validateSchema)o.logger.error(t);else throw Error(t)}}}),uE=q(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.extendSubschemaMode=t.extendSubschemaData=t.getSubschema=void 0;let r=uf(),o=uy();t.getSubschema=function(t,{keyword:i,schemaProp:a,schema:n,schemaPath:s,errSchemaPath:l,topSchemaRef:c}){if(void 0!==i&&void 0!==n)throw Error('both "keyword" and "schema" passed, only one allowed');if(void 0!==i){let n=t.schema[i];return void 0===a?{schema:n,schemaPath:(0,r._)`${t.schemaPath}${(0,r.getProperty)(i)}`,errSchemaPath:`${t.errSchemaPath}/${i}`}:{schema:n[a],schemaPath:(0,r._)`${t.schemaPath}${(0,r.getProperty)(i)}${(0,r.getProperty)(a)}`,errSchemaPath:`${t.errSchemaPath}/${i}/${(0,o.escapeFragment)(a)}`}}if(void 0!==n){if(void 0===s||void 0===l||void 0===c)throw Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:n,schemaPath:s,topSchemaRef:c,errSchemaPath:l}}throw Error('either "keyword" or "schema" must be passed')},t.extendSubschemaData=function(t,i,{dataProp:a,dataPropType:n,data:s,dataTypes:l,propertyName:c}){if(void 0!==s&&void 0!==a)throw Error('both "data" and "dataProp" passed, only one allowed');let{gen:u}=i;if(void 0!==a){let{errorPath:s,dataPathArr:l,opts:c}=i;d(u.let("data",(0,r._)`${i.data}${(0,r.getProperty)(a)}`,!0)),t.errorPath=(0,r.str)`${s}${(0,o.getErrorPath)(a,n,c.jsPropertySyntax)}`,t.parentDataProperty=(0,r._)`${a}`,t.dataPathArr=[...l,t.parentDataProperty]}function d(r){t.data=r,t.dataLevel=i.dataLevel+1,t.dataTypes=[],i.definedProperties=new Set,t.parentData=i.data,t.dataNames=[...i.dataNames,r]}void 0!==s&&(d(s instanceof r.Name?s:u.let("data",s,!0)),void 0!==c&&(t.propertyName=c)),l&&(t.dataTypes=l)},t.extendSubschemaMode=function(t,{jtdDiscriminator:r,jtdMetadata:o,compositeRule:i,createErrors:a,allErrors:n}){void 0!==i&&(t.compositeRule=i),void 0!==a&&(t.createErrors=a),void 0!==n&&(t.allErrors=n),t.jtdDiscriminator=r,t.jtdMetadata=o}}),uk=q((t,r)=>{r.exports=function t(r,o){if(r===o)return!0;if(r&&o&&"object"==typeof r&&"object"==typeof o){if(r.constructor!==o.constructor)return!1;if(Array.isArray(r)){if((i=r.length)!=o.length)return!1;for(a=i;0!=a--;)if(!t(r[a],o[a]))return!1;return!0}if(r.constructor===RegExp)return r.source===o.source&&r.flags===o.flags;if(r.valueOf!==Object.prototype.valueOf)return r.valueOf()===o.valueOf();if(r.toString!==Object.prototype.toString)return r.toString()===o.toString();if((i=(n=Object.keys(r)).length)!==Object.keys(o).length)return!1;for(a=i;0!=a--;)if(!Object.prototype.hasOwnProperty.call(o,n[a]))return!1;for(a=i;0!=a--;){var i,a,n,s=n[a];if(!t(r[s],o[s]))return!1}return!0}return r!=r&&o!=o}}),ux=q((t,r)=>{var o=r.exports=function(t,r,i){"function"==typeof r&&(i=r,r={});var a="function"==typeof(i=r.cb||i)?i:i.pre||function(){};!function t(r,i,a,n,s,l,c,u,d,p){if(n&&"object"==typeof n&&!Array.isArray(n)){for(var h in i(n,s,l,c,u,d,p),n){var m,f=n[h];if(Array.isArray(f)){if(h in o.arrayKeywords)for(var y=0;y<f.length;y++)t(r,i,a,f[y],s+"/"+h+"/"+y,l,s,h,n,y)}else if(h in o.propsKeywords){if(f&&"object"==typeof f)for(var g in f){t(r,i,a,f[g],s+"/"+h+"/"+(m=g).replace(/~/g,"~0").replace(/\//g,"~1"),l,s,h,n,g)}}else(h in o.keywords||r.allKeys&&!(h in o.skipKeywords))&&t(r,i,a,f,s+"/"+h,l,s,h,n)}a(n,s,l,c,u,d,p)}}(r,a,i.post||function(){},t,"",t)};o.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0},o.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},o.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},o.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}}),uT=q(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getSchemaRefs=t.resolveUrl=t.normalizeId=t._getFullPath=t.getFullPath=t.inlineRef=void 0;let r=uy(),o=uk(),i=ux(),a=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);t.inlineRef=function(t,o=!0){return"boolean"==typeof t||(!0===o?!function t(r){for(let o in r){if(n.has(o))return!0;let i=r[o];if(Array.isArray(i)&&i.some(t)||"object"==typeof i&&t(i))return!0}return!1}(t):!!o&&function t(o){let i=0;for(let n in o)if("$ref"===n||(i++,!a.has(n)&&("object"==typeof o[n]&&(0,r.eachItem)(o[n],r=>i+=t(r)),i===1/0)))return 1/0;return i}(t)<=o)};let n=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function s(t,r="",o){return!1!==o&&(r=u(r)),l(t,t.parse(r))}function l(t,r){return t.serialize(r).split("#")[0]+"#"}t.getFullPath=s,t._getFullPath=l;let c=/#\/?$/;function u(t){return t?t.replace(c,""):""}t.normalizeId=u,t.resolveUrl=function(t,r,o){return o=u(o),t.resolve(r,o)};let d=/^[a-z_][-a-z0-9._]*$/i;t.getSchemaRefs=function(t,r){if("boolean"==typeof t)return{};let{schemaId:a,uriResolver:n}=this.opts,l=u(t[a]||r),c={"":l},p=s(n,l,!1),h={},m=new Set;return i(t,{allKeys:!0},(t,r,o,i)=>{if(void 0===i)return;let n=p+r,s=c[i];function l(r){let o=this.opts.uriResolver.resolve;if(r=u(s?o(s,r):r),m.has(r))throw y(r);m.add(r);let i=this.refs[r];return"string"==typeof i&&(i=this.refs[i]),"object"==typeof i?f(t,i.schema,r):r!==u(n)&&("#"===r[0]?(f(t,h[r],r),h[r]=t):this.refs[r]=n),r}function g(t){if("string"==typeof t){if(!d.test(t))throw Error(`invalid anchor "${t}"`);l.call(this,`#${t}`)}}"string"==typeof t[a]&&(s=l.call(this,t[a])),g.call(this,t.$anchor),g.call(this,t.$dynamicAnchor),c[r]=s}),h;function f(t,r,i){if(void 0!==r&&!o(t,r))throw y(i)}function y(t){return Error(`reference "${t}" resolves to more than one schema`)}}}),uO=q(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getData=t.KeywordCxt=t.validateFunctionCode=void 0;let r=u_(),o=uw(),i=uS(),a=uw(),n=u$(),s=uR(),l=uE(),c=uf(),u=ug(),d=uT(),p=uy(),h=uv();function m({gen:t,validateName:r,schema:o,schemaEnv:i,opts:a},n){var s;a.code.es5?t.func(r,(0,c._)`${u.default.data}, ${u.default.valCxt}`,i.$async,()=>{var r,i;t.code((0,c._)`"use strict"; ${f(o,a)}`),r=t,i=a,r.if(u.default.valCxt,()=>{r.var(u.default.instancePath,(0,c._)`${u.default.valCxt}.${u.default.instancePath}`),r.var(u.default.parentData,(0,c._)`${u.default.valCxt}.${u.default.parentData}`),r.var(u.default.parentDataProperty,(0,c._)`${u.default.valCxt}.${u.default.parentDataProperty}`),r.var(u.default.rootData,(0,c._)`${u.default.valCxt}.${u.default.rootData}`),i.dynamicRef&&r.var(u.default.dynamicAnchors,(0,c._)`${u.default.valCxt}.${u.default.dynamicAnchors}`)},()=>{r.var(u.default.instancePath,(0,c._)`""`),r.var(u.default.parentData,(0,c._)`undefined`),r.var(u.default.parentDataProperty,(0,c._)`undefined`),r.var(u.default.rootData,u.default.data),i.dynamicRef&&r.var(u.default.dynamicAnchors,(0,c._)`{}`)}),t.code(n)}):t.func(r,(0,c._)`${u.default.data}, ${(s=a,(0,c._)`{${u.default.instancePath}="", ${u.default.parentData}, ${u.default.parentDataProperty}, ${u.default.rootData}=${u.default.data}${s.dynamicRef?(0,c._)`, ${u.default.dynamicAnchors}={}`:c.nil}}={}`)}`,i.$async,()=>t.code(f(o,a)).code(n))}function f(t,r){let o="object"==typeof t&&t[r.schemaId];return o&&(r.code.source||r.code.process)?(0,c._)`/*# sourceURL=${o} */`:c.nil}function y({schema:t,self:r}){if("boolean"==typeof t)return!t;for(let o in t)if(r.RULES.all[o])return!0;return!1}function g(t){return"boolean"!=typeof t.schema}function v(t){(0,p.checkUnknownRules)(t),function(t){let{schema:r,errSchemaPath:o,opts:i,self:a}=t;r.$ref&&i.ignoreKeywordsWithRef&&(0,p.schemaHasRulesButRef)(r,a.RULES)&&a.logger.warn(`$ref: keywords ignored in schema at path "${o}"`)}(t)}function _(t,r){if(t.opts.jtd)return S(t,[],!1,r);let i=(0,o.getSchemaTypes)(t.schema);S(t,i,!(0,o.coerceAndCheckDataType)(t,i),r)}function b({gen:t,schemaEnv:r,schema:o,errSchemaPath:i,opts:a}){let n=o.$comment;if(!0===a.$comment)t.code((0,c._)`${u.default.self}.logger.log(${n})`);else if("function"==typeof a.$comment){let o=(0,c.str)`${i}/$comment`,a=t.scopeValue("root",{ref:r.root});t.code((0,c._)`${u.default.self}.opts.$comment(${n}, ${o}, ${a}.schema)`)}}function S(t,r,o,n){var s,l,d,h;let{gen:m,schema:f,data:y,allErrors:g,opts:v,self:_}=t,{RULES:b}=_;if(f.$ref&&(v.ignoreKeywordsWithRef||!(0,p.schemaHasRulesButRef)(f,b)))return void m.block(()=>E(t,"$ref",b.all.$ref.definition));function S(s){(0,i.shouldUseGroup)(f,s)&&(s.type?(m.if((0,a.checkDataType)(s.type,y,v.strictNumbers)),w(t,s),1===r.length&&r[0]===s.type&&o&&(m.else(),(0,a.reportTypeError)(t)),m.endIf()):w(t,s),g||m.if((0,c._)`${u.default.errors} === ${n||0}`))}v.jtd||(s=t,l=r,!s.schemaEnv.meta&&s.opts.strictTypes&&(function(t,r){if(r.length){if(!t.dataTypes.length){t.dataTypes=r;return}r.forEach(r=>{$(t.dataTypes,r)||P(t,`type "${r}" not allowed by context "${t.dataTypes.join(",")}"`)}),function(t,r){let o=[];for(let i of t.dataTypes)$(r,i)?o.push(i):r.includes("integer")&&"number"===i&&o.push("integer");t.dataTypes=o}(t,r)}}(s,l),s.opts.allowUnionTypes||(d=s,(h=l).length>1&&!(2===h.length&&h.includes("null"))&&P(d,"use allowUnionTypes to allow union type keyword")),function(t,r){let o=t.self.RULES.all;for(let a in o){let n=o[a];if("object"==typeof n&&(0,i.shouldUseRule)(t.schema,n)){let{type:o}=n.definition;o.length&&!o.some(t=>{var o,i;return o=r,i=t,o.includes(i)||"number"===i&&o.includes("integer")})&&P(t,`missing type "${o.join(",")}" for keyword "${a}"`)}}}(s,s.dataTypes))),m.block(()=>{for(let t of b.rules)S(t);S(b.post)})}function w(t,r){let{gen:o,schema:a,opts:{useDefaults:s}}=t;s&&(0,n.assignDefaults)(t,r.type),o.block(()=>{for(let o of r.rules)(0,i.shouldUseRule)(a,o)&&E(t,o.keyword,o.definition,r.type)})}function $(t,r){return t.includes(r)||"integer"===r&&t.includes("number")}function P(t,r){let o=t.schemaEnv.baseId+t.errSchemaPath;r+=` at "${o}" (strictTypes)`,(0,p.checkStrictMode)(t,r,t.opts.strictTypes)}t.validateFunctionCode=function(t){g(t)&&(v(t),y(t))?function(t){let{schema:r,opts:o,gen:i}=t;m(t,()=>{o.$comment&&r.$comment&&b(t),function(t){let{schema:r,opts:o}=t;void 0!==r.default&&o.useDefaults&&o.strictSchema&&(0,p.checkStrictMode)(t,"default is ignored in the schema root")}(t),i.let(u.default.vErrors,null),i.let(u.default.errors,0),o.unevaluated&&function(t){let{gen:r,validateName:o}=t;t.evaluated=r.const("evaluated",(0,c._)`${o}.evaluated`),r.if((0,c._)`${t.evaluated}.dynamicProps`,()=>r.assign((0,c._)`${t.evaluated}.props`,(0,c._)`undefined`)),r.if((0,c._)`${t.evaluated}.dynamicItems`,()=>r.assign((0,c._)`${t.evaluated}.items`,(0,c._)`undefined`))}(t),_(t),function(t){let{gen:r,schemaEnv:o,validateName:i,ValidationError:a,opts:n}=t;o.$async?r.if((0,c._)`${u.default.errors} === 0`,()=>r.return(u.default.data),()=>r.throw((0,c._)`new ${a}(${u.default.vErrors})`)):(r.assign((0,c._)`${i}.errors`,u.default.vErrors),n.unevaluated&&function({gen:t,evaluated:r,props:o,items:i}){o instanceof c.Name&&t.assign((0,c._)`${r}.props`,o),i instanceof c.Name&&t.assign((0,c._)`${r}.items`,i)}(t),r.return((0,c._)`${u.default.errors} === 0`))}(t)})}(t):m(t,()=>(0,r.topBoolOrEmptySchema)(t))};var R=class{constructor(t,r,o){if((0,s.validateKeywordUsage)(t,r,o),this.gen=t.gen,this.allErrors=t.allErrors,this.keyword=o,this.data=t.data,this.schema=t.schema[o],this.$data=r.$data&&t.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,p.schemaRefOrVal)(t,this.schema,o,this.$data),this.schemaType=r.schemaType,this.parentSchema=t.schema,this.params={},this.it=t,this.def=r,this.$data)this.schemaCode=t.gen.const("vSchema",T(this.$data,t));else if(this.schemaCode=this.schemaValue,!(0,s.validSchemaType)(this.schema,r.schemaType,r.allowUndefined))throw Error(`${o} value must be ${JSON.stringify(r.schemaType)}`);("code"in r?r.trackErrors:!1!==r.errors)&&(this.errsCount=t.gen.const("_errs",u.default.errors))}result(t,r,o){this.failResult((0,c.not)(t),r,o)}failResult(t,r,o){this.gen.if(t),o?o():this.error(),r?(this.gen.else(),r(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(t,r){this.failResult((0,c.not)(t),void 0,r)}fail(t){if(void 0===t){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(t),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(t){if(!this.$data)return this.fail(t);let{schemaCode:r}=this;this.fail((0,c._)`${r} !== undefined && (${(0,c.or)(this.invalid$data(),t)})`)}error(t,r,o){if(r){this.setParams(r),this._error(t,o),this.setParams({});return}this._error(t,o)}_error(t,r){(t?h.reportExtraError:h.reportError)(this,this.def.error,r)}$dataError(){(0,h.reportError)(this,this.def.$dataError||h.keyword$DataError)}reset(){if(void 0===this.errsCount)throw Error('add "trackErrors" to keyword definition');(0,h.resetErrorsCount)(this.gen,this.errsCount)}ok(t){this.allErrors||this.gen.if(t)}setParams(t,r){r?Object.assign(this.params,t):this.params=t}block$data(t,r,o=c.nil){this.gen.block(()=>{this.check$data(t,o),r()})}check$data(t=c.nil,r=c.nil){if(!this.$data)return;let{gen:o,schemaCode:i,schemaType:a,def:n}=this;o.if((0,c.or)((0,c._)`${i} === undefined`,r)),t!==c.nil&&o.assign(t,!0),(a.length||n.validateSchema)&&(o.elseIf(this.invalid$data()),this.$dataError(),t!==c.nil&&o.assign(t,!1)),o.else()}invalid$data(){let{gen:t,schemaCode:r,schemaType:o,def:i,it:n}=this;return(0,c.or)(function(){if(o.length){if(!(r instanceof c.Name))throw Error("ajv implementation error");let t=Array.isArray(o)?o:[o];return(0,c._)`${(0,a.checkDataTypes)(t,r,n.opts.strictNumbers,a.DataType.Wrong)}`}return c.nil}(),function(){if(i.validateSchema){let o=t.scopeValue("validate$data",{ref:i.validateSchema});return(0,c._)`!${o}(${r})`}return c.nil}())}subschema(t,o){let i=(0,l.getSubschema)(this.it,t);(0,l.extendSubschemaData)(i,this.it,t),(0,l.extendSubschemaMode)(i,t);let a={...this.it,...i,items:void 0,props:void 0};return!function(t,o){if(g(t)&&(v(t),y(t)))return function(t,r){var o;let i,{schema:a,gen:n,opts:s}=t;s.$comment&&a.$comment&&b(t),(i=(o=t).schema[o.opts.schemaId])&&(o.baseId=(0,d.resolveUrl)(o.opts.uriResolver,o.baseId,i)),function(t){if(t.schema.$async&&!t.schemaEnv.$async)throw Error("async schema in sync schema")}(t);let l=n.const("_errs",u.default.errors);_(t,l),n.var(r,(0,c._)`${l} === ${u.default.errors}`)}(t,o);(0,r.boolOrEmptySchema)(t,o)}(a,o),a}mergeEvaluated(t,r){let{it:o,gen:i}=this;o.opts.unevaluated&&(!0!==o.props&&void 0!==t.props&&(o.props=p.mergeEvaluated.props(i,t.props,o.props,r)),!0!==o.items&&void 0!==t.items&&(o.items=p.mergeEvaluated.items(i,t.items,o.items,r)))}mergeValidEvaluated(t,r){let{it:o,gen:i}=this;if(o.opts.unevaluated&&(!0!==o.props||!0!==o.items))return i.if(r,()=>this.mergeEvaluated(t,c.Name)),!0}};function E(t,r,o,i){let a=new R(t,o,r);"code"in o?o.code(a,i):a.$data&&o.validate?(0,s.funcKeywordCode)(a,o):"macro"in o?(0,s.macroKeywordCode)(a,o):(o.compile||o.validate)&&(0,s.funcKeywordCode)(a,o)}t.KeywordCxt=R;let k=/^\/(?:[^~]|~0|~1)*$/,x=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function T(t,{dataLevel:r,dataNames:o,dataPathArr:i}){let a,n;if(""===t)return u.default.rootData;if("/"===t[0]){if(!k.test(t))throw Error(`Invalid JSON-pointer: ${t}`);a=t,n=u.default.rootData}else{let s=x.exec(t);if(!s)throw Error(`Invalid JSON-pointer: ${t}`);let c=+s[1];if("#"===(a=s[2])){if(c>=r)throw Error(l("property/index",c));return i[r-c]}if(c>r)throw Error(l("data",c));if(n=o[r-c],!a)return n}let s=n;for(let t of a.split("/"))t&&(n=(0,c._)`${n}${(0,c.getProperty)((0,p.unescapeJsonPointer)(t))}`,s=(0,c._)`${s} && ${n}`);return s;function l(t,o){return`Cannot access ${t} ${o} levels up, current level is ${r}`}}t.getData=T}),uC=q(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default=class extends Error{constructor(t){super("validation failed"),this.errors=t,this.ajv=this.validation=!0}}}),uj=q(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uT();t.default=class extends Error{constructor(t,o,i,a){super(a||`can't resolve reference ${i} from id ${o}`),this.missingRef=(0,r.resolveUrl)(t,o,i),this.missingSchema=(0,r.normalizeId)((0,r.getFullPath)(t,this.missingRef))}}}),uI=q(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.resolveSchema=t.getCompilingSchema=t.resolveRef=t.compileSchema=t.SchemaEnv=void 0;let r=uf(),o=uC(),i=ug(),a=uT(),n=uy(),s=uO();var l=class{constructor(t){var r;let o;this.refs={},this.dynamicAnchors={},"object"==typeof t.schema&&(o=t.schema),this.schema=t.schema,this.schemaId=t.schemaId,this.root=t.root||this,this.baseId=null!=(r=t.baseId)?r:(0,a.normalizeId)(null==o?void 0:o[t.schemaId||"$id"]),this.schemaPath=t.schemaPath,this.localRefs=t.localRefs,this.meta=t.meta,this.$async=null==o?void 0:o.$async,this.refs={}}};function c(t){let n,l,c=d.call(this,t);if(c)return c;let u=(0,a.getFullPath)(this.opts.uriResolver,t.root.baseId),{es5:p,lines:h}=this.opts.code,{ownProperties:m}=this.opts,f=new r.CodeGen(this.scope,{es5:p,lines:h,ownProperties:m});t.$async&&(n=f.scopeValue("Error",{ref:o.default,code:(0,r._)`require("ajv/dist/runtime/validation_error").default`}));let y=f.scopeName("validate");t.validateName=y;let g={gen:f,allErrors:this.opts.allErrors,data:i.default.data,parentData:i.default.parentData,parentDataProperty:i.default.parentDataProperty,dataNames:[i.default.data],dataPathArr:[r.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:f.scopeValue("schema",!0===this.opts.code.source?{ref:t.schema,code:(0,r.stringify)(t.schema)}:{ref:t.schema}),validateName:y,ValidationError:n,schema:t.schema,schemaEnv:t,rootId:u,baseId:t.baseId||u,schemaPath:r.nil,errSchemaPath:t.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,r._)`""`,opts:this.opts,self:this};try{this._compilations.add(t),(0,s.validateFunctionCode)(g),f.optimize(this.opts.code.optimize);let o=f.toString();l=`${f.scopeRefs(i.default.scope)}return ${o}`,this.opts.code.process&&(l=this.opts.code.process(l,t));let a=Function(`${i.default.self}`,`${i.default.scope}`,l)(this,this.scope.get());if(this.scope.value(y,{ref:a}),a.errors=null,a.schema=t.schema,a.schemaEnv=t,t.$async&&(a.$async=!0),!0===this.opts.code.source&&(a.source={validateName:y,validateCode:o,scopeValues:f._values}),this.opts.unevaluated){let{props:t,items:o}=g;a.evaluated={props:t instanceof r.Name?void 0:t,items:o instanceof r.Name?void 0:o,dynamicProps:t instanceof r.Name,dynamicItems:o instanceof r.Name},a.source&&(a.source.evaluated=(0,r.stringify)(a.evaluated))}return t.validate=a,t}catch(r){throw delete t.validate,delete t.validateName,l&&this.logger.error("Error compiling schema, function code:",l),r}finally{this._compilations.delete(t)}}function u(t){return(0,a.inlineRef)(t.schema,this.opts.inlineRefs)?t.schema:t.validate?t:c.call(this,t)}function d(t){for(let i of this._compilations){var r,o;if(r=i,o=t,r.schema===o.schema&&r.root===o.root&&r.baseId===o.baseId)return i}}function p(t,r){let o;for(;"string"==typeof(o=this.refs[r]);)r=o;return o||this.schemas[r]||h.call(this,t,r)}function h(t,r){let o=this.opts.uriResolver.parse(r),i=(0,a._getFullPath)(this.opts.uriResolver,o),n=(0,a.getFullPath)(this.opts.uriResolver,t.baseId,void 0);if(Object.keys(t.schema).length>0&&i===n)return f.call(this,o,t);let s=(0,a.normalizeId)(i),u=this.refs[s]||this.schemas[s];if("string"==typeof u){let r=h.call(this,t,u);if("object"!=typeof(null==r?void 0:r.schema))return;return f.call(this,o,r)}if("object"==typeof(null==u?void 0:u.schema)){if(u.validate||c.call(this,u),s===(0,a.normalizeId)(r)){let{schema:r}=u,{schemaId:o}=this.opts,i=r[o];return i&&(n=(0,a.resolveUrl)(this.opts.uriResolver,n,i)),new l({schema:r,schemaId:o,root:t,baseId:n})}return f.call(this,o,u)}}t.SchemaEnv=l,t.compileSchema=c,t.resolveRef=function(t,r,o){var i;o=(0,a.resolveUrl)(this.opts.uriResolver,r,o);let n=t.refs[o];if(n)return n;let s=p.call(this,t,o);if(void 0===s){let a=null==(i=t.localRefs)?void 0:i[o],{schemaId:n}=this.opts;a&&(s=new l({schema:a,schemaId:n,root:t,baseId:r}))}if(void 0!==s)return t.refs[o]=u.call(this,s)},t.getCompilingSchema=d,t.resolveSchema=h;let m=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function f(t,{baseId:r,schema:o,root:i}){var s;let c;if((null==(s=t.fragment)?void 0:s[0])!=="/")return;for(let i of t.fragment.slice(1).split("/")){if("boolean"==typeof o)return;let t=o[(0,n.unescapeFragment)(i)];if(void 0===t)return;let s="object"==typeof(o=t)&&o[this.opts.schemaId];!m.has(i)&&s&&(r=(0,a.resolveUrl)(this.opts.uriResolver,r,s))}if("boolean"!=typeof o&&o.$ref&&!(0,n.schemaHasRulesButRef)(o,this.RULES)){let t=(0,a.resolveUrl)(this.opts.uriResolver,r,o.$ref);c=h.call(this,i,t)}let{schemaId:u}=this.opts;if((c=c||new l({schema:o,schemaId:u,root:i,baseId:r})).schema!==c.root.schema)return c}}),uN=q((t,r)=>{r.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}}),uA=q((t,r)=>{let o=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),i=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(t){let r="",o=0,i=0;for(i=0;i<t.length;i++)if(48!==(o=t[i].charCodeAt(0))){if(!(o>=48&&o<=57||o>=65&&o<=70||o>=97&&o<=102))return"";r+=t[i];break}for(i+=1;i<t.length;i++){if(!((o=t[i].charCodeAt(0))>=48&&o<=57||o>=65&&o<=70||o>=97&&o<=102))return"";r+=t[i]}return r}let n=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function s(t){return t.length=0,!0}function l(t,r,o){if(t.length){let i=a(t);if(""===i)return o.error=!0,!1;r.push(i),t.length=0}return!0}function c(t){if(2>function(t,r){let o=0;for(let r=0;r<t.length;r++)":"===t[r]&&o++;return o}(t,":"))return{host:t,isIPV6:!1};let r=function(t){let r=0,o={error:!1,address:"",zone:""},i=[],n=[],c=!1,u=!1,d=l;for(let a=0;a<t.length;a++){let l=t[a];if("["!==l&&"]"!==l)if(":"===l){if(!0===c&&(u=!0),!d(n,i,o))break;if(++r>7){o.error=!0;break}a>0&&":"===t[a-1]&&(c=!0),i.push(":");continue}else if("%"===l){if(!d(n,i,o))break;d=s}else{n.push(l);continue}}return n.length&&(d===s?o.zone=n.join(""):u?i.push(n.join("")):i.push(a(n))),o.address=i.join(""),o}(t);if(r.error)return{host:t,isIPV6:!1};{let t=r.address,o=r.address;return r.zone&&(t+="%"+r.zone,o+="%25"+r.zone),{host:t,isIPV6:!0,escapedHost:o}}}r.exports={nonSimpleDomain:n,recomposeAuthority:function(t){let r=[];if(void 0!==t.userinfo&&(r.push(t.userinfo),r.push("@")),void 0!==t.host){let o=unescape(t.host);if(!i(o)){let r=c(o);o=!0===r.isIPV6?`[${r.escapedHost}]`:t.host}r.push(o)}return("number"==typeof t.port||"string"==typeof t.port)&&(r.push(":"),r.push(String(t.port))),r.length?r.join(""):void 0},normalizeComponentEncoding:function(t,r){let o=!0!==r?escape:unescape;return void 0!==t.scheme&&(t.scheme=o(t.scheme)),void 0!==t.userinfo&&(t.userinfo=o(t.userinfo)),void 0!==t.host&&(t.host=o(t.host)),void 0!==t.path&&(t.path=o(t.path)),void 0!==t.query&&(t.query=o(t.query)),void 0!==t.fragment&&(t.fragment=o(t.fragment)),t},removeDotSegments:function(t){let r=t,o=[],i=-1,a=0;for(;a=r.length;){if(1===a)if("."===r)break;else if("/"===r){o.push("/");break}else{o.push(r);break}if(2===a){if("."===r[0]){if("."===r[1])break;else if("/"===r[1]){r=r.slice(2);continue}}else if("/"===r[0]&&("."===r[1]||"/"===r[1])){o.push("/");break}}else if(3===a&&"/.."===r){0!==o.length&&o.pop(),o.push("/");break}if("."===r[0]){if("."===r[1]){if("/"===r[2]){r=r.slice(3);continue}}else if("/"===r[1]){r=r.slice(2);continue}}else if("/"===r[0]&&"."===r[1]){if("/"===r[2]){r=r.slice(2);continue}else if("."===r[2]&&"/"===r[3]){r=r.slice(3),0!==o.length&&o.pop();continue}}if(-1===(i=r.indexOf("/",1))){o.push(r);break}o.push(r.slice(0,i)),r=r.slice(i)}return o.join("")},isIPv4:i,isUUID:o,normalizeIPv6:c,stringArrayToHexStripped:a}}),uz=q((t,r)=>{let{isUUID:o}=uA(),i=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,a=["http","https","ws","wss","urn","urn:uuid"];function n(t){return!0===t.secure||!1!==t.secure&&!!t.scheme&&3===t.scheme.length&&("w"===t.scheme[0]||"W"===t.scheme[0])&&("s"===t.scheme[1]||"S"===t.scheme[1])&&("s"===t.scheme[2]||"S"===t.scheme[2])}function s(t){return t.host||(t.error=t.error||"HTTP URIs must have a host."),t}function l(t){let r="https"===String(t.scheme).toLowerCase();return(t.port===(r?443:80)||""===t.port)&&(t.port=void 0),t.path||(t.path="/"),t}let c={scheme:"http",domainHost:!0,parse:s,serialize:l},u={scheme:"https",domainHost:c.domainHost,parse:s,serialize:l},d={scheme:"ws",domainHost:!0,parse:function(t){return t.secure=n(t),t.resourceName=(t.path||"/")+(t.query?"?"+t.query:""),t.path=void 0,t.query=void 0,t},serialize:function(t){if((t.port===(n(t)?443:80)||""===t.port)&&(t.port=void 0),"boolean"==typeof t.secure&&(t.scheme=t.secure?"wss":"ws",t.secure=void 0),t.resourceName){let[r,o]=t.resourceName.split("?");t.path=r&&"/"!==r?r:void 0,t.query=o,t.resourceName=void 0}return t.fragment=void 0,t}},p={scheme:"wss",domainHost:d.domainHost,parse:d.parse,serialize:d.serialize},h={http:c,https:u,ws:d,wss:p,urn:{scheme:"urn",parse:function(t,r){if(!t.path)return t.error="URN can not be parsed",t;let o=t.path.match(i);if(o){let i=r.scheme||t.scheme||"urn";t.nid=o[1].toLowerCase(),t.nss=o[2];let a=m(`${i}:${r.nid||t.nid}`);t.path=void 0,a&&(t=a.parse(t,r))}else t.error=t.error||"URN can not be parsed.";return t},serialize:function(t,r){if(void 0===t.nid)throw Error("URN without nid cannot be serialized");let o=r.scheme||t.scheme||"urn",i=t.nid.toLowerCase(),a=m(`${o}:${r.nid||i}`);a&&(t=a.serialize(t,r));let n=t,s=t.nss;return n.path=`${i||r.nid}:${s}`,r.skipEscape=!0,n},skipNormalize:!0},"urn:uuid":{scheme:"urn:uuid",parse:function(t,r){return t.uuid=t.nss,t.nss=void 0,r.tolerant||t.uuid&&o(t.uuid)||(t.error=t.error||"UUID is not valid."),t},serialize:function(t){return t.nss=(t.uuid||"").toLowerCase(),t},skipNormalize:!0}};function m(t){return t&&(h[t]||h[t.toLowerCase()])||void 0}Object.setPrototypeOf(h,null),r.exports={wsIsSecure:n,SCHEMES:h,isValidSchemeName:function(t){return -1!==a.indexOf(t)},getSchemeHandler:m}}),uq=q((t,r)=>{let{normalizeIPv6:o,removeDotSegments:i,recomposeAuthority:a,normalizeComponentEncoding:n,isIPv4:s,nonSimpleDomain:l}=uA(),{SCHEMES:c,getSchemeHandler:u}=uz();function d(t,r,o,a){let n={};return a||(t=m(p(t,o),o),r=m(p(r,o),o)),!(o=o||{}).tolerant&&r.scheme?(n.scheme=r.scheme,n.userinfo=r.userinfo,n.host=r.host,n.port=r.port,n.path=i(r.path||""),n.query=r.query):(void 0!==r.userinfo||void 0!==r.host||void 0!==r.port?(n.userinfo=r.userinfo,n.host=r.host,n.port=r.port,n.path=i(r.path||""),n.query=r.query):(r.path?("/"===r.path[0]?n.path=i(r.path):(void 0===t.userinfo&&void 0===t.host&&void 0===t.port||t.path?t.path?n.path=t.path.slice(0,t.path.lastIndexOf("/")+1)+r.path:n.path=r.path:n.path="/"+r.path,n.path=i(n.path)),n.query=r.query):(n.path=t.path,void 0!==r.query?n.query=r.query:n.query=t.query),n.userinfo=t.userinfo,n.host=t.host,n.port=t.port),n.scheme=t.scheme),n.fragment=r.fragment,n}function p(t,r){let o={host:t.host,scheme:t.scheme,userinfo:t.userinfo,port:t.port,path:t.path,query:t.query,nid:t.nid,nss:t.nss,uuid:t.uuid,fragment:t.fragment,reference:t.reference,resourceName:t.resourceName,secure:t.secure,error:""},n=Object.assign({},r),s=[],l=u(n.scheme||o.scheme);l&&l.serialize&&l.serialize(o,n),void 0!==o.path&&(n.skipEscape?o.path=unescape(o.path):(o.path=escape(o.path),void 0!==o.scheme&&(o.path=o.path.split("%3A").join(":")))),"suffix"!==n.reference&&o.scheme&&s.push(o.scheme,":");let c=a(o);if(void 0!==c&&("suffix"!==n.reference&&s.push("//"),s.push(c),o.path&&"/"!==o.path[0]&&s.push("/")),void 0!==o.path){let t=o.path;n.absolutePath||l&&l.absolutePath||(t=i(t)),void 0===c&&"/"===t[0]&&"/"===t[1]&&(t="/%2F"+t.slice(2)),s.push(t)}return void 0!==o.query&&s.push("?",o.query),void 0!==o.fragment&&s.push("#",o.fragment),s.join("")}let h=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function m(t,r){let i=Object.assign({},r),a={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},n=!1;"suffix"===i.reference&&(t=i.scheme?i.scheme+":"+t:"//"+t);let c=t.match(h);if(c){if(a.scheme=c[1],a.userinfo=c[3],a.host=c[4],a.port=parseInt(c[5],10),a.path=c[6]||"",a.query=c[7],a.fragment=c[8],isNaN(a.port)&&(a.port=c[5]),a.host)if(!1===s(a.host)){let t=o(a.host);a.host=t.host.toLowerCase(),n=t.isIPV6}else n=!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",i.reference&&"suffix"!==i.reference&&i.reference!==a.reference&&(a.error=a.error||"URI is not a "+i.reference+" reference.");let r=u(i.scheme||a.scheme);if(!i.unicodeSupport&&(!r||!r.unicodeSupport)&&a.host&&(i.domainHost||r&&r.domainHost)&&!1===n&&l(a.host))try{a.host=URL.domainToASCII(a.host.toLowerCase())}catch(t){a.error=a.error||"Host's domain name can not be converted to ASCII: "+t}(!r||r&&!r.skipNormalize)&&(-1!==t.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)))),r&&r.parse&&r.parse(a,i)}else a.error=a.error||"URI can not be parsed.";return a}let f={SCHEMES:c,normalize:function(t,r){return"string"==typeof t?t=p(m(t,r),r):"object"==typeof t&&(t=m(p(t,r),r)),t},resolve:function(t,r,o){let i=o?Object.assign({scheme:"null"},o):{scheme:"null"},a=d(m(t,i),m(r,i),i,!0);return i.skipEscape=!0,p(a,i)},resolveComponent:d,equal:function(t,r,o){return"string"==typeof t?t=p(n(m(t=unescape(t),o),!0),{...o,skipEscape:!0}):"object"==typeof t&&(t=p(n(t,!0),{...o,skipEscape:!0})),"string"==typeof r?r=p(n(m(r=unescape(r),o),!0),{...o,skipEscape:!0}):"object"==typeof r&&(r=p(n(r,!0),{...o,skipEscape:!0})),t.toLowerCase()===r.toLowerCase()},serialize:p,parse:m};r.exports=f,r.exports.default=f,r.exports.fastUri=f}),uM=q(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uq();r.code='require("ajv/dist/runtime/uri").default',t.default=r}),uL=q(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CodeGen=t.Name=t.nil=t.stringify=t.str=t._=t.KeywordCxt=void 0;var r=uO();Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return r.KeywordCxt}});var o=uf();Object.defineProperty(t,"_",{enumerable:!0,get:function(){return o._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return o.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return o.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return o.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return o.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return o.CodeGen}});let i=uC(),a=uj(),n=ub(),s=uI(),l=uf(),c=uT(),u=uw(),d=uy(),p=uN(),h=uM(),m=(t,r)=>new RegExp(t,r);m.code="new RegExp";let f=["removeAdditional","useDefaults","coerceTypes"],y=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),g={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."},v={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'};var _=class{constructor(t={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,t=this.opts={...t,...function(t){var r,o,i,a,n,s,l,c,u,d,p,f,y,g,v,_,b,S,w,$,P,R,E,k,x;let T=t.strict,O=null==(r=t.code)?void 0:r.optimize,C=!0===O||void 0===O?1:O||0,j=null!=(i=null==(o=t.code)?void 0:o.regExp)?i:m,I=null!=(a=t.uriResolver)?a:h.default;return{strictSchema:null==(s=null!=(n=t.strictSchema)?n:T)||s,strictNumbers:null==(c=null!=(l=t.strictNumbers)?l:T)||c,strictTypes:null!=(d=null!=(u=t.strictTypes)?u:T)?d:"log",strictTuples:null!=(f=null!=(p=t.strictTuples)?p:T)?f:"log",strictRequired:null!=(g=null!=(y=t.strictRequired)?y:T)&&g,code:t.code?{...t.code,optimize:C,regExp:j}:{optimize:C,regExp:j},loopRequired:null!=(v=t.loopRequired)?v:200,loopEnum:null!=(_=t.loopEnum)?_:200,meta:null==(b=t.meta)||b,messages:null==(S=t.messages)||S,inlineRefs:null==(w=t.inlineRefs)||w,schemaId:null!=($=t.schemaId)?$:"$id",addUsedSchema:null==(P=t.addUsedSchema)||P,validateSchema:null==(R=t.validateSchema)||R,validateFormats:null==(E=t.validateFormats)||E,unicodeRegExp:null==(k=t.unicodeRegExp)||k,int32range:null==(x=t.int32range)||x,uriResolver:I}}(t)};const{es5:r,lines:o}=this.opts.code;this.scope=new l.ValueScope({scope:{},prefixes:y,es5:r,lines:o}),this.logger=function(t){if(!1===t)return E;if(void 0===t)return console;if(t.log&&t.warn&&t.error)return t;throw Error("logger must implement log, warn and error methods")}(t.logger);const i=t.validateFormats;t.validateFormats=!1,this.RULES=(0,n.getRules)(),b.call(this,g,t,"NOT SUPPORTED"),b.call(this,v,t,"DEPRECATED","warn"),this._metaOpts=R.call(this),t.formats&&$.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),t.keywords&&P.call(this,t.keywords),"object"==typeof t.meta&&this.addMetaSchema(t.meta),w.call(this),t.validateFormats=i}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:t,meta:r,schemaId:o}=this.opts,i=p;"id"===o&&((i={...p}).id=i.$id,delete i.$id),r&&t&&this.addMetaSchema(i,i[o],!1)}defaultMeta(){let{meta:t,schemaId:r}=this.opts;return this.opts.defaultMeta="object"==typeof t?t[r]||t:void 0}validate(t,r){let o;if("string"==typeof t){if(!(o=this.getSchema(t)))throw Error(`no schema with key or ref "${t}"`)}else o=this.compile(t);let i=o(r);return"$async"in o||(this.errors=o.errors),i}compile(t,r){let o=this._addSchema(t,r);return o.validate||this._compileSchemaEnv(o)}compileAsync(t,r){if("function"!=typeof this.opts.loadSchema)throw Error("options.loadSchema should be a function");let{loadSchema:o}=this.opts;return i.call(this,t,r);async function i(t,r){await n.call(this,t.$schema);let o=this._addSchema(t,r);return o.validate||s.call(this,o)}async function n(t){t&&!this.getSchema(t)&&await i.call(this,{$ref:t},!0)}async function s(t){try{return this._compileSchemaEnv(t)}catch(r){if(!(r instanceof a.default))throw r;return l.call(this,r),await c.call(this,r.missingSchema),s.call(this,t)}}function l({missingSchema:t,missingRef:r}){if(this.refs[t])throw Error(`AnySchema ${t} is loaded but ${r} cannot be resolved`)}async function c(t){let o=await u.call(this,t);this.refs[t]||await n.call(this,o.$schema),this.refs[t]||this.addSchema(o,t,r)}async function u(t){let r=this._loading[t];if(r)return r;try{return await (this._loading[t]=o(t))}finally{delete this._loading[t]}}}addSchema(t,r,o,i=this.opts.validateSchema){let a;if(Array.isArray(t)){for(let r of t)this.addSchema(r,void 0,o,i);return this}if("object"==typeof t){let{schemaId:r}=this.opts;if(void 0!==(a=t[r])&&"string"!=typeof a)throw Error(`schema ${r} must be string`)}return r=(0,c.normalizeId)(r||a),this._checkUnique(r),this.schemas[r]=this._addSchema(t,o,r,i,!0),this}addMetaSchema(t,r,o=this.opts.validateSchema){return this.addSchema(t,r,!0,o),this}validateSchema(t,r){let o;if("boolean"==typeof t)return!0;if(void 0!==(o=t.$schema)&&"string"!=typeof o)throw Error("$schema must be a string");if(!(o=o||this.opts.defaultMeta||this.defaultMeta()))return this.logger.warn("meta-schema not available"),this.errors=null,!0;let i=this.validate(o,t);if(!i&&r){let t="schema is invalid: "+this.errorsText();if("log"===this.opts.validateSchema)this.logger.error(t);else throw Error(t)}return i}getSchema(t){let r;for(;"string"==typeof(r=S.call(this,t));)t=r;if(void 0===r){let{schemaId:o}=this.opts,i=new s.SchemaEnv({schema:{},schemaId:o});if(!(r=s.resolveSchema.call(this,i,t)))return;this.refs[t]=r}return r.validate||this._compileSchemaEnv(r)}removeSchema(t){if(t instanceof RegExp)return this._removeAllSchemas(this.schemas,t),this._removeAllSchemas(this.refs,t),this;switch(typeof t){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let r=S.call(this,t);return"object"==typeof r&&this._cache.delete(r.schema),delete this.schemas[t],delete this.refs[t],this}case"object":{this._cache.delete(t);let r=t[this.opts.schemaId];return r&&(r=(0,c.normalizeId)(r),delete this.schemas[r],delete this.refs[r]),this}default:throw Error("ajv.removeSchema: invalid parameter")}}addVocabulary(t){for(let r of t)this.addKeyword(r);return this}addKeyword(t,r){let o;if("string"==typeof t)o=t,"object"==typeof r&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),r.keyword=o);else if("object"==typeof t&&void 0===r){if(Array.isArray(o=(r=t).keyword)&&!o.length)throw Error("addKeywords: keyword must be string or non-empty array")}else throw Error("invalid addKeywords parameters");if(x.call(this,o,r),!r)return(0,d.eachItem)(o,t=>T.call(this,t)),this;C.call(this,r);let i={...r,type:(0,u.getJSONTypes)(r.type),schemaType:(0,u.getJSONTypes)(r.schemaType)};return(0,d.eachItem)(o,0===i.type.length?t=>T.call(this,t,i):t=>i.type.forEach(r=>T.call(this,t,i,r))),this}getKeyword(t){let r=this.RULES.all[t];return"object"==typeof r?r.definition:!!r}removeKeyword(t){let{RULES:r}=this;for(let o of(delete r.keywords[t],delete r.all[t],r.rules)){let r=o.rules.findIndex(r=>r.keyword===t);r>=0&&o.rules.splice(r,1)}return this}addFormat(t,r){return"string"==typeof r&&(r=new RegExp(r)),this.formats[t]=r,this}errorsText(t=this.errors,{separator:r=", ",dataVar:o="data"}={}){return t&&0!==t.length?t.map(t=>`${o}${t.instancePath} ${t.message}`).reduce((t,o)=>t+r+o):"No errors"}$dataMetaSchema(t,r){let o=this.RULES.all;for(let i of(t=JSON.parse(JSON.stringify(t)),r)){let r=i.split("/").slice(1),a=t;for(let t of r)a=a[t];for(let t in o){let r=o[t];if("object"!=typeof r)continue;let{$data:i}=r.definition,n=a[t];i&&n&&(a[t]=I(n))}}return t}_removeAllSchemas(t,r){for(let o in t){let i=t[o];(!r||r.test(o))&&("string"==typeof i?delete t[o]:i&&!i.meta&&(this._cache.delete(i.schema),delete t[o]))}}_addSchema(t,r,o,i=this.opts.validateSchema,a=this.opts.addUsedSchema){let n,{schemaId:l}=this.opts;if("object"==typeof t)n=t[l];else if(this.opts.jtd)throw Error("schema must be object");else if("boolean"!=typeof t)throw Error("schema must be object or boolean");let u=this._cache.get(t);if(void 0!==u)return u;o=(0,c.normalizeId)(n||o);let d=c.getSchemaRefs.call(this,t,o);return u=new s.SchemaEnv({schema:t,schemaId:l,meta:r,baseId:o,localRefs:d}),this._cache.set(u.schema,u),a&&!o.startsWith("#")&&(o&&this._checkUnique(o),this.refs[o]=u),i&&this.validateSchema(t,!0),u}_checkUnique(t){if(this.schemas[t]||this.refs[t])throw Error(`schema with key or id "${t}" already exists`)}_compileSchemaEnv(t){if(t.meta?this._compileMetaSchema(t):s.compileSchema.call(this,t),!t.validate)throw Error("ajv implementation error");return t.validate}_compileMetaSchema(t){let r=this.opts;this.opts=this._metaOpts;try{s.compileSchema.call(this,t)}finally{this.opts=r}}};function b(t,r,o,i="error"){for(let a in t)a in r&&this.logger[i](`${o}: option ${a}. ${t[a]}`)}function S(t){return t=(0,c.normalizeId)(t),this.schemas[t]||this.refs[t]}function w(){let t=this.opts.schemas;if(t)if(Array.isArray(t))this.addSchema(t);else for(let r in t)this.addSchema(t[r],r)}function $(){for(let t in this.opts.formats){let r=this.opts.formats[t];r&&this.addFormat(t,r)}}function P(t){if(Array.isArray(t))return void this.addVocabulary(t);for(let r in this.logger.warn("keywords option as map is deprecated, pass array"),t){let o=t[r];o.keyword||(o.keyword=r),this.addKeyword(o)}}function R(){let t={...this.opts};for(let r of f)delete t[r];return t}_.ValidationError=i.default,_.MissingRefError=a.default,t.default=_;let E={log(){},warn(){},error(){}},k=/^[a-z_$][a-z0-9_$:-]*$/i;function x(t,r){let{RULES:o}=this;if((0,d.eachItem)(t,t=>{if(o.keywords[t])throw Error(`Keyword ${t} is already defined`);if(!k.test(t))throw Error(`Keyword ${t} has invalid name`)}),r&&r.$data&&!("code"in r||"validate"in r))throw Error('$data keyword must have "code" or "validate" function')}function T(t,r,o){var i;let a=null==r?void 0:r.post;if(o&&a)throw Error('keyword with "post" flag cannot have "type"');let{RULES:n}=this,s=a?n.post:n.rules.find(({type:t})=>t===o);if(s||(s={type:o,rules:[]},n.rules.push(s)),n.keywords[t]=!0,!r)return;let l={keyword:t,definition:{...r,type:(0,u.getJSONTypes)(r.type),schemaType:(0,u.getJSONTypes)(r.schemaType)}};r.before?O.call(this,s,l,r.before):s.rules.push(l),n.all[t]=l,null==(i=r.implements)||i.forEach(t=>this.addKeyword(t))}function O(t,r,o){let i=t.rules.findIndex(t=>t.keyword===o);i>=0?t.rules.splice(i,0,r):(t.rules.push(r),this.logger.warn(`rule ${o} is not defined`))}function C(t){let{metaSchema:r}=t;void 0!==r&&(t.$data&&this.opts.$data&&(r=I(r)),t.validateSchema=this.compile(r,!0))}let j={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function I(t){return{anyOf:[t,j]}}}),uD=q(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default={keyword:"id",code(){throw Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}}}),uU=q(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.callRef=t.getValidate=void 0;let r=uj(),o=uP(),i=uf(),a=ug(),n=uI(),s=uy();function l(t,r){let{gen:o}=t;return r.validate?o.scopeValue("validate",{ref:r.validate}):(0,i._)`${o.scopeValue("wrapper",{ref:r})}.validate`}function c(t,r,n,l){let{gen:c,it:u}=t,{allErrors:d,schemaEnv:p,opts:h}=u,m=h.passContext?a.default.this:i.nil;function f(t){let r=(0,i._)`${t}.errors`;c.assign(a.default.vErrors,(0,i._)`${a.default.vErrors} === null ? ${r} : ${a.default.vErrors}.concat(${r})`),c.assign(a.default.errors,(0,i._)`${a.default.vErrors}.length`)}function y(t){var r;if(!u.opts.unevaluated)return;let o=null==(r=null==n?void 0:n.validate)?void 0:r.evaluated;if(!0!==u.props)if(o&&!o.dynamicProps)void 0!==o.props&&(u.props=s.mergeEvaluated.props(c,o.props,u.props));else{let r=c.var("props",(0,i._)`${t}.evaluated.props`);u.props=s.mergeEvaluated.props(c,r,u.props,i.Name)}if(!0!==u.items)if(o&&!o.dynamicItems)void 0!==o.items&&(u.items=s.mergeEvaluated.items(c,o.items,u.items));else{let r=c.var("items",(0,i._)`${t}.evaluated.items`);u.items=s.mergeEvaluated.items(c,r,u.items,i.Name)}}l?function(){if(!p.$async)throw Error("async schema referenced by sync schema");let a=c.let("valid");c.try(()=>{c.code((0,i._)`await ${(0,o.callValidateCode)(t,r,m)}`),y(r),d||c.assign(a,!0)},t=>{c.if((0,i._)`!(${t} instanceof ${u.ValidationError})`,()=>c.throw(t)),f(t),d||c.assign(a,!1)}),t.ok(a)}():t.result((0,o.callValidateCode)(t,r,m),()=>y(r),()=>f(r))}t.getValidate=l,t.callRef=c,t.default={keyword:"$ref",schemaType:"string",code(t){var o,a;let s,u,d,{gen:p,schema:h,it:m}=t,{baseId:f,schemaEnv:y,validateName:g,opts:v,self:_}=m,{root:b}=y;if(("#"===h||"#/"===h)&&f===b.baseId){if(y===b)return c(t,g,y,y.$async);let r=p.scopeValue("root",{ref:b});return c(t,(0,i._)`${r}.validate`,b,b.$async)}let S=n.resolveRef.call(_,b,f,h);if(void 0===S)throw new r.default(m.opts.uriResolver,f,h);return S instanceof n.SchemaEnv?void c(t,l(t,o=S),o,o.$async):(a=S,s=p.scopeValue("schema",!0===v.code.source?{ref:a,code:(0,i.stringify)(a)}:{ref:a}),u=p.name("valid"),d=t.subschema({schema:a,dataTypes:[],schemaPath:i.nil,topSchemaRef:s,errSchemaPath:h},u),void(t.mergeEvaluated(d),t.ok(u)))}}}),uV=q(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uD(),o=uU();t.default=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",r.default,o.default]}),uH=q(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uf(),o=r.operators,i={maximum:{okStr:"<=",ok:o.LTE,fail:o.GT},minimum:{okStr:">=",ok:o.GTE,fail:o.LT},exclusiveMaximum:{okStr:"<",ok:o.LT,fail:o.GTE},exclusiveMinimum:{okStr:">",ok:o.GT,fail:o.LTE}};t.default={keyword:Object.keys(i),type:"number",schemaType:"number",$data:!0,error:{message:({keyword:t,schemaCode:o})=>(0,r.str)`must be ${i[t].okStr} ${o}`,params:({keyword:t,schemaCode:o})=>(0,r._)`{comparison: ${i[t].okStr}, limit: ${o}}`},code(t){let{keyword:o,data:a,schemaCode:n}=t;t.fail$data((0,r._)`${a} ${i[o].fail} ${n} || isNaN(${a})`)}}}),uF=q(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uf();t.default={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:{message:({schemaCode:t})=>(0,r.str)`must be multiple of ${t}`,params:({schemaCode:t})=>(0,r._)`{multipleOf: ${t}}`},code(t){let{gen:o,data:i,schemaCode:a,it:n}=t,s=n.opts.multipleOfPrecision,l=o.let("res"),c=s?(0,r._)`Math.abs(Math.round(${l}) - ${l}) > 1e-${s}`:(0,r._)`${l} !== parseInt(${l})`;t.fail$data((0,r._)`(${a} === 0 || (${l} = ${i}/${a}, ${c}))`)}}}),uK=q(t=>{function r(t){let r,o=t.length,i=0,a=0;for(;a<o;)i++,(r=t.charCodeAt(a++))>=55296&&r<=56319&&a<o&&(64512&(r=t.charCodeAt(a)))==56320&&a++;return i}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r,r.code='require("ajv/dist/runtime/ucs2length").default'}),uJ=q(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uf(),o=uy(),i=uK();t.default={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:{message:({keyword:t,schemaCode:o})=>(0,r.str)`must NOT have ${"maxLength"===t?"more":"fewer"} than ${o} characters`,params:({schemaCode:t})=>(0,r._)`{limit: ${t}}`},code(t){let{keyword:a,data:n,schemaCode:s,it:l}=t,c="maxLength"===a?r.operators.GT:r.operators.LT,u=!1===l.opts.unicode?(0,r._)`${n}.length`:(0,r._)`${(0,o.useFunc)(t.gen,i.default)}(${n})`;t.fail$data((0,r._)`${u} ${c} ${s}`)}}}),uZ=q(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uP(),o=uy(),i=uf();t.default={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:{message:({schemaCode:t})=>(0,i.str)`must match pattern "${t}"`,params:({schemaCode:t})=>(0,i._)`{pattern: ${t}}`},code(t){let{gen:a,data:n,$data:s,schema:l,schemaCode:c,it:u}=t,d=u.opts.unicodeRegExp?"u":"";if(s){let{regExp:r}=u.opts.code,s="new RegExp"===r.code?(0,i._)`new RegExp`:(0,o.useFunc)(a,r),l=a.let("valid");a.try(()=>a.assign(l,(0,i._)`${s}(${c}, ${d}).test(${n})`),()=>a.assign(l,!1)),t.fail$data((0,i._)`!${l}`)}else{let o=(0,r.usePattern)(t,l);t.fail$data((0,i._)`!${o}.test(${n})`)}}}}),uW=q(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uf();t.default={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:{message:({keyword:t,schemaCode:o})=>(0,r.str)`must NOT have ${"maxProperties"===t?"more":"fewer"} than ${o} properties`,params:({schemaCode:t})=>(0,r._)`{limit: ${t}}`},code(t){let{keyword:o,data:i,schemaCode:a}=t,n="maxProperties"===o?r.operators.GT:r.operators.LT;t.fail$data((0,r._)`Object.keys(${i}).length ${n} ${a}`)}}}),uB=q(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uP(),o=uf(),i=uy();t.default={keyword:"required",type:"object",schemaType:"array",$data:!0,error:{message:({params:{missingProperty:t}})=>(0,o.str)`must have required property '${t}'`,params:({params:{missingProperty:t}})=>(0,o._)`{missingProperty: ${t}}`},code(t){let{gen:a,schema:n,schemaCode:s,data:l,$data:c,it:u}=t,{opts:d}=u;if(!c&&0===n.length)return;let p=n.length>=d.loopRequired;if(u.allErrors?function(){if(p||c)t.block$data(o.nil,h);else for(let o of n)(0,r.checkReportMissingProp)(t,o)}():function(){let i=a.let("missing");if(p||c){let n=a.let("valid",!0);t.block$data(n,()=>{var c,u;return c=i,u=n,void(t.setParams({missingProperty:c}),a.forOf(c,s,()=>{a.assign(u,(0,r.propertyInData)(a,l,c,d.ownProperties)),a.if((0,o.not)(u),()=>{t.error(),a.break()})},o.nil))}),t.ok(n)}else a.if((0,r.checkMissingProp)(t,n,i)),(0,r.reportMissingProp)(t,i),a.else()}(),d.strictRequired){let r=t.parentSchema.properties,{definedProperties:o}=t.it;for(let t of n)if((null==r?void 0:r[t])===void 0&&!o.has(t)){let r=`required property "${t}" is not defined at "${u.schemaEnv.baseId+u.errSchemaPath}" (strictRequired)`;(0,i.checkStrictMode)(u,r,u.opts.strictRequired)}}function h(){a.forOf("prop",s,o=>{t.setParams({missingProperty:o}),a.if((0,r.noPropertyInData)(a,l,o,d.ownProperties),()=>t.error())})}}}}),uG=q(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uf();t.default={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:{message:({keyword:t,schemaCode:o})=>(0,r.str)`must NOT have ${"maxItems"===t?"more":"fewer"} than ${o} items`,params:({schemaCode:t})=>(0,r._)`{limit: ${t}}`},code(t){let{keyword:o,data:i,schemaCode:a}=t,n="maxItems"===o?r.operators.GT:r.operators.LT;t.fail$data((0,r._)`${i}.length ${n} ${a}`)}}}),uX=q(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uk();r.code='require("ajv/dist/runtime/equal").default',t.default=r}),uY=q(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uw(),o=uf(),i=uy(),a=uX();t.default={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:{message:({params:{i:t,j:r}})=>(0,o.str)`must NOT have duplicate items (items ## ${r} and ${t} are identical)`,params:({params:{i:t,j:r}})=>(0,o._)`{i: ${t}, j: ${r}}`},code(t){let{gen:n,data:s,$data:l,schema:c,parentSchema:u,schemaCode:d,it:p}=t;if(!l&&!c)return;let h=n.let("valid"),m=u.items?(0,r.getSchemaTypes)(u.items):[];t.block$data(h,function(){let l=n.let("i",(0,o._)`${s}.length`),c=n.let("j");t.setParams({i:l,j:c}),n.assign(h,!0),n.if((0,o._)`${l} > 1`,()=>(m.length>0&&!m.some(t=>"object"===t||"array"===t)?function(i,a){let l=n.name("item"),c=(0,r.checkDataTypes)(m,l,p.opts.strictNumbers,r.DataType.Wrong),u=n.const("indices",(0,o._)`{}`);n.for((0,o._)`;${i}--;`,()=>{n.let(l,(0,o._)`${s}[${i}]`),n.if(c,(0,o._)`continue`),m.length>1&&n.if((0,o._)`typeof ${l} == "string"`,(0,o._)`${l} += "_"`),n.if((0,o._)`typeof ${u}[${l}] == "number"`,()=>{n.assign(a,(0,o._)`${u}[${l}]`),t.error(),n.assign(h,!1).break()}).code((0,o._)`${u}[${l}] = ${i}`)})}:function(r,l){let c=(0,i.useFunc)(n,a.default),u=n.name("outer");n.label(u).for((0,o._)`;${r}--;`,()=>n.for((0,o._)`${l} = ${r}; ${l}--;`,()=>n.if((0,o._)`${c}(${s}[${r}], ${s}[${l}])`,()=>{t.error(),n.assign(h,!1).break(u)})))})(l,c))},(0,o._)`${d} === false`),t.ok(h)}}}),uQ=q(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uf(),o=uy(),i=uX();t.default={keyword:"const",$data:!0,error:{message:"must be equal to constant",params:({schemaCode:t})=>(0,r._)`{allowedValue: ${t}}`},code(t){let{gen:a,data:n,$data:s,schemaCode:l,schema:c}=t;s||c&&"object"==typeof c?t.fail$data((0,r._)`!${(0,o.useFunc)(a,i.default)}(${n}, ${l})`):t.fail((0,r._)`${c} !== ${n}`)}}}),u0=q(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uf(),o=uy(),i=uX();t.default={keyword:"enum",schemaType:"array",$data:!0,error:{message:"must be equal to one of the allowed values",params:({schemaCode:t})=>(0,r._)`{allowedValues: ${t}}`},code(t){let a,n,{gen:s,data:l,$data:c,schema:u,schemaCode:d,it:p}=t;if(!c&&0===u.length)throw Error("enum must have non-empty array");let h=u.length>=p.opts.loopEnum,m=()=>null!=a?a:a=(0,o.useFunc)(s,i.default);if(h||c)n=s.let("valid"),t.block$data(n,function(){s.assign(n,!1),s.forOf("v",d,t=>s.if((0,r._)`${m()}(${l}, ${t})`,()=>s.assign(n,!0).break()))});else{if(!Array.isArray(u))throw Error("ajv implementation error");let t=s.const("vSchema",d);n=(0,r.or)(...u.map((o,i)=>{var a,n;let s;return a=t,"object"==typeof(s=u[n=i])&&null!==s?(0,r._)`${m()}(${l}, ${a}[${n}])`:(0,r._)`${l} === ${s}`}))}t.pass(n)}}}),u1=q(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uH(),o=uF(),i=uJ(),a=uZ(),n=uW(),s=uB(),l=uG(),c=uY(),u=uQ(),d=u0();t.default=[r.default,o.default,i.default,a.default,n.default,s.default,l.default,c.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},u.default,d.default]}),u2=q(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.validateAdditionalItems=void 0;let r=uf(),o=uy();function i(t,i){let{gen:a,schema:n,data:s,keyword:l,it:c}=t;c.items=!0;let u=a.const("len",(0,r._)`${s}.length`);if(!1===n)t.setParams({len:i.length}),t.pass((0,r._)`${u} <= ${i.length}`);else if("object"==typeof n&&!(0,o.alwaysValidSchema)(c,n)){let n=a.var("valid",(0,r._)`${u} <= ${i.length}`);a.if((0,r.not)(n),()=>{var s;return s=n,void a.forRange("i",i.length,u,i=>{t.subschema({keyword:l,dataProp:i,dataPropType:o.Type.Num},s),c.allErrors||a.if((0,r.not)(s),()=>a.break())})}),t.ok(n)}}t.validateAdditionalItems=i,t.default={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:{message:({params:{len:t}})=>(0,r.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,r._)`{limit: ${t}}`},code(t){let{parentSchema:r,it:a}=t,{items:n}=r;Array.isArray(n)?i(t,n):(0,o.checkStrictMode)(a,'"additionalItems" is ignored when "items" is not an array of schemas')}}}),u9=q(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.validateTuple=void 0;let r=uf(),o=uy(),i=uP();function a(t,i,n=t.schema){let{gen:s,parentSchema:l,data:c,keyword:u,it:d}=t;(function(t){let{opts:r,errSchemaPath:a}=d,s=n.length,l=s===t.minItems&&(s===t.maxItems||!1===t[i]);if(r.strictTuples&&!l){let t=`"${u}" is ${s}-tuple, but minItems or maxItems/${i} are not specified or different at path "${a}"`;(0,o.checkStrictMode)(d,t,r.strictTuples)}})(l),d.opts.unevaluated&&n.length&&!0!==d.items&&(d.items=o.mergeEvaluated.items(s,n.length,d.items));let p=s.name("valid"),h=s.const("len",(0,r._)`${c}.length`);n.forEach((i,a)=>{(0,o.alwaysValidSchema)(d,i)||(s.if((0,r._)`${h} > ${a}`,()=>t.subschema({keyword:u,schemaProp:a,dataProp:a},p)),t.ok(p))})}t.validateTuple=a,t.default={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(t){let{schema:r,it:n}=t;if(Array.isArray(r))return a(t,"additionalItems",r);n.items=!0,(0,o.alwaysValidSchema)(n,r)||t.ok((0,i.validateArray)(t))}}}),u4=q(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=u9();t.default={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:t=>(0,r.validateTuple)(t,"items")}}),u5=q(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uf(),o=uy(),i=uP(),a=u2();t.default={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:{message:({params:{len:t}})=>(0,r.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,r._)`{limit: ${t}}`},code(t){let{schema:r,parentSchema:n,it:s}=t,{prefixItems:l}=n;s.items=!0,(0,o.alwaysValidSchema)(s,r)||(l?(0,a.validateAdditionalItems)(t,l):t.ok((0,i.validateArray)(t)))}}}),u3=q(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uf(),o=uy();t.default={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:{message:({params:{min:t,max:o}})=>void 0===o?(0,r.str)`must contain at least ${t} valid item(s)`:(0,r.str)`must contain at least ${t} and no more than ${o} valid item(s)`,params:({params:{min:t,max:o}})=>void 0===o?(0,r._)`{minContains: ${t}}`:(0,r._)`{minContains: ${t}, maxContains: ${o}}`},code(t){let i,a,{gen:n,schema:s,parentSchema:l,data:c,it:u}=t,{minContains:d,maxContains:p}=l;u.opts.next?(i=void 0===d?1:d,a=p):i=1;let h=n.const("len",(0,r._)`${c}.length`);if(t.setParams({min:i,max:a}),void 0===a&&0===i)return void(0,o.checkStrictMode)(u,'"minContains" == 0 without "maxContains": "contains" keyword ignored');if(void 0!==a&&i>a){(0,o.checkStrictMode)(u,'"minContains" > "maxContains" is always invalid'),t.fail();return}if((0,o.alwaysValidSchema)(u,s)){let o=(0,r._)`${h} >= ${i}`;void 0!==a&&(o=(0,r._)`${o} && ${h} <= ${a}`),t.pass(o);return}u.items=!0;let m=n.name("valid");function f(){let t=n.name("_valid"),o=n.let("count",0);y(t,()=>n.if(t,()=>{var t;return t=o,void(n.code((0,r._)`${t}++`),void 0===a?n.if((0,r._)`${t} >= ${i}`,()=>n.assign(m,!0).break()):(n.if((0,r._)`${t} > ${a}`,()=>n.assign(m,!1).break()),1===i?n.assign(m,!0):n.if((0,r._)`${t} >= ${i}`,()=>n.assign(m,!0))))}))}function y(r,i){n.forRange("i",0,h,a=>{t.subschema({keyword:"contains",dataProp:a,dataPropType:o.Type.Num,compositeRule:!0},r),i()})}void 0===a&&1===i?y(m,()=>n.if(m,()=>n.break())):0===i?(n.let(m,!0),void 0!==a&&n.if((0,r._)`${c}.length > 0`,f)):(n.let(m,!1),f()),t.result(m,()=>t.reset())}}}),u6=q(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.validateSchemaDeps=t.validatePropertyDeps=t.error=void 0;let r=uf(),o=uy(),i=uP();t.error={message:({params:{property:t,depsCount:o,deps:i}})=>(0,r.str)`must have ${1===o?"property":"properties"} ${i} when property ${t} is present`,params:({params:{property:t,depsCount:o,deps:i,missingProperty:a}})=>(0,r._)`{property: ${t},
|
|
66
59
|
missingProperty: ${a},
|
|
67
|
-
depsCount: ${
|
|
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
|
-
`,
|
|
70
|
-
`,
|
|
71
|
-
`,
|
|
72
|
-
${
|
|
73
|
-
`,
|
|
74
|
-
`,
|
|
75
|
-
${a}`,
|
|
76
|
-
${
|
|
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})})();
|
|
60
|
+
depsCount: ${o},
|
|
61
|
+
deps: ${i}}`};let a={keyword:"dependencies",type:"object",schemaType:"object",error:t.error,code(t){let[r,o]=function({schema:t}){let r={},o={};for(let i in t)"__proto__"!==i&&((Array.isArray(t[i])?r:o)[i]=t[i]);return[r,o]}(t);n(t,r),s(t,o)}};function n(t,o=t.schema){let{gen:a,data:s,it:l}=t;if(0===Object.keys(o).length)return;let c=a.let("missing");for(let n in o){let u=o[n];if(0===u.length)continue;let d=(0,i.propertyInData)(a,s,n,l.opts.ownProperties);t.setParams({property:n,depsCount:u.length,deps:u.join(", ")}),l.allErrors?a.if(d,()=>{for(let r of u)(0,i.checkReportMissingProp)(t,r)}):(a.if((0,r._)`${d} && (${(0,i.checkMissingProp)(t,u,c)})`),(0,i.reportMissingProp)(t,c),a.else())}}function s(t,r=t.schema){let{gen:a,data:n,keyword:l,it:c}=t,u=a.name("valid");for(let s in r)(0,o.alwaysValidSchema)(c,r[s])||(a.if((0,i.propertyInData)(a,n,s,c.opts.ownProperties),()=>{let r=t.subschema({keyword:l,schemaProp:s},u);t.mergeValidEvaluated(r,u)},()=>a.var(u,!0)),t.ok(u))}t.validatePropertyDeps=n,t.validateSchemaDeps=s,t.default=a}),u8=q(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uf(),o=uy();t.default={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:{message:"property name must be valid",params:({params:t})=>(0,r._)`{propertyName: ${t.propertyName}}`},code(t){let{gen:i,schema:a,data:n,it:s}=t;if((0,o.alwaysValidSchema)(s,a))return;let l=i.name("valid");i.forIn("key",n,o=>{t.setParams({propertyName:o}),t.subschema({keyword:"propertyNames",data:o,dataTypes:["string"],propertyName:o,compositeRule:!0},l),i.if((0,r.not)(l),()=>{t.error(!0),s.allErrors||i.break()})}),t.ok(l)}}}),u7=q(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uP(),o=uf(),i=ug(),a=uy();t.default={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:{message:"must NOT have additional properties",params:({params:t})=>(0,o._)`{additionalProperty: ${t.additionalProperty}}`},code(t){let{gen:n,schema:s,parentSchema:l,data:c,errsCount:u,it:d}=t;if(!u)throw Error("ajv implementation error");let{allErrors:p,opts:h}=d;if(d.props=!0,"all"!==h.removeAdditional&&(0,a.alwaysValidSchema)(d,s))return;let m=(0,r.allSchemaProperties)(l.properties),f=(0,r.allSchemaProperties)(l.patternProperties);function y(t){n.code((0,o._)`delete ${c}[${t}]`)}function g(r){if("all"===h.removeAdditional||h.removeAdditional&&!1===s)return void y(r);if(!1===s){t.setParams({additionalProperty:r}),t.error(),p||n.break();return}if("object"==typeof s&&!(0,a.alwaysValidSchema)(d,s)){let i=n.name("valid");"failing"===h.removeAdditional?(v(r,i,!1),n.if((0,o.not)(i),()=>{t.reset(),y(r)})):(v(r,i),p||n.if((0,o.not)(i),()=>n.break()))}}function v(r,o,i){let n={keyword:"additionalProperties",dataProp:r,dataPropType:a.Type.Str};!1===i&&Object.assign(n,{compositeRule:!0,createErrors:!1,allErrors:!1}),t.subschema(n,o)}n.forIn("key",c,i=>{m.length||f.length?n.if(function(i){let s;if(m.length>8){let t=(0,a.schemaRefOrVal)(d,l.properties,"properties");s=(0,r.isOwnProperty)(n,t,i)}else s=m.length?(0,o.or)(...m.map(t=>(0,o._)`${i} === ${t}`)):o.nil;return f.length&&(s=(0,o.or)(s,...f.map(a=>(0,o._)`${(0,r.usePattern)(t,a)}.test(${i})`))),(0,o.not)(s)}(i),()=>g(i)):g(i)}),t.ok((0,o._)`${u} === ${i.default.errors}`)}}}),de=q(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uO(),o=uP(),i=uy(),a=u7();t.default={keyword:"properties",type:"object",schemaType:"object",code(t){let{gen:n,schema:s,parentSchema:l,data:c,it:u}=t;"all"===u.opts.removeAdditional&&void 0===l.additionalProperties&&a.default.code(new r.KeywordCxt(u,a.default,"additionalProperties"));let d=(0,o.allSchemaProperties)(s);for(let t of d)u.definedProperties.add(t);u.opts.unevaluated&&d.length&&!0!==u.props&&(u.props=i.mergeEvaluated.props(n,(0,i.toHash)(d),u.props));let p=d.filter(t=>!(0,i.alwaysValidSchema)(u,s[t]));if(0===p.length)return;let h=n.name("valid");for(let r of p){var m;(m=r,u.opts.useDefaults&&!u.compositeRule&&void 0!==s[m].default)?f(r):(n.if((0,o.propertyInData)(n,c,r,u.opts.ownProperties)),f(r),u.allErrors||n.else().var(h,!0),n.endIf()),t.it.definedProperties.add(r),t.ok(h)}function f(r){t.subschema({keyword:"properties",schemaProp:r,dataProp:r},h)}}}}),dt=q(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uP(),o=uf(),i=uy(),a=uy();t.default={keyword:"patternProperties",type:"object",schemaType:"object",code(t){let{gen:n,schema:s,data:l,parentSchema:c,it:u}=t,{opts:d}=u,p=(0,r.allSchemaProperties)(s),h=p.filter(t=>(0,i.alwaysValidSchema)(u,s[t]));if(0===p.length||h.length===p.length&&(!u.opts.unevaluated||!0===u.props))return;let m=d.strictSchema&&!d.allowMatchingProperties&&c.properties,f=n.name("valid");!0===u.props||u.props instanceof o.Name||(u.props=(0,a.evaluatedPropsToName)(n,u.props));let{props:y}=u;for(let t of p)m&&function(t){for(let r in m)new RegExp(t).test(r)&&(0,i.checkStrictMode)(u,`property ${r} matches pattern ${t} (use allowMatchingProperties)`)}(t),u.allErrors?g(t):(n.var(f,!0),g(t),n.if(f));function g(i){n.forIn("key",l,s=>{n.if((0,o._)`${(0,r.usePattern)(t,i)}.test(${s})`,()=>{let r=h.includes(i);r||t.subschema({keyword:"patternProperties",schemaProp:i,dataProp:s,dataPropType:a.Type.Str},f),u.opts.unevaluated&&!0!==y?n.assign((0,o._)`${y}[${s}]`,!0):r||u.allErrors||n.if((0,o.not)(f),()=>n.break())})})}}}}),dr=q(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uy();t.default={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(t){let{gen:o,schema:i,it:a}=t;if((0,r.alwaysValidSchema)(a,i))return void t.fail();let n=o.name("valid");t.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},n),t.failResult(n,()=>t.reset(),()=>t.error())},error:{message:"must NOT be valid"}}}),di=q(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:uP().validateUnion,error:{message:"must match a schema in anyOf"}}}),da=q(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uf(),o=uy();t.default={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:{message:"must match exactly one schema in oneOf",params:({params:t})=>(0,r._)`{passingSchemas: ${t.passing}}`},code(t){let{gen:i,schema:a,parentSchema:n,it:s}=t;if(!Array.isArray(a))throw Error("ajv implementation error");if(s.opts.discriminator&&n.discriminator)return;let l=i.let("valid",!1),c=i.let("passing",null),u=i.name("_valid");t.setParams({passing:c}),i.block(function(){a.forEach((a,n)=>{let d;(0,o.alwaysValidSchema)(s,a)?i.var(u,!0):d=t.subschema({keyword:"oneOf",schemaProp:n,compositeRule:!0},u),n>0&&i.if((0,r._)`${u} && ${l}`).assign(l,!1).assign(c,(0,r._)`[${c}, ${n}]`).else(),i.if(u,()=>{i.assign(l,!0),i.assign(c,n),d&&t.mergeEvaluated(d,r.Name)})})}),t.result(l,()=>t.reset(),()=>t.error(!0))}}}),dn=q(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uy();t.default={keyword:"allOf",schemaType:"array",code(t){let{gen:o,schema:i,it:a}=t;if(!Array.isArray(i))throw Error("ajv implementation error");let n=o.name("valid");i.forEach((o,i)=>{if((0,r.alwaysValidSchema)(a,o))return;let s=t.subschema({keyword:"allOf",schemaProp:i},n);t.ok(n),t.mergeEvaluated(s)})}}}),ds=q(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uf(),o=uy();function i(t,r){let i=t.schema[r];return void 0!==i&&!(0,o.alwaysValidSchema)(t,i)}t.default={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:{message:({params:t})=>(0,r.str)`must match "${t.ifClause}" schema`,params:({params:t})=>(0,r._)`{failingKeyword: ${t.ifClause}}`},code(t){let a,{gen:n,parentSchema:s,it:l}=t;void 0===s.then&&void 0===s.else&&(0,o.checkStrictMode)(l,'"if" without "then" and "else" is ignored');let c=i(l,"then"),u=i(l,"else");if(!c&&!u)return;let d=n.let("valid",!0),p=n.name("_valid");if(a=t.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},p),t.mergeEvaluated(a),t.reset(),c&&u){let r=n.let("ifClause");t.setParams({ifClause:r}),n.if(p,h("then",r),h("else",r))}else c?n.if(p,h("then")):n.if((0,r.not)(p),h("else"));function h(o,i){return()=>{let a=t.subschema({keyword:o},p);n.assign(d,p),t.mergeValidEvaluated(a,d),i?n.assign(i,(0,r._)`${o}`):t.setParams({ifClause:o})}}t.pass(d,()=>t.error(!0))}}}),dl=q(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uy();t.default={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:t,parentSchema:o,it:i}){void 0===o.if&&(0,r.checkStrictMode)(i,`"${t}" without "if" is ignored`)}}}),dc=q(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=u2(),o=u4(),i=u9(),a=u5(),n=u3(),s=u6(),l=u8(),c=u7(),u=de(),d=dt(),p=dr(),h=di(),m=da(),f=dn(),y=ds(),g=dl();t.default=function(t=!1){let v=[p.default,h.default,m.default,f.default,y.default,g.default,l.default,c.default,s.default,u.default,d.default];return t?v.push(o.default,a.default):v.push(r.default,i.default),v.push(n.default),v}}),du=q(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uf();t.default={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:{message:({schemaCode:t})=>(0,r.str)`must match format "${t}"`,params:({schemaCode:t})=>(0,r._)`{format: ${t}}`},code(t,o){let i,a,n,s,l,c,{gen:u,data:d,$data:p,schema:h,schemaCode:m,it:f}=t,{opts:y,errSchemaPath:g,schemaEnv:v,self:_}=f;y.validateFormats&&(p?(i=u.scopeValue("formats",{ref:_.formats,code:y.code.formats}),a=u.const("fDef",(0,r._)`${i}[${m}]`),n=u.let("fType"),s=u.let("format"),u.if((0,r._)`typeof ${a} == "object" && !(${a} instanceof RegExp)`,()=>u.assign(n,(0,r._)`${a}.type || "string"`).assign(s,(0,r._)`${a}.validate`),()=>u.assign(n,(0,r._)`"string"`).assign(s,a)),t.fail$data((0,r.or)(!1===y.strictSchema?r.nil:(0,r._)`${m} && !${s}`,(l=v.$async?(0,r._)`(${a}.async ? await ${s}(${d}) : ${s}(${d}))`:(0,r._)`${s}(${d})`,c=(0,r._)`(typeof ${s} == "function" ? ${l} : ${s}.test(${d}))`,(0,r._)`${s} && ${s} !== true && ${n} === ${o} && !${c}`)))):function(){var i;let a,n,s=_.formats[h];if(!s){if(!1===y.strictSchema)return _.logger.warn(l());throw Error(l());function l(){return`unknown format "${h}" ignored in schema at path "${g}"`}}if(!0===s)return;let[c,p,m]=(a=(i=s)instanceof RegExp?(0,r.regexpCode)(i):y.code.formats?(0,r._)`${y.code.formats}${(0,r.getProperty)(h)}`:void 0,n=u.scopeValue("formats",{key:h,ref:i,code:a}),"object"!=typeof i||i instanceof RegExp?["string",i,n]:[i.type||"string",i.validate,(0,r._)`${n}.validate`]);c===o&&t.pass(function(){if("object"==typeof s&&!(s instanceof RegExp)&&s.async){if(!v.$async)throw Error("async format in sync schema");return(0,r._)`await ${m}(${d})`}return"function"==typeof p?(0,r._)`${m}(${d})`:(0,r._)`${m}.test(${d})`}())}())}}}),dd=q(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default=[du().default]}),dp=q(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.contentVocabulary=t.metadataVocabulary=void 0,t.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"],t.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]}),dh=q(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uV(),o=u1(),i=dc(),a=dd(),n=dp();t.default=[r.default,o.default,(0,i.default)(),a.default,n.metadataVocabulary,n.contentVocabulary]}),dm=q(t=>{var r,o;Object.defineProperty(t,"__esModule",{value:!0}),t.DiscrError=void 0,(o=r||(t.DiscrError=r={})).Tag="tag",o.Mapping="mapping"}),df=q(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uf(),o=dm(),i=uI(),a=uj(),n=uy();t.default={keyword:"discriminator",type:"object",schemaType:"object",error:{message:({params:{discrError:t,tagName:r}})=>t===o.DiscrError.Tag?`tag "${r}" must be string`:`value of tag "${r}" must be in oneOf`,params:({params:{discrError:t,tag:o,tagName:i}})=>(0,r._)`{error: ${t}, tag: ${i}, tagValue: ${o}}`},code(t){let{gen:s,data:l,schema:c,parentSchema:u,it:d}=t,{oneOf:p}=u;if(!d.opts.discriminator)throw Error("discriminator: requires discriminator option");let h=c.propertyName;if("string"!=typeof h)throw Error("discriminator: requires propertyName");if(c.mapping)throw Error("discriminator: mapping is not supported");if(!p)throw Error("discriminator: requires oneOf keyword");let m=s.let("valid",!1),f=s.const("tag",(0,r._)`${l}${(0,r.getProperty)(h)}`);s.if((0,r._)`typeof ${f} == "string"`,()=>(function(){let l=function(){var t;let r={},o=l(u),s=!0;for(let r=0;r<p.length;r++){let u=p[r];if((null==u?void 0:u.$ref)&&!(0,n.schemaHasRulesButRef)(u,d.self.RULES)){let t=u.$ref;if((u=i.resolveRef.call(d.self,d.schemaEnv.root,d.baseId,t))instanceof i.SchemaEnv&&(u=u.schema),void 0===u)throw new a.default(d.opts.uriResolver,d.baseId,t)}let m=null==(t=null==u?void 0:u.properties)?void 0:t[h];if("object"!=typeof m)throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${h}"`);s=s&&(o||l(u)),function(t,r){if(t.const)c(t.const,r);else if(t.enum)for(let o of t.enum)c(o,r);else throw Error(`discriminator: "properties/${h}" must have "const" or "enum"`)}(m,r)}if(!s)throw Error(`discriminator: "${h}" must be required`);return r;function l({required:t}){return Array.isArray(t)&&t.includes(h)}function c(t,o){if("string"!=typeof t||t in r)throw Error(`discriminator: "${h}" values must be unique strings`);r[t]=o}}();for(let o in s.if(!1),l)s.elseIf((0,r._)`${f} === ${o}`),s.assign(m,function(o){let i=s.name("valid"),a=t.subschema({keyword:"oneOf",schemaProp:o},i);return t.mergeEvaluated(a,r.Name),i}(l[o]));s.else(),t.error(!1,{discrError:o.DiscrError.Mapping,tag:f,tagName:h}),s.endIf()})(),()=>t.error(!1,{discrError:o.DiscrError.Tag,tag:f,tagName:h})),t.ok(m)}}}),dy=q((t,r)=>{r.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}}),dg=q((t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.MissingRefError=t.ValidationError=t.CodeGen=t.Name=t.nil=t.stringify=t.str=t._=t.KeywordCxt=t.Ajv=void 0;let o=uL(),i=dh(),a=df(),n=dy(),s=["/properties"],l="http://json-schema.org/draft-07/schema";var c=class extends o.default{_addVocabularies(){super._addVocabularies(),i.default.forEach(t=>this.addVocabulary(t)),this.opts.discriminator&&this.addKeyword(a.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let t=this.opts.$data?this.$dataMetaSchema(n,s):n;this.addMetaSchema(t,l,!1),this.refs["http://json-schema.org/schema"]=l}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(l)?l:void 0)}};t.Ajv=c,r.exports=t=c,r.exports.Ajv=c,Object.defineProperty(t,"__esModule",{value:!0}),t.default=c;var u=uO();Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return u.KeywordCxt}});var d=uf();Object.defineProperty(t,"_",{enumerable:!0,get:function(){return d._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return d.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return d.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return d.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return d.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return d.CodeGen}});var p=uC();Object.defineProperty(t,"ValidationError",{enumerable:!0,get:function(){return p.default}});var h=uj();Object.defineProperty(t,"MissingRefError",{enumerable:!0,get:function(){return h.default}})}),dv=q(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.dynamicAnchor=void 0;let r=uf(),o=ug(),i=uI(),a=uU();function n(t,n){let{gen:s,it:l}=t;l.schemaEnv.root.dynamicAnchors[n]=!0;let c=(0,r._)`${o.default.dynamicAnchors}${(0,r.getProperty)(n)}`,u="#"===l.errSchemaPath?l.validateName:function(t){let{schemaEnv:r,schema:o,self:n}=t.it,{root:s,baseId:l,localRefs:c,meta:u}=r.root,{schemaId:d}=n.opts,p=new i.SchemaEnv({schema:o,schemaId:d,root:s,baseId:l,localRefs:c,meta:u});return i.compileSchema.call(n,p),(0,a.getValidate)(t,p)}(t);s.if((0,r._)`!${c}`,()=>s.assign(c,u))}t.dynamicAnchor=n,t.default={keyword:"$dynamicAnchor",schemaType:"string",code:t=>n(t,t.schema)}}),d_=q(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.dynamicRef=void 0;let r=uf(),o=ug(),i=uU();function a(t,a){let{gen:n,keyword:s,it:l}=t;if("#"!==a[0])throw Error(`"${s}" only supports hash fragment reference`);let c=a.slice(1);if(l.allErrors)u();else{let r=n.let("valid",!1);u(r),t.ok(r)}function u(t){if(l.schemaEnv.root.dynamicAnchors[c]){let i=n.let("_v",(0,r._)`${o.default.dynamicAnchors}${(0,r.getProperty)(c)}`);n.if(i,d(i,t),d(l.validateName,t))}else d(l.validateName,t)()}function d(r,o){return o?()=>n.block(()=>{(0,i.callRef)(t,r),n.let(o,!0)}):()=>(0,i.callRef)(t,r)}}t.dynamicRef=a,t.default={keyword:"$dynamicRef",schemaType:"string",code:t=>a(t,t.schema)}}),db=q(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=dv(),o=uy();t.default={keyword:"$recursiveAnchor",schemaType:"boolean",code(t){t.schema?(0,r.dynamicAnchor)(t,""):(0,o.checkStrictMode)(t.it,"$recursiveAnchor: false is ignored")}}}),dS=q(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=d_();t.default={keyword:"$recursiveRef",schemaType:"string",code:t=>(0,r.dynamicRef)(t,t.schema)}}),dw=q(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=dv(),o=d_(),i=db(),a=dS();t.default=[r.default,o.default,i.default,a.default]}),d$=q(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=u6();t.default={keyword:"dependentRequired",type:"object",schemaType:"object",error:r.error,code:t=>(0,r.validatePropertyDeps)(t)}}),dP=q(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=u6();t.default={keyword:"dependentSchemas",type:"object",schemaType:"object",code:t=>(0,r.validateSchemaDeps)(t)}}),dR=q(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uy();t.default={keyword:["maxContains","minContains"],type:"array",schemaType:"number",code({keyword:t,parentSchema:o,it:i}){void 0===o.contains&&(0,r.checkStrictMode)(i,`"${t}" without "contains" is ignored`)}}}),dE=q(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=d$(),o=dP(),i=dR();t.default=[r.default,o.default,i.default]}),dk=q(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uf(),o=uy(),i=ug();t.default={keyword:"unevaluatedProperties",type:"object",schemaType:["boolean","object"],trackErrors:!0,error:{message:"must NOT have unevaluated properties",params:({params:t})=>(0,r._)`{unevaluatedProperty: ${t.unevaluatedProperty}}`},code(t){let{gen:a,schema:n,data:s,errsCount:l,it:c}=t;if(!l)throw Error("ajv implementation error");let{allErrors:u,props:d}=c;function p(i){if(!1===n){t.setParams({unevaluatedProperty:i}),t.error(),u||a.break();return}if(!(0,o.alwaysValidSchema)(c,n)){let n=a.name("valid");t.subschema({keyword:"unevaluatedProperties",dataProp:i,dataPropType:o.Type.Str},n),u||a.if((0,r.not)(n),()=>a.break())}}d instanceof r.Name?a.if((0,r._)`${d} !== true`,()=>a.forIn("key",s,t=>{var o,i;return a.if((o=d,i=t,(0,r._)`!${o} || !${o}[${i}]`),()=>p(t))})):!0!==d&&a.forIn("key",s,t=>void 0===d?p(t):a.if(function(t,o){let i=[];for(let a in t)!0===t[a]&&i.push((0,r._)`${o} !== ${a}`);return(0,r.and)(...i)}(d,t),()=>p(t))),c.props=!0,t.ok((0,r._)`${l} === ${i.default.errors}`)}}}),dx=q(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uf(),o=uy();t.default={keyword:"unevaluatedItems",type:"array",schemaType:["boolean","object"],error:{message:({params:{len:t}})=>(0,r.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,r._)`{limit: ${t}}`},code(t){let{gen:i,schema:a,data:n,it:s}=t,l=s.items||0;if(!0===l)return;let c=i.const("len",(0,r._)`${n}.length`);if(!1===a)t.setParams({len:l}),t.fail((0,r._)`${c} > ${l}`);else if("object"==typeof a&&!(0,o.alwaysValidSchema)(s,a)){let a=i.var("valid",(0,r._)`${c} <= ${l}`);i.if((0,r.not)(a),()=>{var n,u;return n=a,u=l,void i.forRange("i",u,c,a=>{t.subschema({keyword:"unevaluatedItems",dataProp:a,dataPropType:o.Type.Num},n),s.allErrors||i.if((0,r.not)(n),()=>i.break())})}),t.ok(a)}s.items=!0}}}),dT=q(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=dk(),o=dx();t.default=[r.default,o.default]}),dO=q((t,r)=>{r.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"}]}}}}}),dC=q((t,r)=>{r.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:"#"}}}}}),dj=q((t,r)=>{r.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:"#"}}}}),dI=q((t,r)=>{r.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:{}}}}}),dN=q((t,r)=>{r.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"}}}}),dA=q((t,r)=>{r.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}}}}),dz=q((t,r)=>{r.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:[]}}}}),dq=q(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=dO(),o=dC(),i=dj(),a=dI(),n=dN(),s=dA(),l=dz(),c=["/properties"];t.default=function(t){return[r,o,i,a,u(this,n),s,u(this,l)].forEach(t=>this.addMetaSchema(t,void 0,!1)),this;function u(r,o){return t?r.$dataMetaSchema(o,c):o}}}),dM=q((t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.MissingRefError=t.ValidationError=t.CodeGen=t.Name=t.nil=t.stringify=t.str=t._=t.KeywordCxt=t.Ajv2019=void 0;let o=uL(),i=dh(),a=dw(),n=dE(),s=dT(),l=df(),c=dq(),u="https://json-schema.org/draft/2019-09/schema";var d=class extends o.default{constructor(t={}){super({...t,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){super._addVocabularies(),this.addVocabulary(a.default),i.default.forEach(t=>this.addVocabulary(t)),this.addVocabulary(n.default),this.addVocabulary(s.default),this.opts.discriminator&&this.addKeyword(l.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();let{$data:t,meta:r}=this.opts;r&&(c.default.call(this,t),this.refs["http://json-schema.org/schema"]=u)}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(u)?u:void 0)}};t.Ajv2019=d,r.exports=t=d,r.exports.Ajv2019=d,Object.defineProperty(t,"__esModule",{value:!0}),t.default=d;var p=uO();Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return p.KeywordCxt}});var h=uf();Object.defineProperty(t,"_",{enumerable:!0,get:function(){return h._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return h.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return h.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return h.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return h.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return h.CodeGen}});var m=uC();Object.defineProperty(t,"ValidationError",{enumerable:!0,get:function(){return m.default}});var f=uj();Object.defineProperty(t,"MissingRefError",{enumerable:!0,get:function(){return f.default}})}),dL=q(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uV(),o=u1(),i=dc(),a=dw(),n=dE(),s=dT(),l=dd(),c=dp();t.default=[a.default,r.default,o.default,(0,i.default)(!0),l.default,c.metadataVocabulary,c.contentVocabulary,n.default,s.default]}),dD=q((t,r)=>{r.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}}}}),dU=q((t,r)=>{r.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"}}}}}),dV=q((t,r)=>{r.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"}}}}),dH=q((t,r)=>{r.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"}}}}),dF=q((t,r)=>{r.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"}}}}),dK=q((t,r)=>{r.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"}}}}),dJ=q((t,r)=>{r.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}}}}),dZ=q((t,r)=>{r.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:[]}}}}),dW=q(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=dD(),o=dU(),i=dV(),a=dH(),n=dF(),s=dK(),l=dJ(),c=dZ(),u=["/properties"];t.default=function(t){return[r,o,i,a,n,d(this,s),l,d(this,c)].forEach(t=>this.addMetaSchema(t,void 0,!1)),this;function d(r,o){return t?r.$dataMetaSchema(o,u):o}}}),dB=q((t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.MissingRefError=t.ValidationError=t.CodeGen=t.Name=t.nil=t.stringify=t.str=t._=t.KeywordCxt=t.Ajv2020=void 0;let o=uL(),i=dL(),a=df(),n=dW(),s="https://json-schema.org/draft/2020-12/schema";var l=class extends o.default{constructor(t={}){super({...t,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){super._addVocabularies(),i.default.forEach(t=>this.addVocabulary(t)),this.opts.discriminator&&this.addKeyword(a.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();let{$data:t,meta:r}=this.opts;r&&(n.default.call(this,t),this.refs["http://json-schema.org/schema"]=s)}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(s)?s:void 0)}};t.Ajv2020=l,r.exports=t=l,r.exports.Ajv2020=l,Object.defineProperty(t,"__esModule",{value:!0}),t.default=l;var c=uO();Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return c.KeywordCxt}});var u=uf();Object.defineProperty(t,"_",{enumerable:!0,get:function(){return u._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return u.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return u.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return u.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return u.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return u.CodeGen}});var d=uC();Object.defineProperty(t,"ValidationError",{enumerable:!0,get:function(){return d.default}});var p=uj();Object.defineProperty(t,"MissingRefError",{enumerable:!0,get:function(){return p.default}})}),dG=q(t=>{function r(t,r){return{validate:t,compare:r}}Object.defineProperty(t,"__esModule",{value:!0}),t.formatNames=t.fastFormats=t.fullFormats=void 0,t.fullFormats={date:r(a,n),time:r(l(!0),c),"date-time":r(p(!0),h),"iso-time":r(l(),u),"iso-date-time":r(p(),m),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:function(t){return f.test(t)&&y.test(t)},"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(t){if(S.test(t))return!1;try{return new RegExp(t),!0}catch(t){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(t){return g.lastIndex=0,g.test(t)},int32:{type:"number",validate:function(t){return Number.isInteger(t)&&t<=_&&t>=v}},int64:{type:"number",validate:function(t){return Number.isInteger(t)}},float:{type:"number",validate:b},double:{type:"number",validate:b},password:!0,binary:!0},t.fastFormats={...t.fullFormats,date:r(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,n),time:r(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,c),"date-time":r(/^\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,h),"iso-time":r(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,u),"iso-date-time":r(/^\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,m),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},t.formatNames=Object.keys(t.fullFormats);let o=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,i=[0,31,28,31,30,31,30,31,31,30,31,30,31];function a(t){var r;let a=o.exec(t);if(!a)return!1;let n=+a[1],s=+a[2],l=+a[3];return s>=1&&s<=12&&l>=1&&l<=(2===s&&(r=n)%4==0&&(r%100!=0||r%400==0)?29:i[s])}function n(t,r){if(t&&r)return t>r?1:t<r?-1:0}let s=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function l(t){return function(r){let o=s.exec(r);if(!o)return!1;let i=+o[1],a=+o[2],n=+o[3],l=o[4],c="-"===o[5]?-1:1,u=+(o[6]||0),d=+(o[7]||0);if(u>23||d>59||t&&!l)return!1;if(i<=23&&a<=59&&n<60)return!0;let p=a-d*c,h=i-u*c-(p<0);return(23===h||-1===h)&&(59===p||-1===p)&&n<61}}function c(t,r){if(!(t&&r))return;let o=new Date("2020-01-01T"+t).valueOf(),i=new Date("2020-01-01T"+r).valueOf();if(o&&i)return o-i}function u(t,r){if(!(t&&r))return;let o=s.exec(t),i=s.exec(r);if(o&&i)return(t=o[1]+o[2]+o[3])>(r=i[1]+i[2]+i[3])?1:t<r?-1:0}let d=/t|\s/i;function p(t){let r=l(t);return function(t){let o=t.split(d);return 2===o.length&&a(o[0])&&r(o[1])}}function h(t,r){if(!(t&&r))return;let o=new Date(t).valueOf(),i=new Date(r).valueOf();if(o&&i)return o-i}function m(t,r){if(!(t&&r))return;let[o,i]=t.split(d),[a,s]=r.split(d),l=n(o,a);if(void 0!==l)return l||c(i,s)}let f=/\/|:/,y=/^(?:[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,g=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm,v=-0x80000000,_=0x80000000-1;function b(){return!0}let S=/[^\\]\\Z/}),dX=q(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.formatLimitDefinition=void 0;let r=dg(),o=uf(),i=o.operators,a={formatMaximum:{okStr:"<=",ok:i.LTE,fail:i.GT},formatMinimum:{okStr:">=",ok:i.GTE,fail:i.LT},formatExclusiveMaximum:{okStr:"<",ok:i.LT,fail:i.GTE},formatExclusiveMinimum:{okStr:">",ok:i.GT,fail:i.LTE}};t.formatLimitDefinition={keyword:Object.keys(a),type:"string",schemaType:"string",$data:!0,error:{message:({keyword:t,schemaCode:r})=>(0,o.str)`should be ${a[t].okStr} ${r}`,params:({keyword:t,schemaCode:r})=>(0,o._)`{comparison: ${a[t].okStr}, limit: ${r}}`},code(t){let i,n,{gen:s,data:l,schemaCode:c,keyword:u,it:d}=t,{opts:p,self:h}=d;if(!p.validateFormats)return;let m=new r.KeywordCxt(d,h.RULES.all.format.definition,"format");function f(t){return(0,o._)`${t}.compare(${l}, ${c}) ${a[u].fail} 0`}m.$data?(i=s.scopeValue("formats",{ref:h.formats,code:p.code.formats}),n=s.const("fmt",(0,o._)`${i}[${m.schemaCode}]`),t.fail$data((0,o.or)((0,o._)`typeof ${n} != "object"`,(0,o._)`${n} instanceof RegExp`,(0,o._)`typeof ${n}.compare != "function"`,f(n)))):function(){let r=m.schema,i=h.formats[r];if(!i||!0===i)return;if("object"!=typeof i||i instanceof RegExp||"function"!=typeof i.compare)throw Error(`"${u}": format "${r}" does not define "compare" function`);let a=s.scopeValue("formats",{key:r,ref:i,code:p.code.formats?(0,o._)`${p.code.formats}${(0,o.getProperty)(r)}`:void 0});t.fail$data(f(a))}()},dependencies:["format"]},t.default=r=>(r.addKeyword(t.formatLimitDefinition),r)}),dY=q((t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});let o=dG(),i=dX(),a=uf(),n=new a.Name("fullFormats"),s=new a.Name("fastFormats"),l=(t,r={keywords:!0})=>{if(Array.isArray(r))return c(t,r,o.fullFormats,n),t;let[a,l]="fast"===r.mode?[o.fastFormats,s]:[o.fullFormats,n];return c(t,r.formats||o.formatNames,a,l),r.keywords&&(0,i.default)(t),t};function c(t,r,o,i){var n;for(let s of(null!=(n=t.opts.code).formats||(n.formats=(0,a._)`require("ajv-formats/dist/formats").${i}`),r))t.addFormat(s,o[s])}l.get=(t,r="full")=>{let i=("fast"===r?o.fastFormats:o.fullFormats)[t];if(!i)throw Error(`Unknown format "${t}"`);return i},r.exports=t=l,Object.defineProperty(t,"__esModule",{value:!0}),t.default=l}),dQ=dg(),d0=dM(),d1=dB();let d2=M(dY(),1).default;function d9(t){let r=new t({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return d2(r),r}var d4=class{_ajv;_ajvDraft7;_ajv2019;_userAjv;constructor(t){this._userAjv=void 0!==t,this._ajv=t}get ajv(){return this._ajv??=d9(d1.Ajv2020)}_engineFor(t){if(this._userAjv)return this.ajv;let r=function(t,r){if(!("$schema"in t)||"string"!=typeof t.$schema)return"2020-12";let o=t.$schema.replace(/#$/,"");if(L.has(o))return"2020-12";if(D.has(o))return"2019-09";if(U.has(o)||V.has(o))return"draft-7";throw Error(`JSON Schema declares an unsupported dialect ("$schema": "${t.$schema.slice(0,200)}"). The default validator supports JSON Schema 2020-12, 2019-09, draft-07, and draft-06; ${r}`)}(t,"pass a pre-configured Ajv instance to AjvJsonSchemaValidator(ajv) to validate other dialects.");return"2020-12"===r?this.ajv:"2019-09"===r?this._ajv2019??=d9(d0.Ajv2019):this._ajvDraft7??=d9(dQ.Ajv)}getValidator(t){let r=this._engineFor(t),o="$id"in t&&"string"==typeof t.$id?r.getSchema(t.$id)??r.compile(t):r.compile(t);return t=>o(t)?{valid:!0,data:t,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:r.errorsText(o.errors)}}};async function d5(t){return(await u).getRandomValues(new Uint8Array(t))}async function d3(t){let r="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~",o=256-256%r.length,i="";for(;i.length<t;)for(let a of(await d5(t-i.length)))a<o&&(i+=r[a%r.length]);return i}async function d6(t){return await d3(t)}async function d8(t){return btoa(String.fromCharCode(...new Uint8Array(await (await u).subtle.digest("SHA-256",new TextEncoder().encode(t))))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}async function d7(t){if(t||(t=43),t<43||t>128)throw`Expected a length between 43 and 128. Received ${t}.`;let r=await d6(t),o=await d8(r);return{code_verifier:r,code_challenge:o}}dQ.Ajv,u=globalThis.crypto?.webcrypto??globalThis.crypto??Promise.resolve().then(a.t.bind(a,7598,19)).then(t=>t.webcrypto);class pe extends Error{constructor(t,r){super(t),this.name="ParseError",this.type=r.type,this.field=r.field,this.value=r.value,this.line=r.line}}function pt(t){}function pr(t,r,o){return 100===o&&97===t.charCodeAt(r+1)&&116===t.charCodeAt(r+2)&&97===t.charCodeAt(r+3)&&58===t.charCodeAt(r+4)}function po(t,r,o){return 101===o&&118===t.charCodeAt(r+1)&&101===t.charCodeAt(r+2)&&110===t.charCodeAt(r+3)&&116===t.charCodeAt(r+4)&&58===t.charCodeAt(r+5)}class pi extends TransformStream{constructor({onError:t,onRetry:r,onComment:o,maxBufferSize:i}={}){let a;super({start(n){a=function(t){if("function"==typeof t)throw TypeError("`config` must be an object, got a function instead. Did you mean `createParser({onEvent: fn})`?");let{onEvent:r=pt,onError:o=pt,onRetry:i=pt,onComment:a,maxBufferSize:n}=t,s=[],l=0,c=!0,u,d="",p=0,h,m=!1;function f(){void 0!==n&&(l+d.length<=n||(m=!0,s.length=0,l=0,u=void 0,d="",p=0,h=void 0,o(new pe(`Buffered data exceeded max buffer size of ${n} characters`,{type:"max-buffer-size-exceeded"}))))}function y(t){let o=0;if(-1===t.indexOf("\r")){let i=t.indexOf(`
|
|
62
|
+
`,o);for(;-1!==i;){if(o===i){p>0&&r({id:u,event:h,data:d}),u=void 0,d="",p=0,h=void 0,o=i+1,i=t.indexOf(`
|
|
63
|
+
`,o);continue}let a=t.charCodeAt(o);if(pr(t,o,a)){let a=32===t.charCodeAt(o+5)?o+6:o+5,n=t.slice(a,i);if(0===p&&10===t.charCodeAt(i+1)){r({id:u,event:h,data:n}),u=void 0,d="",h=void 0,o=i+2,i=t.indexOf(`
|
|
64
|
+
`,o);continue}d=0===p?n:`${d}
|
|
65
|
+
${n}`,p++}else po(t,o,a)?h=t.slice(32===t.charCodeAt(o+6)?o+7:o+6,i)||void 0:g(t,o,i);o=i+1,i=t.indexOf(`
|
|
66
|
+
`,o)}return t.slice(o)}for(;o<t.length;){let r=t.indexOf("\r",o),i=t.indexOf(`
|
|
67
|
+
`,o),a=-1;if(-1!==r&&-1!==i?a=r<i?r:i:-1!==r?a=r===t.length-1?-1:r:-1!==i&&(a=i),-1===a)break;g(t,o,a),o=a+1,13===t.charCodeAt(o-1)&&10===t.charCodeAt(o)&&o++}return t.slice(o)}function g(t,o,i){if(o===i)return void(p>0&&r({id:u,event:h,data:d}),u=void 0,d="",p=0,h=void 0);let n=t.charCodeAt(o);if(pr(t,o,n)){let r=32===t.charCodeAt(o+5)?o+6:o+5,a=t.slice(r,i);d=0===p?a:`${d}
|
|
68
|
+
${a}`,p++;return}if(po(t,o,n)){h=t.slice(32===t.charCodeAt(o+6)?o+7:o+6,i)||void 0;return}if(105===n&&100===t.charCodeAt(o+1)&&58===t.charCodeAt(o+2)){let r=t.slice(32===t.charCodeAt(o+3)?o+4:o+3,i);u=r.includes("\0")?void 0:r;return}if(58===n){a&&a(t.slice(o,i).slice(32===t.charCodeAt(o+1)?2:1));return}let s=t.slice(o,i),l=s.indexOf(":");if(-1===l)return void v(s,"",s);let c=s.slice(0,l),m=32===s.charCodeAt(l+1)?2:1;v(c,s.slice(l+m),s)}function v(t,r,a){switch(t){case"event":h=r||void 0;break;case"data":d=0===p?r:`${d}
|
|
69
|
+
${r}`,p++;break;case"id":u=r.includes("\0")?void 0:r;break;case"retry":/^\d+$/.test(r)?i(parseInt(r,10)):o(new pe(`Invalid \`retry\` value: "${r}"`,{type:"invalid-retry",value:r,line:a}));break;default:o(new pe(`Unknown field "${t.length>20?`${t.slice(0,20)}\u2026`:t}"`,{type:"unknown-field",field:t,value:r,line:a}))}}return{feed:function(t){if(m)throw Error("Cannot feed parser: it was terminated after exceeding the configured max buffer size. Call `reset()` to resume parsing.");if(c&&(c=!1,239===t.charCodeAt(0)&&187===t.charCodeAt(1)&&191===t.charCodeAt(2)&&(t=t.slice(3))),0===s.length){let r=y(t);""!==r&&(s.push(r),l=r.length),f();return}if(-1===t.indexOf(`
|
|
70
|
+
`)&&-1===t.indexOf("\r")){s.push(t),l+=t.length,f();return}s.push(t);let r=s.join("");s.length=0,l=0;let o=y(r);""!==o&&(s.push(o),l=o.length),f()},reset:function(t={}){if(t.consume&&s.length>0){let t=s.join("");g(t,0,t.length)}c=!0,u=void 0,d="",p=0,h=void 0,s.length=0,l=0,m=!1}}}({onEvent:t=>{n.enqueue(t)},onError(r){"function"==typeof t&&t(r),("terminate"===t||"max-buffer-size-exceeded"===r.type)&&n.error(r)},onRetry:r,onComment:o,maxBufferSize:i})},transform(t){a.feed(t)}})}}var pa=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.OAuthClientFlowError"})}static[Symbol.hasInstance](t){return lM(this,t)}static isInstance(t){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 lM(this,t)}constructor(t){super(t),this.name=new.target.name,lq(this,new.target)}},pn=class extends pa{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.IssuerMismatchError"})}kind;expected;received;constructor(t,r,o){super(`Issuer mismatch in ${"metadata"===t?"authorization server metadata (RFC 8414 \xa73.3)":"authorization response (RFC 9207)"}: expected ${JSON.stringify(r)}, received ${JSON.stringify(o)}`),this.kind=t,this.expected=r,this.received=o}},ps=class extends pa{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.RegistrationRejectedError"})}status;body;submittedMetadata;constructor(t){super(`Dynamic Client Registration rejected (HTTP ${t.status}): ${t.body}`),this.status=t.status,this.body=t.body,this.submittedMetadata=t.submittedMetadata}},pl=class extends pa{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.InsecureTokenEndpointError"})}tokenEndpoint;constructor(t){super(`Refusing to send credentials to non-https token endpoint '${t}'. OAuth token requests MUST use TLS (localhost / 127.0.0.1 / ::1 are exempt).`),this.tokenEndpoint=t}},pc=class extends pa{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.AuthorizationServerMismatchError"})}constructor(t,r){super(`Authorization server changed between redirect and callback (redirected to ${JSON.stringify(t)}, callback resolved ${JSON.stringify(r)}); refusing to send authorization_code/code_verifier to a different token endpoint`),this.recordedIssuer=t,this.currentIssuer=r}},pu=class extends pa{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.InsufficientScopeError"})}requiredScope;resourceMetadataUrl;errorDescription;constructor(t){super(`Insufficient scope${t.requiredScope?`: required "${t.requiredScope}"`:""}`),this.requiredScope=t.requiredScope,this.resourceMetadataUrl=t.resourceMetadataUrl,this.errorDescription=t.errorDescription}};function pd(t,r,o){if(void 0!==t)return void 0===t.issuer?(o?.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."),t):pp(t.issuer,r)?t:void 0}function pp(t,r){return t===r||t.endsWith("/")&&t.slice(0,-1)===r||r.endsWith("/")&&r.slice(0,-1)===t}async function ph(t,r,o){let{resourceMetadataUrl:i,scope:a}=pE(r.response);if(await p$(t,{serverUrl:r.serverUrl,resourceMetadataUrl:i,scope:a,fetchFn:r.fetchFn,...o})!=="AUTHORIZED")throw new pm}var pm=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UnauthorizedError"})}static[Symbol.hasInstance](t){return lM(this,t)}static isInstance(t){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 lM(this,t)}constructor(t){super(t??"Unauthorized"),this.name="UnauthorizedError",lq(this,new.target)}};function pf(t){return t?.authorization_response_iss_parameter_supported===!0}function py({iss:t,expectedIssuer:r,issParameterSupported:o}){if(void 0!==r){if(void 0===t){if(o)throw new pn("authorization_response",r,void 0);return}if(t!==r)throw new pn("authorization_response",r,t)}}function pg(...t){let r=new Set;for(let o of t)if(o)for(let t of o.split(/\s+/))t&&r.add(t);return r.size>0?[...r].join(" "):void 0}async function pv(t,r,o,i,a){if("string"==typeof t)return{authorizationCode:t,iss:r};let n=t.get("iss")??void 0,s=t.get("code");if(s)return{authorizationCode:s,iss:n};let l=(await o.discoveryState?.())?.authorizationServerMetadata;if(!l)try{l=(await pI(i,a)).authorizationServerMetadata}catch{l=void 0}if(!l)throw new pm("Authorization callback failed and the issuer could not be verified");py({iss:n,expectedIssuer:l.issuer,issParameterSupported:pf(l)});let c=t.get("error");if(c)throw new lD(c,t.get("error_description")??c,t.get("error_uri")??void 0);throw new pm("Authorization callback contained neither `code` nor `error`")}let p_="code",pb="S256";function pS(t){return"localhost"===t||"127.0.0.1"===t||"[::1]"===t||"::1"===t}async function pw(t){let r=t instanceof Response?t.status:void 0,o=t instanceof Response?await t.text():t;try{let t=lT.parse(JSON.parse(o));return lD.fromResponse(t)}catch(i){let t=`${r?`HTTP ${r}: `:""}Invalid OAuth error response: ${i}. Raw body: ${o}`;return new lD(lL.ServerError,t)}}async function p$(t,r){try{return await pP(t,r)}catch(o){if(o instanceof lD){if(o.code===lL.InvalidClient||o.code===lL.UnauthorizedClient)return await t.invalidateCredentials?.("client"),await t.invalidateCredentials?.("tokens"),await pP(t,r);else if(o.code===lL.InvalidGrant)return await t.invalidateCredentials?.("tokens"),await pP(t,r)}throw o}}async function pP(t,{serverUrl:r,authorizationCode:o,iss:i,scope:a,resourceMetadataUrl:n,fetchFn:s,skipIssuerMetadataValidation:l,forceReauthorization:c}){var u;let d,p,h,m,f,y={...f=(u=t).clientMetadata,grant_types:f.grant_types??(void 0===u.redirectUrl?void 0:["authorization_code","refresh_token"]),application_type:f.application_type??function(t){for(let r of t??[]){let t;try{t=new URL(r)}catch{continue}if("http:"!==t.protocol&&"https:"!==t.protocol||pS(t.hostname))return"native"}return"web"}(f.redirect_uris)},g=await t.discoveryState?.(),v=n;if(!v&&g?.resourceMetadataUrl&&(v=new URL(g.resourceMetadataUrl)),g?.authorizationServerUrl){if(p=g.authorizationServerUrl,d=g.resourceMetadata,h=g.authorizationServerMetadata??await pj(p,{fetchFn:s,skipIssuerValidation:l}),!d)try{d=await px(r,{resourceMetadataUrl:v},s)}catch(t){if(t instanceof TypeError)throw t}(h!==g.authorizationServerMetadata||d!==g.resourceMetadata)&&await t.saveDiscoveryState?.({authorizationServerUrl:String(p),resourceMetadataUrl:v?.toString(),resourceMetadata:d,authorizationServerMetadata:h})}else{let t=await pI(r,{resourceMetadataUrl:v,fetchFn:s,skipIssuerMetadataValidation:l});p=t.authorizationServerUrl,h=t.authorizationServerMetadata,d=t.resourceMetadata,m={authorizationServerUrl:String(p),resourceMetadataUrl:v?.toString(),resourceMetadata:d,authorizationServerMetadata:h}}let _=h?.issuer??String(p),b={issuer:_};if(await t.saveAuthorizationServerUrl?.(_),void 0!==o){let r=g?.authorizationServerMetadata?.issuer??g?.authorizationServerUrl;if(void 0===r){if(void 0!==t.saveDiscoveryState)throw new pc("discoveryState was not available on the callback leg; ensure your provider persists discoveryState alongside codeVerifier",_);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(!pp(r,_))throw new pc(r,_)}m&&await t.saveDiscoveryState?.(m);let S=await pR(r,t,d);S&&await t.saveResourceUrl?.(String(S));let w=function(t){let{requestedScope:r,resourceMetadata:o,authServerMetadata:i,clientMetadata:a}=t,n=r||o?.scopes_supported?.join(" ")||a.scope;return n&&i?.scopes_supported?.includes("offline_access")&&!n.split(" ").includes("offline_access")&&a.grant_types?.includes("refresh_token")&&(n=`${n} offline_access`),n}({requestedScope:a,resourceMetadata:d,authServerMetadata:h,clientMetadata:t.clientMetadata}),$=await Promise.resolve(t.clientInformation(b)),P=pd($,_,{canPersistStamp:void 0!==t.saveClientInformation});if(void 0===P&&$?.issuer&&void 0===t.saveClientInformation)throw new pc($.issuer,_);if(P&&void 0===P.issuer&&(P={...P,issuer:_},await t.saveClientInformation?.(P,b)),!P){if(void 0!==o)throw Error("Existing OAuth client information is required when exchanging an authorization code");let r=h?.client_id_metadata_document_supported===!0,i=t.clientMetadataUrl;if(i&&!function(t){if(!t)return!1;try{let r=new URL(t);return"https:"===r.protocol&&"/"!==r.pathname}catch{return!1}}(i))throw new lD(lL.InvalidClientMetadata,`clientMetadataUrl must be a valid HTTPS URL with a non-root pathname, got: ${i}`);if(r&&i)P={client_id:i,issuer:_},await t.saveClientInformation?.(P,b);else{if(!t.saveClientInformation)throw Error("OAuth client information must be saveable for dynamic registration");P={...await pM(p,{metadata:h,clientMetadata:y,scope:w,fetchFn:s}),issuer:_},await t.saveClientInformation(P,b)}}let R=!t.redirectUrl;if(void 0!==o||R){void 0!==o&&py({iss:i,expectedIssuer:h?.issuer,issParameterSupported:pf(h)});let r=await pq(t,p,{metadata:h,resource:S,authorizationCode:o,iss:i,scope:w,fetchFn:s});return await t.saveTokens({...r,issuer:_},b),"AUTHORIZED"}let E=pd(await t.tokens(b),_);if(E&&void 0===E.issuer&&(E={...E,issuer:_},await t.saveTokens(E,b)),E?.refresh_token&&!c)try{let r=await pz(p,{metadata:h,clientInformation:P,refreshToken:E.refresh_token,resource:S,addClientAuthentication:t.addClientAuthentication,fetchFn:s});return await t.saveTokens({...r,issuer:_},b),"AUTHORIZED"}catch(t){if(t instanceof pl||t instanceof lD&&t.code!==lL.ServerError)throw t}let k=t.state?await t.state():void 0,{authorizationUrl:x,codeVerifier:T}=await pN(p,{metadata:h,clientInformation:P,state:k,redirectUrl:t.redirectUrl,scope:w,resource:S});return await t.saveCodeVerifier(T),await t.redirectToAuthorization(x),"REDIRECT"}async function pR(t,r,o){var i;let a,n=((a=new URL("string"==typeof(i=t)?i:i.href)).hash="",a);if(r.validateResourceURL)return await r.validateResourceURL(n,o?.resource);if(o){if(!function({requestedResource:t,configuredResource:r}){let o=new URL("string"==typeof t?t:t.href),i=new URL("string"==typeof r?r:r.href);if(o.origin!==i.origin||o.pathname.length<i.pathname.length)return!1;let a=o.pathname.endsWith("/")?o.pathname:o.pathname+"/",n=i.pathname.endsWith("/")?i.pathname:i.pathname+"/";return a.startsWith(n)}({requestedResource:n,configuredResource:o.resource}))throw Error(`Protected resource ${o.resource} does not match expected ${n} (or origin)`);return new URL(o.resource)}}function pE(t){let r,o=t.headers.get("WWW-Authenticate");if(!o)return{};let[i,a]=o.split(" ");if(i?.toLowerCase()!=="bearer"||!a)return{};let n=pk(t,"resource_metadata")||void 0;if(n)try{r=new URL(n)}catch{}let s=pk(t,"scope")||void 0,l=pk(t,"error")||void 0;return{resourceMetadataUrl:r,scope:s,error:l,errorDescription:pk(t,"error_description")||void 0}}function pk(t,r){let o=t.headers.get("WWW-Authenticate");if(!o)return null;let i=new RegExp(String.raw`${r}=(?:"([^"]+)"|([^\s,]+))`),a=o.match(i);if(a){let t=a[1]||a[2];if(t)return t}return null}async function px(t,r,o=fetch){let i=await pC(t,"oauth-protected-resource",o,{protocolVersion:r?.protocolVersion,metadataUrl:r?.resourceMetadataUrl});if(!i||404===i.status)throw await i?.text?.().catch(()=>{}),Error("Resource server does not implement OAuth 2.0 Protected Resource Metadata.");if(!i.ok)throw await i.text?.().catch(()=>{}),Error(`HTTP ${i.status} trying to load well-known OAuth protected resource metadata.`);return l$.parse(await i.json())}async function pT(t,r,o=fetch){try{return await o(t,{headers:r})}catch(t){throw t}}async function pO(t,r,o=fetch){return await pT(t,{"MCP-Protocol-Version":r},o)}async function pC(t,r,o,i){var a,n;let s,l=new URL(t),c=i?.protocolVersion??aD;i?.metadataUrl?s=new URL(i.metadataUrl):(s=new URL(function(t,r="",o={}){return r.endsWith("/")&&(r=r.slice(0,-1)),o.prependPathname?`${r}/.well-known/${t}`:`/.well-known/${t}${r}`}(r,l.pathname),i?.metadataServerUrl??l)).search=l.search;let u=await pO(s,c,o);return!i?.metadataUrl&&(a=u,n=l.pathname,!a||"/"!==n&&(a.status>=400&&a.status<500||502===a.status))&&(u=await pO(new URL(`/.well-known/${r}`,l),c,o)),u}async function pj(t,{fetchFn:r=fetch,protocolVersion:o=aD,skipIssuerValidation:i=!1}={}){let a={"MCP-Protocol-Version":o,Accept:"application/json"};for(let{url:o,type:n}of function(t){let r="string"==typeof t?new URL(t):t,o="/"!==r.pathname,i=[];if(!o)return i.push({url:new URL("/.well-known/oauth-authorization-server",r.origin),type:"oauth"},{url:new URL("/.well-known/openid-configuration",r.origin),type:"oidc"}),i;let a=r.pathname;return a.endsWith("/")&&(a=a.slice(0,-1)),i.push({url:new URL(`/.well-known/oauth-authorization-server${a}`,r.origin),type:"oauth"},{url:new URL(`/.well-known/openid-configuration${a}`,r.origin),type:"oidc"},{url:new URL(`${a}/.well-known/openid-configuration`,r.origin),type:"oidc"}),i}(t)){let s=await pT(o,a,r);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"===n?"OAuth":"OpenID provider"} metadata from ${o}`)}let l="oauth"===n?lP.parse(await s.json()):lE.parse(await s.json());if(!i){let r="string"==typeof t?t:t.href;if(!(l.issuer===r||r.endsWith("/")&&l.issuer===r.slice(0,-1)))throw new pn("metadata",r,l.issuer)}return l}}async function pI(t,r){let o,i;try{(o=await px(t,{resourceMetadataUrl:r?.resourceMetadataUrl},r?.fetchFn)).authorization_servers&&o.authorization_servers.length>0&&(i=o.authorization_servers[0])}catch(t){if(t instanceof TypeError)throw t}i||(i=String(new URL("/",t)));let a=await pj(i,{fetchFn:r?.fetchFn,skipIssuerValidation:r?.skipIssuerMetadataValidation});return{authorizationServerUrl:i,authorizationServerMetadata:a,resourceMetadata:o}}async function pN(t,{metadata:r,clientInformation:o,redirectUrl:i,scope:a,state:n,resource:s}){let l;if(r){if(l=new URL(r.authorization_endpoint),!r.response_types_supported.includes(p_))throw Error(`Incompatible auth server: does not support response type ${p_}`);if(r.code_challenge_methods_supported&&!r.code_challenge_methods_supported.includes(pb))throw Error(`Incompatible auth server: does not support code challenge method ${pb}`)}else l=new URL("/authorize",t);let c=await d7(),u=c.code_verifier,d=c.code_challenge;return l.searchParams.set("response_type",p_),l.searchParams.set("client_id",o.client_id),l.searchParams.set("code_challenge",d),l.searchParams.set("code_challenge_method",pb),l.searchParams.set("redirect_uri",String(i)),n&&l.searchParams.set("state",n),a&&l.searchParams.set("scope",a),a?.split(" ").includes("offline_access")&&l.searchParams.append("prompt","consent"),s&&l.searchParams.set("resource",s.href),{authorizationUrl:l,codeVerifier:u}}async function pA(t,{metadata:r,tokenRequestParams:o,clientInformation:i,addClientAuthentication:a,resource:n,fetchFn:s}){var l,c;let u,d=function(t){let r=new URL(String(t));if("https:"!==r.protocol&&!pS(r.hostname))throw new pl(r.href);return r}(r?.token_endpoint??new URL("/token",t)),p=new Headers({"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"});n&&o.set("resource",n.href),a?await a(p,o,d,r):i&&function(t,r,o,i){let{client_id:a,client_secret:n}=r;switch(t){case"client_secret_basic":var s,l,c,u,d=a,p=n,h=o;if(!p)throw Error("client_secret_basic authentication requires a client_secret");let m=btoa(`${d}:${p}`);h.set("Authorization",`Basic ${m}`);return;case"client_secret_post":s=a,l=n,(c=i).set("client_id",s),l&&c.set("client_secret",l);return;case"none":u=a,i.set("client_id",u);return;default:throw Error(`Unsupported client authentication method: ${t}`)}}((l=i,c=r?.token_endpoint_auth_methods_supported??[],u=void 0!==l.client_secret,"token_endpoint_auth_method"in l&&l.token_endpoint_auth_method&&["client_secret_basic","client_secret_post","none"].includes(l.token_endpoint_auth_method)&&(0===c.length||c.includes(l.token_endpoint_auth_method))?l.token_endpoint_auth_method:0===c.length?u?"client_secret_basic":"none":u&&c.includes("client_secret_basic")?"client_secret_basic":u&&c.includes("client_secret_post")?"client_secret_post":c.includes("none")?"none":u?"client_secret_post":"none"),i,p,o);let h=await (s??fetch)(d,{method:"POST",headers:p,body:o});if(!h.ok)throw await pw(h);let m=await h.json();try{return lk.parse(m)}catch(t){if("object"==typeof m&&null!==m&&"error"in m)throw await pw(JSON.stringify(m));throw t}}async function pz(t,{metadata:r,clientInformation:o,refreshToken:i,resource:a,addClientAuthentication:n,fetchFn:s}){return{refresh_token:i,...await pA(t,{metadata:r,tokenRequestParams:new URLSearchParams({grant_type:"refresh_token",refresh_token:i}),clientInformation:o,addClientAuthentication:n,resource:a,fetchFn:s})}}async function pq(t,r,{metadata:o,resource:i,authorizationCode:a,iss:n,scope:s,fetchFn:l}={}){let c;void 0!==a&&py({iss:n,expectedIssuer:o?.issuer,issParameterSupported:pf(o)});let u=s??t.clientMetadata.scope;if(t.prepareTokenRequest&&(c=await t.prepareTokenRequest(u)),!c){var d,p;if(!a)throw Error("Either provider.prepareTokenRequest() or authorizationCode is required");if(!t.redirectUrl)throw Error("redirectUrl is required for authorization_code flow");d=a,p=await t.codeVerifier(),c=new URLSearchParams({grant_type:"authorization_code",code:d,code_verifier:p,redirect_uri:String(t.redirectUrl)})}let h=await t.clientInformation({issuer:o?.issuer??String(r)});return pA(r,{metadata:o,tokenRequestParams:c,clientInformation:h??void 0,addClientAuthentication:t.addClientAuthentication,resource:i,fetchFn:l})}async function pM(t,{metadata:r,clientMetadata:o,scope:i,fetchFn:a}){let n;if(r){if(!r.registration_endpoint)throw Error("Incompatible auth server: does not support dynamic client registration");n=new URL(r.registration_endpoint)}else n=new URL("/register",t);let s={...o,...void 0===i?{}:{scope:i}},l=await (a??fetch)(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(!l.ok)throw new ps({status:l.status,body:await l.text(),submittedMetadata:s});return lI.parse(await l.json())}let pL=new Set(["tools/list","prompts/list","resources/list","resources/templates/list","server/discover"]);var pD=class{_entries=new Map;_maxEntries;_stamp=0;_cappedSize=0;constructor(t){this._maxEntries=t?.maxEntries??512}get size(){return this._entries.size}get(t){return this._entries.get(pU(t))}set(t,r){let o=pU(t),i=pL.has(t.method),a=!this._entries.has(o);if(!i&&a&&this._maxEntries>0&&this._cappedSize>=this._maxEntries){for(let t of this._entries.keys())if(!pL.has(t.slice(0,t.indexOf("\0")))){this._entries.delete(t),this._cappedSize--;break}}let n=++this._stamp;return this._entries.set(o,{...r,stamp:n}),a&&!i&&this._cappedSize++,n}delete(t){this._entries.delete(pU(t))&&!pL.has(t.method)&&this._cappedSize--}evict(t){let r=`${t}\0`,o=pL.has(t);for(let t of this._entries.keys())t.startsWith(r)&&(this._entries.delete(t),!o&&this._cappedSize--)}clear(){this._entries.clear(),this._cappedSize=0}};function pU(t){return`${t.method}\0${JSON.stringify([t.partition??"",t.params??""])}`}function pV(t,r){return void 0===r?t:`${t}\0${r}`}var pH=class{_evictionGeneration=new Map;_toolIndex;_toolOutputValidatorIndex;_serverIdentity="";constructor(t,r,o=()=>{},i="",a=Date.now){this._store=t,this._isUserSupplied=r,this._reportError=o,this._cachePartition=i,this._now=a}now(){return this._now()}setServerIdentity(t){this._serverIdentity=t}_partitionFor(t){return JSON.stringify([this._serverIdentity,"public"===t?"":this._cachePartition])}async _probe(t,r){let o={method:t,params:r??""},i=this._partitionFor("private"),a=await this._store.get({...o,partition:i});if(void 0!==a)return a;let n=this._partitionFor("public");if(n===i)return;let s=await this._store.get({...o,partition:n});return s?.scope==="public"?s:void 0}async evict(t){this._evictionGeneration.set(t,(this._evictionGeneration.get(t)??0)+1),await this._deleteBoth(t,"")}async _deleteBoth(t,r){let o=this._partitionFor("private"),i=this._partitionFor("public");try{await this._store.delete({method:t,params:r,partition:o})}catch(t){this._reportError(t)}if(i!==o)try{await this._store.delete({method:t,params:r,partition:i})}catch(t){this._reportError(t)}}async evictKey(t,r){let o=pV(t,r),i=this._evictionGeneration.get(o);void 0!==i&&this._evictionGeneration.set(o,i+1),await this._deleteBoth(t,r)}captureGeneration(t,r){let o=pV(t,r),i=this._evictionGeneration.get(o)??0;return this._evictionGeneration.set(o,i),i}async write(t,r,o,i){if((this._evictionGeneration.get(pV(t,i?.params))??0)!==o)return;let a=i?.params??"",n=this._partitionFor("private"),s=this._partitionFor("public"),l=(i?.scope??"private")==="public"?s:n;try{await this._store.set({method:t,params:a,partition:l},{value:function(t){let r;try{r=JSON.stringify(t)}catch(t){throw TypeError(`cache value is not JSON-serializable: ${t instanceof Error?t.message:String(t)}`)}if("string"!=typeof r)throw TypeError("cache value is not JSON-serializable: it has no JSON representation");return r}(r),expiresAt:i?.expiresAt,scope:i?.scope})}catch(t){this._reportError(t)}if(s!==n)try{await this._store.delete({method:t,params:a,partition:l===n?s:n})}catch(t){this._reportError(t)}}async read(t,r){let o=await this._probe(t,r);if(o?.expiresAt!==void 0&&o.expiresAt>this.now())try{let t=JSON.parse(o.value);if("object"!=typeof t||null===t||Array.isArray(t))throw TypeError("cached document is not an object");return{value:t}}catch(o){this._reportError(o),await this._deleteBoth(t,r??"");return}}resetForReconnect(){this._isUserSupplied||this._store.clear(),this._evictionGeneration.clear(),this._toolIndex=void 0,this._toolOutputValidatorIndex=void 0,this._serverIdentity=""}async toolDefinition(t){let r=await this._probe("tools/list");if(void 0===r){this._toolIndex=void 0;return}if(this._toolIndex?.stamp!==r.stamp){let t=this._decodeListTools(r),o=new Map;if(void 0!==t)for(let r of t.tools)o.set(r.name,r);this._toolIndex={stamp:r.stamp,byName:o}}return this._toolIndex.byName.get(t)}async outputValidator(t,r){let o=await this._probe("tools/list");if(void 0===o){this._toolOutputValidatorIndex=void 0;return}if(this._toolOutputValidatorIndex?.stamp!==o.stamp){let t=this._decodeListTools(o)??{tools:[]},i=new Map;for(let o of t.tools){let t=r(o);void 0!==t&&i.set(o.name,t)}this._toolOutputValidatorIndex={stamp:o.stamp,byName:i}}return this._toolOutputValidatorIndex.byName.get(t)}_decodeListTools(t){try{let r=JSON.parse(t.value);if(!Array.isArray(r?.tools)||!r.tools.every(t=>null!==t&&"object"==typeof t))throw TypeError("cached tools/list document has a malformed tools array");return r}catch(t){this._reportError(t);return}}};let pF=Symbol.for("mcp.authSeamEscape");function pK(t){if("object"==typeof t&&null!==t||"function"==typeof t)try{Object.defineProperty(t,pF,{value:!0,configurable:!0})}catch{}return t}let pJ=new Set([-32001,-32020,-32021]);function pZ(t,r){let{code:o,message:i,data:a}=t;if(-32022===o){let t=function(t){if("object"!=typeof t||null===t)return;let r=t.supported;if(Array.isArray(r)&&0!==r.length&&r.every(t=>"string"==typeof t))return r}(a);if(void 0===t)return{kind:"legacy"};let o=new cp({supported:t,requested:function(t){if("object"!=typeof t||null===t)return;let r=t.requested;return"string"==typeof r?r:void 0}(a)??r.requestedVersion},i),n=lZ(t),s=r.clientModernVersions.find(t=>n.includes(t));return void 0!==s?{kind:"corrective",version:s,error:o}:n.length>0?{kind:"error",error:o}:r.fallbackAvailable?{kind:"legacy"}:{kind:"error",error:o}}return pJ.has(o),{kind:"legacy"}}function pW(t,r){var o,i;return"browser"===r.environment&&((o=t)instanceof TypeError||o instanceof Error&&"TypeError"===o.name)?{kind:"legacy"}:{kind:"error",error:new lV(lU.EraNegotiationFailed,`Version negotiation probe failed: ${(i=t)instanceof Error?i.message:String(i)}`,{cause:t})}}function pB(){let t=globalThis;return void 0!==t.window&&void 0!==t.document?"browser":"node"}function pG(t){return"stderr"in t&&"pid"in t?"stdio":"http"}var pX=class t{_pending;_probeCounter=0;_savedOnMessage;_savedOnError;_savedOnClose;_closeDelivered=!1;constructor(t){this._transport=t,this._savedOnMessage=t.onmessage,this._savedOnError=t.onerror,this._savedOnClose=t.onclose}static async open(r){let o=new t(r);r.onmessage=t=>{let r=o._pending;if(void 0!==r&&(cA(t)||cz(t))&&t.id===r.id){o._pending=void 0,cA(t)?r.resolve({kind:"response",result:t.result}):r.resolve({kind:"response",error:t.error});return}},r.onerror=t=>{o._savedOnError?.(t)},r.onclose=()=>{let t=o._pending;void 0!==t&&(o._pending=void 0,t.resolve({kind:"closed"})),o._closeDelivered=!0,o._savedOnClose?.()};try{await r.start()}catch(t){throw o.detach(),t}return o}async exchange(t,r){let o=`server-discover-probe-${++this._probeCounter}`;return new Promise(i=>{let a=!1,n=t=>{a||(a=!0,clearTimeout(s),this._pending?.id===o&&(this._pending=void 0),i(t))},s=setTimeout(()=>n({kind:"timeout"}),r);this._pending={id:o,resolve:n},this._transport.send(t(o)).catch(t=>n({kind:"send-error",error:t}))})}detach(){if(this._pending=void 0,this._transport.onmessage=this._savedOnMessage,this._transport.onerror=this._savedOnError,this._closeDelivered&&void 0!==this._savedOnClose){let t=this._savedOnClose,r=this._transport,o=!1,i=()=>{if(!o){o=!0;return}t()};r.onclose=i,pY.set(r,()=>{r.onclose===i&&(r.onclose=t)})}else this._transport.onclose=this._savedOnClose}release(){this.detach();let t=this._transport,r=t.start,o=!0;t.start=async function(){if(o){o=!1,t.start=r;return}return r.call(t)}}};let pY=new WeakMap;function pQ(t){let r=pY.get(t);pY.delete(t),r?.()}async function p0(t,r){let o,i=t.probe.timeoutMs??r.defaultTimeoutMs,a=Math.max(0,t.probe.maxRetries??0),n="pin"===t.kind?[t.version]:t.modernVersions,s="auto"===t.kind&&t.fallbackAvailable,l=await pX.open(r.transport),c=async()=>{let o=n[0],c=!1,u=a;for(;;){let a=await l.exchange(t=>{var i,a,n,s;return i=t,a=o,n=r.clientInfo,s=r.capabilities,{jsonrpc:"2.0",id:i,method:"server/discover",params:{_meta:cT(a).outboundEnvelope({protocolVersion:a,clientInfo:n,clientCapabilities:s})}}},i);if("timeout"===a.kind&&u>0){u--;continue}let d=function(t,r){switch(t.kind){case"response":return void 0===t.error?{kind:"result",result:t.result}:{kind:"rpc-error",...t.error};case"send-error":{var o;let r=t.error;if(("object"==typeof(o=r)&&null!==o||"function"==typeof o)&&!0===o[pF]||r instanceof pm||r instanceof Error&&"UnauthorizedError"===r.name)return{kind:"auth-required",error:r};if(r instanceof lH){let t=r.data?.text;return{kind:"http-error",status:r.data.status,body:"string"==typeof t?t:void 0,statusText:r.data.statusText}}return{kind:"network-error",error:r}}case"closed":return{kind:"closed"};case"timeout":return{kind:"timeout",timeoutMs:r}}}(a,i),p=function(t,r){switch(t.kind){case"result":return function(t,r){let o=cT(cx).validateResult("server/discover",t);if(!o.ok)return{kind:"legacy"};let i=o.value.supportedVersions,a=r.clientModernVersions.find(t=>i.includes(t));return void 0!==a?{kind:"modern",version:a,discover:o.value}:r.fallbackAvailable?{kind:"legacy"}:{kind:"error",error:new cp({supported:[...i],requested:r.requestedVersion})}}(t.result,r);case"rpc-error":return pZ(t,r);case"http-error":return function(t,r){if(401===t.status||403===t.status){let r=403===t.status;return{kind:"error",error:new lH(r?lU.ClientHttpForbidden:lU.ClientHttpAuthentication,`Version negotiation failed: ${r?"the server denied access (HTTP 403)":"the server requires authorization (HTTP 401)"}`,{status:t.status,statusText:t.statusText,text:t.body})}}if(t.status>=500)return{kind:"error",error:new lH(lU.EraNegotiationFailed,`Version negotiation failed: the server answered the probe with HTTP ${t.status}`,{status:t.status,statusText:t.statusText,text:t.body})};let o=function(t){let r;if(void 0===t||""===t)return;try{r=JSON.parse(t)}catch{return}if("object"!=typeof r||null===r)return;let o=r.error;if("object"!=typeof o||null===o)return;let{code:i,message:a,data:n}=o;if("number"==typeof i)return{code:i,message:"string"==typeof a?a:"",data:n}}(t.body);return void 0!==o?pZ(o,r):{kind:"legacy"}}(t,r);case"network-error":return pW(t.error,r);case"auth-required":return{kind:"error",error:t.error};case"closed":if("stdio"===r.transportKind)return{kind:"legacy"};return pW(Error("Connection closed during the version negotiation probe"),r);case"timeout":if("stdio"===r.transportKind)return{kind:"legacy"};return{kind:"error",error:new lV(lU.RequestTimeout,`Version negotiation probe timed out after ${t.timeoutMs}ms`,{timeout:t.timeoutMs})}}}(d,{clientModernVersions:n,requestedVersion:o,fallbackAvailable:s,environment:r.environment,transportKind:r.transportKind});switch(p.kind){case"modern":return{era:"modern",version:p.version,discover:p.discover};case"corrective":if(c)throw p.error;c=!0,o=p.version;continue;case"legacy":{let o="closed"===d.kind?"the connection closed during the server/discover probe":void 0;if("pin"===t.kind)throw new lV(lU.EraNegotiationFailed,void 0===o?`Version negotiation failed: the server did not offer pinned protocol version ${t.version} via server/discover (no fallback in pin mode)`:`Version negotiation failed: ${o} before the server offered pinned protocol version ${t.version} (no fallback in pin mode)`);if(!t.fallbackAvailable)throw new lV(lU.EraNegotiationFailed,void 0===o?"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: ${o} and this client supports no pre-2026-07-28 protocol version to fall back to`);if(void 0!==o&&!0!==r.disposableProbe)throw new lV(lU.EraNegotiationFailed,`Version negotiation failed: ${o} (this transport probed in place — the disposable sibling probe requires the SDK's base StdioClientTransport)`);return{era:"legacy"}}case"error":throw p.error}}};try{o=await c()}catch(t){throw l.detach(),t}return l.release(),o}async function p1(t,r,o,i){let a,n,s=new r.constructor({...o,stderr:"ignore"}),l=r.close,c=!1,u=new Promise((t,r)=>{a=()=>r(p2())});r.close=async function(){return c=!0,a?.(),l.call(r)};try{let r=p0(t,{...i,transport:s,transportKind:"stdio",disposableProbe:!0});r.catch(()=>{}),n=await Promise.race([r,u])}finally{await p9(s),r.close=l}if(c)throw p2();return n}function p2(){return new lV(lU.EraNegotiationFailed,"Version negotiation failed: the transport was closed during the server/discover probe")}async function p9(t){try{let r=t._dispose;await ("function"==typeof r?r.call(t):t.close())}catch{}}function p4(t){let r=t._meta?.[aF];return c7.Implementation(r)?r:void 0}let p5={"notifications/tools/list_changed":["tools/list"],"notifications/prompts/list_changed":["prompts/list"],"notifications/resources/list_changed":["resources/list","resources/templates/list"]};var p3=class extends ua{_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 t=new lV(lU.ConnectionClosed,"subscriptions/listen: client reconnected or closed; subscription state from the previous connection was reset");for(let r of this._listenState.values())r.settle({cause:"remote",error:t})}for(let t of(this._listenState.clear(),this._listChangedDebounceTimers.values()))clearTimeout(t);this._listChangedDebounceTimers.clear(),this._cache.resetForReconnect()}async close(){try{await super.close()}finally{this._resetConnectionState()}}constructor(t,r){super(r),this._clientInfo=t,this._capabilities=r?.capabilities?{...r.capabilities}:{},this._jsonSchemaValidator=r?.jsonSchemaValidator??new d4,this._enforceStrictCapabilities=r?.enforceStrictCapabilities??!1,this._versionNegotiation=r?.versionNegotiation,this._supportedProtocolVersionsOption=r?.supportedProtocolVersions,this._inputRequiredDriverConfig=function(t){return{autoFulfill:t?.autoFulfill??!0,maxRounds:t?.maxRounds??10}}(r?.inputRequired),this._cache=new pH(r?.responseCacheStore??new pD,r?.responseCacheStore!==void 0,t=>this._reportStoreError(t),r?.cachePartition??""),this._defaultCacheTtlMs=r?.defaultCacheTtlMs??0,this._listMaxPages=r?.listMaxPages??64,r?.listChanged&&(this._listChangedConfig=r.listChanged)}buildContext(t,r){return t}_shouldDropInbound(t){let r;if(void 0!==this._negotiatedProtocolVersion&&this._negotiatedProtocolVersion>=lF&&(r=t,ne.safeParse(r).success))return"drop"}_outboundMetaEnvelope(){let t=this._negotiatedProtocolVersion;if(void 0!==t)return this._wireCodec().outboundEnvelope({protocolVersion:t,clientInfo:this._clientInfo,clientCapabilities:this._capabilities})}_resolveNonCompleteResult(t,r){return this._inputRequiredDriverConfig.autoFulfill?function(t,r,o,i){let{codec:a,request:n,options:s,flowStartedAt:l}=i,c={inputRequests:o.inputRequests,...void 0!==o.requestState&&{requestState:o.requestState}};return c5({config:r,method:n.method,originalParams:n.params,firstPayload:c,flowStartedAt:l,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:(r,o,i)=>uc(t,a,r,o,i),retry:(t,r)=>{var o,a;return i.retry(t,(o=s,a=r,{...o?.signal!==void 0&&{signal:o.signal},...o?.onprogress!==void 0&&{onprogress:o.onprogress},...o?.resetTimeoutOnProgress!==void 0&&{resetTimeoutOnProgress:o.resetTimeoutOnProgress},...o?.headers!==void 0&&{headers:o.headers},...void 0!==a.timeout&&{timeout:a.timeout},...void 0!==a.maxTotalTimeout&&{maxTotalTimeout:a.maxTotalTimeout},allowInputRequired:!0}))}}})}({getRequestHandler:t=>this._getRequestHandler(t),buildContext:t=>this.buildContext(t,void 0),sessionId:this.transport?.sessionId},this._inputRequiredDriverConfig,t,r):Promise.reject(new lV(lU.UnsupportedResultType,`Unsupported result type 'input_required' for ${r.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:r.request.method}))}_setupListChangedHandlers(t){t.tools&&this._serverCapabilities?.tools?.listChanged&&this._setupListChangedHandler("tools","notifications/tools/list_changed",t.tools,async()=>(await this.listTools(void 0,{cacheMode:"refresh"})).tools),t.prompts&&this._serverCapabilities?.prompts?.listChanged&&this._setupListChangedHandler("prompts","notifications/prompts/list_changed",t.prompts,async()=>(await this.listPrompts(void 0,{cacheMode:"refresh"})).prompts),t.resources&&this._serverCapabilities?.resources?.listChanged&&this._setupListChangedHandler("resources","notifications/resources/list_changed",t.resources,async()=>(await this.listResources(void 0,{cacheMode:"refresh"})).resources)}registerCapabilities(t){if(this.transport)throw Error("Cannot register capabilities after connecting to transport");this._capabilities=function(t,r){let o={...t};for(let t in r){let i=r[t];if(void 0===i)continue;let a=o[t];o[t]=un(a)&&un(i)?{...a,...i}:i}return o}(this._capabilities,t)}setVersionNegotiation(t){if(this.transport)throw Error("Cannot configure version negotiation after connecting to transport");this._versionNegotiation=t}_wrapHandler(t,r){return"elicitation/create"===t?async(t,o)=>{let i=cT(this._negotiatedProtocolVersion),a=i.validateRequest("elicitation/create",t);if(a.ok||"not-in-era"!==a.reason||(a=i.validateInputRequest("elicitation/create",t)),!a.ok)throw new cc("not-in-era"===a.reason?cl.InternalError:cl.InvalidParams,"not-in-era"===a.reason?"No wire schema for elicitation/create in the resolved era":`Invalid elicitation request: ${a.message}`);let{params:n}=a.value;n.mode=n.mode??"form";let{supportsFormMode:s,supportsUrlMode:l}=function(t){if(!t)return{supportsFormMode:!1,supportsUrlMode:!1};let r=void 0!==t.form,o=void 0!==t.url;return{supportsFormMode:r||!r&&!o,supportsUrlMode:o}}(this._capabilities.elicitation);if("form"===n.mode&&!s)throw new cc(cl.InvalidParams,"Client does not support form-mode elicitation requests");if("url"===n.mode&&!l)throw new cc(cl.InvalidParams,"Client does not support URL-mode elicitation requests");let c=await r(t,o),u=i.validateResult("elicitation/create",c);if(u.ok||"not-in-era"!==u.reason||(u=i.validateInputResponse("elicitation/create",c)),!u.ok)throw new cc("not-in-era"===u.reason?cl.InternalError:cl.InvalidParams,"not-in-era"===u.reason?"No wire schema for elicitation/create in the resolved era":`Invalid elicitation result: ${u.message}`);let d=u.value,p="form"===n.mode?n.requestedSchema:void 0;if("form"===n.mode&&"accept"===d.action&&d.content&&p&&this._capabilities.elicitation?.form?.applyDefaults)try{!function t(r,o){if(r&&null!==o&&"object"==typeof o){if("object"===r.type&&r.properties&&"object"==typeof r.properties){let i=r.properties;for(let r of Object.keys(i)){let a=i[r];void 0===o[r]&&Object.prototype.hasOwnProperty.call(a,"default")&&(o[r]=a.default),void 0!==o[r]&&t(a,o[r])}}if(Array.isArray(r.anyOf))for(let i of r.anyOf)"boolean"!=typeof i&&t(i,o);if(Array.isArray(r.oneOf))for(let i of r.oneOf)"boolean"!=typeof i&&t(i,o)}}(p,d.content)}catch{}return d}:"sampling/createMessage"===t?async(t,o)=>{let i=cT(this._negotiatedProtocolVersion),a=i.validateRequest("sampling/createMessage",t);if(a.ok||"not-in-era"!==a.reason||(a=i.validateInputRequest("sampling/createMessage",t)),!a.ok)throw new cc("not-in-era"===a.reason?cl.InternalError:cl.InvalidParams,"not-in-era"===a.reason?"No wire schema for sampling/createMessage in the resolved era":`Invalid sampling request: ${a.message}`);let{params:n}=a.value,s=await r(t,o),l=!!(n.tools||n.toolChoice),c=i.samplingResultVariant(l,s);if(c.ok||"not-in-era"!==c.reason||(c=i.validateInputResponse("sampling/createMessage",s)),!c.ok)throw new cc("not-in-era"===c.reason?cl.InternalError:cl.InvalidParams,"not-in-era"===c.reason?"No result schema for sampling/createMessage in the resolved era":`Invalid sampling result: ${c.message}`);return c.value}:r}assertCapability(t,r){if(!this._serverCapabilities?.[t])throw new lV(lU.CapabilityNotSupported,`Server does not support ${t} (required for ${r})`)}async connect(t,r){if(r?.prior!=null)return this._connectFromPrior(t,function(t){if("object"==typeof t&&null!==t&&("legacy"===t.kind&&!("supportedVersions"in t)&&!("discover"in t)||"modern"===t.kind&&nP.safeParse(t.discover).success))return t;throw new lV(lU.EraNegotiationFailed,"connect({ prior }): unrecognized prior — expected { kind: 'modern', discover } or { kind: 'legacy' }")}(r.prior),r);let o=function(t,r){let o=t?.mode??"legacy";if("legacy"===o)return{kind:"legacy"};let i=t?.probe??{};if("object"==typeof o){if(!(o.pin>=lF))throw TypeError(`versionNegotiation: { pin: '${o.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:o.pin,probe:i}}let a=r?lZ(r):[];return{kind:"auto",modernVersions:a.length>0?a:[...lK],fallbackAvailable:!r||lJ(r).length>0,probe:i}}(this._versionNegotiation,this._supportedProtocolVersionsOption);return"legacy"!==o.kind?this._connectNegotiated(t,o,r):this._connectPlainLegacy(t,r)}async _connectPlainLegacy(t,r){if(await super.connect(t),void 0!==t.sessionId){let r=this._negotiatedProtocolVersion;void 0!==r&&t.setProtocolVersion?.(r);return}this._resetConnectionState(),await this._legacyHandshake(t,r)}async _legacyHandshake(t,r){let o=lJ(this._supportedProtocolVersions);try{let i=o[0];if(void 0===i)throw new lV(lU.EraNegotiationFailed,"Cannot run the initialize handshake: supportedProtocolVersions contains no pre-2026-07-28 protocol version");let a=await this.request({method:"initialize",params:{protocolVersion:i,capabilities:this._capabilities,clientInfo:this._clientInfo}},r);if(void 0===a)throw Error(`Server sent invalid initialize result: ${a}`);if(!o.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(t)),t.setProtocolVersion&&t.setProtocolVersion(a.protocolVersion),this._instructions=a.instructions,await this.notification({method:"notifications/initialized"}),this._negotiatedProtocolVersion=a.protocolVersion,this._listChangedConfig&&this._setupListChangedHandlers(this._listChangedConfig)}catch(t){throw this.close(),t}}async _connectNegotiated(t,r,o){let i;if(void 0!==t.sessionId){await super.connect(t);let r=this._negotiatedProtocolVersion;void 0!==r&&t.setProtocolVersion&&t.setProtocolVersion(r);return}this._resetConnectionState();try{let a=pG(t),n={clientInfo:this._clientInfo,capabilities:this._capabilities,environment:pB(),defaultTimeoutMs:o?.timeout??6e4},s="stdio"===a?function(t){let r=Object.getPrototypeOf(t);if(null===r||!Object.prototype.hasOwnProperty.call(r,"_dispose"))return;let o=t._serverParams;return"object"==typeof o&&null!==o&&"string"==typeof o.command?o:void 0}(t):void 0;i=void 0===s?await p0(r,{...n,transport:t,transportKind:a}):await p1(r,t,s,n)}catch(r){throw await t.close().catch(()=>{}),pQ(t),r}if(pQ(t),await super.connect(t),"legacy"===i.era)return void await this._legacyHandshake(t,o);if(this._serverCapabilities=i.discover.capabilities,this._serverVersion=p4(i.discover),this._cache.setServerIdentity(this._deriveServerIdentity(t)),this._instructions=i.discover.instructions,this._discoverResult=i.discover,this._negotiatedProtocolVersion=i.version,t.setProtocolVersion&&t.setProtocolVersion(i.version),this._listChangedConfig){let t=this._listChangedConfig,r=this._serverCapabilities,i={...t.tools&&r?.tools?.listChanged&&{tools:t.tools},...t.prompts&&r?.prompts?.listChanged&&{prompts:t.prompts},...t.resources&&r?.resources?.listChanged&&{resources:t.resources}},a=!0;try{this._setupListChangedHandlers(i)}catch(t){a=!1,this.onerror?.(t instanceof Error?t:Error(String(t)))}let n=a?{...i.tools&&{toolsListChanged:!0},...i.prompts&&{promptsListChanged:!0},...i.resources&&{resourcesListChanged:!0}}:{};if(Object.keys(n).length>0){let t=new AbortController,r=()=>t.abort(o?.signal?.reason);o?.signal?.aborted&&r(),o?.signal?.addEventListener("abort",r);try{this._autoOpenedSubscription=await this.listen(n,{timeout:o?.timeout,signal:t.signal})}catch(t){if(o?.signal?.aborted)throw await this.close().catch(()=>{}),t;this.onerror?.(t instanceof Error?t:Error(String(t)))}finally{o?.signal?.removeEventListener("abort",r)}}}}async _connectFromPrior(t,r,o){if("legacy"===r.kind)return this._connectPlainLegacy(t,o);let i=r.discover;this._resetConnectionState();let a=this._supportedProtocolVersionsOption,n=(a&&lZ(a).length>0?lZ(a):lK).find(t=>i.supportedVersions.includes(t));if(void 0===n)throw new lV(lU.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(t),this._discoverResult=i,this._serverCapabilities=i.capabilities,this._serverVersion=p4(i),this._cache.setServerIdentity(this._deriveServerIdentity(t)),this._instructions=i.instructions,this._negotiatedProtocolVersion=n,t.setProtocolVersion?.(n),this._listChangedConfig)try{this._setupListChangedHandlers(this._listChangedConfig)}catch(t){this.onerror?.(t instanceof Error?t:Error(String(t)))}}getServerCapabilities(){return this._serverCapabilities}getServerVersion(){return this._serverVersion}_deriveServerIdentity(t){let r=this._serverVersion;return void 0!==r?`${r.name}@${r.version}`:t.sessionId??`anonymous:${Date.now()}-${Math.random().toString(36).slice(2)}`}getNegotiatedProtocolVersion(){return this._negotiatedProtocolVersion}getProtocolEra(){let t=this._negotiatedProtocolVersion;if(void 0!==t)return t>=lF?"modern":"legacy"}getInstructions(){return this._instructions}getDiscoverResult(){return this._discoverResult}assertCapabilityForMethod(t){switch(t){case"logging/setLevel":if(!this._serverCapabilities?.logging)throw new lV(lU.CapabilityNotSupported,`Server does not support logging (required for ${t})`);break;case"prompts/get":case"prompts/list":if(!this._serverCapabilities?.prompts)throw new lV(lU.CapabilityNotSupported,`Server does not support prompts (required for ${t})`);break;case"resources/list":case"resources/templates/list":case"resources/read":case"resources/subscribe":case"resources/unsubscribe":if(!this._serverCapabilities?.resources)throw new lV(lU.CapabilityNotSupported,`Server does not support resources (required for ${t})`);if("resources/subscribe"===t&&!this._serverCapabilities.resources.subscribe)throw new lV(lU.CapabilityNotSupported,`Server does not support resource subscriptions (required for ${t})`);break;case"tools/call":case"tools/list":if(!this._serverCapabilities?.tools)throw new lV(lU.CapabilityNotSupported,`Server does not support tools (required for ${t})`);break;case"completion/complete":if(!this._serverCapabilities?.completions)throw new lV(lU.CapabilityNotSupported,`Server does not support completions (required for ${t})`)}}assertNotificationCapability(t){if("notifications/roots/list_changed"===t&&!this._capabilities.roots?.listChanged)throw new lV(lU.CapabilityNotSupported,`Client does not support roots list changed notifications (required for ${t})`)}assertRequestHandlerCapability(t){switch(t){case"sampling/createMessage":if(!this._capabilities.sampling)throw new lV(lU.CapabilityNotSupported,`Client does not support sampling capability (required for ${t})`);break;case"elicitation/create":if(!this._capabilities.elicitation)throw new lV(lU.CapabilityNotSupported,`Client does not support elicitation capability (required for ${t})`);break;case"roots/list":if(!this._capabilities.roots)throw new lV(lU.CapabilityNotSupported,`Client does not support roots capability (required for ${t})`)}}async ping(t){return this.request({method:"ping"},t)}async discover(t){let r=await this._requestWithSchema({method:"server/discover"},nP,t);return this._discoverResult=r,r}async complete(t,r){return this.request({method:"completion/complete",params:t},r)}async setLoggingLevel(t,r){return this.request({method:"logging/setLevel",params:{level:t}},r)}async getPrompt(t,r){return this.request({method:"prompts/get",params:t},r)}async listPrompts(t,r){if(!this._serverCapabilities?.prompts&&!this._enforceStrictCapabilities)return console.debug("Client.listPrompts() called but server does not advertise prompts capability - returning empty list"),{prompts:[]};if(t?.cursor!==void 0)return this.request({method:"prompts/list",params:t},r);let o=await this._serveFromCache("prompts/list",void 0,r);return void 0!==o?o:this._listAllPages("prompts/list",t,r,(t,r)=>t.prompts.push(...r.prompts))}async listResources(t,r){if(!this._serverCapabilities?.resources&&!this._enforceStrictCapabilities)return console.debug("Client.listResources() called but server does not advertise resources capability - returning empty list"),{resources:[]};if(t?.cursor!==void 0)return this.request({method:"resources/list",params:t},r);let o=await this._serveFromCache("resources/list",void 0,r);return void 0!==o?o:this._listAllPages("resources/list",t,r,(t,r)=>t.resources.push(...r.resources))}async listResourceTemplates(t,r){if(!this._serverCapabilities?.resources&&!this._enforceStrictCapabilities)return console.debug("Client.listResourceTemplates() called but server does not advertise resources capability - returning empty list"),{resourceTemplates:[]};if(t?.cursor!==void 0)return this.request({method:"resources/templates/list",params:t},r);let o=await this._serveFromCache("resources/templates/list",void 0,r);return void 0!==o?o:this._listAllPages("resources/templates/list",t,r,(t,r)=>t.resourceTemplates.push(...r.resourceTemplates))}async _listAllPages(t,r,o,i,a){let n=o?.cacheMode==="bypass",s=this._cache.captureGeneration(t),l=await this.request({method:t,...r&&{params:{...r}}},o),c=l.nextCursor,u=new Set,d=1;for(;void 0!==c&&!u.has(c);){if(0!==this._listMaxPages&&d>=this._listMaxPages)throw new lV(lU.ListPaginationExceeded,`${t}: exceeded listMaxPages (${this._listMaxPages}); server pagination did not terminate`,{method:t,listMaxPages:this._listMaxPages});u.add(c);let a=await this.request({method:t,params:{...r,cursor:c}},o);i(l,a),c=a.nextCursor,d++}return delete l.nextCursor,a?.(l),n||await this._cache.write(t,l,s,this._freshness(l)),l}_freshness(t,r){let o="number"==typeof t.ttlMs?t.ttlMs:this._defaultCacheTtlMs,i="public"===t.cacheScope?"public":"private";return{expiresAt:this._cache.now()+Math.min(Math.max(0,o),864e5),scope:i,params:r}}async _serveFromCache(t,r,o){if(o?.cacheMode==="bypass"||o?.cacheMode==="refresh")return;let i=await this._cache.read(t,r).catch(t=>void this._reportStoreError(t));if(void 0!==i){if(o?.signal?.aborted){let t=o.signal.reason;throw t instanceof lV?t:new lV(lU.RequestTimeout,String(t))}return i.value}}_reportStoreError(t){this.onerror?.(t instanceof Error?t:Error(String(t)))}_compileOutputValidator(t){if(t.outputSchema)try{return{ok:!0,validator:this._jsonSchemaValidator.getValidator(t.outputSchema)}}catch(t){return{ok:!1,compileError:t}}}async _resolveXMcpHeaderScan(t,r){let o=r??await this._cache.toolDefinition(t);return void 0===o?void 0:cU(o.inputSchema)}async readResource(t,r){let o=await this._serveFromCache("resources/read",t.uri,r);if(void 0!==o)return o;let i=this._cache.captureGeneration("resources/read",t.uri),a=await this.request({method:"resources/read",params:t},r);if(r?.cacheMode!=="bypass"){let o=this._freshness(a,t.uri);o.expiresAt>this._cache.now()?await this._cache.write("resources/read",a,i,o):r?.cacheMode==="refresh"&&await this._cache.evictKey("resources/read",t.uri)}return a}async subscribeResource(t,r){return this.request({method:"resources/subscribe",params:t},r)}async unsubscribeResource(t,r){return this.request({method:"resources/unsubscribe",params:t},r)}async listen(t,r){let o,i,a,n,s;if(void 0===this.transport)throw new lV(lU.NotConnected,"Not connected");let l=this._negotiatedProtocolVersion;if(void 0===l||!(l>=lF))throw new lV(lU.MethodNotSupportedByProtocolVersion,`subscriptions/listen requires a 2026-07-28-era connection (negotiated: ${l??"none"}). On a 2025-era connection, change notifications are delivered unsolicited: use ClientOptions.listChanged and resources/subscribe instead.`,{method:"subscriptions/listen",protocolVersion:l});if(r?.signal?.aborted){let t=r.signal.reason;throw t instanceof lV?t:new lV(lU.RequestTimeout,String(t))}let c=new AbortController,u=`listen:${this._nextListenId++}`,d="opening",p=new Promise((t,r)=>{a=t,n=r}),h=new Promise(t=>{s=t}),m=t=>{if("closed"===d)return;let l="opening"===d;if(void 0!==o&&(clearTimeout(o),o=void 0),"ack"in t){d="open",a(t.ack);return}d="closed",void 0!==i&&r?.signal?.removeEventListener("abort",i),this._listenState.delete(u),c.abort(),s(t.cause),l&&n(t.error??new lV(lU.ConnectionClosed,"subscriptions/listen closed before the server acknowledged"))},f=async()=>{c.abort(),await this.notification({method:"notifications/cancelled",params:{requestId:u}}).catch(()=>{})},y=async()=>{"closed"!==d&&(m({cause:"local"}),await f())};this._listenState.set(u,{settle:m});let g=r?.timeout??6e4;if(o=setTimeout(()=>{m({cause:"remote",error:new lV(lU.RequestTimeout,"subscriptions/listen ack timed out",{timeout:g})}),f().catch(()=>{})},g),r?.signal){let t=r.signal;i=()=>{if("closed"===d)return;let r=t.reason;m({cause:"local",error:r instanceof Error?r:Error(String(r??"Aborted"))}),f().catch(()=>{})},t.addEventListener("abort",i,{once:!0})}let v={jsonrpc:"2.0",id:u,method:"subscriptions/listen",params:{_meta:{...this._outboundMetaEnvelope()},notifications:t}};try{await this.transport.send(v,{requestSignal:c.signal,onRequestStreamEnd:()=>m({cause:"remote",error:Error("subscriptions/listen: stream ended")})})}catch(t){m({cause:"remote",error:t instanceof Error?t:Error(String(t))})}return{honoredFilter:await p,close:y,closed:h}}get autoOpenedSubscription(){return this._autoOpenedSubscription}_onnotification(t,r){let o=Object.hasOwn(p5,t.method)?p5[t.method]:void 0;if("notifications/resources/updated"===t.method){let r=t.params?.uri;"string"==typeof r&&this._cache.evictKey("resources/read",r)}else if(void 0!==o)for(let t of o)this._cache.evict(t);if("notifications/subscriptions/acknowledged"===t.method){let r=t.params?._meta?.[aJ],o="string"==typeof r?this._listenState.get(r):void 0;if(void 0!==o){let r=this._wireCodec().validateNotification("notifications/subscriptions/acknowledged",t);o.settle({ack:r.ok?r.value.params.notifications:{}});return}}if("notifications/cancelled"===t.method){let r=t.params?.requestId,o="string"==typeof r?this._listenState.get(r):void 0;if(void 0!==o)return void o.settle({cause:"remote",error:Error("subscriptions/listen: server cancelled the subscription")})}super._onnotification(t,r)}_onresponse(t){let r=t.id,o="string"==typeof r?this._listenState.get(r):void 0;void 0!==o?cz(t)?o.settle({cause:"remote",error:cc.fromError(t.error.code,t.error.message,t.error.data)}):o.settle({cause:"graceful",error:new lV(lU.ConnectionClosed,"subscriptions/listen: server closed the subscription gracefully before acknowledging")}):super._onresponse(t)}_onclose(){if(this._listenState.size>0){let t=new lV(lU.ConnectionClosed,"Connection closed");for(let r of this._listenState.values())r.settle({cause:"remote",error:t});this._listenState.clear()}super._onclose()}async callTool(t,r){let o,i="modern"===this.getProtocolEra()&&"browser"!==pB(),a=async()=>{let o;if(!i)return r;try{o=await this._resolveXMcpHeaderScan(t.name,r?.toolDefinition)}catch(t){this._reportStoreError(t)}if(!o?.valid||0===o.declarations.length)return r;let a=function(t,r){let o={};for(let i of t){let t=function(t,r){let o=t;for(let t of r){if(null===o||"object"!=typeof o)return;o=o[t]}return o}(r,i.path);if(null==t)continue;let a=function(t){if("string"==typeof t)return t;if("boolean"==typeof t)return t?"true":"false";if("number"==typeof t){if(!Number.isFinite(t)||Number.isInteger(t)&&!Number.isSafeInteger(t))return;return String(t)}}(t);void 0!==a&&(o[`Mcp-Param-${i.headerName}`]=cJ(a))}return o}(o.declarations,t.arguments);return 0===Object.keys(a).length?r:{...r,headers:{...r?.headers,...a}}},n=r?.toolDefinition===void 0?await this._cache.outputValidator(t.name,t=>this._compileOutputValidator(t)).catch(t=>void this._reportStoreError(t)):this._compileOutputValidator(r.toolDefinition),s=()=>{if(void 0===n||n.ok)return;let r=n.compileError,o=(r instanceof Error?r.message:String(r)).slice(0,200);throw new cc(cl.InvalidParams,`Tool '${t.name}' has an invalid outputSchema: ${o}`)};s();try{o=await this.request({method:"tools/call",params:t},await a())}catch(u){let l=u instanceof cc&&-32020===u.code;if(!i||!l||r?.toolDefinition!==void 0)throw u;let c={signal:r?.signal,timeout:r?.timeout,cacheMode:"refresh"};await this._cache.evict("tools/list"),await this.listTools(void 0,c).catch(t=>this._reportStoreError(t)),n=await this._cache.outputValidator(t.name,t=>this._compileOutputValidator(t)).catch(t=>void this._reportStoreError(t)),s(),o=await this.request({method:"tools/call",params:t},await a())}let l=void 0!==n&&n.ok?n.validator:void 0;if(l){if(void 0===o.structuredContent&&!o.isError)throw new cc(cl.InvalidRequest,`Tool ${t.name} has an output schema but did not return structured content`);if(void 0!==o.structuredContent&&!o.isError)try{let t=l(o.structuredContent);if(!t.valid)throw new cc(cl.InvalidParams,`Structured content does not match the tool's output schema: ${t.errorMessage}`)}catch(t){if(t instanceof cc)throw t;throw new cc(cl.InvalidParams,`Failed to validate structured content: ${t instanceof Error?t.message:String(t)}`)}}return o}async listTools(t,r){if(!this._serverCapabilities?.tools&&!this._enforceStrictCapabilities)return console.debug("Client.listTools() called but server does not advertise tools capability - returning empty list"),{tools:[]};if(t?.cursor!==void 0){let o=await this.request({method:"tools/list",params:t},r);return this._excludeInvalidXMcpHeaderTools(o),o}let o=await this._serveFromCache("tools/list",void 0,r);return void 0!==o?o:this._listAllPages("tools/list",t,r,(t,r)=>t.tools.push(...r.tools),t=>this._excludeInvalidXMcpHeaderTools(t))}_excludeInvalidXMcpHeaderTools(t){if("modern"!==this.getProtocolEra()||!this.transport||"stdio"===pG(this.transport))return;let r=t.tools.filter(t=>{let r=cU(t.inputSchema);return!!r.valid||(console.warn(`[mcp-sdk] excluding tool '${t.name}' from tools/list: invalid x-mcp-header declaration — ${r.reason}`),!1)});r.length!==t.tools.length&&(t.tools=r)}_setupListChangedHandler(t,r,o,i){let a=im(sS,o);if(!a.success)throw Error(`Invalid ${t} listChanged options: ${a.error.message}`);if("function"!=typeof o.onChanged)throw TypeError(`Invalid ${t} listChanged options: onChanged must be a function`);let{autoRefresh:n,debounceMs:s}=a.data,{onChanged:l}=o,c=async()=>{if(!n)return void l(null,null);try{l(null,await i())}catch(t){l(t instanceof Error?t:Error(String(t)),null)}},u=()=>{if(s){let r=this._listChangedDebounceTimers.get(t);r&&clearTimeout(r);let o=setTimeout(c,s);this._listChangedDebounceTimers.set(t,o)}else c()};this.setNotificationHandler(r,u)}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}};(class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SseError"})}static[Symbol.hasInstance](t){return lM(this,t)}static isInstance(t){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 lM(this,t)}constructor(t,r,o){super(`SSE error: ${r}`),this.code=t,this.event=o,lq(this,new.target)}});let p6={initialReconnectionDelay:1e3,maxReconnectionDelay:3e4,reconnectionDelayGrowFactor:1.5,maxRetries:2},p8=new Set(["authorization","content-type","mcp-protocol-version","mcp-method","mcp-name","mcp-session-id"]);function p7(t,r){if("function"==typeof AbortSignal.any)return AbortSignal.any([t,r]);let o=new AbortController;if(t.aborted)return o.abort(t.reason),o.signal;if(r.aborted)return o.abort(r.reason),o.signal;let i=()=>{t.removeEventListener("abort",a),r.removeEventListener("abort",n)};function a(){i(),o.abort(t.reason)}function n(){i(),o.abort(r.reason)}return t.addEventListener("abort",a,{once:!0}),r.addEventListener("abort",n,{once:!0}),o.signal}var he=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(t,r){this._url=t,this._resourceMetadataUrl=void 0,this._scope=void 0,this._requestInit=r?.requestInit,this._skipIssuerMetadataValidation=r?.skipIssuerMetadataValidation,function(t){return null!=t&&"function"==typeof t.tokens&&"function"==typeof t.clientInformation}(r?.authProvider)?(this._oauthProvider=r.authProvider,this._authProvider=function(t,r){return{token:async()=>(await t.tokens())?.access_token,onUnauthorized:async o=>ph(t,o,r)}}(r.authProvider,{skipIssuerMetadataValidation:r.skipIssuerMetadataValidation})):this._authProvider=r?.authProvider,this._fetch=r?.fetch,this._fetchWithInit=function(t=fetch,r){return r?async(o,i)=>t(o,{...r,...i,headers:i?.headers?{...up(r.headers),...up(i.headers)}:r.headers}):t}(r?.fetch,r?.requestInit),this._sessionId=r?.sessionId,this._protocolVersion=r?.protocolVersion,this._reconnectionOptions=r?.reconnectionOptions??p6,this._reconnectionScheduler=r?.reconnectionScheduler,this._onInsufficientScope=r?.onInsufficientScope??"reauthorize",this._maxStepUpRetries=Math.max(0,r?.maxStepUpRetries??1)}async _stepUpAuthorize(t,r){try{return await this._stepUpAuthorizeInner(t,r)}catch(t){throw pK(t)}}async _stepUpAuthorizeInner(t,r){if("throw"===this._onInsufficientScope||!this._oauthProvider)throw new pu({requiredScope:t.scope,resourceMetadataUrl:t.resourceMetadataUrl,errorDescription:t.errorDescription});if(r>=this._maxStepUpRetries)throw new lH(lU.ClientHttpForbidden,`Server returned 403 insufficient_scope after step-up re-authorization (retry limit ${this._maxStepUpRetries} reached)`,{status:403,statusText:t.statusText??"Forbidden",text:t.text});t.resourceMetadataUrl&&(this._resourceMetadataUrl=t.resourceMetadataUrl);let o=await this._oauthProvider.tokens(),i=pg(this._scope,o?.scope,t.scope);this._scope=i;let a=function(t,r){if(!t)return!1;let o=new Set((r??"").split(/\s+/).filter(Boolean));for(let r of t.split(/\s+/))if(r&&!o.has(r))return!0;return!1}(i,o?.scope);return p$(this._oauthProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:i,forceReauthorization:a,fetchFn:this._fetchWithInit,skipIssuerMetadataValidation:this._skipIssuerMetadataValidation})}async _commonHeaders(){let t,r={};try{t=await this._authProvider?.token()}catch(t){throw pK(t)}t&&(r.Authorization=`Bearer ${t}`),this._sessionId&&(r["mcp-session-id"]=this._sessionId),this._protocolVersion&&(r["mcp-protocol-version"]=this._protocolVersion);let o=up(this._requestInit?.headers);return new Headers({...r,...o})}_applyBodyDerivedHeaders(t,r){let o;if(Array.isArray(r)||(o=r,!ne.safeParse(o).success))return;let i=r.params?._meta?.[aV];if("string"!=typeof i)return;t.set("mcp-protocol-version",i),t.set("mcp-method",r.method);let a=r.params,n="resources/read"===r.method?"string"==typeof a?.uri?a.uri:void 0:"string"==typeof a?.name?a.name:void 0;void 0!==n&&t.set("mcp-name",cJ(n))}_isModernEnvelopedRequest(t){let r;if(Array.isArray(t)||(r=t,!ne.safeParse(r).success))return!1;let o=t.params?._meta?.[aV];return"string"==typeof o&&o>=lF}async _startOrAuthSse(t,r=!1,o=0){let{resumptionToken:i,requestSignal:a}=t,n=()=>this._abortController?.signal.aborted===!0||a?.aborted===!0;try{let n=await this._commonHeaders(),s=[...n.get("accept")?.split(",").map(t=>t.trim().toLowerCase())??[],"text/event-stream"];n.set("accept",[...new Set(s)].join(", ")),i&&n.set("last-event-id",i);let l=this._abortController?.signal,c=void 0!==a&&void 0!==l?p7(l,a):a??l,u=await (this._fetch??fetch)(this._url,{...this._requestInit,method:"GET",headers:n,signal:c});if(!u.ok){if(401===u.status&&this._authProvider){if(u.headers.has("www-authenticate")){let{resourceMetadataUrl:t,scope:r}=pE(u);this._resourceMetadataUrl=t,this._scope=pg(this._scope,r)}if(this._authProvider.onUnauthorized&&!r){try{await this._authProvider.onUnauthorized({response:u,serverUrl:this._url,fetchFn:this._fetchWithInit})}catch(t){throw pK(t)}return await u.text?.().catch(()=>{}),this._startOrAuthSse(t,!0,o)}if(await u.text?.().catch(()=>{}),r)throw pK(new lH(lU.ClientHttpAuthentication,"Server returned 401 after re-authentication",{status:401,statusText:u.statusText}));throw pK(new pm)}if(403===u.status){let{resourceMetadataUrl:i,scope:a,error:n,errorDescription:s}=pE(u);if("insufficient_scope"===n){let n=await u.text?.().catch(()=>null);if(await this._stepUpAuthorize({scope:a,resourceMetadataUrl:i,errorDescription:s,statusText:u.statusText,text:n},o)!=="AUTHORIZED")throw pK(new pm);return this._startOrAuthSse(t,r,o+1)}}if(await u.text?.().catch(()=>{}),405===u.status)return void t.onRequestStreamEnd?.();throw new lH(lU.ClientHttpFailedToOpenStream,`Failed to open SSE stream: ${u.statusText}`,{status:u.status,statusText:u.statusText})}this._handleSseStream(u.body,t,!0)}catch(t){throw n()||this.onerror?.(t),t}}_getNextReconnectionDelay(t){if(void 0!==this._serverRetryMs)return this._serverRetryMs;let r=this._reconnectionOptions.initialReconnectionDelay,o=this._reconnectionOptions.reconnectionDelayGrowFactor;return Math.min(r*Math.pow(o,t),this._reconnectionOptions.maxReconnectionDelay)}_scheduleReconnection(t,r=0){let o=this._reconnectionOptions.maxRetries;if(r>=o){this.onerror?.(Error(`Maximum reconnection attempts (${o}) exceeded.`)),t.onRequestStreamEnd?.();return}let i=this._getNextReconnectionDelay(r),a=()=>{this._cancelReconnection=void 0,this._abortController?.signal.aborted||t.requestSignal?.aborted||this._startOrAuthSse(t).catch(o=>{if(!(this._abortController?.signal.aborted||t.requestSignal?.aborted)){this.onerror?.(Error(`Failed to reconnect SSE stream: ${o instanceof Error?o.message:String(o)}`));try{this._scheduleReconnection(t,r+1)}catch(t){this.onerror?.(t instanceof Error?t:Error(String(t)))}}})};if(this._reconnectionScheduler){let t=this._reconnectionScheduler(a,i,r);this._cancelReconnection="function"==typeof t?t:void 0}else{let t=setTimeout(a,i);this._cancelReconnection=()=>clearTimeout(t)}}_handleSseStream(t,r,o){let i;if(!t)return void r.onRequestStreamEnd?.();let{onresumptiontoken:a,replayMessageId:n,requestSignal:s,onRequestStreamEnd:l}=r,c=()=>this._abortController?.signal.aborted===!0||s?.aborted===!0,u=!1,d=!1;(async()=>{try{let r=t.pipeThrough(new TextDecoderStream).pipeThrough(new pi({onRetry:t=>{this._serverRetryMs=t}})).getReader();for(;;){let{value:t,done:o}=await r.read();if(o)break;if((t.id&&(i=t.id,u=!0,a?.(t.id)),t.data)&&(!t.event||"message"===t.event))try{let r=ni.parse(JSON.parse(t.data));(cA(r)||cz(r))&&(d=!0,void 0!==n&&(r.id=n)),this.onmessage?.(r)}catch(t){this.onerror?.(t)}}(o||u)&&!d&&this._abortController&&!c()?this._scheduleReconnection({resumptionToken:i,onresumptiontoken:a,replayMessageId:n,requestSignal:s,onRequestStreamEnd:l},0):c()||l?.()}catch(t){if(c())return;if(this.onerror?.(Error(`SSE stream disconnected: ${t}`)),(o||u)&&!d&&this._abortController&&!c())try{this._scheduleReconnection({resumptionToken:i,onresumptiontoken:a,replayMessageId:n,requestSignal:s,onRequestStreamEnd:l},0)}catch(t){this.onerror?.(Error(`Failed to reconnect: ${t instanceof Error?t.message:String(t)}`)),l?.()}else l?.()}})()}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(t,r){if(!this._oauthProvider)throw new pm("finishAuth requires an OAuthClientProvider");let{authorizationCode:o,iss:i}=await pv(t,r,this._oauthProvider,this._url,{fetchFn:this._fetchWithInit,resourceMetadataUrl:this._resourceMetadataUrl});if(await p$(this._oauthProvider,{serverUrl:this._url,authorizationCode:o,iss:i,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit,skipIssuerMetadataValidation:this._skipIssuerMetadataValidation})!=="AUTHORIZED")throw new pm("Failed to authorize")}async close(){try{this._cancelReconnection?.()}finally{this._cancelReconnection=void 0,this._abortController?.abort(),this.onclose?.()}}async send(t,r){return this._send(t,r,!1)}async _send(t,r,o,i=0){try{let a,{resumptionToken:n,onresumptiontoken:s}=r||{};if(n){let o;return void this._startOrAuthSse({resumptionToken:n,replayMessageId:(o=t,ne.safeParse(o).success)?t.id:void 0,requestSignal:r?.requestSignal}).catch(t=>this.onerror?.(t))}let l=await this._commonHeaders();this._applyBodyDerivedHeaders(l,t);let c=Array.isArray(t)?t.some(t=>{let r;return r=t,n_.safeParse(r).success}):(a=t,n_.safeParse(a).success);if(c&&l.delete("mcp-session-id"),r?.headers!==void 0)for(let[t,o]of Object.entries(r.headers))p8.has(t.toLowerCase())||l.set(t,o);l.set("content-type","application/json");let u=[...l.get("accept")?.split(",").map(t=>t.trim().toLowerCase())??[],"application/json","text/event-stream"];l.set("accept",[...new Set(u)].join(", "));let d=this._abortController?.signal,p=r?.requestSignal!==void 0&&void 0!==d?p7(d,r.requestSignal):r?.requestSignal??d,h={...this._requestInit,method:"POST",headers:l,body:JSON.stringify(t),signal:p},m=await (this._fetch??fetch)(this._url,h);if(c&&m.ok&&(this._sessionId=m.headers.get("mcp-session-id")||void 0),!m.ok){if(401===m.status&&this._authProvider){if(m.headers.has("www-authenticate")){let{resourceMetadataUrl:t,scope:r}=pE(m);this._resourceMetadataUrl=t,this._scope=pg(this._scope,r)}if(this._authProvider.onUnauthorized&&!o){try{await this._authProvider.onUnauthorized({response:m,serverUrl:this._url,fetchFn:this._fetchWithInit})}catch(t){throw pK(t)}return await m.text?.().catch(()=>{}),this._send(t,r,!0,i)}if(await m.text?.().catch(()=>{}),o)throw pK(new lH(lU.ClientHttpAuthentication,"Server returned 401 after re-authentication",{status:401,statusText:m.statusText}));throw pK(new pm)}let a=await m.text?.().catch(()=>null);if(403===m.status){let{resourceMetadataUrl:n,scope:s,error:l,errorDescription:c}=pE(m);if("insufficient_scope"===l){if(await this._stepUpAuthorize({scope:s,resourceMetadataUrl:n,errorDescription:c,statusText:m.statusText,text:a},i)!=="AUTHORIZED")throw pK(new pm);return this._send(t,r,o,i+1)}}if(400===m.status&&"string"==typeof a&&this._isModernEnvelopedRequest(t))try{let r=ni.parse(JSON.parse(a)),o=(Array.isArray(t)?t:[t]).filter(t=>{let r;return r=t,ne.safeParse(r).success});if(cz(r)&&o.some(t=>t.id===r.id))return void this.onmessage?.(r)}catch{}throw new lH(lU.ClientHttpNotImplemented,`Error POSTing to endpoint: ${a}`,{status:m.status,statusText:m.statusText,text:a})}if(202===m.status){let r;await m.text?.().catch(()=>{}),r=t,nw.safeParse(r).success&&this._startOrAuthSse({resumptionToken:void 0}).catch(t=>this.onerror?.(t));return}let f=(Array.isArray(t)?t:[t]).some(t=>"method"in t&&"id"in t&&void 0!==t.id),y=m.headers.get("content-type"),g=function(t){if(t)try{return uu.parse(t).type}catch{let r=(t.split(";",1)[0]??"").trim().toLowerCase();if(""===r||t.slice(r.length).includes(","))return;return r}}(y);if(f)if("text/event-stream"===g)this._handleSseStream(m.body,{onresumptiontoken:s,requestSignal:r?.requestSignal,onRequestStreamEnd:r?.onRequestStreamEnd},!1);else if("application/json"===g){let t=await m.json();for(let r of Array.isArray(t)?t.map(t=>ni.parse(t)):[ni.parse(t)])this.onmessage?.(r)}else throw await m.text?.().catch(()=>{}),new lV(lU.ClientHttpUnexpectedContent,`Unexpected content type: ${y}`,{contentType:y});else await m.text?.().catch(()=>{})}catch(t){throw r?.requestSignal?.aborted!==!0&&this.onerror?.(t),t}}get sessionId(){return this._sessionId}async terminateSession(){if(this._sessionId)try{let t=await this._commonHeaders(),r={...this._requestInit,method:"DELETE",headers:t,signal:this._abortController?.signal},o=await (this._fetch??fetch)(this._url,r);if(await o.text?.().catch(()=>{}),!o.ok&&405!==o.status)throw new lH(lU.ClientHttpFailedToTerminateSession,`Failed to terminate session: ${o.statusText}`,{status:o.status,statusText:o.statusText});this._sessionId=void 0}catch(t){throw this.onerror?.(t),t}}setProtocolVersion(t){this._protocolVersion=t}get protocolVersion(){return this._protocolVersion}async resumeStream(t,r){await this._startOrAuthSse({resumptionToken:t,onresumptiontoken:r?.onresumptiontoken})}};let ht=require("node:process"),hr=require("node:stream");var ho=a(6507);let hi="win32"===ht.platform?["APPDATA","HOMEDRIVE","HOMEPATH","LOCALAPPDATA","PATH","PROCESSOR_ARCHITECTURE","SYSTEMDRIVE","SYSTEMROOT","TEMP","USERNAME","USERPROFILE","PROGRAMFILES"]:["HOME","LOGNAME","PATH","SHELL","TERM","USER"];var ha=class{_process;_readBuffer;_serverParams;_stderrStream=null;onclose;onerror;onmessage;constructor(t){this._serverParams=t,this._readBuffer=new ud({maxBufferSize:t.maxBufferSize}),("pipe"===t.stderr||"overlapped"===t.stderr)&&(this._stderrStream=new hr.PassThrough)}async start(){if(this._process)throw Error("StdioClientTransport already started! If using Client class, note that connect() calls start() automatically.");return new Promise((t,r)=>{this._process=ho(this._serverParams.command,this._serverParams.args??[],{env:{...function(){let t={};for(let r of hi){let o=ht.env[r];void 0!==o&&(o.startsWith("()")||(t[r]=o))}return t}(),...this._serverParams.env},stdio:["pipe","pipe",this._serverParams.stderr??"inherit"],shell:!1,windowsHide:"win32"===ht.platform,cwd:this._serverParams.cwd}),this._process.on("error",t=>{r(t),this.onerror?.(t)}),this._process.on("spawn",()=>{t()}),this._process.on("close",t=>{this._process=void 0,this.onclose?.()}),this._process.stdin?.on("error",t=>{this.onerror?.(t)}),this._process.stdout?.on("data",t=>{try{this._readBuffer.append(t),this.processReadBuffer()}catch(t){this.onerror?.(t),this.close().catch(()=>{})}}),this._process.stdout?.on("error",t=>{this.onerror?.(t)}),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 t=this._readBuffer.readMessage();if(null===t)break;this.onmessage?.(t)}catch(t){this.onerror?.(t)}}async _dispose(){let t=this._process;if(this._process=void 0,t&&null===t.exitCode&&null===t.signalCode){let r=new Promise(r=>t.once("exit",()=>r()));try{t.stdin?.end()}catch{}try{t.kill("SIGTERM")}catch{}if(await Promise.race([r,new Promise(t=>setTimeout(t,1e3).unref())]),null===t.exitCode&&null===t.signalCode)try{t.kill("SIGKILL")}catch{}await r}try{t?.stdout?.destroy()}catch{}try{t?.stdin?.destroy()}catch{}try{t?.stderr?.destroy()}catch{}this._readBuffer.clear()}async close(){if(this._process){let t=this._process;this._process=void 0;let r=new Promise(r=>{t.once("close",()=>{r()})});try{t.stdin?.end()}catch{}if(await Promise.race([r,new Promise(t=>setTimeout(t,2e3).unref())]),null===t.exitCode){try{t.kill("SIGTERM")}catch{}await Promise.race([r,new Promise(t=>setTimeout(t,2e3).unref())])}if(null===t.exitCode)try{t.kill("SIGKILL")}catch{}}this._readBuffer.clear()}send(t){return new Promise(r=>{if(!this._process?.stdin)throw new lV(lU.NotConnected,"Not connected");let o=JSON.stringify(t)+"\n";this._process.stdin.write(o)?r():this._process.stdin.once("drain",r)})}};let hn=a(8330),hs={name:hn.name,version:hn.version};async function hl(t,r={}){var o;let i,a,{handlers:n={}}=r,s={};n.sampling&&(s.sampling={}),n.elicitation&&(s.elicitation={form:{},url:{}}),n.roots&&(s.roots={});let l=new p3(hs,{capabilities:s,versionNegotiation:r.versionNegotiation??{mode:"auto"}});n.sampling&&l.setRequestHandler("sampling/createMessage",n.sampling),n.elicitation&&l.setRequestHandler("elicitation/create",n.elicitation),n.roots&&l.setRequestHandler("roots/list",n.roots);let c="http"===t.type?new he(new URL(t.url),{requestInit:{headers:(o=t.headers??[],a={},o.forEach(t=>{let r,o=t.name.trim();if("env"in(r=t)&&"string"==typeof r.env){let r=process.env[t.env];if(void 0===r)throw Error(`Environment variable "${t.env}" is not set (required for header "${o}")`);a[o]=r}else a[o]=t.value.trim()}),a)}}):new ha({command:t.command,args:t.args,env:t.env,cwd:t.cwd,stderr:t.stderr??(r.onStderrData?"pipe":"inherit")});c instanceof ha&&c.stderr?.on("data",r.onStderrData??(t=>{process.stderr.write(t)}));let u=c.close.bind(c);c.close=()=>i??(i=u());let d=l.close.bind(l);l.close=async()=>{try{await d()}finally{await c.close()}};let p=r.connect?.signal,h=()=>{c.close().catch(()=>{})};try{return p?.throwIfAborted(),p?.addEventListener("abort",h,{once:!0}),await l.connect(c,r.connect),p?.throwIfAborted(),l}catch(t){try{await l.close()}catch(r){throw AggregateError([t,r],"Client connection and cleanup failed",{cause:t})}throw p?.throwIfAborted(),t}finally{p?.removeEventListener("abort",h)}}async function hc(t,r,o){let i=await hl(t,o);try{return await r(i)}finally{await i.close()}}})(),exports.createClient=n.createClient,exports.withClient=n.withClient,n)-1===["createClient","withClient"].indexOf(s)&&(exports[s]=n[s]);Object.defineProperty(exports,"__esModule",{value:!0})})();
|